* add mntfromname parameter to puffs_init()

* set it in file servers
This commit is contained in:
pooka 2007-07-17 11:34:51 +00:00
parent 0450206384
commit 08db7d7534
11 changed files with 53 additions and 39 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: puffs.c,v 1.57 2007/07/14 16:02:14 dsl Exp $ */
/* $NetBSD: puffs.c,v 1.58 2007/07/17 11:34:51 pooka Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
__RCSID("$NetBSD: puffs.c,v 1.57 2007/07/14 16:02:14 dsl Exp $");
__RCSID("$NetBSD: puffs.c,v 1.58 2007/07/17 11:34:51 pooka Exp $");
#endif /* !lint */
#include <sys/param.h>
@ -42,6 +42,7 @@ __RCSID("$NetBSD: puffs.c,v 1.57 2007/07/14 16:02:14 dsl Exp $");
#include <errno.h>
#include <fcntl.h>
#include <mntopts.h>
#include <paths.h>
#include <puffs.h>
#include <stdio.h>
#include <stdlib.h>
@ -326,8 +327,8 @@ puffs_mount(struct puffs_usermount *pu, const char *dir, int mntflags,
}
struct puffs_usermount *
_puffs_init(int develv, struct puffs_ops *pops, const char *puffsname,
void *priv, uint32_t pflags)
_puffs_init(int develv, struct puffs_ops *pops, const char *mntfromname,
const char *puffsname, void *priv, uint32_t pflags)
{
struct puffs_usermount *pu;
struct puffs_kargs *pargs;
@ -340,9 +341,9 @@ _puffs_init(int develv, struct puffs_ops *pops, const char *puffsname,
return NULL;
}
fd = open("/dev/puffs", O_RDONLY);
fd = open(_PATH_PUFFS, O_RDONLY);
if (fd == -1) {
warnx("puffs_init: cannot open /dev/puffs");
warnx("puffs_init: cannot open %s", _PATH_PUFFS);
return NULL;
}
if (fd <= 2)
@ -359,7 +360,10 @@ _puffs_init(int develv, struct puffs_ops *pops, const char *puffsname,
pargs->pa_flags = PUFFS_FLAG_KERN(pflags);
pargs->pa_fd = fd;
fillvnopmask(pops, pargs->pa_vnopmask);
(void)strlcpy(pargs->pa_name, puffsname, sizeof(pargs->pa_name));
(void)strlcpy(pargs->pa_typename, puffsname,
sizeof(pargs->pa_typename));
(void)strlcpy(pargs->pa_mntfromname, mntfromname,
sizeof(pargs->pa_mntfromname));
puffs_zerostatvfs(&pargs->pa_svfsb);
pargs->pa_root_cookie = NULL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: puffs.h,v 1.74 2007/07/09 09:28:48 pooka Exp $ */
/* $NetBSD: puffs.h,v 1.75 2007/07/17 11:34:52 pooka Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@ -386,8 +386,8 @@ enum {
PUFFSOP_PROTOS(puffs_null) /* XXX */
#define PUFFS_DEVEL_LIBVERSION 24
#define puffs_init(a,b,c,d) \
_puffs_init(PUFFS_DEVEL_LIBVERSION,a,b,c,d)
#define puffs_init(a,b,c,d,e) \
_puffs_init(PUFFS_DEVEL_LIBVERSION,a,b,c,d,e)
#define PNPATH(pnode) ((pnode)->pn_po.po_path)
@ -429,8 +429,8 @@ typedef void (*puffs_framev_cb)(struct puffs_usermount *,
__BEGIN_DECLS
struct puffs_usermount *_puffs_init(int, struct puffs_ops *pops, const char *,
void *, uint32_t);
struct puffs_usermount *_puffs_init(int, struct puffs_ops *, const char *,
const char *, void *, uint32_t);
int puffs_mount(struct puffs_usermount *, const char *, int, void*);
int puffs_exit(struct puffs_usermount *, int);
int puffs_mainloop(struct puffs_usermount *, int);

View File

@ -1,4 +1,4 @@
/* $NetBSD: refuse.c,v 1.71 2007/07/01 18:40:16 pooka Exp $ */
/* $NetBSD: refuse.c,v 1.72 2007/07/17 11:34:53 pooka Exp $ */
/*
* Copyright © 2007 Alistair Crooks. All rights reserved.
@ -30,13 +30,14 @@
#include <sys/cdefs.h>
#if !defined(lint)
__RCSID("$NetBSD: refuse.c,v 1.71 2007/07/01 18:40:16 pooka Exp $");
__RCSID("$NetBSD: refuse.c,v 1.72 2007/07/17 11:34:53 pooka Exp $");
#endif /* !lint */
#include <assert.h>
#include <err.h>
#include <errno.h>
#include <fuse.h>
#include <paths.h>
#include <unistd.h>
#ifdef MULTITHREADED_REFUSE
#include <pthread.h>
@ -1334,7 +1335,7 @@ fuse_new(struct fuse_chan *fc, struct fuse_args *args,
set_refuse_mount_name(&argv0, name, sizeof(name));
puffs_fakecc = 1; /* XXX */
pu = puffs_init(pops, name, fuse,
pu = puffs_init(pops, _PATH_PUFFS, name, fuse,
PUFFS_FLAG_BUILDPATH
| PUFFS_FLAG_HASHPATH
| PUFFS_FLAG_OPDUMP

View File

@ -1,4 +1,4 @@
/* $NetBSD: dtfs.c,v 1.29 2007/07/01 22:59:09 pooka Exp $ */
/* $NetBSD: dtfs.c,v 1.30 2007/07/17 11:34:54 pooka Exp $ */
/*
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
@ -35,6 +35,7 @@
#include <err.h>
#include <mntopts.h>
#include <paths.h>
#include <puffs.h>
#include <signal.h>
#include <stdio.h>
@ -60,8 +61,9 @@ static void
usage()
{
errx(1, "usage: %s [-bsdft] [-c hashbuckets] [-o mntopt] "
"[-o puffsopt]\n [-r rootnodetype] mountpath", getprogname());
errx(1, "usage: %s [-bsdft] [-c hashbuckets] [-n typename] "
"[-o mntopt]\n [-o puffsopt] [-r rootnodetype] mountpath",
getprogname());
}
/*
@ -109,6 +111,7 @@ main(int argc, char *argv[])
struct puffs_pathobj *po_root;
struct puffs_ops *pops;
struct timespec ts;
const char *typename;
char *rtstr;
mntoptparse_t mp;
int pflags, lflags, mntflags;
@ -121,7 +124,8 @@ main(int argc, char *argv[])
lflags = mntflags = 0;
khashbuckets = 256;
pflags = PUFFS_KFLAG_IAONDEMAND;
while ((ch = getopt(argc, argv, "bc:dfio:r:st")) != -1) {
typename = FSNAME;
while ((ch = getopt(argc, argv, "bc:dfin:o:r:st")) != -1) {
switch (ch) {
case 'b': /* build paths, for debugging the feature */
pflags |= PUFFS_FLAG_BUILDPATH;
@ -138,6 +142,9 @@ main(int argc, char *argv[])
case 'i':
pflags &= ~PUFFS_KFLAG_IAONDEMAND;
break;
case 'n':
typename = optarg;
break;
case 'o':
mp = getmntopts(optarg, puffsmopts, &mntflags, &pflags);
if (mp == NULL)
@ -196,7 +203,7 @@ main(int argc, char *argv[])
srandom(time(NULL)); /* for random generation numbers */
pu = puffs_init(pops, FSNAME, &gdtm, pflags);
pu = puffs_init(pops, _PATH_PUFFS, typename, &gdtm, pflags);
if (pu == NULL)
err(1, "init");
gpu = pu;

View File

@ -1,4 +1,4 @@
/* $NetBSD: icfs.c,v 1.4 2007/06/24 22:18:38 pooka Exp $ */
/* $NetBSD: icfs.c,v 1.5 2007/07/17 11:34:54 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -192,7 +192,7 @@ main(int argc, char *argv[])
PUFFSOP_SET(pops, ic, node, readdir);
if ((pu = puffs_init(pops, "ic", NULL, pflags)) == NULL)
if ((pu = puffs_init(pops, argv[0], "ic", NULL, pflags)) == NULL)
err(1, "mount");
pn_root = puffs_pn_new(pu, NULL);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pnullfs.c,v 1.12 2007/06/24 18:43:30 pooka Exp $ */
/* $NetBSD: pnullfs.c,v 1.13 2007/07/17 11:34:54 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -94,7 +94,7 @@ main(int argc, char *argv[])
PUFFSOP_INIT(pops);
puffs_null_setops(pops);
if ((pu = puffs_init(pops, "pnullfs", NULL, pflags)) == NULL)
if ((pu = puffs_init(pops, argv[0], "pnullfs", NULL, pflags)) == NULL)
err(1, "init");
pn_root = puffs_pn_new(pu, NULL);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rot13fs.c,v 1.11 2007/06/24 18:59:27 pooka Exp $ */
/* $NetBSD: rot13fs.c,v 1.12 2007/07/17 11:34:54 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -149,7 +149,7 @@ main(int argc, char *argv[])
PUFFSOP_SET(pops, rot13, node, read);
PUFFSOP_SET(pops, rot13, node, write);
if ((pu = puffs_init(pops, "rot13", NULL, pflags)) == NULL)
if ((pu = puffs_init(pops, argv[0], "rot13", NULL, pflags)) == NULL)
err(1, "mount");
pn_root = puffs_pn_new(pu, NULL);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysctlfs.c,v 1.27 2007/07/01 18:40:16 pooka Exp $ */
/* $NetBSD: sysctlfs.c,v 1.28 2007/07/17 11:34:54 pooka Exp $ */
/*
* Copyright (c) 2006, 2007 Antti Kantee. All Rights Reserved.
@ -38,6 +38,7 @@
#include <err.h>
#include <errno.h>
#include <mntopts.h>
#include <paths.h>
#include <puffs.h>
#include <stdlib.h>
#include <string.h>
@ -258,7 +259,7 @@ main(int argc, char *argv[])
PUFFSOP_SET(pops, sysctlfs, node, write);
PUFFSOP_SET(pops, puffs_genfs, node, reclaim);
pu = puffs_init(pops, argv[0], NULL, pflags);
pu = puffs_init(pops, _PATH_PUFFS, argv[0], NULL, pflags);
if (pu == NULL)
err(1, "puffs_init");

View File

@ -1,4 +1,4 @@
/* $NetBSD: ninepuffs.c,v 1.15 2007/07/17 10:06:04 pooka Exp $ */
/* $NetBSD: ninepuffs.c,v 1.16 2007/07/17 11:34:53 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: ninepuffs.c,v 1.15 2007/07/17 10:06:04 pooka Exp $");
__RCSID("$NetBSD: ninepuffs.c,v 1.16 2007/07/17 11:34:53 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
@ -169,7 +169,7 @@ main(int argc, char *argv[])
PUFFSOP_SET(pops, puffs9p, node, mknod);
#endif
pu = puffs_init(pops, "9p", &p9p, pflags);
pu = puffs_init(pops, argv[0], "9p", &p9p, pflags);
if (pu == NULL)
err(1, "puffs_init");

View File

@ -1,4 +1,4 @@
/* $NetBSD: puffs_portal.c,v 1.5 2007/07/09 09:28:21 pooka Exp $ */
/* $NetBSD: puffs_portal.c,v 1.6 2007/07/17 11:34:53 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -33,6 +33,7 @@
#include <err.h>
#include <errno.h>
#include <mntopts.h>
#include <paths.h>
#include <puffs.h>
#include <stdio.h>
#include <stdlib.h>
@ -413,7 +414,7 @@ main(int argc, char *argv[])
PUFFSOP_SET(pops, portal, node, inactive);
PUFFSOP_SET(pops, portal, node, reclaim);
pu = puffs_init(pops, "portal", NULL, pflags);
pu = puffs_init(pops, _PATH_PUFFS, "portal", NULL, pflags);
if (pu == NULL)
err(1, "init");

View File

@ -1,4 +1,4 @@
/* $NetBSD: psshfs.c,v 1.32 2007/07/07 22:06:09 pooka Exp $ */
/* $NetBSD: psshfs.c,v 1.33 2007/07/17 11:34:54 pooka Exp $ */
/*
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
@ -41,7 +41,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: psshfs.c,v 1.32 2007/07/07 22:06:09 pooka Exp $");
__RCSID("$NetBSD: psshfs.c,v 1.33 2007/07/17 11:34:54 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
@ -171,6 +171,10 @@ main(int argc, char *argv[])
PUFFSOP_SET(pops, psshfs, node, write);
PUFFSOP_SET(pops, psshfs, node, reclaim);
pu = puffs_init(pops, argv[0], "psshfs", &pctx, pflags);
if (pu == NULL)
err(1, "puffs_init");
memset(&pctx, 0, sizeof(pctx));
pctx.mounttime = time(NULL);
@ -185,10 +189,6 @@ main(int argc, char *argv[])
add_ssharg(&sshargs, &nargs, argv[0]);
add_ssharg(&sshargs, &nargs, "sftp");
pu = puffs_init(pops, "psshfs", &pctx, pflags);
if (pu == NULL)
err(1, "puffs_init");
pssh_connect(&pctx, sshargs);
if (puffs_setblockingmode(pu, PUFFSDEV_NONBLOCK) == -1)