Bug#257265: [PATCH] partial 32bit translation for XFS
Or rather non-translation. This just feeds through the ioctls where the
structyure size matches for 32bit vs 64bit, that's all but the various
handle and bulkstat ioctls.
--- 1.31/fs/xfs/Makefile 2004-06-18 04:05:01 +02:00
+++ edited/fs/xfs/Makefile 2004-07-07 18:58:47 +02:00
@@ -71,6 +71,7 @@
xfs-$(CONFIG_XFS_POSIX_MAC) += xfs_mac.o
xfs-$(CONFIG_PROC_FS) += linux-2.6/xfs_stats.o
xfs-$(CONFIG_SYSCTL) += linux-2.6/xfs_sysctl.o
+xfs-$(CONFIG_COMPAT) += linux-2.6/xfs_ioctl32.o
xfs-y += xfs_alloc.o \
--- 1.84/fs/xfs/linux-2.6/xfs_super.c 2004-06-18 06:09:11 +02:00
+++ edited/fs/xfs/linux-2.6/xfs_super.c 2004-07-11 00:41:02 +02:00
@@ -66,6 +66,7 @@
#include "xfs_buf_item.h"
#include "xfs_utils.h"
#include "xfs_version.h"
+#include "xfs_ioctl32.h"
#include <linux/namei.h>
#include <linux/init.h>
@@ -857,6 +858,10 @@
goto undo_shaker;
}
+ error = xfs_ioctl32_init();
+ if (error)
+ goto undo_ioctl32;
+
error = register_filesystem(&xfs_fs_type);
if (error)
goto undo_register;
@@ -864,6 +869,9 @@
return 0;
undo_register:
+ xfs_ioctl32_exit();
+
+undo_ioctl32:
kmem_shake_deregister(xfs_inode_shaker);
undo_shaker:
@@ -882,6 +890,7 @@
vfs_exitquota();
XFS_DM_EXIT(&xfs_fs_type);
unregister_filesystem(&xfs_fs_type);
+ xfs_ioctl32_exit();
kmem_shake_deregister(xfs_inode_shaker);
xfs_cleanup();
pagebuf_terminate();
--- /dev/null 2004-05-30 14:45:31.000000000 +0200
+++ edited/fs/xfs/linux-2.6/xfs_ioctl32.c 2004-07-11 17:08:46.000000000 +0200
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2004 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+#include <linux/init.h>
+#include <linux/ioctl.h>
+#include <linux/ioctl32.h>
+#include <linux/types.h>
+
+#include "xfs_types.h"
+#include "xfs_fs.h"
+
+#define XFS_IOC_GETXFLAGS _IOR('f', 1, long)
+#define XFS_IOC_SETXFLAGS _IOW('f', 2, long)
+#define XFS_IOC_GETVERSION _IOR('v', 1, long)
+
+struct ioctl_trans xfs_ioctl32_trans[] = {
+ /* xfs_flock_t has wrong alignment for x86_64 */
+#if 1
+ { XFS_IOC_ALLOCSP, },
+ { XFS_IOC_FREESP, },
+ { XFS_IOC_RESVSP, },
+ { XFS_IOC_UNRESVSP, },
+ { XFS_IOC_ALLOCSP64, },
+ { XFS_IOC_FREESP64, },
+ { XFS_IOC_RESVSP64, },
+ { XFS_IOC_UNRESVSP64, },
+#endif
+ { XFS_IOC_DIOINFO, NULL },
+#if 0 /* bulkstat is complicated */
+ { XFS_IOC_FSBULKSTAT_SINGLE, },
+ { XFS_IOC_FSBULKSTAT, },
+ { XFS_IOC_FSINUMBERS, },
+#endif
+ { XFS_IOC_FSGEOMETRY_V1, },
+ { XFS_IOC_FSGEOMETRY, },
+ { XFS_IOC_GETVERSION, },
+ { XFS_IOC_GETXFLAGS, },
+ { XFS_IOC_SETXFLAGS, },
+ { XFS_IOC_FSGETXATTR, },
+ { XFS_IOC_FSSETXATTR, },
+ { XFS_IOC_FSGETXATTRA, },
+ { XFS_IOC_FSSETDM, },
+ { XFS_IOC_GETBMAP, },
+ { XFS_IOC_GETBMAPA, },
+ { XFS_IOC_GETBMAPX, },
+#if 0 /* handle ioctls are dealing with embedded pointers */
+ { XFS_IOC_FD_TO_HANDLE, },
+ { XFS_IOC_PATH_TO_HANDLE, },
+ { XFS_IOC_PATH_TO_HANDLE, },
+ { XFS_IOC_PATH_TO_FSHANDLE, },
+ { XFS_IOC_OPEN_BY_HANDLE, },
+ { XFS_IOC_FSSETDM_BY_HANDLE, },
+ { XFS_IOC_READLINK_BY_HANDLE, },
+ { XFS_IOC_ATTRLIST_BY_HANDLE, },
+ { XFS_IOC_ATTRMULTI_BY_HANDLE, },
+#endif
+#if 1 /* xfs_bstat_t has wrong alignment for x86_64 */
+ { XFS_IOC_SWAPEXT, },
+#endif
+ { XFS_IOC_FSCOUNTS, NULL, },
+ { XFS_IOC_SET_RESBLKS, NULL, },
+ { XFS_IOC_GET_RESBLKS, NULL, },
+ { XFS_IOC_FSGROWFSDATA, NULL, },
+ { XFS_IOC_FSGROWFSLOG, NULL, },
+ { XFS_IOC_FSGROWFSRT, NULL, },
+ { XFS_IOC_FREEZE, NULL, },
+ { XFS_IOC_THAW, NULL, },
+ { XFS_IOC_GOINGDOWN, NULL, },
+ { XFS_IOC_ERROR_INJECTION, NULL, },
+ { XFS_IOC_ERROR_CLEARALL, NULL, },
+ { 0, },
+};
+
+int __init
+xfs_ioctl32_init(void)
+{
+ int error, i;
+
+ for (i = 0; xfs_ioctl32_trans[i].cmd != 0; i++) {
+ error = register_ioctl32_conversion(xfs_ioctl32_trans[i].cmd,
+ xfs_ioctl32_trans[i].handler);
+ if (error)
+ goto fail;
+ }
+
+ return 0;
+
+ fail:
+ while (--i)
+ unregister_ioctl32_conversion(xfs_ioctl32_trans[i].cmd);
+ return error;
+}
+
+void __exit
+xfs_ioctl32_exit(void)
+{
+ int i;
+
+ for (i = 0; xfs_ioctl32_trans[i].cmd != 0; i++)
+ unregister_ioctl32_conversion(xfs_ioctl32_trans[i].cmd);
+}
--- /dev/null 2004-05-30 14:45:31.000000000 +0200
+++ edited/fs/xfs/linux-2.6/xfs_ioctl32.h 2004-07-11 00:39:22.000000000 +0200
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2004 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+#include <linux/config.h>
+
+#ifdef CONFIG_COMPAT
+extern int xfs_ioctl32_init(void);
+extern void xfs_ioctl32_exit(void);
+#else
+static inline int xfs_ioctl32_init(void) { return 0; }
+static inline void xfs_ioctl32_exit(void) { }
+#endif
Reply to: