History

block: Document genhd capability flags

The kernel documentation includes a brief section about genhd capabilities, but it turns out that the only documented capability (GENHD_FL_MEDIA_CHANGE_NOTIFY) isn't used any more. This patch removes that flag, and documents the rest, based on my understanding of the current uses of these flags in the kernel. The documentation is kept in the header file, alongside the declarations, in the hope that it will be kept up-to-date in future; the kernel documentation is changed to include the documentation generated from the header file. Because the ultimate goal is to provide some end-user documentation (or end-administrator documentation), the comments are perhaps more user-oriented than might be expected. Since the values are shown to users in hexadecimal, the documentation lists them in hexadecimal, and the constant declarations are adjusted to match.

Stephen Kitt committed 6 years ago

Commit 9243c6f1 parent ce24f732 files · +62 −23Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/genhd.h+58−11
@@ -133,17 +133,64 @@ struct hd_struct { · 132 unmodified lines
133 struct rcu_work rcu_work;133 struct rcu_work rcu_work;
134};134};
135 135
136#define GENHD_FL_REMOVABLE 1136/**
137/* 2 is unused */137 * DOC: genhd capability flags
138#define GENHD_FL_MEDIA_CHANGE_NOTIFY 4138 *
139#define GENHD_FL_CD 8139 * ``GENHD_FL_REMOVABLE`` (0x0001): indicates that the block device
140#define GENHD_FL_UP 16140 * gives access to removable media.
141#define GENHD_FL_SUPPRESS_PARTITION_INFO 32141 * When set, the device remains present even when media is not
142#define GENHD_FL_EXT_DEVT 64 /* allow extended devt */142 * inserted.
143#define GENHD_FL_NATIVE_CAPACITY 128143 * Must not be set for devices which are removed entirely when the
144#define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE 256144 * media is removed.
145#define GENHD_FL_NO_PART_SCAN 512145 *
146#define GENHD_FL_HIDDEN 1024146 * ``GENHD_FL_CD`` (0x0008): the block device is a CD-ROM-style
147 * device.
148 * Affects responses to the ``CDROM_GET_CAPABILITY`` ioctl.
149 *
150 * ``GENHD_FL_UP`` (0x0010): indicates that the block device is "up",
151 * with a similar meaning to network interfaces.
152 *
153 * ``GENHD_FL_SUPPRESS_PARTITION_INFO`` (0x0020): don't include
154 * partition information in ``/proc/partitions`` or in the output of
155 * printk_all_partitions().
156 * Used for the null block device and some MMC devices.
157 *
158 * ``GENHD_FL_EXT_DEVT`` (0x0040): the driver supports extended
159 * dynamic ``dev_t``, i.e. it wants extended device numbers
160 * (``BLOCK_EXT_MAJOR``).
161 * This affects the maximum number of partitions.
162 *
163 * ``GENHD_FL_NATIVE_CAPACITY`` (0x0080): based on information in the
164 * partition table, the device's capacity has been extended to its
165 * native capacity; i.e. the device has hidden capacity used by one
166 * of the partitions (this is a flag used so that native capacity is
167 * only ever unlocked once).
168 *
169 * ``GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE`` (0x0100): event polling is
170 * blocked whenever a writer holds an exclusive lock.
171 *
172 * ``GENHD_FL_NO_PART_SCAN`` (0x0200): partition scanning is disabled.
173 * Used for loop devices in their default settings and some MMC
174 * devices.
175 *
176 * ``GENHD_FL_HIDDEN`` (0x0400): the block device is hidden; it
177 * doesn't produce events, doesn't appear in sysfs, and doesn't have
178 * an associated ``bdev``.
179 * Implies ``GENHD_FL_SUPPRESS_PARTITION_INFO`` and
180 * ``GENHD_FL_NO_PART_SCAN``.
181 * Used for multipath devices.
182 */
183#define GENHD_FL_REMOVABLE 0x0001
184/* 2 is unused (used to be GENHD_FL_DRIVERFS) */
185/* 4 is unused (used to be GENHD_FL_MEDIA_CHANGE_NOTIFY) */
186#define GENHD_FL_CD 0x0008
187#define GENHD_FL_UP 0x0010
188#define GENHD_FL_SUPPRESS_PARTITION_INFO 0x0020
189#define GENHD_FL_EXT_DEVT 0x0040
190#define GENHD_FL_NATIVE_CAPACITY 0x0080
191#define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE 0x0100
192#define GENHD_FL_NO_PART_SCAN 0x0200
193#define GENHD_FL_HIDDEN 0x0400
147 194
148enum {195enum {
149 DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */196 DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t