Detach from console by default unless P2K_DEBUG is set in the

environment.  We can't pass this as a flag, since rump_foo should
remain usage-compatible with mount_foo and therefore can't accept
puffs flags as command line parameters.
This commit is contained in:
pooka 2008-11-14 13:43:20 +00:00
parent e1623d0beb
commit 02d2ab30dc
1 changed files with 12 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: p2k.c,v 1.5 2008/10/07 23:14:58 pooka Exp $ */
/* $NetBSD: p2k.c,v 1.6 2008/11/14 13:43:20 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -144,6 +144,7 @@ p2k_run_fs(const char *vfsname, const char *devpath, const char *mountpath,
struct ukfs *ukfs;
extern int puffs_fakecc;
int rv, sverrno;
bool dodaemon;
rv = -1;
if (ukfs_init() == -1)
@ -188,10 +189,17 @@ p2k_run_fs(const char *vfsname, const char *devpath, const char *mountpath,
PUFFSOP_SET(pops, p2k, node, inactive);
PUFFSOP_SET(pops, p2k, node, reclaim);
dodaemon = true;
if (getenv("P2K_DEBUG") != NULL) {
puffs_flags |= PUFFS_FLAG_OPDUMP;
dodaemon = false;
}
strcpy(typebuf, "p2k|");
if (strcmp(vfsname, "puffs") == 0) { /* XXX */
struct puffs_kargs *args = arg;
strlcat(typebuf, args->pa_typename, sizeof(typebuf));
dodaemon = false;
} else {
strlcat(typebuf, vfsname, sizeof(typebuf));
}
@ -209,6 +217,9 @@ p2k_run_fs(const char *vfsname, const char *devpath, const char *mountpath,
puffs_set_prepost(pu, makelwp, clearlwp);
if (dodaemon)
puffs_daemon(pu, 1, 1);
if ((rv = puffs_mount(pu, mountpath, mntflags, rvp))== -1)
goto out;
rv = puffs_mainloop(pu);