Generic Block Device Capability — The Linux Kernel 5.18.5-gnu-1 documentation

# 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.

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()`