Re: [2.6 patch] efs: make a struct static

From: Denis Vlasenko
Date: Sat Oct 30 2004 - 16:48:21 EST


On Saturday 30 October 2004 20:56, Adrian Bunk wrote:
> The patch below makes a struct in the efs code static.
>
>
> Signed-off-by: Adrian Bunk <bunk@xxxxxxxxx>
>
> --- linux-2.6.10-rc1-mm2-full/include/linux/efs_vh.h.old 2004-10-30 14:03:58.000000000 +0200
> +++ linux-2.6.10-rc1-mm2-full/include/linux/efs_vh.h 2004-10-30 14:04:13.000000000 +0200
> @@ -44,7 +44,7 @@
> #define SGI_EFS 0x07
> #define IS_EFS(x) (((x) == SGI_EFS) || ((x) == SGI_SYSV))
>
> -struct pt_types {
> +static struct pt_types {
> int pt_type;
> char *pt_name;
> } sgi_pt_types[] = {

You made a variable in .h file static. This is a no-no.

Only fs/efs/super.c includes linux/efs_vh.h now, but if
it will be ever included into another files, you
will get silent data duplication.

Unless I miss something, you really wanted to do:

.h file:

struct pt_types {
int pt_type;
char *pt_name;
};
extern struct pt_types sgi_pt_types[];

.c file:

struct pt_types sgi_pt_types[] = {
{0x00, "SGI vh"},
....
{0, NULL}
};

--
vda

-
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/