changeset 98:147519512c3d

Commit before pulling Joa's changes
author Louis Opter <louis@lse.epita.fr>
date Thu, 22 Nov 2012 16:41:18 -0800
parents ffdb018893e2
children e2c237d6c37b
files rathaxes_add_a_test_to_reproduce_the_pointer_to_rathaxes_bug.patch rathaxes_cleanups_in_ethernet_rti_blt.patch rathaxes_use_single_file_language_tests.patch series
diffstat 4 files changed, 89 insertions(+), 278 deletions(-) [+]
line wrap: on
line diff
--- a/rathaxes_add_a_test_to_reproduce_the_pointer_to_rathaxes_bug.patch	Thu Nov 22 15:37:46 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-# HG changeset patch
-# Parent 7adecea6d0fdaad6bb4a97993ef3f7e6cb465b8e
-rathaxes: add a test for the pointer to Rathaxes type bug
-
-diff --git a/rathaxes/compiler/tests/CMakeLists.txt b/rathaxes/compiler/tests/CMakeLists.txt
---- a/rathaxes/compiler/tests/CMakeLists.txt
-+++ b/rathaxes/compiler/tests/CMakeLists.txt
-@@ -43,3 +43,5 @@
- 
- # Tests for the typing system (should not do anymore than parsing/checking typing)
- ADD_SUBDIRECTORY(typing)
-+
-+ADD_SUBDIRECTORY(pointer_to_rathaxes_type)
-diff --git a/rathaxes/compiler/tests/pointer_to_rathaxes_type/CMakeLists.txt b/rathaxes/compiler/tests/pointer_to_rathaxes_type/CMakeLists.txt
-new file mode 100644
---- /dev/null
-+++ b/rathaxes/compiler/tests/pointer_to_rathaxes_type/CMakeLists.txt
-@@ -0,0 +1,3 @@
-+ADD_RATHAXES_SOURCES(test_pointer_to_rathaxes_type pointer_to_rathaxes_type.rtx
-+                     RTI pointer_to_rathaxes_type.rti
-+                     BLT pointer_to_rathaxes_type.blt)
-diff --git a/rathaxes/compiler/tests/pointer_to_rathaxes_type/pointer_to_rathaxes_type.blt b/rathaxes/compiler/tests/pointer_to_rathaxes_type/pointer_to_rathaxes_type.blt
-new file mode 100644
---- /dev/null
-+++ b/rathaxes/compiler/tests/pointer_to_rathaxes_type/pointer_to_rathaxes_type.blt
-@@ -0,0 +1,33 @@
-+with Test
-+{
-+    ${pointcut Test::code()};
-+
-+    template type   Test::Test()
-+    {
-+        chunk   ::decl()
-+        {
-+            int;
-+        }
-+
-+        map
-+        {
-+        }
-+    }
-+
-+    template sequence   Test::entry_point(Test::Test)
-+    {
-+        chunk   code()
-+        {
-+            int
-+            main(void)
-+            {
-+                ${Test::Test} *p;
-+                ${Test::Test} *assign = NULL;
-+
-+                ${pointcut ::IMPLEMENTATION(local.p)};
-+
-+                return 0;
-+            }
-+        }
-+    }
-+}
-diff --git a/rathaxes/compiler/tests/pointer_to_rathaxes_type/pointer_to_rathaxes_type.rti b/rathaxes/compiler/tests/pointer_to_rathaxes_type/pointer_to_rathaxes_type.rti
-new file mode 100644
---- /dev/null
-+++ b/rathaxes/compiler/tests/pointer_to_rathaxes_type/pointer_to_rathaxes_type.rti
-@@ -0,0 +1,14 @@
-+interface Test
-+{
-+    provided pointcut   code();
-+
-+    provided type   Test
-+    {
-+        chunk   ::decl();
-+    }
-+
-+    required sequence   entry_point(Test::Test)
-+    {
-+        provided chunk  code();
-+    }
-+}
-diff --git a/rathaxes/compiler/tests/pointer_to_rathaxes_type/pointer_to_rathaxes_type.rtx b/rathaxes/compiler/tests/pointer_to_rathaxes_type/pointer_to_rathaxes_type.rtx
-new file mode 100644
---- /dev/null
-+++ b/rathaxes/compiler/tests/pointer_to_rathaxes_type/pointer_to_rathaxes_type.rtx
-@@ -0,0 +1,10 @@
-+device Test use Test
-+{
-+    Test::entry_point(Test::Test t)
-+    {
-+    }
-+}
-+
-+configuration
-+{
-+}
--- a/rathaxes_cleanups_in_ethernet_rti_blt.patch	Thu Nov 22 15:37:46 2012 -0800
+++ b/rathaxes_cleanups_in_ethernet_rti_blt.patch	Thu Nov 22 16:41:18 2012 -0800
@@ -1,5 +1,5 @@
 # HG changeset patch
-# Parent 72057981213815c2bc5f34f50a997ea2e28f2fdc
+# Parent 6cc56c206e65a31121a9e9745003fed8276b0b60
 rathaxes: tidy up ethernet.{rti,blt} in the e1000 sample
 
 - Remove typedefs;
@@ -8,14 +8,13 @@
   device to store its private data structure within the context of the
   Ethernet subsystem.
 
-
 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
-@@ -268,7 +268,7 @@
+@@ -284,7 +284,7 @@
+             };
+         }
  
-     template type   e1000::Context()
-     {
 -        chunk   Ethernet::SubContext()
 +        chunk   Ethernet::HardwareContext()
          {
@@ -24,15 +23,15 @@
 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
-@@ -10,7 +10,7 @@
+@@ -9,7 +9,7 @@
+     {
+         method      decl();
  
-     provided type   Context
-     {
 -        chunk       Ethernet::SubContext();
 +        chunk       Ethernet::HardwareContext();
-         method      decl();
-         method      init();
-     }
+ 
+         /* Callbacks/Hooks which should probably be in the front-end: */
+         chunk       Ethernet::adapter_init_context(Ethernet::Device,
 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
@@ -60,7 +59,7 @@
 +            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"
 @@ -96,8 +89,8 @@
                   * In the long-term, this may disappear for a new concept allowing
                   * to embbed a descriptor defined and manipulated by the front-end
@@ -71,7 +70,7 @@
 +            };
          }
  
-         chunk ::init(Ethernet::AbstractDevice net_dev, PCI::Device pci_dev)
+         chunk ::init(Ethernet::AbstractDevice net_dev, PCI::AbstractDevice pci_dev)
 @@ -105,7 +98,7 @@
              ${self} = netdev_priv(${net_dev});
              /*
@@ -81,39 +80,92 @@
               */
              ${self}->pci_dev = ${pci_dev};
              ${self}->net_dev = ${net_dev};
-@@ -213,12 +206,8 @@
-         /* For now the type is not handled, so we just omit it (see #17) */
-         chunk PCI::pci_probe_hook(PCI::Device pdev)
+@@ -129,8 +122,9 @@
+         {
+             static int  rtx_ethernet_open(struct net_device *dev)
+             {
+-                ${Ethernet::Device} rtx_ether_dev = netdev_priv(dev);
++                ${Ethernet::Device} *rtx_ether_dev = netdev_priv(dev);
+ 
++                ${cast local.rtx_ether_dev as Ethernet::Device};
+                 ${pointcut ::IMPLEMENTATION(local.rtx_ether_dev)};
+ 
+                 return 0;
+@@ -149,8 +143,10 @@
+         {
+             static int  rtx_ethernet_xmit(struct sk_buff* kernel_skb, struct net_device *net_dev)
+             {
+-                ${Ethernet::Device} rtx_ethernet_dev = netdev_priv(net_dev);
++                ${Ethernet::Device} *rtx_ethernet_dev = netdev_priv(net_dev);
+                 ${cast local.kernel_skb as Socket::AbstractSKBuff};
++
++                ${cast local.rtx_ethernet_dev as Ethernet::Device};
+                 ${pointcut ::IMPLEMENTATION(local.rtx_ethernet_dev, local.kernel_skb)};
+             }
+         }
+@@ -167,8 +163,9 @@
+         {
+             static int  rtx_ethernet_close(struct net_device *dev)
+             {
+-                ${Ethernet::Device} rtx_ether_dev = netdev_priv(dev);
++                ${Ethernet::Device} *rtx_ether_dev = netdev_priv(dev);
+ 
++                ${cast local.rtx_ether_dev as Ethernet::Device};
+                 ${pointcut ::IMPLEMENTATION(local.rtx_ether_dev)};
+ 
+                 return 0;
+@@ -191,8 +188,9 @@
          {
--            /*
--             * This typedef is needed to workaround a bug in CNorm __std__
--             * dialect.
--             */
-             ${Ethernet::Device} rtx_ether_ctx;
--            struct net_device *net_dev;
-+            ${Ethernet::AbstractDevice} net_dev;
-             int error;
+             static enum irqreturn   rtx_ethernet_interrupt_handler(int irq, void *dev_id)
+             {
+-                ${Ethernet::Device} rtx_ether_dev = dev_id;
++                ${Ethernet::Device} *rtx_ether_dev = dev_id;
+ 
++                ${cast local.rtx_ether_dev as Ethernet::Device};
+                 ${pointcut ::IMPLEMENTATION(local.rtx_ether_dev)};
+ 
+                 return IRQ_NONE;
+@@ -222,8 +220,8 @@
+          */
+         chunk PCI::pci_probe_hook(PCI::Device rtx_pci_dev)
+         {
+-            ${Ethernet::Device} rtx_ether_ctx;
+-            ${Ethernet::AbstractDevice} net_dev;
++            ${Ethernet::Device} *rtx_ether_ctx;
++            ${Ethernet::AbstractDevice} *net_dev;
  
-             /* Initialize the net_device structure */
-@@ -264,8 +253,7 @@
-     {
-         chunk   PCI::pci_remove_hook(PCI::Device pdev)
+             net_dev = alloc_etherdev(sizeof(*rtx_ether_ctx));
+             if (!net_dev)
+@@ -272,6 +270,7 @@
+             int irq = ${rtx_pci_dev.irq};
+             ${cast local.bars as Builtin::number};
+             ${cast local.irq as Builtin::number};
++            ${cast local.rtx_ether_ctx as Ethernet::Device};
+             ${pointcut Ethernet::adapter_init_context(local.rtx_ether_ctx,
+                                                       local.bars,
+                                                       local.ioaddr,
+@@ -294,10 +293,11 @@
+          */
+         chunk   PCI::pci_remove_hook(PCI::Device rtx_pci_dev)
          {
--            /* workaround for cnorm unstrict */
--            struct net_device *net_dev = pci_get_drvdata(${pdev});
-+            ${Ethernet::AbstractDevice} net_dev = pci_get_drvdata(${pdev});
-             ${Ethernet::Device} rtx_ether_ctx = netdev_priv(net_dev);
+-            ${Ethernet::Device} rtx_ether_ctx = ${rtx_pci_dev.context};
++            ${Ethernet::Device} *rtx_ether_ctx = ${rtx_pci_dev.context};
+ 
+             BUG_ON(!rtx_ether_ctx);
  
-             ${pointcut Ethernet::destroy_device(pdev, local.rtx_ether_ctx)};
++            ${cast local.rtx_ether_ctx as Ethernet::Device};
+             unregister_netdev(${local.rtx_ether_ctx.net_device});
+             free_netdev(${local.rtx_ether_ctx.net_device});
+         }
 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
-@@ -27,7 +27,7 @@
+@@ -22,7 +22,7 @@
          chunk       LKM::includes();
          method      decl();
-         method      init(Ethernet::AbstractDevice, PCI::Device);
+         method      init(Ethernet::AbstractDevice, PCI::AbstractDevice);
 -        pointcut    Ethernet::SubContext();
 +        pointcut    Ethernet::HardwareContext();
-     }
  
-     required sequence   open(Ethernet::Device)
+         attribute   PCI::AbstractDevice         pci_device;
+         attribute   Ethernet::AbstractDevice    net_device;
--- a/rathaxes_use_single_file_language_tests.patch	Thu Nov 22 15:37:46 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-# HG changeset patch
-# Parent e3555104b356bbaf4ebed282f74f75323bf7eabf
-rathaxes: convert the test about pointers to Rathaxes types to a single file
-
-And move it to a more generic "language" directory under tests.
-
-diff --git a/rathaxes/compiler/tests/CMakeLists.txt b/rathaxes/compiler/tests/CMakeLists.txt
---- a/rathaxes/compiler/tests/CMakeLists.txt
-+++ b/rathaxes/compiler/tests/CMakeLists.txt
-@@ -44,4 +44,4 @@
- # Tests for the typing system (should not do anymore than parsing/checking typing)
- ADD_SUBDIRECTORY(typing)
- 
--ADD_SUBDIRECTORY(pointer_to_rathaxes_type)
-+ADD_SUBDIRECTORY(language)
-diff --git a/rathaxes/compiler/tests/pointer_to_rathaxes_type/CMakeLists.txt b/rathaxes/compiler/tests/language/CMakeLists.txt
-rename from rathaxes/compiler/tests/pointer_to_rathaxes_type/CMakeLists.txt
-rename to rathaxes/compiler/tests/language/CMakeLists.txt
---- a/rathaxes/compiler/tests/pointer_to_rathaxes_type/CMakeLists.txt
-+++ b/rathaxes/compiler/tests/language/CMakeLists.txt
-@@ -1,3 +1,1 @@
--ADD_RATHAXES_SOURCES(test_pointer_to_rathaxes_type pointer_to_rathaxes_type.rtx
--                     RTI pointer_to_rathaxes_type.rti
--                     BLT pointer_to_rathaxes_type.blt)
-+ADD_RATHAXES_SOURCES(test_pointer_to_rathaxes_type pointer_to_rathaxes_type.rtx)
-diff --git a/rathaxes/compiler/tests/pointer_to_rathaxes_type/pointer_to_rathaxes_type.rtx b/rathaxes/compiler/tests/language/pointer_to_rathaxes_type.rtx
-rename from rathaxes/compiler/tests/pointer_to_rathaxes_type/pointer_to_rathaxes_type.rtx
-rename to rathaxes/compiler/tests/language/pointer_to_rathaxes_type.rtx
---- a/rathaxes/compiler/tests/pointer_to_rathaxes_type/pointer_to_rathaxes_type.rtx
-+++ b/rathaxes/compiler/tests/language/pointer_to_rathaxes_type.rtx
-@@ -1,3 +1,58 @@
-+/* Interfaces */
-+
-+interface Test
-+{
-+    provided pointcut   code();
-+
-+    provided type   Test
-+    {
-+        chunk   ::decl();
-+    }
-+
-+    required sequence   entry_point(Test::Test)
-+    {
-+        provided chunk  code();
-+    }
-+}
-+
-+/* Templates */
-+
-+with Test
-+{
-+    ${pointcut Test::code()};
-+
-+    template type   Test::Test()
-+    {
-+        chunk   ::decl()
-+        {
-+            int;
-+        }
-+
-+        map
-+        {
-+        }
-+    }
-+
-+    template sequence   Test::entry_point(Test::Test)
-+    {
-+        chunk   code()
-+        {
-+            int
-+            main(void)
-+            {
-+                ${Test::Test} *p;
-+                ${Test::Test} *assign = NULL;
-+
-+                ${pointcut ::IMPLEMENTATION(local.p)};
-+
-+                return 0;
-+            }
-+        }
-+    }
-+}
-+
-+/* Description */
-+
- device Test use Test
- {
-     Test::entry_point(Test::Test t)
-diff --git a/rathaxes/compiler/tests/pointer_to_rathaxes_type/pointer_to_rathaxes_type.blt b/rathaxes/compiler/tests/pointer_to_rathaxes_type/pointer_to_rathaxes_type.blt
-deleted file mode 100644
---- a/rathaxes/compiler/tests/pointer_to_rathaxes_type/pointer_to_rathaxes_type.blt
-+++ /dev/null
-@@ -1,33 +0,0 @@
--with Test
--{
--    ${pointcut Test::code()};
--
--    template type   Test::Test()
--    {
--        chunk   ::decl()
--        {
--            int;
--        }
--
--        map
--        {
--        }
--    }
--
--    template sequence   Test::entry_point(Test::Test)
--    {
--        chunk   code()
--        {
--            int
--            main(void)
--            {
--                ${Test::Test} *p;
--                ${Test::Test} *assign = NULL;
--
--                ${pointcut ::IMPLEMENTATION(local.p)};
--
--                return 0;
--            }
--        }
--    }
--}
-diff --git a/rathaxes/compiler/tests/pointer_to_rathaxes_type/pointer_to_rathaxes_type.rti b/rathaxes/compiler/tests/pointer_to_rathaxes_type/pointer_to_rathaxes_type.rti
-deleted file mode 100644
---- a/rathaxes/compiler/tests/pointer_to_rathaxes_type/pointer_to_rathaxes_type.rti
-+++ /dev/null
-@@ -1,14 +0,0 @@
--interface Test
--{
--    provided pointcut   code();
--
--    provided type   Test
--    {
--        chunk   ::decl();
--    }
--
--    required sequence   entry_point(Test::Test)
--    {
--        provided chunk  code();
--    }
--}
--- a/series	Thu Nov 22 15:37:46 2012 -0800
+++ b/series	Thu Nov 22 16:41:18 2012 -0800
@@ -1,6 +1,4 @@
-rathaxes_add_a_test_to_reproduce_the_pointer_to_rathaxes_bug.patch
 rathaxes_fix_builtin_symbol.patch
-rathaxes_use_single_file_language_tests.patch
 rathaxes_rename_pci_device_to_pci_abstractdevice.patch
 rathaxes_remove_useless_xmit_tso_cksum_offload_method_from_e1000.patch
 rathaxes_rewrite_create_and_destroy_device_in_the_e1000_sample.patch