@@ -50,7 +50,7 @@ prototypes:
int (*rename2) (struct inode *, struct dentry *,
struct inode *, struct dentry *, unsigned int);
int (*readlink) (struct dentry *, char __user *,int);
- void * (*follow_link) (struct dentry *, struct nameidata *);
+ void * (*follow_link) (struct dentry *);
void (*put_link) (struct dentry *, char *, void *);
void (*truncate) (struct inode *);
int (*permission) (struct inode *, int, unsigned int);
@@ -476,3 +476,8 @@ in your dentry operations instead.
->put_link now takes a 'char *' rather than a 'struct nameidata*'.
Instead of calling nd_get_link() on the later, just use the former
directly.
+--
+[mandatory]
+ ->follow_link() no longer receives 'struct nameidata *'.
+ The nd is now attached to 'current' and nd_set_link()
+ accesses it directly.
@@ -350,7 +350,7 @@ struct inode_operations {
int (*rename2) (struct inode *, struct dentry *,
struct inode *, struct dentry *, unsigned int);
int (*readlink) (struct dentry *, char __user *,int);
- void * (*follow_link) (struct dentry *, struct nameidata *);
+ void * (*follow_link) (struct dentry *);
void (*put_link) (struct dentry *, char *, void *);
int (*permission) (struct inode *, int);
int (*get_acl)(struct inode *, int);
@@ -118,7 +118,7 @@ failed:
return rc;
}
-static void *ll_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *ll_follow_link(struct dentry *dentry)
{
unsigned long avail_space;
struct inode *inode = dentry->d_inode;
@@ -151,7 +151,7 @@ static void *ll_follow_link(struct dentry *dentry, struct nameidata *nd)
symname = ERR_PTR(rc);
}
- nd_set_link(nd, symname);
+ nd_set_link(symname);
/* symname may contain a pointer to the request message buffer,
* we delay request releasing until ll_put_link then.
*/
@@ -1274,11 +1274,10 @@ done:
/**
* v9fs_vfs_follow_link - follow a symlink path
* @dentry: dentry for symlink
- * @nd: nameidata
*
*/
-static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *v9fs_vfs_follow_link(struct dentry *dentry)
{
int len = 0;
char *link = __getname();
@@ -1296,7 +1295,7 @@ static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd)
} else
link[min(len, PATH_MAX-1)] = 0;
}
- nd_set_link(nd, link);
+ nd_set_link(link);
return NULL;
}
@@ -1304,7 +1303,6 @@ static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd)
/**
* v9fs_vfs_put_link - release a symlink path
* @dentry: dentry for symlink
- * @nd: nameidata
* @p: unused
*
*/
@@ -905,12 +905,11 @@ error:
/**
* v9fs_vfs_follow_link_dotl - follow a symlink path
* @dentry: dentry for symlink
- * @nd: nameidata
*
*/
static void *
-v9fs_vfs_follow_link_dotl(struct dentry *dentry, struct nameidata *nd)
+v9fs_vfs_follow_link_dotl(struct dentry *dentry)
{
int retval;
struct p9_fid *fid;
@@ -938,7 +937,7 @@ v9fs_vfs_follow_link_dotl(struct dentry *dentry, struct nameidata *nd)
__putname(link);
link = ERR_PTR(retval);
ndset:
- nd_set_link(nd, link);
+ nd_set_link(link);
return NULL;
}
@@ -12,13 +12,13 @@
#include "autofs_i.h"
-static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *autofs4_follow_link(struct dentry *dentry)
{
struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
struct autofs_info *ino = autofs4_dentry_ino(dentry);
if (ino && !autofs4_oz_mode(sbi))
ino->last_used = jiffies;
- nd_set_link(nd, dentry->d_inode->i_private);
+ nd_set_link(dentry->d_inode->i_private);
return NULL;
}
@@ -42,8 +42,8 @@ static struct inode *befs_iget(struct super_block *, unsigned long);
static struct inode *befs_alloc_inode(struct super_block *sb);
static void befs_destroy_inode(struct inode *inode);
static void befs_destroy_inodecache(void);
-static void *befs_follow_link(struct dentry *, struct nameidata *);
-static void *befs_fast_follow_link(struct dentry *, struct nameidata *);
+static void *befs_follow_link(struct dentry *);
+static void *befs_fast_follow_link(struct dentry *);
static int befs_utf2nls(struct super_block *sb, const char *in, int in_len,
char **out, int *out_len);
static int befs_nls2utf(struct super_block *sb, const char *in, int in_len,
@@ -469,7 +469,7 @@ befs_destroy_inodecache(void)
* flag is set.
*/
static void *
-befs_follow_link(struct dentry *dentry, struct nameidata *nd)
+befs_follow_link(struct dentry *dentry)
{
struct super_block *sb = dentry->d_sb;
befs_inode_info *befs_ino = BEFS_I(dentry->d_inode);
@@ -494,16 +494,16 @@ befs_follow_link(struct dentry *dentry, struct nameidata *nd)
link[len - 1] = '\0';
}
}
- nd_set_link(nd, link);
+ nd_set_link(link);
return NULL;
}
static void *
-befs_fast_follow_link(struct dentry *dentry, struct nameidata *nd)
+befs_fast_follow_link(struct dentry *dentry)
{
befs_inode_info *befs_ino = BEFS_I(dentry->d_inode);
- nd_set_link(nd, befs_ino->i_data.symlink);
+ nd_set_link(befs_ino->i_data.symlink);
return NULL;
}
@@ -1691,10 +1691,10 @@ retry:
/*
* symlinks
*/
-static void *ceph_sym_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *ceph_sym_follow_link(struct dentry *dentry)
{
struct ceph_inode_info *ci = ceph_inode(dentry->d_inode);
- nd_set_link(nd, ci->i_symlink);
+ nd_set_link(ci->i_symlink);
return NULL;
}
@@ -120,7 +120,7 @@ extern struct vfsmount *cifs_dfs_d_automount(struct path *path);
#endif
/* Functions related to symlinks */
-extern void *cifs_follow_link(struct dentry *direntry, struct nameidata *nd);
+extern void *cifs_follow_link(struct dentry *direntry);
extern int cifs_readlink(struct dentry *direntry, char __user *buffer,
int buflen);
extern int cifs_symlink(struct inode *inode, struct dentry *direntry,
@@ -627,7 +627,7 @@ cifs_hl_exit:
}
void *
-cifs_follow_link(struct dentry *direntry, struct nameidata *nd)
+cifs_follow_link(struct dentry *direntry)
{
struct inode *inode = direntry->d_inode;
int rc = -ENOMEM;
@@ -679,7 +679,7 @@ out:
free_xid(xid);
if (tlink)
cifs_put_tlink(tlink);
- nd_set_link(nd, target_path);
+ nd_set_link(target_path);
return NULL;
}
@@ -279,7 +279,7 @@ static int configfs_getlink(struct dentry *dentry, char * path)
}
-static void *configfs_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *configfs_follow_link(struct dentry *dentry)
{
int error = -ENOMEM;
unsigned long page = get_zeroed_page(GFP_KERNEL);
@@ -287,12 +287,12 @@ static void *configfs_follow_link(struct dentry *dentry, struct nameidata *nd)
if (page) {
error = configfs_getlink(dentry, (char *)page);
if (!error) {
- nd_set_link(nd, (char *)page);
+ nd_set_link((char *)page);
return (void *)page;
}
}
- nd_set_link(nd, ERR_PTR(error));
+ nd_set_link(ERR_PTR(error));
return NULL;
}
@@ -43,9 +43,9 @@ const struct file_operations debugfs_file_operations = {
.llseek = noop_llseek,
};
-static void *debugfs_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *debugfs_follow_link(struct dentry *dentry)
{
- nd_set_link(nd, dentry->d_inode->i_private);
+ nd_set_link(dentry->d_inode->i_private);
return NULL;
}
@@ -170,7 +170,6 @@ out_unlock:
* @directory_inode: inode of the new file's dentry's parent in ecryptfs
* @ecryptfs_dentry: New file's dentry in ecryptfs
* @mode: The mode of the new file
- * @nd: nameidata of ecryptfs' parent's dentry & vfsmount
*
* Creates the underlying file and the eCryptfs inode which will link to
* it. It will also update the eCryptfs directory inode to mimic the
@@ -384,7 +383,6 @@ static int ecryptfs_lookup_interpose(struct dentry *dentry,
* ecryptfs_lookup
* @ecryptfs_dir_inode: The eCryptfs directory inode
* @ecryptfs_dentry: The eCryptfs dentry that we are looking up
- * @ecryptfs_nd: nameidata; may be NULL
*
* Find a file on disk. If the file does not exist, then we'll add it to the
* dentry cache and continue on to read it from the disk.
@@ -675,7 +673,7 @@ out:
return rc ? ERR_PTR(rc) : buf;
}
-static void *ecryptfs_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *ecryptfs_follow_link(struct dentry *dentry)
{
size_t len;
char *buf = ecryptfs_readlink_lower(dentry, &len);
@@ -685,7 +683,7 @@ static void *ecryptfs_follow_link(struct dentry *dentry, struct nameidata *nd)
ecryptfs_dentry_to_lower(dentry)->d_inode);
buf[len] = '\0';
out:
- nd_set_link(nd, buf);
+ nd_set_link(buf);
return NULL;
}
@@ -35,11 +35,11 @@
#include "exofs.h"
-static void *exofs_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *exofs_follow_link(struct dentry *dentry)
{
struct exofs_i_info *oi = exofs_i(dentry->d_inode);
- nd_set_link(nd, (char *)oi->i_data);
+ nd_set_link((char *)oi->i_data);
return NULL;
}
@@ -21,10 +21,10 @@
#include "xattr.h"
#include <linux/namei.h>
-static void *ext2_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *ext2_follow_link(struct dentry *dentry)
{
struct ext2_inode_info *ei = EXT2_I(dentry->d_inode);
- nd_set_link(nd, (char *)ei->i_data);
+ nd_set_link((char *)ei->i_data);
return NULL;
}
@@ -21,10 +21,10 @@
#include "ext3.h"
#include "xattr.h"
-static void * ext3_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void * ext3_follow_link(struct dentry *dentry)
{
struct ext3_inode_info *ei = EXT3_I(dentry->d_inode);
- nd_set_link(nd, (char*)ei->i_data);
+ nd_set_link((char*)ei->i_data);
return NULL;
}
@@ -23,10 +23,10 @@
#include "ext4.h"
#include "xattr.h"
-static void *ext4_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *ext4_follow_link(struct dentry *dentry)
{
struct ext4_inode_info *ei = EXT4_I(dentry->d_inode);
- nd_set_link(nd, (char *) ei->i_data);
+ nd_set_link((char *) ei->i_data);
return NULL;
}
@@ -39,7 +39,7 @@
#include "vxfs_inode.h"
-static void * vxfs_immed_follow_link(struct dentry *, struct nameidata *);
+static void * vxfs_immed_follow_link(struct dentry *);
static int vxfs_immed_readpage(struct file *, struct page *);
@@ -64,7 +64,6 @@ const struct address_space_operations vxfs_immed_aops = {
/**
* vxfs_immed_follow_link - follow immed symlink
* @dp: dentry for the link
- * @np: pathname lookup data for the current path walk
*
* Description:
* vxfs_immed_follow_link restarts the pathname lookup with
@@ -74,10 +73,10 @@ const struct address_space_operations vxfs_immed_aops = {
* Zero on success, else a negative error code.
*/
static void *
-vxfs_immed_follow_link(struct dentry *dp, struct nameidata *np)
+vxfs_immed_follow_link(struct dentry *dp)
{
struct vxfs_inode_info *vip = VXFS_INO(dp->d_inode);
- nd_set_link(np, vip->vii_immed.vi_immed);
+ nd_set_link(vip->vii_immed.vi_immed);
return NULL;
}
@@ -1400,9 +1400,9 @@ static void free_link(char *link)
free_page((unsigned long) link);
}
-static void *fuse_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *fuse_follow_link(struct dentry *dentry)
{
- nd_set_link(nd, read_link(dentry));
+ nd_set_link(read_link(dentry));
return NULL;
}
@@ -1541,14 +1541,13 @@ out:
/**
* gfs2_follow_link - Follow a symbolic link
* @dentry: The dentry of the link
- * @nd: Data that we pass to vfs_follow_link()
*
* This can handle symlinks of any size.
*
* Returns: 0 on success or error code
*/
-static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *gfs2_follow_link(struct dentry *dentry)
{
struct gfs2_inode *ip = GFS2_I(dentry->d_inode);
struct gfs2_holder i_gh;
@@ -1561,7 +1560,7 @@ static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd)
error = gfs2_glock_nq(&i_gh);
if (error) {
gfs2_holder_uninit(&i_gh);
- nd_set_link(nd, ERR_PTR(error));
+ nd_set_link(ERR_PTR(error));
return NULL;
}
@@ -1586,7 +1585,7 @@ static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd)
brelse(dibh);
out:
gfs2_glock_dq_uninit(&i_gh);
- nd_set_link(nd, buf);
+ nd_set_link(buf);
return NULL;
}
@@ -882,7 +882,7 @@ static const struct inode_operations hostfs_dir_iops = {
.setattr = hostfs_setattr,
};
-static void *hostfs_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *hostfs_follow_link(struct dentry *dentry)
{
char *link = __getname();
if (link) {
@@ -902,7 +902,7 @@ static void *hostfs_follow_link(struct dentry *dentry, struct nameidata *nd)
link = ERR_PTR(-ENOMEM);
}
- nd_set_link(nd, link);
+ nd_set_link(link);
return NULL;
}
@@ -642,11 +642,11 @@ static int hppfs_readlink(struct dentry *dentry, char __user *buffer,
buflen);
}
-static void *hppfs_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *hppfs_follow_link(struct dentry *dentry)
{
struct dentry *proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
- return proc_dentry->d_inode->i_op->follow_link(proc_dentry, nd);
+ return proc_dentry->d_inode->i_op->follow_link(proc_dentry);
}
static void hppfs_put_link(struct dentry *dentry, char *link,
@@ -16,7 +16,7 @@
#include <linux/namei.h>
#include "nodelist.h"
-static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd);
+static void *jffs2_follow_link(struct dentry *dentry);
const struct inode_operations jffs2_symlink_inode_operations =
{
@@ -29,7 +29,7 @@ const struct inode_operations jffs2_symlink_inode_operations =
.removexattr = jffs2_removexattr
};
-static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *jffs2_follow_link(struct dentry *dentry)
{
struct jffs2_inode_info *f = JFFS2_INODE_INFO(dentry->d_inode);
char *p = (char *)f->target;
@@ -54,7 +54,7 @@ static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd)
jffs2_dbg(1, "%s(): target path is '%s'\n",
__func__, (char *)f->target);
- nd_set_link(nd, p);
+ nd_set_link(p);
/*
* We will unlock the f->sem mutex but VFS will use the f->target string. This is safe
@@ -22,10 +22,10 @@
#include "jfs_inode.h"
#include "jfs_xattr.h"
-static void *jfs_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *jfs_follow_link(struct dentry *dentry)
{
char *s = JFS_IP(dentry->d_inode)->i_inline;
- nd_set_link(nd, s);
+ nd_set_link(s);
return NULL;
}
@@ -112,7 +112,7 @@ static int kernfs_getlink(struct dentry *dentry, char *path)
return error;
}
-static void *kernfs_iop_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *kernfs_iop_follow_link(struct dentry *dentry)
{
int error = -ENOMEM;
unsigned long page = get_zeroed_page(GFP_KERNEL);
@@ -121,7 +121,7 @@ static void *kernfs_iop_follow_link(struct dentry *dentry, struct nameidata *nd)
if (error < 0)
free_page((unsigned long)page);
}
- nd_set_link(nd, error ? ERR_PTR(error) : (char *)page);
+ nd_set_link(error ? ERR_PTR(error) : (char *)page);
return NULL;
}
@@ -724,8 +724,10 @@ static inline void path_to_nameidata(const struct path *path,
* Helper to directly jump to a known parsed path from ->follow_link,
* caller must have taken a reference to path beforehand.
*/
-void nd_jump_link(struct nameidata *nd, struct path *path)
+void nd_jump_link(struct path *path)
{
+ struct nameidata *nd = current->nameidata;
+
path_put(&nd->path);
nd->path = *path;
@@ -733,8 +735,10 @@ void nd_jump_link(struct nameidata *nd, struct path *path)
nd->flags |= LOOKUP_JUMPED;
}
-void nd_set_link(struct nameidata *nd, char *path)
+void nd_set_link(char *path)
{
+ struct nameidata *nd = current->nameidata;
+
nd->saved_names[nd->depth] = path;
}
EXPORT_SYMBOL(nd_set_link);
@@ -888,14 +892,14 @@ follow_link(struct path *link, struct nameidata *nd, void **p)
nd->total_link_count++;
touch_atime(link);
- nd_set_link(nd, NULL);
+ nd_set_link(NULL);
error = security_inode_follow_link(link->dentry);
if (error)
goto out_put_nd_path;
nd->last_type = LAST_BIND;
- *p = dentry->d_inode->i_op->follow_link(dentry, nd);
+ *p = dentry->d_inode->i_op->follow_link(dentry);
error = PTR_ERR(*p);
if (IS_ERR(*p))
goto out_put_nd_path;
@@ -4460,7 +4464,7 @@ int generic_readlink(struct dentry *dentry, char __user *buffer, int buflen)
int res;
nd.depth = 0;
- cookie = dentry->d_inode->i_op->follow_link(dentry, &nd);
+ cookie = dentry->d_inode->i_op->follow_link(dentry);
if (IS_ERR(cookie))
res = PTR_ERR(cookie);
else {
@@ -4502,10 +4506,10 @@ int page_readlink(struct dentry *dentry, char __user *buffer, int buflen)
}
EXPORT_SYMBOL(page_readlink);
-void *page_follow_link_light(struct dentry *dentry, struct nameidata *nd)
+void *page_follow_link_light(struct dentry *dentry)
{
struct page *page = NULL;
- nd_set_link(nd, page_getlink(dentry, &page));
+ nd_set_link(page_getlink(dentry, &page));
return page;
}
EXPORT_SYMBOL(page_follow_link_light);
@@ -43,7 +43,7 @@ error:
return -EIO;
}
-static void *nfs_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *nfs_follow_link(struct dentry *dentry)
{
struct inode *inode = dentry->d_inode;
struct page *page;
@@ -58,11 +58,11 @@ static void *nfs_follow_link(struct dentry *dentry, struct nameidata *nd)
err = page;
goto read_failed;
}
- nd_set_link(nd, kmap(page));
+ nd_set_link(kmap(page));
return page;
read_failed:
- nd_set_link(nd, err);
+ nd_set_link(err);
return NULL;
}
@@ -35,7 +35,6 @@
* ntfs_lookup - find the inode represented by a dentry in a directory inode
* @dir_ino: directory inode in which to look for the inode
* @dent: dentry representing the inode to look for
- * @nd: lookup nameidata
*
* In short, ntfs_lookup() looks for the inode represented by the dentry @dent
* in the directory inode @dir_ino and if found attaches the inode to the
@@ -140,7 +140,7 @@ struct ovl_link_data {
void *cookie;
};
-static void *ovl_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *ovl_follow_link(struct dentry *dentry)
{
void *ret;
struct dentry *realdentry;
@@ -160,7 +160,7 @@ static void *ovl_follow_link(struct dentry *dentry, struct nameidata *nd)
data->realdentry = realdentry;
}
- ret = realinode->i_op->follow_link(realdentry, nd);
+ ret = realinode->i_op->follow_link(realdentry);
if (IS_ERR(ret)) {
kfree(data);
return ret;
@@ -1371,7 +1371,7 @@ static int proc_exe_link(struct dentry *dentry, struct path *exe_path)
return -ENOENT;
}
-static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *proc_pid_follow_link(struct dentry *dentry)
{
struct inode *inode = dentry->d_inode;
struct path path;
@@ -1385,7 +1385,7 @@ static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd)
if (error)
goto out;
- nd_jump_link(nd, &path);
+ nd_jump_link(&path);
return NULL;
out:
return ERR_PTR(error);
@@ -394,12 +394,12 @@ static const struct file_operations proc_reg_file_ops_no_compat = {
};
#endif
-static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *proc_follow_link(struct dentry *dentry)
{
struct proc_dir_entry *pde = PDE(dentry->d_inode);
if (unlikely(!use_pde(pde)))
return ERR_PTR(-EINVAL);
- nd_set_link(nd, pde->data);
+ nd_set_link(pde->data);
return pde;
}
@@ -30,7 +30,7 @@ static const struct proc_ns_operations *ns_entries[] = {
&mntns_operations,
};
-static void *proc_ns_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *proc_ns_follow_link(struct dentry *dentry)
{
struct inode *inode = dentry->d_inode;
const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops;
@@ -45,7 +45,7 @@ static void *proc_ns_follow_link(struct dentry *dentry, struct nameidata *nd)
if (ptrace_may_access(task, PTRACE_MODE_READ)) {
error = ns_get_path(&ns_path, task, ns_ops);
if (!error)
- nd_jump_link(nd, &ns_path);
+ nd_jump_link(&ns_path);
}
put_task_struct(task);
return error;
@@ -19,7 +19,7 @@ static int proc_self_readlink(struct dentry *dentry, char __user *buffer,
return readlink_copy(buffer, buflen, tmp);
}
-static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *proc_self_follow_link(struct dentry *dentry)
{
struct pid_namespace *ns = dentry->d_sb->s_fs_info;
pid_t tgid = task_tgid_nr_ns(current, ns);
@@ -32,7 +32,7 @@ static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd)
else
sprintf(name, "%d", tgid);
}
- nd_set_link(nd, name);
+ nd_set_link(name);
return NULL;
}
@@ -20,7 +20,7 @@ static int proc_thread_self_readlink(struct dentry *dentry, char __user *buffer,
return readlink_copy(buffer, buflen, tmp);
}
-static void *proc_thread_self_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *proc_thread_self_follow_link(struct dentry *dentry)
{
struct pid_namespace *ns = dentry->d_sb->s_fs_info;
pid_t tgid = task_tgid_nr_ns(current, ns);
@@ -33,7 +33,7 @@ static void *proc_thread_self_follow_link(struct dentry *dentry, struct nameidat
else
sprintf(name, "%d/task/%d", tgid, pid);
}
- nd_set_link(nd, name);
+ nd_set_link(name);
return NULL;
}
@@ -8,9 +8,9 @@
#include "sysv.h"
#include <linux/namei.h>
-static void *sysv_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *sysv_follow_link(struct dentry *dentry)
{
- nd_set_link(nd, (char *)SYSV_I(dentry->d_inode)->i_data);
+ nd_set_link((char *)SYSV_I(dentry->d_inode)->i_data);
return NULL;
}
@@ -1300,11 +1300,11 @@ static void ubifs_invalidatepage(struct page *page, unsigned int offset,
ClearPageChecked(page);
}
-static void *ubifs_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *ubifs_follow_link(struct dentry *dentry)
{
struct ubifs_inode *ui = ubifs_inode(dentry->d_inode);
- nd_set_link(nd, ui->data);
+ nd_set_link(ui->data);
return NULL;
}
@@ -32,10 +32,10 @@
#include "ufs.h"
-static void *ufs_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *ufs_follow_link(struct dentry *dentry)
{
struct ufs_inode_info *p = UFS_I(dentry->d_inode);
- nd_set_link(nd, (char*)p->i_u1.i_symlink);
+ nd_set_link((char*)p->i_u1.i_symlink);
return NULL;
}
@@ -411,8 +411,7 @@ xfs_vn_rename(
*/
STATIC void *
xfs_vn_follow_link(
- struct dentry *dentry,
- struct nameidata *nd)
+ struct dentry *dentry)
{
char *link;
int error = -ENOMEM;
@@ -425,13 +424,13 @@ xfs_vn_follow_link(
if (unlikely(error))
goto out_kfree;
- nd_set_link(nd, link);
+ nd_set_link(link);
return NULL;
out_kfree:
kfree(link);
out_err:
- nd_set_link(nd, ERR_PTR(error));
+ nd_set_link(ERR_PTR(error));
return NULL;
}
@@ -38,7 +38,6 @@ struct backing_dev_info;
struct export_operations;
struct hd_geometry;
struct iovec;
-struct nameidata;
struct kiocb;
struct kobject;
struct pipe_inode_info;
@@ -1574,7 +1573,7 @@ struct file_operations {
struct inode_operations {
struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int);
- void * (*follow_link) (struct dentry *, struct nameidata *);
+ void * (*follow_link) (struct dentry *);
int (*permission) (struct inode *, int);
struct posix_acl * (*get_acl)(struct inode *, int);
@@ -2649,7 +2648,7 @@ extern const struct file_operations generic_ro_fops;
extern int readlink_copy(char __user *, int, const char *);
extern int page_readlink(struct dentry *, char __user *, int);
-extern void *page_follow_link_light(struct dentry *, struct nameidata *);
+extern void *page_follow_link_light(struct dentry *);
extern void page_put_link(struct dentry *, char *, void *);
extern int __page_symlink(struct inode *inode, const char *symname, int len,
int nofs);
@@ -7,7 +7,6 @@
#include <linux/path.h>
struct vfsmount;
-struct nameidata;
enum { MAX_NESTED_LINKS = 8 };
@@ -70,8 +69,8 @@ extern int follow_up(struct path *);
extern struct dentry *lock_rename(struct dentry *, struct dentry *);
extern void unlock_rename(struct dentry *, struct dentry *);
-extern void nd_jump_link(struct nameidata *nd, struct path *path);
-extern void nd_set_link(struct nameidata *nd, char *path);
+extern void nd_jump_link(struct path *path);
+extern void nd_set_link(char *path);
static inline void nd_terminate_link(void *name, size_t len, size_t maxlen)
{
@@ -1267,6 +1267,7 @@ union rcu_special {
short s;
};
struct rcu_node;
+struct nameidata;
enum perf_event_task_context {
perf_invalid_context = -1,
@@ -2474,17 +2474,17 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s
return 0;
}
-static void *shmem_follow_short_symlink(struct dentry *dentry, struct nameidata *nd)
+static void *shmem_follow_short_symlink(struct dentry *dentry)
{
- nd_set_link(nd, SHMEM_I(dentry->d_inode)->symlink);
+ nd_set_link(SHMEM_I(dentry->d_inode)->symlink);
return NULL;
}
-static void *shmem_follow_link(struct dentry *dentry, struct nameidata *nd)
+static void *shmem_follow_link(struct dentry *dentry)
{
struct page *page = NULL;
int error = shmem_getpage(dentry->d_inode, 0, &page, SGP_READ, NULL);
- nd_set_link(nd, error ? ERR_PTR(error) : kmap(page));
+ nd_set_link(error ? ERR_PTR(error) : kmap(page));
if (page)
unlock_page(page);
return page;
Now that current->nameidata is available, nd_set_link() can use that directly, so 'nd' doesn't need to be passed through ->follow_link. As a result of this change, 'nameidata' is almost entirely local to namei.c. It is only exposed externally as an opaque struct pointed to by current->nameidata. Signed-off-by: NeilBrown <neilb@suse.de> --- Documentation/filesystems/Locking | 2 +- Documentation/filesystems/porting | 5 +++++ Documentation/filesystems/vfs.txt | 2 +- drivers/staging/lustre/lustre/llite/symlink.c | 4 ++-- fs/9p/vfs_inode.c | 6 ++---- fs/9p/vfs_inode_dotl.c | 5 ++--- fs/autofs4/symlink.c | 4 ++-- fs/befs/linuxvfs.c | 12 ++++++------ fs/ceph/inode.c | 4 ++-- fs/cifs/cifsfs.h | 2 +- fs/cifs/link.c | 4 ++-- fs/configfs/symlink.c | 6 +++--- fs/debugfs/file.c | 4 ++-- fs/ecryptfs/inode.c | 6 ++---- fs/exofs/symlink.c | 4 ++-- fs/ext2/symlink.c | 4 ++-- fs/ext3/symlink.c | 4 ++-- fs/ext4/symlink.c | 4 ++-- fs/freevxfs/vxfs_immed.c | 7 +++---- fs/fuse/dir.c | 4 ++-- fs/gfs2/inode.c | 7 +++---- fs/hostfs/hostfs_kern.c | 4 ++-- fs/hppfs/hppfs.c | 4 ++-- fs/jffs2/symlink.c | 6 +++--- fs/jfs/symlink.c | 4 ++-- fs/kernfs/symlink.c | 4 ++-- fs/namei.c | 18 +++++++++++------- fs/nfs/symlink.c | 6 +++--- fs/ntfs/namei.c | 1 - fs/overlayfs/inode.c | 4 ++-- fs/proc/base.c | 4 ++-- fs/proc/inode.c | 4 ++-- fs/proc/namespaces.c | 4 ++-- fs/proc/self.c | 4 ++-- fs/proc/thread_self.c | 4 ++-- fs/sysv/symlink.c | 4 ++-- fs/ubifs/file.c | 4 ++-- fs/ufs/symlink.c | 4 ++-- fs/xfs/xfs_iops.c | 7 +++---- include/linux/fs.h | 5 ++--- include/linux/namei.h | 5 ++--- include/linux/sched.h | 1 + mm/shmem.c | 8 ++++---- 43 files changed, 104 insertions(+), 105 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html