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 }; 31 32 static inline struct fuse_dev *fuse_get_dev(struct file *file) 33 { 34 /* 35 * Lockless access is OK, because file->private data is set 36 * once during mount and is valid until the file is released. 37 */ 38 return READ_ONCE(file->private_data); 39 } 40 41 void fuse_dev_end_requests(struct list_head *head); 42 43 void fuse_copy_init(struct fuse_copy_state *cs, int write, 44 struct iov_iter *iter); 45 int fuse_copy_args(struct fuse_copy_state *cs, unsigned int numargs, 46 unsigned int argpages, struct fuse_arg *args, 47 int zeroing); 48 int fuse_copy_out_args(struct fuse_copy_state *cs, struct fuse_args *args, 49 unsigned int nbytes); 50 51 #endif 52 53