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.h37
1 files changed, 23 insertions, 14 deletions
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index a47b8025d399..1dbea0ac5693 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -10,9 +10,19 @@
10 */ 10 */
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/kdev_t.h>
13 14
14#ifdef CONFIG_BLOCK 15#ifdef CONFIG_BLOCK
15 16
17#define kobj_to_dev(k) container_of(k, struct device, kobj)
18#define dev_to_disk(device) container_of(device, struct gendisk, dev)
19#define dev_to_part(device) container_of(device, struct hd_struct, dev)
20
21extern struct device_type disk_type;
22extern struct device_type part_type;
23extern struct kobject *block_depr;
24extern struct class block_class;
25
16enum { 26enum {
17/* These three have identical behaviour; use the second one if DOS FDISK gets 27/* These three have identical behaviour; use the second one if DOS FDISK gets
18 confused about extended/logical partitions starting past cylinder 1023. */ 28 confused about extended/logical partitions starting past cylinder 1023. */
@@ -84,7 +94,7 @@ struct partition {
84struct hd_struct { 94struct hd_struct {
85 sector_t start_sect; 95 sector_t start_sect;
86 sector_t nr_sects; 96 sector_t nr_sects;
87 struct kobject kobj; 97 struct device dev;
88 struct kobject *holder_dir; 98 struct kobject *holder_dir;
89 unsigned ios[2], sectors[2]; /* READs and WRITEs */ 99 unsigned ios[2], sectors[2]; /* READs and WRITEs */
90 int policy, partno; 100 int policy, partno;
@@ -117,15 +127,14 @@ struct gendisk {
117 * disks that can't be partitioned. */ 127 * disks that can't be partitioned. */
118 char disk_name[32]; /* name of major driver */ 128 char disk_name[32]; /* name of major driver */
119 struct hd_struct **part; /* [indexed by minor] */ 129 struct hd_struct **part; /* [indexed by minor] */
120 int part_uevent_suppress;
121 struct block_device_operations *fops; 130 struct block_device_operations *fops;
122 struct request_queue *queue; 131 struct request_queue *queue;
123 void *private_data; 132 void *private_data;
124 sector_t capacity; 133 sector_t capacity;
125 134
126 int flags; 135 int flags;
127 struct device *driverfs_dev; 136 struct device *driverfs_dev; // FIXME: remove
128 struct kobject kobj; 137 struct device dev;
129 struct kobject *holder_dir; 138 struct kobject *holder_dir;
130 struct kobject *slave_dir; 139 struct kobject *slave_dir;
131 140
@@ -143,13 +152,6 @@ struct gendisk {
143 struct work_struct async_notify; 152 struct work_struct async_notify;
144}; 153};
145 154
146/* Structure for sysfs attributes on block devices */
147struct disk_attribute {
148 struct attribute attr;
149 ssize_t (*show)(struct gendisk *, char *);
150 ssize_t (*store)(struct gendisk *, const char *, size_t);
151};
152
153/* 155/*
154 * Macros to operate on percpu disk statistics: 156 * Macros to operate on percpu disk statistics:
155 * 157 *
@@ -411,7 +413,8 @@ struct unixware_disklabel {
411#define ADDPART_FLAG_RAID 1 413#define ADDPART_FLAG_RAID 1
412#define ADDPART_FLAG_WHOLEDISK 2 414#define ADDPART_FLAG_WHOLEDISK 2
413 415
414char *disk_name (struct gendisk *hd, int part, char *buf); 416extern dev_t blk_lookup_devt(const char *name);
417extern char *disk_name (struct gendisk *hd, int part, char *buf);
415 418
416extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); 419extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev);
417extern void add_partition(struct gendisk *, int, sector_t, sector_t, int); 420extern void add_partition(struct gendisk *, int, sector_t, sector_t, int);
@@ -423,12 +426,12 @@ extern struct gendisk *alloc_disk(int minors);
423extern struct kobject *get_disk(struct gendisk *disk); 426extern struct kobject *get_disk(struct gendisk *disk);
424extern void put_disk(struct gendisk *disk); 427extern void put_disk(struct gendisk *disk);
425extern void genhd_media_change_notify(struct gendisk *disk); 428extern void genhd_media_change_notify(struct gendisk *disk);
426extern void blk_register_region(dev_t dev, unsigned long range, 429extern void blk_register_region(dev_t devt, unsigned long range,
427 struct module *module, 430 struct module *module,
428 struct kobject *(*probe)(dev_t, int *, void *), 431 struct kobject *(*probe)(dev_t, int *, void *),
429 int (*lock)(dev_t, void *), 432 int (*lock)(dev_t, void *),
430 void *data); 433 void *data);
431extern void blk_unregister_region(dev_t dev, unsigned long range); 434extern void blk_unregister_region(dev_t devt, unsigned long range);
432 435
433static inline struct block_device *bdget_disk(struct gendisk *disk, int index) 436static inline struct block_device *bdget_disk(struct gendisk *disk, int index)
434{ 437{
@@ -441,6 +444,12 @@ static inline struct block_device *bdget_disk(struct gendisk *disk, int index)
441 444
442static inline void printk_all_partitions(void) { } 445static inline void printk_all_partitions(void) { }
443 446
447static inline dev_t blk_lookup_devt(const char *name)
448{
449 dev_t devt = MKDEV(0, 0);
450 return devt;
451}
452
444#endif /* CONFIG_BLOCK */ 453#endif /* CONFIG_BLOCK */
445 454
446#endif 455#endif