| .. | .. |
|---|
| 18 | 18 | #include <linux/uuid.h> |
|---|
| 19 | 19 | #include <linux/blk_types.h> |
|---|
| 20 | 20 | #include <linux/android_kabi.h> |
|---|
| 21 | | - |
|---|
| 22 | | -#ifdef CONFIG_BLOCK |
|---|
| 21 | +#include <asm/local.h> |
|---|
| 23 | 22 | |
|---|
| 24 | 23 | #define dev_to_disk(device) container_of((device), struct gendisk, part0.__dev) |
|---|
| 25 | 24 | #define dev_to_part(device) container_of((device), struct hd_struct, __dev) |
|---|
| 26 | 25 | #define disk_to_dev(disk) (&(disk)->part0.__dev) |
|---|
| 27 | 26 | #define part_to_dev(part) (&((part)->__dev)) |
|---|
| 28 | 27 | |
|---|
| 28 | +extern const struct device_type disk_type; |
|---|
| 29 | 29 | extern struct device_type part_type; |
|---|
| 30 | | -extern struct kobject *block_depr; |
|---|
| 31 | 30 | extern struct class block_class; |
|---|
| 32 | | - |
|---|
| 33 | | -enum { |
|---|
| 34 | | -/* These three have identical behaviour; use the second one if DOS FDISK gets |
|---|
| 35 | | - confused about extended/logical partitions starting past cylinder 1023. */ |
|---|
| 36 | | - DOS_EXTENDED_PARTITION = 5, |
|---|
| 37 | | - LINUX_EXTENDED_PARTITION = 0x85, |
|---|
| 38 | | - WIN98_EXTENDED_PARTITION = 0x0f, |
|---|
| 39 | | - |
|---|
| 40 | | - SUN_WHOLE_DISK = DOS_EXTENDED_PARTITION, |
|---|
| 41 | | - |
|---|
| 42 | | - LINUX_SWAP_PARTITION = 0x82, |
|---|
| 43 | | - LINUX_DATA_PARTITION = 0x83, |
|---|
| 44 | | - LINUX_LVM_PARTITION = 0x8e, |
|---|
| 45 | | - LINUX_RAID_PARTITION = 0xfd, /* autodetect RAID partition */ |
|---|
| 46 | | - |
|---|
| 47 | | - SOLARIS_X86_PARTITION = LINUX_SWAP_PARTITION, |
|---|
| 48 | | - NEW_SOLARIS_X86_PARTITION = 0xbf, |
|---|
| 49 | | - |
|---|
| 50 | | - DM6_AUX1PARTITION = 0x51, /* no DDO: use xlated geom */ |
|---|
| 51 | | - DM6_AUX3PARTITION = 0x53, /* no DDO: use xlated geom */ |
|---|
| 52 | | - DM6_PARTITION = 0x54, /* has DDO: use xlated geom & offset */ |
|---|
| 53 | | - EZD_PARTITION = 0x55, /* EZ-DRIVE */ |
|---|
| 54 | | - |
|---|
| 55 | | - FREEBSD_PARTITION = 0xa5, /* FreeBSD Partition ID */ |
|---|
| 56 | | - OPENBSD_PARTITION = 0xa6, /* OpenBSD Partition ID */ |
|---|
| 57 | | - NETBSD_PARTITION = 0xa9, /* NetBSD Partition ID */ |
|---|
| 58 | | - BSDI_PARTITION = 0xb7, /* BSDI Partition ID */ |
|---|
| 59 | | - MINIX_PARTITION = 0x81, /* Minix Partition ID */ |
|---|
| 60 | | - UNIXWARE_PARTITION = 0x63, /* Same as GNU_HURD and SCO Unix */ |
|---|
| 61 | | -}; |
|---|
| 62 | 31 | |
|---|
| 63 | 32 | #define DISK_MAX_PARTS 256 |
|---|
| 64 | 33 | #define DISK_NAME_LEN 32 |
|---|
| .. | .. |
|---|
| 69 | 38 | #include <linux/string.h> |
|---|
| 70 | 39 | #include <linux/fs.h> |
|---|
| 71 | 40 | #include <linux/workqueue.h> |
|---|
| 72 | | - |
|---|
| 73 | | -struct partition { |
|---|
| 74 | | - unsigned char boot_ind; /* 0x80 - active */ |
|---|
| 75 | | - unsigned char head; /* starting head */ |
|---|
| 76 | | - unsigned char sector; /* starting sector */ |
|---|
| 77 | | - unsigned char cyl; /* starting cylinder */ |
|---|
| 78 | | - unsigned char sys_ind; /* What partition type */ |
|---|
| 79 | | - unsigned char end_head; /* end head */ |
|---|
| 80 | | - unsigned char end_sector; /* end sector */ |
|---|
| 81 | | - unsigned char end_cyl; /* end cylinder */ |
|---|
| 82 | | - __le32 start_sect; /* starting sector counting from 0 */ |
|---|
| 83 | | - __le32 nr_sects; /* nr of sectors in partition */ |
|---|
| 84 | | -} __attribute__((packed)); |
|---|
| 85 | | - |
|---|
| 86 | | -struct disk_stats { |
|---|
| 87 | | - u64 nsecs[NR_STAT_GROUPS]; |
|---|
| 88 | | - unsigned long sectors[NR_STAT_GROUPS]; |
|---|
| 89 | | - unsigned long ios[NR_STAT_GROUPS]; |
|---|
| 90 | | - unsigned long merges[NR_STAT_GROUPS]; |
|---|
| 91 | | - unsigned long io_ticks; |
|---|
| 92 | | - unsigned long time_in_queue; |
|---|
| 93 | | -}; |
|---|
| 94 | 41 | |
|---|
| 95 | 42 | #define PARTITION_META_INFO_VOLNAMELTH 64 |
|---|
| 96 | 43 | /* |
|---|
| .. | .. |
|---|
| 112 | 59 | * can be non-atomic on 32bit machines with 64bit sector_t. |
|---|
| 113 | 60 | */ |
|---|
| 114 | 61 | sector_t nr_sects; |
|---|
| 62 | +#if BITS_PER_LONG==32 && defined(CONFIG_SMP) |
|---|
| 115 | 63 | seqcount_t nr_sects_seq; |
|---|
| 116 | | - sector_t alignment_offset; |
|---|
| 117 | | - unsigned int discard_alignment; |
|---|
| 64 | +#endif |
|---|
| 65 | + unsigned long stamp; |
|---|
| 66 | + struct disk_stats __percpu *dkstats; |
|---|
| 67 | + struct percpu_ref ref; |
|---|
| 68 | + |
|---|
| 118 | 69 | struct device __dev; |
|---|
| 119 | 70 | struct kobject *holder_dir; |
|---|
| 120 | 71 | int policy, partno; |
|---|
| .. | .. |
|---|
| 122 | 73 | #ifdef CONFIG_FAIL_MAKE_REQUEST |
|---|
| 123 | 74 | int make_it_fail; |
|---|
| 124 | 75 | #endif |
|---|
| 125 | | - unsigned long stamp; |
|---|
| 126 | | - atomic_t in_flight[2]; |
|---|
| 127 | | -#ifdef CONFIG_SMP |
|---|
| 128 | | - struct disk_stats __percpu *dkstats; |
|---|
| 129 | | -#else |
|---|
| 130 | | - struct disk_stats dkstats; |
|---|
| 131 | | -#endif |
|---|
| 132 | | - struct percpu_ref ref; |
|---|
| 133 | 76 | struct rcu_work rcu_work; |
|---|
| 134 | 77 | |
|---|
| 135 | 78 | ANDROID_KABI_RESERVE(1); |
|---|
| .. | .. |
|---|
| 138 | 81 | ANDROID_KABI_RESERVE(4); |
|---|
| 139 | 82 | }; |
|---|
| 140 | 83 | |
|---|
| 141 | | -#define GENHD_FL_REMOVABLE 1 |
|---|
| 142 | | -/* 2 is unused */ |
|---|
| 143 | | -#define GENHD_FL_MEDIA_CHANGE_NOTIFY 4 |
|---|
| 144 | | -#define GENHD_FL_CD 8 |
|---|
| 145 | | -#define GENHD_FL_UP 16 |
|---|
| 146 | | -#define GENHD_FL_SUPPRESS_PARTITION_INFO 32 |
|---|
| 147 | | -#define GENHD_FL_EXT_DEVT 64 /* allow extended devt */ |
|---|
| 148 | | -#define GENHD_FL_NATIVE_CAPACITY 128 |
|---|
| 149 | | -#define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE 256 |
|---|
| 150 | | -#define GENHD_FL_NO_PART_SCAN 512 |
|---|
| 151 | | -#define GENHD_FL_HIDDEN 1024 |
|---|
| 84 | +/** |
|---|
| 85 | + * DOC: genhd capability flags |
|---|
| 86 | + * |
|---|
| 87 | + * ``GENHD_FL_REMOVABLE`` (0x0001): indicates that the block device |
|---|
| 88 | + * gives access to removable media. |
|---|
| 89 | + * When set, the device remains present even when media is not |
|---|
| 90 | + * inserted. |
|---|
| 91 | + * Must not be set for devices which are removed entirely when the |
|---|
| 92 | + * media is removed. |
|---|
| 93 | + * |
|---|
| 94 | + * ``GENHD_FL_CD`` (0x0008): the block device is a CD-ROM-style |
|---|
| 95 | + * device. |
|---|
| 96 | + * Affects responses to the ``CDROM_GET_CAPABILITY`` ioctl. |
|---|
| 97 | + * |
|---|
| 98 | + * ``GENHD_FL_UP`` (0x0010): indicates that the block device is "up", |
|---|
| 99 | + * with a similar meaning to network interfaces. |
|---|
| 100 | + * |
|---|
| 101 | + * ``GENHD_FL_SUPPRESS_PARTITION_INFO`` (0x0020): don't include |
|---|
| 102 | + * partition information in ``/proc/partitions`` or in the output of |
|---|
| 103 | + * printk_all_partitions(). |
|---|
| 104 | + * Used for the null block device and some MMC devices. |
|---|
| 105 | + * |
|---|
| 106 | + * ``GENHD_FL_EXT_DEVT`` (0x0040): the driver supports extended |
|---|
| 107 | + * dynamic ``dev_t``, i.e. it wants extended device numbers |
|---|
| 108 | + * (``BLOCK_EXT_MAJOR``). |
|---|
| 109 | + * This affects the maximum number of partitions. |
|---|
| 110 | + * |
|---|
| 111 | + * ``GENHD_FL_NATIVE_CAPACITY`` (0x0080): based on information in the |
|---|
| 112 | + * partition table, the device's capacity has been extended to its |
|---|
| 113 | + * native capacity; i.e. the device has hidden capacity used by one |
|---|
| 114 | + * of the partitions (this is a flag used so that native capacity is |
|---|
| 115 | + * only ever unlocked once). |
|---|
| 116 | + * |
|---|
| 117 | + * ``GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE`` (0x0100): event polling is |
|---|
| 118 | + * blocked whenever a writer holds an exclusive lock. |
|---|
| 119 | + * |
|---|
| 120 | + * ``GENHD_FL_NO_PART_SCAN`` (0x0200): partition scanning is disabled. |
|---|
| 121 | + * Used for loop devices in their default settings and some MMC |
|---|
| 122 | + * devices. |
|---|
| 123 | + * |
|---|
| 124 | + * ``GENHD_FL_HIDDEN`` (0x0400): the block device is hidden; it |
|---|
| 125 | + * doesn't produce events, doesn't appear in sysfs, and doesn't have |
|---|
| 126 | + * an associated ``bdev``. |
|---|
| 127 | + * Implies ``GENHD_FL_SUPPRESS_PARTITION_INFO`` and |
|---|
| 128 | + * ``GENHD_FL_NO_PART_SCAN``. |
|---|
| 129 | + * Used for multipath devices. |
|---|
| 130 | + */ |
|---|
| 131 | +#define GENHD_FL_REMOVABLE 0x0001 |
|---|
| 132 | +/* 2 is unused (used to be GENHD_FL_DRIVERFS) */ |
|---|
| 133 | +/* 4 is unused (used to be GENHD_FL_MEDIA_CHANGE_NOTIFY) */ |
|---|
| 134 | +#define GENHD_FL_CD 0x0008 |
|---|
| 135 | +#define GENHD_FL_UP 0x0010 |
|---|
| 136 | +#define GENHD_FL_SUPPRESS_PARTITION_INFO 0x0020 |
|---|
| 137 | +#define GENHD_FL_EXT_DEVT 0x0040 |
|---|
| 138 | +#define GENHD_FL_NATIVE_CAPACITY 0x0080 |
|---|
| 139 | +#define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE 0x0100 |
|---|
| 140 | +#define GENHD_FL_NO_PART_SCAN 0x0200 |
|---|
| 141 | +#define GENHD_FL_HIDDEN 0x0400 |
|---|
| 152 | 142 | |
|---|
| 153 | 143 | enum { |
|---|
| 154 | 144 | DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */ |
|---|
| 155 | 145 | DISK_EVENT_EJECT_REQUEST = 1 << 1, /* eject requested */ |
|---|
| 146 | +}; |
|---|
| 147 | + |
|---|
| 148 | +enum { |
|---|
| 149 | + /* Poll even if events_poll_msecs is unset */ |
|---|
| 150 | + DISK_EVENT_FLAG_POLL = 1 << 0, |
|---|
| 151 | + /* Forward events to udev */ |
|---|
| 152 | + DISK_EVENT_FLAG_UEVENT = 1 << 1, |
|---|
| 156 | 153 | }; |
|---|
| 157 | 154 | |
|---|
| 158 | 155 | struct disk_part_tbl { |
|---|
| .. | .. |
|---|
| 165 | 162 | struct disk_events; |
|---|
| 166 | 163 | struct badblocks; |
|---|
| 167 | 164 | |
|---|
| 168 | | -#if defined(CONFIG_BLK_DEV_INTEGRITY) |
|---|
| 169 | | - |
|---|
| 170 | 165 | struct blk_integrity { |
|---|
| 171 | 166 | const struct blk_integrity_profile *profile; |
|---|
| 172 | 167 | unsigned char flags; |
|---|
| .. | .. |
|---|
| 178 | 173 | ANDROID_KABI_RESERVE(2); |
|---|
| 179 | 174 | }; |
|---|
| 180 | 175 | |
|---|
| 181 | | -#endif /* CONFIG_BLK_DEV_INTEGRITY */ |
|---|
| 182 | | - |
|---|
| 183 | 176 | struct gendisk { |
|---|
| 184 | 177 | /* major, first_minor and minors are input parameters only, |
|---|
| 185 | 178 | * don't use directly. Use disk_devt() and disk_max_parts(). |
|---|
| .. | .. |
|---|
| 190 | 183 | * disks that can't be partitioned. */ |
|---|
| 191 | 184 | |
|---|
| 192 | 185 | char disk_name[DISK_NAME_LEN]; /* name of major driver */ |
|---|
| 193 | | - char *(*devnode)(struct gendisk *gd, umode_t *mode); |
|---|
| 194 | 186 | |
|---|
| 195 | | - unsigned int events; /* supported events */ |
|---|
| 196 | | - unsigned int async_events; /* async events, subset of all */ |
|---|
| 187 | + unsigned short events; /* supported events */ |
|---|
| 188 | + unsigned short event_flags; /* flags related to event processing */ |
|---|
| 197 | 189 | |
|---|
| 198 | 190 | /* Array of pointers to partitions indexed by partno. |
|---|
| 199 | 191 | * Protected with matching bdev lock but stat and other |
|---|
| .. | .. |
|---|
| 208 | 200 | void *private_data; |
|---|
| 209 | 201 | |
|---|
| 210 | 202 | int flags; |
|---|
| 203 | + unsigned long state; |
|---|
| 204 | +#define GD_NEED_PART_SCAN 0 |
|---|
| 211 | 205 | struct rw_semaphore lookup_sem; |
|---|
| 212 | 206 | struct kobject *slave_dir; |
|---|
| 213 | 207 | |
|---|
| .. | .. |
|---|
| 217 | 211 | #ifdef CONFIG_BLK_DEV_INTEGRITY |
|---|
| 218 | 212 | struct kobject integrity_kobj; |
|---|
| 219 | 213 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ |
|---|
| 214 | +#if IS_ENABLED(CONFIG_CDROM) |
|---|
| 215 | + struct cdrom_device_info *cdi; |
|---|
| 216 | +#endif |
|---|
| 220 | 217 | int node_id; |
|---|
| 221 | 218 | struct badblocks *bb; |
|---|
| 222 | 219 | struct lockdep_map lockdep_map; |
|---|
| .. | .. |
|---|
| 227 | 224 | ANDROID_KABI_RESERVE(4); |
|---|
| 228 | 225 | |
|---|
| 229 | 226 | }; |
|---|
| 227 | + |
|---|
| 228 | +#if IS_REACHABLE(CONFIG_CDROM) |
|---|
| 229 | +#define disk_to_cdi(disk) ((disk)->cdi) |
|---|
| 230 | +#else |
|---|
| 231 | +#define disk_to_cdi(disk) NULL |
|---|
| 232 | +#endif |
|---|
| 230 | 233 | |
|---|
| 231 | 234 | static inline struct gendisk *part_to_disk(struct hd_struct *part) |
|---|
| 232 | 235 | { |
|---|
| .. | .. |
|---|
| 271 | 274 | put_device(part_to_dev(part)); |
|---|
| 272 | 275 | } |
|---|
| 273 | 276 | |
|---|
| 277 | +static inline void hd_sects_seq_init(struct hd_struct *p) |
|---|
| 278 | +{ |
|---|
| 279 | +#if BITS_PER_LONG==32 && defined(CONFIG_SMP) |
|---|
| 280 | + seqcount_init(&p->nr_sects_seq); |
|---|
| 281 | +#endif |
|---|
| 282 | +} |
|---|
| 283 | + |
|---|
| 274 | 284 | /* |
|---|
| 275 | 285 | * Smarter partition iterator without context limits. |
|---|
| 276 | 286 | */ |
|---|
| .. | .. |
|---|
| 290 | 300 | struct gendisk *disk, unsigned int flags); |
|---|
| 291 | 301 | extern struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter); |
|---|
| 292 | 302 | extern void disk_part_iter_exit(struct disk_part_iter *piter); |
|---|
| 293 | | - |
|---|
| 294 | | -extern struct hd_struct *disk_map_sector_rcu(struct gendisk *disk, |
|---|
| 295 | | - sector_t sector); |
|---|
| 296 | | - |
|---|
| 297 | | -/* |
|---|
| 298 | | - * Macros to operate on percpu disk statistics: |
|---|
| 299 | | - * |
|---|
| 300 | | - * {disk|part|all}_stat_{add|sub|inc|dec}() modify the stat counters |
|---|
| 301 | | - * and should be called between disk_stat_lock() and |
|---|
| 302 | | - * disk_stat_unlock(). |
|---|
| 303 | | - * |
|---|
| 304 | | - * part_stat_read() can be called at any time. |
|---|
| 305 | | - * |
|---|
| 306 | | - * part_stat_{add|set_all}() and {init|free}_part_stats are for |
|---|
| 307 | | - * internal use only. |
|---|
| 308 | | - */ |
|---|
| 309 | | -#ifdef CONFIG_SMP |
|---|
| 310 | | -#define part_stat_lock() ({ rcu_read_lock(); get_cpu(); }) |
|---|
| 311 | | -#define part_stat_unlock() do { put_cpu(); rcu_read_unlock(); } while (0) |
|---|
| 312 | | - |
|---|
| 313 | | -#define __part_stat_add(cpu, part, field, addnd) \ |
|---|
| 314 | | - (per_cpu_ptr((part)->dkstats, (cpu))->field += (addnd)) |
|---|
| 315 | | - |
|---|
| 316 | | -#define part_stat_read(part, field) \ |
|---|
| 317 | | -({ \ |
|---|
| 318 | | - typeof((part)->dkstats->field) res = 0; \ |
|---|
| 319 | | - unsigned int _cpu; \ |
|---|
| 320 | | - for_each_possible_cpu(_cpu) \ |
|---|
| 321 | | - res += per_cpu_ptr((part)->dkstats, _cpu)->field; \ |
|---|
| 322 | | - res; \ |
|---|
| 323 | | -}) |
|---|
| 324 | | - |
|---|
| 325 | | -static inline void part_stat_set_all(struct hd_struct *part, int value) |
|---|
| 326 | | -{ |
|---|
| 327 | | - int i; |
|---|
| 328 | | - |
|---|
| 329 | | - for_each_possible_cpu(i) |
|---|
| 330 | | - memset(per_cpu_ptr(part->dkstats, i), value, |
|---|
| 331 | | - sizeof(struct disk_stats)); |
|---|
| 332 | | -} |
|---|
| 333 | | - |
|---|
| 334 | | -static inline int init_part_stats(struct hd_struct *part) |
|---|
| 335 | | -{ |
|---|
| 336 | | - part->dkstats = alloc_percpu(struct disk_stats); |
|---|
| 337 | | - if (!part->dkstats) |
|---|
| 338 | | - return 0; |
|---|
| 339 | | - return 1; |
|---|
| 340 | | -} |
|---|
| 341 | | - |
|---|
| 342 | | -static inline void free_part_stats(struct hd_struct *part) |
|---|
| 343 | | -{ |
|---|
| 344 | | - free_percpu(part->dkstats); |
|---|
| 345 | | -} |
|---|
| 346 | | - |
|---|
| 347 | | -#else /* !CONFIG_SMP */ |
|---|
| 348 | | -#define part_stat_lock() ({ rcu_read_lock(); 0; }) |
|---|
| 349 | | -#define part_stat_unlock() rcu_read_unlock() |
|---|
| 350 | | - |
|---|
| 351 | | -#define __part_stat_add(cpu, part, field, addnd) \ |
|---|
| 352 | | - ((part)->dkstats.field += addnd) |
|---|
| 353 | | - |
|---|
| 354 | | -#define part_stat_read(part, field) ((part)->dkstats.field) |
|---|
| 355 | | - |
|---|
| 356 | | -static inline void part_stat_set_all(struct hd_struct *part, int value) |
|---|
| 357 | | -{ |
|---|
| 358 | | - memset(&part->dkstats, value, sizeof(struct disk_stats)); |
|---|
| 359 | | -} |
|---|
| 360 | | - |
|---|
| 361 | | -static inline int init_part_stats(struct hd_struct *part) |
|---|
| 362 | | -{ |
|---|
| 363 | | - return 1; |
|---|
| 364 | | -} |
|---|
| 365 | | - |
|---|
| 366 | | -static inline void free_part_stats(struct hd_struct *part) |
|---|
| 367 | | -{ |
|---|
| 368 | | -} |
|---|
| 369 | | - |
|---|
| 370 | | -#endif /* CONFIG_SMP */ |
|---|
| 371 | | - |
|---|
| 372 | | -#define part_stat_read_msecs(part, which) \ |
|---|
| 373 | | - div_u64(part_stat_read(part, nsecs[which]), NSEC_PER_MSEC) |
|---|
| 374 | | - |
|---|
| 375 | | -#define part_stat_read_accum(part, field) \ |
|---|
| 376 | | - (part_stat_read(part, field[STAT_READ]) + \ |
|---|
| 377 | | - part_stat_read(part, field[STAT_WRITE]) + \ |
|---|
| 378 | | - part_stat_read(part, field[STAT_DISCARD])) |
|---|
| 379 | | - |
|---|
| 380 | | -#define part_stat_add(cpu, part, field, addnd) do { \ |
|---|
| 381 | | - __part_stat_add((cpu), (part), field, addnd); \ |
|---|
| 382 | | - if ((part)->partno) \ |
|---|
| 383 | | - __part_stat_add((cpu), &part_to_disk((part))->part0, \ |
|---|
| 384 | | - field, addnd); \ |
|---|
| 385 | | -} while (0) |
|---|
| 386 | | - |
|---|
| 387 | | -#define part_stat_dec(cpu, gendiskp, field) \ |
|---|
| 388 | | - part_stat_add(cpu, gendiskp, field, -1) |
|---|
| 389 | | -#define part_stat_inc(cpu, gendiskp, field) \ |
|---|
| 390 | | - part_stat_add(cpu, gendiskp, field, 1) |
|---|
| 391 | | -#define part_stat_sub(cpu, gendiskp, field, subnd) \ |
|---|
| 392 | | - part_stat_add(cpu, gendiskp, field, -subnd) |
|---|
| 393 | | - |
|---|
| 394 | | -void part_in_flight(struct request_queue *q, struct hd_struct *part, |
|---|
| 395 | | - unsigned int inflight[2]); |
|---|
| 396 | | -void part_in_flight_rw(struct request_queue *q, struct hd_struct *part, |
|---|
| 397 | | - unsigned int inflight[2]); |
|---|
| 398 | | -void part_dec_in_flight(struct request_queue *q, struct hd_struct *part, |
|---|
| 399 | | - int rw); |
|---|
| 400 | | -void part_inc_in_flight(struct request_queue *q, struct hd_struct *part, |
|---|
| 401 | | - int rw); |
|---|
| 402 | | - |
|---|
| 403 | | -static inline struct partition_meta_info *alloc_part_info(struct gendisk *disk) |
|---|
| 404 | | -{ |
|---|
| 405 | | - if (disk) |
|---|
| 406 | | - return kzalloc_node(sizeof(struct partition_meta_info), |
|---|
| 407 | | - GFP_KERNEL, disk->node_id); |
|---|
| 408 | | - return kzalloc(sizeof(struct partition_meta_info), GFP_KERNEL); |
|---|
| 409 | | -} |
|---|
| 410 | | - |
|---|
| 411 | | -static inline void free_part_info(struct hd_struct *part) |
|---|
| 412 | | -{ |
|---|
| 413 | | - kfree(part->info); |
|---|
| 414 | | -} |
|---|
| 415 | | - |
|---|
| 416 | | -/* block/blk-core.c */ |
|---|
| 417 | | -extern void part_round_stats(struct request_queue *q, int cpu, struct hd_struct *part); |
|---|
| 303 | +extern bool disk_has_partitions(struct gendisk *disk); |
|---|
| 418 | 304 | |
|---|
| 419 | 305 | /* block/genhd.c */ |
|---|
| 420 | | -extern void device_add_disk(struct device *parent, struct gendisk *disk); |
|---|
| 306 | +extern void device_add_disk(struct device *parent, struct gendisk *disk, |
|---|
| 307 | + const struct attribute_group **groups); |
|---|
| 421 | 308 | static inline void add_disk(struct gendisk *disk) |
|---|
| 422 | 309 | { |
|---|
| 423 | | - device_add_disk(NULL, disk); |
|---|
| 310 | + device_add_disk(NULL, disk, NULL); |
|---|
| 424 | 311 | } |
|---|
| 425 | 312 | extern void device_add_disk_no_queue_reg(struct device *parent, struct gendisk *disk); |
|---|
| 426 | 313 | static inline void add_disk_no_queue_reg(struct gendisk *disk) |
|---|
| .. | .. |
|---|
| 443 | 330 | extern void disk_block_events(struct gendisk *disk); |
|---|
| 444 | 331 | extern void disk_unblock_events(struct gendisk *disk); |
|---|
| 445 | 332 | extern void disk_flush_events(struct gendisk *disk, unsigned int mask); |
|---|
| 446 | | -extern unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask); |
|---|
| 333 | +bool set_capacity_revalidate_and_notify(struct gendisk *disk, sector_t size, |
|---|
| 334 | + bool update_bdev); |
|---|
| 447 | 335 | |
|---|
| 448 | 336 | /* drivers/char/random.c */ |
|---|
| 449 | 337 | extern void add_disk_randomness(struct gendisk *disk) __latent_entropy; |
|---|
| .. | .. |
|---|
| 462 | 350 | disk->part0.nr_sects = size; |
|---|
| 463 | 351 | } |
|---|
| 464 | 352 | |
|---|
| 465 | | -#ifdef CONFIG_SOLARIS_X86_PARTITION |
|---|
| 466 | | - |
|---|
| 467 | | -#define SOLARIS_X86_NUMSLICE 16 |
|---|
| 468 | | -#define SOLARIS_X86_VTOC_SANE (0x600DDEEEUL) |
|---|
| 469 | | - |
|---|
| 470 | | -struct solaris_x86_slice { |
|---|
| 471 | | - __le16 s_tag; /* ID tag of partition */ |
|---|
| 472 | | - __le16 s_flag; /* permission flags */ |
|---|
| 473 | | - __le32 s_start; /* start sector no of partition */ |
|---|
| 474 | | - __le32 s_size; /* # of blocks in partition */ |
|---|
| 475 | | -}; |
|---|
| 476 | | - |
|---|
| 477 | | -struct solaris_x86_vtoc { |
|---|
| 478 | | - unsigned int v_bootinfo[3]; /* info needed by mboot (unsupported) */ |
|---|
| 479 | | - __le32 v_sanity; /* to verify vtoc sanity */ |
|---|
| 480 | | - __le32 v_version; /* layout version */ |
|---|
| 481 | | - char v_volume[8]; /* volume name */ |
|---|
| 482 | | - __le16 v_sectorsz; /* sector size in bytes */ |
|---|
| 483 | | - __le16 v_nparts; /* number of partitions */ |
|---|
| 484 | | - unsigned int v_reserved[10]; /* free space */ |
|---|
| 485 | | - struct solaris_x86_slice |
|---|
| 486 | | - v_slice[SOLARIS_X86_NUMSLICE]; /* slice headers */ |
|---|
| 487 | | - unsigned int timestamp[SOLARIS_X86_NUMSLICE]; /* timestamp (unsupported) */ |
|---|
| 488 | | - char v_asciilabel[128]; /* for compatibility */ |
|---|
| 489 | | -}; |
|---|
| 490 | | - |
|---|
| 491 | | -#endif /* CONFIG_SOLARIS_X86_PARTITION */ |
|---|
| 492 | | - |
|---|
| 493 | | -#ifdef CONFIG_BSD_DISKLABEL |
|---|
| 494 | | -/* |
|---|
| 495 | | - * BSD disklabel support by Yossi Gottlieb <yogo@math.tau.ac.il> |
|---|
| 496 | | - * updated by Marc Espie <Marc.Espie@openbsd.org> |
|---|
| 497 | | - */ |
|---|
| 498 | | - |
|---|
| 499 | | -/* check against BSD src/sys/sys/disklabel.h for consistency */ |
|---|
| 500 | | - |
|---|
| 501 | | -#define BSD_DISKMAGIC (0x82564557UL) /* The disk magic number */ |
|---|
| 502 | | -#define BSD_MAXPARTITIONS 16 |
|---|
| 503 | | -#define OPENBSD_MAXPARTITIONS 16 |
|---|
| 504 | | -#define BSD_FS_UNUSED 0 /* disklabel unused partition entry ID */ |
|---|
| 505 | | -struct bsd_disklabel { |
|---|
| 506 | | - __le32 d_magic; /* the magic number */ |
|---|
| 507 | | - __s16 d_type; /* drive type */ |
|---|
| 508 | | - __s16 d_subtype; /* controller/d_type specific */ |
|---|
| 509 | | - char d_typename[16]; /* type name, e.g. "eagle" */ |
|---|
| 510 | | - char d_packname[16]; /* pack identifier */ |
|---|
| 511 | | - __u32 d_secsize; /* # of bytes per sector */ |
|---|
| 512 | | - __u32 d_nsectors; /* # of data sectors per track */ |
|---|
| 513 | | - __u32 d_ntracks; /* # of tracks per cylinder */ |
|---|
| 514 | | - __u32 d_ncylinders; /* # of data cylinders per unit */ |
|---|
| 515 | | - __u32 d_secpercyl; /* # of data sectors per cylinder */ |
|---|
| 516 | | - __u32 d_secperunit; /* # of data sectors per unit */ |
|---|
| 517 | | - __u16 d_sparespertrack; /* # of spare sectors per track */ |
|---|
| 518 | | - __u16 d_sparespercyl; /* # of spare sectors per cylinder */ |
|---|
| 519 | | - __u32 d_acylinders; /* # of alt. cylinders per unit */ |
|---|
| 520 | | - __u16 d_rpm; /* rotational speed */ |
|---|
| 521 | | - __u16 d_interleave; /* hardware sector interleave */ |
|---|
| 522 | | - __u16 d_trackskew; /* sector 0 skew, per track */ |
|---|
| 523 | | - __u16 d_cylskew; /* sector 0 skew, per cylinder */ |
|---|
| 524 | | - __u32 d_headswitch; /* head switch time, usec */ |
|---|
| 525 | | - __u32 d_trkseek; /* track-to-track seek, usec */ |
|---|
| 526 | | - __u32 d_flags; /* generic flags */ |
|---|
| 527 | | -#define NDDATA 5 |
|---|
| 528 | | - __u32 d_drivedata[NDDATA]; /* drive-type specific information */ |
|---|
| 529 | | -#define NSPARE 5 |
|---|
| 530 | | - __u32 d_spare[NSPARE]; /* reserved for future use */ |
|---|
| 531 | | - __le32 d_magic2; /* the magic number (again) */ |
|---|
| 532 | | - __le16 d_checksum; /* xor of data incl. partitions */ |
|---|
| 533 | | - |
|---|
| 534 | | - /* filesystem and partition information: */ |
|---|
| 535 | | - __le16 d_npartitions; /* number of partitions in following */ |
|---|
| 536 | | - __le32 d_bbsize; /* size of boot area at sn0, bytes */ |
|---|
| 537 | | - __le32 d_sbsize; /* max size of fs superblock, bytes */ |
|---|
| 538 | | - struct bsd_partition { /* the partition table */ |
|---|
| 539 | | - __le32 p_size; /* number of sectors in partition */ |
|---|
| 540 | | - __le32 p_offset; /* starting sector */ |
|---|
| 541 | | - __le32 p_fsize; /* filesystem basic fragment size */ |
|---|
| 542 | | - __u8 p_fstype; /* filesystem type, see below */ |
|---|
| 543 | | - __u8 p_frag; /* filesystem fragments per block */ |
|---|
| 544 | | - __le16 p_cpg; /* filesystem cylinders per group */ |
|---|
| 545 | | - } d_partitions[BSD_MAXPARTITIONS]; /* actually may be more */ |
|---|
| 546 | | -}; |
|---|
| 547 | | - |
|---|
| 548 | | -#endif /* CONFIG_BSD_DISKLABEL */ |
|---|
| 549 | | - |
|---|
| 550 | | -#ifdef CONFIG_UNIXWARE_DISKLABEL |
|---|
| 551 | | -/* |
|---|
| 552 | | - * Unixware slices support by Andrzej Krzysztofowicz <ankry@mif.pg.gda.pl> |
|---|
| 553 | | - * and Krzysztof G. Baranowski <kgb@knm.org.pl> |
|---|
| 554 | | - */ |
|---|
| 555 | | - |
|---|
| 556 | | -#define UNIXWARE_DISKMAGIC (0xCA5E600DUL) /* The disk magic number */ |
|---|
| 557 | | -#define UNIXWARE_DISKMAGIC2 (0x600DDEEEUL) /* The slice table magic nr */ |
|---|
| 558 | | -#define UNIXWARE_NUMSLICE 16 |
|---|
| 559 | | -#define UNIXWARE_FS_UNUSED 0 /* Unused slice entry ID */ |
|---|
| 560 | | - |
|---|
| 561 | | -struct unixware_slice { |
|---|
| 562 | | - __le16 s_label; /* label */ |
|---|
| 563 | | - __le16 s_flags; /* permission flags */ |
|---|
| 564 | | - __le32 start_sect; /* starting sector */ |
|---|
| 565 | | - __le32 nr_sects; /* number of sectors in slice */ |
|---|
| 566 | | -}; |
|---|
| 567 | | - |
|---|
| 568 | | -struct unixware_disklabel { |
|---|
| 569 | | - __le32 d_type; /* drive type */ |
|---|
| 570 | | - __le32 d_magic; /* the magic number */ |
|---|
| 571 | | - __le32 d_version; /* version number */ |
|---|
| 572 | | - char d_serial[12]; /* serial number of the device */ |
|---|
| 573 | | - __le32 d_ncylinders; /* # of data cylinders per device */ |
|---|
| 574 | | - __le32 d_ntracks; /* # of tracks per cylinder */ |
|---|
| 575 | | - __le32 d_nsectors; /* # of data sectors per track */ |
|---|
| 576 | | - __le32 d_secsize; /* # of bytes per sector */ |
|---|
| 577 | | - __le32 d_part_start; /* # of first sector of this partition */ |
|---|
| 578 | | - __le32 d_unknown1[12]; /* ? */ |
|---|
| 579 | | - __le32 d_alt_tbl; /* byte offset of alternate table */ |
|---|
| 580 | | - __le32 d_alt_len; /* byte length of alternate table */ |
|---|
| 581 | | - __le32 d_phys_cyl; /* # of physical cylinders per device */ |
|---|
| 582 | | - __le32 d_phys_trk; /* # of physical tracks per cylinder */ |
|---|
| 583 | | - __le32 d_phys_sec; /* # of physical sectors per track */ |
|---|
| 584 | | - __le32 d_phys_bytes; /* # of physical bytes per sector */ |
|---|
| 585 | | - __le32 d_unknown2; /* ? */ |
|---|
| 586 | | - __le32 d_unknown3; /* ? */ |
|---|
| 587 | | - __le32 d_pad[8]; /* pad */ |
|---|
| 588 | | - |
|---|
| 589 | | - struct unixware_vtoc { |
|---|
| 590 | | - __le32 v_magic; /* the magic number */ |
|---|
| 591 | | - __le32 v_version; /* version number */ |
|---|
| 592 | | - char v_name[8]; /* volume name */ |
|---|
| 593 | | - __le16 v_nslices; /* # of slices */ |
|---|
| 594 | | - __le16 v_unknown1; /* ? */ |
|---|
| 595 | | - __le32 v_reserved[10]; /* reserved */ |
|---|
| 596 | | - struct unixware_slice |
|---|
| 597 | | - v_slice[UNIXWARE_NUMSLICE]; /* slice headers */ |
|---|
| 598 | | - } vtoc; |
|---|
| 599 | | - |
|---|
| 600 | | -}; /* 408 */ |
|---|
| 601 | | - |
|---|
| 602 | | -#endif /* CONFIG_UNIXWARE_DISKLABEL */ |
|---|
| 603 | | - |
|---|
| 604 | | -#ifdef CONFIG_MINIX_SUBPARTITION |
|---|
| 605 | | -# define MINIX_NR_SUBPARTITIONS 4 |
|---|
| 606 | | -#endif /* CONFIG_MINIX_SUBPARTITION */ |
|---|
| 607 | | - |
|---|
| 608 | | -#define ADDPART_FLAG_NONE 0 |
|---|
| 609 | | -#define ADDPART_FLAG_RAID 1 |
|---|
| 610 | | -#define ADDPART_FLAG_WHOLEDISK 2 |
|---|
| 611 | | - |
|---|
| 612 | | -extern int blk_alloc_devt(struct hd_struct *part, dev_t *devt); |
|---|
| 613 | | -extern void blk_free_devt(dev_t devt); |
|---|
| 614 | | -extern void blk_invalidate_devt(dev_t devt); |
|---|
| 615 | | -extern dev_t blk_lookup_devt(const char *name, int partno); |
|---|
| 616 | | -extern char *disk_name (struct gendisk *hd, int partno, char *buf); |
|---|
| 617 | | - |
|---|
| 618 | | -extern int disk_expand_part_tbl(struct gendisk *disk, int target); |
|---|
| 619 | | -extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); |
|---|
| 620 | | -extern int invalidate_partitions(struct gendisk *disk, struct block_device *bdev); |
|---|
| 621 | | -extern struct hd_struct * __must_check add_partition(struct gendisk *disk, |
|---|
| 622 | | - int partno, sector_t start, |
|---|
| 623 | | - sector_t len, int flags, |
|---|
| 624 | | - struct partition_meta_info |
|---|
| 625 | | - *info); |
|---|
| 626 | | -extern void __delete_partition(struct percpu_ref *); |
|---|
| 627 | | -extern void delete_partition(struct gendisk *, int); |
|---|
| 628 | | -extern void printk_all_partitions(void); |
|---|
| 353 | +int bdev_disk_changed(struct block_device *bdev, bool invalidate); |
|---|
| 354 | +int blk_add_partitions(struct gendisk *disk, struct block_device *bdev); |
|---|
| 355 | +int blk_drop_partitions(struct block_device *bdev); |
|---|
| 629 | 356 | |
|---|
| 630 | 357 | extern struct gendisk *__alloc_disk_node(int minors, int node_id); |
|---|
| 631 | 358 | extern struct kobject *get_disk_and_module(struct gendisk *disk); |
|---|
| .. | .. |
|---|
| 637 | 364 | int (*lock)(dev_t, void *), |
|---|
| 638 | 365 | void *data); |
|---|
| 639 | 366 | extern void blk_unregister_region(dev_t devt, unsigned long range); |
|---|
| 640 | | - |
|---|
| 641 | | -extern ssize_t part_size_show(struct device *dev, |
|---|
| 642 | | - struct device_attribute *attr, char *buf); |
|---|
| 643 | | -extern ssize_t part_stat_show(struct device *dev, |
|---|
| 644 | | - struct device_attribute *attr, char *buf); |
|---|
| 645 | | -extern ssize_t part_inflight_show(struct device *dev, |
|---|
| 646 | | - struct device_attribute *attr, char *buf); |
|---|
| 647 | | -#ifdef CONFIG_FAIL_MAKE_REQUEST |
|---|
| 648 | | -extern ssize_t part_fail_show(struct device *dev, |
|---|
| 649 | | - struct device_attribute *attr, char *buf); |
|---|
| 650 | | -extern ssize_t part_fail_store(struct device *dev, |
|---|
| 651 | | - struct device_attribute *attr, |
|---|
| 652 | | - const char *buf, size_t count); |
|---|
| 653 | | -#endif /* CONFIG_FAIL_MAKE_REQUEST */ |
|---|
| 654 | 367 | |
|---|
| 655 | 368 | #define alloc_disk_node(minors, node_id) \ |
|---|
| 656 | 369 | ({ \ |
|---|
| .. | .. |
|---|
| 670 | 383 | |
|---|
| 671 | 384 | #define alloc_disk(minors) alloc_disk_node(minors, NUMA_NO_NODE) |
|---|
| 672 | 385 | |
|---|
| 673 | | -static inline int hd_ref_init(struct hd_struct *part) |
|---|
| 386 | +int register_blkdev(unsigned int major, const char *name); |
|---|
| 387 | +void unregister_blkdev(unsigned int major, const char *name); |
|---|
| 388 | + |
|---|
| 389 | +void revalidate_disk_size(struct gendisk *disk, bool verbose); |
|---|
| 390 | +bool bdev_check_media_change(struct block_device *bdev); |
|---|
| 391 | +int __invalidate_device(struct block_device *bdev, bool kill_dirty); |
|---|
| 392 | +void bd_set_nr_sectors(struct block_device *bdev, sector_t sectors); |
|---|
| 393 | + |
|---|
| 394 | +/* for drivers/char/raw.c: */ |
|---|
| 395 | +int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); |
|---|
| 396 | +long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); |
|---|
| 397 | + |
|---|
| 398 | +#ifdef CONFIG_SYSFS |
|---|
| 399 | +int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk); |
|---|
| 400 | +void bd_unlink_disk_holder(struct block_device *bdev, struct gendisk *disk); |
|---|
| 401 | +#else |
|---|
| 402 | +static inline int bd_link_disk_holder(struct block_device *bdev, |
|---|
| 403 | + struct gendisk *disk) |
|---|
| 674 | 404 | { |
|---|
| 675 | | - if (percpu_ref_init(&part->ref, __delete_partition, 0, |
|---|
| 676 | | - GFP_KERNEL)) |
|---|
| 677 | | - return -ENOMEM; |
|---|
| 678 | 405 | return 0; |
|---|
| 679 | 406 | } |
|---|
| 680 | | - |
|---|
| 681 | | -static inline void hd_struct_get(struct hd_struct *part) |
|---|
| 407 | +static inline void bd_unlink_disk_holder(struct block_device *bdev, |
|---|
| 408 | + struct gendisk *disk) |
|---|
| 682 | 409 | { |
|---|
| 683 | | - percpu_ref_get(&part->ref); |
|---|
| 684 | 410 | } |
|---|
| 411 | +#endif /* CONFIG_SYSFS */ |
|---|
| 685 | 412 | |
|---|
| 686 | | -static inline int hd_struct_try_get(struct hd_struct *part) |
|---|
| 687 | | -{ |
|---|
| 688 | | - return percpu_ref_tryget_live(&part->ref); |
|---|
| 689 | | -} |
|---|
| 690 | | - |
|---|
| 691 | | -static inline void hd_struct_put(struct hd_struct *part) |
|---|
| 692 | | -{ |
|---|
| 693 | | - percpu_ref_put(&part->ref); |
|---|
| 694 | | -} |
|---|
| 695 | | - |
|---|
| 696 | | -static inline void hd_struct_kill(struct hd_struct *part) |
|---|
| 697 | | -{ |
|---|
| 698 | | - percpu_ref_kill(&part->ref); |
|---|
| 699 | | -} |
|---|
| 700 | | - |
|---|
| 701 | | -static inline void hd_free_part(struct hd_struct *part) |
|---|
| 702 | | -{ |
|---|
| 703 | | - free_part_stats(part); |
|---|
| 704 | | - free_part_info(part); |
|---|
| 705 | | - percpu_ref_exit(&part->ref); |
|---|
| 706 | | -} |
|---|
| 707 | | - |
|---|
| 708 | | -/* |
|---|
| 709 | | - * Any access of part->nr_sects which is not protected by partition |
|---|
| 710 | | - * bd_mutex or gendisk bdev bd_mutex, should be done using this |
|---|
| 711 | | - * accessor function. |
|---|
| 712 | | - * |
|---|
| 713 | | - * Code written along the lines of i_size_read() and i_size_write(). |
|---|
| 714 | | - * CONFIG_PREEMPT case optimizes the case of UP kernel with preemption |
|---|
| 715 | | - * on. |
|---|
| 716 | | - */ |
|---|
| 717 | | -static inline sector_t part_nr_sects_read(struct hd_struct *part) |
|---|
| 718 | | -{ |
|---|
| 719 | | -#if BITS_PER_LONG==32 && defined(CONFIG_LBDAF) && defined(CONFIG_SMP) |
|---|
| 720 | | - sector_t nr_sects; |
|---|
| 721 | | - unsigned seq; |
|---|
| 722 | | - do { |
|---|
| 723 | | - seq = read_seqcount_begin(&part->nr_sects_seq); |
|---|
| 724 | | - nr_sects = part->nr_sects; |
|---|
| 725 | | - } while (read_seqcount_retry(&part->nr_sects_seq, seq)); |
|---|
| 726 | | - return nr_sects; |
|---|
| 727 | | -#elif BITS_PER_LONG==32 && defined(CONFIG_LBDAF) && defined(CONFIG_PREEMPT) |
|---|
| 728 | | - sector_t nr_sects; |
|---|
| 729 | | - |
|---|
| 730 | | - preempt_disable(); |
|---|
| 731 | | - nr_sects = part->nr_sects; |
|---|
| 732 | | - preempt_enable(); |
|---|
| 733 | | - return nr_sects; |
|---|
| 734 | | -#else |
|---|
| 735 | | - return part->nr_sects; |
|---|
| 736 | | -#endif |
|---|
| 737 | | -} |
|---|
| 738 | | - |
|---|
| 739 | | -/* |
|---|
| 740 | | - * Should be called with mutex lock held (typically bd_mutex) of partition |
|---|
| 741 | | - * to provide mutual exlusion among writers otherwise seqcount might be |
|---|
| 742 | | - * left in wrong state leaving the readers spinning infinitely. |
|---|
| 743 | | - */ |
|---|
| 744 | | -static inline void part_nr_sects_write(struct hd_struct *part, sector_t size) |
|---|
| 745 | | -{ |
|---|
| 746 | | -#if BITS_PER_LONG==32 && defined(CONFIG_LBDAF) && defined(CONFIG_SMP) |
|---|
| 747 | | - preempt_disable(); |
|---|
| 748 | | - write_seqcount_begin(&part->nr_sects_seq); |
|---|
| 749 | | - part->nr_sects = size; |
|---|
| 750 | | - write_seqcount_end(&part->nr_sects_seq); |
|---|
| 751 | | - preempt_enable(); |
|---|
| 752 | | -#elif BITS_PER_LONG==32 && defined(CONFIG_LBDAF) && defined(CONFIG_PREEMPT) |
|---|
| 753 | | - preempt_disable(); |
|---|
| 754 | | - part->nr_sects = size; |
|---|
| 755 | | - preempt_enable(); |
|---|
| 756 | | -#else |
|---|
| 757 | | - part->nr_sects = size; |
|---|
| 758 | | -#endif |
|---|
| 759 | | -} |
|---|
| 760 | | - |
|---|
| 761 | | -#if defined(CONFIG_BLK_DEV_INTEGRITY) |
|---|
| 762 | | -extern void blk_integrity_add(struct gendisk *); |
|---|
| 763 | | -extern void blk_integrity_del(struct gendisk *); |
|---|
| 764 | | -#else /* CONFIG_BLK_DEV_INTEGRITY */ |
|---|
| 765 | | -static inline void blk_integrity_add(struct gendisk *disk) { } |
|---|
| 766 | | -static inline void blk_integrity_del(struct gendisk *disk) { } |
|---|
| 767 | | -#endif /* CONFIG_BLK_DEV_INTEGRITY */ |
|---|
| 768 | | - |
|---|
| 413 | +#ifdef CONFIG_BLOCK |
|---|
| 414 | +void printk_all_partitions(void); |
|---|
| 415 | +dev_t blk_lookup_devt(const char *name, int partno); |
|---|
| 769 | 416 | #else /* CONFIG_BLOCK */ |
|---|
| 770 | | - |
|---|
| 771 | | -static inline void printk_all_partitions(void) { } |
|---|
| 772 | | - |
|---|
| 417 | +static inline void printk_all_partitions(void) |
|---|
| 418 | +{ |
|---|
| 419 | +} |
|---|
| 773 | 420 | static inline dev_t blk_lookup_devt(const char *name, int partno) |
|---|
| 774 | 421 | { |
|---|
| 775 | 422 | dev_t devt = MKDEV(0, 0); |
|---|