summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorDamien Le Moal <dlemoal@kernel.org>2026-01-30 15:28:45 +0900
committerJens Axboe <axboe@kernel.dk>2026-01-30 08:11:09 -0700
commitda562d92e6755c00cd67845a8dbfb908dac51a9c (patch)
tree7c7b9a26df57fbeb534b78fd8aed4ecbbb04c4b8 /block
parentad5f2e2908c9b79a86529281a48e94d644d43dc7 (diff)
block: introduce bdev_rot()
Introduce the helper function bdev_rot() to test if a block device is a rotational one. The existing function bdev_nonrot() which tests for the opposite condition is redefined using this new helper. This avoids the double negation (operator and name) that appears when testing if a block device is a rotational device, thus making the code a little easier to read. Call sites of bdev_nonrot() in the block layer are updated to use this new helper. Remaining users in other subsystems are left unchanged for now. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/ioctl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/ioctl.c b/block/ioctl.c
index 344478348a54..fd48f82f9f03 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -692,7 +692,7 @@ static int blkdev_common_ioctl(struct block_device *bdev, blk_mode_t mode,
queue_max_sectors(bdev_get_queue(bdev)));
return put_ushort(argp, max_sectors);
case BLKROTATIONAL:
- return put_ushort(argp, !bdev_nonrot(bdev));
+ return put_ushort(argp, bdev_rot(bdev));
case BLKRASET:
case BLKFRASET:
if(!capable(CAP_SYS_ADMIN))