Commit 675b5da0 authored by Trond Myklebust's avatar Trond Myklebust
Browse files

[PATCH] Pass 'nameidata' to ->create()

  - Make the VFS pass the struct nameidata as an optional argument
    to the create inode operation.
  - Patch vfs_create() to take a struct nameidata as an optional
    argument.
parent fc8b427e
......@@ -256,7 +256,7 @@ affs_unlink(struct inode *dir, struct dentry *dentry)
}
int
affs_create(struct inode *dir, struct dentry *dentry, int mode)
affs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd)
{
struct super_block *sb = dir->i_sb;
struct inode *inode;
......
......@@ -78,7 +78,8 @@ struct file_operations bfs_dir_operations = {
extern void dump_imap(const char *, struct super_block *);
static int bfs_create(struct inode * dir, struct dentry * dentry, int mode)
static int bfs_create(struct inode * dir, struct dentry * dentry, int mode,
struct nameidata *nd)
{
int err;
struct inode * inode;
......
......@@ -46,7 +46,7 @@ extern void cifs_delete_inode(struct inode *);
/* Functions related to inodes */
extern struct inode_operations cifs_dir_inode_ops;
extern int cifs_create(struct inode *, struct dentry *, int);
extern int cifs_create(struct inode *, struct dentry *, int, struct nameidata *);
extern struct dentry *cifs_lookup(struct inode *, struct dentry *, struct nameidata *);
extern int cifs_unlink(struct inode *, struct dentry *);
extern int cifs_hardlink(struct dentry *, struct inode *, struct dentry *);
......
......@@ -119,7 +119,8 @@ build_wildcard_path_from_dentry(struct dentry *direntry)
/* Inode operations in similar order to how they appear in the Linux file fs.h */
int
cifs_create(struct inode *inode, struct dentry *direntry, int mode)
cifs_create(struct inode *inode, struct dentry *direntry, int mode,
struct nameidata *nd)
{
int rc = -ENOENT;
int xid;
......
......@@ -28,7 +28,7 @@
#include <linux/coda_proc.h>
/* dir inode-ops */
static int coda_create(struct inode *dir, struct dentry *new, int mode);
static int coda_create(struct inode *dir, struct dentry *new, int mode, struct nameidata *nd);
static int coda_mknod(struct inode *dir, struct dentry *new, int mode, dev_t rdev);
static struct dentry *coda_lookup(struct inode *dir, struct dentry *target, struct nameidata *nd);
static int coda_link(struct dentry *old_dentry, struct inode *dir_inode,
......@@ -190,7 +190,7 @@ static inline void coda_dir_changed(struct inode *dir, int link)
}
/* creation routines: create, mknod, mkdir, link, symlink */
static int coda_create(struct inode *dir, struct dentry *de, int mode)
static int coda_create(struct inode *dir, struct dentry *de, int mode, struct nameidata *nd)
{
int error=0;
const char *name=de->d_name.name;
......
......@@ -120,7 +120,7 @@ struct dentry *ext2_get_parent(struct dentry *child)
* If the create succeeds, we fill in the inode information
* with d_instantiate().
*/
static int ext2_create (struct inode * dir, struct dentry * dentry, int mode)
static int ext2_create (struct inode * dir, struct dentry * dentry, int mode, struct nameidata *nd)
{
struct inode * inode = ext2_new_inode (dir, mode);
int err = PTR_ERR(inode);
......
......@@ -1623,7 +1623,8 @@ static int ext3_add_nondir(handle_t *handle,
* If the create succeeds, we fill in the inode information
* with d_instantiate().
*/
static int ext3_create (struct inode * dir, struct dentry * dentry, int mode)
static int ext3_create (struct inode * dir, struct dentry * dentry, int mode,
struct nameidata *nd)
{
handle_t *handle;
struct inode * inode;
......
......@@ -163,7 +163,7 @@ static inline void mark_inodes_deleted(struct hfs_cat_entry *entry,
* a directory and return a corresponding inode, given the inode for
* the directory and the name (and its length) of the new file.
*/
int hfs_create(struct inode * dir, struct dentry *dentry, int mode)
int hfs_create(struct inode * dir, struct dentry *dentry, int mode, struct nameidata *nd)
{
struct hfs_cat_entry *entry = HFS_I(dir)->entry;
struct hfs_cat_entry *new;
......
......@@ -26,7 +26,7 @@
static struct dentry *dbl_lookup(struct inode *, struct dentry *, struct nameidata *);
static int dbl_readdir(struct file *, void *, filldir_t);
static int dbl_create(struct inode *, struct dentry *, int);
static int dbl_create(struct inode *, struct dentry *, int, struct nameidata *);
static int dbl_mkdir(struct inode *, struct dentry *, int);
static int dbl_unlink(struct inode *, struct dentry *);
static int dbl_rmdir(struct inode *, struct dentry *);
......@@ -272,7 +272,7 @@ static int dbl_readdir(struct file * filp,
* the directory and the name (and its length) of the new file.
*/
static int dbl_create(struct inode * dir, struct dentry *dentry,
int mode)
int mode, struct nameidata *nd)
{
int error;
......@@ -280,7 +280,7 @@ static int dbl_create(struct inode * dir, struct dentry *dentry,
if (is_hdr(dir, dentry->d_name.name, dentry->d_name.len)) {
error = -EEXIST;
} else {
error = hfs_create(dir, dentry, mode);
error = hfs_create(dir, dentry, mode, nd);
}
unlock_kernel();
return error;
......
......@@ -285,7 +285,7 @@ void hpfs_decide_conv(struct inode *, unsigned char *, unsigned);
/* namei.c */
int hpfs_mkdir(struct inode *, struct dentry *, int);
int hpfs_create(struct inode *, struct dentry *, int);
int hpfs_create(struct inode *, struct dentry *, int, struct nameidata *);
int hpfs_mknod(struct inode *, struct dentry *, int, dev_t);
int hpfs_symlink(struct inode *, struct dentry *, const char *);
int hpfs_unlink(struct inode *, struct dentry *);
......
......@@ -106,7 +106,7 @@ int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
return -ENOSPC;
}
int hpfs_create(struct inode *dir, struct dentry *dentry, int mode)
int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd)
{
const char *name = dentry->d_name.name;
unsigned len = dentry->d_name.len;
......
......@@ -462,7 +462,7 @@ static int hugetlbfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
return retval;
}
static int hugetlbfs_create(struct inode *dir, struct dentry *dentry, int mode)
static int hugetlbfs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd)
{
return hugetlbfs_mknod(dir, dentry, mode | S_IFREG, 0);
}
......
......@@ -412,7 +412,8 @@ int presto_prep(struct dentry *dentry, struct presto_cache **cache,
return 0;
}
static int presto_create(struct inode * dir, struct dentry * dentry, int mode)
static int presto_create(struct inode * dir, struct dentry * dentry, int mode,
struct nameidata *nd)
{
int error;
struct presto_cache *cache;
......
......@@ -598,7 +598,7 @@ int presto_do_create(struct presto_file_set *fset, struct dentry *dir,
}
DQUOT_INIT(dir->d_inode);
lock_kernel();
error = iops->create(dir->d_inode, dentry, mode);
error = iops->create(dir->d_inode, dentry, mode, NULL);
if (error) {
EXIT;
goto exit_lock;
......
......@@ -1273,7 +1273,8 @@ jffs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
* with d_instantiate().
*/
static int
jffs_create(struct inode *dir, struct dentry *dentry, int mode)
jffs_create(struct inode *dir, struct dentry *dentry, int mode,
struct nameidata *nd)
{
struct jffs_raw_inode raw_inode;
struct jffs_control *c;
......
......@@ -32,7 +32,7 @@ typedef dev_t mknod_arg_t;
static int jffs2_readdir (struct file *, void *, filldir_t);
static int jffs2_create (struct inode *,struct dentry *,int);
static int jffs2_create (struct inode *,struct dentry *,int, struct nameidata *);
static struct dentry *jffs2_lookup (struct inode *,struct dentry *, struct nameidata *);
static int jffs2_link (struct dentry *,struct inode *,struct dentry *);
static int jffs2_unlink (struct inode *,struct dentry *);
......@@ -175,7 +175,8 @@ static int jffs2_readdir(struct file *filp, void *dirent, filldir_t filldir)
/***********************************************************************/
static int jffs2_create(struct inode *dir_i, struct dentry *dentry, int mode)
static int jffs2_create(struct inode *dir_i, struct dentry *dentry, int mode,
struct nameidata *nd)
{
struct jffs2_raw_inode *ri;
struct jffs2_inode_info *f, *dir_f;
......
......@@ -54,11 +54,13 @@ s64 commitZeroLink(tid_t, struct inode *);
* PARAMETER: dip - parent directory vnode
* dentry - dentry of new file
* mode - create mode (rwxrwxrwx).
* nd- nd struct
*
* RETURN: Errors from subroutines
*
*/
int jfs_create(struct inode *dip, struct dentry *dentry, int mode)
int jfs_create(struct inode *dip, struct dentry *dentry, int mode,
struct nameidata *nd)
{
int rc = 0;
tid_t tid; /* transaction id */
......
......@@ -89,7 +89,8 @@ static int minix_mknod(struct inode * dir, struct dentry *dentry, int mode, dev_
return error;
}
static int minix_create(struct inode * dir, struct dentry *dentry, int mode)
static int minix_create(struct inode * dir, struct dentry *dentry, int mode,
struct nameidata *nd)
{
return minix_mknod(dir, dentry, mode, 0);
}
......
......@@ -261,7 +261,8 @@ static int msdos_add_entry(struct inode *dir, const char *name,
*/
/***** Create a file */
int msdos_create(struct inode *dir,struct dentry *dentry,int mode)
int msdos_create(struct inode *dir,struct dentry *dentry,int mode,
struct nameidata *nd)
{
struct super_block *sb = dir->i_sb;
struct buffer_head *bh;
......
......@@ -1105,7 +1105,8 @@ void unlock_rename(struct dentry *p1, struct dentry *p2)
}
}
int vfs_create(struct inode *dir, struct dentry *dentry, int mode)
int vfs_create(struct inode *dir, struct dentry *dentry, int mode,
struct nameidata *nd)
{
int error = may_create(dir, dentry);
......@@ -1120,7 +1121,7 @@ int vfs_create(struct inode *dir, struct dentry *dentry, int mode)
if (error)
return error;
DQUOT_INIT(dir);
error = dir->i_op->create(dir, dentry, mode);
error = dir->i_op->create(dir, dentry, mode, nd);
if (!error) {
inode_dir_notify(dir, DN_CREATE);
security_inode_post_create(dir, dentry, mode);
......@@ -1277,7 +1278,7 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
if (!dentry->d_inode) {
if (!IS_POSIXACL(dir->d_inode))
mode &= ~current->fs->umask;
error = vfs_create(dir->d_inode, dentry, mode);
error = vfs_create(dir->d_inode, dentry, mode, nd);
up(&dir->d_inode->i_sem);
dput(nd->dentry);
nd->dentry = dentry;
......@@ -1445,7 +1446,7 @@ asmlinkage long sys_mknod(const char __user * filename, int mode, dev_t dev)
if (!IS_ERR(dentry)) {
switch (mode & S_IFMT) {
case 0: case S_IFREG:
error = vfs_create(nd.dentry->d_inode,dentry,mode);
error = vfs_create(nd.dentry->d_inode,dentry,mode,&nd);
break;
case S_IFCHR: case S_IFBLK: case S_IFIFO: case S_IFSOCK:
error = vfs_mknod(nd.dentry->d_inode,dentry,mode,dev);
......
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