2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
5 This program can be distributed under the terms of the GNU LGPLv2.
6 See the file COPYING.LIB
10 #include "fuse_lowlevel.h"
16 int fuse_session_loop(struct fuse_session
*se
)
19 struct fuse_chan
*ch
= fuse_session_next_chan(se
, NULL
);
20 size_t bufsize
= fuse_chan_bufsize(ch
);
21 char *buf
= (char *) malloc(bufsize
);
23 fprintf(stderr
, "fuse: failed to allocate read buffer\n");
27 while (!fuse_session_exited(se
)) {
28 struct fuse_chan
*tmpch
= ch
;
29 res
= fuse_chan_recv(&tmpch
, buf
, bufsize
);
34 fuse_session_process(se
, buf
, res
, tmpch
);
38 fuse_session_reset(se
);
39 return res
< 0 ? -1 : 0;