Commit 72c85a12 authored by Andries E. Brouwer's avatar Andries E. Brouwer Committed by Linus Torvalds

[PATCH] *_mknod prototype

The dev_t argument of sys_mknod is passed to vfs_mknod, and is then cast
to int when foo_mknod is called, and is subsequently very often cast
back to dev_t.  (For example, minix_mknod() calls minix_set_inode() that
takes a dev_t.)

This is a cleanup that avoids this back-and-forth casting by giving
foo_mknod a prototype with dev_t.  In most cases now the dev_t is
transmitted untouched until init_special_inode.

It also makes the two routines hugetlbfs_get_inode() and
shmem_get_inode() static.
parent 41872921
......@@ -35,7 +35,7 @@ prototypes:
int (*symlink) (struct inode *,struct dentry *,const char *);
int (*mkdir) (struct inode *,struct dentry *,int);
int (*rmdir) (struct inode *,struct dentry *);
int (*mknod) (struct inode *,struct dentry *,int,int);
int (*mknod) (struct inode *,struct dentry *,int,dev_t);
int (*rename) (struct inode *, struct dentry *,
struct inode *, struct dentry *);
int (*readlink) (struct dentry *, char *,int);
......
......@@ -258,7 +258,7 @@ struct inode_operations {
int (*symlink) (struct inode *,struct dentry *,const char *);
int (*mkdir) (struct inode *,struct dentry *,int);
int (*rmdir) (struct inode *,struct dentry *);
int (*mknod) (struct inode *,struct dentry *,int,int);
int (*mknod) (struct inode *,struct dentry *,int,dev_t);
int (*rename) (struct inode *, struct dentry *,
struct inode *, struct dentry *);
int (*readlink) (struct dentry *, char *,int);
......
......@@ -121,7 +121,7 @@ static struct proc_dir_entry *slotdir = NULL;
static const char *slotdir_name = "slots";
#endif
static struct inode *pcihpfs_get_inode (struct super_block *sb, int mode, int dev)
static struct inode *pcihpfs_get_inode (struct super_block *sb, int mode, dev_t dev)
{
struct inode *inode = new_inode(sb);
......@@ -153,7 +153,7 @@ static struct inode *pcihpfs_get_inode (struct super_block *sb, int mode, int de
}
/* SMP-safe */
static int pcihpfs_mknod (struct inode *dir, struct dentry *dentry, int mode, int dev)
static int pcihpfs_mknod (struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
{
struct inode *inode = pcihpfs_get_inode(dir->i_sb, mode, dev);
int error = -ENOSPC;
......
......@@ -143,7 +143,7 @@ static int parse_options(struct super_block *s, char *data)
/* --------------------------------------------------------------------- */
static struct inode *usbfs_get_inode (struct super_block *sb, int mode, int dev)
static struct inode *usbfs_get_inode (struct super_block *sb, int mode, dev_t dev)
{
struct inode *inode = new_inode(sb);
......@@ -176,7 +176,7 @@ static struct inode *usbfs_get_inode (struct super_block *sb, int mode, int dev)
/* SMP-safe */
static int usbfs_mknod (struct inode *dir, struct dentry *dentry, int mode,
int dev)
dev_t dev)
{
struct inode *inode = usbfs_get_inode(dir->i_sb, mode, dev);
int error = -EPERM;
......
......@@ -29,7 +29,7 @@
/* dir inode-ops */
static int coda_create(struct inode *dir, struct dentry *new, int mode);
static int coda_mknod(struct inode *dir, struct dentry *new, int mode, int rdev);
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);
static int coda_link(struct dentry *old_dentry, struct inode *dir_inode,
struct dentry *entry);
......@@ -230,7 +230,7 @@ static int coda_create(struct inode *dir, struct dentry *de, int mode)
return 0;
}
static int coda_mknod(struct inode *dir, struct dentry *de, int mode, int rdev)
static int coda_mknod(struct inode *dir, struct dentry *de, int mode, dev_t rdev)
{
int error=0;
const char *name=de->d_name.name;
......@@ -740,4 +740,3 @@ int coda_revalidate_inode(struct dentry *dentry)
unlock_kernel();
return -EIO;
}
......@@ -310,7 +310,7 @@ int venus_rename(struct super_block *sb, struct ViceFid *old_fid,
}
int venus_create(struct super_block *sb, struct ViceFid *dirfid,
const char *name, int length, int excl, int mode, int rdev,
const char *name, int length, int excl, int mode, dev_t rdev,
struct ViceFid *newfid, struct coda_vattr *attrs)
{
union inputArgs *inp;
......
......@@ -3103,7 +3103,7 @@ static int devfs_rmdir (struct inode *dir, struct dentry *dentry)
} /* End Function devfs_rmdir */
static int devfs_mknod (struct inode *dir, struct dentry *dentry, int mode,
int rdev)
dev_t rdev)
{
int err;
struct fs_info *fs_info = dir->i_sb->s_fs_info;
......
......@@ -202,7 +202,7 @@ static struct file_operations bad_sock_fops = {
.open = sock_no_open
};
void init_special_inode(struct inode *inode, umode_t mode, int rdev)
void init_special_inode(struct inode *inode, umode_t mode, dev_t rdev)
{
inode->i_mode = mode;
if (S_ISCHR(mode)) {
......@@ -217,5 +217,6 @@ void init_special_inode(struct inode *inode, umode_t mode, int rdev)
else if (S_ISSOCK(mode))
inode->i_fop = &bad_sock_fops;
else
printk(KERN_DEBUG "init_special_inode: bogus imode (%o)\n", mode);
printk(KERN_DEBUG "init_special_inode: bogus imode (%o)\n",
mode);
}
......@@ -134,7 +134,7 @@ static int ext2_create (struct inode * dir, struct dentry * dentry, int mode)
return err;
}
static int ext2_mknod (struct inode * dir, struct dentry *dentry, int mode, int rdev)
static int ext2_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t rdev)
{
struct inode * inode = ext2_new_inode (dir, mode);
int err = PTR_ERR(inode);
......
......@@ -1616,7 +1616,7 @@ static int ext3_create (struct inode * dir, struct dentry * dentry, int mode)
}
static int ext3_mknod (struct inode * dir, struct dentry *dentry,
int mode, int rdev)
int mode, dev_t rdev)
{
handle_t *handle;
struct inode *inode;
......
......@@ -282,7 +282,7 @@ void hpfs_decide_conv(struct inode *, unsigned char *, unsigned);
int hpfs_mkdir(struct inode *, struct dentry *, int);
int hpfs_create(struct inode *, struct dentry *, int);
int hpfs_mknod(struct inode *, struct dentry *, int, int);
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 *);
int hpfs_rmdir(struct inode *, struct dentry *);
......
......@@ -181,7 +181,7 @@ int hpfs_create(struct inode *dir, struct dentry *dentry, int mode)
return -ENOSPC;
}
int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, int rdev)
int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
{
const char *name = dentry->d_name.name;
unsigned len = dentry->d_name.len;
......
......@@ -359,7 +359,8 @@ static int hugetlbfs_setattr(struct dentry *dentry, struct iattr *attr)
return error;
}
struct inode *hugetlbfs_get_inode(struct super_block *sb, int mode, int dev)
static struct inode *
hugetlbfs_get_inode(struct super_block *sb, int mode, dev_t dev)
{
struct inode * inode = new_inode(sb);
......@@ -399,7 +400,8 @@ struct inode *hugetlbfs_get_inode(struct super_block *sb, int mode, int dev)
* File creation. Allocate an inode, and we're done..
*/
/* SMP-safe */
static int hugetlbfs_mknod(struct inode *dir, struct dentry *dentry, int mode, int dev)
static int
hugetlbfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
{
struct inode * inode = hugetlbfs_get_inode(dir->i_sb, mode, dev);
int error = -ENOSPC;
......
......@@ -720,7 +720,7 @@ static int presto_rmdir(struct inode *dir, struct dentry *dentry)
return error;
}
static int presto_mknod(struct inode * dir, struct dentry * dentry, int mode, int rdev)
static int presto_mknod(struct inode * dir, struct dentry * dentry, int mode, dev_t rdev)
{
int error;
struct presto_cache *cache;
......
......@@ -1072,7 +1072,7 @@ jffs_remove(struct inode *dir, struct dentry *dentry, int type)
static int
jffs_mknod(struct inode *dir, struct dentry *dentry, int mode, int rdev)
jffs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
{
struct jffs_raw_inode raw_inode;
struct jffs_file *dir_f;
......
......@@ -32,7 +32,7 @@ static int jffs2_unlink (struct inode *,struct dentry *);
static int jffs2_symlink (struct inode *,struct dentry *,const char *);
static int jffs2_mkdir (struct inode *,struct dentry *,int);
static int jffs2_rmdir (struct inode *,struct dentry *);
static int jffs2_mknod (struct inode *,struct dentry *,int,int);
static int jffs2_mknod (struct inode *,struct dentry *,int,dev_t);
static int jffs2_rename (struct inode *, struct dentry *,
struct inode *, struct dentry *);
......@@ -573,7 +573,7 @@ static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry)
return ret;
}
static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, int rdev)
static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, dev_t rdev)
{
struct jffs2_inode_info *f, *dir_f;
struct jffs2_sb_info *c;
......
......@@ -1316,7 +1316,7 @@ int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
*
* FUNCTION: Create a special file (device)
*/
int jfs_mknod(struct inode *dir, struct dentry *dentry, int mode, int rdev)
int jfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
{
struct btstack btstack;
struct component_name dname;
......
......@@ -75,7 +75,7 @@ static struct dentry *minix_lookup(struct inode * dir, struct dentry *dentry)
return NULL;
}
static int minix_mknod(struct inode * dir, struct dentry *dentry, int mode, int rdev)
static int minix_mknod(struct inode * dir, struct dentry *dentry, int mode, dev_t rdev)
{
int error;
struct inode * inode = minix_new_inode(dir, &error);
......
......@@ -42,7 +42,7 @@ static int ncp_rmdir(struct inode *, struct dentry *);
static int ncp_rename(struct inode *, struct dentry *,
struct inode *, struct dentry *);
static int ncp_mknod(struct inode * dir, struct dentry *dentry,
int mode, int rdev);
int mode, dev_t rdev);
#if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS)
extern int ncp_symlink(struct inode *, struct dentry *, const char *);
#else
......@@ -883,7 +883,7 @@ static int ncp_instantiate(struct inode *dir, struct dentry *dentry,
}
int ncp_create_new(struct inode *dir, struct dentry *dentry, int mode,
int rdev, int attributes)
dev_t rdev, int attributes)
{
struct ncp_server *server = NCP_SERVER(dir);
struct ncp_entry_info finfo;
......@@ -1169,7 +1169,7 @@ static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry,
}
static int ncp_mknod(struct inode * dir, struct dentry *dentry,
int mode, int rdev)
int mode, dev_t rdev)
{
if (ncp_is_nfs_extras(NCP_SERVER(dir), NCP_FINFO(dir)->volNumber)) {
DPRINTK(KERN_DEBUG "ncp_mknod: mode = 0%o\n", mode);
......
......@@ -117,7 +117,7 @@ int ncp_dirhandle_alloc(struct ncp_server *, __u8 vol, __u32 dirent, __u8 *dirha
int ncp_dirhandle_free(struct ncp_server *, __u8 dirhandle);
int ncp_create_new(struct inode *dir, struct dentry *dentry,
int mode, int rdev, int attributes);
int mode, dev_t rdev, int attributes);
static inline int ncp_is_nfs_extras(struct ncp_server* server, unsigned int volnum) {
#ifdef CONFIG_NCPFS_NFS_NS
......
......@@ -45,7 +45,7 @@ static int nfs_rmdir(struct inode *, struct dentry *);
static int nfs_unlink(struct inode *, struct dentry *);
static int nfs_symlink(struct inode *, struct dentry *, const char *);
static int nfs_link(struct dentry *, struct inode *, struct dentry *);
static int nfs_mknod(struct inode *, struct dentry *, int, int);
static int nfs_mknod(struct inode *, struct dentry *, int, dev_t);
static int nfs_rename(struct inode *, struct dentry *,
struct inode *, struct dentry *);
......@@ -801,7 +801,8 @@ static int nfs_create(struct inode *dir, struct dentry *dentry, int mode)
/*
* See comments for nfs_proc_create regarding failed operations.
*/
static int nfs_mknod(struct inode *dir, struct dentry *dentry, int mode, int rdev)
static int
nfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
{
struct iattr attr;
struct nfs_fattr fattr;
......
......@@ -47,7 +47,7 @@ static struct backing_dev_info ramfs_backing_dev_info = {
.memory_backed = 1, /* Does not contribute to dirty memory */
};
struct inode *ramfs_get_inode(struct super_block *sb, int mode, int dev)
static struct inode *ramfs_get_inode(struct super_block *sb, int mode, dev_t dev)
{
struct inode * inode = new_inode(sb);
......@@ -87,7 +87,8 @@ struct inode *ramfs_get_inode(struct super_block *sb, int mode, int dev)
* File creation. Allocate an inode, and we're done..
*/
/* SMP-safe */
static int ramfs_mknod(struct inode *dir, struct dentry *dentry, int mode, int dev)
static int
ramfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
{
struct inode * inode = ramfs_get_inode(dir->i_sb, mode, dev);
int error = -ENOSPC;
......
......@@ -605,7 +605,7 @@ static int reiserfs_create (struct inode * dir, struct dentry *dentry, int mode)
}
static int reiserfs_mknod (struct inode * dir, struct dentry *dentry, int mode, int rdev)
static int reiserfs_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t rdev)
{
int retval;
struct inode * inode;
......
......@@ -31,7 +31,7 @@ static int smb_rmdir(struct inode *, struct dentry *);
static int smb_unlink(struct inode *, struct dentry *);
static int smb_rename(struct inode *, struct dentry *,
struct inode *, struct dentry *);
static int smb_make_node(struct inode *,struct dentry *,int,int);
static int smb_make_node(struct inode *,struct dentry *,int,dev_t);
static int smb_link(struct dentry *, struct inode *, struct dentry *);
struct file_operations smb_dir_operations =
......@@ -641,7 +641,7 @@ smb_rename(struct inode *old_dir, struct dentry *old_dentry,
* matches the connection credentials (and we don't know which those are ...)
*/
static int
smb_make_node(struct inode *dir, struct dentry *dentry, int mode, int dev)
smb_make_node(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
{
int error;
struct iattr attr;
......
......@@ -87,7 +87,7 @@ static struct inode *sysfs_get_inode(struct super_block *sb, int mode, int dev)
return inode;
}
static int sysfs_mknod(struct inode *dir, struct dentry *dentry, int mode, int dev)
static int sysfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
{
struct inode *inode;
int error = 0;
......
......@@ -83,7 +83,7 @@ static struct dentry *sysv_lookup(struct inode * dir, struct dentry * dentry)
return NULL;
}
static int sysv_mknod(struct inode * dir, struct dentry * dentry, int mode, int rdev)
static int sysv_mknod(struct inode * dir, struct dentry * dentry, int mode, dev_t rdev)
{
struct inode * inode = sysv_new_inode(dir, mode);
int err = PTR_ERR(inode);
......
......@@ -669,7 +669,7 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode)
return 0;
}
static int udf_mknod(struct inode * dir, struct dentry * dentry, int mode, int rdev)
static int udf_mknod(struct inode * dir, struct dentry * dentry, int mode, dev_t rdev)
{
struct inode * inode;
struct udf_fileident_bh fibh;
......
......@@ -108,7 +108,7 @@ static int ufs_create (struct inode * dir, struct dentry * dentry, int mode)
return err;
}
static int ufs_mknod (struct inode * dir, struct dentry *dentry, int mode, int rdev)
static int ufs_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t rdev)
{
struct inode * inode = ufs_new_inode(dir, mode);
int err = PTR_ERR(inode);
......
......@@ -237,7 +237,7 @@ static int umsdos_nevercreat (struct inode *dir, struct dentry *dentry,
* The same is true for directory creation.
*/
static int umsdos_create_any (struct inode *dir, struct dentry *dentry,
int mode, int rdev, char flags)
int mode, dev_t rdev, char flags)
{
struct dentry *fake;
struct inode *inode;
......@@ -861,7 +861,7 @@ dentry->d_parent->d_name.name, info.fake.fname);
* in particular and other parts of the kernel I guess.
*/
int UMSDOS_mknod (struct inode *dir, struct dentry *dentry,
int mode, int rdev)
int mode, dev_t rdev)
{
return umsdos_create_any (dir, dentry, mode, rdev, 0);
}
......
......@@ -69,7 +69,7 @@ linvfs_mknod(
struct inode *dir,
struct dentry *dentry,
int mode,
int rdev)
dev_t rdev)
{
struct inode *ip;
vattr_t va;
......
......@@ -50,7 +50,7 @@ int venus_mkdir(struct super_block *sb, struct ViceFid *dirfid,
const char *name, int length,
struct ViceFid *newfid, struct coda_vattr *attrs);
int venus_create(struct super_block *sb, struct ViceFid *dirfid,
const char *name, int length, int excl, int mode, int rdev,
const char *name, int length, int excl, int mode, dev_t rdev,
struct ViceFid *newfid, struct coda_vattr *attrs) ;
int venus_rmdir(struct super_block *sb, struct ViceFid *dirfid,
const char *name, int length);
......
......@@ -773,7 +773,7 @@ struct inode_operations {
int (*symlink) (struct inode *,struct dentry *,const char *);
int (*mkdir) (struct inode *,struct dentry *,int);
int (*rmdir) (struct inode *,struct dentry *);
int (*mknod) (struct inode *,struct dentry *,int,int);
int (*mknod) (struct inode *,struct dentry *,int,dev_t);
int (*rename) (struct inode *, struct dentry *,
struct inode *, struct dentry *);
int (*readlink) (struct dentry *, char *,int);
......@@ -1109,7 +1109,7 @@ extern inline const char *bdevname(struct block_device *bdev)
}
extern const char * cdevname(kdev_t);
extern const char * kdevname(kdev_t);
extern void init_special_inode(struct inode *, umode_t, int);
extern void init_special_inode(struct inode *, umode_t, dev_t);
/* Invalid inode operations -- fs/bad_inode.c */
extern void make_bad_inode(struct inode *);
......
......@@ -82,7 +82,7 @@ int UMSDOS_mkdir (struct inode *dir,
int UMSDOS_mknod (struct inode *dir,
struct dentry *dentry,
int mode,
int rdev);
dev_t rdev);
int UMSDOS_rmdir (struct inode *dir,struct dentry *dentry);
int UMSDOS_unlink (struct inode *dir, struct dentry *dentry);
int UMSDOS_rename (struct inode *old_dir,
......
......@@ -1015,7 +1015,8 @@ static int shmem_mmap(struct file *file, struct vm_area_struct *vma)
return 0;
}
struct inode *shmem_get_inode(struct super_block *sb, int mode, int dev)
static struct inode *
shmem_get_inode(struct super_block *sb, int mode, dev_t dev)
{
struct inode *inode;
struct shmem_inode_info *info;
......@@ -1426,7 +1427,8 @@ static int shmem_statfs(struct super_block *sb, struct statfs *buf)
/*
* File creation. Allocate an inode, and we're done..
*/
static int shmem_mknod(struct inode *dir, struct dentry *dentry, int mode, int dev)
static int
shmem_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
{
struct inode *inode = shmem_get_inode(dir->i_sb, mode, dev);
int error = -ENOSPC;
......
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