Mercurial > archived > louis > epitech > mq > rathaxes
comparison 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 |
comparison
equal
deleted
inserted
replaced
95:4e7107e284de | 96:3e715b3e0ecd |
---|---|
1 # HG changeset patch | |
2 # Parent 71f853429e57cb8926fb03e2cacf04a45ad4e8dd | |
3 rathaxes: rename PCI::Device to PCI::AbstractDevice in the e1000 sample | |
4 | |
5 To respect my "new" convention of prefixing Rathaxes types that just map | |
6 types from the kernel with "Abstract". | |
7 | |
8 | |
9 diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt | |
10 --- a/rathaxes/samples/e1000/e1000.blt | |
11 +++ b/rathaxes/samples/e1000/e1000.blt | |
12 @@ -479,7 +479,7 @@ | |
13 | |
14 template sequence e1000::create_device() | |
15 { | |
16 - chunk Ethernet::create_device(PCI::Device pdev, Ethernet::Device rtx_ether_ctx) | |
17 + chunk Ethernet::create_device(PCI::AbstractDevice pdev, Ethernet::Device rtx_ether_ctx) | |
18 { | |
19 /* | |
20 * PCI init stuff: | |
21 @@ -547,7 +547,7 @@ | |
22 | |
23 template sequence e1000::destroy_device() | |
24 { | |
25 - chunk Ethernet::destroy_device(PCI::Device pdev, Ethernet::Device rtx_ether_ctx) | |
26 + chunk Ethernet::destroy_device(PCI::AbstractDevice pdev, Ethernet::Device rtx_ether_ctx) | |
27 { | |
28 /* | |
29 * Here, we should have some checks to avoid to free resources that | |
30 diff --git a/rathaxes/samples/e1000/e1000.rti b/rathaxes/samples/e1000/e1000.rti | |
31 --- a/rathaxes/samples/e1000/e1000.rti | |
32 +++ b/rathaxes/samples/e1000/e1000.rti | |
33 @@ -78,13 +78,13 @@ | |
34 | |
35 provided sequence create_device() | |
36 { | |
37 - provided chunk Ethernet::create_device(PCI::Device, Ethernet::Device); | |
38 + provided chunk Ethernet::create_device(PCI::AbstractDevice, Ethernet::Device); | |
39 provided chunk ::CALL(); | |
40 } | |
41 | |
42 provided sequence destroy_device() | |
43 { | |
44 - provided chunk Ethernet::destroy_device(PCI::Device, Ethernet::Device); | |
45 + provided chunk Ethernet::destroy_device(PCI::AbstractDevice, Ethernet::Device); | |
46 provided chunk ::CALL(); | |
47 } | |
48 | |
49 diff --git a/rathaxes/samples/e1000/ethernet.blt b/rathaxes/samples/e1000/ethernet.blt | |
50 --- a/rathaxes/samples/e1000/ethernet.blt | |
51 +++ b/rathaxes/samples/e1000/ethernet.blt | |
52 @@ -86,7 +86,7 @@ | |
53 typedef struct rtx_ethernet_dev | |
54 { | |
55 /* | |
56 - * I think it's useless to use the ${PCI::Device} "abstraction" | |
57 + * I think it's useless to use the ${PCI::AbstractDevice} "abstraction" | |
58 * here, since we already are in a Linux specific context. | |
59 */ | |
60 struct pci_dev *pci_dev; | |
61 @@ -100,7 +100,7 @@ | |
62 } *rtx_ethernet_dev_p; | |
63 } | |
64 | |
65 - chunk ::init(Ethernet::AbstractDevice net_dev, PCI::Device pci_dev) | |
66 + chunk ::init(Ethernet::AbstractDevice net_dev, PCI::AbstractDevice pci_dev) | |
67 { | |
68 ${self} = netdev_priv(${net_dev}); | |
69 /* | |
70 @@ -211,7 +211,7 @@ | |
71 } | |
72 | |
73 /* For now the type is not handled, so we just omit it (see #17) */ | |
74 - chunk PCI::pci_probe_hook(PCI::Device pdev) | |
75 + chunk PCI::pci_probe_hook(PCI::AbstractDevice pdev) | |
76 { | |
77 /* | |
78 * This typedef is needed to workaround a bug in CNorm __std__ | |
79 @@ -262,7 +262,7 @@ | |
80 | |
81 template sequence Ethernet::exit() | |
82 { | |
83 - chunk PCI::pci_remove_hook(PCI::Device pdev) | |
84 + chunk PCI::pci_remove_hook(PCI::AbstractDevice pdev) | |
85 { | |
86 /* workaround for cnorm unstrict */ | |
87 struct net_device *net_dev = pci_get_drvdata(${pdev}); | |
88 diff --git a/rathaxes/samples/e1000/ethernet.rti b/rathaxes/samples/e1000/ethernet.rti | |
89 --- a/rathaxes/samples/e1000/ethernet.rti | |
90 +++ b/rathaxes/samples/e1000/ethernet.rti | |
91 @@ -17,16 +17,11 @@ | |
92 method decl(); | |
93 } | |
94 | |
95 - /* | |
96 - * Unlike PCI::Device, Ethernet::Device doesn't match the struct net_device | |
97 - * from Linux. Ethernet::Device is the type that we use in the private | |
98 - * field of the struct net_device. | |
99 - */ | |
100 provided type Device | |
101 { | |
102 chunk LKM::includes(); | |
103 method decl(); | |
104 - method init(Ethernet::AbstractDevice, PCI::Device); | |
105 + method init(Ethernet::AbstractDevice, PCI::AbstractDevice); | |
106 pointcut Ethernet::SubContext(); | |
107 } | |
108 | |
109 @@ -57,15 +52,15 @@ | |
110 provided sequence init() | |
111 { | |
112 provided chunk LKM::data(); | |
113 - provided chunk PCI::pci_probe_hook(PCI::Device); | |
114 + provided chunk PCI::pci_probe_hook(PCI::AbstractDevice); | |
115 | |
116 - provided pointcut Ethernet::create_device(PCI::Device, Ethernet::Device); | |
117 + provided pointcut Ethernet::create_device(PCI::AbstractDevice, Ethernet::Device); | |
118 } | |
119 | |
120 provided sequence exit() | |
121 { | |
122 - provided chunk PCI::pci_remove_hook(PCI::Device); | |
123 + provided chunk PCI::pci_remove_hook(PCI::AbstractDevice); | |
124 | |
125 - provided pointcut Ethernet::destroy_device(PCI::Device, Ethernet::Device); | |
126 + provided pointcut Ethernet::destroy_device(PCI::AbstractDevice, Ethernet::Device); | |
127 } | |
128 } | |
129 diff --git a/rathaxes/samples/e1000/pci.blt b/rathaxes/samples/e1000/pci.blt | |
130 --- a/rathaxes/samples/e1000/pci.blt | |
131 +++ b/rathaxes/samples/e1000/pci.blt | |
132 @@ -1,6 +1,6 @@ | |
133 with PCI, LKM, Log | |
134 { | |
135 - template type PCI::Device() | |
136 + template type PCI::AbstractDevice() | |
137 { | |
138 chunk LKM::includes() | |
139 { | |
140 @@ -12,7 +12,7 @@ | |
141 struct pci_dev; | |
142 } | |
143 | |
144 - chunk ::init(PCI::Device) | |
145 + chunk ::init(PCI::AbstractDevice) | |
146 { | |
147 } | |
148 | |
149 @@ -41,7 +41,7 @@ | |
150 goto fail; | |
151 | |
152 /* Use local. to reference a local C variable: */ | |
153 - ${cast local.pdev as PCI::Device}; | |
154 + ${cast local.pdev as PCI::AbstractDevice}; | |
155 ${pointcut PCI::pci_probe_hook(local.pdev)}; | |
156 | |
157 return 0; | |
158 @@ -68,7 +68,7 @@ | |
159 { | |
160 static void rtx_pci_remove(struct pci_dev *pdev) | |
161 { | |
162 - ${cast local.pdev as PCI::Device}; | |
163 + ${cast local.pdev as PCI::AbstractDevice}; | |
164 ${pointcut PCI::pci_remove_hook(local.pdev)}; | |
165 | |
166 pci_disable_device(pdev); | |
167 diff --git a/rathaxes/samples/e1000/pci.rti b/rathaxes/samples/e1000/pci.rti | |
168 --- a/rathaxes/samples/e1000/pci.rti | |
169 +++ b/rathaxes/samples/e1000/pci.rti | |
170 @@ -1,10 +1,10 @@ | |
171 interface PCI : LKM | |
172 { | |
173 - provided type PCI::Device | |
174 + provided type PCI::AbstractDevice | |
175 { | |
176 chunk LKM::includes(); | |
177 method decl(); | |
178 - method init(PCI::Device); | |
179 + method init(PCI::AbstractDevice); | |
180 } | |
181 | |
182 required variable Builtin::number PCI::vendor_id; | |
183 @@ -28,7 +28,7 @@ | |
184 provided chunk LKM::prototypes(); | |
185 provided chunk LKM::code(); | |
186 | |
187 - provided pointcut PCI::pci_probe_hook(PCI::Device); | |
188 + provided pointcut PCI::pci_probe_hook(PCI::AbstractDevice); | |
189 } | |
190 | |
191 provided sequence remove() | |
192 @@ -36,6 +36,6 @@ | |
193 provided chunk LKM::prototypes(); | |
194 provided chunk LKM::code(); | |
195 | |
196 - provided pointcut PCI::pci_remove_hook(PCI::Device); | |
197 + provided pointcut PCI::pci_remove_hook(PCI::AbstractDevice); | |
198 } | |
199 } |