Only use fuse_set_log_func() for libfuse >= 3.7
This commit is contained in:
parent
edd4276633
commit
b5772cef91
@ -169,6 +169,15 @@ int xfuse_path_in_xfuse_fs(const char *path)
|
|||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
|
||||||
|
/* Check for FUSE features we may wish to use
|
||||||
|
*
|
||||||
|
* Note that FUSE_VERSION might be more useful for some features than
|
||||||
|
* FUSE_USE_VERSION
|
||||||
|
*/
|
||||||
|
#if FUSE_VERSION >= FUSE_MAKE_VERSION(3,7)
|
||||||
|
#define FUSE_SET_LOG_FUNC_AVAILABLE
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef EREMOTEIO
|
#ifndef EREMOTEIO
|
||||||
#define EREMOTEIO EIO
|
#define EREMOTEIO EIO
|
||||||
#endif
|
#endif
|
||||||
@ -881,6 +890,7 @@ int xfuse_file_contents_size(int stream_id, int file_size)
|
|||||||
* @param fmt Logging format string
|
* @param fmt Logging format string
|
||||||
* @param ap Arguments for above
|
* @param ap Arguments for above
|
||||||
*/
|
*/
|
||||||
|
#ifdef FUSE_SET_LOG_FUNC_AVAILABLE
|
||||||
static void
|
static void
|
||||||
xfuse_log_func(enum fuse_log_level fuse_log_level, const char *fmt, va_list ap)
|
xfuse_log_func(enum fuse_log_level fuse_log_level, const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
@ -913,17 +923,20 @@ xfuse_log_func(enum fuse_log_level fuse_log_level, const char *fmt, va_list ap)
|
|||||||
vsnprintf(msg, sizeof(msg), fmt, ap);
|
vsnprintf(msg, sizeof(msg), fmt, ap);
|
||||||
LOG(level, "%s", msg);
|
LOG(level, "%s", msg);
|
||||||
}
|
}
|
||||||
|
#endif //FUSE_SET_LOG_FUNC_AVAILABLE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize FUSE library
|
* Initialize FUSE library
|
||||||
*
|
*
|
||||||
* @return 0 on success, -1 on failure
|
* @return 0 on success, -1 on failure
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
static int xfuse_init_lib(struct fuse_args *args)
|
static int xfuse_init_lib(struct fuse_args *args)
|
||||||
{
|
{
|
||||||
int rv = -1;
|
int rv = -1;
|
||||||
|
|
||||||
|
#ifdef FUSE_SET_LOG_FUNC_AVAILABLE
|
||||||
fuse_set_log_func(xfuse_log_func);
|
fuse_set_log_func(xfuse_log_func);
|
||||||
|
#endif
|
||||||
|
|
||||||
g_se = fuse_session_new(args, &g_xfuse_ops, sizeof(g_xfuse_ops), 0);
|
g_se = fuse_session_new(args, &g_xfuse_ops, sizeof(g_xfuse_ops), 0);
|
||||||
if (g_se == NULL)
|
if (g_se == NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user