[PATCH 3/5] dasd: merge dasd_cmd into dasd_mod

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



dasd_cmd just implements three ioctls which are wrappers around
functionality in the core kernel or other modules.  When merging those
into dasd_mod they just add 22 lines of code which is far less than the
amount of code removed in the last two patches, and which doesn't spill
into another 4k pages when build modular, while removing a 128lines
module.


 Kconfig      |   10 ----
 Makefile     |    1 
 dasd_cmb.c   |  128 -----------------------------------------------------------
 dasd_ioctl.c |   22 ++++++++++
 4 files changed, 22 insertions(+), 139 deletions(-)

Signed-off-by: Christoph Hellwig <[email protected]>

Index: linux-2.6.16-rc2-mm1/drivers/s390/block/Kconfig
===================================================================
--- linux-2.6.16-rc2-mm1.orig/drivers/s390/block/Kconfig	2006-02-11 16:25:29.000000000 +0100
+++ linux-2.6.16-rc2-mm1/drivers/s390/block/Kconfig	2006-02-11 16:49:58.000000000 +0100
@@ -63,14 +63,4 @@
           DASD extended error reporting. This is only needed if you want to
           use applications written for the EER facility.
 
-config DASD_CMB
-	tristate "Compatibility interface for DASD channel measurement blocks"
-	depends on DASD
-	help
-	  This driver provides an additional interface to the channel
-          measurement facility, which is normally accessed though sysfs, with
-          a set of ioctl functions specific to the dasd driver.
-	  This is only needed if you want to use applications written for
-	  linux-2.4 dasd channel measurement facility interface.
-
 endif
Index: linux-2.6.16-rc2-mm1/drivers/s390/block/Makefile
===================================================================
--- linux-2.6.16-rc2-mm1.orig/drivers/s390/block/Makefile	2006-02-11 16:25:29.000000000 +0100
+++ linux-2.6.16-rc2-mm1/drivers/s390/block/Makefile	2006-02-11 16:49:58.000000000 +0100
@@ -13,7 +13,6 @@
 obj-$(CONFIG_DASD_DIAG) += dasd_diag_mod.o
 obj-$(CONFIG_DASD_ECKD) += dasd_eckd_mod.o
 obj-$(CONFIG_DASD_FBA)  += dasd_fba_mod.o
-obj-$(CONFIG_DASD_CMB)  += dasd_cmb.o
 obj-$(CONFIG_DASD_EER)  += dasd_eer.o
 obj-$(CONFIG_BLK_DEV_XPRAM) += xpram.o
 obj-$(CONFIG_DCSSBLK) += dcssblk.o
