mirror of
https://github.com/openharmony/third_party_libfuse.git
synced 2026-07-19 21:43:34 -04:00
e4015aca9b
This is a code simplification patch. - It confines most of the implementation channel implementation into fuse_loop_mt (which is its only user). - It makes it more obvious in the code that channels are only ever used when using -o clone_fd and multi-threaded main loop. - It simplies the definition of both struct fuse_session and struct fuse_chan. - Theoretically it should result in (minuscule) performance improvements when not using -o clone_fd. - Overall, it removes a lot more lines of source code than it adds :-).
41 lines
770 B
C
41 lines
770 B
C
/*
|
|
FUSE: Filesystem in Userspace
|
|
Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
|
|
|
Implementation of the single-threaded FUSE session loop.
|
|
|
|
This program can be distributed under the terms of the GNU LGPLv2.
|
|
See the file COPYING.LIB
|
|
*/
|
|
|
|
#include "config.h"
|
|
#include "fuse_lowlevel.h"
|
|
#include "fuse_i.h"
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <errno.h>
|
|
|
|
int fuse_session_loop(struct fuse_session *se)
|
|
{
|
|
int res = 0;
|
|
struct fuse_buf fbuf = {
|
|
.mem = NULL,
|
|
};
|
|
|
|
while (!fuse_session_exited(se)) {
|
|
res = fuse_session_receive_buf_int(se, &fbuf, NULL);
|
|
|
|
if (res == -EINTR)
|
|
continue;
|
|
if (res <= 0)
|
|
break;
|
|
|
|
fuse_session_process_buf_int(se, &fbuf, NULL);
|
|
}
|
|
|
|
free(fbuf.mem);
|
|
fuse_session_reset(se);
|
|
return res < 0 ? -1 : 0;
|
|
}
|