Commit 26d7de18 authored by Christoph Hellwig's avatar Christoph Hellwig

[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.
parent 17eb4a37
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/namei.h>
#include <linux/usbdevice_fs.h> #include <linux/usbdevice_fs.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
* *
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */
#include <linux/dcache.h>
#include <linux/namei.h>
#include "autofs_i.h" #include "autofs_i.h"
/* Functions for maintenance of expiry queue */ /* Functions for maintenance of expiry queue */
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/file.h> #include <linux/file.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/namei.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/string.h> #include <linux/string.h>
#define __NO_VERSION__ #define __NO_VERSION__
#include <linux/namei.h>
#include <linux/module.h> #include <linux/module.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/stat.h> #include <linux/stat.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/dcache.h> #include <linux/dcache.h>
#include <linux/namei.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/device.h> #include <linux/device.h>
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <linux/binfmts.h> #include <linux/binfmts.h>
#define __NO_VERSION__ #define __NO_VERSION__
#include <linux/module.h> #include <linux/module.h>
#include <linux/namei.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/pgalloc.h> #include <asm/pgalloc.h>
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/namei.h>
struct export_operations export_op_default; struct export_operations export_op_default;
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/namei.h>
#include <linux/quotaops.h> #include <linux/quotaops.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/dnotify.h> #include <linux/dnotify.h>
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/namespace.h> #include <linux/namespace.h>
#include <linux/namei.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <linux/nfs_mount.h> #include <linux/nfs_mount.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/namei.h>
#define NFS_PARANOIA 1 #define NFS_PARANOIA 1
/* #define NFS_DEBUG_VERBOSE 1 */ /* #define NFS_DEBUG_VERBOSE 1 */
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/nfsd/nfsd.h> #include <linux/nfsd/nfsd.h>
#include <linux/nfsd/syscall.h> #include <linux/nfsd/syscall.h>
#include <linux/linkage.h> #include <linux/linkage.h>
#include <linux/namei.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
/* /*
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/in.h> #include <linux/in.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/rwsem.h> #include <linux/rwsem.h>
#include <linux/namei.h>
#include <linux/sunrpc/svc.h> #include <linux/sunrpc/svc.h>
#include <linux/nfsd/nfsd.h> #include <linux/nfsd/nfsd.h>
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/nfs3.h> #include <linux/nfs3.h>
#include <linux/dcache.h>
#include <linux/namei.h>
#include <linux/sunrpc/xdr.h> #include <linux/sunrpc/xdr.h>
#include <linux/sunrpc/svc.h> #include <linux/sunrpc/svc.h>
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/fcntl.h> #include <linux/fcntl.h>
#include <linux/net.h> #include <linux/net.h>
#include <linux/in.h> #include <linux/in.h>
#include <linux/namei.h>
#include <linux/version.h> #include <linux/version.h>
#include <linux/unistd.h> #include <linux/unistd.h>
#include <linux/slab.h> #include <linux/slab.h>
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/in.h> #include <linux/in.h>
#define __NO_VERSION__ #define __NO_VERSION__
#include <linux/module.h> #include <linux/module.h>
#include <linux/namei.h>
#include <linux/sunrpc/svc.h> #include <linux/sunrpc/svc.h>
#include <linux/nfsd/nfsd.h> #include <linux/nfsd/nfsd.h>
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/iobuf.h> #include <linux/iobuf.h>
#include <linux/namei.h>
#include <linux/backing-dev.h> #include <linux/backing-dev.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/file.h> #include <linux/file.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/namei.h>
#include <linux/namespace.h> #include <linux/namespace.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/namei.h>
#ifdef CONFIG_QIFACE_COMPAT #ifdef CONFIG_QIFACE_COMPAT
#include <linux/quotacompat.h> #include <linux/quotacompat.h>
#endif #endif
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/highuid.h> #include <linux/highuid.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/namei.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/acct.h> #include <linux/acct.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/quotaops.h> #include <linux/quotaops.h>
#include <linux/namei.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
void get_filesystem(struct file_system_type *fs); void get_filesystem(struct file_system_type *fs);
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/file.h> #include <linux/file.h>
#include <linux/xattr.h> #include <linux/xattr.h>
#include <linux/namei.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
/* /*
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <asm/atomic.h> #include <asm/atomic.h>
struct poll_table_struct; struct poll_table_struct;
struct nameidata;
/* /*
...@@ -605,16 +606,6 @@ extern void kill_fasync(struct fasync_struct **, int, int); ...@@ -605,16 +606,6 @@ extern void kill_fasync(struct fasync_struct **, int, int);
/* only for net: no internal synchronization */ /* only for net: no internal synchronization */
extern void __kill_fasync(struct fasync_struct *, int, int); 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 * Umount options
*/ */
...@@ -707,9 +698,6 @@ extern int vfs_rmdir(struct inode *, struct dentry *); ...@@ -707,9 +698,6 @@ extern int vfs_rmdir(struct inode *, struct dentry *);
extern int vfs_unlink(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 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 * File types
*/ */
...@@ -1166,25 +1154,6 @@ extern ino_t find_inode_number(struct dentry *, struct qstr *); ...@@ -1166,25 +1154,6 @@ extern ino_t find_inode_number(struct dentry *, struct qstr *);
#include <linux/err.h> #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(). * "descriptor" for what we're up to with a read for sendfile().
* This allows us to use the same read code yet * This allows us to use the same read code yet
...@@ -1206,19 +1175,6 @@ typedef int (*read_actor_t)(read_descriptor_t *, struct page *, unsigned long, u ...@@ -1206,19 +1175,6 @@ typedef int (*read_actor_t)(read_descriptor_t *, struct page *, unsigned long, u
/* needed for stackable file system support */ /* needed for stackable file system support */
extern loff_t default_llseek(struct file *file, loff_t offset, int origin); 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 inode_init_once(struct inode *);
extern void iput(struct inode *); extern void iput(struct inode *);
extern void force_delete(struct inode *); extern void force_delete(struct inode *);
......
#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 */
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/binfmts.h> #include <linux/binfmts.h>
#include <linux/namei.h>
#include <asm/checksum.h> #include <asm/checksum.h>
#if defined(CONFIG_PROC_FS) #if defined(CONFIG_PROC_FS)
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/swapctl.h> #include <linux/swapctl.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/namei.h>
#include <linux/shm.h> #include <linux/shm.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/compiler.h> #include <linux/compiler.h>
......
...@@ -88,6 +88,7 @@ ...@@ -88,6 +88,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/stat.h> #include <linux/stat.h>
#include <linux/namei.h>
#include <linux/socket.h> #include <linux/socket.h>
#include <linux/un.h> #include <linux/un.h>
#include <linux/fcntl.h> #include <linux/fcntl.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment