Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 124919
b: refs/heads/master
c: 710d62a
h: refs/heads/master
i:
  124917: 3792a02
  124915: e8a3c8a
  124911: 36c2bb9
v: v3
  • Loading branch information
sandeen@sandeen.net authored and Lachlan McIlroy committed Dec 2, 2008
1 parent dc8cb6f commit 85eb690
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 28750975ace79c547407a84d3969cbed516be8f8
refs/heads/master: 710d62aaaf17c841b8bdbc7a775f8910a7160248
43 changes: 42 additions & 1 deletion trunk/fs/xfs/linux-2.6/xfs_ioctl32.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,46 @@ xfs_compat_attrmulti_by_handle(
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
xfs_compat_ioctl(
xfs_inode_t *ip,
Expand All @@ -586,7 +626,6 @@ xfs_compat_ioctl(
case XFS_IOC_GETBMAP:
case XFS_IOC_GETBMAPA:
case XFS_IOC_GETBMAPX:
/* case XFS_IOC_FSSETDM_BY_HANDLE: not handled */
case XFS_IOC_FSCOUNTS:
case XFS_IOC_SET_RESBLKS:
case XFS_IOC_GET_RESBLKS:
Expand Down Expand Up @@ -696,6 +735,8 @@ xfs_compat_ioctl(
return xfs_compat_attrlist_by_handle(mp, arg, inode);
case XFS_IOC_ATTRMULTI_BY_HANDLE_32:
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:
return -XFS_ERROR(ENOIOCTLCMD);
}
Expand Down
9 changes: 9 additions & 0 deletions trunk/fs/xfs/linux-2.6/xfs_ioctl32.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@ typedef struct compat_xfs_fsop_attrmulti_handlereq {
#define XFS_IOC_ATTRMULTI_BY_HANDLE_32 \
_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
/* on ia32 l_start is on a 32-bit boundary */
typedef struct compat_xfs_flock64 {
Expand Down

0 comments on commit 85eb690

Please sign in to comment.