CVS commit: src/sbin/mount_fdesc

2009-07-31 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jul 31 14:56:11 UTC 2009

Modified Files:
src/sbin/mount_fdesc: mount_fdesc.c

Log Message:
Shortcircuit -o getargs in userspace.  We know the kernel driver
will not return any data and mount(2) fails with EINVAL if data_len
is 0.  This caused lame-o output in mount -vv:
mount_fdesc: fdesc on /failsystem: Invalid argument


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sbin/mount_fdesc/mount_fdesc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/mount_fdesc/mount_fdesc.c
diff -u src/sbin/mount_fdesc/mount_fdesc.c:1.22 src/sbin/mount_fdesc/mount_fdesc.c:1.23
--- src/sbin/mount_fdesc/mount_fdesc.c:1.22	Sun Jul 20 01:20:22 2008
+++ src/sbin/mount_fdesc/mount_fdesc.c	Fri Jul 31 14:56:11 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: mount_fdesc.c,v 1.22 2008/07/20 01:20:22 lukem Exp $	*/
+/*	$NetBSD: mount_fdesc.c,v 1.23 2009/07/31 14:56:11 pooka Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993, 1994
@@ -77,7 +77,7 @@
 #if 0
 static char sccsid[] = "@(#)mount_fdesc.c	8.3 (Berkeley) 4/26/95";
 #else
-__RCSID("$NetBSD: mount_fdesc.c,v 1.22 2008/07/20 01:20:22 lukem Exp $");
+__RCSID("$NetBSD: mount_fdesc.c,v 1.23 2009/07/31 14:56:11 pooka Exp $");
 #endif
 #endif /* not lint */
 
@@ -135,6 +135,10 @@
 	if (argc != 2)
 		usage();
 
