Re: [PATCH] aoe: fix abuse of arrays and sparse warnings
From: Alexey Dobriyan
Date: Thu Feb 24 2005 - 16:59:29 EST
On Thursday 24 February 2005 19:23, Ed L Cashin wrote:
> Have you tested it?
Not yet.
> If you don't have any
> ATA over Ethernet hardware, you can using the alpha vblade program for
> testing.
OK. Will try.
> I was trying to determine what sparse warnings you see, so I got
> sparse from bk://sparse.bkbits.net/sparse and ran it. Your patch cuts
> down significantly on the complaints, but there are some that persist.
> Maybe you're using an older version of sparse?
No. Those three were deliberately left as is because they aren't local to
AOE.
> drivers/block/aoe/aoechr.c:236:24: warning: symbol 'aoe_fops' was not declared. Should it be static?
> drivers/block/aoe/aoecmd.c:27:17: warning: incorrect type in assignment (different base types)
> drivers/block/aoe/aoecmd.c:27:17: expected unsigned short [unsigned] protocol
> drivers/block/aoe/aoecmd.c:27:17: got restricted unsigned short [usertype] [force] <noident>
> drivers/block/aoe/aoenet.c:156:10: warning: incorrect type in initializer (different base types)
> drivers/block/aoe/aoenet.c:156:10: expected unsigned short [unsigned] type
> drivers/block/aoe/aoenet.c:156:10: got restricted unsigned short [usertype] [force] <noident>
> The "array abuse" is something that I'm not all that enthusiastic
> about changing,
I am.
> since it's mostly a style issue,
It isn't.
struct aoe_hdr {
unsigned char tag[4];
};
struct aoe_hdr *h;
u32 net_tag;
net_tag = __cpu_to_be32(n);
memcpy(h->tag, &net_tag, sizeof net_tag);
This code is plain ugly. When AOE was merged there were _plenty_ of examples
of LE and BE fields in structs.
> and last time I
> changed it the way your patch does, the original author of the patch
> changed it back.
Please, show him include/linux/ext2_fs.h::struct ext2_group_desc{} and
fs/ext2/super.c::ext2_check_descriptors(), for example.
> But you've figured out how to make sparse happy, and
> for that I'm grateful! :)
:)
Alexey
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/