diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2010-11-08 17:11:46 +0100 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2010-11-08 17:11:46 +0100 |
commit | 4e0aea6a96146115e2fb3b8c4a4c75325ad894d7 (patch) | |
tree | ddccccd975def8b0881dbd4b219a931a03ffd227 /lib/fuse_loop.c | |
parent | 7d878eb13a9b1e0e1a428c1ead2733b8453a3bb7 (diff) |
libfuse: support zero copy writes in lowlevel interface
Add new ->write_buf() method to low level interface. This
allows passig a generic buffer, either containing a memory buffer
or a file descriptor. This allows implementing zero copy writes.
Add fuse_session_receive_buf() and fuse_session_process_buf()
which may be used in event loop implementations to replace
fuse_chan_recv() and fuse_session_process() respectively.
Diffstat (limited to 'lib/fuse_loop.c')
-rw-r--r-- | lib/fuse_loop.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/fuse_loop.c b/lib/fuse_loop.c index 104c5d4..b7b4ca4 100644 --- a/lib/fuse_loop.c +++ b/lib/fuse_loop.c @@ -25,12 +25,19 @@ int fuse_session_loop(struct fuse_session *se) while (!fuse_session_exited(se)) { struct fuse_chan *tmpch = ch; - res = fuse_chan_recv(&tmpch, buf, bufsize); + struct fuse_buf fbuf = { + .mem = buf, + .size = bufsize, + }; + + res = fuse_session_receive_buf(se, &fbuf, &tmpch); + if (res == -EINTR) continue; if (res <= 0) break; - fuse_session_process(se, buf, res, tmpch); + + fuse_session_process_buf(se, &fbuf, tmpch); } free(buf); |