+	/* getargs is a NULL op and kernel would return EINVAL */
+	if (mntflags & MNT_GETARGS)
+		exit(0);
+
 	if (realpath(argv[1], canon_dir) == NULL)/* Check mounton path */
 		err(1, "realpath %s", argv[1]);
 	if (strncmp(argv[1], canon_dir, MAXPATHLEN)) {



CVS commit: src/sbin/mount_fdesc

2009-07-31 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jul 31 14:58:21 UTC 2009

Modified Files:
src/sbin/mount_fdesc: mount_fdesc.c
Added Files:
src/sbin/mount_fdesc: mount_fdesc.h

Log Message:
convert to parseargs form


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sbin/mount_fdesc/mount_fdesc.c
cvs rdiff -u -r0 -r1.1 src/sbin/mount_fdesc/mount_fdesc.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/mount_fdesc/mount_fdesc.c
diff -u src/sbin/mount_fdesc/mount_fdesc.c:1.23 src/sbin/mount_fdesc/mount_fdesc.c:1.24
--- src/sbin/mount_fdesc/mount_fdesc.c:1.23	Fri Jul 31 14:56:11 2009
+++ src/sbin/mount_fdesc/mount_fdesc.c	Fri Jul 31 14:58:21 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: mount_fdesc.c,v 1.23 2009/07/31 14:56:11 pooka Exp $	*/
+/*	$NetBSD: mount_fdesc.c,v 1.24 2009/07/31 14:58:21 pooka Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993, 1994
@@ -77,7 +77,7 @@
 #if 0
 static char sccsid[] = "@(#)mount_fdesc.c	8.3 (Berkeley) 4/26/95";
 #else
-__RCSID("$NetBSD: mount_fdesc.c,v 1.23 2009/07/31 14:56:11 pooka Exp $");
+__RCSID("$NetBSD: mount_fdesc.c,v 1.24 2009/07/31 14:58:21 pooka Exp $");
 #endif
 #endif /* not lint */
 
@@ -92,6 +92,8 @@
 
 #include 
 
+#include "mount_fdesc.h"
+
 static const struct mntopt mopts[] = {
 	MOPT_STDOPTS,
 	MOPT_GETARGS,
@@ -109,18 +111,18 @@
 }
 #endif
 
-int
-mount_fdesc(int argc, char *argv[])
+void
+mount_fdesc_parseargs(int argc, char *argv[], void *dummy, int *mntflags,
+	char *canon_dev, char *canon_dir)
 {
-	int ch, mntflags;
-	char canon_dir[MAXPATHLEN];
+	int ch;
 	mntoptparse_t mp;
 
-	mntflags = 0;
+	*mntflags = 0;
 	while ((ch = getopt(argc, argv, "o:")) != -1)
 		switch (ch) {
 		case 'o':
-			mp = getmntopts(optarg, mopts, &mntflags, 0);
+			mp = getmntopts(optarg, mopts, mntflags, 0);
 			if (mp == NULL)
 err(1, "getmntopts");
 			freemntopts(mp);
@@ -136,7 +138,7 @@
 		usage();
 
 	/* getargs is a NULL op and kernel would return EINVAL */
-	if (mntflags & MNT_GETARGS)
+	if (*mntflags & MNT_GETARGS)
 		exit(0);
 
 	if (realpath(argv[1], canon_dir) == NULL)/* Check mounton path */
@@ -145,9 +147,18 @@
 		warnx("\"%s\" is a relative path.", argv[1]);
 		warnx("using \"%s\" instead.", canon_dir);
 	}
+}
+
+int
+mount_fdesc(int argc, char *argv[])
+{
+	int mntflags;
+	char canon_dev[MAXPATHLEN], canon_dir[MAXPATHLEN];
 
+	mount_fdesc_parseargs(argc, argv, NULL, &mntflags,
+	canon_dev, canon_dir);
 	if (mount(MOUNT_FDESC, canon_dir, mntflags, NULL, 0) == -1)
-		err(1, "fdesc on %s", argv[1]);
+		err(1, "fdesc on %s", canon_dir);
 	exit(0);
 }
 

Added files:

Index: src/sbin/mount_fdesc/mount_fdesc.h
diff -u /dev/null src/sbin/mount_fdesc/mount_fdesc.h:1.1
--- /dev/null	Fri Jul 31 14:58:21 2009
+++ src/sbin/mount_fdesc/mount_fdesc.h	Fri Jul 31 14:58:21 2009
@@ -0,0 +1,35 @@
+/*	$NetBSD: mount_fdesc.h,v 1.1 2009/07/31 14:58:21 pooka Exp $	*/
+
+/*
+ * Copyright (c) 2008 The NetBSD Foundation.  All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _SBIN_MOUNT_FDESC_MOUNT_FDESC_H_
+#define _SBIN_MOUNT_FDESC_MOUNT_FDESC_H_
+
+int	mount_fdesc(int, char **);
+void	mount_fdesc_parseargs(int, char **, void *, int *,
+			  char *, char *);
+
+#endif /* _SBIN_MOUNT_FDESC_MOUNT_FDESC_H_ */



CVS commit: src/sys/arch/atari/dev

2009-07-31 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jul 31 15:55:11 UTC 2009

Modified Files:
src/sys/arch/atari/dev: fd.c

Log Message:
Read AD_CFG_SWITCH via volatile pointer so that
the default density is detected correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/atari/dev/fd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/atari/dev/fd.c
diff -u src/sys/arch/atari/dev/fd.c:1.70 src/sys/arch/atari/dev/fd.c:1.71
--- src/sys/arch/atari/dev/fd.c:1.70	Sun Jul 19 05:43:22 2009
+++ src/sys/arch/atari/dev/fd.c	Fri Jul 31 15:55:10 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.70 2009/07/19 05:43:22 tsutsui Exp $	*/
+/*	$NetBSD: fd.c,v 1.71 2009/07/31 15:55:10 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.70 2009/07/19 05:43:22 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.71 2009/07/31 15:55:10 tsutsui Exp $");
 
 #include 
 #include 
@@ -253,7 +253,7 @@
 static u_short rd_cfg_switch(void);
 static u_short rd_cfg_switch(void)
 {
-	return(*((u_short*)AD_CFG_SWITCH));
+	return(*((volatile u_short *)AD_CFG_SWITCH));
 }
 
 /*



CVS commit: src/sys/miscfs/fdesc

2009-07-31 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jul 31 18:44:59 UTC 2009

Modified Files:
src/sys/miscfs/fdesc: fdesc_vfsops.c

Log Message:
Instead of reporting some random "files used/free" figures for the
process doing statvfs(!), just report 0.  The code had some kernel
panicking bug after the descriptor code update, the functionality
is more like a bunny rabbit hat than anything useful, and I can't
bother to figure out what the invariants in the new descriptor code
are.

fixes PR kern/41534 and kern/41786


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/miscfs/fdesc/fdesc_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/miscfs/fdesc/fdesc_vfsops.c
diff -u src/sys/miscfs/fdesc/fdesc_vfsops.c:1.80 src/sys/miscfs/fdesc/fdesc_vfsops.c:1.81
--- src/sys/miscfs/fdesc/fdesc_vfsops.c:1.80	Sun May 24 21:41:26 2009
+++ src/sys/miscfs/fdesc/fdesc_vfsops.c	Fri Jul 31 18:44:58 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: fdesc_vfsops.c,v 1.80 2009/05/24 21:41:26 ad Exp $	*/
+/*	$NetBSD: fdesc_vfsops.c,v 1.81 2009/07/31 18:44:58 pooka Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993, 1995
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdesc_vfsops.c,v 1.80 2009/05/24 21:41:26 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdesc_vfsops.c,v 1.81 2009/07/31 18:44:58 pooka Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -164,35 +164,6 @@
 int
 fdesc_statvfs(struct mount *mp, struct statvfs *sbp)
 {
-	lwp_t *l = curlwp;
-	proc_t *p;
-	int lim;
-	int i;
-	int last;
-	int freefd;
-	fdtab_t *dt;
-
-	/*
-	 * Compute number of free file descriptors.
-	 * [ Strange results will ensue if the open file
-	 * limit is ever reduced below the current number
-	 * of open files... ]
-	 */
-	p = l->l_proc;
-	dt = l->l_fd->fd_dt;
-	lim = p->p_rlimit[RLIMIT_NOFILE].rlim_cur;
-	last = min(dt->dt_nfiles, lim);
-	freefd = 0;
-	for (i = l->l_fd->fd_freefile; i < last; i++)
-		if (dt->dt_ff[i]->ff_file == NULL)
-			freefd++;
-
-	/*
-	 * Adjust for the fact that the fdesc array may not
-	 * have been fully allocated yet.
-	 */
-	if (dt->dt_nfiles < lim)
-		freefd += (lim - dt->dt_nfiles);
 
 	sbp->f_bsize = DEV_BSIZE;
 	sbp->f_frsize = DEV_BSIZE;
@@ -201,9 +172,9 @@
 	sbp->f_bfree = 0;
 	sbp->f_bavail = 0;
 	sbp->f_bresvd = 0;
-	sbp->f_files = lim + 1;		/* Allow for "." */
-	sbp->f_ffree = freefd;		/* See comments above */
-	sbp->f_favail = freefd;		/* See comments above */
+	sbp->f_files = 0;
+	sbp->f_ffree = 0;
+	sbp->f_favail = 0;
 	sbp->f_fresvd = 0;
 	copy_statvfs_info(sbp, mp);
 	return (0);



CVS commit: src/sys/miscfs/fdesc

2009-07-31 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jul 31 18:50:58 UTC 2009

Modified Files:
src/sys/miscfs/fdesc: fdesc_vnops.c

Log Message:
Do a name-based search for the ctty major instead of requiring an
external symbol.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/miscfs/fdesc/fdesc_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/miscfs/fdesc/fdesc_vnops.c
diff -u src/sys/miscfs/fdesc/fdesc_vnops.c:1.107 src/sys/miscfs/fdesc/fdesc_vnops.c:1.108
--- src/sys/miscfs/fdesc/fdesc_vnops.c:1.107	Sun May 24 21:41:26 2009
+++ src/sys/miscfs/fdesc/fdesc_vnops.c	Fri Jul 31 18:50:58 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: fdesc_vnops.c,v 1.107 2009/05/24 21:41:26 ad Exp $	*/
+/*	$NetBSD: fdesc_vnops.c,v 1.108 2009/07/31 18:50:58 pooka Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.107 2009/05/24 21:41:26 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.108 2009/07/31 18:50:58 pooka Exp $");
 
 #include 
 #include 
@@ -176,8 +176,6 @@
 const struct vnodeopv_desc fdesc_vnodeop_opv_desc =
 	{ &fdesc_vnodeop_p, fdesc_vnodeop_entries };
 
-extern const struct cdevsw ctty_cdevsw;
-
 /*
  * Initialise cache headers
  */
@@ -187,7 +185,7 @@
 	int cttymajor;
 
 	/* locate the major number */
-	cttymajor = cdevsw_lookup_major(&ctty_cdevsw);
+	cttymajor = devsw_name2chr("ctty", NULL, 0);
 	devctty = makedev(cttymajor, 0);
 	fdhashtbl = hashinit(NFDCACHE, HASH_LIST, true, &fdhash);
 }



CVS commit: src/sys/rump/fs/lib/libfdesc

2009-07-31 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jul 31 19:16:45 UTC 2009

Added Files:
src/sys/rump/fs/lib/libfdesc: Makefile shlib_version

Log Message:
add fdesc fs rump lib
(don't descend in here by default, I don't want to deal with the
setlist pain for now)


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/rump/fs/lib/libfdesc/Makefile \
src/sys/rump/fs/lib/libfdesc/shlib_version

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/sys/rump/fs/lib/libfdesc/Makefile
diff -u /dev/null src/sys/rump/fs/lib/libfdesc/Makefile:1.1
--- /dev/null	Fri Jul 31 19:16:45 2009
+++ src/sys/rump/fs/lib/libfdesc/Makefile	Fri Jul 31 19:16:45 2009
@@ -0,0 +1,11 @@
+#	$NetBSD: Makefile,v 1.1 2009/07/31 19:16:45 pooka Exp $
+#
+
+.PATH:	${.CURDIR}/../../../../miscfs/fdesc
+
+LIB=	rumpfs_fdesc
+
+SRCS=	fdesc_vfsops.c fdesc_vnops.c
+
+.include 
+.include 
Index: src/sys/rump/fs/lib/libfdesc/shlib_version
diff -u /dev/null src/sys/rump/fs/lib/libfdesc/shlib_version:1.1
--- /dev/null	Fri Jul 31 19:16:45 2009
+++ src/sys/rump/fs/lib/libfdesc/shlib_version	Fri Jul 31 19:16:45 2009
@@ -0,0 +1,4 @@
+#	$NetBSD: shlib_version,v 1.1 2009/07/31 19:16:45 pooka Exp $
+#
+major=0
+minor=0



