2 * Linux on zSeries Channel Measurement Facility support
3 * (dasd device driver interface)
5 * Copyright 2000,2003 IBM Corporation
7 * Author: Arnd Bergmann <arndb@de.ibm.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include <linux/init.h>
24 #include <linux/module.h>
25 #include <asm/ccwdev.h>
31 dasd_ioctl_cmf_enable(struct block_device
*bdev
, int no
, long args
)
33 struct dasd_device
*device
;
35 device
= bdev
->bd_disk
->private_data
;
39 return enable_cmf(device
->cdev
);
43 dasd_ioctl_cmf_disable(struct block_device
*bdev
, int no
, long args
)
45 struct dasd_device
*device
;
47 device
= bdev
->bd_disk
->private_data
;
51 return disable_cmf(device
->cdev
);
55 dasd_ioctl_readall_cmb(struct block_device
*bdev
, int no
, long args
)
57 struct dasd_device
*device
;
58 struct cmbdata __user
*udata
;
63 device
= bdev
->bd_disk
->private_data
;
66 udata
= (void __user
*) args
;
69 if (!access_ok(VERIFY_WRITE
, udata
, size
))
71 ret
= cmf_readall(device
->cdev
, &data
);
74 if (copy_to_user(udata
, &data
, min(size
, sizeof(*udata
))))
79 /* module initialization below here. dasd already provides a mechanism
80 * to dynamically register ioctl functions, so we simply use this. */
82 ioctl_reg(unsigned int no
, dasd_ioctl_fn_t handler
)
84 return dasd_ioctl_no_register(THIS_MODULE
, no
, handler
);
88 ioctl_unreg(unsigned int no
, dasd_ioctl_fn_t handler
)
90 dasd_ioctl_no_unregister(THIS_MODULE
, no
, handler
);
96 ioctl_unreg(BIODASDCMFENABLE
, dasd_ioctl_cmf_enable
);
97 ioctl_unreg(BIODASDCMFDISABLE
, dasd_ioctl_cmf_disable
);
98 ioctl_unreg(BIODASDREADALLCMB
, dasd_ioctl_readall_cmb
);
105 ret
= ioctl_reg (BIODASDCMFENABLE
, dasd_ioctl_cmf_enable
);
108 ret
= ioctl_reg (BIODASDCMFDISABLE
, dasd_ioctl_cmf_disable
);
111 ret
= ioctl_reg (BIODASDREADALLCMB
, dasd_ioctl_readall_cmb
);
122 module_init(dasd_cmf_init
);
123 module_exit(dasd_cmf_exit
);
125 MODULE_AUTHOR("Arnd Bergmann <arndb@de.ibm.com>");
126 MODULE_LICENSE("GPL");
127 MODULE_DESCRIPTION("channel measurement facility interface for dasd\n"
128 "Copyright 2003 IBM Corporation\n");