view rathaxes_rename_pci_device_to_pci_abstractdevice.patch @ 96:3e715b3e0ecd

Start a series to cleanup/refactor the e1000 sample a little bit
author Louis Opter <louis@lse.epita.fr>
date Sun, 18 Nov 2012 02:19:07 +0100
parents
children e2c237d6c37b
line wrap: on
line source

# HG changeset patch
# Parent 71f853429e57cb8926fb03e2cacf04a45ad4e8dd
rathaxes: rename PCI::Device to PCI::AbstractDevice in the e1000 sample

To respect my "new" convention of prefixing Rathaxes types that just map
types from the kernel with "Abstract".


diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt
--- a/rathaxes/samples/e1000/e1000.blt
+++ b/rathaxes/samples/e1000/e1000.blt
@@ -479,7 +479,7 @@
 
     template sequence   e1000::create_device()
     {
-        chunk Ethernet::create_device(PCI::Device pdev, Ethernet::Device rtx_ether_ctx)
+        chunk Ethernet::create_device(PCI::AbstractDevice pdev, Ethernet::Device rtx_ether_ctx)
         {
             /*
              * PCI init stuff:
@@ -547,7 +547,7 @@
 
     template sequence   e1000::destroy_device()
     {
-        chunk   Ethernet::destroy_device(PCI::Device pdev, Ethernet::Device rtx_ether_ctx)
+        chunk   Ethernet::destroy_device(PCI::AbstractDevice pdev, Ethernet::Device rtx_ether_ctx)
         {
             /*
              * Here, we should have some checks to avoid to free resources that
diff --git a/rathaxes/samples/e1000/e1000.rti b/rathaxes/samples/e1000/e1000.rti
--- a/rathaxes/samples/e1000/e1000.rti
+++ b/rathaxes/samples/e1000/e1000.rti
@@ -78,13 +78,13 @@
 
     provided sequence   create_device()
     {
-        provided chunk  Ethernet::create_device(PCI::Device, Ethernet::Device);
+        provided chunk  Ethernet::create_device(PCI::AbstractDevice, Ethernet::Device);
         provided chunk  ::CALL();
     }
 
     provided sequence   destroy_device()
     {
-        provided chunk  Ethernet::destroy_device(PCI::Device, Ethernet::Device);
+        provided chunk  Ethernet::destroy_device(PCI::AbstractDevice, Ethernet::Device);
         provided chunk  ::CALL();
     }
 
diff --git a/rathaxes/samples/e1000/ethernet.blt b/rathaxes/samples/e1000/ethernet.blt
--- a/rathaxes/samples/e1000/ethernet.blt
+++ b/rathaxes/samples/e1000/ethernet.blt
@@ -86,7 +86,7 @@
             typedef struct rtx_ethernet_dev
             {
                 /*
-                 * I think it's useless to use the ${PCI::Device} "abstraction"
+                 * I think it's useless to use the ${PCI::AbstractDevice} "abstraction"
                  * here, since we already are in a Linux specific context.
                  */
                 struct pci_dev          *pci_dev;
@@ -100,7 +100,7 @@
             } *rtx_ethernet_dev_p;
         }
 
