| To: | netdev@xxxxxxxxxxx |
|---|---|
| Subject: | Re: double-check me? |
| From: | Jason Lunz <lunz@xxxxxxxxxxxx> |
| Date: | Sun, 17 Aug 2003 21:34:22 +0000 (UTC) |
| Organization: | PBR Streetgang |
| References: | <3F3FBF50.8070207@pobox.com> |
| Sender: | netdev-bounce@xxxxxxxxxxx |
| User-agent: | slrn/0.9.7.4 (Linux) |
jgarzik@xxxxxxxxx said: > if (sizeof_priv) > dev->priv = (void *) (((long)(dev + 1) + 31) & ~31); > > > Now... shouldn't that last line of code be "dev + 1 + sizeof(*dev)" ? are you missing that the "dev + 1" pointer arithmetic is already adding sizeof(*dev) to dev, rather than just 1 byte? "(dev + 1)" is a pointer to the private area after the actual struct net_device, and "((long)(dev + 1) + 31)" adds 31 bytes of padding. The final "& ~31" chops off any excess padding from the 31 that was added and actually aligns the pointer. Seems right to me, but I'm not used to playing alignment tricks. Jason |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [PATCH] (1/5) get rid of useless hashbin in irtty, Jean Tourrilhes |
|---|---|
| Next by Date: | Re: [PATCH] (1/5) get rid of useless hashbin in irtty, Jeff Garzik |
| Previous by Thread: | Re: double-check me?, Jeff Garzik |
| Next by Thread: | [bk patches] net driver updates, Jeff Garzik |
| Indexes: | [Date] [Thread] [Top] [All Lists] |