1 /* SPDX-License-Identifier: GPL-2.0 2 * 3 * FUSE: Filesystem in Userspace 4 * Copyright (C) 2001-2008 Miklos Szeredi <[email protected]> 5 */ 6 #ifndef _FS_FUSE_DEV_I_H 7 #define _FS_FUSE_DEV_I_H 8 9 #include <linux/types.h> 10 11 /* Ordinary requests have even IDs, while interrupts IDs are odd */ 12 #define FUSE_INT_REQ_BIT (1ULL << 0) 13 #define FUSE_REQ_ID_STEP (1ULL << 1) 14 15 struct fuse_arg; 16 struct fuse_args; 17 18 struct fuse_copy_state { 19 int write; 20 struct fuse_req *req; 21 struct iov_iter *iter; 22 struct pipe_buffer *pipebufs; 23 struct pipe_buffer *currbuf; 24 struct pipe_inode_info *pipe; 25 unsigned long nr_segs; 26 struct page *pg; 27 unsigned int len; 28 unsigned int offset; 29 unsigned int move_pages:1; 30 unsigned int is_uring:1; 31 struct { 32 unsigned int copied_sz; /* copied size into the user buffer */ 33 } ring; 34 }; 35 36 static inline struct fuse_dev *fuse_get_dev(struct file *file) 37 { 38 /* 39 * Lockless access is OK, because file->private data is set 40 * once during mount and is valid until the file is released. 41 */ 42 return READ_ONCE(file->private_data); 43 } 44 45 void fuse_dev_end_requests(struct list_head *head); 46 47 void fuse_copy_init(struct fuse_copy_state *cs, int write, 48 struct iov_iter *iter); 49 int fuse_copy_args(struct fuse_copy_state *cs, unsigned int numargs, 50 unsigned int argpages, struct fuse_arg *args, 51 int zeroing); 52 int fuse_copy_out_args(struct fuse_copy_state *cs, struct fuse_args *args, 53 unsigned int nbytes); 54 55 #endif 56 57