diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2008-09-02 15:28:45 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-10-21 07:47:06 -0400 |
commit | aeb5d727062a0238a2f96c9c380fbd2be4640c6f (patch) | |
tree | 51dae8a071fcf42e4431a66d37c5b843c8e99cf6 /block | |
parent | 2515ddc6db8eb49a79f0fe5e67ff09ac7c81eab4 (diff) |
[PATCH] introduce fmode_t, do annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'block')
-rw-r--r-- | block/bsg.c | 7 | ||||
-rw-r--r-- | block/cmd-filter.c | 2 | ||||
-rw-r--r-- | block/scsi_ioctl.c | 5 |
3 files changed, 8 insertions, 6 deletions
diff --git a/block/bsg.c b/block/bsg.c index 034112bfe1f3..2d36b127f384 100644 --- a/block/bsg.c +++ b/block/bsg.c | |||
@@ -173,7 +173,7 @@ unlock: | |||
173 | 173 | ||
174 | static int blk_fill_sgv4_hdr_rq(struct request_queue *q, struct request *rq, | 174 | static int blk_fill_sgv4_hdr_rq(struct request_queue *q, struct request *rq, |
175 | struct sg_io_v4 *hdr, struct bsg_device *bd, | 175 | struct sg_io_v4 *hdr, struct bsg_device *bd, |
176 | int has_write_perm) | 176 | fmode_t has_write_perm) |
177 | { | 177 | { |
178 | if (hdr->request_len > BLK_MAX_CDB) { | 178 | if (hdr->request_len > BLK_MAX_CDB) { |
179 | rq->cmd = kzalloc(hdr->request_len, GFP_KERNEL); | 179 | rq->cmd = kzalloc(hdr->request_len, GFP_KERNEL); |
@@ -242,7 +242,7 @@ bsg_validate_sgv4_hdr(struct request_queue *q, struct sg_io_v4 *hdr, int *rw) | |||
242 | * map sg_io_v4 to a request. | 242 | * map sg_io_v4 to a request. |
243 | */ | 243 | */ |
244 | static struct request * | 244 | static struct request * |
245 | bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, int has_write_perm) | 245 | bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm) |
246 | { | 246 | { |
247 | struct request_queue *q = bd->queue; | 247 | struct request_queue *q = bd->queue; |
248 | struct request *rq, *next_rq = NULL; | 248 | struct request *rq, *next_rq = NULL; |
@@ -601,7 +601,8 @@ bsg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
601 | } | 601 | } |
602 | 602 | ||
603 | static int __bsg_write(struct bsg_device *bd, const char __user *buf, | 603 | static int __bsg_write(struct bsg_device *bd, const char __user *buf, |
604 | size_t count, ssize_t *bytes_written, int has_write_perm) | 604 | size_t count, ssize_t *bytes_written, |
605 | fmode_t has_write_perm) | ||
605 | { | 606 | { |
606 | struct bsg_command *bc; | 607 | struct bsg_command *bc; |
607 | struct request *rq; | 608 | struct request *rq; |
diff --git a/block/cmd-filter.c b/block/cmd-filter.c index e669aed4c6bc..504b275e1b90 100644 --- a/block/cmd-filter.c +++ b/block/cmd-filter.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/cdrom.h> | 27 | #include <linux/cdrom.h> |
28 | 28 | ||
29 | int blk_verify_command(struct blk_cmd_filter *filter, | 29 | int blk_verify_command(struct blk_cmd_filter *filter, |
30 | unsigned char *cmd, int has_write_perm) | 30 | unsigned char *cmd, fmode_t has_write_perm) |
31 | { | 31 | { |
32 | /* root can do any command. */ | 32 | /* root can do any command. */ |
33 | if (capable(CAP_SYS_RAWIO)) | 33 | if (capable(CAP_SYS_RAWIO)) |
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index c34272a348fe..c525905f9d35 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c | |||
@@ -384,7 +384,8 @@ int sg_scsi_ioctl(struct file *file, struct request_queue *q, | |||
384 | struct gendisk *disk, struct scsi_ioctl_command __user *sic) | 384 | struct gendisk *disk, struct scsi_ioctl_command __user *sic) |
385 | { | 385 | { |
386 | struct request *rq; | 386 | struct request *rq; |
387 | int err, write_perm = 0; | 387 | int err; |
388 | fmode_t write_perm = 0; | ||
388 | unsigned int in_len, out_len, bytes, opcode, cmdlen; | 389 | unsigned int in_len, out_len, bytes, opcode, cmdlen; |
389 | char *buffer = NULL, sense[SCSI_SENSE_BUFFERSIZE]; | 390 | char *buffer = NULL, sense[SCSI_SENSE_BUFFERSIZE]; |
390 | 391 | ||
@@ -428,7 +429,7 @@ int sg_scsi_ioctl(struct file *file, struct request_queue *q, | |||
428 | 429 | ||
429 | /* scsi_ioctl passes NULL */ | 430 | /* scsi_ioctl passes NULL */ |
430 | if (file && (file->f_mode & FMODE_WRITE)) | 431 | if (file && (file->f_mode & FMODE_WRITE)) |
431 | write_perm = 1; | 432 | write_perm = FMODE_WRITE; |
432 | 433 | ||
433 | err = blk_verify_command(&q->cmd_filter, rq->cmd, write_perm); | 434 | err = blk_verify_command(&q->cmd_filter, rq->cmd, write_perm); |
434 | if (err) | 435 | if (err) |