12 #define KMSG_COMPONENT "dasd"
19 #include <linux/slab.h>
20 #include <asm/compat.h>
23 #include <asm/uaccess.h>
26 #define PRINTK_HEADER "dasd_ioctl:"
32 dasd_ioctl_api_version(
void __user *
argp)
58 (loff_t)get_capacity(base->
block->gdp) << 9);
60 dasd_put_device(base);
95 dasd_put_device(base);
111 pr_info(
"%s: The DASD has been put in the quiesce "
112 "state\n", dev_name(&base->
cdev->dev));
123 static int dasd_ioctl_resume(
struct dasd_block *block)
132 pr_info(
"%s: I/O operations have been resumed "
133 "on the DASD\n", dev_name(&base->
cdev->dev));
159 pr_warning(
"%s: The DASD cannot be formatted while it is "
160 "enabled\n", dev_name(&base->
cdev->dev));
165 "formatting units %u to %u (%u B blocks) flags %u",
181 cqr = base->
discipline->format_device(base, fdata);
188 pr_err(
"%s: Formatting unit %d failed with "
189 "rc=%d\n", dev_name(&base->
cdev->dev),
217 dasd_put_device(base);
221 dasd_put_device(base);
225 pr_warning(
"%s: The specified DASD is a partition and cannot "
227 dev_name(&base->
cdev->dev));
228 dasd_put_device(base);
231 rc = dasd_format(base->
block, &fdata);
232 dasd_put_device(base);
236 #ifdef CONFIG_DASD_PROFILE
240 static int dasd_ioctl_reset_profile(
struct dasd_block *block)
249 static int dasd_ioctl_read_profile(
struct dasd_block *block,
void __user *argp)
258 spin_lock_bh(&block->
profile.lock);
273 block->
profile.data->dasd_io_time2ps,
278 block->
profile.data->dasd_io_nr_req,
280 spin_unlock_bh(&block->
profile.lock);
282 spin_unlock_bh(&block->
profile.lock);
293 static int dasd_ioctl_reset_profile(
struct dasd_block *block)
298 static int dasd_ioctl_read_profile(
struct dasd_block *block,
void __user *argp)
307 static int dasd_ioctl_information(
struct dasd_block *block,
308 unsigned int cmd,
void __user *argp)
318 if (!base->discipline || !base->discipline->fill_info)
322 if (dasd_info ==
NULL)
325 rc = base->discipline->fill_info(base, dasd_info);
340 dasd_info->
status = base->state;
355 (dasd_check_blocksize(block->
bp_block)))
361 memcpy(dasd_info->
type, base->discipline->name, 4);
365 #ifdef DASD_EXTENDED_PROFILING
370 dasd_info->req_queue_len++;
371 spin_unlock_irqrestore(&block->lock, flags);
376 dasd_info->chanq_len++;
402 if (bdev != bdev->bd_contains)
405 if (
get_user(intval, (
int __user *)argp))
411 dasd_put_device(base);
416 dasd_put_device(base);
420 static int dasd_ioctl_readall_cmb(
struct dasd_block *block,
unsigned int cmd,
434 unsigned int cmd,
unsigned long arg)
442 argp = compat_ptr(arg);
444 argp = (
void __user *)arg;
458 rc = dasd_ioctl_disable(bdev);
461 rc = dasd_ioctl_enable(bdev);
464 rc = dasd_ioctl_quiesce(block);
467 rc = dasd_ioctl_resume(block);
470 rc = dasd_ioctl_format(bdev, argp);
473 rc = dasd_ioctl_information(block, cmd, argp);
476 rc = dasd_ioctl_information(block, cmd, argp);
479 rc = dasd_ioctl_read_profile(block, argp);
482 rc = dasd_ioctl_reset_profile(block);
485 rc = dasd_ioctl_set_ro(bdev, argp);
488 rc = dasd_ioctl_api_version(argp);
497 rc = dasd_ioctl_readall_cmb(block, cmd, argp);
503 rc = base->
discipline->ioctl(block, cmd, argp);
505 dasd_put_device(base);