Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Jul 2009 11:59:14 GMT
From:      Tatsiana Severyna <tatsianka@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 165625 for review
Message-ID:  <200907051159.n65BxEke050294@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=165625

Change 165625 by tatsianka@tatsianka_zonder on 2009/07/05 11:58:51

	Fix message park reuse big in puffs_vnop_read and puffs_vnop_write
	Clean up sources
	Merge latest changes from NetBSD

Affected files ...

.. //depot/projects/soc2009/tatsianka_puffs/libpuffs/Makefile#3 edit
.. //depot/projects/soc2009/tatsianka_puffs/libpuffs/callcontext.c#3 edit
.. //depot/projects/soc2009/tatsianka_puffs/libpuffs/framebuf.c#3 edit
.. //depot/projects/soc2009/tatsianka_puffs/libpuffs/null.c#3 edit
.. //depot/projects/soc2009/tatsianka_puffs/libpuffs/opdump.c#2 edit
.. //depot/projects/soc2009/tatsianka_puffs/libpuffs/paths.c#2 edit
.. //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs.3#2 edit
.. //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs.c#4 edit
.. //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs.h#3 edit
.. //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs_cc.3#2 edit
.. //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs_cred.3#2 edit
.. //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs_flush.3#2 edit
.. //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs_framebuf.3#2 edit
.. //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs_node.3#2 edit
.. //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs_ops.3#2 edit
.. //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs_path.3#2 edit
.. //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs_suspend.3#2 edit
.. //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffsdump.h#2 edit
.. //depot/projects/soc2009/tatsianka_puffs/libpuffs/subr.c#2 edit
.. //depot/projects/soc2009/tatsianka_puffs/puffs/puffs_msgif.c#5 edit
.. //depot/projects/soc2009/tatsianka_puffs/puffs/puffs_msgif.h#3 edit
.. //depot/projects/soc2009/tatsianka_puffs/puffs/puffs_node.c#6 edit
.. //depot/projects/soc2009/tatsianka_puffs/puffs/puffs_subr.c#5 edit
.. //depot/projects/soc2009/tatsianka_puffs/puffs/puffs_sys.h#5 edit
.. //depot/projects/soc2009/tatsianka_puffs/puffs/puffs_vfsops.c#6 edit
.. //depot/projects/soc2009/tatsianka_puffs/puffs/puffs_vnops.c#6 edit
.. //depot/projects/soc2009/tatsianka_puffs/putter/putter.c#4 edit

Differences ...

==== //depot/projects/soc2009/tatsianka_puffs/libpuffs/Makefile#3 (text+ko) ====

@@ -8,6 +8,6 @@
 		puffs_suspend.3
 INCS=		puffs.h puffsdump.h
 CFLAGS+=	-g -I${.CURDIR}/../puffs -I${.CURDIR}/../putter -I${.CURDIR} -I/usr/src/sbin/mount
-#SHLIB_MAJOR=	0
+#SHLIB_MAJOR=	1
 
 .include <bsd.lib.mk>

==== //depot/projects/soc2009/tatsianka_puffs/libpuffs/callcontext.c#3 (text+ko) ====

@@ -81,7 +81,7 @@
 	pcc->pcc_flags &= ~PCC_BORROWED;
 
 	/* romanes eunt domus */
-	DPRINTF(("puffs_cc_yield: "));
+	DPRINTF(("puffs_cc_yield: ")); 
 	if ((pcc->pcc_flags & PCC_MLCONT) == 0) {
 		DPRINTF(("no mlcont, pcc %p\n", pcc));
 		swapcontext(&pcc->pcc_uc, &pcc->pcc_uc_ret);
@@ -98,7 +98,7 @@
 
 /*
  * Internal continue routine.  This has slightly different semantics.
- * We simply make our cc available in the freelist and jump to the
+ * We simply make our cc available in the freelist and jump to the 
  * indicated pcc.
  */
 void
@@ -311,7 +311,6 @@
 {
 	struct puffs_cc *pcc;
 
-	printf("puffs__cc_exit\n");
 	while ((pcc = LIST_FIRST(&pu->pu_ccmagazin)) != NULL) {
 		LIST_REMOVE(pcc, pcc_rope);
 		cc_free(pcc);

==== //depot/projects/soc2009/tatsianka_puffs/libpuffs/framebuf.c#3 (text+ko) ====

@@ -705,14 +705,14 @@
 				}
 				continue;
 			}
-
+			
 			puffs__framebuf_moveinfo(pufbuf, appbuf);
 			puffs_framebuf_destroy(pufbuf);
 		} else {
 			appbuf = pufbuf;
 		}
 		appbuf->istat &= ~ISTAT_NODESTROY;
