Source-Changes-HG archive

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

[src/trunk]: src/lib/libpuffs Make it possible to supply parameters to puffs_...



details:   https://anonhg.NetBSD.org/src/rev/ab9ae5965e98
branches:  trunk
changeset: 748261:ab9ae5965e98
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sun Oct 18 19:09:20 2009 +0000

description:
Make it possible to supply parameters to puffs_init() later (but
before puffs_mount()).

diffstat:

 lib/libpuffs/puffs.c |  28 ++++++++++++++++++++++------
 lib/libpuffs/puffs.h |   5 ++++-
 2 files changed, 26 insertions(+), 7 deletions(-)

diffs (89 lines):

diff -r e34a7f175731 -r ab9ae5965e98 lib/libpuffs/puffs.c
--- a/lib/libpuffs/puffs.c      Sun Oct 18 18:23:29 2009 +0000
+++ b/lib/libpuffs/puffs.c      Sun Oct 18 19:09:20 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffs.c,v 1.99 2009/10/17 23:19:52 pooka Exp $ */
+/*     $NetBSD: puffs.c,v 1.100 2009/10/18 19:09:20 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.99 2009/10/17 23:19:52 pooka Exp $");
+__RCSID("$NetBSD: puffs.c,v 1.100 2009/10/18 19:09:20 pooka Exp $");
 #endif /* !lint */
 
 #include <sys/param.h>
@@ -276,6 +276,18 @@
        pu->pu_privdata = privdata;
 }
 
+void
+puffs_setmntinfo(struct puffs_usermount *pu,
+       const char *mntfromname, const char *puffsname)
+{
+       struct puffs_kargs *pargs = pu->pu_kargp;
+
+       (void)strlcpy(pargs->pa_mntfromname, mntfromname,
+           sizeof(pargs->pa_mntfromname));
+       (void)strlcpy(pargs->pa_typename, puffsname,
+           sizeof(pargs->pa_typename));
+}
+
 size_t
 puffs_getmaxreqlen(struct puffs_usermount *pu)
 {
@@ -596,6 +608,13 @@
        struct puffs_kargs *pargs;
        int sverrno;
 
+       if (puffsname == PUFFS_DEFER)
+               puffsname = "n/a";
+       if (mntfromname == PUFFS_DEFER)
+               mntfromname = "n/a";
+       if (priv == PUFFS_DEFER)
+               priv = NULL;
+
        pu = malloc(sizeof(struct puffs_usermount));
        if (pu == NULL)
                goto failfree;
@@ -609,10 +628,7 @@
        pargs->pa_vers = PUFFSDEVELVERS | PUFFSVERSION;
        pargs->pa_flags = PUFFS_FLAG_KERN(pflags);
        fillvnopmask(pops, pargs->pa_vnopmask);
-       (void)strlcpy(pargs->pa_typename, puffsname,
-           sizeof(pargs->pa_typename));
-       (void)strlcpy(pargs->pa_mntfromname, mntfromname,
-           sizeof(pargs->pa_mntfromname));
+       puffs_setmntinfo(pu, mntfromname, puffsname);
 
        puffs_zerostatvfs(&pargs->pa_svfsb);
        pargs->pa_root_cookie = NULL;
diff -r e34a7f175731 -r ab9ae5965e98 lib/libpuffs/puffs.h
--- a/lib/libpuffs/puffs.h      Sun Oct 18 18:23:29 2009 +0000
+++ b/lib/libpuffs/puffs.h      Sun Oct 18 19:09:20 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffs.h,v 1.111 2009/10/17 23:19:52 pooka Exp $        */
+/*     $NetBSD: puffs.h,v 1.112 2009/10/18 19:09:20 pooka Exp $        */
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -418,6 +418,7 @@
 
 __BEGIN_DECLS
 
+#define PUFFS_DEFER ((void *)-1)
 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*);
@@ -446,6 +447,8 @@
 void                   puffs_setmaxreqlen(struct puffs_usermount *, size_t);
 size_t                 puffs_getmaxreqlen(struct puffs_usermount *);
 void                   puffs_setfhsize(struct puffs_usermount *, size_t, int);
+void                   puffs_setmntinfo(struct puffs_usermount *,
+                                        const char *, const char *);
 
 void                   puffs_setncookiehash(struct puffs_usermount *, int);
 



Home | Main Index | Thread Index | Old Index