2005-05-05 02:57:58

by Mike Christie

[permalink] [raw]
Subject: [PATCH 2/3] add open iscsi netlink interface to iscsi transport class

attached common-iscsi-headers.patch - Common header files:
- iscsi_if.h (user/kernel #defines);
- iscsi_proto.h (RFC3720 #defines and types);
- iscsi_ifev.h (user/kernel events).


Thanks,

Linux-iscsi Team

Signed-off-by: Alex Aizman <[email protected]>
Signed-off-by: Dmitry Yusupov <[email protected]>
Signed-off-by: Mike Christie <[email protected]>


Attachments:
common-iscsi-headers.patch (22.40 kB)

2005-05-05 09:52:37

by YOSHIFUJI Hideaki

[permalink] [raw]
Subject: Re: [PATCH 2/3] add open iscsi netlink interface to iscsi transport class

In article <[email protected]> (at Wed, 04 May 2005 19:53:53 -0700), Mike Christie <[email protected]> says:

> +struct iscsi_uevent {
:
> +} __attribute__ ((aligned (sizeof(unsigned long))));

I think it'd be better to use sizeof(uint64_t) or something.
Please check other spots, too. e.g.:

> + struct iscsi_stats_custom custom[0]
> + __attribute__ ((aligned (sizeof(unsigned long))));

--yoshfuji

2005-05-05 11:40:12

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH 2/3] add open iscsi netlink interface to iscsi transport class

YOSHIFUJI Hideaki / ???? <[email protected]> wrote:
> In article <[email protected]> (at Wed, 04 May 2005 19:53:53 -0700), Mike Christie <[email protected]> says:
>
>> +struct iscsi_uevent {
> :
>> +} __attribute__ ((aligned (sizeof(unsigned long))));
>
> I think it'd be better to use sizeof(uint64_t) or something.

Is there a benefit in aligning on 64-bit boundaries for 32-bit platforms?

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2005-05-05 23:53:25

by Arjan van de Ven

[permalink] [raw]
Subject: Re: [PATCH 2/3] add open iscsi netlink interface to iscsi transport class

On Thu, 2005-05-05 at 21:39 +1000, Herbert Xu wrote:
> YOSHIFUJI Hideaki / ???? <[email protected]> wrote:
> > In article <[email protected]> (at Wed, 04 May 2005 19:53:53 -0700), Mike Christie <[email protected]> says:
> >
> >> +struct iscsi_uevent {
> > :
> >> +} __attribute__ ((aligned (sizeof(unsigned long))));
> >
> > I think it'd be better to use sizeof(uint64_t) or something.
>
> Is there a benefit in aligning on 64-bit boundaries for 32-bit platforms?


why align at all as opposed to just letting the compiler figure it out.



2005-05-05 11:52:55

by YOSHIFUJI Hideaki

[permalink] [raw]
Subject: Re: [PATCH 2/3] add open iscsi netlink interface to iscsi transport class

In article <[email protected]> (at Thu, 05 May 2005 21:39:47 +1000), Herbert Xu <[email protected]> says:

> YOSHIFUJI Hideaki / ???? <[email protected]> wrote:
> > In article <[email protected]> (at Wed, 04 May 2005 19:53:53 -0700), Mike Christie <[email protected]> says:
> >
> >> +struct iscsi_uevent {
> > :
> >> +} __attribute__ ((aligned (sizeof(unsigned long))));
> >
> > I think it'd be better to use sizeof(uint64_t) or something.
>
> Is there a benefit in aligning on 64-bit boundaries for 32-bit platforms?

Well, this if for avoiding inconsistency between kernel and userspace.
If you use unsigned long, sizeof(unsigned long) may be inconssitent
between kernel and userland like this:
kernel: sizeof(unsigned long) == 8
userspace: sizeof(unsigned long) == 4

--yoshfuji

2005-05-05 12:22:56

by Matthew Wilcox

[permalink] [raw]
Subject: Re: [PATCH 2/3] add open iscsi netlink interface to iscsi transport class

On Thu, May 05, 2005 at 06:55:03PM +0900, YOSHIFUJI Hideaki / ?$B5HF#1QL@ wrote:
> In article <[email protected]> (at Wed, 04 May 2005 19:53:53 -0700), Mike Christie <[email protected]> says:
>
> > +struct iscsi_uevent {
> :
> > +} __attribute__ ((aligned (sizeof(unsigned long))));
>
> I think it'd be better to use sizeof(uint64_t) or something.

Actually, it's completely unnecessary. iscsi_uevent contains a uint64_t
element, and the GCC docs (in the 'Type attribute' section, documenting
aligned) say:

Note that the alignment of any given `struct' or `union' type is
required by the ISO C standard to be at least a perfect multiple of
the lowest common multiple of the alignments of all of the members
of the `struct' or `union' in question. This means that you _can_

So best to just delete it. It has no effect.

> Please check other spots, too. e.g.:
>
> > + struct iscsi_stats_custom custom[0]
> > + __attribute__ ((aligned (sizeof(unsigned long))));

This one's probably useless too, but it's hard to tell since the patches
weren't sent inline thus making them difficult to cross-reference.

--
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain