Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 52b499c4 authored by David Howells's avatar David Howells Committed by Jens Axboe
Browse files

[PATCH] BLOCK: Move the ReiserFS device ioctl compat stuff to the ReiserFS driver [try #6]



Move the ReiserFS device ioctl compat stuff from fs/compat_ioctl.c to the
ReiserFS driver so that the ReiserFS header file doesn't need to be included.

Signed-Off-By: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 36695673
Loading
Loading
Loading
Loading
+0 −12
Original line number Original line Diff line number Diff line
@@ -59,7 +59,6 @@
#include <linux/pci.h>
#include <linux/pci.h>
#include <linux/module.h>
#include <linux/module.h>
#include <linux/serial.h>
#include <linux/serial.h>
#include <linux/reiserfs_fs.h>
#include <linux/if_tun.h>
#include <linux/if_tun.h>
#include <linux/ctype.h>
#include <linux/ctype.h>
#include <linux/ioctl32.h>
#include <linux/ioctl32.h>
@@ -2014,16 +2013,6 @@ static int vfat_ioctl32(unsigned fd, unsigned cmd, unsigned long arg)
	return ret;
	return ret;
}
}


#define REISERFS_IOC_UNPACK32               _IOW(0xCD,1,int)

static int reiserfs_ioctl32(unsigned fd, unsigned cmd, unsigned long ptr)
{
        if (cmd == REISERFS_IOC_UNPACK32)
                cmd = REISERFS_IOC_UNPACK;

        return sys_ioctl(fd,cmd,ptr);
}

struct raw32_config_request
struct raw32_config_request
{
{
        compat_int_t    raw_minor;
        compat_int_t    raw_minor;
@@ -2784,7 +2773,6 @@ HANDLE_IOCTL(BLKGETSIZE64_32, do_blkgetsize64)
/* vfat */
/* vfat */
HANDLE_IOCTL(VFAT_IOCTL_READDIR_BOTH32, vfat_ioctl32)
HANDLE_IOCTL(VFAT_IOCTL_READDIR_BOTH32, vfat_ioctl32)
HANDLE_IOCTL(VFAT_IOCTL_READDIR_SHORT32, vfat_ioctl32)
HANDLE_IOCTL(VFAT_IOCTL_READDIR_SHORT32, vfat_ioctl32)
HANDLE_IOCTL(REISERFS_IOC_UNPACK32, reiserfs_ioctl32)
/* Raw devices */
/* Raw devices */
HANDLE_IOCTL(RAW_SETBIND, raw_ioctl)
HANDLE_IOCTL(RAW_SETBIND, raw_ioctl)
HANDLE_IOCTL(RAW_GETBIND, raw_ioctl)
HANDLE_IOCTL(RAW_GETBIND, raw_ioctl)
+3 −0
Original line number Original line Diff line number Diff line
@@ -22,6 +22,9 @@ const struct file_operations reiserfs_dir_operations = {
	.readdir = reiserfs_readdir,
	.readdir = reiserfs_readdir,
	.fsync = reiserfs_dir_fsync,
	.fsync = reiserfs_dir_fsync,
	.ioctl = reiserfs_ioctl,
	.ioctl = reiserfs_ioctl,
#ifdef CONFIG_COMPAT
	.compat_ioctl = reiserfs_compat_ioctl,
#endif
};
};


static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry,
static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry,
+4 −0
Original line number Original line Diff line number Diff line
@@ -2,6 +2,7 @@
 * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
 * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
 */
 */


#include <linux/config.h>
#include <linux/time.h>
#include <linux/time.h>
#include <linux/reiserfs_fs.h>
#include <linux/reiserfs_fs.h>
#include <linux/reiserfs_acl.h>
#include <linux/reiserfs_acl.h>
@@ -1568,6 +1569,9 @@ const struct file_operations reiserfs_file_operations = {
	.read = generic_file_read,
	.read = generic_file_read,
	.write = reiserfs_file_write,
	.write = reiserfs_file_write,
	.ioctl = reiserfs_ioctl,
	.ioctl = reiserfs_ioctl,
#ifdef CONFIG_COMPAT
	.compat_ioctl = reiserfs_compat_ioctl,
#endif
	.mmap = generic_file_mmap,
	.mmap = generic_file_mmap,
	.release = reiserfs_file_release,
	.release = reiserfs_file_release,
	.fsync = reiserfs_sync_file,
	.fsync = reiserfs_sync_file,
+35 −0
Original line number Original line Diff line number Diff line
@@ -9,6 +9,7 @@
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <linux/pagemap.h>
#include <linux/pagemap.h>
#include <linux/smp_lock.h>
#include <linux/smp_lock.h>
#include <linux/compat.h>


static int reiserfs_unpack(struct inode *inode, struct file *filp);
static int reiserfs_unpack(struct inode *inode, struct file *filp);


@@ -94,6 +95,40 @@ int reiserfs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
	}
	}
}
}


