scsi: replace the fmode_t argument to scsi_cmd_allowed with a simple bool
[linux-2.6-microblaze.git] / drivers / scsi / scsi_ioctl.c
index e3b31d3..dda5468 100644 (file)
@@ -248,7 +248,7 @@ static int scsi_send_start_stop(struct scsi_device *sdev, int data)
  * Only a subset of commands are allowed for unprivileged users. Commands used
  * to format the media, update the firmware, etc. are not permitted.
  */
-bool scsi_cmd_allowed(unsigned char *cmd, fmode_t mode)
+bool scsi_cmd_allowed(unsigned char *cmd, bool open_for_write)
 {
        /* root can do any command. */
        if (capable(CAP_SYS_RAWIO))
@@ -338,7 +338,7 @@ bool scsi_cmd_allowed(unsigned char *cmd, fmode_t mode)
        case GPCMD_SET_READ_AHEAD:
        /* ZBC */
        case ZBC_OUT:
-               return (mode & FMODE_WRITE);
+               return open_for_write;
        default:
                return false;
        }
@@ -354,7 +354,7 @@ static int scsi_fill_sghdr_rq(struct scsi_device *sdev, struct request *rq,
                return -EMSGSIZE;
        if (copy_from_user(scmd->cmnd, hdr->cmdp, hdr->cmd_len))
                return -EFAULT;
-       if (!scsi_cmd_allowed(scmd->cmnd, mode))
+       if (!scsi_cmd_allowed(scmd->cmnd, mode & FMODE_WRITE))
                return -EPERM;
        scmd->cmd_len = hdr->cmd_len;
 
@@ -554,7 +554,7 @@ static int sg_scsi_ioctl(struct request_queue *q, fmode_t mode,
                goto error;
 
        err = -EPERM;
-       if (!scsi_cmd_allowed(scmd->cmnd, mode))
+       if (!scsi_cmd_allowed(scmd->cmnd, mode & FMODE_WRITE))
                goto error;
 
        /* default.  possible overridden later */