aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_ioctl.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c48
1 files changed, 21 insertions, 27 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index 47cfde6cfae2..f36902fa714d 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -47,6 +47,7 @@
47#include "xfs_utils.h" 47#include "xfs_utils.h"
48#include "xfs_dfrag.h" 48#include "xfs_dfrag.h"
49#include "xfs_fsops.h" 49#include "xfs_fsops.h"
50#include "xfs_vnodeops.h"
50 51
51#include <linux/capability.h> 52#include <linux/capability.h>
52#include <linux/dcache.h> 53#include <linux/dcache.h>
@@ -436,7 +437,6 @@ xfs_fssetdm_by_handle(
436 struct fsdmidata fsd; 437 struct fsdmidata fsd;
437 xfs_fsop_setdm_handlereq_t dmhreq; 438 xfs_fsop_setdm_handlereq_t dmhreq;
438 struct inode *inode; 439 struct inode *inode;
439 bhv_desc_t *bdp;
440 bhv_vnode_t *vp; 440 bhv_vnode_t *vp;
441 441
442 if (!capable(CAP_MKNOD)) 442 if (!capable(CAP_MKNOD))
@@ -458,8 +458,8 @@ xfs_fssetdm_by_handle(
458 return -XFS_ERROR(EFAULT); 458 return -XFS_ERROR(EFAULT);
459 } 459 }
460 460
461 bdp = bhv_base_unlocked(VN_BHV_HEAD(vp)); 461 error = xfs_set_dmattrs(xfs_vtoi(vp),
462 error = xfs_set_dmattrs(bdp, fsd.fsd_dmevmask, fsd.fsd_dmstate, NULL); 462 fsd.fsd_dmevmask, fsd.fsd_dmstate);
463 463
464 VN_RELE(vp); 464 VN_RELE(vp);
465 if (error) 465 if (error)
@@ -676,7 +676,7 @@ xfs_attrmulti_by_handle(
676 676
677STATIC int 677STATIC int
678xfs_ioc_space( 678xfs_ioc_space(
679 bhv_desc_t *bdp, 679 struct xfs_inode *ip,
680 struct inode *inode, 680 struct inode *inode,
681 struct file *filp, 681 struct file *filp,
682 int flags, 682 int flags,
@@ -709,37 +709,31 @@ xfs_ioc_xattr(
709 709
710STATIC int 710STATIC int
711xfs_ioc_getbmap( 711xfs_ioc_getbmap(
712 bhv_desc_t *bdp, 712 struct xfs_inode *ip,
713 int flags, 713 int flags,
714 unsigned int cmd, 714 unsigned int cmd,
715 void __user *arg); 715 void __user *arg);
716 716
717STATIC int 717STATIC int
718xfs_ioc_getbmapx( 718xfs_ioc_getbmapx(
719 bhv_desc_t *bdp, 719 struct xfs_inode *ip,
720 void __user *arg); 720 void __user *arg);
721 721
722int 722int
723xfs_ioctl( 723xfs_ioctl(
724 bhv_desc_t *bdp, 724 xfs_inode_t *ip,
725 struct inode *inode,
726 struct file *filp, 725 struct file *filp,
727 int ioflags, 726 int ioflags,
728 unsigned int cmd, 727 unsigned int cmd,
729 void __user *arg) 728 void __user *arg)
730{ 729{
730 struct inode *inode = filp->f_path.dentry->d_inode;
731 bhv_vnode_t *vp = vn_from_inode(inode);
732 xfs_mount_t *mp = ip->i_mount;
731 int error; 733 int error;
732 bhv_vnode_t *vp;
733 xfs_inode_t *ip;
734 xfs_mount_t *mp;
735
736 vp = vn_from_inode(inode);
737 734
738 vn_trace_entry(vp, "xfs_ioctl", (inst_t *)__return_address); 735 vn_trace_entry(vp, "xfs_ioctl", (inst_t *)__return_address);
739 736
740 ip = XFS_BHVTOI(bdp);
741 mp = ip->i_mount;
742
743 switch (cmd) { 737 switch (cmd) {
744 738
745 case XFS_IOC_ALLOCSP: 739 case XFS_IOC_ALLOCSP:
@@ -758,7 +752,7 @@ xfs_ioctl(
758 !capable(CAP_SYS_ADMIN)) 752 !capable(CAP_SYS_ADMIN))
759 return -EPERM; 753 return -EPERM;
760 754
761 return xfs_ioc_space(bdp, inode, filp, ioflags, cmd, arg); 755 return xfs_ioc_space(ip, inode, filp, ioflags, cmd, arg);
762 756
763 case XFS_IOC_DIOINFO: { 757 case XFS_IOC_DIOINFO: {
764 struct dioattr da; 758 struct dioattr da;
@@ -801,17 +795,17 @@ xfs_ioctl(
801 if (copy_from_user(&dmi, arg, sizeof(dmi))) 795 if (copy_from_user(&dmi, arg, sizeof(dmi)))
802 return -XFS_ERROR(EFAULT); 796 return -XFS_ERROR(EFAULT);
803 797
804 error = xfs_set_dmattrs(bdp, dmi.fsd_dmevmask, dmi.fsd_dmstate, 798 error = xfs_set_dmattrs(ip, dmi.fsd_dmevmask,
805 NULL); 799 dmi.fsd_dmstate);
806 return -error; 800 return -error;
807 } 801 }
808 802
809 case XFS_IOC_GETBMAP: 803 case XFS_IOC_GETBMAP:
810 case XFS_IOC_GETBMAPA: 804 case XFS_IOC_GETBMAPA:
811 return xfs_ioc_getbmap(bdp, ioflags, cmd, arg); 805 return xfs_ioc_getbmap(ip, ioflags, cmd, arg);
812 806
813 case XFS_IOC_GETBMAPX: 807 case XFS_IOC_GETBMAPX:
814 return xfs_ioc_getbmapx(bdp, arg); 808 return xfs_ioc_getbmapx(ip, arg);
815 809
816 case XFS_IOC_FD_TO_HANDLE: 810 case XFS_IOC_FD_TO_HANDLE:
817 case XFS_IOC_PATH_TO_HANDLE: 811 case XFS_IOC_PATH_TO_HANDLE:
@@ -981,7 +975,7 @@ xfs_ioctl(
981 975
982STATIC int 976STATIC int
983xfs_ioc_space( 977xfs_ioc_space(
984 bhv_desc_t *bdp, 978 struct xfs_inode *ip,
985 struct inode *inode, 979 struct inode *inode,
986 struct file *filp, 980 struct file *filp,
987 int ioflags, 981 int ioflags,
@@ -1009,7 +1003,7 @@ xfs_ioc_space(
1009 if (ioflags & IO_INVIS) 1003 if (ioflags & IO_INVIS)
1010 attr_flags |= ATTR_DMI; 1004 attr_flags |= ATTR_DMI;
1011 1005
1012 error = xfs_change_file_space(bdp, cmd, &bf, filp->f_pos, 1006 error = xfs_change_file_space(ip, cmd, &bf, filp->f_pos,
1013 NULL, attr_flags); 1007 NULL, attr_flags);
1014 return -error; 1008 return -error;
1015} 1009}
@@ -1295,7 +1289,7 @@ xfs_ioc_xattr(
1295 1289
1296STATIC int 1290STATIC int
1297xfs_ioc_getbmap( 1291xfs_ioc_getbmap(
1298 bhv_desc_t *bdp, 1292 struct xfs_inode *ip,
1299 int ioflags, 1293 int ioflags,
1300 unsigned int cmd, 1294 unsigned int cmd,
1301 void __user *arg) 1295 void __user *arg)
@@ -1314,7 +1308,7 @@ xfs_ioc_getbmap(
1314 if (ioflags & IO_INVIS) 1308 if (ioflags & IO_INVIS)
1315 iflags |= BMV_IF_NO_DMAPI_READ; 1309 iflags |= BMV_IF_NO_DMAPI_READ;
1316 1310
1317 error = xfs_getbmap(bdp, &bm, (struct getbmap __user *)arg+1, iflags); 1311 error = xfs_getbmap(ip, &bm, (struct getbmap __user *)arg+1, iflags);
1318 if (error) 1312 if (error)
1319 return -error; 1313 return -error;
1320 1314
@@ -1325,7 +1319,7 @@ xfs_ioc_getbmap(
1325 1319
1326STATIC int 1320STATIC int
1327xfs_ioc_getbmapx( 1321xfs_ioc_getbmapx(
1328 bhv_desc_t *bdp, 1322 struct xfs_inode *ip,
1329 void __user *arg) 1323 void __user *arg)
1330{ 1324{
1331 struct getbmapx bmx; 1325 struct getbmapx bmx;
@@ -1352,7 +1346,7 @@ xfs_ioc_getbmapx(
1352 1346
1353 iflags |= BMV_IF_EXTENDED; 1347 iflags |= BMV_IF_EXTENDED;
1354 1348
1355 error = xfs_getbmap(bdp, &bm, (struct getbmapx __user *)arg+1, iflags); 1349 error = xfs_getbmap(ip, &bm, (struct getbmapx __user *)arg+1, iflags);
1356 if (error) 1350 if (error)
1357 return -error; 1351 return -error;
1358 1352