summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libfuse/Makefile4
-rw-r--r--lib/libfuse/debug.c7
-rw-r--r--lib/libfuse/debug.h8
-rw-r--r--lib/libfuse/fuse.c13
4 files changed, 13 insertions, 19 deletions
diff --git a/lib/libfuse/Makefile b/lib/libfuse/Makefile
index c1233ef2873..033deee461f 100644
--- a/lib/libfuse/Makefile
+++ b/lib/libfuse/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.10 2016/09/14 06:26:02 natano Exp $
+# $OpenBSD: Makefile,v 1.11 2017/12/13 12:30:18 helg Exp $
LIB= fuse
MAN= fuse_main.3
@@ -12,7 +12,7 @@ CDIAGFLAGS+= -Wwrite-strings -Wshadow -Wpointer-arith -Wsign-compare
CDIAGFLAGS+= -Wundef -Wbad-function-cast -Winline -Wcast-align
# XXX Shouldn't we use a common fuse.h with proper ifdef _KERNEL part?
-CFLAGS+= -I${.CURDIR} -DDEBUG
+CFLAGS+= -I${.CURDIR}
SRCS= debug.c dict.c fuse.c fuse_ops.c fuse_opt.c fuse_subr.c tree.c
HDRS= fuse.h fuse_opt.h
diff --git a/lib/libfuse/debug.c b/lib/libfuse/debug.c
index e6262136451..d7829116398 100644
--- a/lib/libfuse/debug.c
+++ b/lib/libfuse/debug.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: debug.c,v 1.1 2013/06/03 16:00:50 tedu Exp $ */
+/* $OpenBSD: debug.c,v 1.2 2017/12/13 12:30:18 helg Exp $ */
/*
* Copyright (c) 2011 Alexandre Ratchov <alex@caoua.org>
*
@@ -20,7 +20,6 @@
#include "debug.h"
-#ifdef DEBUG
/*
* debug level, -1 means uninitialized
*/
@@ -31,10 +30,10 @@ ifuse_debug_init(void)
{
char *dbg;
+ /* Default to level 1 unless FUSE_DEBUG environment variable is set. */
if (ifuse_debug < 0) {
dbg = issetugid() ? NULL : getenv("FUSE_DEBUG");
if (!dbg || sscanf(dbg, "%u", &ifuse_debug) != 1)
- ifuse_debug = 0;
+ ifuse_debug = 1;
}
}
-#endif
diff --git a/lib/libfuse/debug.h b/lib/libfuse/debug.h
index 4a23e9af1b1..5869e0acf81 100644
--- a/lib/libfuse/debug.h
+++ b/lib/libfuse/debug.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: debug.h,v 1.1 2013/06/03 16:00:50 tedu Exp $ */
+/* $OpenBSD: debug.h,v 1.2 2017/12/13 12:30:18 helg Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -17,7 +17,6 @@
#ifndef _DEBUG_H_
#define _DEBUG_H_
-#ifdef DEBUG
#include <stdio.h>
#define DPRINTFN(n, ...) \
@@ -40,10 +39,5 @@
void ifuse_debug_init(void);
extern int ifuse_debug;
-#else
-#define DPRINTF(...) do {} while(0)
-#define DPRINTFN(...) do {} while(0)
-#define DPERROR(s) do {} while(0)
-#endif
#endif /* _DEBUG_H_ */
diff --git a/lib/libfuse/fuse.c b/lib/libfuse/fuse.c
index dcd4d27f738..c0a31f0c500 100644
--- a/lib/libfuse/fuse.c
+++ b/lib/libfuse/fuse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fuse.c,v 1.36 2017/11/26 15:17:17 helg Exp $ */
+/* $OpenBSD: fuse.c,v 1.37 2017/12/13 12:30:18 helg Exp $ */
/*
* Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
@@ -37,6 +37,7 @@ static struct fuse_context *ictx = NULL;
static int max_read = FUSEBUFMAXSIZE;
enum {
+ KEY_DEBUG,
KEY_FOREGROUND,
KEY_HELP,
KEY_HELP_WITHOUT_HEADER,
@@ -52,8 +53,8 @@ static struct fuse_opt fuse_core_opts[] = {
FUSE_OPT_KEY("-V", KEY_VERSION),
FUSE_OPT_KEY("--version", KEY_VERSION),
FUSE_OPT_KEY("max_read=", KEY_MAXREAD),
- FUSE_OPT_KEY("debug", KEY_STUB),
- FUSE_OPT_KEY("-d", KEY_STUB),
+ FUSE_OPT_KEY("debug", KEY_DEBUG),
+ FUSE_OPT_KEY("-d", KEY_DEBUG),
FUSE_OPT_KEY("-f", KEY_FOREGROUND),
FUSE_OPT_KEY("-s", KEY_STUB),
FUSE_OPT_KEY("use_ino", KEY_STUB),
@@ -410,6 +411,9 @@ ifuse_process_opt(void *data, const char *arg, int key,
switch (key) {
case KEY_STUB:
return (0);
+ case KEY_DEBUG:
+ ifuse_debug_init();
+ /* falls through */
case KEY_FOREGROUND:
opt->foreground = 1;
return (0);
@@ -468,9 +472,6 @@ fuse_parse_cmdline(struct fuse_args *args, char **mp, int *mt, int *fg)
{
struct fuse_core_opt opt;
-#ifdef DEBUG
- ifuse_debug_init();
-#endif
bzero(&opt, sizeof(opt));
if (fuse_opt_parse(args, &opt, fuse_core_opts, ifuse_process_opt) == -1)
return (-1);