diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/attribute_container.h | 12 | ||||
| -rw-r--r-- | include/linux/bio.h | 6 | ||||
| -rw-r--r-- | include/linux/blkdev.h | 10 | ||||
| -rw-r--r-- | include/linux/raid_class.h | 59 | ||||
| -rw-r--r-- | include/linux/transport_class.h | 11 |
5 files changed, 84 insertions, 14 deletions
diff --git a/include/linux/attribute_container.h b/include/linux/attribute_container.h index af1010b6dab7..93bfb0beb62a 100644 --- a/include/linux/attribute_container.h +++ b/include/linux/attribute_container.h | |||
| @@ -11,10 +11,12 @@ | |||
| 11 | 11 | ||
| 12 | #include <linux/device.h> | 12 | #include <linux/device.h> |
| 13 | #include <linux/list.h> | 13 | #include <linux/list.h> |
| 14 | #include <linux/klist.h> | ||
| 15 | #include <linux/spinlock.h> | ||
| 14 | 16 | ||
| 15 | struct attribute_container { | 17 | struct attribute_container { |
| 16 | struct list_head node; | 18 | struct list_head node; |
| 17 | struct list_head containers; | 19 | struct klist containers; |
| 18 | struct class *class; | 20 | struct class *class; |
| 19 | struct class_device_attribute **attrs; | 21 | struct class_device_attribute **attrs; |
| 20 | int (*match)(struct attribute_container *, struct device *); | 22 | int (*match)(struct attribute_container *, struct device *); |
| @@ -62,12 +64,8 @@ int attribute_container_add_class_device_adapter(struct attribute_container *con | |||
| 62 | struct class_device *classdev); | 64 | struct class_device *classdev); |
| 63 | void attribute_container_remove_attrs(struct class_device *classdev); | 65 | void attribute_container_remove_attrs(struct class_device *classdev); |
| 64 | void attribute_container_class_device_del(struct class_device *classdev); | 66 | void attribute_container_class_device_del(struct class_device *classdev); |
| 65 | 67 | struct attribute_container *attribute_container_classdev_to_container(struct class_device *); | |
| 66 | 68 | struct class_device *attribute_container_find_class_device(struct attribute_container *, struct device *); | |
| 67 | |||
| 68 | |||
| 69 | |||
| 70 | |||
| 71 | struct class_device_attribute **attribute_container_classdev_to_attrs(const struct class_device *classdev); | 69 | struct class_device_attribute **attribute_container_classdev_to_attrs(const struct class_device *classdev); |
| 72 | 70 | ||
| 73 | #endif | 71 | #endif |
diff --git a/include/linux/bio.h b/include/linux/bio.h index 69e047989f1c..cdaf03a14a51 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
| @@ -295,7 +295,13 @@ extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int); | |||
| 295 | extern int bio_get_nr_vecs(struct block_device *); | 295 | extern int bio_get_nr_vecs(struct block_device *); |
| 296 | extern struct bio *bio_map_user(struct request_queue *, struct block_device *, | 296 | extern struct bio *bio_map_user(struct request_queue *, struct block_device *, |
| 297 | unsigned long, unsigned int, int); | 297 | unsigned long, unsigned int, int); |
| 298 | struct sg_iovec; | ||
| 299 | extern struct bio *bio_map_user_iov(struct request_queue *, | ||
| 300 | struct block_device *, | ||
| 301 | struct sg_iovec *, int, int); | ||
| 298 | extern void bio_unmap_user(struct bio *); | 302 | extern void bio_unmap_user(struct bio *); |
| 303 | extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int, | ||
| 304 | unsigned int); | ||
| 299 | extern void bio_set_pages_dirty(struct bio *bio); | 305 | extern void bio_set_pages_dirty(struct bio *bio); |
| 300 | extern void bio_check_pages_dirty(struct bio *bio); | 306 | extern void bio_check_pages_dirty(struct bio *bio); |
| 301 | extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int); | 307 | extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int); |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 19bd8e7e11bf..aefa26fbae8a 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -563,10 +563,12 @@ extern void blk_sync_queue(struct request_queue *q); | |||
| 563 | extern void __blk_stop_queue(request_queue_t *q); | 563 | extern void __blk_stop_queue(request_queue_t *q); |
| 564 | extern void blk_run_queue(request_queue_t *); | 564 | extern void blk_run_queue(request_queue_t *); |
| 565 | extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *); | 565 | extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *); |
| 566 | extern struct request *blk_rq_map_user(request_queue_t *, int, void __user *, unsigned int); | 566 | extern int blk_rq_map_user(request_queue_t *, struct request *, void __user *, unsigned int); |
| 567 | extern int blk_rq_unmap_user(struct request *, struct bio *, unsigned int); | 567 | extern int blk_rq_unmap_user(struct bio *, unsigned int); |
| 568 | extern int blk_execute_rq(request_queue_t *, struct gendisk *, struct request *); | 568 | extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned int, unsigned int); |
| 569 | 569 | extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int); | |
| 570 | extern int blk_execute_rq(request_queue_t *, struct gendisk *, | ||
| 571 | struct request *, int); | ||
| 570 | static inline request_queue_t *bdev_get_queue(struct block_device *bdev) | 572 | static inline request_queue_t *bdev_get_queue(struct block_device *bdev) |
| 571 | { | 573 | { |
| 572 | return bdev->bd_disk->queue; | 574 | return bdev->bd_disk->queue; |
diff --git a/include/linux/raid_class.h b/include/linux/raid_class.h new file mode 100644 index 000000000000..a71123c28272 --- /dev/null +++ b/include/linux/raid_class.h | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | /* | ||
| 2 | */ | ||
| 3 | #include <linux/transport_class.h> | ||
| 4 | |||
| 5 | struct raid_template { | ||
| 6 | struct transport_container raid_attrs; | ||
| 7 | }; | ||
| 8 | |||
| 9 | struct raid_function_template { | ||
| 10 | void *cookie; | ||
| 11 | int (*is_raid)(struct device *); | ||
| 12 | void (*get_resync)(struct device *); | ||
| 13 | void (*get_state)(struct device *); | ||
| 14 | }; | ||
| 15 | |||
| 16 | enum raid_state { | ||
| 17 | RAID_ACTIVE = 1, | ||
| 18 | RAID_DEGRADED, | ||
| 19 | RAID_RESYNCING, | ||
| 20 | RAID_OFFLINE, | ||
| 21 | }; | ||
| 22 | |||
| 23 | struct raid_data { | ||
| 24 | struct list_head component_list; | ||
| 25 | int component_count; | ||
| 26 | int level; | ||
| 27 | enum raid_state state; | ||
| 28 | int resync; | ||
| 29 | }; | ||
| 30 | |||
| 31 | #define DEFINE_RAID_ATTRIBUTE(type, attr) \ | ||
| 32 | static inline void \ | ||
| 33 | raid_set_##attr(struct raid_template *r, struct device *dev, type value) { \ | ||
| 34 | struct class_device *cdev = \ | ||
| 35 | attribute_container_find_class_device(&r->raid_attrs.ac, dev);\ | ||
| 36 | struct raid_data *rd; \ | ||
| 37 | BUG_ON(!cdev); \ | ||
| 38 | rd = class_get_devdata(cdev); \ | ||
| 39 | rd->attr = value; \ | ||
| 40 | } \ | ||
| 41 | static inline type \ | ||
| 42 | raid_get_##attr(struct raid_template *r, struct device *dev) { \ | ||
| 43 | struct class_device *cdev = \ | ||
| 44 | attribute_container_find_class_device(&r->raid_attrs.ac, dev);\ | ||
| 45 | struct raid_data *rd; \ | ||
| 46 | BUG_ON(!cdev); \ | ||
| 47 | rd = class_get_devdata(cdev); \ | ||
| 48 | return rd->attr; \ | ||
| 49 | } | ||
| 50 | |||
| 51 | DEFINE_RAID_ATTRIBUTE(int, level) | ||
| 52 | DEFINE_RAID_ATTRIBUTE(int, resync) | ||
| 53 | DEFINE_RAID_ATTRIBUTE(enum raid_state, state) | ||
| 54 | |||
| 55 | struct raid_template *raid_class_attach(struct raid_function_template *); | ||
| 56 | void raid_class_release(struct raid_template *); | ||
| 57 | |||
| 58 | void raid_component_add(struct raid_template *, struct device *, | ||
| 59 | struct device *); | ||
diff --git a/include/linux/transport_class.h b/include/linux/transport_class.h index 87d98d1faefb..1d6cc22e5f42 100644 --- a/include/linux/transport_class.h +++ b/include/linux/transport_class.h | |||
| @@ -12,11 +12,16 @@ | |||
| 12 | #include <linux/device.h> | 12 | #include <linux/device.h> |
| 13 | #include <linux/attribute_container.h> | 13 | #include <linux/attribute_container.h> |
| 14 | 14 | ||
| 15 | struct transport_container; | ||
| 16 | |||
| 15 | struct transport_class { | 17 | struct transport_class { |
| 16 | struct class class; | 18 | struct class class; |
| 17 | int (*setup)(struct device *); | 19 | int (*setup)(struct transport_container *, struct device *, |
| 18 | int (*configure)(struct device *); | 20 | struct class_device *); |
| 19 | int (*remove)(struct device *); | 21 | int (*configure)(struct transport_container *, struct device *, |
| 22 | struct class_device *); | ||
| 23 | int (*remove)(struct transport_container *, struct device *, | ||
| 24 | struct class_device *); | ||
| 20 | }; | 25 | }; |
| 21 | 26 | ||
| 22 | #define DECLARE_TRANSPORT_CLASS(cls, nm, su, rm, cfg) \ | 27 | #define DECLARE_TRANSPORT_CLASS(cls, nm, su, rm, cfg) \ |