Index: linux-2.6.16-rc2-mm1/drivers/s390/block/dasd_cmb.c
===================================================================
--- linux-2.6.16-rc2-mm1.orig/drivers/s390/block/dasd_cmb.c	2006-02-11 16:25:29.000000000 +0100
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,128 +0,0 @@
-/*
- * Linux on zSeries Channel Measurement Facility support
- *  (dasd device driver interface)
- *
- * Copyright 2000,2003 IBM Corporation
- *
- * Author: Arnd Bergmann <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <linux/init.h>
-#include <linux/module.h>
-#include <asm/ccwdev.h>
-#include <asm/cmb.h>
-
-#include "dasd_int.h"
-
-static int
-dasd_ioctl_cmf_enable(struct block_device *bdev, int no, long args)
-{
-	struct dasd_device *device;
-
-	device = bdev->bd_disk->private_data;
-	if (!device)
-		return -EINVAL;
-
-	return enable_cmf(device->cdev);
-}
-
-static int
-dasd_ioctl_cmf_disable(struct block_device *bdev, int no, long args)
-{
-	struct dasd_device *device;
-
-	device = bdev->bd_disk->private_data;
-	if (!device)
-		return -EINVAL;
-
-	return disable_cmf(device->cdev);
-}
-
-static int
-dasd_ioctl_readall_cmb(struct block_device *bdev, int no, long args)
-{
-	struct dasd_device *device;
-	struct cmbdata __user *udata;
-	struct cmbdata data;
-	size_t size;
-	int ret;
-
-	device = bdev->bd_disk->private_data;
-	if (!device)
-		return -EINVAL;
-	udata = (void __user *) args;
-	size = _IOC_SIZE(no);
-
-	if (!access_ok(VERIFY_WRITE, udata, size))
-		return -EFAULT;
-	ret = cmf_readall(device->cdev, &data);
-	if (ret)
-		return ret;
-	if (copy_to_user(udata, &data, min(size, sizeof(*udata))))
-		return -EFAULT;
-	return 0;
-}
-
-/* module initialization below here. dasd already provides a mechanism
- * to dynamically register ioctl functions, so we simply use this. */
-static inline int
-ioctl_reg(unsigned int no, dasd_ioctl_fn_t handler)
-{
-	return dasd_ioctl_no_register(THIS_MODULE, no, handler);
-}
-
-static inline void
-ioctl_unreg(unsigned int no, dasd_ioctl_fn_t handler)
-{
-	dasd_ioctl_no_unregister(THIS_MODULE, no, handler);
-}
-
-static void
-dasd_cmf_exit(void)
-{
-	ioctl_unreg(BIODASDCMFENABLE,  dasd_ioctl_cmf_enable);
-	ioctl_unreg(BIODASDCMFDISABLE, dasd_ioctl_cmf_disable);
-	ioctl_unreg(BIODASDREADALLCMB, dasd_ioctl_readall_cmb);
-}
-
-static int __init
-dasd_cmf_init(void)
-{
-	int ret;
-	ret = ioctl_reg (BIODASDCMFENABLE, dasd_ioctl_cmf_enable);
-	if (ret)
-		goto err;
-	ret = ioctl_reg (BIODASDCMFDISABLE, dasd_ioctl_cmf_disable);
-	if (ret)
-		goto err;
-	ret = ioctl_reg (BIODASDREADALLCMB, dasd_ioctl_readall_cmb);
-	if (ret)
-		goto err;
-
-	return 0;
-err:
-	dasd_cmf_exit();
-
-	return ret;
-}
-
-module_init(dasd_cmf_init);
-module_exit(dasd_cmf_exit);
-
-MODULE_AUTHOR("Arnd Bergmann <[email protected]>");
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("channel measurement facility interface for dasd\n"
-		   "Copyright 2003 IBM Corporation\n");
Index: linux-2.6.16-rc2-mm1/drivers/s390/block/dasd_ioctl.c
===================================================================
--- linux-2.6.16-rc2-mm1.orig/drivers/s390/block/dasd_ioctl.c	2006-02-11 16:49:33.000000000 +0100
+++ linux-2.6.16-rc2-mm1/drivers/s390/block/dasd_ioctl.c	2006-02-11 16:50:25.000000000 +0100
@@ -16,6 +16,7 @@
 #include <linux/blkpg.h>
 
 #include <asm/ccwdev.h>
+#include <asm/cmb.h>
 #include <asm/uaccess.h>
 
 /* This is ugly... */
@@ -406,6 +407,21 @@
 	return dasd_set_feature(device->cdev, DASD_FEATURE_READONLY, intval);
 }
 
+static int
+dasd_ioctl_readall_cmb(struct dasd_device *device, unsigned int cmd,
+		unsigned long arg)
+{
+	struct cmbdata __user *argp = (void __user *) arg;
+	size_t size = _IOC_SIZE(cmd);
+	struct cmbdata data;
+	int ret;
+
+	ret = cmf_readall(device->cdev, &data);
+	if (!ret && copy_to_user(argp, &data, min(size, sizeof(*argp))))
+		return -EFAULT;
+	return ret;
+}
+
 int
 dasd_ioctl(struct inode *inode, struct file *file,
 	   unsigned int cmd, unsigned long arg)
@@ -447,6 +463,12 @@
 		return dasd_ioctl_set_ro(bdev, argp);
 	case DASDAPIVER:
 		return dasd_ioctl_api_version(argp);
+	case BIODASDCMFENABLE:
+		return enable_cmf(device->cdev);
+	case BIODASDCMFDISABLE:
+		return disable_cmf(device->cdev);
+	case BIODASDREADALLCMB:
+		return dasd_ioctl_readall_cmb(device, cmd, arg);
 	default:
 		/* if the discipline has an ioctl method try it. */
 		if (device->discipline->ioctl) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux