[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>
This commit is contained in:
Родитель
28750975ac
Коммит
710d62aaaf
|
@ -563,6 +563,46 @@ xfs_compat_attrmulti_by_handle(
|
||||||
return -error;
|
return -error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STATIC int
|
||||||
|
xfs_compat_fssetdm_by_handle(
|
||||||
|
xfs_mount_t *mp,
|
||||||
|
void __user *arg,
|
||||||
|
struct inode *parinode)
|
||||||
|
{
|
||||||
|
int error;
|
||||||
|
struct fsdmidata fsd;
|
||||||
|
compat_xfs_fsop_setdm_handlereq_t dmhreq;
|
||||||
|
struct inode *inode;
|
||||||
|
|
||||||
|
if (!capable(CAP_MKNOD))
|
||||||
|
return -XFS_ERROR(EPERM);
|
||||||
|
if (copy_from_user(&dmhreq, arg,
|
||||||
|
sizeof(compat_xfs_fsop_setdm_handlereq_t)))
|
||||||
|
return -XFS_ERROR(EFAULT);
|
||||||
|
|
||||||
|
error = xfs_vget_fsop_handlereq_compat(mp, parinode, &dmhreq.hreq,
|
||||||
|
&inode);
|
||||||
|
if (error)
|
||||||
|
return -error;
|
||||||
|
|
||||||
|
if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) {
|
||||||
|
error = -XFS_ERROR(EPERM);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (copy_from_user(&fsd, compat_ptr(dmhreq.data), sizeof(fsd))) {
|
||||||
|
error = -XFS_ERROR(EFAULT);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
error = -xfs_set_dmattrs(XFS_I(inode), fsd.fsd_dmevmask,
|
||||||
|
fsd.fsd_dmstate);
|
||||||
|
|
||||||
|
out:
|
||||||
|
iput(inode);
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
STATIC long
|
STATIC long
|
||||||
xfs_compat_ioctl(
|
xfs_compat_ioctl(
|
||||||
xfs_inode_t *ip,
|
xfs_inode_t *ip,
|
||||||
|
@ -586,7 +626,6 @@ xfs_compat_ioctl(
|
||||||
case XFS_IOC_GETBMAP:
|
case XFS_IOC_GETBMAP:
|
||||||
case XFS_IOC_GETBMAPA:
|
case XFS_IOC_GETBMAPA:
|
||||||
case XFS_IOC_GETBMAPX:
|
case XFS_IOC_GETBMAPX:
|
||||||
/* case XFS_IOC_FSSETDM_BY_HANDLE: not handled */
|
|
||||||
case XFS_IOC_FSCOUNTS:
|
case XFS_IOC_FSCOUNTS:
|
||||||
case XFS_IOC_SET_RESBLKS:
|
case XFS_IOC_SET_RESBLKS:
|
||||||
case XFS_IOC_GET_RESBLKS:
|
case XFS_IOC_GET_RESBLKS:
|
||||||
|
@ -696,6 +735,8 @@ xfs_compat_ioctl(
|
||||||
return xfs_compat_attrlist_by_handle(mp, arg, inode);
|
return xfs_compat_attrlist_by_handle(mp, arg, inode);
|
||||||
case XFS_IOC_ATTRMULTI_BY_HANDLE_32:
|
case XFS_IOC_ATTRMULTI_BY_HANDLE_32:
|
||||||
return xfs_compat_attrmulti_by_handle(mp, arg, inode);
|
return xfs_compat_attrmulti_by_handle(mp, arg, inode);
|
||||||
|
case XFS_IOC_FSSETDM_BY_HANDLE_32:
|
||||||
|
return xfs_compat_fssetdm_by_handle(mp, arg, inode);
|
||||||
default:
|
default:
|
||||||
return -XFS_ERROR(ENOIOCTLCMD);
|
return -XFS_ERROR(ENOIOCTLCMD);
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,6 +155,15 @@ typedef struct compat_xfs_fsop_attrmulti_handlereq {
|
||||||
#define XFS_IOC_ATTRMULTI_BY_HANDLE_32 \
|
#define XFS_IOC_ATTRMULTI_BY_HANDLE_32 \
|
||||||
_IOW('X', 123, struct compat_xfs_fsop_attrmulti_handlereq)
|
_IOW('X', 123, struct compat_xfs_fsop_attrmulti_handlereq)
|
||||||
|
|
||||||
|
typedef struct compat_xfs_fsop_setdm_handlereq {
|
||||||
|
struct compat_xfs_fsop_handlereq hreq; /* handle information */
|
||||||
|
/* ptr to struct fsdmidata */
|
||||||
|
compat_uptr_t data; /* DMAPI data */
|
||||||
|
} compat_xfs_fsop_setdm_handlereq_t;
|
||||||
|
|
||||||
|
#define XFS_IOC_FSSETDM_BY_HANDLE_32 \
|
||||||
|
_IOW('X', 121, struct compat_xfs_fsop_setdm_handlereq)
|
||||||
|
|
||||||
#ifdef BROKEN_X86_ALIGNMENT
|
#ifdef BROKEN_X86_ALIGNMENT
|
||||||
/* on ia32 l_start is on a 32-bit boundary */
|
/* on ia32 l_start is on a 32-bit boundary */
|
||||||
typedef struct compat_xfs_flock64 {
|
typedef struct compat_xfs_flock64 {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче