* fs/fat - fix sparse warning
@ 2005-10-31 11:36 Ben Dooks
2005-10-31 13:27 ` Alexey Dobriyan
2005-10-31 14:15 ` OGAWA Hirofumi
0 siblings, 2 replies; 5+ messages in thread
From: Ben Dooks @ 2005-10-31 11:36 UTC (permalink / raw)
To: hirofumi, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1752 bytes --]
move fat_cache_init/fat_cache_destroy to a common
header file in fs/fat so that inode.c and cache.c
see the same definition, and to stop warnings
from sparse about undeclared functions
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
diff -urpN -X ../dontdiff linux-2.6.14-git3/fs/fat/cache.c linux-2.6.14-git3-bjd1/fs/fat/cache.c
--- linux-2.6.14-git3/fs/fat/cache.c 2005-09-01 21:02:38.000000000 +0100
+++ linux-2.6.14-git3-bjd1/fs/fat/cache.c 2005-10-31 11:31:32.000000000 +0000
@@ -12,6 +12,8 @@
#include <linux/msdos_fs.h>
#include <linux/buffer_head.h>
+#include "cache.h"
+
/* this must be > 0. */
#define FAT_MAX_CACHE 8
diff -urpN -X ../dontdiff linux-2.6.14-git3/fs/fat/cache.h linux-2.6.14-git3-bjd1/fs/fat/cache.h
--- linux-2.6.14-git3/fs/fat/cache.h 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.14-git3-bjd1/fs/fat/cache.h 2005-10-31 11:32:37.000000000 +0000
@@ -0,0 +1,8 @@
+/* linux/fs/fat/cache.h
+ *
+ * Written 1992,1993 by Werner Almesberger
+ * header, 2005, Ben Dooks
+*/
+
+extern int __init fat_cache_init(void);
+extern void fat_cache_destroy(void);
diff -urpN -X ../dontdiff linux-2.6.14-git3/fs/fat/inode.c linux-2.6.14-git3-bjd1/fs/fat/inode.c
--- linux-2.6.14-git3/fs/fat/inode.c 2005-10-28 11:28:31.000000000 +0100
+++ linux-2.6.14-git3-bjd1/fs/fat/inode.c 2005-10-31 11:32:29.000000000 +0000
@@ -24,6 +24,8 @@
#include <linux/parser.h>
#include <asm/unaligned.h>
+#include "cache.h"
+
#ifndef CONFIG_FAT_DEFAULT_IOCHARSET
/* if user don't select VFAT, this is undefined. */
#define CONFIG_FAT_DEFAULT_IOCHARSET ""
@@ -1346,9 +1348,6 @@ out_fail:
EXPORT_SYMBOL(fat_fill_super);
-int __init fat_cache_init(void);
-void fat_cache_destroy(void);
-
static int __init init_fat_fs(void)
{
int err;
[-- Attachment #2: 2614-fat-fix-cache-decl.patch --]
[-- Type: text/plain, Size: 1518 bytes --]
diff -urpN -X ../dontdiff linux-2.6.14-git3/fs/fat/cache.c linux-2.6.14-git3-bjd1/fs/fat/cache.c
--- linux-2.6.14-git3/fs/fat/cache.c 2005-09-01 21:02:38.000000000 +0100
+++ linux-2.6.14-git3-bjd1/fs/fat/cache.c 2005-10-31 11:31:32.000000000 +0000
@@ -12,6 +12,8 @@
#include <linux/msdos_fs.h>
#include <linux/buffer_head.h>
+#include "cache.h"
+
/* this must be > 0. */
#define FAT_MAX_CACHE 8
diff -urpN -X ../dontdiff linux-2.6.14-git3/fs/fat/cache.h linux-2.6.14-git3-bjd1/fs/fat/cache.h
--- linux-2.6.14-git3/fs/fat/cache.h 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.14-git3-bjd1/fs/fat/cache.h 2005-10-31 11:32:37.000000000 +0000
@@ -0,0 +1,8 @@
+/* linux/fs/fat/cache.h
+ *
+ * Written 1992,1993 by Werner Almesberger
+ * header, 2005, Ben Dooks
+*/
+
+extern int __init fat_cache_init(void);
+extern void fat_cache_destroy(void);
diff -urpN -X ../dontdiff linux-2.6.14-git3/fs/fat/inode.c linux-2.6.14-git3-bjd1/fs/fat/inode.c
--- linux-2.6.14-git3/fs/fat/inode.c 2005-10-28 11:28:31.000000000 +0100
+++ linux-2.6.14-git3-bjd1/fs/fat/inode.c 2005-10-31 11:32:29.000000000 +0000
@@ -24,6 +24,8 @@
#include <linux/parser.h>
#include <asm/unaligned.h>
+#include "cache.h"
+
#ifndef CONFIG_FAT_DEFAULT_IOCHARSET
/* if user don't select VFAT, this is undefined. */
#define CONFIG_FAT_DEFAULT_IOCHARSET ""
@@ -1346,9 +1348,6 @@ out_fail:
EXPORT_SYMBOL(fat_fill_super);
-int __init fat_cache_init(void);
-void fat_cache_destroy(void);
-
static int __init init_fat_fs(void)
{
int err;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: fs/fat - fix sparse warning
2005-10-31 11:36 fs/fat - fix sparse warning Ben Dooks
@ 2005-10-31 13:27 ` Alexey Dobriyan
2005-10-31 14:15 ` OGAWA Hirofumi
1 sibling, 0 replies; 5+ messages in thread
From: Alexey Dobriyan @ 2005-10-31 13:27 UTC (permalink / raw)
To: Ben Dooks; +Cc: hirofumi, linux-kernel
On Mon, Oct 31, 2005 at 11:36:39AM +0000, Ben Dooks wrote:
> move fat_cache_init/fat_cache_destroy to a common
> header file in fs/fat so that inode.c and cache.c
> see the same definition, and to stop warnings
> from sparse about undeclared functions
> --- linux-2.6.14-git3/fs/fat/cache.h
> +++ linux-2.6.14-git3-bjd1/fs/fat/cache.h
> @@ -0,0 +1,8 @@
> +/* linux/fs/fat/cache.h
Every editor can show the name of the current file.
> + *
> + * Written 1992,1993 by Werner Almesberger
> + * header, 2005, Ben Dooks
> +*/
Too much for two-line file.
> +
> +extern int __init fat_cache_init(void);
> +extern void fat_cache_destroy(void);
Where did you pick up "extern"? Prototypes in *.c don't have it.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: fs/fat - fix sparse warning
2005-10-31 11:36 fs/fat - fix sparse warning Ben Dooks
2005-10-31 13:27 ` Alexey Dobriyan
@ 2005-10-31 14:15 ` OGAWA Hirofumi
2005-11-02 18:04 ` Adrian Bunk
1 sibling, 1 reply; 5+ messages in thread
From: OGAWA Hirofumi @ 2005-10-31 14:15 UTC (permalink / raw)
To: Ben Dooks; +Cc: linux-kernel
Ben Dooks <ben-linux@fluff.org> writes:
> move fat_cache_init/fat_cache_destroy to a common
> header file in fs/fat so that inode.c and cache.c
> see the same definition, and to stop warnings
> from sparse about undeclared functions
The fs/fat/* has many internal functions, it is in
include/linux/msdos_fs.h. Please move those internal functions to one
internal header (probably fs/fat/fat.h?).
This seems be just for sparse, please do real cleanup instead.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: fs/fat - fix sparse warning
2005-10-31 14:15 ` OGAWA Hirofumi
@ 2005-11-02 18:04 ` Adrian Bunk
2005-11-02 18:39 ` OGAWA Hirofumi
0 siblings, 1 reply; 5+ messages in thread
From: Adrian Bunk @ 2005-11-02 18:04 UTC (permalink / raw)
To: OGAWA Hirofumi; +Cc: Ben Dooks, linux-kernel
On Mon, Oct 31, 2005 at 11:15:34PM +0900, OGAWA Hirofumi wrote:
> Ben Dooks <ben-linux@fluff.org> writes:
>
> > move fat_cache_init/fat_cache_destroy to a common
> > header file in fs/fat so that inode.c and cache.c
> > see the same definition, and to stop warnings
> > from sparse about undeclared functions
>
> The fs/fat/* has many internal functions, it is in
> include/linux/msdos_fs.h. Please move those internal functions to one
> internal header (probably fs/fat/fat.h?).
>
> This seems be just for sparse, please do real cleanup instead.
It's not only for sparse.
The -Wmissing-prototypes flag to gcc gives similar warnings, and I'm
also cleaning up code for adding this flag to the CFLAGS.
Why?
It sometimes happens that the signature of a function changes and it is
forgotten to update all prototypes.
If the prototype is in a header file, gcc tells about the mistake.
If the prototype is in the C file gcc can't help us and it might take
some time until someone tracks the source of the nasty runtime problems
this might cause.
It's your choice as subsystem maintainer which header file the
prototypes should go into - it is only important that both the file with
the actual function and all users of this function #include this header.
> OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: fs/fat - fix sparse warning
2005-11-02 18:04 ` Adrian Bunk
@ 2005-11-02 18:39 ` OGAWA Hirofumi
0 siblings, 0 replies; 5+ messages in thread
From: OGAWA Hirofumi @ 2005-11-02 18:39 UTC (permalink / raw)
To: Adrian Bunk; +Cc: Ben Dooks, linux-kernel
Adrian Bunk <bunk@stusta.de> writes:
> It sometimes happens that the signature of a function changes and it is
> forgotten to update all prototypes.
>
> If the prototype is in a header file, gcc tells about the mistake.
>
> If the prototype is in the C file gcc can't help us and it might take
> some time until someone tracks the source of the nasty runtime problems
> this might cause.
>
> It's your choice as subsystem maintainer which header file the
> prototypes should go into - it is only important that both the file with
> the actual function and all users of this function #include this header.
Sounds reasonable, although that's unlikely, because those are
init/exit functions. OK, I'll do this in header cleanup as soon as possible.
Thanks.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-11-02 18:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-31 11:36 fs/fat - fix sparse warning Ben Dooks
2005-10-31 13:27 ` Alexey Dobriyan
2005-10-31 14:15 ` OGAWA Hirofumi
2005-11-02 18:04 ` Adrian Bunk
2005-11-02 18:39 ` OGAWA Hirofumi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox