- Add the names of the args in function prototypes - whitespace - make the fd an `int', not an `unsigned int'. --- 25-akpm/fs/fcntl.c | 130 ++++++++++++++++++++++----------------------- 25-akpm/fs/nfs/file.c | 18 +++--- 25-akpm/include/linux/fs.h | 7 +- 3 files changed, 77 insertions(+), 78 deletions(-) diff -puN fs/fcntl.c~file-operations-fcntl-tidies fs/fcntl.c --- 25/fs/fcntl.c~file-operations-fcntl-tidies 2004-03-21 22:01:40.381169680 -0800 +++ 25-akpm/fs/fcntl.c 2004-03-21 22:05:38.587956744 -0800 @@ -282,80 +282,78 @@ void f_delown(struct file *filp) EXPORT_SYMBOL(f_delown); -long generic_file_fcntl(unsigned int fd, unsigned int cmd, - unsigned long arg, struct file * filp) +long generic_file_fcntl(int fd, unsigned int cmd, + unsigned long arg, struct file *filp) { long err = -EINVAL; switch (cmd) { - case F_DUPFD: - get_file(filp); - err = dupfd(filp, arg); - break; - case F_GETFD: - err = get_close_on_exec(fd) ? FD_CLOEXEC : 0; - break; - case F_SETFD: - err = 0; - set_close_on_exec(fd, arg & FD_CLOEXEC); - break; - case F_GETFL: - err = filp->f_flags; - break; - case F_SETFL: - err = setfl(fd, filp, arg); - break; - case F_GETLK: - err = fcntl_getlk(filp, (struct flock __user *) arg); - break; - case F_SETLK: - case F_SETLKW: - err = fcntl_setlk(filp, cmd, (struct flock __user *) arg); - break; - case F_GETOWN: - /* - * XXX If f_owner is a process group, the - * negative return value will get converted - * into an error. Oops. If we keep the - * current syscall conventions, the only way - * to fix this will be in libc. - */ - err = filp->f_owner.pid; - force_successful_syscall_return(); - break; - case F_SETOWN: - err = f_setown(filp, arg, 1); - break; - case F_GETSIG: - err = filp->f_owner.signum; - break; - case F_SETSIG: - /* arg == 0 restores default behaviour. */ - if (arg < 0 || arg > _NSIG) { - break; - } - err = 0; - filp->f_owner.signum = arg; - break; - case F_GETLEASE: - err = fcntl_getlease(filp); - break; - case F_SETLEASE: - err = fcntl_setlease(fd, filp, arg); - break; - case F_NOTIFY: - err = fcntl_dirnotify(fd, filp, arg); - break; - default: + case F_DUPFD: + get_file(filp); + err = dupfd(filp, arg); + break; + case F_GETFD: + err = get_close_on_exec(fd) ? FD_CLOEXEC : 0; + break; + case F_SETFD: + err = 0; + set_close_on_exec(fd, arg & FD_CLOEXEC); + break; + case F_GETFL: + err = filp->f_flags; + break; + case F_SETFL: + err = setfl(fd, filp, arg); + break; + case F_GETLK: + err = fcntl_getlk(filp, (struct flock __user *) arg); + break; + case F_SETLK: + case F_SETLKW: + err = fcntl_setlk(filp, cmd, (struct flock __user *) arg); + break; + case F_GETOWN: + /* + * XXX If f_owner is a process group, the + * negative return value will get converted + * into an error. Oops. If we keep the + * current syscall conventions, the only way + * to fix this will be in libc. + */ + err = filp->f_owner.pid; + force_successful_syscall_return(); + break; + case F_SETOWN: + err = f_setown(filp, arg, 1); + break; + case F_GETSIG: + err = filp->f_owner.signum; + break; + case F_SETSIG: + /* arg == 0 restores default behaviour. */ + if (arg < 0 || arg > _NSIG) { break; + } + err = 0; + filp->f_owner.signum = arg; + break; + case F_GETLEASE: + err = fcntl_getlease(filp); + break; + case F_SETLEASE: + err = fcntl_setlease(fd, filp, arg); + break; + case F_NOTIFY: + err = fcntl_dirnotify(fd, filp, arg); + break; + default: + break; } - return err; } - EXPORT_SYMBOL(generic_file_fcntl); -static long do_fcntl(unsigned int fd, unsigned int cmd, +static long do_fcntl(int fd, unsigned int cmd, unsigned long arg, struct file *filp) { if (filp->f_op && filp->f_op->fcntl) @@ -363,9 +361,9 @@ static long do_fcntl(unsigned int fd, un return generic_file_fcntl(fd, cmd, arg, filp); } -asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg) +asmlinkage long sys_fcntl(int fd, unsigned int cmd, unsigned long arg) { - struct file * filp; + struct file *filp; long err = -EBADF; filp = fget(fd); diff -puN fs/nfs/file.c~file-operations-fcntl-tidies fs/nfs/file.c --- 25/fs/nfs/file.c~file-operations-fcntl-tidies 2004-03-21 22:01:40.383169376 -0800 +++ 25-akpm/fs/nfs/file.c 2004-03-21 22:01:40.388168616 -0800 @@ -33,8 +33,8 @@ #define NFSDBG_FACILITY NFSDBG_FILE -static long nfs_file_fcntl(unsigned int, unsigned int, unsigned long, - struct file *); +static long nfs_file_fcntl(int fd, unsigned int cmd, + unsigned long arg, struct file *filp); static int nfs_file_open(struct inode *, struct file *); static int nfs_file_release(struct inode *, struct file *); static int nfs_file_mmap(struct file *, struct vm_area_struct *); @@ -78,16 +78,16 @@ struct inode_operations nfs_file_inode_o * pass the rest to the generic fcntl function. */ static long -nfs_file_fcntl(unsigned int fd, unsigned int cmd, +nfs_file_fcntl(int fd, unsigned int cmd, unsigned long arg, struct file *filp) { switch (cmd) { - case F_SETFL: - if ((filp->f_flags & nfs_invalid_flags) == nfs_invalid_flags) - return -EINVAL; - break; - default: - break; + case F_SETFL: + if ((filp->f_flags & nfs_invalid_flags) == nfs_invalid_flags) + return -EINVAL; + break; + default: + break; } return generic_file_fcntl(fd, cmd, arg, filp); diff -puN include/linux/fs.h~file-operations-fcntl-tidies include/linux/fs.h --- 25/include/linux/fs.h~file-operations-fcntl-tidies 2004-03-21 22:01:40.385169072 -0800 +++ 25-akpm/include/linux/fs.h 2004-03-21 22:01:40.390168312 -0800 @@ -625,8 +625,8 @@ extern struct list_head file_lock_list; #include -extern long generic_file_fcntl(unsigned int, unsigned int, unsigned long, - struct file *); +extern long generic_file_fcntl(int fd, unsigned int cmd, + unsigned long arg, struct file *filp); extern int fcntl_getlk(struct file *, struct flock __user *); extern int fcntl_setlk(struct file *, unsigned int, struct flock __user *); @@ -838,7 +838,8 @@ struct file_operations { ssize_t (*sendfile) (struct file *, loff_t *, size_t, read_actor_t, void __user *); ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int); unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); - long (*fcntl)(unsigned int, unsigned int, unsigned long, struct file *); + long (*fcntl)(int fd, unsigned int cmd, + unsigned long arg, struct file *filp); }; struct inode_operations { _