diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-04-04 14:29:30 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-04-04 14:29:30 -0400 |
commit | 55eccc6d00cea224bf634d44e9871cfe83200ff2 (patch) | |
tree | 1fffca6fbacad1650b27e493a406aad0e347a7a6 /fs/gfs2/ops_file.c | |
parent | 76467874b83835129dc454e3a7a8e5d1186101b0 (diff) |
[GFS2] Finish off ioctl support
This puts the finishing touches to the ioctl support and also
removes a couple of unused fields from GFS2's private per file
structure.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_file.c')
-rw-r--r-- | fs/gfs2/ops_file.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c index c44225fa758b..9bb296717086 100644 --- a/fs/gfs2/ops_file.c +++ b/fs/gfs2/ops_file.c | |||
@@ -572,7 +572,7 @@ static int gfs2_get_flags(struct inode *inode, u32 __user *ptr) | |||
572 | error = gfs2_glock_nq_m_atime(1, &gh); | 572 | error = gfs2_glock_nq_m_atime(1, &gh); |
573 | if (error) | 573 | if (error) |
574 | return error; | 574 | return error; |
575 | 575 | ||
576 | iflags = iflags_cvt(gfs2_to_iflags, ip->i_di.di_flags); | 576 | iflags = iflags_cvt(gfs2_to_iflags, ip->i_di.di_flags); |
577 | if (put_user(iflags, ptr)) | 577 | if (put_user(iflags, ptr)) |
578 | error = -EFAULT; | 578 | error = -EFAULT; |
@@ -600,20 +600,22 @@ static int gfs2_get_flags(struct inode *inode, u32 __user *ptr) | |||
600 | * @mask: Indicates which flags are valid | 600 | * @mask: Indicates which flags are valid |
601 | * | 601 | * |
602 | */ | 602 | */ |
603 | static int do_gfs2_set_flags(struct inode *inode, u32 flags, u32 mask) | 603 | static int do_gfs2_set_flags(struct inode *inode, u32 reqflags, u32 mask) |
604 | { | 604 | { |
605 | struct gfs2_inode *ip = inode->u.generic_ip; | 605 | struct gfs2_inode *ip = inode->u.generic_ip; |
606 | struct gfs2_sbd *sdp = ip->i_sbd; | ||
606 | struct buffer_head *bh; | 607 | struct buffer_head *bh; |
607 | struct gfs2_holder gh; | 608 | struct gfs2_holder gh; |
608 | int error; | 609 | int error; |
609 | u32 new_flags; | 610 | u32 new_flags, flags; |
610 | 611 | ||
611 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); | 612 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); |
612 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); | 613 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); |
613 | if (error) | 614 | if (error) |
614 | return error; | 615 | return error; |
615 | 616 | ||
616 | new_flags = (ip->i_di.di_flags & ~mask) | (flags & mask); | 617 | flags = ip->i_di.di_flags; |
618 | new_flags = (flags & ~mask) | (reqflags & mask); | ||
617 | if ((new_flags ^ flags) == 0) | 619 | if ((new_flags ^ flags) == 0) |
618 | goto out; | 620 | goto out; |
619 | 621 | ||
@@ -640,13 +642,18 @@ static int do_gfs2_set_flags(struct inode *inode, u32 flags, u32 mask) | |||
640 | if (error) | 642 | if (error) |
641 | goto out; | 643 | goto out; |
642 | 644 | ||
643 | error = gfs2_meta_inode_buffer(ip, &bh); | 645 | error = gfs2_trans_begin(sdp, RES_DINODE, 0); |
644 | if (error) | 646 | if (error) |
645 | goto out; | 647 | goto out; |
648 | error = gfs2_meta_inode_buffer(ip, &bh); | ||
649 | if (error) | ||
650 | goto out_trans_end; | ||
646 | gfs2_trans_add_bh(ip->i_gl, bh, 1); | 651 | gfs2_trans_add_bh(ip->i_gl, bh, 1); |
647 | ip->i_di.di_flags = new_flags; | 652 | ip->i_di.di_flags = new_flags; |
648 | gfs2_dinode_out(&ip->i_di, bh->b_data); | 653 | gfs2_dinode_out(&ip->i_di, bh->b_data); |
649 | brelse(bh); | 654 | brelse(bh); |
655 | out_trans_end: | ||
656 | gfs2_trans_end(sdp); | ||
650 | out: | 657 | out: |
651 | gfs2_glock_dq_uninit(&gh); | 658 | gfs2_glock_dq_uninit(&gh); |
652 | return error; | 659 | return error; |
@@ -730,9 +737,6 @@ static int gfs2_open(struct inode *inode, struct file *file) | |||
730 | 737 | ||
731 | mutex_init(&fp->f_fl_mutex); | 738 | mutex_init(&fp->f_fl_mutex); |
732 | 739 | ||
733 | fp->f_inode = ip; | ||
734 | fp->f_vfile = file; | ||
735 | |||
736 | gfs2_assert_warn(ip->i_sbd, !file->private_data); | 740 | gfs2_assert_warn(ip->i_sbd, !file->private_data); |
737 | file->private_data = fp; | 741 | file->private_data = fp; |
738 | 742 | ||
@@ -875,7 +879,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl) | |||
875 | { | 879 | { |
876 | struct gfs2_file *fp = file->private_data; | 880 | struct gfs2_file *fp = file->private_data; |
877 | struct gfs2_holder *fl_gh = &fp->f_fl_gh; | 881 | struct gfs2_holder *fl_gh = &fp->f_fl_gh; |
878 | struct gfs2_inode *ip = fp->f_inode; | 882 | struct gfs2_inode *ip = file->f_dentry->d_inode->u.generic_ip; |
879 | struct gfs2_glock *gl; | 883 | struct gfs2_glock *gl; |
880 | unsigned int state; | 884 | unsigned int state; |
881 | int flags; | 885 | int flags; |