public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.6 patch] efs: make a struct static
@ 2004-10-30 17:56 Adrian Bunk
  2004-10-30 21:41 ` Denis Vlasenko
  0 siblings, 1 reply; 3+ messages in thread
From: Adrian Bunk @ 2004-10-30 17:56 UTC (permalink / raw)
  To: linux-kernel

The patch below makes a struct in the efs code static.


Signed-off-by: Adrian Bunk <bunk@stusta.de>

--- 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[] = {


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [2.6 patch] efs: make a struct static
  2004-10-30 17:56 [2.6 patch] efs: make a struct static Adrian Bunk
@ 2004-10-30 21:41 ` Denis Vlasenko
  2004-12-12  2:10   ` Adrian Bunk
  0 siblings, 1 reply; 3+ messages in thread
From: Denis Vlasenko @ 2004-10-30 21:41 UTC (permalink / raw)
  To: Adrian Bunk, linux-kernel

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@stusta.de>
> 
> --- 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [2.6 patch] efs: make a struct static
  2004-10-30 21:41 ` Denis Vlasenko
@ 2004-12-12  2:10   ` Adrian Bunk
  0 siblings, 0 replies; 3+ messages in thread
From: Adrian Bunk @ 2004-12-12  2:10 UTC (permalink / raw)
  To: Denis Vlasenko; +Cc: linux-kernel

On Sun, Oct 31, 2004 at 12:41:25AM +0300, Denis Vlasenko wrote:
> 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@stusta.de>
> > 
> > --- 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.

Not that the previous code was much better...

> 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:
>...

Sounds good, updated patch below.


The patch below makes a needessly global struct in the efs code static.


diffstat output:
 fs/efs/super.c         |   20 ++++++++++++++++++++
 include/linux/efs_vh.h |   17 -----------------
 2 files changed, 20 insertions(+), 17 deletions(-)


Signed-off-by: Adrian Bunk <bunk@stusta.de>

--- linux-2.6.10-rc2-mm4-full/include/linux/efs_vh.h.old	2004-12-12 00:28:23.000000000 +0100
+++ linux-2.6.10-rc2-mm4-full/include/linux/efs_vh.h	2004-12-12 00:30:45.000000000 +0100
@@ -47,23 +47,6 @@
 struct pt_types {
 	int	pt_type;
 	char	*pt_name;
-} sgi_pt_types[] = {
-	{0x00,		"SGI vh"},
-	{0x01,		"SGI trkrepl"},
-	{0x02,		"SGI secrepl"},
-	{0x03,		"SGI raw"},
-	{0x04,		"SGI bsd"},
-	{SGI_SYSV,	"SGI sysv"},
-	{0x06,		"SGI vol"},
-	{SGI_EFS,	"SGI efs"},
-	{0x08,		"SGI lv"},
-	{0x09,		"SGI rlv"},
-	{0x0A,		"SGI xfs"},
-	{0x0B,		"SGI xfslog"},
-	{0x0C,		"SGI xlv"},
-	{0x82,		"Linux swap"},
-	{0x83,		"Linux native"},
-	{0,		NULL}
 };
 
 #endif /* __EFS_VH_H__ */
--- linux-2.6.10-rc2-mm4-full/fs/efs/super.c.old	2004-12-12 00:29:46.000000000 +0100
+++ linux-2.6.10-rc2-mm4-full/fs/efs/super.c	2004-12-12 00:30:32.000000000 +0100
@@ -32,6 +32,26 @@
 	.fs_flags	= FS_REQUIRES_DEV,
 };
 
+static struct pt_types sgi_pt_types[] = {
+	{0x00,		"SGI vh"},
+	{0x01,		"SGI trkrepl"},
+	{0x02,		"SGI secrepl"},
+	{0x03,		"SGI raw"},
+	{0x04,		"SGI bsd"},
+	{SGI_SYSV,	"SGI sysv"},
+	{0x06,		"SGI vol"},
+	{SGI_EFS,	"SGI efs"},
+	{0x08,		"SGI lv"},
+	{0x09,		"SGI rlv"},
+	{0x0A,		"SGI xfs"},
+	{0x0B,		"SGI xfslog"},
+	{0x0C,		"SGI xlv"},
+	{0x82,		"Linux swap"},
+	{0x83,		"Linux native"},
+	{0,		NULL}
+};
+
+
 static kmem_cache_t * efs_inode_cachep;
 
 static struct inode *efs_alloc_inode(struct super_block *sb)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-12-12  2:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-30 17:56 [2.6 patch] efs: make a struct static Adrian Bunk
2004-10-30 21:41 ` Denis Vlasenko
2004-12-12  2:10   ` Adrian Bunk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox