2 * linux/drivers/s390/block/dasd_cmb.c ($Revision: 1.6 $)
4 * Linux on zSeries Channel Measurement Facility support
5 * (dasd device driver interface)
7 * Copyright 2000,2003 IBM Corporation
9 * Author: Arnd Bergmann <arndb@de.ibm.com>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2, or (at your option)
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include <linux/init.h>
26 #include <linux/ioctl32.h>
27 #include <linux/module.h>
28 #include <asm/ccwdev.h>
34 dasd_ioctl_cmf_enable(struct block_device
*bdev
, int no
, long args
)
36 struct dasd_device
*device
;
38 device
= bdev
->bd_disk
->private_data
;
42 return enable_cmf(device
->cdev
);
46 dasd_ioctl_cmf_disable(struct block_device
*bdev
, int no
, long args
)
48 struct dasd_device
*device
;
50 device
= bdev
->bd_disk
->private_data
;
54 return disable_cmf(device
->cdev
);
58 dasd_ioctl_readall_cmb(struct block_device
*bdev
, int no
, long args
)
60 struct dasd_device
*device
;
61 struct cmbdata __user
*udata
;
66 device
= bdev
->bd_disk
->private_data
;
69 udata
= (void __user
*) args
;
72 if (!access_ok(VERIFY_WRITE
, udata
, size
))
74 ret
= cmf_readall(device
->cdev
, &data
);
77 if (copy_to_user(udata
, &data
, min(size
, sizeof(*udata
))))
82 /* module initialization below here. dasd already provides a mechanism
83 * to dynamically register ioctl functions, so we simply use this. */
85 ioctl_reg(unsigned int no
, dasd_ioctl_fn_t handler
)
88 ret
= dasd_ioctl_no_register(THIS_MODULE
, no
, handler
);
93 ret
= register_ioctl32_conversion(no
, NULL
);
95 dasd_ioctl_no_unregister(THIS_MODULE
, no
, handler
);
101 ioctl_unreg(unsigned int no
, dasd_ioctl_fn_t handler
)
103 dasd_ioctl_no_unregister(THIS_MODULE
, no
, handler
);
105 unregister_ioctl32_conversion(no
);
113 ioctl_unreg(BIODASDCMFENABLE
, dasd_ioctl_cmf_enable
);
114 ioctl_unreg(BIODASDCMFDISABLE
, dasd_ioctl_cmf_disable
);
115 ioctl_unreg(BIODASDREADALLCMB
, dasd_ioctl_readall_cmb
);
122 ret
= ioctl_reg (BIODASDCMFENABLE
, dasd_ioctl_cmf_enable
);
125 ret
= ioctl_reg (BIODASDCMFDISABLE
, dasd_ioctl_cmf_disable
);
128 ret
= ioctl_reg (BIODASDREADALLCMB
, dasd_ioctl_readall_cmb
);
139 module_init(dasd_cmf_init
);
140 module_exit(dasd_cmf_exit
);
142 MODULE_AUTHOR("Arnd Bergmann <arndb@de.ibm.com>");
143 MODULE_LICENSE("GPL");
144 MODULE_DESCRIPTION("channel measurement facility interface for dasd\n"
145 "Copyright 2003 IBM Corporation\n");