Mercurial > archived > louis > epitech > mq > rathaxes
view 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 |
line wrap: on
line source
# HG changeset patch # Parent 72057981213815c2bc5f34f50a997ea2e28f2fdc rathaxes: tidy up ethernet.{rti,blt} in the e1000 sample - Remove typedefs; - Rename Ethernet::SubContext in Ethernet::HardwareContext: I think this is more clear. This pointcut is here to allow the underlying real 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 @@ template type e1000::Context() { - chunk Ethernet::SubContext() + chunk Ethernet::HardwareContext() { /* * Force the generation of the structure in the "headers" part, we 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 @@ provided type Context { - chunk Ethernet::SubContext(); + chunk Ethernet::HardwareContext(); method decl(); method init(); } 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 @@ -59,7 +59,7 @@ chunk ::decl() { - typedef struct net_device *net_devp; + struct net_device; } map @@ -76,14 +76,7 @@ chunk ::decl() { - /* - * So, at first sight, it sucks to typedef it as pointer but (for - * now) it makes sense for two reasons: - * - This structure will always be used through a pointer; - * - This remove the ambiguity of pointer/not-pointer in the - * ::init() chunk. - */ - typedef struct rtx_ethernet_dev + struct rtx_ethernet_dev { /* * I think it's useless to use the ${PCI::Device} "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 */ - ${pointcut Ethernet::SubContext()}; - } *rtx_ethernet_dev_p; + ${pointcut Ethernet::HardwareContext()}; + }; } chunk ::init(Ethernet::AbstractDevice net_dev, PCI::Device pci_dev) @@ -105,7 +98,7 @@ ${self} = netdev_priv(${net_dev}); /* * We can use -> because we know that ${self} will be always a - * pointer ("thanks" to the typedef) + * pointer, but the ambiguity sucks. */ ${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) { - /* - * 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; /* Initialize the net_device structure */ @@ -264,8 +253,7 @@ { chunk PCI::pci_remove_hook(PCI::Device pdev) { - /* 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); ${pointcut Ethernet::destroy_device(pdev, local.rtx_ether_ctx)}; 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 @@ chunk LKM::includes(); method decl(); method init(Ethernet::AbstractDevice, PCI::Device); - pointcut Ethernet::SubContext(); + pointcut Ethernet::HardwareContext(); } required sequence open(Ethernet::Device)