aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/genhd.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/genhd.h')
-rw-r--r--include/linux/genhd.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index e4e18c509ac5..9e866a2aee50 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -127,12 +127,13 @@ struct gendisk {
127 127
128 char disk_name[32]; /* name of major driver */ 128 char disk_name[32]; /* name of major driver */
129 129
130 /* Array of pointers to partitions indexed by partno - 1. 130 /* Array of pointers to partitions indexed by partno.
131 * Protected with matching bdev lock but stat and other 131 * Protected with matching bdev lock but stat and other
132 * non-critical accesses use RCU. Always access through 132 * non-critical accesses use RCU. Always access through
133 * helpers. 133 * helpers.
134 */ 134 */
135 struct hd_struct **__part; 135 struct hd_struct **__part;
136 struct hd_struct part0;
136 137
137 struct block_device_operations *fops; 138 struct block_device_operations *fops;
138 struct request_queue *queue; 139 struct request_queue *queue;
@@ -171,7 +172,12 @@ static inline struct gendisk *part_to_disk(struct hd_struct *part)
171 172
172static inline int disk_max_parts(struct gendisk *disk) 173static inline int disk_max_parts(struct gendisk *disk)
173{ 174{
174 return disk->minors + disk->ext_minors - 1; 175 return disk->minors + disk->ext_minors;
176}
177
178static inline bool disk_partitionable(struct gendisk *disk)
179{
180 return disk_max_parts(disk) > 1;
175} 181}
176 182
177static inline dev_t disk_devt(struct gendisk *disk) 183static inline dev_t disk_devt(struct gendisk *disk)
@@ -197,6 +203,7 @@ static inline void disk_put_part(struct hd_struct *part)
197 */ 203 */
198#define DISK_PITER_REVERSE (1 << 0) /* iterate in the reverse direction */ 204#define DISK_PITER_REVERSE (1 << 0) /* iterate in the reverse direction */
199#define DISK_PITER_INCL_EMPTY (1 << 1) /* include 0-sized parts */ 205#define DISK_PITER_INCL_EMPTY (1 << 1) /* include 0-sized parts */
206#define DISK_PITER_INCL_PART0 (1 << 2) /* include partition 0 */
200 207
201struct disk_part_iter { 208struct disk_part_iter {
202 struct gendisk *disk; 209 struct gendisk *disk;