ソースを参照

[patch 5/5] vfs: remove mode parameter from vfs_symlink()

Remove the unused mode parameter from vfs_symlink and callers.

Thanks to Tetsuo Handa for noticing.

CC: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Miklos Szeredi 17 年 前
コミット
db2e747b14
4 ファイル変更6 行追加14 行削除
  1. 1 3
      fs/ecryptfs/inode.c
  2. 2 2
      fs/namei.c
  3. 2 8
      fs/nfsd/vfs.c
  4. 1 1
      include/linux/fs.h

+ 1 - 3
fs/ecryptfs/inode.c

@@ -465,7 +465,6 @@ static int ecryptfs_symlink(struct inode *dir, struct dentry *dentry,
 	int rc;
 	int rc;
 	struct dentry *lower_dentry;
 	struct dentry *lower_dentry;
 	struct dentry *lower_dir_dentry;
 	struct dentry *lower_dir_dentry;
-	umode_t mode;
 	char *encoded_symname;
 	char *encoded_symname;
 	int encoded_symlen;
 	int encoded_symlen;
 	struct ecryptfs_crypt_stat *crypt_stat = NULL;
 	struct ecryptfs_crypt_stat *crypt_stat = NULL;
@@ -473,7 +472,6 @@ static int ecryptfs_symlink(struct inode *dir, struct dentry *dentry,
 	lower_dentry = ecryptfs_dentry_to_lower(dentry);
 	lower_dentry = ecryptfs_dentry_to_lower(dentry);
 	dget(lower_dentry);
 	dget(lower_dentry);
 	lower_dir_dentry = lock_parent(lower_dentry);
 	lower_dir_dentry = lock_parent(lower_dentry);
-	mode = S_IALLUGO;
 	encoded_symlen = ecryptfs_encode_filename(crypt_stat, symname,
 	encoded_symlen = ecryptfs_encode_filename(crypt_stat, symname,
 						  strlen(symname),
 						  strlen(symname),
 						  &encoded_symname);
 						  &encoded_symname);
@@ -482,7 +480,7 @@ static int ecryptfs_symlink(struct inode *dir, struct dentry *dentry,
 		goto out_lock;
 		goto out_lock;
 	}
 	}
 	rc = vfs_symlink(lower_dir_dentry->d_inode, lower_dentry,
 	rc = vfs_symlink(lower_dir_dentry->d_inode, lower_dentry,
-			 encoded_symname, mode);
+			 encoded_symname);
 	kfree(encoded_symname);
 	kfree(encoded_symname);
 	if (rc || !lower_dentry->d_inode)
 	if (rc || !lower_dentry->d_inode)
 		goto out_lock;
 		goto out_lock;

+ 2 - 2
fs/namei.c

@@ -2434,7 +2434,7 @@ asmlinkage long sys_unlink(const char __user *pathname)
 	return do_unlinkat(AT_FDCWD, pathname);
 	return do_unlinkat(AT_FDCWD, pathname);
 }
 }
 
 
-int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname, int mode)
+int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname)
 {
 {
 	int error = may_create(dir, dentry, NULL);
 	int error = may_create(dir, dentry, NULL);
 
 
@@ -2483,7 +2483,7 @@ asmlinkage long sys_symlinkat(const char __user *oldname,
 	error = mnt_want_write(nd.path.mnt);
 	error = mnt_want_write(nd.path.mnt);
 	if (error)
 	if (error)
 		goto out_dput;
 		goto out_dput;
-	error = vfs_symlink(nd.path.dentry->d_inode, dentry, from, S_IALLUGO);
+	error = vfs_symlink(nd.path.dentry->d_inode, dentry, from);
 	mnt_drop_write(nd.path.mnt);
 	mnt_drop_write(nd.path.mnt);
 out_dput:
 out_dput:
 	dput(dentry);
 	dput(dentry);

+ 2 - 8
fs/nfsd/vfs.c

@@ -1516,7 +1516,6 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp,
 	struct dentry	*dentry, *dnew;
 	struct dentry	*dentry, *dnew;
 	__be32		err, cerr;
 	__be32		err, cerr;
 	int		host_err;
 	int		host_err;
-	umode_t		mode;
 
 
 	err = nfserr_noent;
 	err = nfserr_noent;
 	if (!flen || !plen)
 	if (!flen || !plen)
@@ -1535,11 +1534,6 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp,
 	if (IS_ERR(dnew))
 	if (IS_ERR(dnew))
 		goto out_nfserr;
 		goto out_nfserr;
 
 
-	mode = S_IALLUGO;
-	/* Only the MODE ATTRibute is even vaguely meaningful */
-	if (iap && (iap->ia_valid & ATTR_MODE))
-		mode = iap->ia_mode & S_IALLUGO;
-
 	host_err = mnt_want_write(fhp->fh_export->ex_path.mnt);
 	host_err = mnt_want_write(fhp->fh_export->ex_path.mnt);
 	if (host_err)
 	if (host_err)
 		goto out_nfserr;
 		goto out_nfserr;
@@ -1551,11 +1545,11 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp,
 		else {
 		else {
 			strncpy(path_alloced, path, plen);
 			strncpy(path_alloced, path, plen);
 			path_alloced[plen] = 0;
 			path_alloced[plen] = 0;
-			host_err = vfs_symlink(dentry->d_inode, dnew, path_alloced, mode);
+			host_err = vfs_symlink(dentry->d_inode, dnew, path_alloced);
 			kfree(path_alloced);
 			kfree(path_alloced);
 		}
 		}
 	} else
 	} else
-		host_err = vfs_symlink(dentry->d_inode, dnew, path, mode);
+		host_err = vfs_symlink(dentry->d_inode, dnew, path);
 
 
 	if (!host_err) {
 	if (!host_err) {
 		if (EX_ISSYNC(fhp->fh_export))
 		if (EX_ISSYNC(fhp->fh_export))

+ 1 - 1
include/linux/fs.h

@@ -1139,7 +1139,7 @@ extern int vfs_permission(struct nameidata *, int);
 extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *);
 extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *);
 extern int vfs_mkdir(struct inode *, struct dentry *, int);
 extern int vfs_mkdir(struct inode *, struct dentry *, int);
 extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t);
 extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t);
-extern int vfs_symlink(struct inode *, struct dentry *, const char *, int);
+extern int vfs_symlink(struct inode *, struct dentry *, const char *);
 extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
 extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
 extern int vfs_rmdir(struct inode *, struct dentry *);
 extern int vfs_rmdir(struct inode *, struct dentry *);
 extern int vfs_unlink(struct inode *, struct dentry *);
 extern int vfs_unlink(struct inode *, struct dentry *);