Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aeb5d727 authored by Al Viro's avatar Al Viro
Browse files

[PATCH] introduce fmode_t, do annotations



Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 2515ddc6
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ static int bsg_io_schedule(struct bsg_device *bd)

static int blk_fill_sgv4_hdr_rq(struct request_queue *q, struct request *rq,
				struct sg_io_v4 *hdr, struct bsg_device *bd,
				int has_write_perm)
				fmode_t has_write_perm)
{
	if (hdr->request_len > BLK_MAX_CDB) {
		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)
 * map sg_io_v4 to a request.
 */
static struct request *
bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, int has_write_perm)
bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm)
{
	struct request_queue *q = bd->queue;
	struct request *rq, *next_rq = NULL;
@@ -601,7 +601,8 @@ bsg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
}

static int __bsg_write(struct bsg_device *bd, const char __user *buf,
		       size_t count, ssize_t *bytes_written, int has_write_perm)
		       size_t count, ssize_t *bytes_written,
		       fmode_t has_write_perm)
{
	struct bsg_command *bc;
	struct request *rq;
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@
#include <linux/cdrom.h>

int blk_verify_command(struct blk_cmd_filter *filter,
		       unsigned char *cmd, int has_write_perm)
		       unsigned char *cmd, fmode_t has_write_perm)
{
	/* root can do any command. */
	if (capable(CAP_SYS_RAWIO))
+3 −2
Original line number Diff line number Diff line
@@ -384,7 +384,8 @@ int sg_scsi_ioctl(struct file *file, struct request_queue *q,
		  struct gendisk *disk, struct scsi_ioctl_command __user *sic)
{
	struct request *rq;
	int err, write_perm = 0;
	int err;
	fmode_t write_perm = 0;
	unsigned int in_len, out_len, bytes, opcode, cmdlen;
	char *buffer = NULL, sense[SCSI_SENSE_BUFFERSIZE];

@@ -428,7 +429,7 @@ int sg_scsi_ioctl(struct file *file, struct request_queue *q,

	/* scsi_ioctl passes NULL */
	if (file && (file->f_mode & FMODE_WRITE))
		write_perm = 1;
		write_perm = FMODE_WRITE;

	err = blk_verify_command(&q->cmd_filter, rq->cmd, write_perm);
	if (err)
+2 −2
Original line number Diff line number Diff line
@@ -1560,9 +1560,9 @@ static int floppy_open(struct inode *inode, struct file *filp)
	if (fd_ref[drive] && old_dev != system)
		return -EBUSY;

	if (filp && filp->f_mode & 3) {
	if (filp && filp->f_mode & (FMODE_READ|FMODE_WRITE)) {
		check_disk_change(inode->i_bdev);
		if (filp->f_mode & 2 ) {
		if (filp->f_mode & FMODE_WRITE ) {
			int wrprot;

			get_fdc(drive);
+2 −2
Original line number Diff line number Diff line
@@ -1826,9 +1826,9 @@ static int floppy_open( struct inode *inode, struct file *filp )
	if (filp->f_flags & O_NDELAY)
		return 0;

	if (filp->f_mode & 3) {
	if (filp->f_mode & (FMODE_READ|FMODE_WRITE)) {
		check_disk_change(inode->i_bdev);
		if (filp->f_mode & 2) {
		if (filp->f_mode & FMODE_WRITE) {
			if (p->wpstat) {
				if (p->ref < 0)
					p->ref = 0;
Loading