2025-01-20 02:28:54 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0
|
|
|
|
*
|
|
|
|
* FUSE: Filesystem in Userspace
|
|
|
|
* Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu>
|
|
|
|
*/
|
|
|
|
#ifndef _FS_FUSE_DEV_I_H
|
|
|
|
#define _FS_FUSE_DEV_I_H
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
|
|
|
|
2025-01-20 02:28:56 +01:00
|
|
|
/* Ordinary requests have even IDs, while interrupts IDs are odd */
|
|
|
|
#define FUSE_INT_REQ_BIT (1ULL << 0)
|
|
|
|
#define FUSE_REQ_ID_STEP (1ULL << 1)
|
|
|
|
|
2025-01-20 02:29:00 +01:00
|
|
|
struct fuse_arg;
|
|
|
|
struct fuse_args;
|
2025-01-20 02:29:02 +01:00
|
|
|
struct fuse_pqueue;
|
|
|
|
struct fuse_req;
|
2025-01-20 02:29:05 +01:00
|
|
|
struct fuse_iqueue;
|
|
|
|
struct fuse_forget_link;
|
2025-01-20 02:29:00 +01:00
|
|
|
|
|
|
|
struct fuse_copy_state {
|
|
|
|
struct fuse_req *req;
|
|
|
|
struct iov_iter *iter;
|
|
|
|
struct pipe_buffer *pipebufs;
|
|
|
|
struct pipe_buffer *currbuf;
|
|
|
|
struct pipe_inode_info *pipe;
|
|
|
|
unsigned long nr_segs;
|
|
|
|
struct page *pg;
|
|
|
|
unsigned int len;
|
|
|
|
unsigned int offset;
|
2025-02-20 12:16:59 -08:00
|
|
|
bool write:1;
|
2025-05-12 15:58:30 -07:00
|
|
|
bool move_folios:1;
|
2025-02-20 12:16:59 -08:00
|
|
|
bool is_uring:1;
|
2025-01-20 02:29:01 +01:00
|
|
|
struct {
|
|
|
|
unsigned int copied_sz; /* copied size into the user buffer */
|
|
|
|
} ring;
|
2025-01-20 02:29:00 +01:00
|
|
|
};
|
|
|
|
|
2025-01-20 02:28:55 +01:00
|
|
|
static inline struct fuse_dev *fuse_get_dev(struct file *file)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Lockless access is OK, because file->private data is set
|
|
|
|
* once during mount and is valid until the file is released.
|
|
|
|
*/
|
|
|
|
return READ_ONCE(file->private_data);
|
|
|
|
}
|
|
|
|
|
2025-01-20 02:29:02 +01:00
|
|
|
unsigned int fuse_req_hash(u64 unique);
|
|
|
|
struct fuse_req *fuse_request_find(struct fuse_pqueue *fpq, u64 unique);
|
|
|
|
|
2025-01-20 02:28:54 +01:00
|
|
|
void fuse_dev_end_requests(struct list_head *head);
|
|
|
|
|
2025-02-20 12:16:59 -08:00
|
|
|
void fuse_copy_init(struct fuse_copy_state *cs, bool write,
|
2025-01-20 02:29:00 +01:00
|
|
|
struct iov_iter *iter);
|
|
|
|
int fuse_copy_args(struct fuse_copy_state *cs, unsigned int numargs,
|
|
|
|
unsigned int argpages, struct fuse_arg *args,
|
|
|
|
int zeroing);
|
|
|
|
int fuse_copy_out_args(struct fuse_copy_state *cs, struct fuse_args *args,
|
|
|
|
unsigned int nbytes);
|
2025-01-20 02:29:05 +01:00
|
|
|
void fuse_dev_queue_forget(struct fuse_iqueue *fiq,
|
|
|
|
struct fuse_forget_link *forget);
|
|
|
|
void fuse_dev_queue_interrupt(struct fuse_iqueue *fiq, struct fuse_req *req);
|
2025-03-25 18:29:31 +01:00
|
|
|
bool fuse_remove_pending_req(struct fuse_req *req, spinlock_t *lock);
|
2025-01-20 02:29:00 +01:00
|
|
|
|
2025-01-22 13:55:27 -08:00
|
|
|
bool fuse_request_expired(struct fuse_conn *fc, struct list_head *list);
|
|
|
|
|
2025-01-20 02:28:54 +01:00
|
|
|
#endif
|
|
|
|
|