-
+	
 		if (appbuf->pcc) {
 			puffs__cc_cont(appbuf->pcc);
 		} else if (appbuf->fcb) {
@@ -1062,7 +1062,6 @@
 {
 	struct puffs_fctrl_io *fio;
 
-	printf("puffs__framev_exit\n");
 	while ((fio = LIST_FIRST(&pu->pu_ios)) != NULL)
 		removefio(pu, fio, ENXIO);
 	free(pu->pu_evs);

==== //depot/projects/soc2009/tatsianka_puffs/libpuffs/null.c#3 (text+ko) ====

@@ -1,4 +1,4 @@
-/*	$NetBSD: null.c,v 1.25 2008/08/12 19:44:39 pooka Exp $	*/
+/*	$NetBSD: null.c,v 1.27 2009/01/08 02:19:48 lukem Exp $	*/
 
 /*
  * Copyright (c) 2007  Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint)
-__RCSID("$NetBSD: null.c,v 1.25 2008/08/12 19:44:39 pooka Exp $");
+__RCSID("$NetBSD: null.c,v 1.27 2009/01/08 02:19:48 lukem Exp $");
 #endif /* !lint */
 
 /*
@@ -69,8 +69,8 @@
 			return errno;
 
 	/* sloppy */
-	if (va->va_atime.tv_sec != (unsigned)PUFFS_VNOVAL
-	    || va->va_mtime.tv_sec != (unsigned)PUFFS_VNOVAL) {
+	if (va->va_atime.tv_sec != (time_t)PUFFS_VNOVAL
+	    || va->va_mtime.tv_sec != (time_t)PUFFS_VNOVAL) {
 		TIMESPEC_TO_TIMEVAL(&tv[0], &va->va_atime);
 		TIMESPEC_TO_TIMEVAL(&tv[1], &va->va_mtime);
 
@@ -167,6 +167,10 @@
 	PUFFSOP_SET(pops, puffs_null, fs, statvfs);
 	PUFFSOP_SETFSNOP(pops, unmount);
 	PUFFSOP_SETFSNOP(pops, sync);
+#ifdef XXX_TS
+	PUFFSOP_SET(pops, puffs_null, fs, fhtonode);
+	PUFFSOP_SET(pops, puffs_null, fs, nodetofh);
+#endif
 
 	PUFFSOP_SET(pops, puffs_null, node, lookup);
 	PUFFSOP_SET(pops, puffs_null, node, create);
@@ -198,7 +202,102 @@
 	return 0;
 }
 
+#ifdef XXX_TS
+/*
+ * XXX: this is the stupidest crap ever, but:
+ * getfh() returns the fhandle type, when we are expected to deliver
+ * the fid type.  Just adjust it a bit and stop whining.
+ *
+ * Yes, this really really needs fixing.  Yes, *REALLY*.
+ */
+#define FHANDLE_HEADERLEN 8
+struct kernfid {
+	unsigned short	fid_len;		/* length of data in bytes */
+	unsigned short	fid_reserved;		/* compat: historic align */
+	char		fid_data[0];		/* data (variable length) */
+};
+
+/*ARGSUSED*/
+static void *
+fhcmp(struct puffs_usermount *pu, struct puffs_node *pn, void *arg)
+{
+	struct kernfid *kf1, *kf2;
+
+	if ((kf1 = pn->pn_data) == NULL)
+		return NULL;
+	kf2 = arg;
+
+	if (kf1->fid_len != kf2->fid_len)
+		return NULL;
+
+	/*LINTED*/
+	if (memcmp(kf1, kf2, kf1->fid_len) == 0)
+		return pn;
+	return NULL;
+}
+
+/*
+ * This routine only supports file handles which have been issued while
+ * the server was alive.  Not really stable ones, that is.
+ */
+/*ARGSUSED*/
 int
+puffs_null_fs_fhtonode(struct puffs_usermount *pu, void *fid, size_t fidsize,
+	struct puffs_newinfo *pni)
+{
+	struct puffs_node *pn_res;
+
+	pn_res = puffs_pn_nodewalk(pu, fhcmp, fid);
+	if (pn_res == NULL)
+		return ENOENT;
+
+	puffs_newinfo_setcookie(pni, pn_res);
+	puffs_newinfo_setvtype(pni, pn_res->pn_va.va_type);
+	puffs_newinfo_setsize(pni, (off_t)pn_res->pn_va.va_size);
+	puffs_newinfo_setrdev(pni, pn_res->pn_va.va_rdev);
+	return 0;
+}
+
+/*ARGSUSED*/
+int
+puffs_null_fs_nodetofh(struct puffs_usermount *pu, puffs_cookie_t opc,
+	void *fid, size_t *fidsize)
+{
+	struct puffs_node *pn = opc;
+	struct kernfid *kfid;
+	void *bounce;
+	int rv;
+
+	rv = 0;
+	bounce = NULL;
+	if (*fidsize) {
+		bounce = malloc(*fidsize + FHANDLE_HEADERLEN);
+		if (!bounce)
+			return ENOMEM;
+		*fidsize += FHANDLE_HEADERLEN;
+	}
+	if (getfh(PNPATH(pn), bounce, fidsize) == -1)
+		rv = errno;
+	else
+		memcpy(fid, (uint8_t *)bounce + FHANDLE_HEADERLEN,
+		    *fidsize - FHANDLE_HEADERLEN);
+	kfid = fid;
+	if (rv == 0) {
+		*fidsize = kfid->fid_len;
+		pn->pn_data = malloc(*fidsize);
+		if (pn->pn_data == NULL)
+			abort(); /* lazy */
+		memcpy(pn->pn_data, fid, *fidsize);
+	} else {
+		*fidsize -= FHANDLE_HEADERLEN;
+	}
+	free(bounce);
+
+	return rv;
+}
+#endif
+
+int
 puffs_null_node_lookup(struct puffs_usermount *pu, puffs_cookie_t opc,
 	struct puffs_newinfo *pni, const struct puffs_cn *pcn)
 {
@@ -470,6 +569,7 @@
 	off_t i;
 	int rv;
 
+	*ncookies = 0;
 	dp = opendir(PNPATH(pn));
 	if (dp == NULL)
 		return errno;
@@ -492,8 +592,10 @@
 		if (rv != 0)
 			goto out;
 
-		if (!result)
+		if (!result) {
+			*eofflag = 1;
 			goto out;
+		}
 
 		if (_DIRENT_SIZE(result) > *reslen)
 			goto out;
@@ -503,6 +605,7 @@
 		de = _DIRENT_NEXT(de);
 
 		(*off)++;
+		PUFFS_STORE_DCOOKIE(cookies, ncookies, *off);
 	}
 
  out:

==== //depot/projects/soc2009/tatsianka_puffs/libpuffs/opdump.c#2 (text+ko) ====

@@ -1,4 +1,4 @@
-/*	$NetBSD: opdump.c,v 1.24 2008/08/12 19:44:39 pooka Exp $	*/
+/*	$NetBSD: opdump.c,v 1.27 2009/04/06 20:47:17 pooka Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006  Antti Kantee.  All Rights Reserved.
@@ -35,12 +35,13 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint)
-__RCSID("$NetBSD: opdump.c,v 1.24 2008/08/12 19:44:39 pooka Exp $");
+__RCSID("$NetBSD: opdump.c,v 1.27 2009/04/06 20:47:17 pooka Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
 #include <sys/time.h>
 
+#include <inttypes.h>
 #include <puffs.h>
 #include <puffsdump.h>
 #include <stdio.h>
@@ -166,9 +167,9 @@
 		break;
 	}
 
-	printf("\treqid: %ju, opclass %d%s, optype: %s, "
+	printf("\treqid: %" PRIu64 ", opclass %d%s, optype: %s, "
 	    "cookie: %p,\n\t\taux: %p, auxlen: %zu, pid: %d, lwpid: %d\n",
-	    (intmax_t) preq->preq_id, PUFFSOP_OPCLASS(preq->preq_opclass),
+	    preq->preq_id, PUFFSOP_OPCLASS(preq->preq_opclass),
 	    PUFFSOP_WANTREPLY(preq->preq_opclass) ? "" : " (FAF)",
 	    map[preq->preq_optype], preq->preq_cookie,
 	    preq->preq_buf, preq->preq_buflen,
@@ -191,15 +192,19 @@
 		case PUFFS_VN_LINK:
 			puffsdump_targ(preq);
 			break;
+		case PUFFS_VN_READDIR:
+			puffsdump_readdir(preq);
+			break;
 		default:
 			break;
 		}
 	}
-
+	
 	PU_LOCK();
 	gettimeofday(&tv_now, NULL);
 	timersub(&tv_now, &tv_prev, &tv);
-	printf("\t\tsince previous call: %ld.%06ld\n", tv.tv_sec, tv.tv_usec);
+	printf("\t\tsince previous call: %lld.%06ld\n",
+	    (long long)tv.tv_sec, (long)tv.tv_usec);
 	gettimeofday(&tv_prev, NULL);
 	PU_UNLOCK();
 }
@@ -208,10 +213,6 @@
 puffsdump_rv(struct puffs_req *preq)
 {
 
-	printf("\tRV reqid: %ju, result: %d %s\n",
-	    (intmax_t) preq->preq_id, preq->preq_rv,
-	    preq->preq_rv ? strerror(preq->preq_rv) : "");
-
 	if (PUFFSOP_OPCLASS(preq->preq_opclass) == PUFFSOP_VN) {
 		switch (preq->preq_optype) {
 		case PUFFS_VN_LOOKUP:
@@ -227,16 +228,23 @@
 		case PUFFS_VN_WRITE:
 			puffsdump_readwrite_rv(preq);
 			break;
+		case PUFFS_VN_READDIR:
+			puffsdump_readdir_rv(preq);
+			break;
 		default:
 			break;
 		}
 	}
+
+	printf("\tRV reqid: %" PRIu64 ", result: %d %s\n",
+	    preq->preq_id, preq->preq_rv,
+	    preq->preq_rv ? strerror(preq->preq_rv) : "");
 }
 
 void
 puffsdump_cookie(puffs_cookie_t c, const char *cookiename)
 {
-
+	
 	printf("\t%scookie: at %p\n", cookiename, c);
 }
 
@@ -273,9 +281,9 @@
 {
 	struct puffs_vnmsg_lookup *lookup_msg = (void *)preq;
 
-	printf("\t\tnew node %p, type 0x%x,\n\t\tsize 0x%ju, dev 0x%x\n",
+	printf("\t\tnew node %p, type 0x%x,\n\t\tsize 0x%"PRIu64", dev 0x%llx\n",
 	    lookup_msg->pvnr_newnode, lookup_msg->pvnr_vtype,
-	    (intmax_t) lookup_msg->pvnr_size, lookup_msg->pvnr_rdev);
+	    lookup_msg->pvnr_size, (unsigned long long)lookup_msg->pvnr_rdev);
 }
 
 void
@@ -292,8 +300,8 @@
 {
 	struct puffs_vnmsg_rw *rw_msg = (void *)preq;
 
-	printf("\t\toffset: %jd, resid %zu, ioflag 0x%x\n",
-	    (intmax_t) rw_msg->pvnr_offset, rw_msg->pvnr_resid, rw_msg->pvnr_ioflag);
+	printf("\t\toffset: %" PRId64 ", resid %zu, ioflag 0x%x\n",
+	    rw_msg->pvnr_offset, rw_msg->pvnr_resid, rw_msg->pvnr_ioflag);
 }
 
 void
@@ -305,6 +313,15 @@
 }
 
 void
+puffsdump_readdir_rv(struct puffs_req *preq)
+{
+	struct puffs_vnmsg_readdir *readdir_msg = (void *)preq;
+
+	printf("\t\tresid after op: %zu, eofflag %d\n",
+	    readdir_msg->pvnr_resid, readdir_msg->pvnr_eofflag);
+}
+
+void
 puffsdump_open(struct puffs_req *preq)
 {
 	struct puffs_vnmsg_open *open_msg = (void *)preq;
@@ -321,6 +338,14 @@
 }
 
 void
+puffsdump_readdir(struct puffs_req *preq)
+{
+	struct puffs_vnmsg_readdir *readdir_msg = (void *)preq;
+
+	printf("\t\tread offset: %" PRId64 "\n", readdir_msg->pvnr_offset);
+}
+
+void
 /*ARGSUSED*/
 puffsdump_creds(struct puffs_cred *pcr)
 {

==== //depot/projects/soc2009/tatsianka_puffs/libpuffs/paths.c#2 (text+ko) ====

@@ -254,7 +254,7 @@
 
 	if (isdotdot) {
 		char *slash; /* sweet char of mine */
-
+		
 		slash = strrchr(po_pre->po_path, '/');
 		assert(slash != NULL);
 

==== //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs.3#2 (text+ko) ====

@@ -1,4 +1,4 @@
-.\"	$NetBSD: puffs.3,v 1.42 2008/09/06 12:39:49 pooka Exp $
+.\"	$NetBSD: puffs.3,v 1.46 2009/02/20 14:26:56 pooka Exp $
 .\"
 .\" Copyright (c) 2006, 2007, 2008 Antti Kantee.  All rights reserved.
 .\"
@@ -23,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd September 6, 2008
+.Dd December 12, 2008
 .Dt PUFFS 3
 .Os
 .Sh NAME
@@ -62,6 +62,8 @@
 .Ft void *
 .Fn puffs_getspecific "struct puffs_usermount *pu"
 .Ft void
+.Fn puffs_setspecific "struct puffs_usermount *pu" "void *private"
+.Ft void
 .Fn puffs_setmaxreqlen "struct puffs_usermount *pu" "size_t maxreqlen"
 .Ft size_t
 .Fn puffs_getmaxreqlen "struct puffs_usermount *pu"
@@ -85,17 +87,8 @@
 .Fa "struct puffs_cc **pccp"
 .Fc
 .Ft int
-.Fn puffs_dispatch_exec .Fa "struct puffs_cc *pcc" "struct puffs_framebuf **pbp"
+.Fn puffs_dispatch_exec "struct puffs_cc *pcc" "struct puffs_framebuf **pbp"
 .Sh DESCRIPTION
-.Em IMPORTANT NOTE!
-This document describes interfaces which are not yet guaranteed to be
-stable.
-In case you update your system sources, please recompile everything
-and fix compilation errors.
-If your sources are out-of-sync, incorrect operation may result.
-The interfaces in this document will most likely be hugely simplified
-in later versions or made transparent to the implementation.
-.Pp
 .Nm
 provides a framework for creating file systems as userspace servers.
 Operations are transported from the kernel virtual file system layer
@@ -307,6 +300,9 @@
 .Fa private
 argument of
 .Fn puffs_init .
+.It Fn puffs_setspecific "pu" "private"
+Can be used to set the specific data after the call to
+.Fn puffs_init .
 .It Fn puffs_setmaxreqlen "pu" "maxreqlen"
 In case the file system desires a maximum buffer length different from
 the default, the amount
@@ -430,6 +426,9 @@
 .Fn puffs_mount
 and the foreground process does not exit before the file system mount
 call has returned from the kernel.
+Since this routine internally calls fork, it has to be called
+.Em before
+.Fn puffs_mount .
 .It Fn puffs_mainloop pu flags
 Handle all requests automatically until the file system is unmounted.
 It returns 0 if the file system was successfully unmounted or \-1 if it
@@ -540,7 +539,7 @@
 .Nm
 first appeared in
 .Nx 4.0 .
+A stable version appeared in
+.Nx 5.0 .
 .Sh AUTHORS
 .An Antti Kantee Aq pooka@iki.fi
-.Sh BUGS
-Under construction.

==== //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs.c#4 (text+ko) ====

@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs.c,v 1.92 2008/08/12 19:44:39 pooka Exp $	*/
+/*	$NetBSD: puffs.c,v 1.98 2009/01/08 02:28:08 lukem 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.92 2008/08/12 19:44:39 pooka Exp $");
+__RCSID("$NetBSD: puffs.c,v 1.98 2009/01/08 02:28:08 lukem Exp $");
 #endif /* !lint */
 
 #include <sys/param.h>
@@ -193,13 +193,13 @@
 
 	psize = sysconf(_SC_PAGESIZE);
 	minsize = 4*psize;
-	if (ss < minsize || ss == PUFFS_STACKSIZE_MIN) {
+	if (ss < (size_t)minsize || ss == PUFFS_STACKSIZE_MIN) {
 		if (ss != PUFFS_STACKSIZE_MIN)
 			fprintf(stderr, "puffs_setstacksize: adjusting "
 			    "stacksize to minimum %ld\n", minsize);
 		ss = 4*psize;
 	}
-
+ 
 	stackshift = -1;
 	bonus = 0;
 	while (ss) {
@@ -269,6 +269,13 @@
 	return pu->pu_privdata;
 }
 
+void
+puffs_setspecific(struct puffs_usermount *pu, void *privdata)
+{
+
+	pu->pu_privdata = privdata;
+}
+
 size_t
 puffs_getmaxreqlen(struct puffs_usermount *pu)
 {
@@ -403,7 +410,7 @@
 int
 puffs_daemon(struct puffs_usermount *pu, int nochdir, int noclose)
 {
-	ssize_t n;
+	long int n;
 	int parent, value, fd;
 
 	if (pipe(pu->pu_dpipe) == -1)
@@ -422,10 +429,12 @@
 	pu->pu_state |= PU_PUFFSDAEMON;
 
 	if (parent) {
+		close(pu->pu_dpipe[1]);
 		n = read(pu->pu_dpipe[0], &value, sizeof(int));
 		if (n == -1)
 			err(1, "puffs_daemon");
-		assert(n == sizeof(value));
+		if (n != sizeof(value))
+			errx(1, "puffs_daemon got %ld bytes", n);
 		if (value) {
 			errno = value;
 			err(1, "puffs_daemon");
@@ -457,13 +466,24 @@
 	return -1;
 }
 
+static void
+shutdaemon(struct puffs_usermount *pu, int error)
+{
+	ssize_t n;
+
+	n = write(pu->pu_dpipe[1], &error, sizeof(int));
+	assert(n == 4);
+	close(pu->pu_dpipe[0]);
+	close(pu->pu_dpipe[1]);
+	pu->pu_state &= ~PU_PUFFSDAEMON;
+}
+
 int
 puffs_mount(struct puffs_usermount *pu, const char *dir, int mntflags,
 	puffs_cookie_t cookie)
 {
 	struct iovec iov[6];
 	char rp[MAXPATHLEN];
-	ssize_t n;
 	int rv, fd, sverrno;
 	char *comfd;
 
@@ -508,14 +528,14 @@
 			rv = -1;
 			goto out;
 		}
-
+			
 		len = strlen(dir)+1;
 
 #define allwrite(buf, len)						\
 do {									\
 	ssize_t al_rv;							\
 	al_rv = write(pu->pu_fd, buf, len);				\
-	if (al_rv != len) {						\
+	if ((size_t)al_rv != len) {					\
 		if (al_rv != -1)					\
 			errno = EIO;					\
 		rv = -1;						\
@@ -575,15 +595,10 @@
 	free(pu->pu_kargp);
 	pu->pu_kargp = NULL;
 
-	if (pu->pu_state & PU_PUFFSDAEMON) {
-		n = write(pu->pu_dpipe[1], &sverrno, sizeof(int));
-		assert(n == 4);
-		close(pu->pu_dpipe[0]);
-		close(pu->pu_dpipe[1]);
-	}
+	if (pu->pu_state & PU_PUFFSDAEMON)
+		shutdaemon(pu, sverrno);
 
 	errno = sverrno;
-	printf("%s: mount return %d\n", __func__, rv);
 	return rv;
 }
 
@@ -668,6 +683,15 @@
 	return NULL;
 }
 
+void
+puffs_cancel(struct puffs_usermount *pu, int error)
+{
+
+	assert(puffs_getstate(pu) < PUFFS_STATE_RUNNING);
+	shutdaemon(pu, error);
+	free(pu);
+}
+
 /*
  * XXX: there's currently no clean way to request unmount from
  * within the user server, so be very brutal about it.
@@ -678,8 +702,8 @@
 {
 	struct puffs_node *pn;
 
-	printf("puffs_exit: enter\n");
 	force = 1; /* currently */
+	assert((pu->pu_state & PU_PUFFSDAEMON) == 0);
 
 	if (pu->pu_fd)
 		close(pu->pu_fd);
@@ -693,7 +717,6 @@
 	if (pu->pu_state & PU_HASKQ)
 		close(pu->pu_kq);
 	free(pu);
-	printf("puffs_exit: done\n");
 
 	return 0; /* always succesful for now, WILL CHANGE */
 }

==== //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs.h#3 (text+ko) ====

@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs.h,v 1.108 2008/08/12 19:44:39 pooka Exp $	*/
+/*	$NetBSD: puffs.h,v 1.110 2008/12/12 19:45:16 pooka Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -423,6 +423,7 @@
 				    const char *, void *, uint32_t);
 int		puffs_mount(struct puffs_usermount *, const char *, int, void*);
 int		puffs_exit(struct puffs_usermount *, int);
+void		puffs_cancel(struct puffs_usermount *, int);
 int		puffs_mainloop(struct puffs_usermount *);
 int		puffs_daemon(struct puffs_usermount *, int, int);
 
@@ -442,6 +443,7 @@
 					  enum vtype, size_t, dev_t);
 
 void			*puffs_getspecific(struct puffs_usermount *);
+void			puffs_setspecific(struct puffs_usermount *, void *);
 void			puffs_setmaxreqlen(struct puffs_usermount *, size_t);
 size_t			puffs_getmaxreqlen(struct puffs_usermount *);
 void			puffs_setfhsize(struct puffs_usermount *, size_t, int);

==== //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs_cc.3#2 (text+ko) ====

@@ -1,4 +1,4 @@
-.\"	$NetBSD: puffs_cc.3,v 1.12 2008/05/25 19:38:21 wiz Exp $
+.\"	$NetBSD: puffs_cc.3,v 1.14 2009/04/11 16:48:53 wiz Exp $
 .\"
 .\" Copyright (c) 2007, 2008 Antti Kantee.  All rights reserved.
 .\"
@@ -42,15 +42,6 @@
 .Ft struct puffs_cc *
 .Fn puffs_cc_getcc "struct puffs_usermount *pu"
 .Sh DESCRIPTION
-.Em IMPORTANT NOTE!
-This document describes interfaces which are not yet guaranteed to be
-stable.
-In case you update your system sources, please recompile everything
-and fix compilation errors.
-If your sources are out-of-sync, incorrect operation may result.
-The interfaces in this document will most likely be hugely simplified
-in later versions or made transparent to the implementation.
-.Pp
 These routines are used for the cooperative multitasking suite present
 in puffs.
 .Pp
@@ -92,7 +83,8 @@
 This cookie should be hooked to the
 .Va pcc
 so that the correct continuation can be continued when the event it
-was waiting for triggers.  Alternatively, the
+was waiting for triggers.
+Alternatively, the
 .Xr puffs_framebuf 3
 framework and
 .Fn puffs_mainloop

==== //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs_cred.3#2 (text+ko) ====

@@ -1,4 +1,4 @@
-.\"	$NetBSD: puffs_cred.3,v 1.3 2007/12/01 19:18:50 wiz Exp $
+.\"	$NetBSD: puffs_cred.3,v 1.5 2009/04/11 15:36:22 joerg Exp $
 .\"
 .\" Copyright (c) 2007 Antti Kantee.  All rights reserved.
 .\"
@@ -34,7 +34,7 @@
 .Sh SYNOPSIS
 .In puffs.h
 .Ft int
-.Fn puffs_cred_getuid "const struct puffs_cred *pcr" "uid_t *uid
+.Fn puffs_cred_getuid "const struct puffs_cred *pcr" "uid_t *uid"
 .Ft int
 .Fn puffs_cred_getgid "const struct puffs_cred *pcr" "gid_t *gid"
 .Ft int
@@ -74,15 +74,6 @@
 .Fa "const struct puffs_cred *pcr"
 .Fc
 .Sh DESCRIPTION
-.Em IMPORTANT NOTE!
-This document describes interfaces which are not yet guaranteed to be
-stable.
-In case you update your system sources, please recompile everything
-and fix compilation errors.
-If your sources are out-of-sync, incorrect operation may result.
-The interfaces in this document will most likely be hugely simplified
-in later versions or made transparent to the implementation.
-.Pp
 These functions can be used to check operation credentials and perform
 access control.
 The structure

==== //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs_flush.3#2 (text+ko) ====

@@ -1,4 +1,4 @@
-.\"	$NetBSD: puffs_flush.3,v 1.7 2008/08/12 19:44:39 pooka Exp $
+.\"	$NetBSD: puffs_flush.3,v 1.8 2009/02/20 14:26:56 pooka Exp $
 .\"
 .\" Copyright (c) 2007 Antti Kantee.  All rights reserved.
 .\"
@@ -58,15 +58,6 @@
 .Fa "off_t end"
 .Fc
 .Sh DESCRIPTION
-.Em IMPORTANT NOTE!
-This document describes interfaces which are not yet guaranteed to be
-stable.
-In case you update your system sources, please recompile everything
-and fix compilation errors.
-If your sources are out-of-sync, incorrect operation may result.
-The interfaces in this document will most likely be hugely simplified
-in later versions or made transparent to the implementation.
-.Pp
 These routines are used inform the kernel that any information it might
 have cached is no longer valid.
 .Fn puffs_inval_namecache_dir

==== //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs_framebuf.3#2 (text+ko) ====

@@ -1,4 +1,4 @@
-.\"	$NetBSD: puffs_framebuf.3,v 1.25 2008/09/06 15:43:27 wiz Exp $
+.\"	$NetBSD: puffs_framebuf.3,v 1.26 2009/02/20 14:26:56 pooka Exp $
 .\"
 .\" Copyright (c) 2007 Antti Kantee.  All rights reserved.
 .\"
@@ -151,13 +151,6 @@
 .Fa "struct puffs_usermount *pu" "int fd" "int what"
 .Fc
 .Sh DESCRIPTION
-.Em IMPORTANT NOTE!
-This document describes interfaces which are not yet guaranteed to be
-stable.
-In case you update your system sources, please recompile everything
-and fix compilation errors.
-If your sources are out-of-sync, incorrect operation may result.
-.Pp
 The
 .Nm
 routines provide buffering and an event loop structured around the

==== //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs_node.3#2 (text+ko) ====

@@ -1,4 +1,4 @@
-.\"	$NetBSD: puffs_node.3,v 1.3 2007/12/01 19:18:50 wiz Exp $
+.\"	$NetBSD: puffs_node.3,v 1.5 2009/05/13 22:42:31 wiz Exp $
 .\"
 .\" Copyright (c) 2007 Antti Kantee.  All rights reserved.
 .\"
@@ -48,21 +48,6 @@
 .Ft void
 .Fn puffs_pn_put "struct puffs_node *pn"
 .Sh DESCRIPTION
-.Em IMPORTANT NOTE!
-This document describes interfaces which are not yet guaranteed to be
-stable.
-In case you update your system sources, please recompile everything
-and fix compilation errors.
-If your sources are out-of-sync, incorrect operation may result.
-The interfaces in this document will most likely be hugely simplified
-in later versions or made transparent to the implementation.
-.Pp
-.Em MORE IMPORTANT STUFF!
-It should especially be noted, that it is yet completely unsure, how
-much of the internals contents of
-.Vt struct puffs_node
-will be exposed to file systems in the end.
-.Pp
 .Bl -tag -width xxxx
 .It Fn puffs_pn_new pu priv
 Create a new node and attach it to the mountpoint
@@ -111,7 +96,6 @@
 .Ar pn .
 This is typically called from
 .Fn puffs_node_reclaim .
-.Pp
 .El
 .Sh SEE ALSO
 .Xr puffs 3

==== //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs_ops.3#2 (text+ko) ====

@@ -1,4 +1,4 @@
-.\"	$NetBSD: puffs_ops.3,v 1.21 2008/08/12 19:44:39 pooka Exp $
+.\"	$NetBSD: puffs_ops.3,v 1.25 2009/04/11 16:48:53 wiz Exp $
 .\"
 .\" Copyright (c) 2007 Antti Kantee.  All rights reserved.
 .\"
@@ -35,7 +35,7 @@
 .In puffs.h
 .Ft int
 .Fo puffs_fs_statvfs
-.Fa "struct puffs_usermount *pu" "struct statvfs *sbp"
+.Fa "struct puffs_usermount *pu" "struct statfs *sbp"
 .Fc
 .Ft int
 .Fo puffs_fs_sync
@@ -48,7 +48,7 @@
 .Fc
 .Ft int
 .Fo puffs_fs_nodetofh
-.Fa "struct puffs_usermount *pu" "puffs_cooie_t cookie" "void *fid"
+.Fa "struct puffs_usermount *pu" "puffs_cookie_t cookie" "void *fid"
 .Fa "size_t *fidsize"
 .Fc
 .Ft void
@@ -194,15 +194,6 @@
 .Ft void
 .Fn puffs_newinfo_setrdev "struct puffs_newinfo *pni" "dev_t rdev"
 .Sh DESCRIPTION
-.Em IMPORTANT NOTE!
-This document describes interfaces which are not yet guaranteed to be
-stable.
-In case you update your system sources, please recompile everything
-and fix compilation errors.
-If your sources are out-of-sync, incorrect operation may result.
-The interfaces in this document will most likely be hugely simplified
-in later versions or made transparent to the implementation.
-.Pp
 The operations
 .Nm puffs
 requires to function can be divided into two categories: file system
@@ -572,7 +563,7 @@
 and
 .Fa pcn_targ ,
 respectively.
-.B If
+.Em If
 the target node already exists, it is specified by
 .Fa targ
 and must be replaced atomically.
@@ -707,8 +698,8 @@
 .Dv PUFFS_IO_APPEND
 is specified, the data should be appended to the end of the file.
 .It Fn puffs_node_print "pu" "opc"
-Print information about node.  This is used only for kernel-initiated
-diagnostic purposes.
+Print information about node.
+This is used only for kernel-initiated diagnostic purposes.
 .It Fn puffs_node_reclaim "pu" "opc"
 The kernel will no longer reference the cookie and resources associated
 with it may be freed.

==== //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs_path.3#2 (text+ko) ====

@@ -1,4 +1,4 @@
-.\"	$NetBSD: puffs_path.3,v 1.3 2007/12/27 18:50:42 pooka Exp $
+.\"	$NetBSD: puffs_path.3,v 1.4 2009/02/20 14:26:56 pooka Exp $
 .\"
 .\" Copyright (c) 2007 Antti Kantee.  All rights reserved.
 .\"
@@ -59,15 +59,6 @@
 .Ft struct puffs_pathobj *
 .Fn puffs_getrootpathobj "struct puffs_usermount *pu"
 .Sh DESCRIPTION
-.Em IMPORTANT NOTE!
-This document describes interfaces which are not yet guaranteed to be
-stable.
-In case you update your system sources, please recompile everything
-and fix compilation errors.
-If your sources are out-of-sync, incorrect operation may result.
-The interfaces in this document will most likely be hugely simplified
-in later versions or made transparent to the implementation.
-.Pp
 The puffs library has the ability to provide full pathnames for backends
 which require them.
 Normal file systems should be constructed without the file system

==== //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffs_suspend.3#2 (text+ko) ====

@@ -1,4 +1,4 @@
-.\"	$NetBSD: puffs_suspend.3,v 1.2 2007/01/28 07:58:05 wiz Exp $
+.\"	$NetBSD: puffs_suspend.3,v 1.3 2009/02/20 14:26:56 pooka Exp $
 .\"
 .\" Copyright (c) 2007 Antti Kantee.  All rights reserved.
 .\"
@@ -36,15 +36,6 @@
 .Ft int
 .Fn puffs_fs_suspend "struct puffs_usermount *pu"
 .Sh DESCRIPTION
-.Em IMPORTANT NOTE!
-This document describes interfaces which are not yet guaranteed to be
-stable.
-In case you update your system sources, please recompile everything
-and fix compilation errors.
-If your sources are out-of-sync, incorrect operation may result.
-The interfaces in this document will most likely be hugely simplified
-in later versions or made transparent to the implementation.
-.Pp
 The function
 .Fn puffs_fs_suspend
 requests the kernel to suspend operations to the file system indicated by
@@ -92,4 +83,3 @@
 .Pp
 File system data and metadata are not always totally correctly
 synchronized at suspend.
-This will be fixed soon.

==== //depot/projects/soc2009/tatsianka_puffs/libpuffs/puffsdump.h#2 (text+ko) ====

@@ -1,4 +1,4 @@
-/*	$NetBSD: puffsdump.h,v 1.10 2008/08/12 19:44:39 pooka Exp $	*/
+/*	$NetBSD: puffsdump.h,v 1.12 2009/04/06 20:47:17 pooka Exp $	*/
 
 /*
  * Copyright (c) 2006  Antti Kantee.  All Rights Reserved.
@@ -41,6 +41,8 @@
 
 void puffsdump_readwrite(struct puffs_req *);
 void puffsdump_readwrite_rv(struct puffs_req *);
+void puffsdump_readdir(struct puffs_req *);
+void puffsdump_readdir_rv(struct puffs_req *);
 void puffsdump_lookup(struct puffs_req *);
 void puffsdump_lookup_rv(struct puffs_req *);
 void puffsdump_create_rv(struct puffs_req *);

==== //depot/projects/soc2009/tatsianka_puffs/libpuffs/subr.c#2 (text+ko) ====

@@ -1,4 +1,4 @@
-/*	$NetBSD: subr.c,v 1.23 2008/08/12 19:44:39 pooka Exp $	*/

>>> TRUNCATED FOR MAIL (1000 lines) <<<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907051159.n65BxEke050294>