Mercurial > archived > louis > epitech > mq > rathaxes
view 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 |
line wrap: on
line source
# HG changeset patch # Parent f91d274916763989466df5f948ee32a48930b028 Add a patch to illustrate pointcuts in type definition to illustrate #8 diff --git a/rathaxes/samples/lkm/e1000.blt b/rathaxes/samples/lkm/e1000.blt --- a/rathaxes/samples/lkm/e1000.blt +++ b/rathaxes/samples/lkm/e1000.blt @@ -2,25 +2,20 @@ { template type e1000::Context() { - chunk LKM::includes() + chunk Ethernet::Context() { - /* - * Force the generation of the structure in the "headers part, we - * have to do this since we do not use the structure in this blt - * (we hacked a bit and used it in ethernet.blt directly). - */ - typedef int ${e1000::Context}; /* CNorm __std__ workaround */ - ${e1000::Context} force_declaration_in_includes; + struct + { + int bars; + unsigned char /* __iomem */ *ioaddr; + } rtx_e1000_ctx; } - chunk ::decl() - { - struct rtx_e1000_ctx - { - int bars; - unsigned char /* __iomem */ *ioaddr; - }; - } + /* + * Not sure about how chunk ::init will look in that case maybe we + * would need a second pointcut that would insert code in chunk ::init + * in Ethernet::Context? (and this chunk would be implemented here). + */ map { diff --git a/rathaxes/samples/lkm/e1000.rti b/rathaxes/samples/lkm/e1000.rti --- a/rathaxes/samples/lkm/e1000.rti +++ b/rathaxes/samples/lkm/e1000.rti @@ -1,6 +1,9 @@ interface e1000 : Socket, Ethernet, PCI, LKM { - provided type e1000::Context; + provided type e1000::Context + { + provided chunk Ethernet::Context; + } /* Not sure if we need the argument */ provided sequence e1000::create() diff --git a/rathaxes/samples/lkm/ethernet.blt b/rathaxes/samples/lkm/ethernet.blt --- a/rathaxes/samples/lkm/ethernet.blt +++ b/rathaxes/samples/lkm/ethernet.blt @@ -22,7 +22,8 @@ struct net_device *net_dev; /* while waiting on issue #8 */ - struct rtx_e1000_ctx hw_ctx; + /* struct rtx_e1000_ctx hw_ctx; */ + ${pointcut Ethernet::Context}; }; } diff --git a/rathaxes/samples/lkm/ethernet.rti b/rathaxes/samples/lkm/ethernet.rti --- a/rathaxes/samples/lkm/ethernet.rti +++ b/rathaxes/samples/lkm/ethernet.rti @@ -1,6 +1,9 @@ interface Ethernet : Socket, PCI, LKM { - provided type Ethernet::Device; + provided type Ethernet::Device + { + provided pointcut Ethernet::Context; + } required variable ::string Ethernet::ifname;