From: Thomas Heinz <creatix@hipac.org>
To: Laszlo Valko <valko@linux.karinthy.hu>
Cc: netfilter-devel@lists.netfilter.org
Subject: Re: Comments about IPT_ALIGN
Date: Sun, 26 Jan 2003 18:06:32 +0100 [thread overview]
Message-ID: <3E341598.5060907@hipac.org> (raw)
In-Reply-To: 20030126120159.A3045@linux.karinthy.hu
Hi Laszlo
You wrote:
> This is not too surprising. Both of them are RISC processors with
> strict alignment restrictions. I guess even with a 32bit sparc
> gcc, a 64bit unsigned integer gets aligned to 64bit just to make life
> easier
Yes, in fact this is the case. Just take a look at the output of
struct t64 on sparc64 in my first posting.
> Now the problem comes if you have only 32bit integers in the first
> structure and 64bit integers in the second one: you have to either
> use IPT_ALIGN again (which we would like to get rid of), or we
> have to make sure the first structure gets aligned to 64bit.
> We could introduce an extra variablke just for this at the end
> like:
>
> u_int64_t dummy[0];
> }
>
> Or we could do something like that in netfilter:
>
> struct ipt_entry entries[0];
> }
>
> This latter version is better if we know what kind structure will follow,
> because it will not increase the size of the structure unnecessarily on
> platforms without alignment restrictions.
Yes, very good point. Another way would be to introduce a new type
for this purpose which is u_int32_t on 32 bit architectures and
u_int64_t on 64 bit architectures or just use long instead if
sizeof(long) always works the expected way.
Anyway this is just a question of personal taste.
Thomas
prev parent reply other threads:[~2003-01-26 17:06 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-26 3:57 Comments about IPT_ALIGN Thomas Heinz
2003-01-26 11:01 ` Laszlo Valko
2003-01-26 11:28 ` Anders Fugmann
2003-01-26 13:58 ` Thomas Heinz
2003-01-26 14:26 ` Laszlo Valko
2003-01-26 16:50 ` Thomas Heinz
2003-01-26 19:31 ` Laszlo Valko
2003-01-31 11:51 ` Harald Welte
2003-01-26 14:22 ` Laszlo Valko
2003-01-26 18:05 ` Thomas Heinz
2003-01-26 19:43 ` Laszlo Valko
2003-01-26 23:09 ` Thomas Heinz
2003-01-27 0:43 ` Laszlo Valko
2003-01-27 10:33 ` Thomas Heinz
2003-01-31 11:57 ` Harald Welte
2003-01-26 19:48 ` Thomas Heinz
2003-01-31 11:55 ` Harald Welte
2003-01-31 23:37 ` Laszlo Valko
2003-01-26 17:06 ` Thomas Heinz [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=3E341598.5060907@hipac.org \
--to=creatix@hipac.org \
--cc=netfilter-devel@lists.netfilter.org \
--cc=valko@linux.karinthy.hu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.