comparison rathaxes_add_a_patch_to_illustrate_issue_8.patch @ 32:c7c59cebab85

Add a patch to illustrate pointcuts in type definition to illustrate #8
author Louis Opter <louis@lse.epitech.net>
date Sat, 07 Jan 2012 23:56:11 +0100
parents
children
comparison
equal deleted inserted replaced
31:cd3e61d6759a 32:c7c59cebab85
1 # HG changeset patch
2 # Parent f91d274916763989466df5f948ee32a48930b028
3 Add a patch to illustrate pointcuts in type definition to illustrate #8
4
5 diff --git a/rathaxes/samples/lkm/e1000.blt b/rathaxes/samples/lkm/e1000.blt
6 --- a/rathaxes/samples/lkm/e1000.blt
7 +++ b/rathaxes/samples/lkm/e1000.blt
8 @@ -2,25 +2,20 @@
9 {
10 template type e1000::Context()
11 {
12 - chunk LKM::includes()
13 + chunk Ethernet::Context()
14 {
15 - /*
16 - * Force the generation of the structure in the "headers part, we
17 - * have to do this since we do not use the structure in this blt
18 - * (we hacked a bit and used it in ethernet.blt directly).
19 - */
20 - typedef int ${e1000::Context}; /* CNorm __std__ workaround */
21 - ${e1000::Context} force_declaration_in_includes;
22 + struct
23 + {
24 + int bars;
25 + unsigned char /* __iomem */ *ioaddr;
26 + } rtx_e1000_ctx;
27 }
28
29 - chunk ::decl()
30 - {
31 - struct rtx_e1000_ctx
32 - {
33 - int bars;
34 - unsigned char /* __iomem */ *ioaddr;
35 - };
36 - }
37 + /*
38 + * Not sure about how chunk ::init will look in that case maybe we
39 + * would need a second pointcut that would insert code in chunk ::init
40 + * in Ethernet::Context? (and this chunk would be implemented here).
41 + */
42
43 map
44 {
45 diff --git a/rathaxes/samples/lkm/e1000.rti b/rathaxes/samples/lkm/e1000.rti
46 --- a/rathaxes/samples/lkm/e1000.rti
47 +++ b/rathaxes/samples/lkm/e1000.rti
48 @@ -1,6 +1,9 @@
49 interface e1000 : Socket, Ethernet, PCI, LKM
50 {
51 - provided type e1000::Context;
52 + provided type e1000::Context
53 + {
54 + provided chunk Ethernet::Context;
55 + }
56
57 /* Not sure if we need the argument */
58 provided sequence e1000::create()
59 diff --git a/rathaxes/samples/lkm/ethernet.blt b/rathaxes/samples/lkm/ethernet.blt
60 --- a/rathaxes/samples/lkm/ethernet.blt
61 +++ b/rathaxes/samples/lkm/ethernet.blt
62 @@ -22,7 +22,8 @@
63 struct net_device *net_dev;
64
65 /* while waiting on issue #8 */
66 - struct rtx_e1000_ctx hw_ctx;
67 + /* struct rtx_e1000_ctx hw_ctx; */
68 + ${pointcut Ethernet::Context};
69 };
70 }
71
72 diff --git a/rathaxes/samples/lkm/ethernet.rti b/rathaxes/samples/lkm/ethernet.rti
73 --- a/rathaxes/samples/lkm/ethernet.rti
74 +++ b/rathaxes/samples/lkm/ethernet.rti
75 @@ -1,6 +1,9 @@
76 interface Ethernet : Socket, PCI, LKM
77 {
78 - provided type Ethernet::Device;
79 + provided type Ethernet::Device
80 + {
81 + provided pointcut Ethernet::Context;
82 + }
83
84 required variable ::string Ethernet::ifname;
85