Re: [PATCH] revoke: consolidate revoked file operations
On Fri, Mar 09, 2007 at 01:55:06PM +0200, Pekka J Enberg wrote: > From: Pekka Enberg <[EMAIL PROTECTED]> > > Return EBADF for all revoked file operations except for read(2) which > returns zero for special files as the BSDs do and close(2) which is > always zero. > > Cc: Alan Cox <[EMAIL PROTECTED]> > Signed-off-by: Pekka Enberg <[EMAIL PROTECTED]> Acked-by: Alan Cox <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] revoke: consolidate revoked file operations
From: Pekka Enberg <[EMAIL PROTECTED]> Return EBADF for all revoked file operations except for read(2) which returns zero for special files as the BSDs do and close(2) which is always zero. Cc: Alan Cox <[EMAIL PROTECTED]> Signed-off-by: Pekka Enberg <[EMAIL PROTECTED]> --- fs/revoked_inode.c | 367 + 1 file changed, 38 insertions(+), 329 deletions(-) Index: uml-2.6/fs/revoked_inode.c === --- uml-2.6.orig/fs/revoked_inode.c 2007-03-09 13:26:30.0 +0200 +++ uml-2.6/fs/revoked_inode.c 2007-03-09 13:47:54.0 +0200 @@ -29,6 +29,12 @@ return -EBADF; } +static ssize_t revoked_special_file_read(struct file *filp, char __user * buf, +size_t size, loff_t * ppos) +{ + return 0; +} + static ssize_t revoked_file_write(struct file *filp, const char __user * buf, size_t siz, loff_t * ppos) { @@ -200,6 +206,35 @@ .splice_read = revoked_file_splice_read, }; +static const struct file_operations revoked_special_file_ops = { + .llseek = revoked_file_llseek, + .read = revoked_special_file_read, + .write = revoked_file_write, + .aio_read = revoked_file_aio_read, + .aio_write = revoked_file_aio_write, + .readdir = revoked_file_readdir, + .poll = revoked_file_poll, + .ioctl = revoked_file_ioctl, + .unlocked_ioctl = revoked_file_unlocked_ioctl, + .compat_ioctl = revoked_file_compat_ioctl, + .mmap = revoked_file_mmap, + .open = revoked_file_open, + .flush = revoked_file_flush, + .release = revoked_file_release, + .fsync = revoked_file_fsync, + .aio_fsync = revoked_file_aio_fsync, + .fasync = revoked_file_fasync, + .lock = revoked_file_lock, + .sendfile = revoked_file_sendfile, + .sendpage = revoked_file_sendpage, + .get_unmapped_area = revoked_file_get_unmapped_area, + .check_flags = revoked_file_check_flags, + .dir_notify = revoked_file_dir_notify, + .flock = revoked_file_flock, + .splice_write = revoked_file_splice_write, + .splice_read = revoked_file_splice_read, +}; + static int revoked_inode_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd) { @@ -326,330 +361,6 @@ /* truncate_range returns void */ }; -static loff_t revoked_special_file_llseek(struct file *file, loff_t offset, - int origin) -{ - return -ENXIO; -} - -static ssize_t revoked_special_file_read(struct file *filp, char __user * buf, -size_t size, loff_t * ppos) -{ - return -ENXIO; -} - -static ssize_t revoked_special_file_write(struct file *filp, - const char __user * buf, size_t siz, - loff_t * ppos) -{ - return -ENXIO; -} - -static ssize_t revoked_special_file_aio_read(struct kiocb *iocb, -const struct iovec *iov, -unsigned long nr_segs, loff_t pos) -{ - return -ENXIO; -} - -static ssize_t revoked_special_file_aio_write(struct kiocb *iocb, - const struct iovec *iov, - unsigned long nr_segs, loff_t pos) -{ - return -ENXIO; -} - -static int revoked_special_file_readdir(struct file *filp, void *dirent, - filldir_t filldir) -{ - return -ENXIO; -} - -static unsigned int revoked_special_file_poll(struct file *filp, - poll_table * wait) -{ - return POLLERR; -} - -static int revoked_special_file_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - return -ENXIO; -} - -static long revoked_special_file_unlocked_ioctl(struct file *file, unsigned cmd, - unsigned long arg) -{ - return -ENXIO; -} - -static long revoked_special_file_compat_ioctl(struct file *file, - unsigned int cmd, - unsigned long arg) -{ - return -ENXIO; -} - -static int revoked_special_file_mmap(struct file *file, -struct vm_area_struct *vma) -{ - return -ENXIO; -} - -static int revoked_special_file_open(struct inode *inode, struct file *filp) -{ - return -ENXIO; -} - -static int revoked_special_file_flush(struct file *file, fl_owner_t id) -{ - return 0; -} - -static int revoked_special_file_release(struct inode *inode, struct file *filp) -{ - return -ENXIO; -} - -static int revoked_special_file_fsync(struct
[PATCH] revoke: consolidate revoked file operations
From: Pekka Enberg [EMAIL PROTECTED] Return EBADF for all revoked file operations except for read(2) which returns zero for special files as the BSDs do and close(2) which is always zero. Cc: Alan Cox [EMAIL PROTECTED] Signed-off-by: Pekka Enberg [EMAIL PROTECTED] --- fs/revoked_inode.c | 367 + 1 file changed, 38 insertions(+), 329 deletions(-) Index: uml-2.6/fs/revoked_inode.c === --- uml-2.6.orig/fs/revoked_inode.c 2007-03-09 13:26:30.0 +0200 +++ uml-2.6/fs/revoked_inode.c 2007-03-09 13:47:54.0 +0200 @@ -29,6 +29,12 @@ return -EBADF; } +static ssize_t revoked_special_file_read(struct file *filp, char __user * buf, +size_t size, loff_t * ppos) +{ + return 0; +} + static ssize_t revoked_file_write(struct file *filp, const char __user * buf, size_t siz, loff_t * ppos) { @@ -200,6 +206,35 @@ .splice_read = revoked_file_splice_read, }; +static const struct file_operations revoked_special_file_ops = { + .llseek = revoked_file_llseek, + .read = revoked_special_file_read, + .write = revoked_file_write, + .aio_read = revoked_file_aio_read, + .aio_write = revoked_file_aio_write, + .readdir = revoked_file_readdir, + .poll = revoked_file_poll, + .ioctl = revoked_file_ioctl, + .unlocked_ioctl = revoked_file_unlocked_ioctl, + .compat_ioctl = revoked_file_compat_ioctl, + .mmap = revoked_file_mmap, + .open = revoked_file_open, + .flush = revoked_file_flush, + .release = revoked_file_release, + .fsync = revoked_file_fsync, + .aio_fsync = revoked_file_aio_fsync, + .fasync = revoked_file_fasync, + .lock = revoked_file_lock, + .sendfile = revoked_file_sendfile, + .sendpage = revoked_file_sendpage, + .get_unmapped_area = revoked_file_get_unmapped_area, + .check_flags = revoked_file_check_flags, + .dir_notify = revoked_file_dir_notify, + .flock = revoked_file_flock, + .splice_write = revoked_file_splice_write, + .splice_read = revoked_file_splice_read, +}; + static int revoked_inode_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd) { @@ -326,330 +361,6 @@ /* truncate_range returns void */ }; -static loff_t revoked_special_file_llseek(struct file *file, loff_t offset, - int origin) -{ - return -ENXIO; -} - -static ssize_t revoked_special_file_read(struct file *filp, char __user * buf, -size_t size, loff_t * ppos) -{ - return -ENXIO; -} - -static ssize_t revoked_special_file_write(struct file *filp, - const char __user * buf, size_t siz, - loff_t * ppos) -{ - return -ENXIO; -} - -static ssize_t revoked_special_file_aio_read(struct kiocb *iocb, -const struct iovec *iov, -unsigned long nr_segs, loff_t pos) -{ - return -ENXIO; -} - -static ssize_t revoked_special_file_aio_write(struct kiocb *iocb, - const struct iovec *iov, - unsigned long nr_segs, loff_t pos) -{ - return -ENXIO; -} - -static int revoked_special_file_readdir(struct file *filp, void *dirent, - filldir_t filldir) -{ - return -ENXIO; -} - -static unsigned int revoked_special_file_poll(struct file *filp, - poll_table * wait) -{ - return POLLERR; -} - -static int revoked_special_file_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - return -ENXIO; -} - -static long revoked_special_file_unlocked_ioctl(struct file *file, unsigned cmd, - unsigned long arg) -{ - return -ENXIO; -} - -static long revoked_special_file_compat_ioctl(struct file *file, - unsigned int cmd, - unsigned long arg) -{ - return -ENXIO; -} - -static int revoked_special_file_mmap(struct file *file, -struct vm_area_struct *vma) -{ - return -ENXIO; -} - -static int revoked_special_file_open(struct inode *inode, struct file *filp) -{ - return -ENXIO; -} - -static int revoked_special_file_flush(struct file *file, fl_owner_t id) -{ - return 0; -} - -static int revoked_special_file_release(struct inode *inode, struct file *filp) -{ - return -ENXIO; -} - -static int revoked_special_file_fsync(struct file
Re: [PATCH] revoke: consolidate revoked file operations
On Fri, Mar 09, 2007 at 01:55:06PM +0200, Pekka J Enberg wrote: From: Pekka Enberg [EMAIL PROTECTED] Return EBADF for all revoked file operations except for read(2) which returns zero for special files as the BSDs do and close(2) which is always zero. Cc: Alan Cox [EMAIL PROTECTED] Signed-off-by: Pekka Enberg [EMAIL PROTECTED] Acked-by: Alan Cox [EMAIL PROTECTED] - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/