aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/genhd.h
diff options
context:
space:
mode:
authorJens Axboe <jaxboe@fusionio.com>2011-01-13 08:47:54 -0500
committerJens Axboe <jaxboe@fusionio.com>2011-01-13 08:47:54 -0500
commit81c5e2ae33c4b19e53966b427e33646bf6811830 (patch)
treea602a6dd100165c8948bfa713e6f0b422dcba5d8 /include/linux/genhd.h
parent797a455d2c682476c3797dbfecf5bf84c1e3b9d3 (diff)
parentfcc57045d53edc35bcce456e60ac4aa802712934 (diff)
Merge branch 'for-2.6.38/event-handling' into for-2.6.38/core
Diffstat (limited to 'include/linux/genhd.h')
-rw-r--r--include/linux/genhd.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 2d0468145967..c0d5f6945c1e 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -128,6 +128,11 @@ struct hd_struct {
128#define GENHD_FL_EXT_DEVT 64 /* allow extended devt */ 128#define GENHD_FL_EXT_DEVT 64 /* allow extended devt */
129#define GENHD_FL_NATIVE_CAPACITY 128 129#define GENHD_FL_NATIVE_CAPACITY 128
130 130
131enum {
132 DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */
133 DISK_EVENT_EJECT_REQUEST = 1 << 1, /* eject requested */
134};
135
131#define BLK_SCSI_MAX_CMDS (256) 136#define BLK_SCSI_MAX_CMDS (256)
132#define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) 137#define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8))
133 138
@@ -144,6 +149,8 @@ struct disk_part_tbl {
144 struct hd_struct __rcu *part[]; 149 struct hd_struct __rcu *part[];
145}; 150};
146 151
152struct disk_events;
153
147struct gendisk { 154struct gendisk {
148 /* major, first_minor and minors are input parameters only, 155 /* major, first_minor and minors are input parameters only,
149 * don't use directly. Use disk_devt() and disk_max_parts(). 156 * don't use directly. Use disk_devt() and disk_max_parts().
@@ -155,6 +162,10 @@ struct gendisk {
155 162
156 char disk_name[DISK_NAME_LEN]; /* name of major driver */ 163 char disk_name[DISK_NAME_LEN]; /* name of major driver */
157 char *(*devnode)(struct gendisk *gd, mode_t *mode); 164 char *(*devnode)(struct gendisk *gd, mode_t *mode);
165
166 unsigned int events; /* supported events */
167 unsigned int async_events; /* async events, subset of all */
168
158 /* Array of pointers to partitions indexed by partno. 169 /* Array of pointers to partitions indexed by partno.
159 * Protected with matching bdev lock but stat and other 170 * Protected with matching bdev lock but stat and other
160 * non-critical accesses use RCU. Always access through 171 * non-critical accesses use RCU. Always access through
@@ -172,9 +183,8 @@ struct gendisk {
172 struct kobject *slave_dir; 183 struct kobject *slave_dir;
173 184
174 struct timer_rand_state *random; 185 struct timer_rand_state *random;
175
176 atomic_t sync_io; /* RAID */ 186 atomic_t sync_io; /* RAID */
177 struct work_struct async_notify; 187 struct disk_events *ev;
178#ifdef CONFIG_BLK_DEV_INTEGRITY 188#ifdef CONFIG_BLK_DEV_INTEGRITY
179 struct blk_integrity *integrity; 189 struct blk_integrity *integrity;
180#endif 190#endif
@@ -396,7 +406,6 @@ extern void part_round_stats(int cpu, struct hd_struct *part);
396/* block/genhd.c */ 406/* block/genhd.c */
397extern void add_disk(struct gendisk *disk); 407extern void add_disk(struct gendisk *disk);
398extern void del_gendisk(struct gendisk *gp); 408extern void del_gendisk(struct gendisk *gp);
399extern void unlink_gendisk(struct gendisk *gp);
400extern struct gendisk *get_gendisk(dev_t dev, int *partno); 409extern struct gendisk *get_gendisk(dev_t dev, int *partno);
401extern struct block_device *bdget_disk(struct gendisk *disk, int partno); 410extern struct block_device *bdget_disk(struct gendisk *disk, int partno);
402 411
@@ -408,6 +417,11 @@ static inline int get_disk_ro(struct gendisk *disk)
408 return disk->part0.policy; 417 return disk->part0.policy;
409} 418}
410 419
420extern void disk_block_events(struct gendisk *disk);
421extern void disk_unblock_events(struct gendisk *disk);
422extern void disk_check_events(struct gendisk *disk);
423extern unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask);
424
411/* drivers/char/random.c */ 425/* drivers/char/random.c */
412extern void add_disk_randomness(struct gendisk *disk); 426extern void add_disk_randomness(struct gendisk *disk);
413extern void rand_initialize_disk(struct gendisk *disk); 427extern void rand_initialize_disk(struct gendisk *disk);