From: sandeen@sandeen.net
To: xfs@oss.sgi.com
Cc: hch@infradead.org
Subject: [patch 10/11] Hook up compat XFS_IOC_FSSETDM_BY_HANDLE ioctl handler
Date: Tue, 18 Nov 2008 22:44:11 -0600 [thread overview]
Message-ID: <20081119044910.323857277@sandeen.net> (raw)
In-Reply-To: 20081119044401.573365619@sandeen.net
[-- Attachment #1: compat_ioctl_dmidata --]
[-- Type: text/plain, Size: 2992 bytes --]
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>
--
Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_ioctl32.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_ioctl32.c
+++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_ioctl32.c
@@ -585,6 +585,44 @@ xfs_attrmulti_by_handle_compat(
return -error;
}
+STATIC int
+compat_xfs_fssetdm_by_handle(
+ void __user *arg,
+ struct inode *parinode)
+{
+ int error;
+ struct fsdmidata fsd;
+ compat_xfs_fsop_setdm_handlereq_t dmhreq;
+ struct inode *inode;
+ xfs_mount_t *mp = XFS_I(parinode)->i_mount;
+
+ 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(
int mode,
@@ -605,7 +643,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:
@@ -681,6 +718,8 @@ xfs_compat_ioctl(
return xfs_attrlist_by_handle_compat((void __user*)arg, inode);
case XFS_IOC_ATTRMULTI_BY_HANDLE_32:
return xfs_attrmulti_by_handle_compat((void __user*)arg, inode);
+ case XFS_IOC_FSSETDM_BY_HANDLE_32:
+ return compat_xfs_fssetdm_by_handle((void __user*)arg, inode);
default:
return -XFS_ERROR(ENOIOCTLCMD);
}
Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_ioctl32.h
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_ioctl32.h
+++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_ioctl32.h
@@ -151,6 +151,15 @@ typedef struct compat_xfs_fsop_attrmulti
#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 {
--
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2008-11-19 4:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-19 4:44 [patch 00/11] RFC: compat ioctl fixes/cleanups/additions sandeen
2008-11-19 4:44 ` [patch 01/11] Move compat ioctl structs & numbers into xfs_ioctl32.h sandeen
[not found] ` <20081119145941.GA13050@infradead.org>
2008-11-19 15:24 ` Eric Sandeen
2008-11-20 1:54 ` Eric Sandeen
2008-11-19 4:44 ` [patch 02/11] Fix the compat XFS_IOC_FSGEOMETRY_V1 ioctl sandeen
2008-11-19 4:44 ` [patch 03/11] Add compat handlers for data & rt growfs ioctls sandeen
2008-11-19 4:44 ` [patch 04/11] Add compat handlers for swapext ioctl sandeen
2008-11-19 4:44 ` [patch 05/11] Make the bulkstat_one compat ioctl handling more sane sandeen
2008-11-19 4:44 ` [patch 06/11] Fix xfs_bulkstat_one size checks & error handling sandeen
2008-11-19 4:44 ` [patch 07/11] Fix compat XFS_IOC_FSBULKSTAT_SINGLE ioctl sandeen
2008-11-19 4:44 ` [patch 08/11] Hook up compat XFS_IOC_ATTRLIST_BY_HANDLE ioctl handler sandeen
2008-11-19 4:44 ` [patch 09/11] Hook up compat XFS_IOC_ATTRMULTI_BY_HANDLE " sandeen
[not found] ` <20081119151628.GI13050@infradead.org>
2008-11-19 15:30 ` Eric Sandeen
2008-11-19 4:44 ` sandeen [this message]
2008-11-19 4:44 ` [patch 11/11] Reorder xfs_ioctl32.c for some tidiness sandeen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081119044910.323857277@sandeen.net \
--to=sandeen@sandeen.net \
--cc=hch@infradead.org \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox