Skip to contentSkip to conversation

fs - fix sparse errors

PATCH New Ben Dooks 1 participant 1 message Oct 14, 2005

Subsystems (4)
lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH 1/1 fs - fix sparse errors

There are a number of sparse warnings coming from the fs subdirectory, mainly due to not defining functions that are used by other files, as well as 0/NULL patch to fs/proc/task_mmu.c

This patch creates a header with the definitions in and includes it into the relevant .c files, and moves the proc definitions into linux/proc_fs.h

Also cleans up some static definitions in fs/inotify.c

Files modified:

 fs/block_dev.c          |    2 ++
 fs/char_dev.c           |    2 ++
 fs/compat.c             |    4 ++--
 fs/filesystems.c        |    3 +++
 fs/fs-writeback.c       |    2 +-
 fs/fs.h                 |   16 ++++++++++++++++
 fs/inotify.c            |    6 +++---
 fs/locks.c              |    1 +
 fs/namespace.c          |    2 ++
 fs/proc/proc_misc.c     |   13 -------------
 fs/proc/task_mmu.c      |    2 +-
 fs/super.c              |    3 +--
 include/linux/proc_fs.h |   15 +++++++++++++++
 kernel/exec_domain.c    |    2 +-
 14 files changed, 50 insertions(+), 23 deletions(-)
fs/block_dev.c +2 -0
diff -urpN -X ../dontdiff linux-2.6.14-rc4-bjd3/fs/block_dev.c linux-2.6.14-rc4-bjd3b/fs/block_dev.c
@@ -25,6 +25,8 @@
 #include <linux/namei.h>
 #include <asm/uaccess.h>
 
