summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2002-05-21 21:50:24 -0700
committerChristoph Hellwig <hch@infradead.org>2002-05-21 21:50:24 -0700
commit26d7de1889cd9af635e5e8d9f515537ea3871d26 (patch)
tree4ace7b06b348742f1d98c873774fd3e6057dd122
parent17eb4a37572617e20ac06ef6ff096efb901b0a36 (diff)
[PATCH] split namei.h out of fs.h
Currently fs.h is full of unrelated declarations and included in almost any source file. Thus it makes sense to spilt certain aspects out that are only used by few users. This patch starts with the namei/path lookup interface and splits it into <linux/namei.h> which is now directly included by the 24 files that actually need it.
-rw-r--r--drivers/usb/core/inode.c1
-rw-r--r--fs/autofs/dirhash.c2
-rw-r--r--fs/binfmt_misc.c1
-rw-r--r--fs/coda/pioctl.c1
-rw-r--r--fs/driverfs/inode.c1
-rw-r--r--fs/exec.c1
-rw-r--r--fs/exportfs/expfs.c1
-rw-r--r--fs/namei.c1
-rw-r--r--fs/namespace.c1
-rw-r--r--fs/nfs/dir.c1
-rw-r--r--fs/nfsctl.c1
-rw-r--r--fs/nfsd/export.c1
-rw-r--r--fs/nfsd/nfs3xdr.c2
-rw-r--r--fs/nfsd/nfsproc.c1
-rw-r--r--fs/nfsd/vfs.c1
-rw-r--r--fs/open.c1
-rw-r--r--fs/proc/base.c1
-rw-r--r--fs/quota.c1
-rw-r--r--fs/stat.c1
-rw-r--r--fs/super.c1
-rw-r--r--fs/xattr.c1
-rw-r--r--include/linux/fs.h46
-rw-r--r--include/linux/namei.h56
-rw-r--r--kernel/ksyms.c1
-rw-r--r--mm/swapfile.c1
-rw-r--r--net/unix/af_unix.c1
26 files changed, 83 insertions, 45 deletions
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index 73527b766d81..5b7fac56a9a7 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -35,6 +35,7 @@
#include <linux/init.h>
#include <linux/proc_fs.h>
#include <linux/usb.h>
+#include <linux/namei.h>
#include <linux/usbdevice_fs.h>
#include <linux/smp_lock.h>
#include <asm/byteorder.h>
diff --git a/fs/autofs/dirhash.c b/fs/autofs/dirhash.c
index 448143fd0796..6b0a3595db05 100644
--- a/fs/autofs/dirhash.c
+++ b/fs/autofs/dirhash.c
@@ -10,6 +10,8 @@
*
* ------------------------------------------------------------------------- */
+#include <linux/dcache.h>
+#include <linux/namei.h>
#include "autofs_i.h"
/* Functions for maintenance of expiry queue */
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 49e76ddda8cc..926ff80a8bcc 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -24,6 +24,7 @@
#include <linux/ctype.h>
#include <linux/file.h>
#include <linux/pagemap.h>
+#include <linux/namei.h>
#include <asm/uaccess.h>
diff --git a/fs/coda/pioctl.c b/fs/coda/pioctl.c
index 53f4d2c714dc..e4633745e1e5 100644
--- a/fs/coda/pioctl.c
+++ b/fs/coda/pioctl.c
@@ -15,6 +15,7 @@
#include <linux/errno.h>
#include <linux/string.h>
#define __NO_VERSION__
+#include <linux/namei.h>
#include <linux/module.h>
#include <asm/uaccess.h>
diff --git a/fs/driverfs/inode.c b/fs/driverfs/inode.c
index 438dc6fa38ff..5de6cd337e74 100644
--- a/fs/driverfs/inode.c
+++ b/fs/driverfs/inode.c
@@ -29,6 +29,7 @@
#include <linux/stat.h>
#include <linux/fs.h>
#include <linux/dcache.h>
+#include <linux/namei.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/device.h>
diff --git a/fs/exec.c b/fs/exec.c
index e7e4da3c3a8d..532d18eadc3e 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -38,6 +38,7 @@
#include <linux/binfmts.h>
#define __NO_VERSION__
#include <linux/module.h>
+#include <linux/namei.h>
#include <asm/uaccess.h>
#include <asm/pgalloc.h>
diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
index 9046e59def5e..3a3e2ffdfe48 100644
--- a/fs/exportfs/expfs.c
+++ b/fs/exportfs/expfs.c
@@ -2,6 +2,7 @@
#include <linux/fs.h>
#include <linux/module.h>
#include <linux/smp_lock.h>
+#include <linux/namei.h>
struct export_operations export_op_default;
diff --git a/fs/namei.c b/fs/namei.c
index 8ed094ea90b0..5b6e0cf59ec8 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -17,6 +17,7 @@
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/fs.h>
+#include <linux/namei.h>
#include <linux/quotaops.h>
#include <linux/pagemap.h>
#include <linux/dnotify.h>
diff --git a/fs/namespace.c b/fs/namespace.c
index 1225bac1bafa..64515aa0025e 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -18,6 +18,7 @@
#include <linux/module.h>
#include <linux/seq_file.h>
#include <linux/namespace.h>
+#include <linux/namei.h>
#include <asm/uaccess.h>
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 31d58c25914f..40c622741d69 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -30,6 +30,7 @@
#include <linux/nfs_mount.h>
#include <linux/pagemap.h>
#include <linux/smp_lock.h>
+#include <linux/namei.h>
#define NFS_PARANOIA 1
/* #define NFS_DEBUG_VERBOSE 1 */
diff --git a/fs/nfsctl.c b/fs/nfsctl.c
index 99afff5ad4ce..42a0d1125f49 100644
--- a/fs/nfsctl.c
+++ b/fs/nfsctl.c
@@ -11,6 +11,7 @@
#include <linux/nfsd/nfsd.h>
#include <linux/nfsd/syscall.h>
#include <linux/linkage.h>
+#include <linux/namei.h>
#include <asm/uaccess.h>
/*
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 936781bb107b..1ccea370c9aa 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -21,6 +21,7 @@
#include <linux/in.h>
#include <linux/seq_file.h>
#include <linux/rwsem.h>
+#include <linux/namei.h>
#include <linux/sunrpc/svc.h>
#include <linux/nfsd/nfsd.h>
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 20b86a0e79df..b5994d6b36cf 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -9,6 +9,8 @@
#include <linux/types.h>
#include <linux/time.h>
#include <linux/nfs3.h>
+#include <linux/dcache.h>
+#include <linux/namei.h>
#include <linux/sunrpc/xdr.h>
#include <linux/sunrpc/svc.h>
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index 5527f0d6b5d4..139a76099c7d 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -15,6 +15,7 @@
#include <linux/fcntl.h>
#include <linux/net.h>
#include <linux/in.h>
+#include <linux/namei.h>
#include <linux/version.h>
#include <linux/unistd.h>
#include <linux/slab.h>
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index b9d0bbfb333a..02419edd0250 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -32,6 +32,7 @@
#include <linux/in.h>
#define __NO_VERSION__
#include <linux/module.h>
+#include <linux/namei.h>
#include <linux/sunrpc/svc.h>
#include <linux/nfsd/nfsd.h>
diff --git a/fs/open.c b/fs/open.c
index 2ef917feadb7..55f8b0083f0d 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -15,6 +15,7 @@
#include <linux/slab.h>
#include <linux/tty.h>
#include <linux/iobuf.h>
+#include <linux/namei.h>
#include <linux/backing-dev.h>
#include <asm/uaccess.h>
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 4e839bd9eade..c8a80b066a72 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -24,6 +24,7 @@
#include <linux/file.h>
#include <linux/string.h>
#include <linux/seq_file.h>
+#include <linux/namei.h>
#include <linux/namespace.h>
#include <linux/mm.h>
#include <linux/smp_lock.h>
diff --git a/fs/quota.c b/fs/quota.c
index e877afd9a9e2..422e4cf7ce12 100644
--- a/fs/quota.c
+++ b/fs/quota.c
@@ -11,6 +11,7 @@
#include <asm/uaccess.h>
#include <linux/kernel.h>
#include <linux/smp_lock.h>
+#include <linux/namei.h>
#ifdef CONFIG_QIFACE_COMPAT
#include <linux/quotacompat.h>
#endif
diff --git a/fs/stat.c b/fs/stat.c
index a09b7f6abd73..3f963e9d9c93 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -11,6 +11,7 @@
#include <linux/smp_lock.h>
#include <linux/highuid.h>
#include <linux/fs.h>
+#include <linux/namei.h>
#include <asm/uaccess.h>
diff --git a/fs/super.c b/fs/super.c
index 13f1b7a7e34d..1d45d67fc611 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -27,6 +27,7 @@
#include <linux/acct.h>
#include <linux/blkdev.h>
#include <linux/quotaops.h>
+#include <linux/namei.h>
#include <asm/uaccess.h>
void get_filesystem(struct file_system_type *fs);
diff --git a/fs/xattr.c b/fs/xattr.c
index 20a7f5b049f9..387d7dc74fe5 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -12,6 +12,7 @@
#include <linux/smp_lock.h>
#include <linux/file.h>
#include <linux/xattr.h>
+#include <linux/namei.h>
#include <asm/uaccess.h>
/*
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 0f2ae2f148e6..95cd02771592 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -27,6 +27,7 @@
#include <asm/atomic.h>
struct poll_table_struct;
+struct nameidata;
/*
@@ -605,16 +606,6 @@ extern void kill_fasync(struct fasync_struct **, int, int);
/* only for net: no internal synchronization */
extern void __kill_fasync(struct fasync_struct *, int, int);
-struct nameidata {
- struct dentry *dentry;
- struct vfsmount *mnt;
- struct qstr last;
- unsigned int flags;
- int last_type;
- struct dentry *old_dentry;
- struct vfsmount *old_mnt;
-};
-
/*
* Umount options
*/
@@ -707,9 +698,6 @@ extern int vfs_rmdir(struct inode *, struct dentry *);
extern int vfs_unlink(struct inode *, struct dentry *);
extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
-extern struct dentry *lock_rename(struct dentry *, struct dentry *);
-extern void unlock_rename(struct dentry *, struct dentry *);
-
/*
* File types
*/
@@ -1167,25 +1155,6 @@ extern ino_t find_inode_number(struct dentry *, struct qstr *);
#include <linux/err.h>
/*
- * The bitmask for a lookup event:
- * - follow links at the end
- * - require a directory
- * - ending slashes ok even for nonexistent files
- * - internal "there are more path compnents" flag
- * - locked when lookup done with dcache_lock held
- */
-#define LOOKUP_FOLLOW (1)
-#define LOOKUP_DIRECTORY (2)
-#define LOOKUP_CONTINUE (4)
-#define LOOKUP_PARENT (16)
-#define LOOKUP_NOALT (32)
-
-/*
- * Type of the last component on LOOKUP_PARENT
- */
-enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
-
-/*
* "descriptor" for what we're up to with a read for sendfile().
* This allows us to use the same read code yet
* have multiple different users of the data that
@@ -1206,19 +1175,6 @@ typedef int (*read_actor_t)(read_descriptor_t *, struct page *, unsigned long, u
/* needed for stackable file system support */
extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
-extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *));
-extern int FASTCALL(path_init(const char *, unsigned, struct nameidata *));
-extern int FASTCALL(path_walk(const char *, struct nameidata *));
-extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *));
-extern int FASTCALL(link_path_walk(const char *, struct nameidata *));
-extern void path_release(struct nameidata *);
-extern int follow_down(struct vfsmount **, struct dentry **);
-extern int follow_up(struct vfsmount **, struct dentry **);
-extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
-extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
-#define user_path_walk(name,nd) __user_walk(name, LOOKUP_FOLLOW, nd)
-#define user_path_walk_link(name,nd) __user_walk(name, 0, nd)
-
extern void inode_init_once(struct inode *);
extern void iput(struct inode *);
extern void force_delete(struct inode *);
diff --git a/include/linux/namei.h b/include/linux/namei.h
new file mode 100644
index 000000000000..2c789cf0d4fc
--- /dev/null
+++ b/include/linux/namei.h
@@ -0,0 +1,56 @@
+#ifndef _LINUX_NAMEI_H
+#define _LINUX_NAMEI_H
+
+struct vfsmount;
+
+struct nameidata {
+ struct dentry *dentry;
+ struct vfsmount *mnt;
+ struct qstr last;
+ unsigned int flags;
+ int last_type;
+ struct dentry *old_dentry;
+ struct vfsmount *old_mnt;
+};
+
+/*
+ * Type of the last component on LOOKUP_PARENT
+ */
+enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
+
+/*
+ * The bitmask for a lookup event:
+ * - follow links at the end
+ * - require a directory
+ * - ending slashes ok even for nonexistent files
+ * - internal "there are more path compnents" flag
+ * - locked when lookup done with dcache_lock held
+ */
+#define LOOKUP_FOLLOW 1
+#define LOOKUP_DIRECTORY 2
+#define LOOKUP_CONTINUE 4
+#define LOOKUP_PARENT 16
+#define LOOKUP_NOALT 32
+
+
+extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *));
+#define user_path_walk(name,nd) \
+ __user_walk(name, LOOKUP_FOLLOW, nd)
+#define user_path_walk_link(name,nd) \
+ __user_walk(name, 0, nd)
+extern int FASTCALL(path_init(const char *, unsigned, struct nameidata *));
+extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *));
+extern int FASTCALL(path_walk(const char *, struct nameidata *));
+extern int FASTCALL(link_path_walk(const char *, struct nameidata *));
+extern void path_release(struct nameidata *);
+
+extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
+extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
+
+extern int follow_down(struct vfsmount **, struct dentry **);
+extern int follow_up(struct vfsmount **, struct dentry **);
+
+extern struct dentry *lock_rename(struct dentry *, struct dentry *);
+extern void unlock_rename(struct dentry *, struct dentry *);
+
+#endif /* _LINUX_NAMEI_H */
diff --git a/kernel/ksyms.c b/kernel/ksyms.c
index 9b1201822582..9c38804e4694 100644
--- a/kernel/ksyms.c
+++ b/kernel/ksyms.c
@@ -47,6 +47,7 @@
#include <linux/completion.h>
#include <linux/seq_file.h>
#include <linux/binfmts.h>
+#include <linux/namei.h>
#include <asm/checksum.h>
#if defined(CONFIG_PROC_FS)
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 504c34fbbaf0..a1fe966321e7 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -13,6 +13,7 @@
#include <linux/swapctl.h>
#include <linux/vmalloc.h>
#include <linux/pagemap.h>
+#include <linux/namei.h>
#include <linux/shm.h>
#include <linux/blkdev.h>
#include <linux/compiler.h>
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 2891751d9b5f..bd6fb1b8f9f2 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -88,6 +88,7 @@
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/stat.h>
+#include <linux/namei.h>
#include <linux/socket.h>
#include <linux/un.h>
#include <linux/fcntl.h>