-        chunk ::init(Ethernet::AbstractDevice net_dev, PCI::Device pci_dev)
+        chunk ::init(Ethernet::AbstractDevice net_dev, PCI::AbstractDevice pci_dev)
         {
             ${self} = netdev_priv(${net_dev});
             /*
@@ -211,7 +211,7 @@
         }
 
         /* For now the type is not handled, so we just omit it (see #17) */
-        chunk PCI::pci_probe_hook(PCI::Device pdev)
+        chunk PCI::pci_probe_hook(PCI::AbstractDevice pdev)
         {
             /*
              * This typedef is needed to workaround a bug in CNorm __std__
@@ -262,7 +262,7 @@
 
     template sequence   Ethernet::exit()
     {
-        chunk   PCI::pci_remove_hook(PCI::Device pdev)
+        chunk   PCI::pci_remove_hook(PCI::AbstractDevice pdev)
         {
             /* workaround for cnorm unstrict */
             struct net_device *net_dev = pci_get_drvdata(${pdev});
diff --git a/rathaxes/samples/e1000/ethernet.rti b/rathaxes/samples/e1000/ethernet.rti
--- a/rathaxes/samples/e1000/ethernet.rti
+++ b/rathaxes/samples/e1000/ethernet.rti
@@ -17,16 +17,11 @@
         method      decl();
     }
 
-    /*
-     * Unlike PCI::Device, Ethernet::Device doesn't match the struct net_device
-     * from Linux. Ethernet::Device is the type that we use in the private
-     * field of the struct net_device.
-     */
     provided type   Device
     {
         chunk       LKM::includes();
         method      decl();
-        method      init(Ethernet::AbstractDevice, PCI::Device);
+        method      init(Ethernet::AbstractDevice, PCI::AbstractDevice);
         pointcut    Ethernet::SubContext();
     }
 
@@ -57,15 +52,15 @@
     provided sequence   init()
     {
         provided chunk  LKM::data();
-        provided chunk  PCI::pci_probe_hook(PCI::Device);
+        provided chunk  PCI::pci_probe_hook(PCI::AbstractDevice);
 
-        provided pointcut   Ethernet::create_device(PCI::Device, Ethernet::Device);
+        provided pointcut   Ethernet::create_device(PCI::AbstractDevice, Ethernet::Device);
     }
 
     provided sequence   exit()
     {
-        provided chunk  PCI::pci_remove_hook(PCI::Device);
+        provided chunk  PCI::pci_remove_hook(PCI::AbstractDevice);
 
-        provided pointcut   Ethernet::destroy_device(PCI::Device, Ethernet::Device);
+        provided pointcut   Ethernet::destroy_device(PCI::AbstractDevice, Ethernet::Device);
     }
 }
diff --git a/rathaxes/samples/e1000/pci.blt b/rathaxes/samples/e1000/pci.blt
--- a/rathaxes/samples/e1000/pci.blt
+++ b/rathaxes/samples/e1000/pci.blt
@@ -1,6 +1,6 @@
 with PCI, LKM, Log
 {
-    template type   PCI::Device()
+    template type   PCI::AbstractDevice()
     {
         chunk   LKM::includes()
         {
@@ -12,7 +12,7 @@
             struct pci_dev;
         }
 
-        chunk ::init(PCI::Device)
+        chunk ::init(PCI::AbstractDevice)
         {
         }
 
@@ -41,7 +41,7 @@
                     goto fail;
 
                 /* Use local. to reference a local C variable: */
-                ${cast local.pdev as PCI::Device};
+                ${cast local.pdev as PCI::AbstractDevice};
                 ${pointcut PCI::pci_probe_hook(local.pdev)};
 
                 return 0;
@@ -68,7 +68,7 @@
         {
             static void rtx_pci_remove(struct pci_dev *pdev)
             {
-                ${cast local.pdev as PCI::Device};
+                ${cast local.pdev as PCI::AbstractDevice};
                 ${pointcut PCI::pci_remove_hook(local.pdev)};
 
                 pci_disable_device(pdev);
diff --git a/rathaxes/samples/e1000/pci.rti b/rathaxes/samples/e1000/pci.rti
--- a/rathaxes/samples/e1000/pci.rti
+++ b/rathaxes/samples/e1000/pci.rti
@@ -1,10 +1,10 @@
 interface PCI : LKM
 {
-    provided type   PCI::Device
+    provided type   PCI::AbstractDevice
     {
         chunk       LKM::includes();
         method      decl();
-        method      init(PCI::Device);
+        method      init(PCI::AbstractDevice);
     }
 
     required variable Builtin::number  PCI::vendor_id;
@@ -28,7 +28,7 @@
         provided chunk  LKM::prototypes();
         provided chunk  LKM::code();
 
-        provided pointcut   PCI::pci_probe_hook(PCI::Device);
+        provided pointcut   PCI::pci_probe_hook(PCI::AbstractDevice);
     }
 
     provided sequence   remove()
@@ -36,6 +36,6 @@
         provided chunk  LKM::prototypes();
         provided chunk  LKM::code();
 
-        provided pointcut   PCI::pci_remove_hook(PCI::Device);
+        provided pointcut   PCI::pci_remove_hook(PCI::AbstractDevice);
     }
 }