Module Name: src Committed By: pho Date: Sat Jan 22 08:03:32 UTC 2022
Modified Files: src/lib/librefuse: fuse.h fuse_lowlevel.h refuse.c Log Message: Implement some missing functions that are part of the API To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/lib/librefuse/fuse.h cvs rdiff -u -r1.1 -r1.2 src/lib/librefuse/fuse_lowlevel.h cvs rdiff -u -r1.110 -r1.111 src/lib/librefuse/refuse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/librefuse/fuse.h diff -u src/lib/librefuse/fuse.h:1.31 src/lib/librefuse/fuse.h:1.32 --- src/lib/librefuse/fuse.h:1.31 Sat Jan 22 08:02:49 2022 +++ src/lib/librefuse/fuse.h Sat Jan 22 08:03:32 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: fuse.h,v 1.31 2022/01/22 08:02:49 pho Exp $ */ +/* $NetBSD: fuse.h,v 1.32 2022/01/22 08:03:32 pho Exp $ */ /* * Copyright © 2007 Alistair Crooks. All rights reserved. @@ -195,8 +195,6 @@ struct fuse_operations { struct fuse *fuse_new(struct fuse_args *, const struct fuse_operations *, size_t, void *); -/* Invalidate cache for a given path. Appeared on FUSE 3.2. */ -int fuse_invalidate_path(struct fuse *fuse, const char *path); int fuse_mount(struct fuse *, const char *); void fuse_unmount(struct fuse *); @@ -205,9 +203,12 @@ int fuse_main_real(int, char **, const s /* Functions that have existed since the beginning and have never * changed between API versions. */ int fuse_loop(struct fuse *); -struct fuse_context *fuse_get_context(void); void fuse_exit(struct fuse *); void fuse_destroy(struct fuse *); +struct fuse_context *fuse_get_context(void); + +/* Print available library options. Appeared on FUSE 3.1. */ +void fuse_lib_help(struct fuse_args *args); /* Daemonize the calling process. Appeared on FUSE 2.6. * @@ -215,6 +216,13 @@ void fuse_destroy(struct fuse *); * the time when FUSE_H_ < 20211204. */ int fuse_daemonize(int foreground) __RENAME(fuse_daemonize_rev1); +/* Check if a request has been interrupted. Appeared on FUSE 2.6. */ +int fuse_interrupted(void); + +/* Invalidate cache for a given path. Appeared on FUSE 3.2. */ +int fuse_invalidate_path(struct fuse *fuse, const char *path); + +/* Get the version number of the library. Appeared on FUSE 2.7. */ int fuse_version(void); #if FUSE_USE_VERSION == 22 @@ -230,6 +238,25 @@ void fuse_unmount_compat22(const char *) #define fuse_main(argc, argv, op) \ fuse_main_real(argc, argv, op, sizeof(*(op)), NULL) #endif +/* Get the version string of the library. Appeared on FUSE 3.0. */ +const char *fuse_pkgversion(void); + +/* Get the current supplementary group IDs for the current request, or + * return -errno on failure. Appeared on FUSE 2.8. */ +int fuse_getgroups(int size, gid_t list[]); + +/* Start the cleanup thread when using option "-oremember". Appeared + * on FUSE 2.9. */ +int fuse_start_cleanup_thread(struct fuse *fuse); + +/* Stop the cleanup thread when using "-oremember". Appeared on FUSE + * 2.9. */ +void fuse_stop_cleanup_thread(struct fuse *fuse); + +/* Iterate over cache removing stale entries, used in conjunction with + * "-oremember". Return the number of seconds until the next + * cleanup. Appeared on FUSE 2.9. */ +int fuse_clean_cache(struct fuse *fuse); #ifdef __cplusplus } Index: src/lib/librefuse/fuse_lowlevel.h diff -u src/lib/librefuse/fuse_lowlevel.h:1.1 src/lib/librefuse/fuse_lowlevel.h:1.2 --- src/lib/librefuse/fuse_lowlevel.h:1.1 Sun Nov 20 13:26:28 2016 +++ src/lib/librefuse/fuse_lowlevel.h Sat Jan 22 08:03:32 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: fuse_lowlevel.h,v 1.1 2016/11/20 13:26:28 pho Exp $ */ +/* $NetBSD: fuse_lowlevel.h,v 1.2 2022/01/22 08:03:32 pho Exp $ */ /* * Copyright (c) 2016 The NetBSD Foundation, Inc. @@ -49,7 +49,12 @@ struct fuse_cmdline_opts { }; int fuse_parse_cmdline(struct fuse_args *args, struct fuse_cmdline_opts *opts); +/* Print low-level version information to stdout. Appeared on FUSE + * 3.0. */ void fuse_lowlevel_version(void); + +/* Print available options for fuse_parse_cmdline(). Appeared on FUSE + * 3.0. */ void fuse_cmdline_help(void); #ifdef __cplusplus Index: src/lib/librefuse/refuse.c diff -u src/lib/librefuse/refuse.c:1.110 src/lib/librefuse/refuse.c:1.111 --- src/lib/librefuse/refuse.c:1.110 Sat Jan 22 08:02:49 2022 +++ src/lib/librefuse/refuse.c Sat Jan 22 08:03:32 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: refuse.c,v 1.110 2022/01/22 08:02:49 pho Exp $ */ +/* $NetBSD: refuse.c,v 1.111 2022/01/22 08:03:32 pho Exp $ */ /* * Copyright © 2007 Alistair Crooks. All rights reserved. @@ -31,7 +31,7 @@ #include <sys/cdefs.h> #if !defined(lint) -__RCSID("$NetBSD: refuse.c,v 1.110 2022/01/22 08:02:49 pho Exp $"); +__RCSID("$NetBSD: refuse.c,v 1.111 2022/01/22 08:03:32 pho Exp $"); #endif /* !lint */ #include <sys/types.h> @@ -1414,6 +1414,20 @@ fuse_unmount_compat22(const char *mp) return; } +void +fuse_lib_help(struct fuse_args *args __attribute__((__unused__))) +{ + fuse_cmdline_help(); +} + +int +fuse_interrupted(void) +{ + /* ReFUSE doesn't support request interruption at the + * moment. */ + return 0; +} + int fuse_invalidate_path(struct fuse *fuse __attribute__((__unused__)), const char *path __attribute__((__unused__))) @@ -1429,6 +1443,41 @@ fuse_version(void) return _REFUSE_VERSION_; } +const char * +fuse_pkgversion(void) +{ + return "ReFUSE " ___STRING(_REFUSE_MAJOR_VERSION_) + "." ___STRING(_REFUSE_MINOR_VERSION_); +} + +int +fuse_getgroups(int size, gid_t list[]) +{ + /* XXX: In order to implement this, we need to save a pointer + * to struct puffs_cred in struct fuse upon entering a puffs + * callback, and set it back to NULL upon leaving it. Then we + * can use puffs_cred_getgroups(3) here. */ + return -ENOSYS; +} + +int +fuse_start_cleanup_thread(struct fuse *fuse) +{ + /* XXX: ReFUSE doesn't support -oremember at the moment. */ + return 0; +} + +void +fuse_stop_cleanup_thread(struct fuse *fuse) { + /* XXX: ReFUSE doesn't support -oremember at the moment. */ +} + +int +fuse_clean_cache(struct fuse *fuse) { + /* XXX: ReFUSE doesn't support -oremember at the moment. */ + return 3600; +} + /* This is a legacy function that has been removed from the FUSE API, * but is defined here because it needs to access refuse_opts. */ int