netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Lunz <lunz@falooley.org>
To: netdev@oss.sgi.com
Subject: Re: double-check me?
Date: Sun, 17 Aug 2003 21:34:22 +0000 (UTC)	[thread overview]
Message-ID: <slrnbjvt6q.u4n.lunz@orr.homenet> (raw)
In-Reply-To: 3F3FBF50.8070207@pobox.com

jgarzik@pobox.com 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

      parent reply	other threads:[~2003-08-17 21:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-17 17:45 double-check me? Jeff Garzik
2003-08-17 20:58 ` Krzysztof Halasa
2003-08-17 22:31   ` Jeff Garzik
2003-08-18 14:38     ` Jason Lunz
2003-08-18 14:41       ` Jeff Garzik
2003-08-17 21:34 ` Jason Lunz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=slrnbjvt6q.u4n.lunz@orr.homenet \
    --to=lunz@falooley.org \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).