]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/s390/block/dasd_ioctl.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[mirror_ubuntu-bionic-kernel.git] / drivers / s390 / block / dasd_ioctl.c
CommitLineData
1da177e4 1/*
1da177e4
LT
2 * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
3 * Horst Hummel <Horst.Hummel@de.ibm.com>
4 * Carsten Otte <Cotte@de.ibm.com>
5 * Martin Schwidefsky <schwidefsky@de.ibm.com>
6 * Bugreports.to..: <Linux390@de.ibm.com>
a53c8fab 7 * Copyright IBM Corp. 1999, 2001
1da177e4
LT
8 *
9 * i/o controls for the dasd driver.
10 */
fc19f381
SH
11
12#define KMSG_COMPONENT "dasd"
13
1da177e4 14#include <linux/interrupt.h>
048cd4e5 15#include <linux/compat.h>
1da177e4
LT
16#include <linux/major.h>
17#include <linux/fs.h>
18#include <linux/blkpg.h>
5a0e3ad6 19#include <linux/slab.h>
88034865 20#include <asm/compat.h>
1da177e4 21#include <asm/ccwdev.h>
287a0933 22#include <asm/schid.h>
8b2eb664 23#include <asm/cmb.h>
7c0f6ba6 24#include <linux/uaccess.h>
1da177e4
LT
25
26/* This is ugly... */
27#define PRINTK_HEADER "dasd_ioctl:"
28
29#include "dasd_int.h"
30
1da177e4 31
1da177e4 32static int
13c6204f 33dasd_ioctl_api_version(void __user *argp)
1da177e4
LT
34{
35 int ver = DASD_API_VERSION;
b5029622 36 return put_user(ver, (int __user *)argp);
1da177e4
LT
37}
38
39/*
40 * Enable device.
41 * used by dasdfmt after BIODASDDISABLE to retrigger blocksize detection
42 */
43static int
13c6204f 44dasd_ioctl_enable(struct block_device *bdev)
1da177e4 45{
65f8da47 46 struct dasd_device *base;
1da177e4
LT
47
48 if (!capable(CAP_SYS_ADMIN))
49 return -EACCES;
13c6204f 50
65f8da47
SW
51 base = dasd_device_from_gendisk(bdev->bd_disk);
52 if (!base)
53 return -ENODEV;
54
55 dasd_enable_device(base);
1da177e4 56 /* Formatting the dasd device can change the capacity. */
c039e313 57 mutex_lock(&bdev->bd_mutex);
65f8da47
SW
58 i_size_write(bdev->bd_inode,
59 (loff_t)get_capacity(base->block->gdp) << 9);
c039e313 60 mutex_unlock(&bdev->bd_mutex);
65f8da47 61 dasd_put_device(base);
1da177e4
LT
62 return 0;
63}
64
65/*
66 * Disable device.
67 * Used by dasdfmt. Disable I/O operations but allow ioctls.
68 */
69static int
13c6204f 70dasd_ioctl_disable(struct block_device *bdev)
1da177e4 71{
65f8da47 72 struct dasd_device *base;
1da177e4
LT
73
74 if (!capable(CAP_SYS_ADMIN))
75 return -EACCES;
13c6204f 76
65f8da47
SW
77 base = dasd_device_from_gendisk(bdev->bd_disk);
78 if (!base)
79 return -ENODEV;
1da177e4
LT
80 /*
81 * Man this is sick. We don't do a real disable but only downgrade
82 * the device to DASD_STATE_BASIC. The reason is that dasdfmt uses
83 * BIODASDDISABLE to disable accesses to the device via the block
84 * device layer but it still wants to do i/o on the device by
85 * using the BIODASDFMT ioctl. Therefore the correct state for the
86 * device is DASD_STATE_BASIC that allows to do basic i/o.
87 */
65f8da47 88 dasd_set_target_state(base, DASD_STATE_BASIC);
1da177e4
LT
89 /*
90 * Set i_size to zero, since read, write, etc. check against this
91 * value.
92 */
c039e313 93 mutex_lock(&bdev->bd_mutex);
1da177e4 94 i_size_write(bdev->bd_inode, 0);
c039e313 95 mutex_unlock(&bdev->bd_mutex);
65f8da47 96 dasd_put_device(base);
1da177e4
LT
97 return 0;
98}
99
100/*
101 * Quiesce device.
102 */
8e09f215 103static int dasd_ioctl_quiesce(struct dasd_block *block)
1da177e4 104{
1da177e4 105 unsigned long flags;
8e09f215 106 struct dasd_device *base;
138c014d 107
8e09f215 108 base = block->base;
1da177e4
LT
109 if (!capable (CAP_SYS_ADMIN))
110 return -EACCES;
138c014d 111
ca99dab0
SH
112 pr_info("%s: The DASD has been put in the quiesce "
113 "state\n", dev_name(&base->cdev->dev));
8e09f215 114 spin_lock_irqsave(get_ccwdev_lock(base->cdev), flags);
eb6e199b 115 dasd_device_set_stop_bits(base, DASD_STOPPED_QUIESCE);
8e09f215 116 spin_unlock_irqrestore(get_ccwdev_lock(base->cdev), flags);
1da177e4
LT
117 return 0;
118}
119
120
121/*
fc19f381 122 * Resume device.
1da177e4 123 */
8e09f215 124static int dasd_ioctl_resume(struct dasd_block *block)
1da177e4 125{
1da177e4 126 unsigned long flags;
8e09f215 127 struct dasd_device *base;
138c014d 128
8e09f215 129 base = block->base;
138c014d 130 if (!capable (CAP_SYS_ADMIN))
1da177e4
LT
131 return -EACCES;
132
ca99dab0
SH
133 pr_info("%s: I/O operations have been resumed "
134 "on the DASD\n", dev_name(&base->cdev->dev));
8e09f215 135 spin_lock_irqsave(get_ccwdev_lock(base->cdev), flags);
eb6e199b 136 dasd_device_remove_stop_bits(base, DASD_STOPPED_QUIESCE);
8e09f215 137 spin_unlock_irqrestore(get_ccwdev_lock(base->cdev), flags);
1da177e4 138
8e09f215 139 dasd_schedule_block_bh(block);
1da177e4
LT
140 return 0;
141}
142
5ea34a01
HR
143/*
144 * Abort all failfast I/O on a device.
145 */
146static int dasd_ioctl_abortio(struct dasd_block *block)
147{
148 unsigned long flags;
149 struct dasd_device *base;
150 struct dasd_ccw_req *cqr, *n;
151
152 base = block->base;
153 if (!capable(CAP_SYS_ADMIN))
154 return -EACCES;
155
156 if (test_and_set_bit(DASD_FLAG_ABORTALL, &base->flags))
157 return 0;
158 DBF_DEV_EVENT(DBF_NOTICE, base, "%s", "abortall flag set");
159
160 spin_lock_irqsave(&block->request_queue_lock, flags);
161 spin_lock(&block->queue_lock);
162 list_for_each_entry_safe(cqr, n, &block->ccw_queue, blocklist) {
163 if (test_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags) &&
164 cqr->callback_data &&
165 cqr->callback_data != DASD_SLEEPON_START_TAG &&
166 cqr->callback_data != DASD_SLEEPON_END_TAG) {
167 spin_unlock(&block->queue_lock);
168 blk_abort_request(cqr->callback_data);
169 spin_lock(&block->queue_lock);
170 }
171 }
172 spin_unlock(&block->queue_lock);
173 spin_unlock_irqrestore(&block->request_queue_lock, flags);
174
175 dasd_schedule_block_bh(block);
176 return 0;
177}
178
179/*
180 * Allow I/O on a device
181 */
182static int dasd_ioctl_allowio(struct dasd_block *block)
183{
184 struct dasd_device *base;
185
186 base = block->base;
187 if (!capable(CAP_SYS_ADMIN))
188 return -EACCES;
189
190 if (test_and_clear_bit(DASD_FLAG_ABORTALL, &base->flags))
191 DBF_DEV_EVENT(DBF_NOTICE, base, "%s", "abortall flag unset");
192
193 return 0;
194}
195
1da177e4
LT
196/*
197 * performs formatting of _device_ according to _fdata_
198 * Note: The discipline's format_function is assumed to deliver formatting
d42e1712
SH
199 * commands to format multiple units of the device. In terms of the ECKD
200 * devices this means CCWs are generated to format multiple tracks.
1da177e4 201 */
d42e1712
SH
202static int
203dasd_format(struct dasd_block *block, struct format_data_t *fdata)
1da177e4 204{
8e09f215 205 struct dasd_device *base;
8542885b 206 int rc;
1da177e4 207
8e09f215
SW
208 base = block->base;
209 if (base->discipline->format_device == NULL)
1da177e4
LT
210 return -EPERM;
211
8e09f215 212 if (base->state != DASD_STATE_BASIC) {
d42e1712
SH
213 pr_warn("%s: The DASD cannot be formatted while it is enabled\n",
214 dev_name(&base->cdev->dev));
1da177e4
LT
215 return -EBUSY;
216 }
217
8e09f215 218 DBF_DEV_EVENT(DBF_NOTICE, base,
b44b0ab3 219 "formatting units %u to %u (%u B blocks) flags %u",
1da177e4
LT
220 fdata->start_unit,
221 fdata->stop_unit, fdata->blksize, fdata->intensity);
222
223 /* Since dasdfmt keeps the device open after it was disabled,
224 * there still exists an inode for this device.
225 * We must update i_blkbits, otherwise we might get errors when
226 * enabling the device later.
227 */
228 if (fdata->start_unit == 0) {
8e09f215 229 struct block_device *bdev = bdget_disk(block->gdp, 0);
1da177e4
LT
230 bdev->bd_inode->i_blkbits = blksize_bits(fdata->blksize);
231 bdput(bdev);
232 }
233
8542885b
JH
234 rc = base->discipline->format_device(base, fdata, 1);
235 if (rc == -EAGAIN)
236 rc = base->discipline->format_device(base, fdata, 0);
237
238 return rc;
1da177e4
LT
239}
240
8fd57520
JH
241static int dasd_check_format(struct dasd_block *block,
242 struct format_check_t *cdata)
243{
244 struct dasd_device *base;
245 int rc;
246
247 base = block->base;
248 if (!base->discipline->check_device_format)
249 return -ENOTTY;
250
251 rc = base->discipline->check_device_format(base, cdata, 1);
252 if (rc == -EAGAIN)
253 rc = base->discipline->check_device_format(base, cdata, 0);
254
255 return rc;
256}
257
1da177e4
LT
258/*
259 * Format device.
260 */
261static int
13c6204f 262dasd_ioctl_format(struct block_device *bdev, void __user *argp)
1da177e4 263{
65f8da47 264 struct dasd_device *base;
1da177e4 265 struct format_data_t fdata;
65f8da47 266 int rc;
1da177e4
LT
267
268 if (!capable(CAP_SYS_ADMIN))
269 return -EACCES;
13c6204f 270 if (!argp)
1da177e4 271 return -EINVAL;
65f8da47
SW
272 base = dasd_device_from_gendisk(bdev->bd_disk);
273 if (!base)
274 return -ENODEV;
275 if (base->features & DASD_FEATURE_READONLY ||
276 test_bit(DASD_FLAG_DEVICE_RO, &base->flags)) {
277 dasd_put_device(base);
1da177e4 278 return -EROFS;
65f8da47
SW
279 }
280 if (copy_from_user(&fdata, argp, sizeof(struct format_data_t))) {
281 dasd_put_device(base);
1da177e4 282 return -EFAULT;
65f8da47 283 }
1da177e4 284 if (bdev != bdev->bd_contains) {
baebc70a
JP
285 pr_warn("%s: The specified DASD is a partition and cannot be formatted\n",
286 dev_name(&base->cdev->dev));
65f8da47 287 dasd_put_device(base);
1da177e4
LT
288 return -EINVAL;
289 }
65f8da47
SW
290 rc = dasd_format(base->block, &fdata);
291 dasd_put_device(base);
8fd57520
JH
292
293 return rc;
294}
295
296/*
297 * Check device format
298 */
299static int dasd_ioctl_check_format(struct block_device *bdev, void __user *argp)
300{
301 struct format_check_t cdata;
302 struct dasd_device *base;
303 int rc = 0;
304
305 if (!argp)
306 return -EINVAL;
307
308 base = dasd_device_from_gendisk(bdev->bd_disk);
309 if (!base)
310 return -ENODEV;
311 if (bdev != bdev->bd_contains) {
312 pr_warn("%s: The specified DASD is a partition and cannot be checked\n",
313 dev_name(&base->cdev->dev));
314 rc = -EINVAL;
315 goto out_err;
316 }
317
318 if (copy_from_user(&cdata, argp, sizeof(cdata))) {
319 rc = -EFAULT;
320 goto out_err;
321 }
322
323 rc = dasd_check_format(base->block, &cdata);
324 if (rc)
325 goto out_err;
326
327 if (copy_to_user(argp, &cdata, sizeof(cdata)))
328 rc = -EFAULT;
329
330out_err:
331 dasd_put_device(base);
332
65f8da47 333 return rc;
1da177e4
LT
334}
335
336#ifdef CONFIG_DASD_PROFILE
337/*
338 * Reset device profile information
339 */
8e09f215 340static int dasd_ioctl_reset_profile(struct dasd_block *block)
1da177e4 341{
4fa52aa7 342 dasd_profile_reset(&block->profile);
1da177e4
LT
343 return 0;
344}
345
346/*
347 * Return device profile information
348 */
8e09f215 349static int dasd_ioctl_read_profile(struct dasd_block *block, void __user *argp)
1da177e4 350{
4fa52aa7 351 struct dasd_profile_info_t *data;
ba465d83 352 int rc = 0;
4fa52aa7
SW
353
354 data = kmalloc(sizeof(*data), GFP_KERNEL);
355 if (!data)
356 return -ENOMEM;
357
358 spin_lock_bh(&block->profile.lock);
359 if (block->profile.data) {
360 data->dasd_io_reqs = block->profile.data->dasd_io_reqs;
361 data->dasd_io_sects = block->profile.data->dasd_io_sects;
362 memcpy(data->dasd_io_secs, block->profile.data->dasd_io_secs,
363 sizeof(data->dasd_io_secs));
364 memcpy(data->dasd_io_times, block->profile.data->dasd_io_times,
365 sizeof(data->dasd_io_times));
366 memcpy(data->dasd_io_timps, block->profile.data->dasd_io_timps,
367 sizeof(data->dasd_io_timps));
368 memcpy(data->dasd_io_time1, block->profile.data->dasd_io_time1,
369 sizeof(data->dasd_io_time1));
370 memcpy(data->dasd_io_time2, block->profile.data->dasd_io_time2,
371 sizeof(data->dasd_io_time2));
372 memcpy(data->dasd_io_time2ps,
373 block->profile.data->dasd_io_time2ps,
374 sizeof(data->dasd_io_time2ps));
375 memcpy(data->dasd_io_time3, block->profile.data->dasd_io_time3,
376 sizeof(data->dasd_io_time3));
377 memcpy(data->dasd_io_nr_req,
378 block->profile.data->dasd_io_nr_req,
379 sizeof(data->dasd_io_nr_req));
380 spin_unlock_bh(&block->profile.lock);
381 } else {
382 spin_unlock_bh(&block->profile.lock);
ba465d83
JL
383 rc = -EIO;
384 goto out;
4fa52aa7
SW
385 }
386 if (copy_to_user(argp, data, sizeof(*data)))
ba465d83
JL
387 rc = -EFAULT;
388out:
389 kfree(data);
390 return rc;
1da177e4
LT
391}
392#else
8e09f215 393static int dasd_ioctl_reset_profile(struct dasd_block *block)
1da177e4 394{
2267a0c8 395 return -ENOTTY;
1da177e4
LT
396}
397
8e09f215 398static int dasd_ioctl_read_profile(struct dasd_block *block, void __user *argp)
1da177e4 399{
2267a0c8 400 return -ENOTTY;
1da177e4
LT
401}
402#endif
403
404/*
405 * Return dasd information. Used for BIODASDINFO and BIODASDINFO2.
406 */
8e09f215
SW
407static int dasd_ioctl_information(struct dasd_block *block,
408 unsigned int cmd, void __user *argp)
1da177e4 409{
1da177e4 410 struct dasd_information2_t *dasd_info;
287a0933
SO
411 struct subchannel_id sch_id;
412 struct ccw_dev_id dev_id;
8e09f215 413 struct dasd_device *base;
1da177e4 414 struct ccw_device *cdev;
287a0933
SO
415 unsigned long flags;
416 int rc;
1da177e4 417
8e09f215 418 base = block->base;
294001a8 419 if (!base->discipline || !base->discipline->fill_info)
1da177e4
LT
420 return -EINVAL;
421
554a826e 422 dasd_info = kzalloc(sizeof(struct dasd_information2_t), GFP_KERNEL);
1da177e4
LT
423 if (dasd_info == NULL)
424 return -ENOMEM;
425
8e09f215 426 rc = base->discipline->fill_info(base, dasd_info);
1da177e4
LT
427 if (rc) {
428 kfree(dasd_info);
429 return rc;
430 }
431
8e09f215 432 cdev = base->cdev;
9a92fe48 433 ccw_device_get_id(cdev, &dev_id);
287a0933 434 ccw_device_get_schid(cdev, &sch_id);
1da177e4 435
9a92fe48 436 dasd_info->devno = dev_id.devno;
287a0933 437 dasd_info->schid = sch_id.sch_no;
1da177e4
LT
438 dasd_info->cu_type = cdev->id.cu_type;
439 dasd_info->cu_model = cdev->id.cu_model;
440 dasd_info->dev_type = cdev->id.dev_type;
441 dasd_info->dev_model = cdev->id.dev_model;
8e09f215 442 dasd_info->status = base->state;
57467195
HH
443 /*
444 * The open_count is increased for every opener, that includes
445 * the blkdev_get in dasd_scan_partitions.
446 * This must be hidden from user-space.
447 */
8e09f215
SW
448 dasd_info->open_count = atomic_read(&block->open_count);
449 if (!block->bdev)
57467195 450 dasd_info->open_count++;
138c014d 451
1da177e4
LT
452 /*
453 * check if device is really formatted
454 * LDL / CDL was returned by 'fill_info'
455 */
8e09f215
SW
456 if ((base->state < DASD_STATE_READY) ||
457 (dasd_check_blocksize(block->bp_block)))
1da177e4 458 dasd_info->format = DASD_FORMAT_NONE;
f24acd45 459
c6eb7b77 460 dasd_info->features |=
8e09f215 461 ((base->features & DASD_FEATURE_READONLY) != 0);
1da177e4 462
294001a8 463 memcpy(dasd_info->type, base->discipline->name, 4);
554a826e 464
8e09f215 465 if (block->request_queue->request_fn) {
1da177e4
LT
466 struct list_head *l;
467#ifdef DASD_EXTENDED_PROFILING
468 {
469 struct list_head *l;
8e09f215
SW
470 spin_lock_irqsave(&block->lock, flags);
471 list_for_each(l, &block->request_queue->queue_head)
1da177e4 472 dasd_info->req_queue_len++;
8e09f215 473 spin_unlock_irqrestore(&block->lock, flags);
1da177e4
LT
474 }
475#endif /* DASD_EXTENDED_PROFILING */
8e09f215
SW
476 spin_lock_irqsave(get_ccwdev_lock(base->cdev), flags);
477 list_for_each(l, &base->ccw_queue)
1da177e4 478 dasd_info->chanq_len++;
8e09f215 479 spin_unlock_irqrestore(get_ccwdev_lock(base->cdev),
1da177e4
LT
480 flags);
481 }
482
483 rc = 0;
13c6204f
CH
484 if (copy_to_user(argp, dasd_info,
485 ((cmd == (unsigned int) BIODASDINFO2) ?
8e09f215
SW
486 sizeof(struct dasd_information2_t) :
487 sizeof(struct dasd_information_t))))
1da177e4
LT
488 rc = -EFAULT;
489 kfree(dasd_info);
490 return rc;
491}
492
493/*
494 * Set read only
495 */
496static int
13c6204f 497dasd_ioctl_set_ro(struct block_device *bdev, void __user *argp)
1da177e4 498{
65f8da47
SW
499 struct dasd_device *base;
500 int intval, rc;
1da177e4
LT
501
502 if (!capable(CAP_SYS_ADMIN))
503 return -EACCES;
504 if (bdev != bdev->bd_contains)
505 // ro setting is not allowed for partitions
506 return -EINVAL;
d2c993d8 507 if (get_user(intval, (int __user *)argp))
1da177e4 508 return -EFAULT;
65f8da47
SW
509 base = dasd_device_from_gendisk(bdev->bd_disk);
510 if (!base)
511 return -ENODEV;
512 if (!intval && test_bit(DASD_FLAG_DEVICE_RO, &base->flags)) {
513 dasd_put_device(base);
33b62a30 514 return -EROFS;
65f8da47 515 }
1da177e4 516 set_disk_ro(bdev->bd_disk, intval);
65f8da47
SW
517 rc = dasd_set_feature(base->cdev, DASD_FEATURE_READONLY, intval);
518 dasd_put_device(base);
519 return rc;
1da177e4
LT
520}
521
8e09f215 522static int dasd_ioctl_readall_cmb(struct dasd_block *block, unsigned int cmd,
88034865 523 struct cmbdata __user *argp)
8b2eb664 524{
8b2eb664
CH
525 size_t size = _IOC_SIZE(cmd);
526 struct cmbdata data;
527 int ret;
528
8e09f215 529 ret = cmf_readall(block->base->cdev, &data);
8b2eb664
CH
530 if (!ret && copy_to_user(argp, &data, min(size, sizeof(*argp))))
531 return -EFAULT;
532 return ret;
533}
534
cfdb00a7
AB
535int dasd_ioctl(struct block_device *bdev, fmode_t mode,
536 unsigned int cmd, unsigned long arg)
1da177e4 537{
65f8da47
SW
538 struct dasd_block *block;
539 struct dasd_device *base;
88034865 540 void __user *argp;
65f8da47 541 int rc;
88034865
HC
542
543 if (is_compat_task())
544 argp = compat_ptr(arg);
545 else
546 argp = (void __user *)arg;
1da177e4 547
13c6204f
CH
548 if ((_IOC_DIR(cmd) != _IOC_NONE) && !arg) {
549 PRINT_DEBUG("empty data ptr");
550 return -EINVAL;
551 }
1da177e4 552
65f8da47
SW
553 base = dasd_device_from_gendisk(bdev->bd_disk);
554 if (!base)
555 return -ENODEV;
556 block = base->block;
557 rc = 0;
13c6204f
CH
558 switch (cmd) {
559 case BIODASDDISABLE:
65f8da47
SW
560 rc = dasd_ioctl_disable(bdev);
561 break;
13c6204f 562 case BIODASDENABLE:
65f8da47
SW
563 rc = dasd_ioctl_enable(bdev);
564 break;
13c6204f 565 case BIODASDQUIESCE:
65f8da47
SW
566 rc = dasd_ioctl_quiesce(block);
567 break;
13c6204f 568 case BIODASDRESUME:
65f8da47
SW
569 rc = dasd_ioctl_resume(block);
570 break;
5ea34a01
HR
571 case BIODASDABORTIO:
572 rc = dasd_ioctl_abortio(block);
573 break;
574 case BIODASDALLOWIO:
575 rc = dasd_ioctl_allowio(block);
576 break;
13c6204f 577 case BIODASDFMT:
65f8da47
SW
578 rc = dasd_ioctl_format(bdev, argp);
579 break;
8fd57520
JH
580 case BIODASDCHECKFMT:
581 rc = dasd_ioctl_check_format(bdev, argp);
582 break;
13c6204f 583 case BIODASDINFO:
65f8da47
SW
584 rc = dasd_ioctl_information(block, cmd, argp);
585 break;
13c6204f 586 case BIODASDINFO2:
65f8da47
SW
587 rc = dasd_ioctl_information(block, cmd, argp);
588 break;
13c6204f 589 case BIODASDPRRD:
65f8da47
SW
590 rc = dasd_ioctl_read_profile(block, argp);
591 break;
13c6204f 592 case BIODASDPRRST:
65f8da47
SW
593 rc = dasd_ioctl_reset_profile(block);
594 break;
13c6204f 595 case BLKROSET:
65f8da47
SW
596 rc = dasd_ioctl_set_ro(bdev, argp);
597 break;
13c6204f 598 case DASDAPIVER:
65f8da47
SW
599 rc = dasd_ioctl_api_version(argp);
600 break;
8b2eb664 601 case BIODASDCMFENABLE:
65f8da47
SW
602 rc = enable_cmf(base->cdev);
603 break;
8b2eb664 604 case BIODASDCMFDISABLE:
65f8da47
SW
605 rc = disable_cmf(base->cdev);
606 break;
8b2eb664 607 case BIODASDREADALLCMB:
65f8da47
SW
608 rc = dasd_ioctl_readall_cmb(block, cmd, argp);
609 break;
13c6204f 610 default:
1107ccfb 611 /* if the discipline has an ioctl method try it. */
6b79d14e
HC
612 rc = -ENOTTY;
613 if (base->discipline->ioctl)
65f8da47 614 rc = base->discipline->ioctl(block, cmd, argp);
13c6204f 615 }
65f8da47
SW
616 dasd_put_device(base);
617 return rc;
1da177e4 618}