Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/librefuse Implement some missing functions that are part...



details:   https://anonhg.NetBSD.org/src/rev/9810b75e5b2c
branches:  trunk
changeset: 359768:9810b75e5b2c
user:      pho <pho%NetBSD.org@localhost>
date:      Sat Jan 22 08:03:32 2022 +0000

description:
Implement some missing functions that are part of the API

diffstat:

 lib/librefuse/fuse.h          |  35 +++++++++++++++++++++++++---
 lib/librefuse/fuse_lowlevel.h |   7 ++++-
 lib/librefuse/refuse.c        |  53 +++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 88 insertions(+), 7 deletions(-)

diffs (175 lines):

diff -r 6e811f92b232 -r 9810b75e5b2c lib/librefuse/fuse.h
--- a/lib/librefuse/fuse.h      Sat Jan 22 08:02:49 2022 +0000
+++ b/lib/librefuse/fuse.h      Sat Jan 22 08:03:32 2022 +0000
@@ -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 *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 @@
 /* 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 @@
  * 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 @@
 #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
 }
diff -r 6e811f92b232 -r 9810b75e5b2c lib/librefuse/fuse_lowlevel.h
--- a/lib/librefuse/fuse_lowlevel.h     Sat Jan 22 08:02:49 2022 +0000
+++ b/lib/librefuse/fuse_lowlevel.h     Sat Jan 22 08:03:32 2022 +0000
@@ -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 @@
 };
 
 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
diff -r 6e811f92b232 -r 9810b75e5b2c lib/librefuse/refuse.c
--- a/lib/librefuse/refuse.c    Sat Jan 22 08:02:49 2022 +0000
+++ b/lib/librefuse/refuse.c    Sat Jan 22 08:03:32 2022 +0000
@@ -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 @@
        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 @@
        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



Home | Main Index | Thread Index | Old Index