-# $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
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
-/* $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>
*
#include "debug.h"
-#ifdef DEBUG
/*
* debug level, -1 means uninitialized
*/
{
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
-/* $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>
*
#ifndef _DEBUG_H_
#define _DEBUG_H_
-#ifdef DEBUG
#include <stdio.h>
#define DPRINTFN(n, ...) \
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_ */
-/* $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>
*
static int max_read = FUSEBUFMAXSIZE;
enum {
+ KEY_DEBUG,
KEY_FOREGROUND,
KEY_HELP,
KEY_HELP_WITHOUT_HEADER,
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),
switch (key) {
case KEY_STUB:
return (0);
+ case KEY_DEBUG:
+ ifuse_debug_init();
+ /* falls through */
case KEY_FOREGROUND:
opt->foreground = 1;
return (0);
{
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);