aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorAdel Gadllah <adel.gadllah@gmail.com>2008-06-26 07:48:27 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-07-03 07:21:14 -0400
commit0b07de85a76e1346e675f0e98437378932473df7 (patch)
treeb86e5e0be27679c408ab525534c76162754129b9 /include/linux
parent6e2401ad6f33de15ff00f78b88159f00a14f3b35 (diff)
allow userspace to modify scsi command filter on per device basis
This patch exports the per-gendisk command filter to user space through sysfs, so it can be changed by the system administrator. All users of the old cmd filter have been converted to use the new one. Original patch from Peter Jones. Signed-off-by: Adel Gadllah <adel.gadllah@gmail.com> Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/blkdev.h10
-rw-r--r--include/linux/genhd.h9
2 files changed, 18 insertions, 1 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index d3ae9ad97213..a842b776d099 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -671,7 +671,6 @@ extern int blk_execute_rq(struct request_queue *, struct gendisk *,
671 struct request *, int); 671 struct request *, int);
672extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, 672extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
673 struct request *, int, rq_end_io_fn *); 673 struct request *, int, rq_end_io_fn *);
674extern int blk_verify_command(unsigned char *, int);
675extern void blk_unplug(struct request_queue *q); 674extern void blk_unplug(struct request_queue *q);
676 675
677static inline struct request_queue *bdev_get_queue(struct block_device *bdev) 676static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
@@ -797,6 +796,15 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
797 796
798extern int blkdev_issue_flush(struct block_device *, sector_t *); 797extern int blkdev_issue_flush(struct block_device *, sector_t *);
799 798
799/*
800* command filter functions
801*/
802extern int blk_verify_command(struct file *file, unsigned char *cmd);
803extern int blk_cmd_filter_verify_command(struct blk_scsi_cmd_filter *filter,
804 unsigned char *cmd, mode_t *f_mode);
805extern int blk_register_filter(struct gendisk *disk);
806extern void blk_unregister_filter(struct gendisk *disk);
807
800#define MAX_PHYS_SEGMENTS 128 808#define MAX_PHYS_SEGMENTS 128
801#define MAX_HW_SEGMENTS 128 809#define MAX_HW_SEGMENTS 128
802#define SAFE_MAX_SECTORS 255 810#define SAFE_MAX_SECTORS 255
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 524ec96f5a23..e8787417f65a 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -110,6 +110,14 @@ struct hd_struct {
110#define GENHD_FL_SUPPRESS_PARTITION_INFO 32 110#define GENHD_FL_SUPPRESS_PARTITION_INFO 32
111#define GENHD_FL_FAIL 64 111#define GENHD_FL_FAIL 64
112 112
113#define BLK_SCSI_MAX_CMDS (256)
114#define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8))
115
116struct blk_scsi_cmd_filter {
117 unsigned long read_ok[BLK_SCSI_CMD_PER_LONG];
118 unsigned long write_ok[BLK_SCSI_CMD_PER_LONG];
119 struct kobject kobj;
120};
113 121
114struct gendisk { 122struct gendisk {
115 int major; /* major number of driver */ 123 int major; /* major number of driver */
@@ -120,6 +128,7 @@ struct gendisk {
120 struct hd_struct **part; /* [indexed by minor] */ 128 struct hd_struct **part; /* [indexed by minor] */
121 struct block_device_operations *fops; 129 struct block_device_operations *fops;
122 struct request_queue *queue; 130 struct request_queue *queue;
131 struct blk_scsi_cmd_filter cmd_filter;
123 void *private_data; 132 void *private_data;
124 sector_t capacity; 133 sector_t capacity;
125 134