diff rathaxes_change_the_abstract_type_notation_in_the_e1000_sample.patch @ 107:f42751b8ca99

Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
author Louis Opter <louis@lse.epita.fr>
date Sun, 24 Mar 2013 21:47:39 -0700
parents 976a4b87803f
children 7efe3212db3a
line wrap: on
line diff
--- a/rathaxes_change_the_abstract_type_notation_in_the_e1000_sample.patch	Mon Mar 25 01:17:56 2013 +0100
+++ b/rathaxes_change_the_abstract_type_notation_in_the_e1000_sample.patch	Sun Mar 24 21:47:39 2013 -0700
@@ -1,5 +1,5 @@
 # HG changeset patch
-# Parent f046837f963dcba715cebe8b6dc40e7bbe2ce598
+# Parent 6122a310f97196aadba20973d9218aa24528bd3d
 rathaxes: change the abstract type notation in the e1000 sample
 
 Starting with ra24db32bf134 Rathaxes types are generated differently: you
@@ -269,7 +269,7 @@
          }
  
          chunk LKM::includes()
-@@ -59,9 +59,15 @@
+@@ -59,11 +59,16 @@
              #include <linux/netdevice.h>
          }
  
@@ -280,13 +280,15 @@
 +
          map
          {
--            netdev:   ${self}->ndev;
+-            netdev: ${self}->ndev;
 +            k_net_dev: ((struct net_device *)${self});
+             /* This could be another init method for Ethernet::Device: */
+-            rtx_ether_ctx: netdev_priv(&${self}->ndev);
 +            rtx_ether_ctx: netdev_priv((struct net_device *)${self});
          }
      }
  
-@@ -88,25 +94,33 @@
+@@ -90,25 +95,33 @@
              #include <linux/etherdevice.h>
          }
  
@@ -327,7 +329,7 @@
          }
      }
  
-@@ -126,8 +140,17 @@
+@@ -128,8 +141,17 @@
          {
              static int  rtx_ethernet_open(struct net_device *dev)
              {
@@ -346,7 +348,7 @@
                  ${cast local.rtx_ether_ctx as Ethernet::Device};
  
                  int error;
-@@ -187,8 +210,13 @@
+@@ -189,8 +211,13 @@
          {
              static int  rtx_ethernet_close(struct net_device *dev)
              {
@@ -361,22 +363,15 @@
                  ${cast local.rtx_ether_ctx as Ethernet::Device};
  
                  /* TODO: change this pointcut into a pointcut/adapter/callback: */
-@@ -221,9 +249,13 @@
-         {
-             static enum irqreturn   rtx_ethernet_interrupt_handler(int irq, void *dev_id)
+@@ -225,6 +252,7 @@
              {
--                ${Ethernet::Device} *rtx_ether_ctx = dev_id;
-+                ${Ethernet::AbstractDevice} *rtx_net_dev = dev_id;
-+                ${cast local.rtx_net_dev as Ethernet::AbstractDevice};
- 
-+                ${Ethernet::Device} *rtx_ether_ctx;
+                 ${Ethernet::AbstractDevice} *rtx_net_dev = dev_id;
+                 ${cast local.rtx_net_dev as Ethernet::AbstractDevice};
++
+                 ${Ethernet::Device} *rtx_ether_ctx;
                  ${cast local.rtx_ether_ctx as Ethernet::Device};
-+                rtx_ether_ctx = ${local.rtx_net_dev.rtx_ether_ctx};
-+
-                 ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)};
- 
-                 return IRQ_NONE;
-@@ -253,23 +285,26 @@
+                 rtx_ether_ctx = ${local.rtx_net_dev.rtx_ether_ctx};
+@@ -258,23 +286,26 @@
           */
          chunk PCI::pci_probe_hook(PCI::Device rtx_pci_dev)
          {
@@ -412,7 +407,7 @@
              if (error)
              {
                  ${Log::info("cannot register the driver in the net subsystem")};
-@@ -281,14 +316,11 @@
+@@ -286,14 +317,11 @@
               * XXX: the cast is here because the compiler resolve the
               * type of rtx_pci_dev.pci_device to the type of
               * rtx_pci_dev instead of the type of rtx_pci_dev.pci_device.
@@ -431,7 +426,7 @@
              }
  
              /* Register ourselves in the parent context: */
-@@ -310,7 +342,7 @@
+@@ -315,7 +343,7 @@
              ${pointcut Ethernet::adapter_load_mac_address(local.rtx_ether_ctx)};
              memcpy(${local.rtx_ether_ctx.perm_addr},
                     ${local.rtx_ether_ctx.dev_addr},
@@ -440,7 +435,7 @@
          }
  
          /* This chunk should be removed (see #26) */
-@@ -327,15 +359,15 @@
+@@ -332,15 +360,15 @@
           */
          chunk   PCI::pci_remove_hook(PCI::Device rtx_pci_dev)
          {
@@ -466,20 +461,20 @@
 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
-@@ -16,8 +16,15 @@
+@@ -16,13 +16,14 @@
      provided type   AbstractDevice
      {
          chunk       LKM::includes();
 +        method      init(Builtin::symbol);
          decl        data_types();
 -        attribute   Builtin::symbol.scalar netdev;
-+
-+        attribute   Builtin::symbol.scalar k_net_dev;
-+        /*
-+         * XXX: should be a Ethernet::Device, but that causes a circular
-+         * dependency.
-+         */
-+        attribute   Builtin::symbol.scalar rtx_ether_ctx;
++        attribute   Builtin::symbol.scalar  k_net_dev;
+         /*
+          * XXX: should be a Ethernet::Device, but that causes a circular
+          * dependency:
+          */
+-        attribute   Builtin::symbol rtx_ether_ctx;
++        attribute   Builtin::symbol.scalar  rtx_ether_ctx;
      }
  
      provided type   Device