aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-09-07 20:31:27 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-07 20:31:27 -0400
commit0481990b758628e12f4b0a9e15094e70cefc7cd1 (patch)
tree67a4b4b7acc6a688b87ef2a2d3ec0e296e6e480c /include/linux
parentdb400b3c4ee89d384d9163836a55577abdae772d (diff)
parent17fa53da1239b8712c5cebbd72a74c713b6c2db9 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-for-linus-2.6
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/attribute_container.h12
-rw-r--r--include/linux/bio.h6
-rw-r--r--include/linux/blkdev.h10
-rw-r--r--include/linux/raid_class.h59
-rw-r--r--include/linux/transport_class.h11
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
15struct attribute_container { 17struct 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);
63void attribute_container_remove_attrs(struct class_device *classdev); 65void attribute_container_remove_attrs(struct class_device *classdev);
64void attribute_container_class_device_del(struct class_device *classdev); 66void attribute_container_class_device_del(struct class_device *classdev);
65 67struct attribute_container *attribute_container_classdev_to_container(struct class_device *);
66 68struct class_device *attribute_container_find_class_device(struct attribute_container *, struct device *);
67
68
69
70
71struct class_device_attribute **attribute_container_classdev_to_attrs(const struct class_device *classdev); 69struct 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);
295extern int bio_get_nr_vecs(struct block_device *); 295extern int bio_get_nr_vecs(struct block_device *);
296extern struct bio *bio_map_user(struct request_queue *, struct block_device *, 296extern struct bio *bio_map_user(struct request_queue *, struct block_device *,
297 unsigned long, unsigned int, int); 297 unsigned long, unsigned int, int);
298struct sg_iovec;
299extern struct bio *bio_map_user_iov(struct request_queue *,
300 struct block_device *,
301 struct sg_iovec *, int, int);
298extern void bio_unmap_user(struct bio *); 302extern void bio_unmap_user(struct bio *);
303extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int,
304 unsigned int);
299extern void bio_set_pages_dirty(struct bio *bio); 305extern void bio_set_pages_dirty(struct bio *bio);
300extern void bio_check_pages_dirty(struct bio *bio); 306extern void bio_check_pages_dirty(struct bio *bio);
301extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int); 307extern 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);
563extern void __blk_stop_queue(request_queue_t *q); 563extern void __blk_stop_queue(request_queue_t *q);
564extern void blk_run_queue(request_queue_t *); 564extern void blk_run_queue(request_queue_t *);
565extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *); 565extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *);
566extern struct request *blk_rq_map_user(request_queue_t *, int, void __user *, unsigned int); 566extern int blk_rq_map_user(request_queue_t *, struct request *, void __user *, unsigned int);
567extern int blk_rq_unmap_user(struct request *, struct bio *, unsigned int); 567extern int blk_rq_unmap_user(struct bio *, unsigned int);
568extern int blk_execute_rq(request_queue_t *, struct gendisk *, struct request *); 568extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned int, unsigned int);
569 569extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int);
570extern int blk_execute_rq(request_queue_t *, struct gendisk *,
571 struct request *, int);
570static inline request_queue_t *bdev_get_queue(struct block_device *bdev) 572static 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
5struct raid_template {
6 struct transport_container raid_attrs;
7};
8
9struct 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
16enum raid_state {
17 RAID_ACTIVE = 1,
18 RAID_DEGRADED,
19 RAID_RESYNCING,
20 RAID_OFFLINE,
21};
22
23struct 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) \
32static inline void \
33raid_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} \
41static inline type \
42raid_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
51DEFINE_RAID_ATTRIBUTE(int, level)
52DEFINE_RAID_ATTRIBUTE(int, resync)
53DEFINE_RAID_ATTRIBUTE(enum raid_state, state)
54
55struct raid_template *raid_class_attach(struct raid_function_template *);
56void raid_class_release(struct raid_template *);
57
58void 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
15struct transport_container;
16
15struct transport_class { 17struct 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) \