#ifdef CONFIG_COMPAT
long reiserfs_compat_ioctl(struct file *file, unsigned int cmd,
				unsigned long arg)
{
	struct inode *inode = file->f_dentry->d_inode;
	int ret;

	/* These are just misnamed, they actually get/put from/to user an int */
	switch (cmd) {
	case REISERFS_IOC32_UNPACK:
		cmd = REISERFS_IOC_UNPACK;
		break;
	case REISERFS_IOC32_GETFLAGS:
		cmd = REISERFS_IOC_GETFLAGS;
		break;
	case REISERFS_IOC32_SETFLAGS:
		cmd = REISERFS_IOC_SETFLAGS;
		break;
	case REISERFS_IOC32_GETVERSION:
		cmd = REISERFS_IOC_GETVERSION;
		break;
	case REISERFS_IOC32_SETVERSION:
		cmd = REISERFS_IOC_SETVERSION;
		break;
	default:
		return -ENOIOCTLCMD;
	}
	lock_kernel();
	ret = reiserfs_ioctl(inode, file, cmd, (unsigned long) compat_ptr(arg));
	unlock_kernel();
	return ret;
}
#endif

/*
/*
** reiserfs_unpack
** reiserfs_unpack
** Function try to convert tail from direct item into indirect.
** Function try to convert tail from direct item into indirect.
+9 −0
Original line number Original line Diff line number Diff line
@@ -2161,6 +2161,8 @@ __u32 r5_hash(const signed char *msg, int len);
/* prototypes from ioctl.c */
/* prototypes from ioctl.c */
int reiserfs_ioctl(struct inode *inode, struct file *filp,
int reiserfs_ioctl(struct inode *inode, struct file *filp,
		   unsigned int cmd, unsigned long arg);
		   unsigned int cmd, unsigned long arg);
long reiserfs_compat_ioctl(struct file *filp,
		   unsigned int cmd, unsigned long arg);


/* ioctl's command */
/* ioctl's command */
#define REISERFS_IOC_UNPACK		_IOW(0xCD,1,long)
#define REISERFS_IOC_UNPACK		_IOW(0xCD,1,long)
@@ -2171,6 +2173,13 @@ int reiserfs_ioctl(struct inode *inode, struct file *filp,
#define REISERFS_IOC_GETVERSION		FS_IOC_GETVERSION
#define REISERFS_IOC_GETVERSION		FS_IOC_GETVERSION
#define REISERFS_IOC_SETVERSION		FS_IOC_SETVERSION
#define REISERFS_IOC_SETVERSION		FS_IOC_SETVERSION


/* the 32 bit compat definitions with int argument */
#define REISERFS_IOC32_UNPACK		_IOW(0xCD, 1, int)
#define REISERFS_IOC32_GETFLAGS		FS_IOC32_GETFLAGS
#define REISERFS_IOC32_SETFLAGS		FS_IOC32_SETFLAGS
#define REISERFS_IOC32_GETVERSION	FS_IOC32_GETVERSION
#define REISERFS_IOC32_SETVERSION	FS_IOC32_SETVERSION

/* Locking primitives */
/* Locking primitives */
/* Right now we are still falling back to (un)lock_kernel, but eventually that
/* Right now we are still falling back to (un)lock_kernel, but eventually that
   would evolve into real per-fs locks */
   would evolve into real per-fs locks */