Source-Changes-HG archive

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

[src/trunk]: src/lib/librefuse Support the FUSE option -ho



details:   https://anonhg.NetBSD.org/src/rev/28eb63e9be79
branches:  trunk
changeset: 359769:28eb63e9be79
user:      pho <pho%NetBSD.org@localhost>
date:      Sat Jan 22 08:05:35 2022 +0000

description:
Support the FUSE option -ho

It is supposed to print a help message without the usage
line. Although it is deprecated and has been removed as of FUSE 3.0,
filesystems in the wild still use it.

diffstat:

 lib/librefuse/fuse_internal.h   |   7 ++++++-
 lib/librefuse/refuse.c          |  20 +++++++++++++-------
 lib/librefuse/refuse_lowlevel.c |   9 +++++----
 3 files changed, 24 insertions(+), 12 deletions(-)

diffs (92 lines):

diff -r 9810b75e5b2c -r 28eb63e9be79 lib/librefuse/fuse_internal.h
--- a/lib/librefuse/fuse_internal.h     Sat Jan 22 08:03:32 2022 +0000
+++ b/lib/librefuse/fuse_internal.h     Sat Jan 22 08:05:35 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fuse_internal.h,v 1.3 2022/01/22 08:01:12 pho Exp $ */
+/* $NetBSD: fuse_internal.h,v 1.4 2022/01/22 08:05:35 pho Exp $ */
 
 /*
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -44,6 +44,11 @@
 extern "C" {
 #endif
 
+enum refuse_show_help_variant {
+       REFUSE_SHOW_HELP_FULL           = 1,
+       REFUSE_SHOW_HELP_NO_HEADER      = 2,
+};
+
 /* Internal functions, hidden from users */
 __BEGIN_HIDDEN_DECLS
 int __fuse_set_signal_handlers(struct fuse* fuse);
diff -r 9810b75e5b2c -r 28eb63e9be79 lib/librefuse/refuse.c
--- a/lib/librefuse/refuse.c    Sat Jan 22 08:03:32 2022 +0000
+++ b/lib/librefuse/refuse.c    Sat Jan 22 08:05:35 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: refuse.c,v 1.111 2022/01/22 08:03:32 pho Exp $ */
+/*     $NetBSD: refuse.c,v 1.112 2022/01/22 08:05:35 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.111 2022/01/22 08:03:32 pho Exp $");
+__RCSID("$NetBSD: refuse.c,v 1.112 2022/01/22 08:05:35 pho Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
@@ -1157,11 +1157,17 @@
        }
 
        if (opts.show_help) {
-               if (args.argv[0] != NULL && args.argv[0][0] != '\0') {
-                       /* argv[0] being empty means that the application doesn't
-                        * want us to print the usage string.
-                        */
-                       printf("Usage: %s [options] mountpoint\n\n", args.argv[0]);
+               switch (opts.show_help) {
+               case REFUSE_SHOW_HELP_FULL:
+                       if (args.argv[0] != NULL && args.argv[0][0] != '\0') {
+                               /* argv[0] being empty means that the application doesn't
+                                * want us to print the usage string.
+                                */
+                               printf("Usage: %s [options] mountpoint\n\n", args.argv[0]);
+                       }
+                       break;
+               case REFUSE_SHOW_HELP_NO_HEADER:
+                       break;
                }
                fuse_cmdline_help();
                rv = 0;
diff -r 9810b75e5b2c -r 28eb63e9be79 lib/librefuse/refuse_lowlevel.c
--- a/lib/librefuse/refuse_lowlevel.c   Sat Jan 22 08:03:32 2022 +0000
+++ b/lib/librefuse/refuse_lowlevel.c   Sat Jan 22 08:05:35 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: refuse_lowlevel.c,v 1.2 2021/12/04 06:42:39 pho Exp $  */
+/*     $NetBSD: refuse_lowlevel.c,v 1.3 2022/01/22 08:05:35 pho Exp $  */
 
 /*
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint)
-__RCSID("$NetBSD: refuse_lowlevel.c,v 1.2 2021/12/04 06:42:39 pho Exp $");
+__RCSID("$NetBSD: refuse_lowlevel.c,v 1.3 2022/01/22 08:05:35 pho Exp $");
 #endif /* !lint */
 
 #include <fuse_internal.h>
@@ -45,8 +45,9 @@
        { t, offsetof(struct fuse_cmdline_opts, p), v }
 
 static struct fuse_opt fuse_lowlevel_opts[] = {
-       REFUSE_LOWLEVEL_OPT("-h"       , show_help       , 1),
-       REFUSE_LOWLEVEL_OPT("--help"   , show_help       , 1),
+       REFUSE_LOWLEVEL_OPT("-h"       , show_help       , REFUSE_SHOW_HELP_FULL),
+       REFUSE_LOWLEVEL_OPT("--help"   , show_help       , REFUSE_SHOW_HELP_FULL),
+       REFUSE_LOWLEVEL_OPT("-ho"      , show_help       , REFUSE_SHOW_HELP_NO_HEADER),
        REFUSE_LOWLEVEL_OPT("-V"       , show_version    , 1),
        REFUSE_LOWLEVEL_OPT("--version", show_version    , 1),
        REFUSE_LOWLEVEL_OPT("-d"       , debug           , 1),



Home | Main Index | Thread Index | Old Index