mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
fuse: use boolean bit-fields in struct fuse_copy_state
Refactor struct fuse_copy_state to use boolean bit-fields to improve clarity/readability and be consistent with other fuse structs that use bit-fields for boolean state (eg fuse_fs_context, fuse_args). No functional changes. Signed-off-by: Joanne Koong <joannelkoong@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
parent
a5c4983bb9
commit
03a3617f92
3 changed files with 16 additions and 16 deletions
|
|
@ -816,7 +816,7 @@ static int unlock_request(struct fuse_req *req)
|
|||
return err;
|
||||
}
|
||||
|
||||
void fuse_copy_init(struct fuse_copy_state *cs, int write,
|
||||
void fuse_copy_init(struct fuse_copy_state *cs, bool write,
|
||||
struct iov_iter *iter)
|
||||
{
|
||||
memset(cs, 0, sizeof(*cs));
|
||||
|
|
@ -1538,7 +1538,7 @@ static ssize_t fuse_dev_read(struct kiocb *iocb, struct iov_iter *to)
|
|||
if (!user_backed_iter(to))
|
||||
return -EINVAL;
|
||||
|
||||
fuse_copy_init(&cs, 1, to);
|
||||
fuse_copy_init(&cs, true, to);
|
||||
|
||||
return fuse_dev_do_read(fud, file, &cs, iov_iter_count(to));
|
||||
}
|
||||
|
|
@ -1561,7 +1561,7 @@ static ssize_t fuse_dev_splice_read(struct file *in, loff_t *ppos,
|
|||
if (!bufs)
|
||||
return -ENOMEM;
|
||||
|
||||
fuse_copy_init(&cs, 1, NULL);
|
||||
fuse_copy_init(&cs, true, NULL);
|
||||
cs.pipebufs = bufs;
|
||||
cs.pipe = pipe;
|
||||
ret = fuse_dev_do_read(fud, in, &cs, len);
|
||||
|
|
@ -2038,7 +2038,7 @@ static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code,
|
|||
unsigned int size, struct fuse_copy_state *cs)
|
||||
{
|
||||
/* Don't try to move pages (yet) */
|
||||
cs->move_pages = 0;
|
||||
cs->move_pages = false;
|
||||
|
||||
switch (code) {
|
||||
case FUSE_NOTIFY_POLL:
|
||||
|
|
@ -2189,7 +2189,7 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud,
|
|||
spin_unlock(&fpq->lock);
|
||||
cs->req = req;
|
||||
if (!req->args->page_replace)
|
||||
cs->move_pages = 0;
|
||||
cs->move_pages = false;
|
||||
|
||||
if (oh.error)
|
||||
err = nbytes != sizeof(oh) ? -EINVAL : 0;
|
||||
|
|
@ -2227,7 +2227,7 @@ static ssize_t fuse_dev_write(struct kiocb *iocb, struct iov_iter *from)
|
|||
if (!user_backed_iter(from))
|
||||
return -EINVAL;
|
||||
|
||||
fuse_copy_init(&cs, 0, from);
|
||||
fuse_copy_init(&cs, false, from);
|
||||
|
||||
return fuse_dev_do_write(fud, &cs, iov_iter_count(from));
|
||||
}
|
||||
|
|
@ -2301,13 +2301,13 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe,
|
|||
}
|
||||
pipe_unlock(pipe);
|
||||
|
||||
fuse_copy_init(&cs, 0, NULL);
|
||||
fuse_copy_init(&cs, false, NULL);
|
||||
cs.pipebufs = bufs;
|
||||
cs.nr_segs = nbuf;
|
||||
cs.pipe = pipe;
|
||||
|
||||
if (flags & SPLICE_F_MOVE)
|
||||
cs.move_pages = 1;
|
||||
cs.move_pages = true;
|
||||
|
||||
ret = fuse_dev_do_write(fud, &cs, len);
|
||||
|
||||
|
|
|
|||
|
|
@ -577,8 +577,8 @@ static int fuse_uring_copy_from_ring(struct fuse_ring *ring,
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
fuse_copy_init(&cs, 0, &iter);
|
||||
cs.is_uring = 1;
|
||||
fuse_copy_init(&cs, false, &iter);
|
||||
cs.is_uring = true;
|
||||
cs.req = req;
|
||||
|
||||
return fuse_copy_out_args(&cs, args, ring_in_out.payload_sz);
|
||||
|
|
@ -607,8 +607,8 @@ static int fuse_uring_args_to_ring(struct fuse_ring *ring, struct fuse_req *req,
|
|||
return err;
|
||||
}
|
||||
|
||||
fuse_copy_init(&cs, 1, &iter);
|
||||
cs.is_uring = 1;
|
||||
fuse_copy_init(&cs, true, &iter);
|
||||
cs.is_uring = true;
|
||||
cs.req = req;
|
||||
|
||||
if (num_args > 0) {
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@ struct fuse_copy_state {
|
|||
struct page *pg;
|
||||
unsigned int len;
|
||||
unsigned int offset;
|
||||
unsigned int write:1;
|
||||
unsigned int move_pages:1;
|
||||
unsigned int is_uring:1;
|
||||
bool write:1;
|
||||
bool move_pages:1;
|
||||
bool is_uring:1;
|
||||
struct {
|
||||
unsigned int copied_sz; /* copied size into the user buffer */
|
||||
} ring;
|
||||
|
|
@ -51,7 +51,7 @@ struct fuse_req *fuse_request_find(struct fuse_pqueue *fpq, u64 unique);
|
|||
|
||||
void fuse_dev_end_requests(struct list_head *head);
|
||||
|
||||
void fuse_copy_init(struct fuse_copy_state *cs, int write,
|
||||
void fuse_copy_init(struct fuse_copy_state *cs, bool write,
|
||||
struct iov_iter *iter);
|
||||
int fuse_copy_args(struct fuse_copy_state *cs, unsigned int numargs,
|
||||
unsigned int argpages, struct fuse_arg *args,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue