Commit ef00f59c95fe6e002e7c6e3663cdea65e253f4cc

Authored by Martin K. Petersen
Committed by Jens Axboe
1 parent b1bd055d39

block: Add BLKROTATIONAL ioctl

Introduce an ioctl which permits applications to query whether a block
device is rotational.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

Showing 3 changed files with 6 additions and 0 deletions Side-by-side Diff

block/compat_ioctl.c
... ... @@ -719,6 +719,9 @@
719 719 case BLKSECTGET:
720 720 return compat_put_ushort(arg,
721 721 queue_max_sectors(bdev_get_queue(bdev)));
  722 + case BLKROTATIONAL:
  723 + return compat_put_ushort(arg,
  724 + !blk_queue_nonrot(bdev_get_queue(bdev)));
722 725 case BLKRASET: /* compatible, but no compat_ptr (!) */
723 726 case BLKFRASET:
724 727 if (!capable(CAP_SYS_ADMIN))
... ... @@ -278,6 +278,8 @@
278 278 return put_uint(arg, bdev_discard_zeroes_data(bdev));
279 279 case BLKSECTGET:
280 280 return put_ushort(arg, queue_max_sectors(bdev_get_queue(bdev)));
  281 + case BLKROTATIONAL:
  282 + return put_ushort(arg, !blk_queue_nonrot(bdev_get_queue(bdev)));
281 283 case BLKRASET:
282 284 case BLKFRASET:
283 285 if(!capable(CAP_SYS_ADMIN))
... ... @@ -319,6 +319,7 @@
319 319 #define BLKPBSZGET _IO(0x12,123)
320 320 #define BLKDISCARDZEROES _IO(0x12,124)
321 321 #define BLKSECDISCARD _IO(0x12,125)
  322 +#define BLKROTATIONAL _IO(0x12,126)
322 323  
323 324 #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
324 325 #define FIBMAP _IO(0x00,1) /* bmap access */