diff options
author | sandeen@sandeen.net <sandeen@sandeen.net> | 2008-11-25 22:20:16 -0500 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-12-02 01:17:43 -0500 |
commit | 710d62aaaf17c841b8bdbc7a775f8910a7160248 (patch) | |
tree | 52bd778a094fa5ade3a0ea4a5cc9a0bd39c35c60 /fs | |
parent | 28750975ace79c547407a84d3969cbed516be8f8 (diff) |
[XFS] Hook up compat XFS_IOC_FSSETDM_BY_HANDLE ioctl handler
Add a compat handler for XFS_IOC_FSSETDM_BY_HANDLE.
I haven't tested this, lacking dmapi tools to do so
(unless xfsqa magically gets this somehow?)
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl32.c | 43 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl32.h | 9 |
2 files changed, 51 insertions, 1 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c index 17993352aa64..9234360910f2 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl32.c +++ b/fs/xfs/linux-2.6/xfs_ioctl32.c | |||
@@ -563,6 +563,46 @@ xfs_compat_attrmulti_by_handle( | |||
563 | return -error; | 563 | return -error; |
564 | } | 564 | } |
565 | 565 | ||
566 | STATIC int | ||
567 | xfs_compat_fssetdm_by_handle( | ||
568 | xfs_mount_t *mp, | ||
569 | void __user *arg, | ||
570 | struct inode *parinode) | ||
571 | { | ||
572 | int error; | ||
573 | struct fsdmidata fsd; | ||
574 | compat_xfs_fsop_setdm_handlereq_t dmhreq; | ||
575 | struct inode *inode; | ||
576 | |||
577 | if (!capable(CAP_MKNOD)) | ||
578 | return -XFS_ERROR(EPERM); | ||
579 | if (copy_from_user(&dmhreq, arg, | ||
580 | sizeof(compat_xfs_fsop_setdm_handlereq_t))) | ||
581 | return -XFS_ERROR(EFAULT); | ||
582 | |||
583 | error = xfs_vget_fsop_handlereq_compat(mp, parinode, &dmhreq.hreq, | ||
584 | &inode); | ||
585 | if (error) | ||
586 | return -error; | ||
587 | |||
588 | if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) { | ||
589 | error = -XFS_ERROR(EPERM); | ||
590 | goto out; | ||
591 | } | ||
592 | |||
593 | if (copy_from_user(&fsd, compat_ptr(dmhreq.data), sizeof(fsd))) { | ||
594 | error = -XFS_ERROR(EFAULT); | ||
595 | goto out; | ||
596 | } | ||
597 | |||
598 | error = -xfs_set_dmattrs(XFS_I(inode), fsd.fsd_dmevmask, | ||
599 | fsd.fsd_dmstate); | ||
600 | |||
601 | out: | ||
602 | iput(inode); | ||
603 | return error; | ||
604 | } | ||
605 | |||
566 | STATIC long | 606 | STATIC long |
567 | xfs_compat_ioctl( | 607 | xfs_compat_ioctl( |
568 | xfs_inode_t *ip, | 608 | xfs_inode_t *ip, |
@@ -586,7 +626,6 @@ xfs_compat_ioctl( | |||
586 | case XFS_IOC_GETBMAP: | 626 | case XFS_IOC_GETBMAP: |
587 | case XFS_IOC_GETBMAPA: | 627 | case XFS_IOC_GETBMAPA: |
588 | case XFS_IOC_GETBMAPX: | 628 | case XFS_IOC_GETBMAPX: |
589 | /* case XFS_IOC_FSSETDM_BY_HANDLE: not handled */ | ||
590 | case XFS_IOC_FSCOUNTS: | 629 | case XFS_IOC_FSCOUNTS: |
591 | case XFS_IOC_SET_RESBLKS: | 630 | case XFS_IOC_SET_RESBLKS: |
592 | case XFS_IOC_GET_RESBLKS: | 631 | case XFS_IOC_GET_RESBLKS: |
@@ -696,6 +735,8 @@ xfs_compat_ioctl( | |||
696 | return xfs_compat_attrlist_by_handle(mp, arg, inode); | 735 | return xfs_compat_attrlist_by_handle(mp, arg, inode); |
697 | case XFS_IOC_ATTRMULTI_BY_HANDLE_32: | 736 | case XFS_IOC_ATTRMULTI_BY_HANDLE_32: |
698 | return xfs_compat_attrmulti_by_handle(mp, arg, inode); | 737 | return xfs_compat_attrmulti_by_handle(mp, arg, inode); |
738 | case XFS_IOC_FSSETDM_BY_HANDLE_32: | ||
739 | return xfs_compat_fssetdm_by_handle(mp, arg, inode); | ||
699 | default: | 740 | default: |
700 | return -XFS_ERROR(ENOIOCTLCMD); | 741 | return -XFS_ERROR(ENOIOCTLCMD); |
701 | } | 742 | } |
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.h b/fs/xfs/linux-2.6/xfs_ioctl32.h index 785e7ec318cf..af918749d186 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl32.h +++ b/fs/xfs/linux-2.6/xfs_ioctl32.h | |||
@@ -155,6 +155,15 @@ typedef struct compat_xfs_fsop_attrmulti_handlereq { | |||
155 | #define XFS_IOC_ATTRMULTI_BY_HANDLE_32 \ | 155 | #define XFS_IOC_ATTRMULTI_BY_HANDLE_32 \ |
156 | _IOW('X', 123, struct compat_xfs_fsop_attrmulti_handlereq) | 156 | _IOW('X', 123, struct compat_xfs_fsop_attrmulti_handlereq) |
157 | 157 | ||
158 | typedef struct compat_xfs_fsop_setdm_handlereq { | ||
159 | struct compat_xfs_fsop_handlereq hreq; /* handle information */ | ||
160 | /* ptr to struct fsdmidata */ | ||
161 | compat_uptr_t data; /* DMAPI data */ | ||
162 | } compat_xfs_fsop_setdm_handlereq_t; | ||
163 | |||
164 | #define XFS_IOC_FSSETDM_BY_HANDLE_32 \ | ||
165 | _IOW('X', 121, struct compat_xfs_fsop_setdm_handlereq) | ||
166 | |||
158 | #ifdef BROKEN_X86_ALIGNMENT | 167 | #ifdef BROKEN_X86_ALIGNMENT |
159 | /* on ia32 l_start is on a 32-bit boundary */ | 168 | /* on ia32 l_start is on a 32-bit boundary */ |
160 | typedef struct compat_xfs_flock64 { | 169 | typedef struct compat_xfs_flock64 { |