From 26d7de1889cd9af635e5e8d9f515537ea3871d26 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 21 May 2002 21:50:24 -0700 Subject: [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 which is now directly included by the 24 files that actually need it. --- include/linux/fs.h | 46 +----------------------------------------- include/linux/namei.h | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 45 deletions(-) create mode 100644 include/linux/namei.h (limited to 'include/linux') 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 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 */ @@ -1166,25 +1154,6 @@ extern ino_t find_inode_number(struct dentry *, struct qstr *); #include -/* - * 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 @@ -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 */ -- cgit v1.2.3