block: add a bdev_is_partition helper
Add a littler helper to make the somewhat arcane bd_contains checks a little more obvious. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:

committed by
Jens Axboe

parent
250eec9e39
commit
fa01b1e973
@@ -723,7 +723,7 @@ static int mmc_blk_check_blkdev(struct block_device *bdev)
|
||||
* whole block device, not on a partition. This prevents overspray
|
||||
* between sibling partitions.
|
||||
*/
|
||||
if ((!capable(CAP_SYS_RAWIO)) || (bdev != bdev->bd_contains))
|
||||
if (!capable(CAP_SYS_RAWIO) || bdev_is_partition(bdev))
|
||||
return -EPERM;
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user