Generic Block Device Capability¶
This file documents the sysfs file block/<disk>/capability
.
capability
is a bitfield, printed in hexadecimal, indicating which
capabilities a specific block device supports:
genhd capability flags
GENHD_FL_REMOVABLE
: indicates that the block device gives access to
removable media. When set, the device remains present even when media is not
inserted. Shall not be set for devices which are removed entirely when the
media is removed.
GENHD_FL_HIDDEN
: the block device is hidden; it doesn’t produce events,
doesn’t appear in sysfs, and can’t be opened from userspace or using
blkdev_get*. Used for the underlying components of multipath devices.
GENHD_FL_NO_PART
: partition support is disabled. The kernel will not
scan for partitions from add_disk, and users can’t add partitions manually.
-
unsigned int disk_openers(struct gendisk *disk)¶
returns how many openers are there for a disk
Parameters
struct gendisk *disk
disk to check
Description
This returns the number of openers for a disk. Note that this value is only stable if disk->open_mutex is held.
Note
Due to a quirk in the block layer open code, each open partition is only counted once even if there are multiple openers.
-
blk_alloc_disk¶
blk_alloc_disk (node_id)
allocate a gendisk structure
Parameters
node_id
numa node to allocate on
Description
Allocate and pre-initialize a gendisk structure for use with BIO based drivers.
Context
can sleep
-
void bio_end_io_acct(struct bio *bio, unsigned long start_time)¶
end I/O accounting for bio based drivers
Parameters
struct bio *bio
bio to end account for
unsigned long start_time
start time returned by
bio_start_io_acct()