summaryrefslogtreecommitdiff
path: root/drivers/scsi/scsi_bsg.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2023-06-08 13:02:48 +0200
committerJens Axboe <axboe@kernel.dk>2023-06-12 08:04:04 -0600
commit1991299e49fa58c3ba7e91599932f84bf537d592 (patch)
treeed6f82a882837186dab69dc19d83bab2408150c1 /drivers/scsi/scsi_bsg.c
parent2e80089c18241699c41d0af0669cb93844ff0dc1 (diff)
downloadlwn-1991299e49fa58c3ba7e91599932f84bf537d592.tar.gz
lwn-1991299e49fa58c3ba7e91599932f84bf537d592.zip
scsi: replace the fmode_t argument to ->sg_io_fn with a simple bool
Instead of passing a fmode_t and only checking it for FMODE_WRITE, pass a bool open_for_write to prepare for callers that won't have the fmode_t. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Acked-by: Christian Brauner <brauner@kernel.org> Link: https://lore.kernel.org/r/20230608110258.189493-21-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/scsi/scsi_bsg.c')
-rw-r--r--drivers/scsi/scsi_bsg.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_bsg.c b/drivers/scsi/scsi_bsg.c
index 12431f35f861..a9a9ec086a7e 100644
--- a/drivers/scsi/scsi_bsg.c
+++ b/drivers/scsi/scsi_bsg.c
@@ -10,7 +10,7 @@
#define uptr64(val) ((void __user *)(uintptr_t)(val))
static int scsi_bsg_sg_io_fn(struct request_queue *q, struct sg_io_v4 *hdr,
- fmode_t mode, unsigned int timeout)
+ bool open_for_write, unsigned int timeout)
{
struct scsi_cmnd *scmd;
struct request *rq;
@@ -42,7 +42,7 @@ static int scsi_bsg_sg_io_fn(struct request_queue *q, struct sg_io_v4 *hdr,
if (copy_from_user(scmd->cmnd, uptr64(hdr->request), scmd->cmd_len))
goto out_put_request;
ret = -EPERM;
- if (!scsi_cmd_allowed(scmd->cmnd, mode & FMODE_WRITE))
+ if (!scsi_cmd_allowed(scmd->cmnd, open_for_write))
goto out_put_request;
ret = 0;