r1109 - in trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian: . patches

Christoph Hellwig hch-guest@haydn.debian.org
Sat, 14 Aug 2004 15:29:46 -0600


Author: hch-guest
Date: 2004-08-14 15:29:41 -0600 (Sat, 14 Aug 2004)
New Revision: 1109

Added:
   trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/xfs-ioctl32.dpatch
Modified:
   trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/changelog
   trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/00list-1
Log:

 * Add 32bit ioctl translation support to XFS (closes: Bug#257265)



Modified: trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/changelog
===================================================================
--- trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/changelog	2004-08-14 20:59:03 UTC (rev 1108)
+++ trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/changelog	2004-08-14 21:29:41 UTC (rev 1109)
@@ -62,6 +62,9 @@
   * Add patch from Gustavo Barbier to support IBM RS/6000 7043-240 and -E30
     (Christoph Hellwig).
 
+  * Add 32bit ioctl translation support to XFS (closes: Bug#257265)
+    (Christoph Hellwig).
+
  -- Andres Salomon <dilinger@voxel.net>  Sat, 14 Aug 2004 02:40:50 -0400
 
 kernel-source-2.6.7 (2.6.7-4) unstable; urgency=high

Modified: trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/00list-1
===================================================================
--- trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/00list-1	2004-08-14 20:59:03 UTC (rev 1108)
+++ trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/00list-1	2004-08-14 21:29:41 UTC (rev 1109)
@@ -26,3 +26,4 @@
 ia64-generic-no-smp
 ptmx-fix
 powerpc-ibm-240-e30
+xfs-ioctl32

Added: trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/xfs-ioctl32.dpatch
===================================================================
--- trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/xfs-ioctl32.dpatch	2004-08-14 20:59:03 UTC (rev 1108)
+++ trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/xfs-ioctl32.dpatch	2004-08-14 21:29:41 UTC (rev 1109)
@@ -0,0 +1,302 @@
+#! /bin/sh -e 
+## <PATCHNAME>.dpatch by <PATCH_AUTHOR@EMAI>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Description: Add 32bit ioctl translations to XFS
+## DP: Patch author: Christoph Hellwig <hch@lst.de>
+## DP: Upstream status: pending submission in next XFS merge
+
+. $(dirname $0)/DPATCH
+
+@DPATCH@
+--- 1.31/fs/xfs/Makefile	2004-06-18 04:05:01 +02:00
++++ edited/fs/xfs/Makefile	2004-08-11 10:20:52 +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.10/fs/xfs/xfs_fs.h	2004-02-27 07:28:05 +01:00
++++ edited/fs/xfs/xfs_fs.h	2004-08-11 18:27:01 +02:00
+@@ -445,6 +445,13 @@
+ #define XFS_FSOP_GOING_FLAGS_NOLOGFLUSH		0x2	/* don't flush log nor data */
+ 
+ /*
++ * ioctl commands that are used by Linux filesystems
++ */
++#define XFS_IOC_GETXFLAGS	_IOR('f', 1, long)
++#define XFS_IOC_SETXFLAGS	_IOW('f', 2, long)
++#define XFS_IOC_GETVERSION	_IOR('v', 1, long)
++
++/*
+  * ioctl commands that replace IRIX fcntl()'s
+  * For 'documentation' purposed more than anything else,
+  * the "cmd #" field reflects the IRIX fcntl number.
+--- 1.27/fs/xfs/linux-2.6/xfs_ioctl.c	2004-05-24 05:08:10 +02:00
++++ edited/fs/xfs/linux-2.6/xfs_ioctl.c	2004-08-11 18:26:25 +02:00
+@@ -73,14 +73,6 @@
+ #include <linux/pagemap.h>
+ 
+ /*
+- * ioctl commands that are used by Linux filesystems
+- */
+-#define XFS_IOC_GETXFLAGS	_IOR('f', 1, long)
+-#define XFS_IOC_SETXFLAGS	_IOW('f', 2, long)
+-#define XFS_IOC_GETVERSION	_IOR('v', 1, long)
+-
+-
+-/*
+  * xfs_find_handle maps from userspace xfs_fsop_handlereq structure to
+  * a file or fs handle.
+  *
+--- 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-08-11 10:20:52 +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-08-10 00:19:24.000000000 +0200
++++ a/fs/xfs/linux-2.6/xfs_ioctl32.c	2004-08-11 18:27:20.008881680 +0200
+@@ -0,0 +1,162 @@
++/*
++ * 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>
++#include <linux/compat.h>
++#include <linux/init.h>
++#include <linux/ioctl.h>
++#include <linux/ioctl32.h>
++#include <linux/syscalls.h>
++#include <linux/types.h>
++#include <asm/uaccess.h>
++
++#include "xfs_types.h"
++#include "xfs_fs.h"
++#include "xfs_dfrag.h"
++
++#if defined(CONFIG_IA64) || defined(CONFIG_X86_64)
++#define BROKEN_X86_ALIGNMENT
++#endif
++
++
++typedef struct xfs_fsop_bulkreq32 {
++	compat_uptr_t	lastip;		/* last inode # pointer		*/
++	__s32		icount;		/* count of entries in buffer	*/
++	compat_uptr_t	ubuffer;	/* user buffer for inode desc.	*/
++	__s32		ocount;		/* output count pointer		*/
++} xfs_fsop_bulkreq32_t;
++
++static int
++xfs_ioctl32_bulkstat(
++	unsigned int		fd,
++	unsigned int		cmd,
++	unsigned long		arg,
++	struct file *		file)
++{
++	xfs_fsop_bulkreq32_t	__user *p32 = (void __user *)arg;
++	xfs_fsop_bulkreq_t	__user *p = compat_alloc_user_space(sizeof(*p));
++	u32 addr;
++
++	if (get_user(addr, &p32->lastip) ||
++	    put_user(compat_ptr(addr), &p->lastip) ||
++	    copy_in_user(&p->icount, &p32->icount, sizeof(s32)) ||
++	    get_user(addr, &p32->ubuffer) ||
++	    put_user(compat_ptr(addr), &p->ubuffer) ||
++	    get_user(addr, &p32->ocount) ||
++	    put_user(compat_ptr(addr), &p->ocount))
++		return -EFAULT;
++
++	return sys_ioctl(fd, cmd, (unsigned long)p);
++}
++
++struct ioctl_trans xfs_ioctl32_trans[] = {
++	{ XFS_IOC_DIOINFO, },
++	{ 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, },
++/* not handled
++	{ 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, },
++*/
++	{ 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, },
++#ifndef BROKEN_X86_ALIGNMENT
++	/* xfs_flock_t and xfs_bstat_t have wrong u32 vs u64 alignment */
++	{ XFS_IOC_ALLOCSP, },
++	{ XFS_IOC_FREESP, },
++	{ XFS_IOC_RESVSP, },
++	{ XFS_IOC_UNRESVSP, },
++	{ XFS_IOC_ALLOCSP64, },
++	{ XFS_IOC_FREESP64, },
++	{ XFS_IOC_RESVSP64, },
++	{ XFS_IOC_UNRESVSP64, },
++	{ XFS_IOC_SWAPEXT, },
++	{ XFS_IOC_FSBULKSTAT_SINGLE, xfs_ioctl32_bulkstat },
++	{ XFS_IOC_FSBULKSTAT, xfs_ioctl32_bulkstat},
++	{ XFS_IOC_FSINUMBERS, xfs_ioctl32_bulkstat},
++#endif
++	{ 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
++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-08-10 00:19:24.000000000 +0200
++++ a/fs/xfs/linux-2.6/xfs_ioctl32.h	2004-07-11 16:42:03.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