CVS commit: src/usr.sbin/puffs/rump_fdesc

2009-07-31 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jul 31 19:18:46 UTC 2009

Added Files:
src/usr.sbin/puffs/rump_fdesc: Makefile rump_fdesc.8 rump_fdesc.c

Log Message:
rump_fdesc.  it works, but it's actually not very sexy out of
developer clothes, since the server cannot fetch the fd information
from the kernel.  Therefore, don't build it by default.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/usr.sbin/puffs/rump_fdesc/Makefile \
src/usr.sbin/puffs/rump_fdesc/rump_fdesc.8 \
src/usr.sbin/puffs/rump_fdesc/rump_fdesc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/usr.sbin/puffs/rump_fdesc/Makefile
diff -u /dev/null src/usr.sbin/puffs/rump_fdesc/Makefile:1.1
--- /dev/null	Fri Jul 31 19:18:46 2009
+++ src/usr.sbin/puffs/rump_fdesc/Makefile	Fri Jul 31 19:18:46 2009
@@ -0,0 +1,8 @@
+#	$NetBSD: Makefile,v 1.1 2009/07/31 19:18:46 pooka Exp $
+#
+
+MOUNTNAME=	fdesc
+
+ISRUMP=		# descualified
+
+.include 
Index: src/usr.sbin/puffs/rump_fdesc/rump_fdesc.8
diff -u /dev/null src/usr.sbin/puffs/rump_fdesc/rump_fdesc.8:1.1
--- /dev/null	Fri Jul 31 19:18:46 2009
+++ src/usr.sbin/puffs/rump_fdesc/rump_fdesc.8	Fri Jul 31 19:18:46 2009
@@ -0,0 +1,112 @@
+.\"	$NetBSD: rump_fdesc.8,v 1.1 2009/07/31 19:18:46 pooka Exp $
+.\"
+.\"	WARNING: GENERATED FILE, DO NOT EDIT
+.\"	INSTEAD, EDIT makerumpmanpages.sh AND REGEN
+.\"
+.\" Copyright (c) 2008 Antti Kantee. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.Dd February 15, 2009
+.Dt RUMP_FDESC 8
+.Os
+.Sh NAME
+.Nm rump_fdesc
+.Nd mount the fdesc file system using a userspace server
+.Sh SYNOPSIS
+.Cd "file-system PUFFS"
+.Cd "pseudo-device putter"
+.Pp
+.Nm
+.Op options
+.Ar special
+.Ar node
+.Sh DESCRIPTION
+The
+.Nm
+utility can be used to mount fdesc file systems.
+It uses
+.Xr rump 3
+and
+.Xr p2k 3
+to facilitate running the file system as a server in userspace.
+As opposed to
+.Xr mount_fdesc 8 ,
+.Nm
+does not use file system code within the kernel and therefore does
+not require kernel support except
+.Xr puffs 4 .
+Apart from a minor speed penalty (starting from 10% and depending
+on the workload and file system in question), there is no difference
+to using in-kernel code.
+.Pp
+In case mounting a file system image from a regular file,
+.Nm
+does not require the use of
+.Xr vnconfig 8
+unlike kernel file systems.
+Instead, the image path can be directly passed as the special file path.
+The exception is if the image contains a disklabel.
+In this case vnconfig is required to resolve the start offset for the
+correct partition within the image.
+.Pp
+It is recommended that untrusted file system images be mounted with
+.Nm
+instead of
+.Xr mount_fdesc 8 .
+Corrupt file system images commonly cause the file system
+to crash the entire kernel, but with
+.Nm
+only the userspace server process will dump core.
+.Pp
+To use
+.Nm
+via
+.Xr mount 8 ,
+the flags
+.Fl o Ar rump
+and
+.Fl t Ar fdesc
+should be given.
+Similarly,
+.Nm
+is run instead of
+.Xr mount_fdesc 8
+if
+.Dq rump
+is added to the options field of
+.Xr fstab 5 .
+.Pp
+Please see
+.Xr mount_fdesc 8
+for a full description of the available command line options.
+.Sh SEE ALSO
+.Xr p2k 3 ,
+.Xr puffs 3 ,
+.Xr rump 3 ,
+.Xr mount_fdesc 8
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Nx 5.0 .
+It is currently considered experimental.
Index: src/usr.sbin/puffs/rump_fdesc/rump_fdesc.c
diff -u /dev/null src/usr.sbin/puffs/rump_fdesc/rump_fdesc.c:1.1
--- /dev/null	Fri Jul 31 19:18:46 2009
+++ src/usr.sbin/puffs/rump_fdesc/rump_fdesc.c	Fri Jul 31 19:18:46 2009
@@ -0,0 +1,59 @@
+/*	$NetBSD: rump_fdesc.c,v 1

CVS commit: src/usr.sbin/puffs

2009-07-31 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jul 31 19:21:55 UTC 2009

Modified Files:
src/usr.sbin/puffs: Makefile

Log Message:
add commented-out rump_fdesc along with an explanation


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/puffs/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/puffs/Makefile
diff -u src/usr.sbin/puffs/Makefile:1.8 src/usr.sbin/puffs/Makefile:1.9
--- src/usr.sbin/puffs/Makefile:1.8	Thu Oct 16 09:30:57 2008
+++ src/usr.sbin/puffs/Makefile	Fri Jul 31 19:21:55 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.8 2008/10/16 09:30:57 pooka Exp $
+#	$NetBSD: Makefile,v 1.9 2009/07/31 19:21:55 pooka Exp $
 
 SUBDIR=	mount_9p mount_portal mount_psshfs mount_sysctlfs
 
@@ -6,4 +6,12 @@
 SUBDIR+=rump_msdos rump_nfs rump_ntfs rump_syspuffs rump_sysvbfs
 SUBDIR+=rump_tmpfs rump_udf
 
+#
+# The following are not built by default
+#
+
+# userspace fdesc server cannot grope the fd info from the kernel,
+# and is therefore not useful for the average user
+#SUBDIR+=rump_fdesc
+
 .include 



CVS commit: src/sys/miscfs/fdesc

2009-07-31 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jul 31 19:47:47 UTC 2009

Modified Files:
src/sys/miscfs/fdesc: fdesc.h fdesc_vfsops.c

Log Message:
Get rid of dependency on M_UFSMNT.  Since we need storage only for
one pointer, simply hang that off of mnt_data instead of allocating
storage.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/miscfs/fdesc/fdesc.h
cvs rdiff -u -r1.81 -r1.82 src/sys/miscfs/fdesc/fdesc_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/miscfs/fdesc/fdesc.h
diff -u src/sys/miscfs/fdesc/fdesc.h:1.19 src/sys/miscfs/fdesc/fdesc.h:1.20
--- src/sys/miscfs/fdesc/fdesc.h:1.19	Sat Jun 28 01:34:06 2008
+++ src/sys/miscfs/fdesc/fdesc.h	Fri Jul 31 19:47:47 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: fdesc.h,v 1.19 2008/06/28 01:34:06 rumble Exp $	*/
+/*	$NetBSD: fdesc.h,v 1.20 2009/07/31 19:47:47 pooka Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -37,9 +37,6 @@
  */
 
 #ifdef _KERNEL
-struct fdescmount {
-	struct vnode	*f_root;	/* Root node */
-};
 
 #define FD_ROOT		2
 #define FD_DEVFD	3
@@ -67,7 +64,6 @@
 	int		fd_ix;		/* filesystem index */
 };
 
-#define VFSTOFDESC(mp)	((struct fdescmount *)((mp)->mnt_data))
 #define	VTOFDESC(vp) ((struct fdescnode *)(vp)->v_data)
 
 extern dev_t devctty;

Index: src/sys/miscfs/fdesc/fdesc_vfsops.c
diff -u src/sys/miscfs/fdesc/fdesc_vfsops.c:1.81 src/sys/miscfs/fdesc/fdesc_vfsops.c:1.82
--- src/sys/miscfs/fdesc/fdesc_vfsops.c:1.81	Fri Jul 31 18:44:58 2009
+++ src/sys/miscfs/fdesc/fdesc_vfsops.c	Fri Jul 31 19:47:47 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: fdesc_vfsops.c,v 1.81 2009/07/31 18:44:58 pooka Exp $	*/
+/*	$NetBSD: fdesc_vfsops.c,v 1.82 2009/07/31 19:47:47 pooka Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993, 1995
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdesc_vfsops.c,v 1.81 2009/07/31 18:44:58 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdesc_vfsops.c,v 1.82 2009/07/31 19:47:47 pooka Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -79,7 +79,6 @@
 {
 	struct lwp *l = curlwp;
 	int error = 0;
-	struct fdescmount *fmp;
 	struct vnode *rvp;
 
 	if (mp->mnt_flag & MNT_GETARGS) {
@@ -96,14 +95,11 @@
 	if (error)
 		return (error);
 
-	fmp = (struct fdescmount *)malloc(sizeof(struct fdescmount),
-M_UFSMNT, M_WAITOK);	/* XXX */
 	rvp->v_type = VDIR;
 	rvp->v_vflag |= VV_ROOT;
