blob: 058d895544c75ae63c5f6fb17ff1bd1ebd006e29 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002#ifndef _LINUX_GENHD_H
3#define _LINUX_GENHD_H
4
5/*
6 * genhd.h Copyright (C) 1992 Drew Eckhardt
7 * Generic hard disk header file by
8 * Drew Eckhardt
9 *
10 * <drew@colorado.edu>
11 */
12
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/types.h>
Kay Sieversedfaa7c2007-05-21 22:08:01 +020014#include <linux/kdev_t.h>
Tejun Heoe71bf0d2008-09-03 09:03:02 +020015#include <linux/rcupdate.h>
Will Drewry6d1d8052010-08-31 15:47:05 -050016#include <linux/slab.h>
Ming Lei6c710132015-07-16 11:16:45 +080017#include <linux/percpu-refcount.h>
Andy Shevchenko63579782016-05-20 17:01:24 -070018#include <linux/uuid.h>
Michael Callahandbae2c52018-07-18 04:47:38 -070019#include <linux/blk_types.h>
Mikulas Patocka1226b8d2018-12-06 11:41:20 -050020#include <asm/local.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
David Howells93614012006-09-30 20:45:40 +020022#ifdef CONFIG_BLOCK
23
Tejun Heo548b10e2008-08-29 09:01:47 +020024#define dev_to_disk(device) container_of((device), struct gendisk, part0.__dev)
Tejun Heoed9e1982008-08-25 19:56:05 +090025#define dev_to_part(device) container_of((device), struct hd_struct, __dev)
Tejun Heo548b10e2008-08-29 09:01:47 +020026#define disk_to_dev(disk) (&(disk)->part0.__dev)
Tejun Heoed9e1982008-08-25 19:56:05 +090027#define part_to_dev(part) (&((part)->__dev))
Kay Sieversedfaa7c2007-05-21 22:08:01 +020028
Kay Sieversedfaa7c2007-05-21 22:08:01 +020029extern struct device_type part_type;
Kay Sieversedfaa7c2007-05-21 22:08:01 +020030extern struct class block_class;
31
Tejun Heo689d6fa2008-08-25 19:56:16 +090032#define DISK_MAX_PARTS 256
Tejun Heo3e1a7ff2008-08-25 19:56:17 +090033#define DISK_NAME_LEN 32
Tejun Heo689d6fa2008-08-25 19:56:16 +090034
David Woodhouse34186ef2006-04-25 14:07:57 +010035#include <linux/major.h>
36#include <linux/device.h>
37#include <linux/smp.h>
38#include <linux/string.h>
39#include <linux/fs.h>
Kristen Carlson Accardi8ce7ad7b2007-05-23 13:57:38 -070040#include <linux/workqueue.h>
David Woodhouse34186ef2006-04-25 14:07:57 +010041
Jerome Marchandea5c48a2008-02-08 11:04:09 +010042struct disk_stats {
Omar Sandovalb57e99b2018-09-21 16:44:34 -070043 u64 nsecs[NR_STAT_GROUPS];
Michael Callahandbae2c52018-07-18 04:47:38 -070044 unsigned long sectors[NR_STAT_GROUPS];
45 unsigned long ios[NR_STAT_GROUPS];
46 unsigned long merges[NR_STAT_GROUPS];
Jerome Marchandea5c48a2008-02-08 11:04:09 +010047 unsigned long io_ticks;
Mikulas Patocka1226b8d2018-12-06 11:41:20 -050048 local_t in_flight[2];
Jerome Marchandea5c48a2008-02-08 11:04:09 +010049};
Will Drewry6d1d8052010-08-31 15:47:05 -050050
51#define PARTITION_META_INFO_VOLNAMELTH 64
Stephen Warren1ad7e892012-11-08 16:12:25 -080052/*
53 * Enough for the string representation of any kind of UUID plus NULL.
54 * EFI UUID is 36 characters. MSDOS UUID is 11 characters.
55 */
Andy Shevchenko63579782016-05-20 17:01:24 -070056#define PARTITION_META_INFO_UUIDLTH (UUID_STRING_LEN + 1)
Will Drewry6d1d8052010-08-31 15:47:05 -050057
58struct partition_meta_info {
Stephen Warren1ad7e892012-11-08 16:12:25 -080059 char uuid[PARTITION_META_INFO_UUIDLTH];
Will Drewry6d1d8052010-08-31 15:47:05 -050060 u8 volname[PARTITION_META_INFO_VOLNAMELTH];
61};
62
Linus Torvalds1da177e2005-04-16 15:20:36 -070063struct hd_struct {
64 sector_t start_sect;
Vivek Goyalc83f6bf2012-08-01 12:24:18 +020065 /*
66 * nr_sects is protected by sequence counter. One might extend a
67 * partition while IO is happening to it and update of nr_sects
68 * can be non-atomic on 32bit machines with 64bit sector_t.
69 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070070 sector_t nr_sects;
Vivek Goyalc83f6bf2012-08-01 12:24:18 +020071 seqcount_t nr_sects_seq;
Martin K. Petersenc72758f2009-05-22 17:17:53 -040072 sector_t alignment_offset;
Jens Axboea1706ac2011-05-30 07:42:51 +020073 unsigned int discard_alignment;
Tejun Heoed9e1982008-08-25 19:56:05 +090074 struct device __dev;
Jun'ichi Nomura6a4d44c2006-03-27 01:17:55 -080075 struct kobject *holder_dir;
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 int policy, partno;
Will Drewry6d1d8052010-08-31 15:47:05 -050077 struct partition_meta_info *info;
Akinobu Mitac17bb492006-12-08 02:39:46 -080078#ifdef CONFIG_FAIL_MAKE_REQUEST
79 int make_it_fail;
80#endif
Jerome Marchandea5c48a2008-02-08 11:04:09 +010081 unsigned long stamp;
Jerome Marchandea5c48a2008-02-08 11:04:09 +010082#ifdef CONFIG_SMP
Tejun Heo43cf38e2010-02-02 14:38:57 +090083 struct disk_stats __percpu *dkstats;
Jerome Marchandea5c48a2008-02-08 11:04:09 +010084#else
85 struct disk_stats dkstats;
86#endif
Ming Lei6c710132015-07-16 11:16:45 +080087 struct percpu_ref ref;
Yufen Yu94a2c3a2018-11-28 16:42:01 +080088 struct rcu_work rcu_work;
Linus Torvalds1da177e2005-04-16 15:20:36 -070089};
90
Stephen Kitt9243c6f2020-03-07 15:56:59 +010091/**
92 * DOC: genhd capability flags
93 *
94 * ``GENHD_FL_REMOVABLE`` (0x0001): indicates that the block device
95 * gives access to removable media.
96 * When set, the device remains present even when media is not
97 * inserted.
98 * Must not be set for devices which are removed entirely when the
99 * media is removed.
100 *
101 * ``GENHD_FL_CD`` (0x0008): the block device is a CD-ROM-style
102 * device.
103 * Affects responses to the ``CDROM_GET_CAPABILITY`` ioctl.
104 *
105 * ``GENHD_FL_UP`` (0x0010): indicates that the block device is "up",
106 * with a similar meaning to network interfaces.
107 *
108 * ``GENHD_FL_SUPPRESS_PARTITION_INFO`` (0x0020): don't include
109 * partition information in ``/proc/partitions`` or in the output of
110 * printk_all_partitions().
111 * Used for the null block device and some MMC devices.
112 *
113 * ``GENHD_FL_EXT_DEVT`` (0x0040): the driver supports extended
114 * dynamic ``dev_t``, i.e. it wants extended device numbers
115 * (``BLOCK_EXT_MAJOR``).
116 * This affects the maximum number of partitions.
117 *
118 * ``GENHD_FL_NATIVE_CAPACITY`` (0x0080): based on information in the
119 * partition table, the device's capacity has been extended to its
120 * native capacity; i.e. the device has hidden capacity used by one
121 * of the partitions (this is a flag used so that native capacity is
122 * only ever unlocked once).
123 *
124 * ``GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE`` (0x0100): event polling is
125 * blocked whenever a writer holds an exclusive lock.
126 *
127 * ``GENHD_FL_NO_PART_SCAN`` (0x0200): partition scanning is disabled.
128 * Used for loop devices in their default settings and some MMC
129 * devices.
130 *
131 * ``GENHD_FL_HIDDEN`` (0x0400): the block device is hidden; it
132 * doesn't produce events, doesn't appear in sysfs, and doesn't have
133 * an associated ``bdev``.
134 * Implies ``GENHD_FL_SUPPRESS_PARTITION_INFO`` and
135 * ``GENHD_FL_NO_PART_SCAN``.
136 * Used for multipath devices.
137 */
138#define GENHD_FL_REMOVABLE 0x0001
139/* 2 is unused (used to be GENHD_FL_DRIVERFS) */
140/* 4 is unused (used to be GENHD_FL_MEDIA_CHANGE_NOTIFY) */
141#define GENHD_FL_CD 0x0008
142#define GENHD_FL_UP 0x0010
143#define GENHD_FL_SUPPRESS_PARTITION_INFO 0x0020
144#define GENHD_FL_EXT_DEVT 0x0040
145#define GENHD_FL_NATIVE_CAPACITY 0x0080
146#define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE 0x0100
147#define GENHD_FL_NO_PART_SCAN 0x0200
148#define GENHD_FL_HIDDEN 0x0400
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149
Tejun Heo77ea8872010-12-08 20:57:37 +0100150enum {
151 DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */
152 DISK_EVENT_EJECT_REQUEST = 1 << 1, /* eject requested */
153};
154
Martin Wilckc92e2f02019-03-27 14:51:02 +0100155enum {
156 /* Poll even if events_poll_msecs is unset */
157 DISK_EVENT_FLAG_POLL = 1 << 0,
158 /* Forward events to udev */
159 DISK_EVENT_FLAG_UEVENT = 1 << 1,
160};
161
Tejun Heo540eed52008-08-25 19:56:15 +0900162struct disk_part_tbl {
163 struct rcu_head rcu_head;
164 int len;
Arnd Bergmann4d2deb42010-02-24 20:01:56 +0100165 struct hd_struct __rcu *last_lookup;
166 struct hd_struct __rcu *part[];
Tejun Heo540eed52008-08-25 19:56:15 +0900167};
168
Tejun Heo77ea8872010-12-08 20:57:37 +0100169struct disk_events;
Vishal Verma99e66082016-01-09 08:36:51 -0800170struct badblocks;
Tejun Heo77ea8872010-12-08 20:57:37 +0100171
Martin K. Petersen25520d52015-10-21 13:19:49 -0400172#if defined(CONFIG_BLK_DEV_INTEGRITY)
173
174struct blk_integrity {
Eric Biggers869ab902017-03-24 18:03:48 -0700175 const struct blk_integrity_profile *profile;
176 unsigned char flags;
177 unsigned char tuple_size;
178 unsigned char interval_exp;
179 unsigned char tag_size;
Martin K. Petersen25520d52015-10-21 13:19:49 -0400180};
181
182#endif /* CONFIG_BLK_DEV_INTEGRITY */
183
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184struct gendisk {
Tejun Heo689d6fa2008-08-25 19:56:16 +0900185 /* major, first_minor and minors are input parameters only,
186 * don't use directly. Use disk_devt() and disk_max_parts().
Tejun Heof331c022008-09-03 09:01:48 +0200187 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188 int major; /* major number of driver */
189 int first_minor;
190 int minors; /* maximum number of minors, =1 for
191 * disks that can't be partitioned. */
Tejun Heof331c022008-09-03 09:01:48 +0200192
Tejun Heo3e1a7ff2008-08-25 19:56:17 +0900193 char disk_name[DISK_NAME_LEN]; /* name of major driver */
Tejun Heo77ea8872010-12-08 20:57:37 +0100194
Martin Wilckc92e2f02019-03-27 14:51:02 +0100195 unsigned short events; /* supported events */
196 unsigned short event_flags; /* flags related to event processing */
Tejun Heo77ea8872010-12-08 20:57:37 +0100197
Tejun Heob5d0b9d2008-09-03 09:06:42 +0200198 /* Array of pointers to partitions indexed by partno.
Tejun Heoe71bf0d2008-09-03 09:03:02 +0200199 * Protected with matching bdev lock but stat and other
200 * non-critical accesses use RCU. Always access through
201 * helpers.
202 */
Arnd Bergmann4d2deb42010-02-24 20:01:56 +0100203 struct disk_part_tbl __rcu *part_tbl;
Tejun Heob5d0b9d2008-09-03 09:06:42 +0200204 struct hd_struct part0;
Tejun Heoe71bf0d2008-09-03 09:03:02 +0200205
Alexey Dobriyan83d5cde2009-09-21 17:01:13 -0700206 const struct block_device_operations *fops;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207 struct request_queue *queue;
208 void *private_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209
210 int flags;
Jan Kara56c09082018-02-26 13:01:41 +0100211 struct rw_semaphore lookup_sem;
Jun'ichi Nomura6a4d44c2006-03-27 01:17:55 -0800212 struct kobject *slave_dir;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213
214 struct timer_rand_state *random;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700215 atomic_t sync_io; /* RAID */
Tejun Heo77ea8872010-12-08 20:57:37 +0100216 struct disk_events *ev;
Martin K. Petersen7ba1ba12008-06-30 20:04:41 +0200217#ifdef CONFIG_BLK_DEV_INTEGRITY
Martin K. Petersenaff34e12015-10-21 13:19:27 -0400218 struct kobject integrity_kobj;
Martin K. Petersen25520d52015-10-21 13:19:49 -0400219#endif /* CONFIG_BLK_DEV_INTEGRITY */
Tejun Heo540eed52008-08-25 19:56:15 +0900220 int node_id;
Vishal Verma99e66082016-01-09 08:36:51 -0800221 struct badblocks *bb;
Byungchul Parke319e1f2017-10-25 17:56:05 +0900222 struct lockdep_map lockdep_map;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223};
224
Tejun Heo310a2c12008-08-25 19:47:17 +0900225static inline struct gendisk *part_to_disk(struct hd_struct *part)
226{
Tejun Heo548b10e2008-08-29 09:01:47 +0200227 if (likely(part)) {
228 if (part->partno)
229 return dev_to_disk(part_to_dev(part)->parent);
230 else
231 return dev_to_disk(part_to_dev(part));
232 }
Tejun Heo310a2c12008-08-25 19:47:17 +0900233 return NULL;
234}
235
Tejun Heof331c022008-09-03 09:01:48 +0200236static inline int disk_max_parts(struct gendisk *disk)
237{
Tejun Heo689d6fa2008-08-25 19:56:16 +0900238 if (disk->flags & GENHD_FL_EXT_DEVT)
239 return DISK_MAX_PARTS;
240 return disk->minors;
Tejun Heob5d0b9d2008-09-03 09:06:42 +0200241}
242
Tejun Heod27769e2011-08-23 20:01:04 +0200243static inline bool disk_part_scan_enabled(struct gendisk *disk)
Tejun Heob5d0b9d2008-09-03 09:06:42 +0200244{
Tejun Heod27769e2011-08-23 20:01:04 +0200245 return disk_max_parts(disk) > 1 &&
246 !(disk->flags & GENHD_FL_NO_PART_SCAN);
Tejun Heof331c022008-09-03 09:01:48 +0200247}
248
249static inline dev_t disk_devt(struct gendisk *disk)
250{
Christoph Hellwig517bf3c2017-11-02 21:29:52 +0300251 return MKDEV(disk->major, disk->first_minor);
Tejun Heof331c022008-09-03 09:01:48 +0200252}
253
254static inline dev_t part_devt(struct hd_struct *part)
255{
Tejun Heoed9e1982008-08-25 19:56:05 +0900256 return part_to_dev(part)->devt;
Tejun Heof331c022008-09-03 09:01:48 +0200257}
258
Greg Edwards67f25192017-10-24 11:21:48 -0600259extern struct hd_struct *__disk_get_part(struct gendisk *disk, int partno);
Tejun Heoe71bf0d2008-09-03 09:03:02 +0200260extern struct hd_struct *disk_get_part(struct gendisk *disk, int partno);
261
262static inline void disk_put_part(struct hd_struct *part)
263{
264 if (likely(part))
Tejun Heoed9e1982008-08-25 19:56:05 +0900265 put_device(part_to_dev(part));
Tejun Heoe71bf0d2008-09-03 09:03:02 +0200266}
267
268/*
269 * Smarter partition iterator without context limits.
270 */
271#define DISK_PITER_REVERSE (1 << 0) /* iterate in the reverse direction */
272#define DISK_PITER_INCL_EMPTY (1 << 1) /* include 0-sized parts */
Tejun Heob5d0b9d2008-09-03 09:06:42 +0200273#define DISK_PITER_INCL_PART0 (1 << 2) /* include partition 0 */
Tejun Heo71982a42009-04-17 08:34:48 +0200274#define DISK_PITER_INCL_EMPTY_PART0 (1 << 3) /* include empty partition 0 */
Tejun Heoe71bf0d2008-09-03 09:03:02 +0200275
276struct disk_part_iter {
277 struct gendisk *disk;
278 struct hd_struct *part;
279 int idx;
280 unsigned int flags;
281};
282
283extern void disk_part_iter_init(struct disk_part_iter *piter,
284 struct gendisk *disk, unsigned int flags);
285extern struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter);
286extern void disk_part_iter_exit(struct disk_part_iter *piter);
Linus Torvalds10f36b12020-03-30 11:20:13 -0700287extern bool disk_has_partitions(struct gendisk *disk);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700288
Petros Koutoupis32ca1632009-03-10 08:25:54 +0100289/* block/genhd.c */
Hannes Reineckefef912b2018-09-28 08:17:19 +0200290extern void device_add_disk(struct device *parent, struct gendisk *disk,
291 const struct attribute_group **groups);
Dan Williamse63a46b2016-06-15 18:17:27 -0700292static inline void add_disk(struct gendisk *disk)
293{
Hannes Reineckefef912b2018-09-28 08:17:19 +0200294 device_add_disk(NULL, disk, NULL);
Dan Williamse63a46b2016-06-15 18:17:27 -0700295}
Mike Snitzerfa70d2e2018-01-08 22:01:13 -0500296extern void device_add_disk_no_queue_reg(struct device *parent, struct gendisk *disk);
297static inline void add_disk_no_queue_reg(struct gendisk *disk)
298{
299 device_add_disk_no_queue_reg(NULL, disk);
300}
Dan Williamse63a46b2016-06-15 18:17:27 -0700301
Linus Torvalds1da177e2005-04-16 15:20:36 -0700302extern void del_gendisk(struct gendisk *gp);
Tejun Heocf771cb2008-09-03 09:01:09 +0200303extern struct gendisk *get_gendisk(dev_t dev, int *partno);
Tejun Heof331c022008-09-03 09:01:48 +0200304extern struct block_device *bdget_disk(struct gendisk *disk, int partno);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700305
306extern void set_device_ro(struct block_device *bdev, int flag);
307extern void set_disk_ro(struct gendisk *disk, int flag);
308
Tejun Heob7db9952008-08-25 19:56:10 +0900309static inline int get_disk_ro(struct gendisk *disk)
310{
311 return disk->part0.policy;
312}
313
Tejun Heo77ea8872010-12-08 20:57:37 +0100314extern void disk_block_events(struct gendisk *disk);
315extern void disk_unblock_events(struct gendisk *disk);
Tejun Heo85ef06d2011-07-01 16:17:47 +0200316extern void disk_flush_events(struct gendisk *disk, unsigned int mask);
Balbir Singhe598a722020-03-13 05:30:05 +0000317extern void set_capacity_revalidate_and_notify(struct gendisk *disk,
318 sector_t size, bool revalidate);
Tejun Heo77ea8872010-12-08 20:57:37 +0100319extern unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask);
320
Linus Torvalds1da177e2005-04-16 15:20:36 -0700321/* drivers/char/random.c */
Emese Revfy0766f782016-06-20 20:42:34 +0200322extern void add_disk_randomness(struct gendisk *disk) __latent_entropy;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700323extern void rand_initialize_disk(struct gendisk *disk);
324
325static inline sector_t get_start_sect(struct block_device *bdev)
326{
Tejun Heo0762b8b2008-08-25 19:56:12 +0900327 return bdev->bd_part->start_sect;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700328}
329static inline sector_t get_capacity(struct gendisk *disk)
330{
Tejun Heo80795ae2008-08-25 19:56:07 +0900331 return disk->part0.nr_sects;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700332}
333static inline void set_capacity(struct gendisk *disk, sector_t size)
334{
Tejun Heo80795ae2008-08-25 19:56:07 +0900335 disk->part0.nr_sects = size;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700336}
337
Tejun Heocf771cb2008-09-03 09:01:09 +0200338extern dev_t blk_lookup_devt(const char *name, int partno);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700339
Christoph Hellwig142fe8f2019-11-14 15:34:35 +0100340int bdev_disk_changed(struct block_device *bdev, bool invalidate);
Christoph Hellwiga1548b62019-11-14 15:34:34 +0100341int blk_add_partitions(struct gendisk *disk, struct block_device *bdev);
Christoph Hellwigd46430b2020-04-14 09:28:57 +0200342int blk_drop_partitions(struct block_device *bdev);
Dave Gilbertdd2a3452007-05-09 02:33:24 -0700343extern void printk_all_partitions(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700344
Byungchul Parke319e1f2017-10-25 17:56:05 +0900345extern struct gendisk *__alloc_disk_node(int minors, int node_id);
Jan Kara3079c222018-02-26 13:01:38 +0100346extern struct kobject *get_disk_and_module(struct gendisk *disk);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700347extern void put_disk(struct gendisk *disk);
Jan Kara9df6c292018-02-26 13:01:39 +0100348extern void put_disk_and_module(struct gendisk *disk);
Kay Sieversedfaa7c2007-05-21 22:08:01 +0200349extern void blk_register_region(dev_t devt, unsigned long range,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700350 struct module *module,
351 struct kobject *(*probe)(dev_t, int *, void *),
352 int (*lock)(dev_t, void *),
353 void *data);
Kay Sieversedfaa7c2007-05-21 22:08:01 +0200354extern void blk_unregister_region(dev_t devt, unsigned long range);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700355
Byungchul Parke319e1f2017-10-25 17:56:05 +0900356#define alloc_disk_node(minors, node_id) \
357({ \
358 static struct lock_class_key __key; \
359 const char *__name; \
360 struct gendisk *__disk; \
361 \
362 __name = "(gendisk_completion)"#minors"("#node_id")"; \
363 \
364 __disk = __alloc_disk_node(minors, node_id); \
365 \
366 if (__disk) \
367 lockdep_init_map(&__disk->lockdep_map, __name, &__key, 0); \
368 \
369 __disk; \
370})
371
372#define alloc_disk(minors) alloc_disk_node(minors, NUMA_NO_NODE)
373
Jens Axboe87c1efb2007-05-11 13:29:54 +0200374#else /* CONFIG_BLOCK */
375
376static inline void printk_all_partitions(void) { }
377
Tejun Heocf771cb2008-09-03 09:01:09 +0200378static inline dev_t blk_lookup_devt(const char *name, int partno)
Kay Sieversedfaa7c2007-05-21 22:08:01 +0200379{
380 dev_t devt = MKDEV(0, 0);
381 return devt;
382}
Jens Axboe87c1efb2007-05-11 13:29:54 +0200383#endif /* CONFIG_BLOCK */
David Howells93614012006-09-30 20:45:40 +0200384
David Woodhousea8ae50b2008-03-12 17:52:56 +0100385#endif /* _LINUX_GENHD_H */