+#include "fs.h"
+
 struct bdev_inode {
 	struct block_device bdev;
 	struct inode vfs_inode;
fs/char_dev.c +2 -0
diff -urpN -X ../dontdiff linux-2.6.14-rc4-bjd3/fs/char_dev.c linux-2.6.14-rc4-bjd3b/fs/char_dev.c
@@ -20,6 +20,8 @@
 #include <linux/kobj_map.h>
 #include <linux/cdev.h>
 
+#include <linux/proc_fs.h>
+
 #ifdef CONFIG_KMOD
 #include <linux/kmod.h>
 #endif
fs/compat.c +2 -2
diff -urpN -X ../dontdiff linux-2.6.14-rc4-bjd3/fs/compat.c linux-2.6.14-rc4-bjd3b/fs/compat.c
@@ -53,6 +53,8 @@
 #include <asm/mmu_context.h>
 #include <asm/ioctls.h>
 
+#include "fs.h"
+
 /*
  * Not all architectures have sys_utime, so implement this in terms
  * of sys_utimes.
@@ -787,8 +789,6 @@ static int do_nfs4_super_data_conv(void 
 	return 0;
 }
 
-extern int copy_mount_options (const void __user *, unsigned long *);
-
 #define SMBFS_NAME      "smbfs"
 #define NCPFS_NAME      "ncpfs"
 #define NFS4_NAME	"nfs4"
fs/filesystems.c +3 -0
diff -urpN -X ../dontdiff linux-2.6.14-rc4-bjd3/fs/filesystems.c linux-2.6.14-rc4-bjd3b/fs/filesystems.c
@@ -13,6 +13,9 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <asm/uaccess.h>
+#include <linux/proc_fs.h>
+
+#include "fs.h"
 
 /*
  * Handling of filesystem drivers list.
fs/fs-writeback.c +1 -1
diff -urpN -X ../dontdiff linux-2.6.14-rc4-bjd3/fs/fs-writeback.c linux-2.6.14-rc4-bjd3b/fs/fs-writeback.c
@@ -23,7 +23,7 @@
 #include <linux/backing-dev.h>
 #include <linux/buffer_head.h>
 
-extern struct super_block *blockdev_superblock;
+#include "fs.h"
 
 /**
  *	__mark_inode_dirty -	internal function
fs/fs.h +16 -0
diff -urpN -X ../dontdiff linux-2.6.14-rc4-bjd3/fs/fs.h linux-2.6.14-rc4-bjd3b/fs/fs.h
@@ -0,0 +1,16 @@
+/* linux/fs/fs.h
+ *
+ * (C) 2005 Simtec Electronics
+ *	Ben Dooks <[email protected]>
+ *
+ * Filesystem internal declarations
+ *
+ * Licensed under GPLv2 
+*/
+
+extern void get_filesystem(struct file_system_type *fs);
+extern void put_filesystem(struct file_system_type *fs);
+
+extern struct super_block *blockdev_superblock;
+
+extern int copy_mount_options (const void __user *, unsigned long *);
fs/inotify.c +3 -3
diff -urpN -X ../dontdiff linux-2.6.14-rc4-bjd3/fs/inotify.c linux-2.6.14-rc4-bjd3b/fs/inotify.c
@@ -45,9 +45,9 @@ static kmem_cache_t *event_cachep;
 static struct vfsmount *inotify_mnt;
 
 /* these are configurable via /proc/sys/fs/inotify/ */
-int inotify_max_user_instances;
-int inotify_max_user_watches;
-int inotify_max_queued_events;
+static int inotify_max_user_instances;
+static int inotify_max_user_watches;
+static int inotify_max_queued_events;
 
 /*
  * Lock ordering:
fs/locks.c +1 -0
diff -urpN -X ../dontdiff linux-2.6.14-rc4-bjd3/fs/locks.c linux-2.6.14-rc4-bjd3b/fs/locks.c
@@ -125,6 +125,7 @@
 #include <linux/syscalls.h>
 #include <linux/time.h>
 #include <linux/rcupdate.h>
+#include <linux/proc_fs.h>
 
 #include <asm/semaphore.h>
 #include <asm/uaccess.h>
fs/namespace.c +2 -0
diff -urpN -X ../dontdiff linux-2.6.14-rc4-bjd3/fs/namespace.c linux-2.6.14-rc4-bjd3b/fs/namespace.c
@@ -25,6 +25,8 @@
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
 
+#include "fs.h"
+
 extern int __init init_rootfs(void);
 
 #ifdef CONFIG_SYSFS
fs/proc/proc_misc.c +0 -13
diff -urpN -X ../dontdiff linux-2.6.14-rc4-bjd3/fs/proc/proc_misc.c linux-2.6.14-rc4-bjd3b/fs/proc/proc_misc.c
@@ -54,19 +54,6 @@
 
 #define LOAD_INT(x) ((x) >> FSHIFT)
 #define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
-/*
- * Warning: stuff below (imported functions) assumes that its output will fit
- * into one page. For some of those functions it may be wrong. Moreover, we
- * have a way to deal with that gracefully. Right now I used straightforward
- * wrappers, but this needs further analysis wrt potential overflows.
- */
-extern int get_hardware_list(char *);
-extern int get_stram_list(char *);
-extern int get_chrdev_list(char *);
-extern int get_filesystem_list(char *);
-extern int get_exec_domain_list(char *);
-extern int get_dma_list(char *);
-extern int get_locks_status (char *, char **, off_t, int);
 
 static int proc_calc_metrics(char *page, char **start, off_t off,
 				 int count, int *eof, int len)
fs/proc/task_mmu.c +1 -1
diff -urpN -X ../dontdiff linux-2.6.14-rc4-bjd3/fs/proc/task_mmu.c linux-2.6.14-rc4-bjd3b/fs/proc/task_mmu.c
@@ -178,7 +178,7 @@ static int show_map_internal(struct seq_
 
 static int show_map(struct seq_file *m, void *v)
 {
-	return show_map_internal(m, v, 0);
+	return show_map_internal(m, v, NULL);
 }
 
 static void smaps_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
fs/super.c +1 -2
diff -urpN -X ../dontdiff linux-2.6.14-rc4-bjd3/fs/super.c linux-2.6.14-rc4-bjd3b/fs/super.c
@@ -39,9 +39,8 @@
 #include <linux/kobject.h>
 #include <asm/uaccess.h>
 
+#include "fs.h"
 
-void get_filesystem(struct file_system_type *fs);
-void put_filesystem(struct file_system_type *fs);
 struct file_system_type *get_fs_type(const char *name);
 
 LIST_HEAD(super_blocks);
include/linux/proc_fs.h +15 -0
@@ -104,6 +104,21 @@ unsigned long task_vsize(struct mm_struc
 int task_statm(struct mm_struct *, int *, int *, int *, int *);
 char *task_mem(struct mm_struct *, char *);
 
+/*
+ * Warning: stuff below (imported functions) assumes that its output will fit
+ * into one page. For some of those functions it may be wrong. Moreover, we
+ * have a way to deal with that gracefully. Right now I used straightforward
+ * wrappers, but this needs further analysis wrt potential overflows.
+ */
+
+extern int get_locks_status (char *, char **, off_t, int);
+extern int get_filesystem_list(char *);
+extern int get_chrdev_list(char *);
+extern int get_hardware_list(char *);
+extern int get_stram_list(char *);
+extern int get_exec_domain_list(char *);
+extern int get_dma_list(char *);
+
 extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
 						struct proc_dir_entry *parent);
 extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent);
kernel/exec_domain.c +1 -1
diff -urpN -X ../dontdiff linux-2.6.14-rc4-bjd3/kernel/exec_domain.c linux-2.6.14-rc4-bjd3b/kernel/exec_domain.c
@@ -17,7 +17,7 @@
 #include <linux/syscalls.h>
 #include <linux/sysctl.h>
 #include <linux/types.h>
-
+#include <linux/proc_fs.h>
 
 static void default_handler(int, struct pt_regs *);