-	fmp->f_root = rvp;
 	mp->mnt_stat.f_namemax = MAXNAMLEN;
 	mp->mnt_flag |= MNT_LOCAL;
-	mp->mnt_data = fmp;
+	mp->mnt_data = rvp;
 	vfs_getnewfsid(mp);
 
 	error = set_statvfs_info(path, UIO_USERSPACE, "fdesc", UIO_SYSSPACE,
@@ -123,7 +119,7 @@
 {
 	int error;
 	int flags = 0;
-	struct vnode *rtvp = VFSTOFDESC(mp)->f_root;
+	struct vnode *rtvp = mp->mnt_data;
 
 	if (mntflags & MNT_FORCE)
 		flags |= FORCECLOSE;
@@ -137,10 +133,6 @@
 	 * Blow it away for future re-use
 	 */
 	vgone(rtvp);
-	/*
-	 * Finally, throw away the fdescmount structure
-	 */
-	free(mp->mnt_data, M_UFSMNT);	/* XXX */
 	mp->mnt_data = NULL;
 
 	return (0);
@@ -154,7 +146,7 @@
 	/*
 	 * Return locked reference to root.
 	 */
-	vp = VFSTOFDESC(mp)->f_root;
+	vp = mp->mnt_data;
 	VREF(vp);
 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	*vpp = vp;



CVS commit: src/lib/libc

2009-07-31 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Fri Jul 31 20:40:01 UTC 2009

Modified Files:
src/lib/libc/arch/alpha/stdlib: Makefile.inc
src/lib/libc/arch/arm/stdlib: Makefile.inc
src/lib/libc/arch/hppa/stdlib: Makefile.inc
src/lib/libc/arch/i386/stdlib: Makefile.inc
src/lib/libc/arch/ia64/stdlib: Makefile.inc
src/lib/libc/arch/m68k/stdlib: Makefile.inc
src/lib/libc/arch/mips/stdlib: Makefile.inc
src/lib/libc/arch/powerpc/stdlib: Makefile.inc
src/lib/libc/arch/powerpc64/stdlib: Makefile.inc
src/lib/libc/arch/sh3/stdlib: Makefile.inc
src/lib/libc/arch/sparc/stdlib: Makefile.inc
src/lib/libc/arch/sparc64/stdlib: Makefile.inc
src/lib/libc/arch/vax/stdlib: Makefile.inc
src/lib/libc/arch/x86_64/stdlib: Makefile.inc
src/lib/libc/stdlib: Makefile.inc

Log Message:
Add the 'abs', 'div' and 'erand48' sources to stdlib/Makefile.inc.
Change the arch files only include the .S files.
This adds imaxdiv() to some archs where it was missing.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/alpha/stdlib/Makefile.inc
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/arm/stdlib/Makefile.inc
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/hppa/stdlib/Makefile.inc
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/i386/stdlib/Makefile.inc
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/ia64/stdlib/Makefile.inc
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/m68k/stdlib/Makefile.inc
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/mips/stdlib/Makefile.inc
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/powerpc/stdlib/Makefile.inc
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/powerpc64/stdlib/Makefile.inc
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/sh3/stdlib/Makefile.inc
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/sparc/stdlib/Makefile.inc
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/sparc64/stdlib/Makefile.inc
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/vax/stdlib/Makefile.inc
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/x86_64/stdlib/Makefile.inc
cvs rdiff -u -r1.72 -r1.73 src/lib/libc/stdlib/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/alpha/stdlib/Makefile.inc
diff -u src/lib/libc/arch/alpha/stdlib/Makefile.inc:1.4 src/lib/libc/arch/alpha/stdlib/Makefile.inc:1.5
--- src/lib/libc/arch/alpha/stdlib/Makefile.inc:1.4	Mon Aug  4 21:29:28 2008
+++ src/lib/libc/arch/alpha/stdlib/Makefile.inc	Fri Jul 31 20:39:59 2009
@@ -1,5 +1 @@
-#	$NetBSD: Makefile.inc,v 1.4 2008/08/04 21:29:28 matt Exp $
-
-SRCS+=	abs.c div.c labs.c ldiv.c llabs.c imaxabs.c imaxdiv.c
-
-SRCS+=	erand48_ieee754.c
+#	$NetBSD: Makefile.inc,v 1.5 2009/07/31 20:39:59 dsl Exp $

Index: src/lib/libc/arch/arm/stdlib/Makefile.inc
diff -u src/lib/libc/arch/arm/stdlib/Makefile.inc:1.3 src/lib/libc/arch/arm/stdlib/Makefile.inc:1.4
--- src/lib/libc/arch/arm/stdlib/Makefile.inc:1.3	Mon Aug  4 21:29:28 2008
+++ src/lib/libc/arch/arm/stdlib/Makefile.inc	Fri Jul 31 20:39:59 2009
@@ -1,5 +1 @@
-#	$NetBSD: Makefile.inc,v 1.3 2008/08/04 21:29:28 matt Exp $
-
-SRCS+=	abs.c div.c labs.c ldiv.c llabs.c imaxabs.c imaxdiv.c
-
-SRCS+=	erand48_ieee754.c
+#	$NetBSD: Makefile.inc,v 1.4 2009/07/31 20:39:59 dsl Exp $

Index: src/lib/libc/arch/hppa/stdlib/Makefile.inc
diff -u src/lib/libc/arch/hppa/stdlib/Makefile.inc:1.3 src/lib/libc/arch/hppa/stdlib/Makefile.inc:1.4
--- src/lib/libc/arch/hppa/stdlib/Makefile.inc:1.3	Mon Aug  4 21:29:28 2008
+++ src/lib/libc/arch/hppa/stdlib/Makefile.inc	Fri Jul 31 20:39:59 2009
@@ -1,5 +1 @@
-#	$NetBSD: Makefile.inc,v 1.3 2008/08/04 21:29:28 matt Exp $
-
-SRCS+=	abs.c div.c labs.c ldiv.c llabs.c imaxabs.c imaxdiv.c
-
-SRCS+=	erand48_ieee754.c
+#	$NetBSD: Makefile.inc,v 1.4 2009/07/31 20:39:59 dsl Exp $

Index: src/lib/libc/arch/i386/stdlib/Makefile.inc
diff -u src/lib/libc/arch/i386/stdlib/Makefile.inc:1.6 src/lib/libc/arch/i386/stdlib/Makefile.inc:1.7
--- src/lib/libc/arch/i386/stdlib/Makefile.inc:1.6	Mon Aug  4 21:29:28 2008
+++ src/lib/libc/arch/i386/stdlib/Makefile.inc	Fri Jul 31 20:39:59 2009
@@ -1,13 +1,5 @@
-#	$NetBSD: Makefile.inc,v 1.6 2008/08/04 21:29:28 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.7 2009/07/31 20:39:59 dsl Exp $
 
-# objects built from assembler sources (need lint stubs)
+# objects built from assembler sources
 SRCS+=	abs.S div.S labs.S ldiv.S llabs.S
-
-# objects built from C sources
-SRCS+=	erand48_ieee754.c
-
-SRCS.i386.stdlib=Lint_abs.c Lint_labs.c Lint_llabs.c Lint_imaxabs.c
-SRCS.i386.stdlib+=Lint_div.c Lint_ldiv.c
-LSRCS+=		${SRCS.i386.stdlib}
-DPSRCS+=	${SRCS.i386.stdlib}
-CLEANFILES+=	${SRCS.i386.stdlib}
+NO_SRCS+= imaxabs.c imaxdiv.c

Index: src/lib/libc/arch/ia64/stdlib/Makefile.inc
diff -u src/lib/libc/arch/ia64/stdlib/Makefile.inc:1.3 src/lib/libc/arch/ia64/stdlib/Makefile.inc:1.4
--- src/lib/libc/arch/ia64/stdlib/Makefile.inc:1.3	Mon Aug  4 21:29:28 2008
+++ src/lib/libc/arch/ia64/stdlib/Makef

CVS commit: src/sys/dev/pci

2009-07-31 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Jul 31 20:47:25 UTC 2009

Modified Files:
src/sys/dev/pci: twa.c

Log Message:
Disable completely bogus DIAGNOSTIC check.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/pci/twa.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/twa.c
diff -u src/sys/dev/pci/twa.c:1.31 src/sys/dev/pci/twa.c:1.32
--- src/sys/dev/pci/twa.c:1.31	Tue May 12 08:23:01 2009
+++ src/sys/dev/pci/twa.c	Fri Jul 31 20:47:25 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: twa.c,v 1.31 2009/05/12 08:23:01 cegger Exp $ */
+/*	$NetBSD: twa.c,v 1.32 2009/07/31 20:47:25 bouyer Exp $ */
 /*	$wasabi: twa.c,v 1.27 2006/07/28 18:17:21 wrstuden Exp $	*/
 
 /*-
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: twa.c,v 1.31 2009/05/12 08:23:01 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: twa.c,v 1.32 2009/07/31 20:47:25 bouyer Exp $");
 
 #include 
 #include 
@@ -1300,7 +1300,7 @@
 }
 
 
-#ifdef		DIAGNOSTIC
+#if 0
 static void
 twa_check_response_q(struct twa_request *tr, int clear)
 {
@@ -1321,6 +1321,7 @@
 		req = tr;
 
 	if ((tr->tr_cmd_pkt_type & TWA_CMD_PKT_TYPE_EXTERNAL) != 0) {
+		XXX this is bogus ! req can't be anything else but tr !
 		if (req->tr_request_id == tr->tr_request_id) 
 			panic("req id: %d on controller queue twice",
 			tr->tr_request_id);
@@ -1353,7 +1354,7 @@
 		/* Response queue is not empty. */
 		rq.value = twa_inl(sc, TWA_RESPONSE_QUEUE_OFFSET);
 		tr = sc->sc_twa_request + rq.u.response_id;
-#ifdef		DIAGNOSTIC
+#if 0
 		twa_check_response_q(tr, 0);
 #endif
 		/* Unmap the command packet, and any associated data buffer. */
@@ -1367,7 +1368,7 @@
 	}
 	(void)twa_drain_pending_queue(sc);
 	
-#ifdef		DIAGNOSTIC	
+#if 0
 	twa_check_response_q(NULL, 1);
 #endif
 	return(rv);



CVS commit: src/lib/libc/arch/i386/stdlib

2009-07-31 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Fri Jul 31 20:54:36 UTC 2009

Modified Files:
src/lib/libc/arch/i386/stdlib: Makefile.inc

Log Message:
Don't remove imaxdiv.c


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/arch/i386/stdlib/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/i386/stdlib/Makefile.inc
diff -u src/lib/libc/arch/i386/stdlib/Makefile.inc:1.7 src/lib/libc/arch/i386/stdlib/Makefile.inc:1.8
--- src/lib/libc/arch/i386/stdlib/Makefile.inc:1.7	Fri Jul 31 20:39:59 2009
+++ src/lib/libc/arch/i386/stdlib/Makefile.inc	Fri Jul 31 20:54:35 2009
@@ -1,5 +1,5 @@
-#	$NetBSD: Makefile.inc,v 1.7 2009/07/31 20:39:59 dsl Exp $
+#	$NetBSD: Makefile.inc,v 1.8 2009/07/31 20:54:35 dsl Exp $
 
 # objects built from assembler sources
 SRCS+=	abs.S div.S labs.S ldiv.S llabs.S
-NO_SRCS+= imaxabs.c imaxdiv.c
+NO_SRCS+= imaxabs.c



CVS commit: src/sys/ufs/ffs

2009-07-31 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jul 31 20:58:50 UTC 2009

Modified Files:
src/sys/ufs/ffs: ffs_vfsops.c

Log Message:
Don't free extattr resources until it is certain that unmount
succeeds.  Also, "unmount system call" -> "unmount vfs operation"
in comment just so that our comments aren't 15+ years outdated.


To generate a diff of this commit:
cvs rdiff -u -r1.249 -r1.250 src/sys/ufs/ffs/ffs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.249 src/sys/ufs/ffs/ffs_vfsops.c:1.250
--- src/sys/ufs/ffs/ffs_vfsops.c:1.249	Thu Jul 23 01:10:02 2009
+++ src/sys/ufs/ffs/ffs_vfsops.c	Fri Jul 31 20:58:50 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_vfsops.c,v 1.249 2009/07/23 01:10:02 pooka Exp $	*/
+/*	$NetBSD: ffs_vfsops.c,v 1.250 2009/07/31 20:58:50 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.249 2009/07/23 01:10:02 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.250 2009/07/31 20:58:50 pooka Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1364,7 +1364,7 @@
 }
 
 /*
- * unmount system call
+ * unmount vfs operation
  */
 int
 ffs_unmount(struct mount *mp, int mntflags)
@@ -1380,12 +1380,6 @@
 	flags = 0;
 	if (mntflags & MNT_FORCE)
 		flags |= FORCECLOSE;
-#ifdef UFS_EXTATTR
-	if (ump->um_fstype == UFS1) {
-		ufs_extattr_stop(mp, l);
-		ufs_extattr_uepm_destroy(&ump->um_extattr);
-	}
-#endif /* UFS_EXTATTR */
 	if ((error = ffs_flushfiles(mp, flags, l)) != 0)
 		return (error);
 	error = UFS_WAPBL_BEGIN(mp);
@@ -1412,6 +1406,13 @@
 		return error;
 	}
 #endif /* WAPBL */
+#ifdef UFS_EXTATTR
+	if (ump->um_fstype == UFS1) {
+		ufs_extattr_stop(mp, l);
+		ufs_extattr_uepm_destroy(&ump->um_extattr);
+	}
+#endif /* UFS_EXTATTR */
+
 	if (ump->um_devvp->v_type != VBAD)
 		ump->um_devvp->v_specmountpoint = NULL;
 	vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY);