comparison rathaxes_cleanups_in_ethernet_rti_blt.patch @ 93:2cc8fda4c4e3

Add a patch with some wip on the ethernet part of the e1000 sample
author Louis Opter <louis@lse.epita.fr>
date Mon, 22 Oct 2012 00:56:41 +0200
parents
children 147519512c3d
comparison
equal deleted inserted replaced
92:5eb746474f0f 93:2cc8fda4c4e3
1 # HG changeset patch
2 # Parent 72057981213815c2bc5f34f50a997ea2e28f2fdc
3 rathaxes: tidy up ethernet.{rti,blt} in the e1000 sample
4
5 - Remove typedefs;
6 - Rename Ethernet::SubContext in Ethernet::HardwareContext: I think this
7 is more clear. This pointcut is here to allow the underlying real
8 device to store its private data structure within the context of the
9 Ethernet subsystem.
10
11
12 diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt
13 --- a/rathaxes/samples/e1000/e1000.blt
14 +++ b/rathaxes/samples/e1000/e1000.blt
15 @@ -268,7 +268,7 @@
16
17 template type e1000::Context()
18 {
19 - chunk Ethernet::SubContext()
20 + chunk Ethernet::HardwareContext()
21 {
22 /*
23 * Force the generation of the structure in the "headers" part, we
24 diff --git a/rathaxes/samples/e1000/e1000.rti b/rathaxes/samples/e1000/e1000.rti
25 --- a/rathaxes/samples/e1000/e1000.rti
26 +++ b/rathaxes/samples/e1000/e1000.rti
27 @@ -10,7 +10,7 @@
28
29 provided type Context
30 {
31 - chunk Ethernet::SubContext();
32 + chunk Ethernet::HardwareContext();
33 method decl();
34 method init();
35 }
36 diff --git a/rathaxes/samples/e1000/ethernet.blt b/rathaxes/samples/e1000/ethernet.blt
37 --- a/rathaxes/samples/e1000/ethernet.blt
38 +++ b/rathaxes/samples/e1000/ethernet.blt
39 @@ -59,7 +59,7 @@
40
41 chunk ::decl()
42 {
43 - typedef struct net_device *net_devp;
44 + struct net_device;
45 }
46
47 map
48 @@ -76,14 +76,7 @@
49
50 chunk ::decl()
51 {
52 - /*
53 - * So, at first sight, it sucks to typedef it as pointer but (for
54 - * now) it makes sense for two reasons:
55 - * - This structure will always be used through a pointer;
56 - * - This remove the ambiguity of pointer/not-pointer in the
57 - * ::init() chunk.
58 - */
59 - typedef struct rtx_ethernet_dev
60 + struct rtx_ethernet_dev
61 {
62 /*
63 * I think it's useless to use the ${PCI::Device} "abstraction"
64 @@ -96,8 +89,8 @@
65 * In the long-term, this may disappear for a new concept allowing
66 * to embbed a descriptor defined and manipulated by the front-end
67 */
68 - ${pointcut Ethernet::SubContext()};
69 - } *rtx_ethernet_dev_p;
70 + ${pointcut Ethernet::HardwareContext()};
71 + };
72 }
73
74 chunk ::init(Ethernet::AbstractDevice net_dev, PCI::Device pci_dev)
75 @@ -105,7 +98,7 @@
76 ${self} = netdev_priv(${net_dev});
77 /*
78 * We can use -> because we know that ${self} will be always a
79 - * pointer ("thanks" to the typedef)
80 + * pointer, but the ambiguity sucks.
81 */
82 ${self}->pci_dev = ${pci_dev};
83 ${self}->net_dev = ${net_dev};
84 @@ -213,12 +206,8 @@
85 /* For now the type is not handled, so we just omit it (see #17) */
86 chunk PCI::pci_probe_hook(PCI::Device pdev)
87 {
88 - /*
89 - * This typedef is needed to workaround a bug in CNorm __std__
90 - * dialect.
91 - */
92 ${Ethernet::Device} rtx_ether_ctx;
93 - struct net_device *net_dev;
94 + ${Ethernet::AbstractDevice} net_dev;
95 int error;
96
97 /* Initialize the net_device structure */
98 @@ -264,8 +253,7 @@
99 {
100 chunk PCI::pci_remove_hook(PCI::Device pdev)
101 {
102 - /* workaround for cnorm unstrict */
103 - struct net_device *net_dev = pci_get_drvdata(${pdev});
104 + ${Ethernet::AbstractDevice} net_dev = pci_get_drvdata(${pdev});
105 ${Ethernet::Device} rtx_ether_ctx = netdev_priv(net_dev);
106
107 ${pointcut Ethernet::destroy_device(pdev, local.rtx_ether_ctx)};
108 diff --git a/rathaxes/samples/e1000/ethernet.rti b/rathaxes/samples/e1000/ethernet.rti
109 --- a/rathaxes/samples/e1000/ethernet.rti
110 +++ b/rathaxes/samples/e1000/ethernet.rti
111 @@ -27,7 +27,7 @@
112 chunk LKM::includes();
113 method decl();
114 method init(Ethernet::AbstractDevice, PCI::Device);
115 - pointcut Ethernet::SubContext();
116 + pointcut Ethernet::HardwareContext();
117 }
118
119 required sequence open(Ethernet::Device)