mirror of
https://github.com/winfsp/winfsp.git
synced 2025-06-15 08:12:45 -05:00
fuse_opt: implementation checkpoint
This commit is contained in:
@ -35,6 +35,14 @@ extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define FSP_FUSE_MEMFN_P void *(*memalloc)(size_t), void (*memfree)(void *)
|
||||
#define FSP_FUSE_MEMFN_A memalloc, memfree
|
||||
#if defined(WINFSP_DLL_INTERNAL)
|
||||
#define FSP_FUSE_MEMFN_V MemAlloc, MemFree
|
||||
#else
|
||||
#define FSP_FUSE_MEMFN_V malloc, free
|
||||
#endif
|
||||
|
||||
#define FUSE_OPT_KEY(templ, key) { templ, -1U, key }
|
||||
#define FUSE_OPT_END { NULL, 0, 0 }
|
||||
|
||||
@ -63,48 +71,62 @@ typedef int (*fuse_opt_proc_t)(void *data, const char *arg, int key,
|
||||
struct fuse_args *outargs);
|
||||
|
||||
FSP_FUSE_API int fsp_fuse_opt_parse(struct fuse_args *args, void *data,
|
||||
const struct fuse_opt opts[], fuse_opt_proc_t proc);
|
||||
FSP_FUSE_API int fsp_fuse_opt_add_opt(char **opts, const char *opt);
|
||||
FSP_FUSE_API int fsp_fuse_opt_add_opt_escaped(char **opts, const char *opt);
|
||||
FSP_FUSE_API int fsp_fuse_opt_add_arg(struct fuse_args *args, const char *arg);
|
||||
FSP_FUSE_API int fsp_fuse_opt_insert_arg(struct fuse_args *args, int pos, const char *arg);
|
||||
FSP_FUSE_API void fsp_fuse_opt_free_args(struct fuse_args *args);
|
||||
FSP_FUSE_API int fsp_fuse_opt_match(const struct fuse_opt opts[], const char *opt);
|
||||
const struct fuse_opt opts[], fuse_opt_proc_t proc,
|
||||
FSP_FUSE_MEMFN_P);
|
||||
FSP_FUSE_API int fsp_fuse_opt_add_arg(struct fuse_args *args, const char *arg,
|
||||
FSP_FUSE_MEMFN_P);
|
||||
FSP_FUSE_API int fsp_fuse_opt_insert_arg(struct fuse_args *args, int pos, const char *arg,
|
||||
FSP_FUSE_MEMFN_P);
|
||||
FSP_FUSE_API void fsp_fuse_opt_free_args(struct fuse_args *args,
|
||||
FSP_FUSE_MEMFN_P);
|
||||
FSP_FUSE_API int fsp_fuse_opt_add_opt(char **opts, const char *opt,
|
||||
FSP_FUSE_MEMFN_P);
|
||||
FSP_FUSE_API int fsp_fuse_opt_add_opt_escaped(char **opts, const char *opt,
|
||||
FSP_FUSE_MEMFN_P);
|
||||
FSP_FUSE_API int fsp_fuse_opt_match(const struct fuse_opt opts[], const char *opt,
|
||||
FSP_FUSE_MEMFN_P);
|
||||
|
||||
static inline int fuse_opt_parse(struct fuse_args *args, void *data,
|
||||
const struct fuse_opt opts[], fuse_opt_proc_t proc)
|
||||
{
|
||||
return fsp_fuse_opt_parse(args, data, opts, proc);
|
||||
}
|
||||
|
||||
static inline int fuse_opt_add_opt(char **opts, const char *opt)
|
||||
{
|
||||
return fsp_fuse_opt_add_opt(opts, opt);
|
||||
}
|
||||
|
||||
static inline int fuse_opt_add_opt_escaped(char **opts, const char *opt)
|
||||
{
|
||||
return fsp_fuse_opt_add_opt_escaped(opts, opt);
|
||||
return fsp_fuse_opt_parse(args, data, opts, proc,
|
||||
FSP_FUSE_MEMFN_V);
|
||||
}
|
||||
|
||||
static inline int fuse_opt_add_arg(struct fuse_args *args, const char *arg)
|
||||
{
|
||||
return fsp_fuse_opt_add_arg(args, arg);
|
||||
return fsp_fuse_opt_add_arg(args, arg,
|
||||
FSP_FUSE_MEMFN_V);
|
||||
}
|
||||
|
||||
static inline int fuse_opt_insert_arg(struct fuse_args *args, int pos, const char *arg)
|
||||
{
|
||||
return fsp_fuse_opt_insert_arg(args, pos, arg);
|
||||
return fsp_fuse_opt_insert_arg(args, pos, arg,
|
||||
FSP_FUSE_MEMFN_V);
|
||||
}
|
||||
|
||||
static inline void fuse_opt_free_args(struct fuse_args *args)
|
||||
{
|
||||
fsp_fuse_opt_free_args(args);
|
||||
fsp_fuse_opt_free_args(args,
|
||||
FSP_FUSE_MEMFN_V);
|
||||
}
|
||||
|
||||
static inline int fuse_opt_add_opt(char **opts, const char *opt)
|
||||
{
|
||||
return fsp_fuse_opt_add_opt(opts, opt,
|
||||
FSP_FUSE_MEMFN_V);
|
||||
}
|
||||
|
||||
static inline int fuse_opt_add_opt_escaped(char **opts, const char *opt)
|
||||
{
|
||||
return fsp_fuse_opt_add_opt_escaped(opts, opt,
|
||||
FSP_FUSE_MEMFN_V);
|
||||
}
|
||||
|
||||
static inline int fuse_opt_match(const struct fuse_opt opts[], const char *opt)
|
||||
{
|
||||
return fsp_fuse_opt_match(opts, opt);
|
||||
return fsp_fuse_opt_match(opts, opt,
|
||||
FSP_FUSE_MEMFN_V);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Reference in New Issue
Block a user