Add support for more detailed error codes from main loop

This commit is contained in:
Nikolaus Rath 2016-11-16 12:41:41 -08:00
parent 2e6cd2d425
commit c22da7f3a8
7 changed files with 15 additions and 5 deletions

View File

@ -7,6 +7,10 @@ UNRELEASED CHANGES
* Added documentation for FUSE_CAP_FLOCK_LOCKS.
* fuse_loop(), fuse_loop_mt(), fuse_session_loop() and
fuse_session_loop_mt() now return -errno instead of -1 in case of
failure.
FUSE 3.0.0-rc2 (2016-11-06)
===========================

View File

@ -828,7 +828,7 @@ void fuse_destroy(struct fuse *f);
* operations are called.
*
* @param f the FUSE handle
* @return 0 if no error occurred, -1 otherwise
* @return 0 if no error occurred, -errno otherwise
*
* See also: fuse_loop()
*/
@ -871,7 +871,7 @@ void fuse_exit(struct fuse *f);
* @param f the FUSE handle
* @param clone_fd whether to use separate device fds for each thread
* (may increase performance)
* @return 0 if no error occurred, -1 otherwise
* @return 0 if no error occurred, -errno otherwise
*
* See also: fuse_loop()
*/

View File

@ -1783,7 +1783,7 @@ int fuse_session_mount(struct fuse_session *se, const char *mountpoint);
* fuse_set_signal_handlers() first.
*
* @param se the session
* @return 0 on success, -1 on error
* @return 0 on success, -errno on failure
*/
int fuse_session_loop(struct fuse_session *se);
@ -1793,7 +1793,7 @@ int fuse_session_loop(struct fuse_session *se);
* @param se the session
* @param clone_fd whether to use separate device fds for each thread
* (may increase performance)
* @return 0 on success, -1 on error
* @return 0 on success, -errno on failure
*/
int fuse_session_loop_mt(struct fuse_session *se, int clone_fd);

View File

@ -63,6 +63,7 @@ struct fuse_session {
uint64_t notify_ctr;
struct fuse_notify_req notify_list;
size_t bufsize;
int error;
};
struct fuse_chan {

View File

@ -35,6 +35,8 @@ int fuse_session_loop(struct fuse_session *se)
}
free(fbuf.mem);
if(se->error != 0)
res = se->error;
fuse_session_reset(se);
return res < 0 ? -1 : 0;
return res;
}

View File

@ -339,6 +339,8 @@ int fuse_session_loop_mt(struct fuse_session *se, int clone_fd)
pthread_mutex_destroy(&mt.lock);
sem_destroy(&mt.finish);
if(se->error != 0)
err = se->error;
fuse_session_reset(se);
return err;
}

View File

@ -2940,6 +2940,7 @@ void fuse_session_exit(struct fuse_session *se)
void fuse_session_reset(struct fuse_session *se)
{
se->exited = 0;
se->error = 0;
}
int fuse_session_exited(struct fuse_session *se)