From d52ae4f9d44d7e08375bfacac0bc7cc02ad1b54b Mon Sep 17 00:00:00 2001 From: Bernd Schubert Date: Wed, 28 May 2025 15:13:47 +0200 Subject: Allow applications to retrieve the req payload (io-uring only) With io-uring the req owns the payload buffer, the application can directly access it and copy data into it. fuse_buf_copy_one() already has a check for dstmem == srcmem and skips data copies. fuse_reply_data fuse_reply_data_uring fuse_buf_copy fuse_buf_copy_one Signed-off-by: Bernd Schubert --- include/fuse_lowlevel.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include') diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h index 844ee71..dc4ec07 100644 --- a/include/fuse_lowlevel.h +++ b/include/fuse_lowlevel.h @@ -2367,6 +2367,24 @@ int fuse_session_receive_buf(struct fuse_session *se, struct fuse_buf *buf); */ bool fuse_req_is_uring(fuse_req_t req); +/** + * Get the payload of a request + * (for requests submitted through fuse-io-uring only) + * + * This is useful for a file system that wants to write data directly + * to the request buffer. With io-uring the req is the buffer owner + * and the file system can write directly to the buffer and avoid + * extra copying. For example useful for network file systems. + * + * @param req the request + * @param payload pointer to the payload + * @param payload_sz size of the payload + * @param mr memory registration handle, currently unused + * @return 0 on success, -errno on failure + */ +int fuse_req_get_payload(fuse_req_t req, char **payload, size_t *payload_sz, + void **mr); + #ifdef __cplusplus } #endif -- cgit v1.2.3