diff options
Diffstat (limited to 'fs/gfs2/ops_file.c')
-rw-r--r-- | fs/gfs2/ops_file.c | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c index d30c6db46241..6333a14cf77a 100644 --- a/fs/gfs2/ops_file.c +++ b/fs/gfs2/ops_file.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/blkdev.h> | 17 | #include <linux/blkdev.h> |
18 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
19 | #include <linux/smp_lock.h> | 19 | #include <linux/smp_lock.h> |
20 | #include <linux/gfs2_ioctl.h> | ||
21 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
22 | #include <linux/gfs2_ondisk.h> | 21 | #include <linux/gfs2_ondisk.h> |
23 | #include <asm/semaphore.h> | 22 | #include <asm/semaphore.h> |
@@ -532,98 +531,6 @@ static int gfs2_readdir(struct file *file, void *dirent, filldir_t filldir) | |||
532 | return error; | 531 | return error; |
533 | } | 532 | } |
534 | 533 | ||
535 | static int gfs2_ioctl_flags(struct gfs2_inode *ip, unsigned int cmd, | ||
536 | unsigned long arg) | ||
537 | { | ||
538 | unsigned int lmode = (cmd == GFS2_IOCTL_SETFLAGS) ? | ||
539 | LM_ST_EXCLUSIVE : LM_ST_SHARED; | ||
540 | struct buffer_head *dibh; | ||
541 | struct gfs2_holder i_gh; | ||
542 | int error; | ||
543 | __u32 flags = 0, change; | ||
544 | |||
545 | if (cmd == GFS2_IOCTL_SETFLAGS) { | ||
546 | error = get_user(flags, (__u32 __user *)arg); | ||
547 | if (error) | ||
548 | return -EFAULT; | ||
549 | } | ||
550 | |||
551 | error = gfs2_glock_nq_init(ip->i_gl, lmode, 0, &i_gh); | ||
552 | if (error) | ||
553 | return error; | ||
554 | |||
555 | if (cmd == GFS2_IOCTL_SETFLAGS) { | ||
556 | change = flags ^ ip->i_di.di_flags; | ||
557 | error = -EPERM; | ||
558 | if (change & (GFS2_DIF_IMMUTABLE|GFS2_DIF_APPENDONLY)) { | ||
559 | if (!capable(CAP_LINUX_IMMUTABLE)) | ||
560 | goto out; | ||
561 | } | ||
562 | error = -EINVAL; | ||
563 | if (flags & (GFS2_DIF_JDATA|GFS2_DIF_DIRECTIO)) { | ||
564 | if (!S_ISREG(ip->i_di.di_mode)) | ||
565 | goto out; | ||
566 | } | ||
567 | if (flags & | ||
568 | (GFS2_DIF_INHERIT_JDATA|GFS2_DIF_INHERIT_DIRECTIO)) { | ||
569 | if (!S_ISDIR(ip->i_di.di_mode)) | ||
570 | goto out; | ||
571 | } | ||
572 | |||
573 | error = gfs2_trans_begin(ip->i_sbd, RES_DINODE, 0); | ||
574 | if (error) | ||
575 | goto out; | ||
576 | |||
577 | error = gfs2_meta_inode_buffer(ip, &dibh); | ||
578 | if (error) | ||
579 | goto out_trans_end; | ||
580 | |||
581 | ip->i_di.di_flags = flags; | ||
582 | |||
583 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); | ||
584 | gfs2_dinode_out(&ip->i_di, dibh->b_data); | ||
585 | |||
586 | brelse(dibh); | ||
587 | |||
588 | out_trans_end: | ||
589 | gfs2_trans_end(ip->i_sbd); | ||
590 | } else { | ||
591 | flags = ip->i_di.di_flags; | ||
592 | } | ||
593 | out: | ||
594 | gfs2_glock_dq_uninit(&i_gh); | ||
595 | if (cmd == GFS2_IOCTL_GETFLAGS) { | ||
596 | if (put_user(flags, (__u32 __user *)arg)) | ||
597 | return -EFAULT; | ||
598 | } | ||
599 | return error; | ||
600 | } | ||
601 | |||
602 | /** | ||
603 | * gfs2_ioctl - do an ioctl on a file | ||
604 | * @inode: the inode | ||
605 | * @file: the file pointer | ||
606 | * @cmd: the ioctl command | ||
607 | * @arg: the argument | ||
608 | * | ||
609 | * Returns: errno | ||
610 | */ | ||
611 | |||
612 | static int gfs2_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | ||
613 | unsigned long arg) | ||
614 | { | ||
615 | struct gfs2_inode *ip = inode->u.generic_ip; | ||
616 | |||
617 | switch (cmd) { | ||
618 | case GFS2_IOCTL_SETFLAGS: | ||
619 | case GFS2_IOCTL_GETFLAGS: | ||
620 | return gfs2_ioctl_flags(ip, cmd, arg); | ||
621 | |||
622 | default: | ||
623 | return -ENOTTY; | ||
624 | } | ||
625 | } | ||
626 | |||
627 | /** | 534 | /** |
628 | * gfs2_mmap - | 535 | * gfs2_mmap - |
629 | * @file: The file to map | 536 | * @file: The file to map |
@@ -925,7 +832,6 @@ struct file_operations gfs2_file_fops = { | |||
925 | .write = generic_file_write, | 832 | .write = generic_file_write, |
926 | .writev = generic_file_writev, | 833 | .writev = generic_file_writev, |
927 | .aio_write = generic_file_aio_write, | 834 | .aio_write = generic_file_aio_write, |
928 | .ioctl = gfs2_ioctl, | ||
929 | .mmap = gfs2_mmap, | 835 | .mmap = gfs2_mmap, |
930 | .open = gfs2_open, | 836 | .open = gfs2_open, |
931 | .release = gfs2_close, | 837 | .release = gfs2_close, |
@@ -937,7 +843,6 @@ struct file_operations gfs2_file_fops = { | |||
937 | 843 | ||
938 | struct file_operations gfs2_dir_fops = { | 844 | struct file_operations gfs2_dir_fops = { |
939 | .readdir = gfs2_readdir, | 845 | .readdir = gfs2_readdir, |
940 | .ioctl = gfs2_ioctl, | ||
941 | .open = gfs2_open, | 846 | .open = gfs2_open, |
942 | .release = gfs2_close, | 847 | .release = gfs2_close, |
943 | .fsync = gfs2_fsync, | 848 | .fsync = gfs2_fsync, |