CVS commit: src/distrib/sets/lists/debug

2015-09-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Sep  1 19:58:57 UTC 2015

Modified Files:
src/distrib/sets/lists/debug: shl.mi

Log Message:
mark a rump library as such


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/distrib/sets/lists/debug/shl.mi

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

Modified files:

Index: src/distrib/sets/lists/debug/shl.mi
diff -u src/distrib/sets/lists/debug/shl.mi:1.108 src/distrib/sets/lists/debug/shl.mi:1.109
--- src/distrib/sets/lists/debug/shl.mi:1.108	Thu Aug 13 06:36:38 2015
+++ src/distrib/sets/lists/debug/shl.mi	Tue Sep  1 15:58:57 2015
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.108 2015/08/13 10:36:38 christos Exp $
+# $NetBSD: shl.mi,v 1.109 2015/09/01 19:58:57 christos Exp $
 ./usr/libdata/debug/lib		base-sys-usr	debug,dynamicroot,compatdir
 ./usr/libdata/debug/lib/libblacklist.so.0.0.debug		comp-sys-debug	debug,dynamicroot
 ./usr/libdata/debug/lib/libc.so.12.197.debug			comp-sys-debug	debug,dynamicroot
@@ -19,7 +19,7 @@
 ./usr/libdata/debug/lib/libppath.so.0.0.debug			comp-sys-debug	debug,dynamicroot
 ./usr/libdata/debug/lib/libprop.so.1.1.debug			comp-sys-debug	debug,dynamicroot
 ./usr/libdata/debug/lib/libradius.so.4.0.debug			comp-sys-debug	debug,dynamicroot
-./usr/libdata/debug/lib/librumpclient.so.0.0.debug		comp-sys-debug	debug,dynamicroot
+./usr/libdata/debug/lib/librumpclient.so.0.0.debug		comp-sys-debug	debug,dynamicroot,rump
 ./usr/libdata/debug/lib/libterminfo.so.1.0.debug		comp-sys-debug	debug,dynamicroot
 ./usr/libdata/debug/lib/libutil.so.7.22.debug			comp-sys-debug	debug,dynamicroot
 ./usr/libdata/debug/lib/libz.so.1.0.debug			comp-sys-debug	debug,dynamicroot



CVS commit: src/sys/dev/gpio

2015-09-01 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Tue Sep  1 19:25:32 UTC 2015

Modified Files:
src/sys/dev/gpio: gpioiic.c

Log Message:
i2c_acquire_bus() should return 0 on success.
Fixed bug in gpioiic_bb_set_bits(), which was introduced with the SDA/SCL-
reverse feature.
Now the driver is confirmed to work. Tested with Raspberry Pi GPIO.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/gpio/gpioiic.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/gpio/gpioiic.c
diff -u src/sys/dev/gpio/gpioiic.c:1.6 src/sys/dev/gpio/gpioiic.c:1.7
--- src/sys/dev/gpio/gpioiic.c:1.6	Sat Oct 27 17:18:16 2012
+++ src/sys/dev/gpio/gpioiic.c	Tue Sep  1 19:25:32 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: gpioiic.c,v 1.6 2012/10/27 17:18:16 chs Exp $ */
+/* $NetBSD: gpioiic.c,v 1.7 2015/09/01 19:25:32 phx Exp $ */
 /*	$OpenBSD: gpioiic.c,v 1.8 2008/11/24 12:12:12 mbalmer Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gpioiic.c,v 1.6 2012/10/27 17:18:16 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gpioiic.c,v 1.7 2015/09/01 19:25:32 phx Exp $");
 
 /*
  * I2C bus bit-banging through GPIO pins.
@@ -232,10 +232,10 @@ gpioiic_i2c_acquire_bus(void *cookie, in
 	struct gpioiic_softc *sc = cookie;
 
 	if (flags & I2C_F_POLL)
-		return 0;
+		return 1;
 
 	rw_enter(>sc_i2c_lock, RW_WRITER);
-	return 1;
+	return 0;
 }
 
 void
@@ -286,8 +286,8 @@ gpioiic_bb_set_bits(void *cookie, uint32
 
 	gpio_pin_write(sc->sc_gpio, >sc_map, sc->sc_pin_sda,
 	bits & GPIOIIC_SDA ? GPIO_PIN_HIGH : GPIO_PIN_LOW);
-	gpio_pin_write(sc->sc_gpio, >sc_map, GPIOIIC_PIN_SCL,
-	bits & GPIOIIC_SCL ? GPIO_PIN_HIGH : sc->sc_pin_scl);
+	gpio_pin_write(sc->sc_gpio, >sc_map, sc->sc_pin_scl,
+	bits & GPIOIIC_SCL ? GPIO_PIN_HIGH : GPIO_PIN_LOW);
 }
 
 void



CVS commit: src/lib/libc/stdlib

2015-09-01 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Sep  1 19:39:57 UTC 2015

Modified Files:
src/lib/libc/stdlib: getopt_long.c

Log Message:
ANSIfy getopt(3) - this is the REPLACE_GETOPT version from getopt_long(3)

For the reference, this version still passes the current set of ATF tests
for the getopt(3) function.

This version is by default unused.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/lib/libc/stdlib/getopt_long.c

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/stdlib/getopt_long.c
diff -u src/lib/libc/stdlib/getopt_long.c:1.26 src/lib/libc/stdlib/getopt_long.c:1.27
--- src/lib/libc/stdlib/getopt_long.c:1.26	Tue Sep  1 01:28:17 2015
+++ src/lib/libc/stdlib/getopt_long.c	Tue Sep  1 19:39:57 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: getopt_long.c,v 1.26 2015/09/01 01:28:17 kamil Exp $	*/
+/*	$NetBSD: getopt_long.c,v 1.27 2015/09/01 19:39:57 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: getopt_long.c,v 1.26 2015/09/01 01:28:17 kamil Exp $");
+__RCSID("$NetBSD: getopt_long.c,v 1.27 2015/09/01 19:39:57 kamil Exp $");
 
 #include "namespace.h"
 
@@ -307,10 +307,7 @@ start:
  * [eventually this will replace the real getopt]
  */
 int
-getopt(nargc, nargv, options)
-	int nargc;
-	char * const *nargv;
-	const char *options;
+getopt(int nargc, char * const *nargv, const char *options)
 {
 	int retval;
 



CVS commit: src/sbin/fsck_lfs

2015-09-01 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Sep  1 06:13:34 UTC 2015

Modified Files:
src/sbin/fsck_lfs: lfs.c lfs_user.h pass6.c

Log Message:
Use daddr_t, not ulfs_daddr_t, as the latter's 32 bits wide.
Don't use either for on-disk items.
Part 1 of 3.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sbin/fsck_lfs/lfs.c
cvs rdiff -u -r1.11 -r1.12 src/sbin/fsck_lfs/lfs_user.h
cvs rdiff -u -r1.45 -r1.46 src/sbin/fsck_lfs/pass6.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/fsck_lfs/lfs.c
diff -u src/sbin/fsck_lfs/lfs.c:1.60 src/sbin/fsck_lfs/lfs.c:1.61
--- src/sbin/fsck_lfs/lfs.c:1.60	Tue Sep  1 06:12:04 2015
+++ src/sbin/fsck_lfs/lfs.c	Tue Sep  1 06:13:33 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs.c,v 1.60 2015/09/01 06:12:04 dholland Exp $ */
+/* $NetBSD: lfs.c,v 1.61 2015/09/01 06:13:33 dholland Exp $ */
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -336,7 +336,7 @@ lfs_ifind(struct lfs *fs, ino_t ino, str
  * XXX it currently loses atime information.
  */
 struct uvnode *
-lfs_raw_vget(struct lfs * fs, ino_t ino, int fd, ulfs_daddr_t daddr)
+lfs_raw_vget(struct lfs * fs, ino_t ino, int fd, daddr_t daddr)
 {
 	struct uvnode *vp;
 	struct inode *ip;
@@ -412,7 +412,7 @@ static struct uvnode *
 lfs_vget(void *vfs, ino_t ino)
 {
 	struct lfs *fs = (struct lfs *)vfs;
-	ulfs_daddr_t daddr;
+	daddr_t daddr;
 	struct ubuf *bp;
 	IFILE *ifp;
 

Index: src/sbin/fsck_lfs/lfs_user.h
diff -u src/sbin/fsck_lfs/lfs_user.h:1.11 src/sbin/fsck_lfs/lfs_user.h:1.12
--- src/sbin/fsck_lfs/lfs_user.h:1.11	Wed Aug 19 20:33:29 2015
+++ src/sbin/fsck_lfs/lfs_user.h	Tue Sep  1 06:13:33 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_user.h,v 1.11 2015/08/19 20:33:29 dholland Exp $ */
+/* $NetBSD: lfs_user.h,v 1.12 2015/09/01 06:13:33 dholland Exp $ */
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -83,7 +83,7 @@ int lfs_vop_strategy(struct ubuf *);
 int lfs_vop_bwrite(struct ubuf *);
 int lfs_vop_bmap(struct uvnode *, daddr_t, daddr_t *);
 
-struct uvnode *lfs_raw_vget(struct lfs *, ino_t, int, ulfs_daddr_t);
+struct uvnode *lfs_raw_vget(struct lfs *, ino_t, int, daddr_t);
 struct lfs *lfs_init(int, daddr_t, daddr_t, int, int);
 struct lfs *lfs_verify(struct lfs *, struct lfs *, struct uvnode *, int);
 int check_summary(struct lfs *, union segsum *, ulfs_daddr_t, int, struct uvnode *, void (*)(ulfs_daddr_t, union finfo *));

Index: src/sbin/fsck_lfs/pass6.c
diff -u src/sbin/fsck_lfs/pass6.c:1.45 src/sbin/fsck_lfs/pass6.c:1.46
--- src/sbin/fsck_lfs/pass6.c:1.45	Tue Sep  1 06:12:04 2015
+++ src/sbin/fsck_lfs/pass6.c	Tue Sep  1 06:13:33 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: pass6.c,v 1.45 2015/09/01 06:12:04 dholland Exp $	 */
+/* $NetBSD: pass6.c,v 1.46 2015/09/01 06:13:33 dholland Exp $	 */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -219,7 +219,7 @@ remove_ino(struct uvnode *vp, ino_t ino)
 	CLEANERINFO *cip;
 	struct ubuf *bp, *sbp, *cbp;
 	struct inodesc idesc;
-	ulfs_daddr_t daddr;
+	daddr_t daddr;
 
 	if (debug)
 		pwarn("remove ino %d\n", (int)ino);
@@ -422,13 +422,13 @@ account_block_changes(union lfs_dinode *
  * free list accounting is done.
  */
 static void
-readdress_inode(union lfs_dinode *dp, ulfs_daddr_t daddr)
+readdress_inode(union lfs_dinode *dp, daddr_t daddr)
 {
 	IFILE *ifp;
 	SEGUSE *sup;
 	struct ubuf *bp;
 	int sn;
-	ulfs_daddr_t odaddr;
+	daddr_t odaddr;
 	ino_t thisino = lfs_dino_getinumber(fs, dp);
 	struct uvnode *vp;
 
@@ -443,10 +443,10 @@ readdress_inode(union lfs_dinode *dp, ul
 	VOP_BWRITE(bp);
 
 	if (debug)
-		pwarn("readdress ino %ju from 0x%x to 0x%x mode %o nlink %d\n",
+		pwarn("readdress ino %ju from 0x%jx to 0x%jx mode %o nlink %d\n",
 			(uintmax_t)lfs_dino_getinumber(fs, dp),
-			(unsigned)odaddr,
-			(unsigned)daddr,
+			(uintmax_t)odaddr,
+			(intmax_t)daddr,
 			(int)lfs_dino_getmode(fs, dp),
 			(int)lfs_dino_getnlink(fs, dp));
 
@@ -549,7 +549,8 @@ alloc_inode(ino_t thisino, ulfs_daddr_t 
 void
 pass6(void)
 {
-	ulfs_daddr_t daddr, ibdaddr, odaddr, lastgood, *idaddrp;
+	daddr_t daddr, ibdaddr, odaddr, lastgood;
+	uint32_t *idaddrp; /* XXX ondisk32 */
 	struct uvnode *vp, *devvp;
 	CLEANERINFO *cip;
 	SEGUSE *sup;
@@ -618,13 +619,14 @@ pass6(void)
 	break;
 			}
 		}
+		KASSERT(hassuper == 0 || hassuper == 1);
 		
 		/* Read in summary block */
 		bread(devvp, LFS_FSBTODB(fs, daddr), lfs_sb_getsumsize(fs), 0, );
 		sp = (SEGSUM *)bp->b_data;
 		if (debug)
-			pwarn("sum at 0x%x: ninos=%d nfinfo=%d\n",
-(unsigned)daddr, (int)lfs_ss_getninos(fs, sp),
+			pwarn("sum at 0x%jx: ninos=%d nfinfo=%d\n",
+(intmax_t)daddr, (int)lfs_ss_getninos(fs, sp),
 (int)lfs_ss_getnfinfo(fs, sp));
 
 		/* We have verified that this is a good summary. */
@@ -650,7 +652,8 @@ pass6(void)
 			LFS_INOPB(fs)) *
 		lfs_sb_getibsize(fs)));
 		}
-		idaddrp = 

CVS commit: src/sys/ufs/lfs

2015-09-01 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Sep  1 06:13:09 UTC 2015

Modified Files:
src/sys/ufs/lfs: lfs_accessors.h lfs_inode.c

Log Message:
Fix up indirect block handling in truncate to be 32/64 clean.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/ufs/lfs/lfs_accessors.h
cvs rdiff -u -r1.146 -r1.147 src/sys/ufs/lfs/lfs_inode.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/lfs/lfs_accessors.h
diff -u src/sys/ufs/lfs/lfs_accessors.h:1.20 src/sys/ufs/lfs/lfs_accessors.h:1.21
--- src/sys/ufs/lfs/lfs_accessors.h:1.20	Tue Sep  1 06:12:33 2015
+++ src/sys/ufs/lfs/lfs_accessors.h	Tue Sep  1 06:13:09 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_accessors.h,v 1.20 2015/09/01 06:12:33 dholland Exp $	*/
+/*	$NetBSD: lfs_accessors.h,v 1.21 2015/09/01 06:13:09 dholland Exp $	*/
 
 /*  from NetBSD: lfs.h,v 1.165 2015/07/24 06:59:32 dholland Exp  */
 /*  from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp  */
@@ -214,11 +214,6 @@
 #define LFS_MAXSYMLINKLEN(fs) \
 	((fs)->lfs_is64 ? LFS64_MAXSYMLINKLEN : LFS32_MAXSYMLINKLEN)
 
-/* get rid of this eventually */
-#define ULFS_MAXSYMLINKLEN(ip) \
-	((ip)->i_ump->um_fstype == ULFS1) ? \
-	LFS32_MAXSYMLINKLEN : LFS64_MAXSYMLINKLEN
-
 #define DINOSIZE(fs) ((fs)->lfs_is64 ? sizeof(struct lfs64_dinode) : sizeof(struct lfs32_dinode))
 
 #define DINO_IN_BLOCK(fs, base, ix) \

Index: src/sys/ufs/lfs/lfs_inode.c
diff -u src/sys/ufs/lfs/lfs_inode.c:1.146 src/sys/ufs/lfs/lfs_inode.c:1.147
--- src/sys/ufs/lfs/lfs_inode.c:1.146	Tue Sep  1 06:08:37 2015
+++ src/sys/ufs/lfs/lfs_inode.c	Tue Sep  1 06:13:09 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_inode.c,v 1.146 2015/09/01 06:08:37 dholland Exp $	*/
+/*	$NetBSD: lfs_inode.c,v 1.147 2015/09/01 06:13:09 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.146 2015/09/01 06:08:37 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.147 2015/09/01 06:13:09 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -726,10 +726,10 @@ lfs_indirtrunc(struct inode *ip, daddr_t
 	int i;
 	struct buf *bp;
 	struct lfs *fs = ip->i_lfs;
-	int32_t *bap;	/* XXX ondisk32 */
+	void *bap;
+	bool bap_needs_free;
 	struct vnode *vp;
 	daddr_t nb, nlbn, last;
-	int32_t *copy = NULL;	/* XXX ondisk32 */
 	daddr_t blkcount, rblkcount, factor;
 	int nblocks;
 	daddr_t blocksreleased = 0, real_released = 0;
@@ -777,17 +777,25 @@ lfs_indirtrunc(struct inode *ip, daddr_t
 		return (error);
 	}
 
-	bap = (int32_t *)bp->b_data;	/* XXX ondisk32 */
 	if (lastbn >= 0) {
-		copy = lfs_malloc(fs, lfs_sb_getbsize(fs), LFS_NB_IBLOCK);
-		memcpy((void *)copy, (void *)bap, lfs_sb_getbsize(fs));
-		memset((void *)[last + 1], 0,
-		/* XXX ondisk32 */
-		  (u_int)(LFS_NINDIR(fs) - (last + 1)) * sizeof (int32_t));
+		/*
+		 * We still need this block, so copy the data for
+		 * subsequent processing; then in the original block,
+		 * zero out the dying block pointers and send it off.
+		 */
+		bap = lfs_malloc(fs, lfs_sb_getbsize(fs), LFS_NB_IBLOCK);
+		memcpy(bap, bp->b_data, lfs_sb_getbsize(fs));
+		bap_needs_free = true;
+
+		for (i = last + 1; i < LFS_NINDIR(fs); i++) {
+			lfs_iblock_set(fs, bp->b_data, i, 0);
+		}
 		error = VOP_BWRITE(bp->b_vp, bp);
 		if (error)
 			allerror = error;
-		bap = copy;
+	} else {
+		bap = bp->b_data;
+		bap_needs_free = false;
 	}
 
 	/*
@@ -795,7 +803,7 @@ lfs_indirtrunc(struct inode *ip, daddr_t
 	 */
 	for (i = LFS_NINDIR(fs) - 1, nlbn = lbn + 1 - i * factor; i > last;
 	i--, nlbn += factor) {
-		nb = bap[i];
+		nb = lfs_iblock_get(fs, bap, i);
 		if (nb == 0)
 			continue;
 		if (level > SINGLE) {
@@ -809,7 +817,7 @@ lfs_indirtrunc(struct inode *ip, daddr_t
 			real_released += rblkcount;
 		}
 		lfs_blkfree(fs, ip, nb, lfs_sb_getbsize(fs), lastsegp, bcp);
-		if (bap[i] > 0)
+		if (lfs_iblock_get(fs, bap, i) > 0)
 			real_released += nblocks;
 		blocksreleased += nblocks;
 	}
@@ -819,7 +827,7 @@ lfs_indirtrunc(struct inode *ip, daddr_t
 	 */
 	if (level > SINGLE && lastbn >= 0) {
 		last = lastbn % factor;
-		nb = bap[i];
+		nb = lfs_iblock_get(fs, bap, i);
 		if (nb != 0) {
 			error = lfs_indirtrunc(ip, nlbn, nb,
 	   last, level - 1, ,
@@ -831,8 +839,8 @@ lfs_indirtrunc(struct inode *ip, daddr_t
 		}
 	}
 
-	if (copy != NULL) {
-		lfs_free(fs, copy, LFS_NB_IBLOCK);
+	if (bap_needs_free) {
+		lfs_free(fs, bap, LFS_NB_IBLOCK);
 	} else {
 		mutex_enter(_lock);
 		if (bp->b_oflags & BO_DELWRI) {



CVS commit: src/sbin/fsck_lfs

2015-09-01 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Sep  1 06:13:57 UTC 2015

Modified Files:
src/sbin/fsck_lfs: lfs.c lfs_user.h pass6.c

Log Message:
Use daddr_t, not ulfs_daddr_t, as the latter's 32 bits wide.
Don't use either for on-disk items.
Part 2 of 3.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sbin/fsck_lfs/lfs.c
cvs rdiff -u -r1.12 -r1.13 src/sbin/fsck_lfs/lfs_user.h
cvs rdiff -u -r1.46 -r1.47 src/sbin/fsck_lfs/pass6.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/fsck_lfs/lfs.c
diff -u src/sbin/fsck_lfs/lfs.c:1.61 src/sbin/fsck_lfs/lfs.c:1.62
--- src/sbin/fsck_lfs/lfs.c:1.61	Tue Sep  1 06:13:33 2015
+++ src/sbin/fsck_lfs/lfs.c	Tue Sep  1 06:13:57 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs.c,v 1.61 2015/09/01 06:13:33 dholland Exp $ */
+/* $NetBSD: lfs.c,v 1.62 2015/09/01 06:13:57 dholland Exp $ */
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -579,14 +579,14 @@ lfs_init(int devfd, daddr_t sblkno, dadd
  * or "goal" if we reached it without failure (the partial segment *at* goal
  * need not be valid).
  */
-ulfs_daddr_t
-try_verify(struct lfs *osb, struct uvnode *devvp, ulfs_daddr_t goal, int debug)
+daddr_t
+try_verify(struct lfs *osb, struct uvnode *devvp, daddr_t goal, int debug)
 {
-	ulfs_daddr_t daddr, odaddr;
+	daddr_t daddr, odaddr;
 	SEGSUM *sp;
 	int i, bc, hitclean;
 	struct ubuf *bp;
-	ulfs_daddr_t nodirop_daddr;
+	daddr_t nodirop_daddr;
 	u_int64_t serial;
 
 	bc = 0;
@@ -603,6 +603,7 @@ try_verify(struct lfs *osb, struct uvnod
 			if (daddr == lfs_sb_gets0addr(osb))
 daddr += lfs_btofsb(osb, LFS_LABELPAD);
 			for (i = 0; i < LFS_MAXNUMSB; i++) {
+/* XXX dholland 20150828 I think this is wrong */
 if (lfs_sb_getsboff(osb, i) < daddr)
 	break;
 if (lfs_sb_getsboff(osb, i) == daddr)
@@ -694,7 +695,7 @@ try_verify(struct lfs *osb, struct uvnod
 struct lfs *
 lfs_verify(struct lfs *sb0, struct lfs *sb1, struct uvnode *devvp, int debug)
 {
-	ulfs_daddr_t daddr;
+	daddr_t daddr;
 	struct lfs *osb, *nsb;
 
 	/*
@@ -753,14 +754,14 @@ lfs_verify(struct lfs *sb0, struct lfs *
 
 /* Verify a partial-segment summary; return the number of bytes on disk. */
 int
-check_summary(struct lfs *fs, SEGSUM *sp, ulfs_daddr_t pseg_addr, int debug,
-	  struct uvnode *devvp, void (func(ulfs_daddr_t, FINFO *)))
+check_summary(struct lfs *fs, SEGSUM *sp, daddr_t pseg_addr, int debug,
+	  struct uvnode *devvp, void (func(daddr_t, FINFO *)))
 {
 	FINFO *fp;
 	int bc;			/* Bytes in partial segment */
 	int nblocks;
-	ulfs_daddr_t daddr;
-	ulfs_daddr_t *dp, *idp;
+	daddr_t daddr;
+	uint32_t *dp, *idp; // XXX ondisk32
 	struct ubuf *bp;
 	int i, j, k, datac, len;
 	u_int32_t *datap;
@@ -786,8 +787,8 @@ check_summary(struct lfs *fs, SEGSUM *sp
 	datap = emalloc(nblocks * sizeof(*datap));
 	datac = 0;
 
-	dp = (ulfs_daddr_t *) sp;
-	dp += lfs_sb_getsumsize(fs) / sizeof(ulfs_daddr_t);
+	dp = (uint32_t *) sp; /* XXX ondisk32 */
+	dp += lfs_sb_getsumsize(fs) / sizeof(*dp);
 	dp--;
 
 	idp = dp;
@@ -796,13 +797,13 @@ check_summary(struct lfs *fs, SEGSUM *sp
 	for (i = 0, j = 0;
 	 i < lfs_ss_getnfinfo(fs, sp) || j < howmany(lfs_ss_getninos(fs, sp), LFS_INOPB(fs)); i++) {
 		if (i >= lfs_ss_getnfinfo(fs, sp) && *idp != daddr) {
-			pwarn("Not enough inode blocks in pseg at 0x%" PRIx32
-			  ": found %d, wanted %d\n",
+			pwarn("Not enough inode blocks in pseg at 0x%jx: "
+			  "found %d, wanted %d\n",
 			  pseg_addr, j, howmany(lfs_ss_getninos(fs, sp),
 		LFS_INOPB(fs)));
 			if (debug)
-pwarn("*idp=%x, daddr=%" PRIx32 "\n", *idp,
-  daddr);
+pwarn("*idp=0x%jx, daddr=0x%jx\n",
+(uintmax_t)*idp, (intmax_t)daddr);
 			break;
 		}
 		while (j < howmany(lfs_ss_getninos(fs, sp), LFS_INOPB(fs)) && *idp == daddr) {

Index: src/sbin/fsck_lfs/lfs_user.h
diff -u src/sbin/fsck_lfs/lfs_user.h:1.12 src/sbin/fsck_lfs/lfs_user.h:1.13
--- src/sbin/fsck_lfs/lfs_user.h:1.12	Tue Sep  1 06:13:33 2015
+++ src/sbin/fsck_lfs/lfs_user.h	Tue Sep  1 06:13:57 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_user.h,v 1.12 2015/09/01 06:13:33 dholland Exp $ */
+/* $NetBSD: lfs_user.h,v 1.13 2015/09/01 06:13:57 dholland Exp $ */
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -86,8 +86,8 @@ int lfs_vop_bmap(struct uvnode *, daddr_
 struct uvnode *lfs_raw_vget(struct lfs *, ino_t, int, daddr_t);
 struct lfs *lfs_init(int, daddr_t, daddr_t, int, int);
 struct lfs *lfs_verify(struct lfs *, struct lfs *, struct uvnode *, int);
-int check_summary(struct lfs *, union segsum *, ulfs_daddr_t, int, struct uvnode *, void (*)(ulfs_daddr_t, union finfo *));
-ulfs_daddr_t try_verify(struct lfs *, struct uvnode *, ulfs_daddr_t, int);
+int check_summary(struct lfs *, union segsum *, daddr_t, int, struct uvnode *, void (*)(daddr_t, union finfo *));
+daddr_t try_verify(struct lfs *, struct 

CVS commit: src

2015-09-01 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Sep  1 06:12:33 UTC 2015

Modified Files:
src/sbin/fsck_lfs: setup.c
src/sbin/newfs_lfs: make_lfs.c
src/sys/ufs/lfs: lfs_accessors.h

Log Message:
Tidy the MAXSYMLINKLEN macros.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sbin/fsck_lfs/setup.c
cvs rdiff -u -r1.46 -r1.47 src/sbin/newfs_lfs/make_lfs.c
cvs rdiff -u -r1.19 -r1.20 src/sys/ufs/lfs/lfs_accessors.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/fsck_lfs/setup.c
diff -u src/sbin/fsck_lfs/setup.c:1.57 src/sbin/fsck_lfs/setup.c:1.58
--- src/sbin/fsck_lfs/setup.c:1.57	Tue Sep  1 06:12:04 2015
+++ src/sbin/fsck_lfs/setup.c	Tue Sep  1 06:12:33 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: setup.c,v 1.57 2015/09/01 06:12:04 dholland Exp $ */
+/* $NetBSD: setup.c,v 1.58 2015/09/01 06:12:33 dholland Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -394,10 +394,10 @@ setup(const char *dev)
 			sbdirty();
 		}
 	}
-	if (lfs_sb_getmaxsymlinklen(fs) != ULFS1_MAXSYMLINKLEN) {
+	if (lfs_sb_getmaxsymlinklen(fs) != LFS_MAXSYMLINKLEN(fs)) {
 		pwarn("INCORRECT MAXSYMLINKLEN=%d IN SUPERBLOCK (SHOULD BE %zu)",
-		lfs_sb_getmaxsymlinklen(fs), ULFS1_MAXSYMLINKLEN);
-		lfs_sb_setmaxsymlinklen(fs, ULFS1_MAXSYMLINKLEN);
+		lfs_sb_getmaxsymlinklen(fs), LFS_MAXSYMLINKLEN(fs));
+		lfs_sb_setmaxsymlinklen(fs, LFS_MAXSYMLINKLEN(fs));
 		if (preen)
 			printf(" (FIXED)\n");
 		if (preen || reply("FIX") == 1) {

Index: src/sbin/newfs_lfs/make_lfs.c
diff -u src/sbin/newfs_lfs/make_lfs.c:1.46 src/sbin/newfs_lfs/make_lfs.c:1.47
--- src/sbin/newfs_lfs/make_lfs.c:1.46	Tue Sep  1 06:12:04 2015
+++ src/sbin/newfs_lfs/make_lfs.c	Tue Sep  1 06:12:33 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: make_lfs.c,v 1.46 2015/09/01 06:12:04 dholland Exp $	*/
+/*	$NetBSD: make_lfs.c,v 1.47 2015/09/01 06:12:33 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
 #if 0
 static char sccsid[] = "@(#)lfs.c	8.5 (Berkeley) 5/24/95";
 #else
-__RCSID("$NetBSD: make_lfs.c,v 1.46 2015/09/01 06:12:04 dholland Exp $");
+__RCSID("$NetBSD: make_lfs.c,v 1.47 2015/09/01 06:12:33 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -152,7 +152,7 @@ static const struct dlfs dlfs32_default 
 		.dlfs_fbmask =		DFL_LFS_FBMASK,
 		.dlfs_blktodb =		0,
 		.dlfs_sushift =		0,
-		.dlfs_maxsymlinklen =	ULFS1_MAXSYMLINKLEN,
+		.dlfs_maxsymlinklen =	LFS32_MAXSYMLINKLEN,
 		.dlfs_sboffs =		{ 0 },
 		.dlfs_nclean =  	0,
 		.dlfs_fsmnt =   	{ 0 },
@@ -216,7 +216,7 @@ static const struct dlfs64 dlfs64_defaul
 		.dlfs_blktodb =		0,
 		.dlfs_sushift =		0,
 		.dlfs_sboffs =		{ 0 },
-		.dlfs_maxsymlinklen =	ULFS2_MAXSYMLINKLEN,
+		.dlfs_maxsymlinklen =	LFS64_MAXSYMLINKLEN,
 		.dlfs_nclean =  	0,
 		.dlfs_fsmnt =   	{ 0 },
 		.dlfs_pflags =  	LFS_PF_CLEAN,

Index: src/sys/ufs/lfs/lfs_accessors.h
diff -u src/sys/ufs/lfs/lfs_accessors.h:1.19 src/sys/ufs/lfs/lfs_accessors.h:1.20
--- src/sys/ufs/lfs/lfs_accessors.h:1.19	Tue Sep  1 06:12:04 2015
+++ src/sys/ufs/lfs/lfs_accessors.h	Tue Sep  1 06:12:33 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_accessors.h,v 1.19 2015/09/01 06:12:04 dholland Exp $	*/
+/*	$NetBSD: lfs_accessors.h,v 1.20 2015/09/01 06:12:33 dholland Exp $	*/
 
 /*  from NetBSD: lfs.h,v 1.165 2015/07/24 06:59:32 dholland Exp  */
 /*  from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp  */
@@ -208,12 +208,16 @@
 /*
  * Maximum length of a symlink that can be stored within the inode.
  */
-#define ULFS1_MAXSYMLINKLEN	((ULFS_NDADDR + ULFS_NIADDR) * sizeof(int32_t))
-#define ULFS2_MAXSYMLINKLEN	((ULFS_NDADDR + ULFS_NIADDR) * sizeof(int64_t))
+#define LFS32_MAXSYMLINKLEN	((ULFS_NDADDR + ULFS_NIADDR) * sizeof(int32_t))
+#define LFS64_MAXSYMLINKLEN	((ULFS_NDADDR + ULFS_NIADDR) * sizeof(int64_t))
 
+#define LFS_MAXSYMLINKLEN(fs) \
+	((fs)->lfs_is64 ? LFS64_MAXSYMLINKLEN : LFS32_MAXSYMLINKLEN)
+
+/* get rid of this eventually */
 #define ULFS_MAXSYMLINKLEN(ip) \
 	((ip)->i_ump->um_fstype == ULFS1) ? \
-	ULFS1_MAXSYMLINKLEN : ULFS2_MAXSYMLINKLEN
+	LFS32_MAXSYMLINKLEN : LFS64_MAXSYMLINKLEN
 
 #define DINOSIZE(fs) ((fs)->lfs_is64 ? sizeof(struct lfs64_dinode) : sizeof(struct lfs32_dinode))
 



CVS commit: src

2015-09-01 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Sep  1 06:08:37 UTC 2015

Modified Files:
src/sbin/fsck_lfs: dir.c inode.c lfs.c pass6.c segwrite.c setup.c
src/sys/ufs/lfs: lfs_accessors.h lfs_alloc.c lfs_balloc.c lfs_inode.c
lfs_inode.h lfs_itimes.c lfs_rfw.c lfs_segment.c lfs_syscalls.c
lfs_vfsops.c lfs_vnops.c ulfs_bmap.c ulfs_inode.h ulfs_vnops.c

Log Message:
Use the lfs dinode accessors in place of the ufs-derived ones.
(Mostly.)

The ufs-derived ones are fake structure member macros, which are gross
and not very safe. Also, it seems that a lot of places in the lfs code
were using the ffsv1 branch of them unconditionally, and this way it's
guaranteed all those places have been updated.

Found while doing this: for non-devices, have getattr produce NODEV
in the rdev field instead of leaking the address of the first direct
block.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sbin/fsck_lfs/dir.c
cvs rdiff -u -r1.60 -r1.61 src/sbin/fsck_lfs/inode.c
cvs rdiff -u -r1.57 -r1.58 src/sbin/fsck_lfs/lfs.c
cvs rdiff -u -r1.43 -r1.44 src/sbin/fsck_lfs/pass6.c
cvs rdiff -u -r1.42 -r1.43 src/sbin/fsck_lfs/segwrite.c
cvs rdiff -u -r1.55 -r1.56 src/sbin/fsck_lfs/setup.c
cvs rdiff -u -r1.15 -r1.16 src/sys/ufs/lfs/lfs_accessors.h \
src/sys/ufs/lfs/ulfs_inode.h
cvs rdiff -u -r1.128 -r1.129 src/sys/ufs/lfs/lfs_alloc.c
cvs rdiff -u -r1.86 -r1.87 src/sys/ufs/lfs/lfs_balloc.c
cvs rdiff -u -r1.145 -r1.146 src/sys/ufs/lfs/lfs_inode.c
cvs rdiff -u -r1.10 -r1.11 src/sys/ufs/lfs/lfs_inode.h
cvs rdiff -u -r1.18 -r1.19 src/sys/ufs/lfs/lfs_itimes.c
cvs rdiff -u -r1.30 -r1.31 src/sys/ufs/lfs/lfs_rfw.c
cvs rdiff -u -r1.258 -r1.259 src/sys/ufs/lfs/lfs_segment.c
cvs rdiff -u -r1.169 -r1.170 src/sys/ufs/lfs/lfs_syscalls.c
cvs rdiff -u -r1.341 -r1.342 src/sys/ufs/lfs/lfs_vfsops.c
cvs rdiff -u -r1.287 -r1.288 src/sys/ufs/lfs/lfs_vnops.c
cvs rdiff -u -r1.6 -r1.7 src/sys/ufs/lfs/ulfs_bmap.c
cvs rdiff -u -r1.26 -r1.27 src/sys/ufs/lfs/ulfs_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/sbin/fsck_lfs/dir.c
diff -u src/sbin/fsck_lfs/dir.c:1.36 src/sbin/fsck_lfs/dir.c:1.37
--- src/sbin/fsck_lfs/dir.c:1.36	Wed Aug 12 18:28:00 2015
+++ src/sbin/fsck_lfs/dir.c	Tue Sep  1 06:08:37 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.36 2015/08/12 18:28:00 dholland Exp $	 */
+/* $NetBSD: dir.c,v 1.37 2015/09/01 06:08:37 dholland Exp $	 */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -316,7 +316,7 @@ fileerror(ino_t cwd, ino_t ino, const ch
 	else {
 		if (ftypeok(VTOD(vp)))
 			pfatal("%s=%s\n",
-			(VTOI(vp)->i_ffs1_mode & LFS_IFMT) == LFS_IFDIR ?
+			(lfs_dino_getmode(fs, VTOI(vp)->i_din) & LFS_IFMT) == LFS_IFDIR ?
 			"DIR" : "FILE", pathbuf);
 		else
 			pfatal("NAME=%s\n", pathbuf);
@@ -492,7 +492,8 @@ linkup(ino_t orphan, ino_t parentdir)
 		parentdir != (ino_t) - 1)
 			(void) makeentry(orphan, lfdir, "..");
 		vp = vget(fs, lfdir);
-		VTOI(vp)->i_ffs1_nlink++;
+		lfs_dino_setnlink(fs, VTOI(vp)->i_din,
+		lfs_dino_getnlink(fs, VTOI(vp)->i_din) + 1);
 		inodirty(VTOI(vp));
 		lncntp[lfdir]++;
 		pwarn("DIR I=%llu CONNECTED. ", (unsigned long long)orphan);
@@ -688,7 +689,8 @@ freedir(ino_t ino, ino_t parent)
 
 	if (ino != parent) {
 		vp = vget(fs, parent);
-		VTOI(vp)->i_ffs1_nlink--;
+		lfs_dino_setnlink(fs, VTOI(vp)->i_din,
+		lfs_dino_getnlink(fs, VTOI(vp)->i_din) - 1);
 		inodirty(VTOI(vp));
 	}
 	freeino(ino);

Index: src/sbin/fsck_lfs/inode.c
diff -u src/sbin/fsck_lfs/inode.c:1.60 src/sbin/fsck_lfs/inode.c:1.61
--- src/sbin/fsck_lfs/inode.c:1.60	Wed Aug 19 20:33:29 2015
+++ src/sbin/fsck_lfs/inode.c	Tue Sep  1 06:08:37 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: inode.c,v 1.60 2015/08/19 20:33:29 dholland Exp $	 */
+/* $NetBSD: inode.c,v 1.61 2015/09/01 06:08:37 dholland Exp $	 */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -305,7 +305,10 @@ iblock(struct inodesc *idesc, long ileve
 pathbuf, (long long)idesc->id_number);
 if (reply("ADJUST LENGTH") == 1) {
 	vp = vget(fs, idesc->id_number);
-	VTOI(vp)->i_ffs1_size -= isize;
+	lfs_dino_setsize(fs, VTOI(vp)->i_din,
+	lfs_dino_getsize(fs,
+			 VTOI(vp)->i_din)
+	- isize);
 	isize = 0;
 	printf(
 	"YOU MUST RERUN FSCK AFTERWARDS\n");
@@ -444,7 +447,7 @@ clri(struct inodesc * idesc, const char 
 	vp = vget(fs, idesc->id_number);
 	if (flag & 0x1) {
 		pwarn("%s %s", type,
-		  (VTOI(vp)->i_ffs1_mode & LFS_IFMT) == LFS_IFDIR ? "DIR" : "FILE");
+		  (lfs_dino_getmode(fs, VTOI(vp)->i_din) & LFS_IFMT) == LFS_IFDIR ? "DIR" : "FILE");
 		pinode(idesc->id_number);
 	}
 	if ((flag & 0x2) || preen || reply("CLEAR") == 1) {

Index: src/sbin/fsck_lfs/lfs.c
diff -u src/sbin/fsck_lfs/lfs.c:1.57 src/sbin/fsck_lfs/lfs.c:1.58
--- src/sbin/fsck_lfs/lfs.c:1.57	Wed Aug 19 20:33:29 2015
+++ src/sbin/fsck_lfs/lfs.c	Tue Sep  1 

CVS commit: src/sys/ufs/ufs

2015-09-01 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Sep  1 06:09:23 UTC 2015

Modified Files:
src/sys/ufs/ufs: ufs_vnops.c

Log Message:
Propagate fix from lfs:
For non-devices, have getattr (and thus stat) produce NODEV in the
rdev field, instead of leaking the address of the first direct block.


To generate a diff of this commit:
cvs rdiff -u -r1.230 -r1.231 src/sys/ufs/ufs/ufs_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/ufs/ufs/ufs_vnops.c
diff -u src/sys/ufs/ufs/ufs_vnops.c:1.230 src/sys/ufs/ufs/ufs_vnops.c:1.231
--- src/sys/ufs/ufs/ufs_vnops.c:1.230	Mon Apr 20 23:03:09 2015
+++ src/sys/ufs/ufs/ufs_vnops.c	Tue Sep  1 06:09:23 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_vnops.c,v 1.230 2015/04/20 23:03:09 riastradh Exp $	*/
+/*	$NetBSD: ufs_vnops.c,v 1.231 2015/09/01 06:09:23 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.230 2015/04/20 23:03:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.231 2015/09/01 06:09:23 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -378,8 +378,16 @@ ufs_getattr(void *v)
 	vap->va_gid = ip->i_gid;
 	vap->va_size = vp->v_size;
 	if (ip->i_ump->um_fstype == UFS1) {
-		vap->va_rdev = (dev_t)ufs_rw32(ip->i_ffs1_rdev,
-		UFS_MPNEEDSWAP(ip->i_ump));
+		switch (vp->v_type) {
+		case VBLK:
+		case VCHR:
+			vap->va_rdev = (dev_t)ufs_rw32(ip->i_ffs1_rdev,
+			UFS_MPNEEDSWAP(ip->i_ump));
+			break;
+		default:
+			vap->va_rdev = NODEV;
+			break;
+		}
 		vap->va_atime.tv_sec = ip->i_ffs1_atime;
 		vap->va_atime.tv_nsec = ip->i_ffs1_atimensec;
 		vap->va_mtime.tv_sec = ip->i_ffs1_mtime;
@@ -390,8 +398,16 @@ ufs_getattr(void *v)
 		vap->va_birthtime.tv_nsec = 0;
 		vap->va_bytes = dbtob((u_quad_t)ip->i_ffs1_blocks);
 	} else {
-		vap->va_rdev = (dev_t)ufs_rw64(ip->i_ffs2_rdev,
-		UFS_MPNEEDSWAP(ip->i_ump));
+		switch (vp->v_type) {
+		case VBLK:
+		case VCHR:
+			vap->va_rdev = (dev_t)ufs_rw64(ip->i_ffs2_rdev,
+			UFS_MPNEEDSWAP(ip->i_ump));
+			break;
+		default:
+			vap->va_rdev = NODEV;
+			break;
+		}
 		vap->va_atime.tv_sec = ip->i_ffs2_atime;
 		vap->va_atime.tv_nsec = ip->i_ffs2_atimensec;
 		vap->va_mtime.tv_sec = ip->i_ffs2_mtime;



CVS commit: src/sbin

2015-09-01 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Sep  1 06:15:02 UTC 2015

Modified Files:
src/sbin/fsck_lfs: fsck_vars.h inode.c lfs.c pass1.c pass4.c pass5.c
pass6.c segwrite.c segwrite.h setup.c
src/sbin/newfs_lfs: make_lfs.c

Log Message:
Use daddr_t, not ulfs_daddr_t, as the latter's 32 bits wide.
Don't use either for on-disk items.
Declare external data in header files.
Part 3 of 3.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sbin/fsck_lfs/fsck_vars.h
cvs rdiff -u -r1.61 -r1.62 src/sbin/fsck_lfs/inode.c
cvs rdiff -u -r1.62 -r1.63 src/sbin/fsck_lfs/lfs.c
cvs rdiff -u -r1.43 -r1.44 src/sbin/fsck_lfs/pass1.c \
src/sbin/fsck_lfs/segwrite.c
cvs rdiff -u -r1.26 -r1.27 src/sbin/fsck_lfs/pass4.c
cvs rdiff -u -r1.35 -r1.36 src/sbin/fsck_lfs/pass5.c
cvs rdiff -u -r1.47 -r1.48 src/sbin/fsck_lfs/pass6.c
cvs rdiff -u -r1.6 -r1.7 src/sbin/fsck_lfs/segwrite.h
cvs rdiff -u -r1.58 -r1.59 src/sbin/fsck_lfs/setup.c
cvs rdiff -u -r1.47 -r1.48 src/sbin/newfs_lfs/make_lfs.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/fsck_lfs/fsck_vars.h
diff -u src/sbin/fsck_lfs/fsck_vars.h:1.14 src/sbin/fsck_lfs/fsck_vars.h:1.15
--- src/sbin/fsck_lfs/fsck_vars.h:1.14	Wed Aug 12 18:28:00 2015
+++ src/sbin/fsck_lfs/fsck_vars.h	Tue Sep  1 06:15:02 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: fsck_vars.h,v 1.14 2015/08/12 18:28:00 dholland Exp $	 */
+/* $NetBSD: fsck_vars.h,v 1.15 2015/09/01 06:15:02 dholland Exp $	 */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -77,3 +77,9 @@ extern daddr_t n_blks;		/* number of blo
 extern ino_t n_files;		/* number of files in use */
 
 extern int no_roll_forward;	/* Don't roll forward */
+
+blkcnt_t badblkcount;		/* count of "bad" blocks */
+
+/* from setup.c */
+extern SEGUSE *seg_table;
+extern daddr_t *din_table;

Index: src/sbin/fsck_lfs/inode.c
diff -u src/sbin/fsck_lfs/inode.c:1.61 src/sbin/fsck_lfs/inode.c:1.62
--- src/sbin/fsck_lfs/inode.c:1.61	Tue Sep  1 06:08:37 2015
+++ src/sbin/fsck_lfs/inode.c	Tue Sep  1 06:15:02 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: inode.c,v 1.61 2015/09/01 06:08:37 dholland Exp $	 */
+/* $NetBSD: inode.c,v 1.62 2015/09/01 06:15:02 dholland Exp $	 */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -87,9 +87,6 @@
 #include "fsutil.h"
 #include "extern.h"
 
-extern SEGUSE *seg_table;
-extern ulfs_daddr_t *din_table;
-
 static int iblock(struct inodesc *, long, u_int64_t);
 int blksreqd(struct lfs *, int);
 int lfs_maxino(void);
@@ -128,7 +125,7 @@ ginode(ino_t ino)
 int
 ckinode(union lfs_dinode *dp, struct inodesc *idesc)
 {
-	ulfs_daddr_t lbn, pbn;
+	daddr_t lbn, pbn;
 	long ret, n, ndb, offset;
 	union lfs_dinode dino;
 	u_int64_t remsize, sizepb;
@@ -234,7 +231,8 @@ ckinode(union lfs_dinode *dp, struct ino
 static int
 iblock(struct inodesc *idesc, long ilevel, u_int64_t isize)
 {
-	ulfs_daddr_t *ap, *aplim;
+	unsigned j, maxindir;
+	daddr_t found;
 	struct ubuf *bp;
 	int i, n, (*func) (struct inodesc *), nif;
 	u_int64_t sizepb;
@@ -263,23 +261,25 @@ iblock(struct inodesc *idesc, long ileve
 	else
 		nif = howmany(isize, sizepb);
 	if (idesc->id_func == pass1check && nif < LFS_NINDIR(fs)) {
-		aplim = ((ulfs_daddr_t *) bp->b_data) + LFS_NINDIR(fs);
-		for (ap = ((ulfs_daddr_t *) bp->b_data) + nif; ap < aplim; ap++) {
-			if (*ap == 0)
+		maxindir = LFS_NINDIR(fs);
+		for (j = nif; j < maxindir; j++) {
+			found = lfs_iblock_get(fs, bp->b_data, j);
+			if (found == 0)
 continue;
 			(void)snprintf(buf, sizeof(buf),
 			"PARTIALLY TRUNCATED INODE I=%llu",
 			(unsigned long long)idesc->id_number);
 			if (dofix(idesc, buf)) {
-*ap = 0;
+lfs_iblock_set(fs, bp->b_data, j, 0);
 ++diddirty;
 			}
 		}
 	}
-	aplim = ((ulfs_daddr_t *) bp->b_data) + nif;
-	for (ap = ((ulfs_daddr_t *) bp->b_data); ap < aplim; ap++) {
-		if (*ap) {
-			idesc->id_blkno = *ap;
+	maxindir = nif;
+	for (j = 0; j < maxindir; j++) {
+		found = lfs_iblock_get(fs, bp->b_data, j);
+		if (found) {
+			idesc->id_blkno = found;
 			if (ilevel == 0) {
 /*
  * dirscan needs lfs_lblkno.
@@ -370,7 +370,7 @@ cacheino(union lfs_dinode *dp, ino_t inu
 	blks = howmany(lfs_dino_getsize(fs, dp), lfs_sb_getbsize(fs));
 	if (blks > ULFS_NDADDR)
 		blks = ULFS_NDADDR + ULFS_NIADDR;
-	inp = emalloc(sizeof(*inp) + (blks - 1) * sizeof(ulfs_daddr_t));
+	inp = emalloc(sizeof(*inp) + (blks - 1) * sizeof(inp->i_blks[0]));
 	inpp = [inumber % numdirs];
 	inp->i_nexthash = *inpp;
 	*inpp = inp;
@@ -383,7 +383,7 @@ cacheino(union lfs_dinode *dp, ino_t inu
 	inp->i_number = inumber;
 	inp->i_isize = lfs_dino_getsize(fs, dp);
 
-	inp->i_numblks = blks * sizeof(ulfs_daddr_t);
+	inp->i_numblks = blks * sizeof(inp->i_blks[0]);
 	for (i=0; ii_blks[i] = lfs_dino_getdb(fs, dp, i);
 	}

Index: src/sbin/fsck_lfs/lfs.c
diff -u src/sbin/fsck_lfs/lfs.c:1.62 src/sbin/fsck_lfs/lfs.c:1.63
--- src/sbin/fsck_lfs/lfs.c:1.62	Tue Sep  1 

CVS commit: src/sys/ufs/lfs

2015-09-01 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Sep  1 06:15:46 UTC 2015

Modified Files:
src/sys/ufs/lfs: lfs.h

Log Message:
Comments on directories.

This includes a description of the struct direct byteswap horrors that
ought to be propagated to ufs/ufs.


To generate a diff of this commit:
cvs rdiff -u -r1.183 -r1.184 src/sys/ufs/lfs/lfs.h

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/lfs/lfs.h
diff -u src/sys/ufs/lfs/lfs.h:1.183 src/sys/ufs/lfs/lfs.h:1.184
--- src/sys/ufs/lfs/lfs.h:1.183	Tue Sep  1 06:12:04 2015
+++ src/sys/ufs/lfs/lfs.h	Tue Sep  1 06:15:46 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs.h,v 1.183 2015/09/01 06:12:04 dholland Exp $	*/
+/*	$NetBSD: lfs.h,v 1.184 2015/09/01 06:15:46 dholland Exp $	*/
 
 /*  from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp  */
 /*  from NetBSD: dir.h,v 1.21 2009/07/22 04:49:19 dholland Exp  */
@@ -217,29 +217,115 @@
  */
 
 /*
- * A directory consists of some number of blocks of LFS_DIRBLKSIZ
- * bytes, where LFS_DIRBLKSIZ is chosen such that it can be transferred
- * to disk in a single atomic operation (e.g. 512 bytes on most machines).
- *
- * Each LFS_DIRBLKSIZ byte block contains some number of directory entry
- * structures, which are of variable length.  Each directory entry has
- * a struct lfs_direct at the front of it, containing its inode number,
- * the length of the entry, and the length of the name contained in
- * the entry.  These are followed by the name padded to a 4 byte boundary.
- * All names are guaranteed null terminated.
- * The maximum length of a name in a directory is LFS_MAXNAMLEN.
- *
- * The macro DIRSIZ(fmt, dp) gives the amount of space required to represent
- * a directory entry.  Free space in a directory is represented by
- * entries which have dp->d_reclen > DIRSIZ(fmt, dp).  All LFS_DIRBLKSIZ bytes
- * in a directory block are claimed by the directory entries.  This
- * usually results in the last entry in a directory having a large
- * dp->d_reclen.  When entries are deleted from a directory, the
- * space is returned to the previous entry in the same directory
- * block by increasing its dp->d_reclen.  If the first entry of
- * a directory block is free, then its dp->d_ino is set to 0.
- * Entries other than the first in a directory do not normally have
- * dp->d_ino set to 0.
+ * Directories in LFS are files; they use the same inode and block
+ * mapping structures that regular files do. The directory per se is
+ * manifested in the file contents: an unordered, unstructured
+ * sequence of variable-size directory entries.
+ *
+ * This format and structure is taken (via what was originally shared
+ * ufs-level code) from FFS. Each directory entry is a fixed header
+ * followed by a string, the total length padded to a 4-byte boundary.
+ * All strings include a null terminator; the maximum string length
+ * is LFS_MAXNAMLEN, which is 255.
+ *
+ * The directory entry structure (struct lfs_direct) includes both the
+ * header and a maximal string. A real entry is potentially smaller;
+ * this causes assorted complications and hazards. For example, if
+ * pointing at the last entry in a directory block, in most cases the
+ * end of the struct lfs_direct will be off the end of the block
+ * buffer and pointing into some other memory (or into the void); thus
+ * one must never e.g. assign structures directly or do anything that
+ * accesses the name field beyond the real length stored in the
+ * header.
+ *
+ * Historically, FFS directories were/are organized into blocks of
+ * size DIRBLKSIZE that can be written atomically to disk at the
+ * hardware level. Directory entries are not allowed to cross the
+ * boundaries of these blocks. The resulting atomicity is important
+ * for the integrity of FFS volumes; however, for LFS it's irrelevant.
+ * All we have to care about is not writing out directories that
+ * confuse earlier ufs-based versions of the LFS code.
+ *
+ * This means [to be determined]. (XXX)
+ *
+ * As DIRBLKSIZE in its FFS sense is hardware-dependent, and file
+ * system images do from time to time move to different hardware, code
+ * that reads directories should be prepared to handle directories
+ * written in a context where DIRBLKSIZE was different (smaller or
+ * larger) than its current value. Note however that it is not
+ * sensible for DIRBLKSIZE to be larger than the volume fragment size,
+ * and not practically possible for it to be larger than the volume
+ * block size.
+ *
+ * Some further notes:
+ *- the LFS_DIRSIZ macro provides the minimum space needed to hold
+ *  a directory entry.
+ *- any particular entry may be arbitrarily larger (which is why the
+ *  header stores both the entry size and the name size) to pad out
+ *  unused space.
+ *- dp->d_reclen is the size of the entry. This is always 4-byte
+ *  aligned.
+ *- 

CVS commit: src/sys/ufs/ufs

2015-09-01 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Sep  1 06:16:03 UTC 2015

Modified Files:
src/sys/ufs/ufs: dir.h

Log Message:
Pull over comments on struct direct's type/reclen byte swapping from LFS.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/ufs/ufs/dir.h

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/ufs/dir.h
diff -u src/sys/ufs/ufs/dir.h:1.24 src/sys/ufs/ufs/dir.h:1.25
--- src/sys/ufs/ufs/dir.h:1.24	Wed Jun 19 17:51:26 2013
+++ src/sys/ufs/ufs/dir.h	Tue Sep  1 06:16:03 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.h,v 1.24 2013/06/19 17:51:26 dholland Exp $	*/
+/*	$NetBSD: dir.h,v 1.25 2015/09/01 06:16:03 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -124,6 +124,50 @@ struct	direct {
 UFS_DIRECTSIZ((dp)->d_type) : UFS_DIRECTSIZ((dp)->d_namlen))
 #endif
 
+/*
+ * UFS_OLDDIRFMT and UFS_NEWDIRFMT are code numbers for a directory
+ * format change that happened in ffs a long time ago. (Back in the
+ * 80s, if I'm not mistaken.)
+ *
+ * These code numbers do not appear on disk. They're generated from
+ * runtime logic that is cued by other things, which is why
+ * UFS_OLDDIRFMT is confusingly 1 and UFS_NEWDIRFMT is confusingly 0.
+ *
+ * Relatedly, the FFS_EI byte swapping logic for directories is a
+ * horrible mess. For example, to access the namlen field, one
+ * currently does the following:
+ *
+ * #if (BYTE_ORDER == LITTLE_ENDIAN)
+ * swap = (UFS_IPNEEDSWAP(VTOI(vp)) == 0);
+ * #else
+ * swap = (UFS_IPNEEDSWAP(VTOI(vp)) != 0);
+ * #endif
+ * return ((FSFMT(vp) && swap) ? dp->d_type : dp->d_namlen);
+ *
+ * UFS_IPNEEDSWAP() returns true if the volume is opposite-endian. This
+ * horrible "swap" logic is cutpasted all over everywhere but amounts
+ * to the following:
+ *
+ *running code  volume  lfs_dobyteswap  "swap"
+ *--
+ *LITTLE_ENDIAN LITTLE_ENDIAN   false   true
+ *LITTLE_ENDIAN BIG_ENDIAN  truefalse
+ *BIG_ENDIANLITTLE_ENDIAN   truetrue
+ *BIG_ENDIANBIG_ENDIAN  false   false
+ *
+ * which you'll note boils down to "volume is little-endian".
+ *
+ * Meanwhile, FSFMT(vp) yields UFS_OLDDIRFMT or UFS_NEWDIRFMT via
+ * perverted logic of its own. Since UFS_OLDDIRFMT is 1 (contrary to
+ * what one might expect approaching this cold) what this mess means
+ * is: on OLDDIRFMT volumes that are little-endian, we read the
+ * namlen value out of the type field. This is because on OLDDIRFMT
+ * volumes there is no d_type field, just a 16-bit d_namlen; so if
+ * the 16-bit d_namlen is little-endian, the useful part of it is
+ * in the first byte, which in the NEWDIRFMT structure is the d_type
+ * field.
+ */
+
 #define UFS_OLDDIRFMT	1
 #define UFS_NEWDIRFMT	0
 



CVS commit: src/sys/external/bsd/dwc2/dist

2015-09-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep  1 06:24:21 UTC 2015

Modified Files:
src/sys/external/bsd/dwc2/dist: dwc2_core.c

Log Message:
Re-apply hunk that got lost in the recent import.  CVS is fun!


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/dwc2/dist/dwc2_core.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/external/bsd/dwc2/dist/dwc2_core.c
diff -u src/sys/external/bsd/dwc2/dist/dwc2_core.c:1.8 src/sys/external/bsd/dwc2/dist/dwc2_core.c:1.9
--- src/sys/external/bsd/dwc2/dist/dwc2_core.c:1.8	Sun Aug 30 12:59:59 2015
+++ src/sys/external/bsd/dwc2/dist/dwc2_core.c	Tue Sep  1 06:24:21 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2_core.c,v 1.8 2015/08/30 12:59:59 skrll Exp $	*/
+/*	$NetBSD: dwc2_core.c,v 1.9 2015/09/01 06:24:21 skrll Exp $	*/
 
 /*
  * core.c - DesignWare HS OTG Controller common routines
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2_core.c,v 1.8 2015/08/30 12:59:59 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2_core.c,v 1.9 2015/09/01 06:24:21 skrll Exp $");
 
 #include 
 #include 
@@ -1842,10 +1842,18 @@ void dwc2_hc_start_transfer(struct dwc2_
 		} else {
 			dma_addr = chan->xfer_dma;
 		}
-		DWC2_WRITE_4(hsotg, HCDMA(chan->hc_num), (u32)dma_addr);
-		if (dbg_hc(chan))
-			dev_vdbg(hsotg->dev, "Wrote %08lx to HCDMA(%d)\n",
- (unsigned long)dma_addr, chan->hc_num);
+		if (hsotg->hsotg_sc->sc_set_dma_addr == NULL) {
+			DWC2_WRITE_4(hsotg, HCDMA(chan->hc_num),
+			(u32)dma_addr);
+			if (dbg_hc(chan))
+dev_vdbg(hsotg->dev,
+"Wrote %08lx to HCDMA(%d)\n",
+ (unsigned long)dma_addr,
+chan->hc_num);
+		} else {
+			(void)(*hsotg->hsotg_sc->sc_set_dma_addr)(
+			hsotg->dev, dma_addr, chan->hc_num);
+		}
 	}
 
 	/* Start the split */



CVS commit: src

2015-09-01 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Sep  1 06:16:59 UTC 2015

Modified Files:
src/libexec/lfs_cleanerd: cleaner.h lfs_cleanerd.c
src/sbin/fsck_lfs: dir.c inode.c pass2.c
src/sbin/newfs_lfs: make_lfs.c
src/sys/lib/libsa: ufs.c
src/sys/ufs/lfs: lfs.h lfs_accessors.h lfs_rename.c lfs_vfsops.c
lfs_vnops.c ulfs_dirhash.c ulfs_extern.h ulfs_inode.c ulfs_lookup.c
ulfs_vfsops.c ulfs_vnops.c

Log Message:
Add new accessors for the d_type and d_namlen fields of struct lfs_direct.
Napalm the old byteswap access logic for these.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/libexec/lfs_cleanerd/cleaner.h
cvs rdiff -u -r1.52 -r1.53 src/libexec/lfs_cleanerd/lfs_cleanerd.c
cvs rdiff -u -r1.37 -r1.38 src/sbin/fsck_lfs/dir.c
cvs rdiff -u -r1.62 -r1.63 src/sbin/fsck_lfs/inode.c
cvs rdiff -u -r1.26 -r1.27 src/sbin/fsck_lfs/pass2.c
cvs rdiff -u -r1.48 -r1.49 src/sbin/newfs_lfs/make_lfs.c
cvs rdiff -u -r1.73 -r1.74 src/sys/lib/libsa/ufs.c
cvs rdiff -u -r1.184 -r1.185 src/sys/ufs/lfs/lfs.h
cvs rdiff -u -r1.21 -r1.22 src/sys/ufs/lfs/lfs_accessors.h
cvs rdiff -u -r1.8 -r1.9 src/sys/ufs/lfs/lfs_rename.c \
src/sys/ufs/lfs/ulfs_dirhash.c
cvs rdiff -u -r1.344 -r1.345 src/sys/ufs/lfs/lfs_vfsops.c
cvs rdiff -u -r1.288 -r1.289 src/sys/ufs/lfs/lfs_vnops.c
cvs rdiff -u -r1.15 -r1.16 src/sys/ufs/lfs/ulfs_extern.h
cvs rdiff -u -r1.10 -r1.11 src/sys/ufs/lfs/ulfs_inode.c
cvs rdiff -u -r1.25 -r1.26 src/sys/ufs/lfs/ulfs_lookup.c
cvs rdiff -u -r1.9 -r1.10 src/sys/ufs/lfs/ulfs_vfsops.c
cvs rdiff -u -r1.27 -r1.28 src/sys/ufs/lfs/ulfs_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/libexec/lfs_cleanerd/cleaner.h
diff -u src/libexec/lfs_cleanerd/cleaner.h:1.14 src/libexec/lfs_cleanerd/cleaner.h:1.15
--- src/libexec/lfs_cleanerd/cleaner.h:1.14	Tue Sep  1 06:10:16 2015
+++ src/libexec/lfs_cleanerd/cleaner.h	Tue Sep  1 06:16:58 2015
@@ -21,7 +21,8 @@ struct clfs {
 		struct dlfs64 u_64;
 	} lfs_dlfs_u;
 	unsigned lfs_is64 : 1,
-		lfs_dobyteswap : 1;
+		lfs_dobyteswap : 1,
+		lfs_hasolddirfmt : 1;
 
 	/* Ifile */
 	int clfs_ifilefd;	   /* Ifile file descriptor */

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.52 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.53
--- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.52	Tue Sep  1 06:12:04 2015
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.c	Tue Sep  1 06:16:58 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.52 2015/09/01 06:12:04 dholland Exp $	 */
+/* $NetBSD: lfs_cleanerd.c,v 1.53 2015/09/01 06:16:58 dholland Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -270,6 +270,8 @@ init_fs(struct clfs *fs, char *fsname)
 	}
 	fs->lfs_is64 = 0; /* XXX notyet */
 	fs->lfs_dobyteswap = 0; /* XXX notyet */
+	/* XXX: can this ever need to be set? does the cleaner even care? */
+	fs->lfs_hasolddirfmt = 0;
 
 	/* If this is not a version 2 filesystem, complain and exit */
 	if (lfs_sb_getversion(fs) != 2) {

Index: src/sbin/fsck_lfs/dir.c
diff -u src/sbin/fsck_lfs/dir.c:1.37 src/sbin/fsck_lfs/dir.c:1.38
--- src/sbin/fsck_lfs/dir.c:1.37	Tue Sep  1 06:08:37 2015
+++ src/sbin/fsck_lfs/dir.c	Tue Sep  1 06:16:58 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.37 2015/09/01 06:08:37 dholland Exp $	 */
+/* $NetBSD: dir.c,v 1.38 2015/09/01 06:16:58 dholland Exp $	 */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -70,6 +70,7 @@ struct lfs_dirtemplate dirhead = {
 	.dotdot_namlen = 2,
 	.dotdot_name = ".."
 };
+#if 0
 struct lfs_odirtemplate odirhead = {
 	.dot_ino = 0,
 	.dot_reclen = 12,
@@ -80,6 +81,7 @@ struct lfs_odirtemplate odirhead = {
 	.dotdot_namlen = 2,
 	.dotdot_name = ".."
 };
+#endif
 
 static int expanddir(struct uvnode *, union lfs_dinode *, char *);
 static void freedir(ino_t, ino_t);
@@ -193,8 +195,8 @@ fsck_readdir(struct uvnode *vp, struct i
 		dp = (struct lfs_direct *) (bp->b_data + idesc->id_loc);
 		dp->d_reclen = LFS_DIRBLKSIZ;
 		dp->d_ino = 0;
-		dp->d_type = 0;
-		dp->d_namlen = 0;
+		lfs_dir_settype(fs, dp, LFS_DT_UNKNOWN);
+		lfs_dir_setnamlen(fs, dp, 0);
 		dp->d_name[0] = '\0';
 		if (fix)
 			VOP_BWRITE(bp);
@@ -266,9 +268,9 @@ dircheck(struct inodesc *idesc, struct l
 	}
 	if (dp->d_ino == 0)
 		return (1);
-	size = LFS_DIRSIZ(0, dp, 0);
-	namlen = dp->d_namlen;
-	type = dp->d_type;
+	size = LFS_DIRSIZ(fs, dp);
+	namlen = lfs_dir_getnamlen(fs, dp);
+	type = lfs_dir_gettype(fs, dp);
 	if (dp->d_reclen < size ||
 	idesc->id_filesize < size ||
 	/* namlen > MAXNAMLEN || */
@@ -366,12 +368,14 @@ mkentry(struct inodesc *idesc)
 {
 	struct lfs_direct *dirp = idesc->id_dirp;
 	struct lfs_direct newent;
+	unsigned namlen;
 	int newlen, oldlen;
 
-	newent.d_namlen = strlen(idesc->id_name);
-	newlen = LFS_DIRSIZ(0, , 0);
+	namlen = strlen(idesc->id_name);
+	lfs_dir_setnamlen(fs, , namlen);
+	newlen = LFS_DIRSIZ(fs, );
 	if 

CVS commit: src/sbin/fsck_lfs

2015-09-01 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Sep  1 06:15:16 UTC 2015

Modified Files:
src/sbin/fsck_lfs: lfs_user.h

Log Message:
Remove ulfs_daddr_t.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sbin/fsck_lfs/lfs_user.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/fsck_lfs/lfs_user.h
diff -u src/sbin/fsck_lfs/lfs_user.h:1.13 src/sbin/fsck_lfs/lfs_user.h:1.14
--- src/sbin/fsck_lfs/lfs_user.h:1.13	Tue Sep  1 06:13:57 2015
+++ src/sbin/fsck_lfs/lfs_user.h	Tue Sep  1 06:15:16 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_user.h,v 1.13 2015/09/01 06:13:57 dholland Exp $ */
+/* $NetBSD: lfs_user.h,v 1.14 2015/09/01 06:15:16 dholland Exp $ */
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -68,8 +68,6 @@ struct indir {
 	int in_exists;		/* Flag if the block exists. */
 };
 
-typedef int32_t ulfs_daddr_t;
-
 /* Convert between inode pointers and vnode pointers. */
 #define	VTOI(vp)	((struct inode *)(vp)->v_data)
 #define VTOD(vp)	(VTOI(vp)->i_din)



CVS commit: src

2015-09-01 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Sep  1 06:11:06 UTC 2015

Modified Files:
src/sbin/fsck_lfs: pass0.c
src/sys/ufs/lfs: lfs.h lfs_accessors.h lfs_debug.c lfs_vfsops.c
src/usr.sbin/dumplfs: dumplfs.c

Log Message:
Make the inode fields in the 64-bit superblock 64 bits wide.
Reasoning as before.

Note that I am not going through and checking for 64->32 truncations
in inode numbers; I'm sure there are quite a few, but that's a project
for later.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sbin/fsck_lfs/pass0.c
cvs rdiff -u -r1.181 -r1.182 src/sys/ufs/lfs/lfs.h
cvs rdiff -u -r1.17 -r1.18 src/sys/ufs/lfs/lfs_accessors.h
cvs rdiff -u -r1.52 -r1.53 src/sys/ufs/lfs/lfs_debug.c
cvs rdiff -u -r1.343 -r1.344 src/sys/ufs/lfs/lfs_vfsops.c
cvs rdiff -u -r1.55 -r1.56 src/usr.sbin/dumplfs/dumplfs.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/fsck_lfs/pass0.c
diff -u src/sbin/fsck_lfs/pass0.c:1.41 src/sbin/fsck_lfs/pass0.c:1.42
--- src/sbin/fsck_lfs/pass0.c:1.41	Sun Aug 23 16:00:23 2015
+++ src/sbin/fsck_lfs/pass0.c	Tue Sep  1 06:11:06 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: pass0.c,v 1.41 2015/08/23 16:00:23 christos Exp $	 */
+/* $NetBSD: pass0.c,v 1.42 2015/09/01 06:11:06 dholland Exp $	 */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -200,8 +200,8 @@ pass0(void)
 		writeit = 1;
 	}
 	if (freehd != lfs_sb_getfreehd(fs)) {
-		pwarn("FREE LIST HEAD IN SUPERBLOCK SHOULD BE %ju (WAS %u)\n",
-			(uintmax_t)freehd, lfs_sb_getfreehd(fs));
+		pwarn("FREE LIST HEAD IN SUPERBLOCK SHOULD BE %ju (WAS %ju)\n",
+			(uintmax_t)freehd, (uintmax_t)lfs_sb_getfreehd(fs));
 		if (preen || reply("FIX")) {
 			lfs_sb_setfreehd(fs, freehd);
 			sbdirty();

Index: src/sys/ufs/lfs/lfs.h
diff -u src/sys/ufs/lfs/lfs.h:1.181 src/sys/ufs/lfs/lfs.h:1.182
--- src/sys/ufs/lfs/lfs.h:1.181	Tue Sep  1 06:10:16 2015
+++ src/sys/ufs/lfs/lfs.h	Tue Sep  1 06:11:06 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs.h,v 1.181 2015/09/01 06:10:16 dholland Exp $	*/
+/*	$NetBSD: lfs.h,v 1.182 2015/09/01 06:11:06 dholland Exp $	*/
 
 /*  from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp  */
 /*  from NetBSD: dir.h,v 1.21 2009/07/22 04:49:19 dholland Exp  */
@@ -789,63 +789,63 @@ struct dlfs64 {
 	u_int32_t dlfs_frag;	  /* 36: number of frags in a block in fs */
 
 /* Checkpoint region. */
-	u_int32_t dlfs_freehd;	  /* 40: start of the free inode list */
-	u_int32_t dlfs_nfiles;	  /* 44: number of allocated inodes */
-	int64_t   dlfs_bfree;	  /* 48: number of free frags */
-	int64_t	  dlfs_avail;	  /* 56: blocks available for writing */
-	int64_t	  dlfs_idaddr;	  /* 64: inode file disk address */
-	int32_t	  dlfs_uinodes;	  /* 72: inodes in cache not yet on disk */
-	u_int32_t dlfs_ifile;	  /* 76: inode file inode number */
-	int64_t	  dlfs_lastseg;	  /* 80: address of last segment written */
-	int64_t	  dlfs_nextseg;	  /* 88: address of next segment to write */
-	int64_t	  dlfs_curseg;	  /* 96: current segment being written */
-	int64_t	  dlfs_offset;	  /* 104: offset in curseg for next partial */
-	int64_t	  dlfs_lastpseg;  /* 112: address of last partial written */
-	u_int32_t dlfs_inopf;	  /* 120: inodes per frag */
+	u_int64_t dlfs_freehd;	  /* 40: start of the free inode list */
+	u_int64_t dlfs_nfiles;	  /* 48: number of allocated inodes */
+	int64_t   dlfs_bfree;	  /* 56: number of free frags */
+	int64_t	  dlfs_avail;	  /* 64: blocks available for writing */
+	int64_t	  dlfs_idaddr;	  /* 72: inode file disk address */
+	int32_t	  dlfs_uinodes;	  /* 80: inodes in cache not yet on disk */
+	u_int32_t dlfs_ifile;	  /* 84: inode file inode number */
+	int64_t	  dlfs_lastseg;	  /* 88: address of last segment written */
+	int64_t	  dlfs_nextseg;	  /* 96: address of next segment to write */
+	int64_t	  dlfs_curseg;	  /* 104: current segment being written */
+	int64_t	  dlfs_offset;	  /* 112: offset in curseg for next partial */
+	int64_t	  dlfs_lastpseg;  /* 120: address of last partial written */
+	u_int32_t dlfs_inopf;	  /* 128: inodes per frag */
 
 /* These are configuration parameters. */
-	u_int32_t dlfs_minfree;	  /* 124: minimum percentage of free blocks */
+	u_int32_t dlfs_minfree;	  /* 132: minimum percentage of free blocks */
 
 /* These fields can be computed from the others. */
-	u_int64_t dlfs_maxfilesize; /* 128: maximum representable file size */
-	u_int32_t dlfs_fsbpseg;	  /* 136: frags (fsb) per segment */
-	u_int32_t dlfs_inopb;	  /* 140: inodes per block */
-	u_int32_t dlfs_ifpb;	  /* 144: IFILE entries per block */
-	u_int32_t dlfs_sepb;	  /* 148: SEGUSE entries per block */
-	u_int32_t dlfs_nindir;	  /* 152: indirect pointers per block */
-	u_int32_t dlfs_nseg;	  /* 156: number of segments */
-	u_int32_t dlfs_nspf;	  /* 160: number of sectors per fragment */
-	u_int32_t dlfs_cleansz;	  /* 164: cleaner info size in blocks */
-	

CVS commit: src

2015-09-01 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Sep  1 06:12:04 UTC 2015

Modified Files:
src/libexec/lfs_cleanerd: lfs_cleanerd.c
src/sbin/dump_lfs: lfs_inode.c
src/sbin/fsck_lfs: lfs.c pass1.c pass6.c setup.c
src/sbin/newfs_lfs: make_lfs.c
src/sys/lib/libsa: ufs.c
src/sys/ufs/lfs: lfs.h lfs_accessors.h lfs_debug.c
src/usr.sbin/dumplfs: dumplfs.c

Log Message:
The ifile's inode number is constant. (it is always 1)

Therefore, storing the value in the superblock and reading it out
again is silly and offers the opportunity for it to become corrupted.
So, don't do that (most of the code already didn't) and use the
existing constant instead. Initialize new 32-bit superblocks with
the value for the sake of old userland programs, but don't keep the
value in the 64-bit superblock at all.

(approved by Margo Seltzer)


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/libexec/lfs_cleanerd/lfs_cleanerd.c
cvs rdiff -u -r1.25 -r1.26 src/sbin/dump_lfs/lfs_inode.c
cvs rdiff -u -r1.59 -r1.60 src/sbin/fsck_lfs/lfs.c
cvs rdiff -u -r1.42 -r1.43 src/sbin/fsck_lfs/pass1.c
cvs rdiff -u -r1.44 -r1.45 src/sbin/fsck_lfs/pass6.c
cvs rdiff -u -r1.56 -r1.57 src/sbin/fsck_lfs/setup.c
cvs rdiff -u -r1.45 -r1.46 src/sbin/newfs_lfs/make_lfs.c
cvs rdiff -u -r1.72 -r1.73 src/sys/lib/libsa/ufs.c
cvs rdiff -u -r1.182 -r1.183 src/sys/ufs/lfs/lfs.h
cvs rdiff -u -r1.18 -r1.19 src/sys/ufs/lfs/lfs_accessors.h
cvs rdiff -u -r1.53 -r1.54 src/sys/ufs/lfs/lfs_debug.c
cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/dumplfs/dumplfs.c

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

Modified files:

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.51 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.52
--- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.51	Tue Sep  1 06:10:16 2015
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.c	Tue Sep  1 06:12:04 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.51 2015/09/01 06:10:16 dholland Exp $	 */
+/* $NetBSD: lfs_cleanerd.c,v 1.52 2015/09/01 06:12:04 dholland Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -1017,10 +1017,10 @@ check_hidden_cost(struct clfs *fs, BLOCK
 			/*
 			 * Look for IFILE blocks, unless this is the Ifile.
 			 */
-			if (bip[i].bi_inode != lfs_sb_getifile(fs)) {
+			if (bip[i].bi_inode != LFS_IFILE_INUM) {
 lbn = lfs_sb_getcleansz(fs) + bip[i].bi_inode /
 			lfs_sb_getifpb(fs);
-*ifc += check_or_add(lfs_sb_getifile(fs), lbn,
+*ifc += check_or_add(LFS_IFILE_INUM, lbn,
 		 bip, bic, , );
 			}
 		}

Index: src/sbin/dump_lfs/lfs_inode.c
diff -u src/sbin/dump_lfs/lfs_inode.c:1.25 src/sbin/dump_lfs/lfs_inode.c:1.26
--- src/sbin/dump_lfs/lfs_inode.c:1.25	Wed Aug 12 18:28:00 2015
+++ src/sbin/dump_lfs/lfs_inode.c	Tue Sep  1 06:12:04 2015
@@ -1,4 +1,4 @@
-/*  $NetBSD: lfs_inode.c,v 1.25 2015/08/12 18:28:00 dholland Exp $ */
+/*  $NetBSD: lfs_inode.c,v 1.26 2015/09/01 06:12:04 dholland Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)main.c  8.6 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: lfs_inode.c,v 1.25 2015/08/12 18:28:00 dholland Exp $");
+__RCSID("$NetBSD: lfs_inode.c,v 1.26 2015/09/01 06:12:04 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -170,7 +170,7 @@ fs_parametrize(void)
 ino_t
 fs_maxino(void)
 {
-	return ((getino(lfs_sb_getifile(sblock))->dp1.di_size
+	return ((getino(LFS_IFILE_INUM)->dp1.di_size
 		   - (lfs_sb_getcleansz(sblock) + lfs_sb_getsegtabsz(sblock))
 		   * lfs_sb_getbsize(sblock))
 		  / lfs_sb_getbsize(sblock)) * lfs_sb_getifpb(sblock) - 1;
@@ -288,7 +288,7 @@ lfs_ientry(ino_t ino)
 	unsigned index;
 
 	lbn = ino/lfs_sb_getifpb(sblock) + lfs_sb_getcleansz(sblock) + lfs_sb_getsegtabsz(sblock);
-	dp = getino(lfs_sb_getifile(sblock));
+	dp = getino(LFS_IFILE_INUM);
 	/* XXX this is foolish */
 	if (sblock->lfs_is64) {
 		ldp = (union lfs_dinode *)>dlp64;
@@ -340,7 +340,7 @@ getino(ino_t inum)
 	union lfs_dinode *dp;
 	ino_t inum2;
 
-	if(inum == lfs_sb_getifile(sblock)) {
+	if (inum == LFS_IFILE_INUM) {
 		/* Load the ifile inode if not already */
 		inum2 = sblock->lfs_is64 ?
 			ifile_dinode.dlp64.di_inumber :

Index: src/sbin/fsck_lfs/lfs.c
diff -u src/sbin/fsck_lfs/lfs.c:1.59 src/sbin/fsck_lfs/lfs.c:1.60
--- src/sbin/fsck_lfs/lfs.c:1.59	Tue Sep  1 06:10:16 2015
+++ src/sbin/fsck_lfs/lfs.c	Tue Sep  1 06:12:04 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs.c,v 1.59 2015/09/01 06:10:16 dholland Exp $ */
+/* $NetBSD: lfs.c,v 1.60 2015/09/01 06:12:04 dholland Exp $ */
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -559,8 +559,7 @@ lfs_init(int devfd, daddr_t sblkno, dadd
 	else
 		lfs_sb_setidaddr(fs, idaddr);
 	/* NB: If dummy_read!=0, idaddr==0 here so we get a fake inode. */
-	fs->lfs_ivnode 

CVS commit: src

2015-09-01 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Sep  1 06:10:16 UTC 2015

Modified Files:
src/libexec/lfs_cleanerd: cleaner.h lfs_cleanerd.c
src/sbin/fsck_lfs: lfs.c
src/sbin/newfs_lfs: make_lfs.c
src/sys/ufs/lfs: lfs.h lfs_accessors.h lfs_vfsops.c

Log Message:
Add byteswapping to the dinode accessors.

This prevents regressions in the ulfs code when switching to the new
accessors. Note that while adding byteswapping to the other accessors
is straightforward, I haven't done it yet; and that also is not enough
to make LFS_EI work, because there are places lying around that bypass
the accessors for one reason and another and all of them need to be
updated. That is going to have to wait for a later day as LFS_EI is
not on the critical path right now.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/libexec/lfs_cleanerd/cleaner.h
cvs rdiff -u -r1.50 -r1.51 src/libexec/lfs_cleanerd/lfs_cleanerd.c
cvs rdiff -u -r1.58 -r1.59 src/sbin/fsck_lfs/lfs.c
cvs rdiff -u -r1.44 -r1.45 src/sbin/newfs_lfs/make_lfs.c
cvs rdiff -u -r1.180 -r1.181 src/sys/ufs/lfs/lfs.h
cvs rdiff -u -r1.16 -r1.17 src/sys/ufs/lfs/lfs_accessors.h
cvs rdiff -u -r1.342 -r1.343 src/sys/ufs/lfs/lfs_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/libexec/lfs_cleanerd/cleaner.h
diff -u src/libexec/lfs_cleanerd/cleaner.h:1.13 src/libexec/lfs_cleanerd/cleaner.h:1.14
--- src/libexec/lfs_cleanerd/cleaner.h:1.13	Wed Aug 12 18:25:03 2015
+++ src/libexec/lfs_cleanerd/cleaner.h	Tue Sep  1 06:10:16 2015
@@ -20,7 +20,8 @@ struct clfs {
 		struct dlfs u_32;
 		struct dlfs64 u_64;
 	} lfs_dlfs_u;
-	unsigned lfs_is64 : 1;
+	unsigned lfs_is64 : 1,
+		lfs_dobyteswap : 1;
 
 	/* Ifile */
 	int clfs_ifilefd;	   /* Ifile file descriptor */

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.50 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.51
--- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.50	Wed Aug 12 18:28:00 2015
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.c	Tue Sep  1 06:10:16 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.50 2015/08/12 18:28:00 dholland Exp $	 */
+/* $NetBSD: lfs_cleanerd.c,v 1.51 2015/09/01 06:10:16 dholland Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -269,6 +269,7 @@ init_fs(struct clfs *fs, char *fsname)
 		return -1;
 	}
 	fs->lfs_is64 = 0; /* XXX notyet */
+	fs->lfs_dobyteswap = 0; /* XXX notyet */
 
 	/* If this is not a version 2 filesystem, complain and exit */
 	if (lfs_sb_getversion(fs) != 2) {

Index: src/sbin/fsck_lfs/lfs.c
diff -u src/sbin/fsck_lfs/lfs.c:1.58 src/sbin/fsck_lfs/lfs.c:1.59
--- src/sbin/fsck_lfs/lfs.c:1.58	Tue Sep  1 06:08:37 2015
+++ src/sbin/fsck_lfs/lfs.c	Tue Sep  1 06:10:16 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs.c,v 1.58 2015/09/01 06:08:37 dholland Exp $ */
+/* $NetBSD: lfs.c,v 1.59 2015/09/01 06:10:16 dholland Exp $ */
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -424,7 +424,10 @@ lfs_vget(void *vfs, ino_t ino)
 	return lfs_raw_vget(fs, ino, fs->lfs_ivnode->v_fd, daddr);
 }
 
-/* Check superblock magic number and checksum */
+/*
+ * Check superblock magic number and checksum.
+ * Sets lfs_is64 and lfs_dobyteswap.
+ */
 static int
 check_sb(struct lfs *fs)
 {
@@ -440,6 +443,9 @@ check_sb(struct lfs *fs)
 		   (unsigned long) LFS_MAGIC);
 		return 1;
 	}
+	fs->lfs_is64 = 0; /* XXX notyet */
+	fs->lfs_dobyteswap = 0; /* XXX notyet */
+
 	/* checksum */
 	checksum = lfs_sb_cksum(fs);
 	if (lfs_sb_getcksum(fs) != checksum) {

Index: src/sbin/newfs_lfs/make_lfs.c
diff -u src/sbin/newfs_lfs/make_lfs.c:1.44 src/sbin/newfs_lfs/make_lfs.c:1.45
--- src/sbin/newfs_lfs/make_lfs.c:1.44	Wed Aug 19 20:33:29 2015
+++ src/sbin/newfs_lfs/make_lfs.c	Tue Sep  1 06:10:16 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: make_lfs.c,v 1.44 2015/08/19 20:33:29 dholland Exp $	*/
+/*	$NetBSD: make_lfs.c,v 1.45 2015/09/01 06:10:16 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
 #if 0
 static char sccsid[] = "@(#)lfs.c	8.5 (Berkeley) 5/24/95";
 #else
-__RCSID("$NetBSD: make_lfs.c,v 1.44 2015/08/19 20:33:29 dholland Exp $");
+__RCSID("$NetBSD: make_lfs.c,v 1.45 2015/09/01 06:10:16 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -397,6 +397,7 @@ make_lfs(int devfd, uint secsize, struct
 	u_int64_t tsepb, tnseg;
 	time_t stamp;
 	bool is64 = false; /* XXX notyet */
+	bool dobyteswap = false; /* XXX notyet */
 
 	/*
 	 * Initialize buffer cache.  Use a ballpark guess of the length of
@@ -420,6 +421,7 @@ make_lfs(int devfd, uint secsize, struct
 		fs->lfs_dlfs_u.u_32 = dlfs32_default;
 	}
 	fs->lfs_is64 = is64;
+	fs->lfs_dobyteswap = dobyteswap;
 	fs->lfs_ivnode = vp;
 	fs->lfs_devvp = save_devvp;
 

Index: src/sys/ufs/lfs/lfs.h
diff -u src/sys/ufs/lfs/lfs.h:1.180 src/sys/ufs/lfs/lfs.h:1.181
--- src/sys/ufs/lfs/lfs.h:1.180	Wed Aug 12 

CVS commit: src/sys/conf

2015-09-01 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Wed Sep  2 03:22:41 UTC 2015

Modified Files:
src/sys/conf: Makefile.kern.inc

Log Message:
Clean up some rules and make them less error prone.


To generate a diff of this commit:
cvs rdiff -u -r1.218 -r1.219 src/sys/conf/Makefile.kern.inc

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

Modified files:

Index: src/sys/conf/Makefile.kern.inc
diff -u src/sys/conf/Makefile.kern.inc:1.218 src/sys/conf/Makefile.kern.inc:1.219
--- src/sys/conf/Makefile.kern.inc:1.218	Tue Sep  1 23:04:35 2015
+++ src/sys/conf/Makefile.kern.inc	Wed Sep  2 03:22:41 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.kern.inc,v 1.218 2015/09/01 23:04:35 uebayasi Exp $
+#	$NetBSD: Makefile.kern.inc,v 1.219 2015/09/02 03:22:41 uebayasi Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -397,8 +397,9 @@ DEPS=	${SRCS:T:u:R:S/$/.d/g}
 .if !target(${_s:T:R}.d)
 ${_s:T:R}.d: ${_s} assym.h
 	${_MKTARGET_CREATE}
-	${MKDEP} -f ${.TARGET} -- ${MKDEP_AFLAGS} \
+	${MKDEP} -f ${.TARGET}.tmp -- ${MKDEP_AFLAGS} \
 	${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s}
+	mv -f ${.TARGET}.tmp ${.TARGET}
 .endif
 .endfor
 
@@ -406,8 +407,9 @@ ${_s:T:R}.d: ${_s} assym.h
 .if !target(${_s:T:R}.d)
 ${_s:T:R}.d: ${_s}
 	${_MKTARGET_CREATE}
-	${MKDEP} -f ${.TARGET} -- ${MKDEP_CFLAGS} \
+	${MKDEP} -f ${.TARGET}.tmp -- ${MKDEP_CFLAGS} \
 	${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s}
+	mv -f ${.TARGET}.tmp ${.TARGET}
 .endif
 .endfor
 
@@ -523,28 +525,27 @@ build_kernel: .USE
 .SUFFIXES: .genassym .assym.h
 .genassym.assym.h:
 	${_MKTARGET_CREATE}
-	cat $< | \
-	${GENASSYM} -- ${CC} ${CFLAGS:N-Wa,*} ${CPPFLAGS} ${PROF} \
-	${GENASSYM_CPPFLAGS} > $@.tmp && \
+	${GENASSYM} -- ${CC} ${CFLAGS:N-Wa,*} ${CPPFLAGS} ${PROF} \
+	${GENASSYM_CPPFLAGS} < $< > $@
 	mv -f $@.tmp $@
 
 .SUFFIXES: .s .d
 .s.d:
 	${_MKTARGET_CREATE}
-	${MKDEP} -f ${.TARGET} -- ${MKDEP_AFLAGS} \
-	${CPPFLAGS} ${CPPFLAGS.${<:T}} $<
+	${MKDEP} -f $@.tmp -- ${MKDEP_AFLAGS} ${CPPFLAGS} ${CPPFLAGS.${<:T}} $<
+	mv -f $@.tmp $@
 
 .SUFFIXES: .S .d
 .S.d:
 	${_MKTARGET_CREATE}
-	${MKDEP} -f ${.TARGET} -- ${MKDEP_AFLAGS} \
-	${CPPFLAGS} ${CPPFLAGS.${<:T}} $<
+	${MKDEP} -f $@.tmp -- ${MKDEP_AFLAGS} ${CPPFLAGS} ${CPPFLAGS.${<:T}} $<
+	mv -f $@.tmp $@
 
 .SUFFIXES: .c .d
 .c.d:
 	${_MKTARGET_CREATE}
-	${MKDEP} -f ${.TARGET} -- ${MKDEP_CFLAGS} \
-	${CPPFLAGS} ${CPPFLAGS.${<:T}} $<
+	${MKDEP} -f $@.tmp -- ${MKDEP_CFLAGS} ${CPPFLAGS} ${CPPFLAGS.${<:T}} $<
+	mv -f $@.tmp $@
 
 .SUFFIXES: .c .o
 .c.o:



CVS commit: src/usr.bin/config

2015-09-01 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Sep  1 20:18:41 UTC 2015

Modified Files:
src/usr.bin/config: mkmakefile.c

Log Message:
Fix build.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/usr.bin/config/mkmakefile.c

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

Modified files:

Index: src/usr.bin/config/mkmakefile.c
diff -u src/usr.bin/config/mkmakefile.c:1.55 src/usr.bin/config/mkmakefile.c:1.56
--- src/usr.bin/config/mkmakefile.c:1.55	Tue Sep  1 16:01:23 2015
+++ src/usr.bin/config/mkmakefile.c	Tue Sep  1 20:18:41 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkmakefile.c,v 1.55 2015/09/01 16:01:23 uebayasi Exp $	*/
+/*	$NetBSD: mkmakefile.c,v 1.56 2015/09/01 20:18:41 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkmakefile.c,v 1.55 2015/09/01 16:01:23 uebayasi Exp $");
+__RCSID("$NetBSD: mkmakefile.c,v 1.56 2015/09/01 20:18:41 uebayasi Exp $");
 
 #include 
 #include 
@@ -298,14 +298,14 @@ emitdefs(FILE *fp)
 static void
 emitfile(FILE *fp, struct files *fi)
 {
-	const char *srcdir = "$S/";
+	const char *defprologue = "$S/";
 	const char *prologue, *prefix, *sep;
 
 	if (Sflag)
-		srcdir = "";
+		defprologue = "";
 	prologue = prefix = sep = "";
 	if (*fi->fi_path != '/') {
-		prologue = srcdir;
+		prologue = defprologue;
 		if (fi->fi_prefix != NULL) {
 			if (*fi->fi_prefix == '/')
 prologue = "";
@@ -319,13 +319,20 @@ emitfile(FILE *fp, struct files *fi)
 static void
 emitobjs(FILE *fp)
 {
+	const char *prologue, *prefix, *sep;
 	struct files *fi;
 
 	fputs("OBJS= \\\n", fp);
 	TAILQ_FOREACH(fi, , fi_next) {
+		prologue = prefix = sep = "";
 		if ((fi->fi_flags & FI_SEL) == 0)
 			continue;
-		fprintf(fp, "\t%s.o \\\n", fi->fi_base);
+		if (fi->fi_buildprefix != NULL) {
+			prefix = fi->fi_buildprefix;
+			sep = "/";
+		}
+		fprintf(fp, "\t%s%s%s%s.o \\\n", prologue, prefix, sep,
+		fi->fi_base);
 	}
 	TAILQ_FOREACH(fi, , fi_snext) {
 		if ((fi->fi_flags & FI_SEL) == 0)



CVS commit: src/sys/conf

2015-09-01 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Sep  1 23:04:35 UTC 2015

Modified Files:
src/sys/conf: Makefile.kern.inc

Log Message:
Define suffix rules at the end to override system definitions.  Provide them
only if ___USE_SUFFIX_RULES___ is defined (config -S).


To generate a diff of this commit:
cvs rdiff -u -r1.217 -r1.218 src/sys/conf/Makefile.kern.inc

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

Modified files:

Index: src/sys/conf/Makefile.kern.inc
diff -u src/sys/conf/Makefile.kern.inc:1.217 src/sys/conf/Makefile.kern.inc:1.218
--- src/sys/conf/Makefile.kern.inc:1.217	Tue Sep  1 16:04:04 2015
+++ src/sys/conf/Makefile.kern.inc	Tue Sep  1 23:04:35 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.kern.inc,v 1.217 2015/09/01 16:04:04 uebayasi Exp $
+#	$NetBSD: Makefile.kern.inc,v 1.218 2015/09/01 23:04:35 uebayasi Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -174,14 +174,6 @@ ${_s:T:R}.o: ${_s}
 .endif
 .endfor
 
-.SUFFIXES: .c .o
-.c.o:
-	${NORMAL_C}
-
-.SUFFIXES: .S .o
-.S.o:
-	${NORMAL_S}
-
 ##
 ## (3) libkern and compat
 ##
@@ -325,14 +317,6 @@ SYSTEM_LD_TAIL_STAGE2+=	${SYSTEM_LD_TAIL
 ## (6) port independent targets and dependencies: assym.h, vers.o
 ##
 
-.SUFFIXES: .genassym .assym.h
-.genassym.assym.h:
-	${_MKTARGET_CREATE}
-	cat $< | \
-	${GENASSYM} -- ${CC} ${CFLAGS:N-Wa,*} ${CPPFLAGS} ${PROF} \
-	${GENASSYM_CPPFLAGS} > $@.tmp && \
-	mv -f $@.tmp $@
-
 assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS} $S/conf/genassym.cf
 	${_MKTARGET_CREATE}
 	cat ${GENASSYM_CONF} ${GENASSYM_EXTRAS} $S/conf/genassym.cf | \
@@ -409,12 +393,6 @@ CSRCS=${MD_CFILES} ${MI_CFILES} ${CFILES
 SRCS=${SSRCS} ${CSRCS}
 DEPS=	${SRCS:T:u:R:S/$/.d/g}
 
-.SUFFIXES: .S .d
-.S.d:
-	${_MKTARGET_CREATE}
-	${MKDEP} -f ${.TARGET} -- ${MKDEP_AFLAGS} \
-	${CPPFLAGS} ${CPPFLAGS.${_s:T}} $<
-
 .for _s in ${SSRCS}
 .if !target(${_s:T:R}.d)
 ${_s:T:R}.d: ${_s} assym.h
@@ -424,12 +402,6 @@ ${_s:T:R}.d: ${_s} assym.h
 .endif
 .endfor
 
-.SUFFIXES: .c .d
-.c.d:
-	${_MKTARGET_CREATE}
-	${MKDEP} -f ${.TARGET} -- ${MKDEP_CFLAGS} \
-	${CPPFLAGS} ${CPPFLAGS.${_s:T}} $<
-
 .for _s in ${CSRCS}
 .if !target(${_s:T:R}.d)
 ${_s:T:R}.d: ${_s}
@@ -544,5 +516,49 @@ build_kernel: .USE
 .include 
 
 ##
+## suffix rules
+##
+
+.if defined(___USE_SUFFIX_RULES___)
+.SUFFIXES: .genassym .assym.h
+.genassym.assym.h:
+	${_MKTARGET_CREATE}
+	cat $< | \
+	${GENASSYM} -- ${CC} ${CFLAGS:N-Wa,*} ${CPPFLAGS} ${PROF} \
+	${GENASSYM_CPPFLAGS} > $@.tmp && \
+	mv -f $@.tmp $@
+
+.SUFFIXES: .s .d
+.s.d:
+	${_MKTARGET_CREATE}
+	${MKDEP} -f ${.TARGET} -- ${MKDEP_AFLAGS} \
+	${CPPFLAGS} ${CPPFLAGS.${<:T}} $<
+
+.SUFFIXES: .S .d
+.S.d:
+	${_MKTARGET_CREATE}
+	${MKDEP} -f ${.TARGET} -- ${MKDEP_AFLAGS} \
+	${CPPFLAGS} ${CPPFLAGS.${<:T}} $<
+
+.SUFFIXES: .c .d
+.c.d:
+	${_MKTARGET_CREATE}
+	${MKDEP} -f ${.TARGET} -- ${MKDEP_CFLAGS} \
+	${CPPFLAGS} ${CPPFLAGS.${<:T}} $<
+
+.SUFFIXES: .c .o
+.c.o:
+	${NORMAL_C}
+
+.SUFFIXES: .s .o
+.s.o:
+	${NORMAL_S}
+
+.SUFFIXES: .S .o
+.S.o:
+	${NORMAL_S}
+.endif # ___USE_SUFFIX_RULES___
+
+##
 ## the end
 ##



CVS commit: src/sys/netinet6

2015-09-01 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Sep  1 08:46:27 UTC 2015

Modified Files:
src/sys/netinet6: nd6.c

Log Message:
Cleanup nd6_nud_hint

The deleted rtfree was never called.


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 src/sys/netinet6/nd6.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/netinet6/nd6.c
diff -u src/sys/netinet6/nd6.c:1.170 src/sys/netinet6/nd6.c:1.171
--- src/sys/netinet6/nd6.c:1.170	Mon Aug 31 03:26:53 2015
+++ src/sys/netinet6/nd6.c	Tue Sep  1 08:46:27 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6.c,v 1.170 2015/08/31 03:26:53 ozaki-r Exp $	*/
+/*	$NetBSD: nd6.c,v 1.171 2015/09/01 08:46:27 ozaki-r Exp $	*/
 /*	$KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.170 2015/08/31 03:26:53 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.171 2015/09/01 08:46:27 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1167,10 +1167,9 @@ nd6_free(struct rtentry *rt, int gc)
  * XXX cost-effective methods?
  */
 void
-nd6_nud_hint(struct rtentry *rt0)
+nd6_nud_hint(struct rtentry *rt)
 {
 	struct llinfo_nd6 *ln;
-	struct rtentry *rt = rt0;
 
 	if (rt == NULL)
 		return;
@@ -1180,12 +1179,12 @@ nd6_nud_hint(struct rtentry *rt0)
 	!rt->rt_llinfo || !rt->rt_gateway ||
 	rt->rt_gateway->sa_family != AF_LINK) {
 		/* This is not a host route. */
-		goto exit;
+		return;
 	}
 
 	ln = (struct llinfo_nd6 *)rt->rt_llinfo;
 	if (ln->ln_state < ND6_LLINFO_REACHABLE)
-		goto exit;
+		return;
 
 	/*
 	 * if we get upper-layer reachability confirmation many times,
@@ -1193,16 +1192,14 @@ nd6_nud_hint(struct rtentry *rt0)
 	 */
 	ln->ln_byhint++;
 	if (ln->ln_byhint > nd6_maxnudhint)
-		goto exit;
+		return;
 
 	ln->ln_state = ND6_LLINFO_REACHABLE;
 	if (!ND6_LLINFO_PERMANENT(ln)) {
 		nd6_llinfo_settimer(ln,
 		(long)ND_IFINFO(rt->rt_ifp)->reachable * hz);
 	}
-exit:
-	if (rt != rt0)
-		rtfree(rt);
+
 	return;
 }
 



CVS commit: src

2015-09-01 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Sep  1 09:54:34 UTC 2015

Modified Files:
src/lib/libc/net: if_nametoindex.c
src/usr.sbin/ndp: Makefile

Log Message:
Fix rump.ndp -I options by rump-ifying if_nametoindex(3)

>From s-yamaguchi@IIJ


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/net/if_nametoindex.c
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/ndp/Makefile

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/net/if_nametoindex.c
diff -u src/lib/libc/net/if_nametoindex.c:1.4 src/lib/libc/net/if_nametoindex.c:1.5
--- src/lib/libc/net/if_nametoindex.c:1.4	Fri Nov 24 08:21:12 2000
+++ src/lib/libc/net/if_nametoindex.c	Tue Sep  1 09:54:34 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_nametoindex.c,v 1.4 2000/11/24 08:21:12 itojun Exp $	*/
+/*	$NetBSD: if_nametoindex.c,v 1.5 2015/09/01 09:54:34 ozaki-r Exp $	*/
 /*	$KAME: if_nametoindex.c,v 1.6 2000/11/24 08:18:54 itojun Exp $	*/
 
 /*-
@@ -28,10 +28,12 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: if_nametoindex.c,v 1.4 2000/11/24 08:21:12 itojun Exp $");
+__RCSID("$NetBSD: if_nametoindex.c,v 1.5 2015/09/01 09:54:34 ozaki-r Exp $");
 #endif /* LIBC_SCCS and not lint */
 
+#ifndef RUMP_ACTION
 #include "namespace.h"
+#endif
 #include 
 #include 
 #include 
@@ -41,9 +43,11 @@ __RCSID("$NetBSD: if_nametoindex.c,v 1.4
 #include 
 #include 
 
+#ifndef RUMP_ACTION
 #ifdef __weak_alias
 __weak_alias(if_nametoindex,_if_nametoindex)
 #endif
+#endif
 
 /*
  * From RFC 2553:

Index: src/usr.sbin/ndp/Makefile
diff -u src/usr.sbin/ndp/Makefile:1.10 src/usr.sbin/ndp/Makefile:1.11
--- src/usr.sbin/ndp/Makefile:1.10	Mon Aug  3 09:51:40 2015
+++ src/usr.sbin/ndp/Makefile	Tue Sep  1 09:54:34 2015
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.10 2015/08/03 09:51:40 ozaki-r Exp $
+# $NetBSD: Makefile,v 1.11 2015/09/01 09:54:34 ozaki-r Exp $
 
 .include 
 
@@ -15,7 +15,7 @@ CPPFLAGS+=	-DINET6
 CPPFLAGS+=	-I. -I${TCPDUMP}
 
 .PATH:		${.CURDIR}/../../lib/libc/net
-RUMPSRCS=	getifaddrs.c getnameinfo.c if_indextoname.c
+RUMPSRCS=	getifaddrs.c getnameinfo.c if_indextoname.c if_nametoindex.c
 .if (${MKRUMP} != "no")
 CPPFLAGS+= 	-DRUMP_ACTION
 .endif



CVS commit: src/usr.bin/config

2015-09-01 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Sep  1 10:37:48 UTC 2015

Modified Files:
src/usr.bin/config: defs.h

Log Message:
Start merging struct files and struct objects.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/usr.bin/config/defs.h

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

Modified files:

Index: src/usr.bin/config/defs.h
diff -u src/usr.bin/config/defs.h:1.74 src/usr.bin/config/defs.h:1.75
--- src/usr.bin/config/defs.h:1.74	Mon Aug 31 02:58:25 2015
+++ src/usr.bin/config/defs.h	Tue Sep  1 10:37:48 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.74 2015/08/31 02:58:25 uebayasi Exp $	*/
+/*	$NetBSD: defs.h,v 1.75 2015/09/01 10:37:48 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -332,16 +332,21 @@ struct devi {
  * Files or objects.  This structure defines the common fields
  * between the two.
  */
-struct filetype
-{
+struct filetype {
+	TAILQ_ENTRY(files) fit_next;
 	const char *fit_srcfile;	/* the name of the "files" file that got us */
 	u_short	fit_srcline;	/* and the line number */
 	u_char	fit_flags;	/* as below */
 	char	fit_lastc;	/* last char from path */
+	const char *fit_tail;	/* name, i.e., strrchr(fi_path, '/') + 1 */
+	const char *fit_base;	/* tail minus ".c" (or whatever) */
 	const char *fit_path;	/* full file path */
 	const char *fit_prefix;	/* any file prefix */
-	size_t fit_len;		/* path string length */
 	int fit_suffix;		/* single char suffix */
+	size_t fit_len;		/* path string length */
+	struct condexpr *fit_optx; /* options expression */
+	struct nvlist *fit_optf; /* flattened version of above, if needed */
+	const  char *fit_mkrule;	/* special make rule, if any */
 	struct attr *fit_attr;	/* owner attr */
 	TAILQ_ENTRY(files) fit_anext;	/* next file in attr */
 };
@@ -360,21 +365,21 @@ struct filetype
  */
 struct files {
 	struct filetype fi_fit;
-	TAILQ_ENTRY(files) fi_next;
-	const  char *fi_tail;	/* name, i.e., strrchr(fi_path, '/') + 1 */
-	const  char *fi_base;	/* tail minus ".c" (or whatever) */
-	struct condexpr *fi_optx; /* options expression */
-	struct nvlist *fi_optf; /* flattened version of above, if needed */
-	const  char *fi_mkrule;	/* special make rule, if any */
 };
+#define fi_nextfi_fit.fit_next
 #define fi_srcfile fi_fit.fit_srcfile
 #define fi_srcline fi_fit.fit_srcline
 #define fi_flags   fi_fit.fit_flags
 #define fi_lastc   fi_fit.fit_lastc
+#define fi_tailfi_fit.fit_tail
+#define fi_basefi_fit.fit_base
 #define fi_pathfi_fit.fit_path
 #define fi_prefix  fi_fit.fit_prefix
 #define fi_suffix  fi_fit.fit_suffix
 #define fi_len fi_fit.fit_len
+#define fi_optxfi_fit.fit_optx
+#define fi_optffi_fit.fit_optf
+#define fi_mkrule  fi_fit.fit_mkrule
 #define fi_attrfi_fit.fit_attr
 #define fi_anext   fi_fit.fit_anext
 
@@ -390,17 +395,24 @@ struct files {
  */
 struct objects {
 	struct  filetype oi_fit;
-	TAILQ_ENTRY(objects) oi_next;
-	struct condexpr *oi_optx;	/* condition expression */
-	struct  nvlist *oi_optf;/* flattened version of above, if needed */
 };
 
+#define oi_nextoi_fit.fit_next
 #define oi_srcfile oi_fit.fit_srcfile
 #define oi_srcline oi_fit.fit_srcline
 #define oi_flags   oi_fit.fit_flags
 #define oi_lastc   oi_fit.fit_lastc
+#define oi_tailoi_fit.fit_tail
+#define oi_baseoi_fit.fit_base
 #define oi_pathoi_fit.fit_path
 #define oi_prefix  oi_fit.fit_prefix
+#define oi_suffix  oi_fit.fit_suffix
+#define oi_len oi_fit.fit_len
+#define oi_optxoi_fit.fit_optx
+#define oi_optfoi_fit.fit_optf
+#define oi_mkrule  oi_fit.fit_mkrule
+#define oi_attroi_fit.fit_attr
+#define oi_anext   oi_fit.fit_anext
 
 /* flags */
 #define	OI_SEL		0x01	/* selected */



CVS commit: src/usr.bin/config

2015-09-01 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Sep  1 12:10:56 UTC 2015

Modified Files:
src/usr.bin/config: defs.h files.c mkmakefile.c

Log Message:
Use per-suffix lists where appropriate.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/usr.bin/config/defs.h
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/config/files.c
cvs rdiff -u -r1.53 -r1.54 src/usr.bin/config/mkmakefile.c

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

Modified files:

Index: src/usr.bin/config/defs.h
diff -u src/usr.bin/config/defs.h:1.77 src/usr.bin/config/defs.h:1.78
--- src/usr.bin/config/defs.h:1.77	Tue Sep  1 11:35:46 2015
+++ src/usr.bin/config/defs.h	Tue Sep  1 12:10:56 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.77 2015/09/01 11:35:46 uebayasi Exp $	*/
+/*	$NetBSD: defs.h,v 1.78 2015/09/01 12:10:56 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -481,8 +481,6 @@ struct filelist		allfiles;	/* list of al
 struct filelist		allcfiles;	/* list of all .c files */
 struct filelist		allsfiles;	/* list of all .S files */
 struct filelist		allofiles;	/* list of all .o files */
-TAILQ_HEAD(, files)	allobjects;	/* list of all kernel object and
-	   library files */
 
 SLIST_HEAD(, prefix)	prefixes,	/* prefix stack */
 			allprefixes;	/* all prefixes used (after popped) */

Index: src/usr.bin/config/files.c
diff -u src/usr.bin/config/files.c:1.22 src/usr.bin/config/files.c:1.23
--- src/usr.bin/config/files.c:1.22	Tue Sep  1 11:22:59 2015
+++ src/usr.bin/config/files.c	Tue Sep  1 12:10:56 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: files.c,v 1.22 2015/09/01 11:22:59 uebayasi Exp $	*/
+/*	$NetBSD: files.c,v 1.23 2015/09/01 12:10:56 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: files.c,v 1.22 2015/09/01 11:22:59 uebayasi Exp $");
+__RCSID("$NetBSD: files.c,v 1.23 2015/09/01 12:10:56 uebayasi Exp $");
 
 #include 
 #include 
@@ -85,7 +85,6 @@ initfiles(void)
 	TAILQ_INIT();
 	TAILQ_INIT();
 	unchecked = _FIRST();
-	TAILQ_INIT();
 }
 
 void
@@ -177,13 +176,18 @@ addfile(const char *path, struct condexp
 		TAILQ_INSERT_TAIL(, fi, fi_next);
 		break;
 	case 'S':
+		fi->fi_suffix = 's';
+		/* FALLTHRU */
 	case 's':
 		TAILQ_INSERT_TAIL(, fi, fi_snext);
 		TAILQ_INSERT_TAIL(, fi, fi_next);
 		break;
 	case 'o':
 		TAILQ_INSERT_TAIL(, fi, fi_snext);
-		TAILQ_INSERT_TAIL(, fi, fi_next);
+		break;
+	default:
+		cfgxerror(fi->fi_srcfile, fi->fi_srcline,
+		"unknown suffix");
 		break;
 	}
 	return;
@@ -331,7 +335,7 @@ fixobjects(void)
 	int err, sel; 
  
 	err = 0;
-	TAILQ_FOREACH(fi, , fi_next) {
+	TAILQ_FOREACH(fi, , fi_snext) {
 		/* Optional: see if it is to be included. */
 		if (fi->fi_optx != NULL) {
 			flathead = NULL;

Index: src/usr.bin/config/mkmakefile.c
diff -u src/usr.bin/config/mkmakefile.c:1.53 src/usr.bin/config/mkmakefile.c:1.54
--- src/usr.bin/config/mkmakefile.c:1.53	Tue Sep  1 11:35:46 2015
+++ src/usr.bin/config/mkmakefile.c	Tue Sep  1 12:10:56 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkmakefile.c,v 1.53 2015/09/01 11:35:46 uebayasi Exp $	*/
+/*	$NetBSD: mkmakefile.c,v 1.54 2015/09/01 12:10:56 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkmakefile.c,v 1.53 2015/09/01 11:35:46 uebayasi Exp $");
+__RCSID("$NetBSD: mkmakefile.c,v 1.54 2015/09/01 12:10:56 uebayasi Exp $");
 
 #include 
 #include 
@@ -63,7 +63,7 @@ __RCSID("$NetBSD: mkmakefile.c,v 1.53 20
  */
 
 static void emitdefs(FILE *);
-static void emitfiles(FILE *, int, int);
+static void emitfiles(FILE *, struct filelist *, int);
 
 static void emitobjs(FILE *);
 static void emitallkobjs(FILE *);
@@ -320,7 +320,7 @@ emitobjs(FILE *fp)
 			continue;
 		fprintf(fp, "\t%s.o \\\n", fi->fi_base);
 	}
-	TAILQ_FOREACH(fi, , fi_next) {
+	TAILQ_FOREACH(fi, , fi_snext) {
 		if ((fi->fi_flags & FI_SEL) == 0)
 			continue;
 		putc('\t', fp);
@@ -444,29 +444,27 @@ static void
 emitcfiles(FILE *fp)
 {
 
-	emitfiles(fp, 'c', 0);
+	emitfiles(fp, , 'c');
 }
 
 static void
 emitsfiles(FILE *fp)
 {
 
-	emitfiles(fp, 's', 'S');
+	emitfiles(fp, , 's');
 }
 
 static void
-emitfiles(FILE *fp, int suffix, int upper_suffix)
+emitfiles(FILE *fp, struct filelist *filelist, int suffix)
 {
 	struct files *fi;
  	struct config *cf;
  	char swapname[100];
 
 	fprintf(fp, "%cFILES= \\\n", toupper(suffix));
-	TAILQ_FOREACH(fi, , fi_next) {
+	TAILQ_FOREACH(fi, filelist, fi_snext) {
 		if ((fi->fi_flags & FI_SEL) == 0)
 			continue;
-		if (fi->fi_suffix != suffix && fi->fi_suffix != upper_suffix)
-			continue;
 		putc('\t', fp);
 		emitfile(fp, fi);
 		fputs(" \\\n", fp);



CVS commit: src/usr.bin/config

2015-09-01 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Sep  1 11:22:59 UTC 2015

Modified Files:
src/usr.bin/config: defs.h files.c gram.y mkmakefile.c

Log Message:
Merge struct objects into struct files.  Keep per-suffix file lists.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/usr.bin/config/defs.h
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/config/files.c
cvs rdiff -u -r1.50 -r1.51 src/usr.bin/config/gram.y
cvs rdiff -u -r1.51 -r1.52 src/usr.bin/config/mkmakefile.c

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

Modified files:

Index: src/usr.bin/config/defs.h
diff -u src/usr.bin/config/defs.h:1.75 src/usr.bin/config/defs.h:1.76
--- src/usr.bin/config/defs.h:1.75	Tue Sep  1 10:37:48 2015
+++ src/usr.bin/config/defs.h	Tue Sep  1 11:22:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.75 2015/09/01 10:37:48 uebayasi Exp $	*/
+/*	$NetBSD: defs.h,v 1.76 2015/09/01 11:22:59 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -149,6 +149,9 @@ struct defoptlist {
 	struct nvlist *dl_depends;
 };
 
+struct files;
+TAILQ_HEAD(filelist, files);
+
 struct module {
 	const char		*m_name;
 #if 1
@@ -158,7 +161,7 @@ struct module {
 	struct modulelist	*m_deps;
 #endif
 	int			m_expanding;
-	TAILQ_HEAD(, files)	m_files;
+	struct filelist		m_files;
 	int			m_weight;
 };
 
@@ -334,6 +337,7 @@ struct devi {
  */
 struct filetype {
 	TAILQ_ENTRY(files) fit_next;
+	TAILQ_ENTRY(files) fit_snext;
 	const char *fit_srcfile;	/* the name of the "files" file that got us */
 	u_short	fit_srcline;	/* and the line number */
 	u_char	fit_flags;	/* as below */
@@ -367,6 +371,7 @@ struct files {
 	struct filetype fi_fit;
 };
 #define fi_nextfi_fit.fit_next
+#define fi_snextfi_fit.fit_snext
 #define fi_srcfile fi_fit.fit_srcfile
 #define fi_srcline fi_fit.fit_srcline
 #define fi_flags   fi_fit.fit_flags
@@ -390,35 +395,6 @@ struct files {
 #define	FI_HIDDEN	0x08	/* obscured by other(s), base names overlap */
 
 /*
- * Objects and libraries.  This allows precompiled object and library
- * files (e.g. binary-only device drivers) to be linked in.
- */
-struct objects {
-	struct  filetype oi_fit;
-};
-
-#define oi_nextoi_fit.fit_next
-#define oi_srcfile oi_fit.fit_srcfile
-#define oi_srcline oi_fit.fit_srcline
-#define oi_flags   oi_fit.fit_flags
-#define oi_lastc   oi_fit.fit_lastc
-#define oi_tailoi_fit.fit_tail
-#define oi_baseoi_fit.fit_base
-#define oi_pathoi_fit.fit_path
-#define oi_prefix  oi_fit.fit_prefix
-#define oi_suffix  oi_fit.fit_suffix
-#define oi_len oi_fit.fit_len
-#define oi_optxoi_fit.fit_optx
-#define oi_optfoi_fit.fit_optf
-#define oi_mkrule  oi_fit.fit_mkrule
-#define oi_attroi_fit.fit_attr
-#define oi_anext   oi_fit.fit_anext
-
-/* flags */
-#define	OI_SEL		0x01	/* selected */
-#define	OI_NEEDSFLAG	0x02	/* needs-flag */
-
-/*
  * Condition expressions.
  */
 
@@ -534,8 +510,11 @@ int	do_devsw;			/* 0 if pre-devsw config
 int	oktopackage;			/* 0 before setmachine() */
 int	devilevel;			/* used for devi->i_level */
 
-TAILQ_HEAD(, files)	allfiles;	/* list of all kernel source files */
-TAILQ_HEAD(, objects)	allobjects;	/* list of all kernel object and
+struct filelist		allfiles;	/* list of all kernel source files */
+struct filelist		allcfiles;	/* list of all .c files */
+struct filelist		allsfiles;	/* list of all .S files */
+struct filelist		allofiles;	/* list of all .o files */
+TAILQ_HEAD(, files)	allobjects;	/* list of all kernel object and
 	   library files */
 
 SLIST_HEAD(, prefix)	prefixes,	/* prefix stack */
@@ -563,7 +542,6 @@ int	fixfiles(void);		/* finalize */
 int	fixobjects(void);
 int	fixdevsw(void);
 void	addfile(const char *, struct condexpr *, u_char, const char *);
-void	addobject(const char *, struct condexpr *, u_char);
 int	expr_eval(struct condexpr *, int (*)(const char *, void *), void *);
 
 /* hash.c */

Index: src/usr.bin/config/files.c
diff -u src/usr.bin/config/files.c:1.21 src/usr.bin/config/files.c:1.22
--- src/usr.bin/config/files.c:1.21	Sat Aug 29 02:54:07 2015
+++ src/usr.bin/config/files.c	Tue Sep  1 11:22:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: files.c,v 1.21 2015/08/29 02:54:07 uebayasi Exp $	*/
+/*	$NetBSD: files.c,v 1.22 2015/09/01 11:22:59 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: files.c,v 1.21 2015/08/29 02:54:07 uebayasi Exp $");
+__RCSID("$NetBSD: files.c,v 1.22 2015/09/01 11:22:59 uebayasi Exp $");
 
 #include 
 #include 
@@ -81,6 +81,9 @@ initfiles(void)
 	basetab = ht_new();
 	pathtab = ht_new();
 	TAILQ_INIT();
+	TAILQ_INIT();
+	TAILQ_INIT();
+	TAILQ_INIT();
 	unchecked = _FIRST();
 	TAILQ_INIT();
 }
@@ -168,7 +171,21 @@ addfile(const char *path, struct condexp
 	fi->fi_optf = NULL;
 	fi->fi_mkrule = rule;
 	fi->fi_attr = NULL;
-	TAILQ_INSERT_TAIL(, fi, fi_next);
+	switch (fi->fi_suffix) {
+	case 'c':
+		TAILQ_INSERT_TAIL(, fi, fi_snext);
+		

CVS commit: src/usr.bin/config

2015-09-01 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Sep  1 11:35:47 UTC 2015

Modified Files:
src/usr.bin/config: defs.h mkmakefile.c

Log Message:
Abstract struct filetype is no longer needed.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/usr.bin/config/defs.h
cvs rdiff -u -r1.52 -r1.53 src/usr.bin/config/mkmakefile.c

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

Modified files:

Index: src/usr.bin/config/defs.h
diff -u src/usr.bin/config/defs.h:1.76 src/usr.bin/config/defs.h:1.77
--- src/usr.bin/config/defs.h:1.76	Tue Sep  1 11:22:59 2015
+++ src/usr.bin/config/defs.h	Tue Sep  1 11:35:46 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.76 2015/09/01 11:22:59 uebayasi Exp $	*/
+/*	$NetBSD: defs.h,v 1.77 2015/09/01 11:35:46 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -332,61 +332,28 @@ struct devi {
 #define	WILD	(-2)		/* unit number for, e.g., "sd?" */
 
 /*
- * Files or objects.  This structure defines the common fields
+ * Files (*.c, *.S, or *.o).  This structure defines the common fields
  * between the two.
  */
-struct filetype {
-	TAILQ_ENTRY(files) fit_next;
-	TAILQ_ENTRY(files) fit_snext;
-	const char *fit_srcfile;	/* the name of the "files" file that got us */
-	u_short	fit_srcline;	/* and the line number */
-	u_char	fit_flags;	/* as below */
-	char	fit_lastc;	/* last char from path */
-	const char *fit_tail;	/* name, i.e., strrchr(fi_path, '/') + 1 */
-	const char *fit_base;	/* tail minus ".c" (or whatever) */
-	const char *fit_path;	/* full file path */
-	const char *fit_prefix;	/* any file prefix */
-	int fit_suffix;		/* single char suffix */
-	size_t fit_len;		/* path string length */
-	struct condexpr *fit_optx; /* options expression */
-	struct nvlist *fit_optf; /* flattened version of above, if needed */
-	const  char *fit_mkrule;	/* special make rule, if any */
-	struct attr *fit_attr;	/* owner attr */
-	TAILQ_ENTRY(files) fit_anext;	/* next file in attr */
-};
-/* Anything less than 0x10 is sub-type specific */
-
-/*
- * Files.  Each file is either standard (always included) or optional,
- * depending on whether it has names on which to *be* optional.  The
- * options field (fi_optx) is an expression tree of type struct
- * condexpr, with nodes for OR, AND, and NOT, as well as atoms (words)
- * representing some particular option.
- * 
- * For any file marked as needs-count or needs-flag, fixfiles() will
- * build fi_optf, a `flat list' of the options with nv_num fields that
- * contain counts or `need' flags; this is used in mkheaders().
- */
 struct files {
-	struct filetype fi_fit;
+	TAILQ_ENTRY(files) fi_next;
+	TAILQ_ENTRY(files) fi_snext;
+	const char *fi_srcfile;	/* the name of the "files" file that got us */
+	u_short	fi_srcline;	/* and the line number */
+	u_char	fi_flags;	/* as below */
+	char	fi_lastc;	/* last char from path */
+	const char *fi_tail;	/* name, i.e., strrchr(fi_path, '/') + 1 */
+	const char *fi_base;	/* tail minus ".c" (or whatever) */
+	const char *fi_path;	/* full file path */
+	const char *fi_prefix;	/* any file prefix */
+	int fi_suffix;		/* single char suffix */
+	size_t fi_len;		/* path string length */
+	struct condexpr *fi_optx; /* options expression */
+	struct nvlist *fi_optf; /* flattened version of above, if needed */
+	const  char *fi_mkrule;	/* special make rule, if any */
+	struct attr *fi_attr;	/* owner attr */
+	TAILQ_ENTRY(files) fi_anext;	/* next file in attr */
 };
-#define fi_nextfi_fit.fit_next
-#define fi_snextfi_fit.fit_snext
-#define fi_srcfile fi_fit.fit_srcfile
-#define fi_srcline fi_fit.fit_srcline
-#define fi_flags   fi_fit.fit_flags
-#define fi_lastc   fi_fit.fit_lastc
-#define fi_tailfi_fit.fit_tail
-#define fi_basefi_fit.fit_base
-#define fi_pathfi_fit.fit_path
-#define fi_prefix  fi_fit.fit_prefix
-#define fi_suffix  fi_fit.fit_suffix
-#define fi_len fi_fit.fit_len
-#define fi_optxfi_fit.fit_optx
-#define fi_optffi_fit.fit_optf
-#define fi_mkrule  fi_fit.fit_mkrule
-#define fi_attrfi_fit.fit_attr
-#define fi_anext   fi_fit.fit_anext
 
 /* flags */
 #define	FI_SEL		0x01	/* selected */

Index: src/usr.bin/config/mkmakefile.c
diff -u src/usr.bin/config/mkmakefile.c:1.52 src/usr.bin/config/mkmakefile.c:1.53
--- src/usr.bin/config/mkmakefile.c:1.52	Tue Sep  1 11:22:59 2015
+++ src/usr.bin/config/mkmakefile.c	Tue Sep  1 11:35:46 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkmakefile.c,v 1.52 2015/09/01 11:22:59 uebayasi Exp $	*/
+/*	$NetBSD: mkmakefile.c,v 1.53 2015/09/01 11:35:46 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkmakefile.c,v 1.52 2015/09/01 11:22:59 uebayasi Exp $");
+__RCSID("$NetBSD: mkmakefile.c,v 1.53 2015/09/01 11:35:46 uebayasi Exp $");
 
 #include 
 #include 
@@ -292,21 +292,21 @@ emitdefs(FILE *fp)
 }
 
 static void
-emitfiletype(FILE *fp, struct filetype *fit)
+emitfile(FILE *fp, struct files *fi)
 {
 	

CVS commit: src/usr.bin/config

2015-09-01 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Sep  1 12:32:26 UTC 2015

Modified Files:
src/usr.bin/config: defs.h

Log Message:
Clean up struct files.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/usr.bin/config/defs.h

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

Modified files:

Index: src/usr.bin/config/defs.h
diff -u src/usr.bin/config/defs.h:1.78 src/usr.bin/config/defs.h:1.79
--- src/usr.bin/config/defs.h:1.78	Tue Sep  1 12:10:56 2015
+++ src/usr.bin/config/defs.h	Tue Sep  1 12:32:26 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.78 2015/09/01 12:10:56 uebayasi Exp $	*/
+/*	$NetBSD: defs.h,v 1.79 2015/09/01 12:32:26 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -337,11 +337,10 @@ struct devi {
  */
 struct files {
 	TAILQ_ENTRY(files) fi_next;
-	TAILQ_ENTRY(files) fi_snext;
+	TAILQ_ENTRY(files) fi_snext;	/* per-suffix list */
 	const char *fi_srcfile;	/* the name of the "files" file that got us */
 	u_short	fi_srcline;	/* and the line number */
-	u_char	fi_flags;	/* as below */
-	char	fi_lastc;	/* last char from path */
+	u_char fi_flags;	/* as below */
 	const char *fi_tail;	/* name, i.e., strrchr(fi_path, '/') + 1 */
 	const char *fi_base;	/* tail minus ".c" (or whatever) */
 	const char *fi_path;	/* full file path */
@@ -350,7 +349,7 @@ struct files {
 	size_t fi_len;		/* path string length */
 	struct condexpr *fi_optx; /* options expression */
 	struct nvlist *fi_optf; /* flattened version of above, if needed */
-	const  char *fi_mkrule;	/* special make rule, if any */
+	const char *fi_mkrule;	/* special make rule, if any */
 	struct attr *fi_attr;	/* owner attr */
 	TAILQ_ENTRY(files) fi_anext;	/* next file in attr */
 };



CVS commit: src/usr.bin/config

2015-09-01 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Sep  1 12:46:20 UTC 2015

Modified Files:
src/usr.bin/config: defs.h files.c

Log Message:
Keep track of directory of files internally.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/usr.bin/config/defs.h
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/config/files.c

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

Modified files:

Index: src/usr.bin/config/defs.h
diff -u src/usr.bin/config/defs.h:1.79 src/usr.bin/config/defs.h:1.80
--- src/usr.bin/config/defs.h:1.79	Tue Sep  1 12:32:26 2015
+++ src/usr.bin/config/defs.h	Tue Sep  1 12:46:20 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.79 2015/09/01 12:32:26 uebayasi Exp $	*/
+/*	$NetBSD: defs.h,v 1.80 2015/09/01 12:46:20 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -343,6 +343,7 @@ struct files {
 	u_char fi_flags;	/* as below */
 	const char *fi_tail;	/* name, i.e., strrchr(fi_path, '/') + 1 */
 	const char *fi_base;	/* tail minus ".c" (or whatever) */
+	const char *fi_dir;	/* path to file */
 	const char *fi_path;	/* full file path */
 	const char *fi_prefix;	/* any file prefix */
 	int fi_suffix;		/* single char suffix */

Index: src/usr.bin/config/files.c
diff -u src/usr.bin/config/files.c:1.23 src/usr.bin/config/files.c:1.24
--- src/usr.bin/config/files.c:1.23	Tue Sep  1 12:10:56 2015
+++ src/usr.bin/config/files.c	Tue Sep  1 12:46:20 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: files.c,v 1.23 2015/09/01 12:10:56 uebayasi Exp $	*/
+/*	$NetBSD: files.c,v 1.24 2015/09/01 12:46:20 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: files.c,v 1.23 2015/09/01 12:10:56 uebayasi Exp $");
+__RCSID("$NetBSD: files.c,v 1.24 2015/09/01 12:46:20 uebayasi Exp $");
 
 #include 
 #include 
@@ -93,8 +93,10 @@ addfile(const char *path, struct condexp
 	struct files *fi;
 	const char *dotp, *tail;
 	size_t baselen;
+	size_t dirlen;
 	int needc, needf;
 	char base[200];
+	char dir[MAXPATHLEN];
 
 	/* check various errors */
 	needc = flags & FI_NEEDSCOUNT;
@@ -115,10 +117,16 @@ addfile(const char *path, struct condexp
 
 	/* find last part of pathname, and same without trailing suffix */
 	tail = strrchr(path, '/');
-	if (tail == NULL)
+	if (tail == NULL) {
+		dirlen = 0;
 		tail = path;
-	else
+	} else {
+		dirlen = (size_t)(tail - path);
 		tail++;
+	}
+	memcpy(dir, path, dirlen);
+	dir[dirlen] = '\0';
+
 	dotp = strrchr(tail, '.');
 	if (dotp == NULL || dotp[1] == 0 ||
 	(baselen = (size_t)(dotp - tail)) >= sizeof(base)) {
@@ -155,13 +163,14 @@ addfile(const char *path, struct condexp
 		goto bad;
 	}
 	memcpy(base, tail, baselen);
-	base[baselen] = 0;
+	base[baselen] = '\0';
 	fi->fi_srcfile = yyfile;
 	fi->fi_srcline = currentline();
 	fi->fi_flags = flags;
 	fi->fi_path = path;
 	fi->fi_tail = tail;
 	fi->fi_base = intern(base);
+	fi->fi_dir = intern(dir);
 	fi->fi_prefix = SLIST_EMPTY() ? NULL :
 			SLIST_FIRST()->pf_prefix;
 	fi->fi_len = strlen(path);



CVS commit: src/usr.bin/config

2015-09-01 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Wed Sep  2 05:09:25 UTC 2015

Modified Files:
src/usr.bin/config: defs.h files.c main.c mkdevsw.c mkheaders.c
mkioconf.c mkswap.c

Log Message:
In `-S' mode, generate *.c files under conf/ subdirectory.  Register generated
.c files to the `files' list internally.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/usr.bin/config/defs.h
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/config/files.c
cvs rdiff -u -r1.84 -r1.85 src/usr.bin/config/main.c
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/config/mkdevsw.c
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/config/mkheaders.c
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/config/mkioconf.c
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/config/mkswap.c

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

Modified files:

Index: src/usr.bin/config/defs.h
diff -u src/usr.bin/config/defs.h:1.83 src/usr.bin/config/defs.h:1.84
--- src/usr.bin/config/defs.h:1.83	Tue Sep  1 16:01:23 2015
+++ src/usr.bin/config/defs.h	Wed Sep  2 05:09:25 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.83 2015/09/01 16:01:23 uebayasi Exp $	*/
+/*	$NetBSD: defs.h,v 1.84 2015/09/02 05:09:25 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -433,6 +433,8 @@ struct	nvlist *machinesubarches;
 const char *ioconfname;		/* ioconf name, mutually exclusive to machine */
 const char *srcdir;		/* path to source directory (rel. to build) */
 const char *builddir;		/* path to build directory */
+int	builddirfd;		/* dir fd of builddir */
+int	buildconfdirfd;		/* dir fd of builddir/conf */
 const char *defbuilddir;	/* default build directory */
 const char *ident;		/* kernel "ident"ification string */
 int	errors;			/* counts calls to error() */

Index: src/usr.bin/config/files.c
diff -u src/usr.bin/config/files.c:1.26 src/usr.bin/config/files.c:1.27
--- src/usr.bin/config/files.c:1.26	Tue Sep  1 16:01:23 2015
+++ src/usr.bin/config/files.c	Wed Sep  2 05:09:25 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: files.c,v 1.26 2015/09/01 16:01:23 uebayasi Exp $	*/
+/*	$NetBSD: files.c,v 1.27 2015/09/02 05:09:25 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: files.c,v 1.26 2015/09/01 16:01:23 uebayasi Exp $");
+__RCSID("$NetBSD: files.c,v 1.27 2015/09/02 05:09:25 uebayasi Exp $");
 
 #include 
 #include 
@@ -278,13 +278,15 @@ fixfiles(void)
  		struct config *cf;
  		char swapname[100];
 
-		addfile("devsw.c", NULL, 0, NULL);
-		addfile("ioconf.c", NULL, 0, NULL);
+		buildprefix_push("conf");
+		addfile("conf/devsw.c", NULL, 0, NULL);
+		addfile("conf/ioconf.c", NULL, 0, NULL);
  		TAILQ_FOREACH(cf, , cf_next) {
- 			(void)snprintf(swapname, sizeof(swapname), "swap%s.c",
+ 			(void)snprintf(swapname, sizeof(swapname), "conf/swap%s.c",
  			cf->cf_name);
  			addfile(intern(swapname), NULL, 0, NULL);
  		}
+		buildprefix_pop();
 	}
 
 	err = 0;

Index: src/usr.bin/config/main.c
diff -u src/usr.bin/config/main.c:1.84 src/usr.bin/config/main.c:1.85
--- src/usr.bin/config/main.c:1.84	Tue Sep  1 16:01:23 2015
+++ src/usr.bin/config/main.c	Wed Sep  2 05:09:25 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.84 2015/09/01 16:01:23 uebayasi Exp $	*/
+/*	$NetBSD: main.c,v 1.85 2015/09/02 05:09:25 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: main.c,v 1.84 2015/09/01 16:01:23 uebayasi Exp $");
+__RCSID("$NetBSD: main.c,v 1.85 2015/09/02 05:09:25 uebayasi Exp $");
 
 #ifndef MAKE_BOOTSTRAP
 #include 
@@ -100,6 +100,8 @@ extern int yydebug;
 #endif
 int	dflag;
 
+static const char *buildconfdir = ".";
+
 static struct dlhash *obsopttab;
 static struct hashtab *mkopttab;
 static struct nvlist **nextopt;
@@ -522,11 +524,15 @@ main(int argc, char **argv)
 	/*
 	 * Ready to go.  Build all the various files.
 	 */
-	if (mksubdirs() || mksymlinks() || mkmakefile() || mkheaders() || mkswap() ||
+	if ((Sflag && mksubdirs()) || mksymlinks() || mkmakefile() || mkheaders() || mkswap() ||
 	mkioconf() || (do_devsw ? mkdevsw() : 0) || mkident() || errors)
 		stop();
 	(void)printf("Build directory is %s\n", builddir);
 	(void)printf("Don't forget to run \"make depend\"\n");
+
+	close(buildconfdirfd);
+	close(builddirfd);
+
 	return 0;
 }
 
@@ -650,9 +656,6 @@ mksubdirs(void)
 	const char *prefix, *sep;
 	char buf[MAXPATHLEN];
 
-	if (!Sflag)
-		return 0;
-
 	TAILQ_FOREACH(fi, , fi_next) {
 		if ((fi->fi_flags & FI_SEL) == 0)
 			continue;
@@ -672,6 +675,8 @@ mksubdirs(void)
 		mksubdir(buf);
 	}
 
+	buildconfdir = "conf";
+
 	return 0;
 }
 
@@ -689,6 +694,9 @@ mksymlinks(void)
 
 	p = buf;
 
+	if ((buildconfdirfd = open(buildconfdir, O_RDONLY)) == -1)
+		errx(EXIT_FAILURE, "cannot opens %s", buildconfdir);
+
 	snprintf(buf, sizeof(buf), "%s/arch/%s/include", srcdir, machine);
 	ret = recreate(p, "machine");
 	ret = recreate(p, machine);
@@ -1464,6 +1472,8 @@ setupdirs(void)
 			

CVS commit: othersrc/external/bsd/progress/dist

2015-09-01 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Tue Sep  1 15:16:31 UTC 2015

Modified Files:
othersrc/external/bsd/progress/dist: progress.c

Log Message:
we go to the lengths of calculating the prefix length for the progress bar,
so we might as well use it when printing out the progress bar. Missed from
previous changes from k...@freebsd.org.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/progress/dist/progress.c

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

Modified files:

Index: othersrc/external/bsd/progress/dist/progress.c
diff -u othersrc/external/bsd/progress/dist/progress.c:1.2 othersrc/external/bsd/progress/dist/progress.c:1.3
--- othersrc/external/bsd/progress/dist/progress.c:1.2	Tue Sep  1 03:47:28 2015
+++ othersrc/external/bsd/progress/dist/progress.c	Tue Sep  1 15:16:31 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: progress.c,v 1.2 2015/09/01 03:47:28 agc Exp $	*/
+/*	$NetBSD: progress.c,v 1.3 2015/09/01 15:16:31 agc Exp $	*/
 
 /*-
  * Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
@@ -198,7 +198,8 @@ progress_draw(progress_t *prog, uint64_t
 	}
 	secs = secsleft % SECSPERHOUR;
 	len = snprintf(buf, sizeof(buf),
-		"\r%s %3lld%% |%.*s%*s| %5lld %-3s %3lld.%02d %.2sB/s %s%02d:%02d ETA",
+		"\r%.*s %3lld%% |%.*s%*s| %5lld %-3s %3lld.%02d %.2sB/s %s%02d:%02d ETA",
+		(int)prefixlength,
 		(prog->prefix) ? prog->prefix : "",
 		(long long)prog->percent,
 		(int)starc, stars, (int)(barlength - starc), "",



CVS commit: src/usr.bin/config

2015-09-01 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Sep  1 14:32:20 UTC 2015

Modified Files:
src/usr.bin/config: main.c

Log Message:
Prepare to build subdirectories.  Not enabled yet.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/usr.bin/config/main.c

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

Modified files:

Index: src/usr.bin/config/main.c
diff -u src/usr.bin/config/main.c:1.82 src/usr.bin/config/main.c:1.83
--- src/usr.bin/config/main.c:1.82	Tue Sep  1 01:50:14 2015
+++ src/usr.bin/config/main.c	Tue Sep  1 14:32:20 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.82 2015/09/01 01:50:14 pgoyette Exp $	*/
+/*	$NetBSD: main.c,v 1.83 2015/09/01 14:32:20 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: main.c,v 1.82 2015/09/01 01:50:14 pgoyette Exp $");
+__RCSID("$NetBSD: main.c,v 1.83 2015/09/01 14:32:20 uebayasi Exp $");
 
 #ifndef MAKE_BOOTSTRAP
 #include 
@@ -122,6 +122,7 @@ static	int	undo_option(struct hashtab *,
 static	int	crosscheck(void);
 static	int	badstar(void);
 	int	main(int, char **);
+static	int	mksubdirs(void);
 static	int	mksymlinks(void);
 static	int	mkident(void);
 static	int	devbase_has_dead_instances(const char *, void *, void *);
@@ -516,7 +517,7 @@ main(int argc, char **argv)
 	/*
 	 * Ready to go.  Build all the various files.
 	 */
-	if (mksymlinks() || mkmakefile() || mkheaders() || mkswap() ||
+	if (mksubdirs() || mksymlinks() || mkmakefile() || mkheaders() || mkswap() ||
 	mkioconf() || (do_devsw ? mkdevsw() : 0) || mkident() || errors)
 		stop();
 	(void)printf("Build directory is %s\n", builddir);
@@ -617,6 +618,59 @@ recreate(const char *p, const char *q)
 	return ret;
 }
 
+static void
+mksubdir(char *buf)
+{
+	char *p;
+	struct stat st;
+
+	p = strrchr(buf, '/');
+	if (p != NULL && *p == '/') {
+		*p = '\0';
+		mksubdir(buf);
+		*p = '/';
+	}
+	if (stat(buf, ) == 0) {
+		if (!S_ISDIR(st.st_mode))
+			errx(EXIT_FAILURE, "not directory %s", buf);
+	} else
+		if (mkdir(buf, 0777) == -1)
+			errx(EXIT_FAILURE, "cannot create %s", buf);
+}
+
+static int
+mksubdirs(void)
+{
+	struct files *fi;
+	const char *prefix, *sep;
+	char buf[MAXPATHLEN];
+
+	// XXX notyet
+	if (1)
+		return 0;
+
+	TAILQ_FOREACH(fi, , fi_next) {
+		if ((fi->fi_flags & FI_SEL) == 0)
+			continue;
+		prefix = sep = "";
+		if (fi->fi_buildprefix != NULL) {
+			prefix = fi->fi_buildprefix;
+			sep = "/";
+		} else {
+			if (fi->fi_prefix != NULL) {
+prefix = fi->fi_prefix;
+sep = "/";
+			}
+		}
+		snprintf(buf, sizeof(buf), "%s%s%s", prefix, sep, fi->fi_dir);
+		if (buf[0] == '\0')
+			continue;
+		mksubdir(buf);
+	}
+
+	return 0;
+}
+
 /*
  * Make a symlink for "machine" so that "#include " works,
  * and for the machine's CPU architecture, so that works as well.



CVS commit: src/sys/arch/luna68k/luna68k

2015-09-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Sep  1 13:46:14 UTC 2015

Modified Files:
src/sys/arch/luna68k/luna68k: locore.s

Log Message:
Allow NetBSD/luna68k kernel work with 8kB/page (PGSHIFT==13) settings.

Tested on both LUNA (68030) and LUNA-II (68040).


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/luna68k/luna68k/locore.s

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/luna68k/luna68k/locore.s
diff -u src/sys/arch/luna68k/luna68k/locore.s:1.59 src/sys/arch/luna68k/luna68k/locore.s:1.60
--- src/sys/arch/luna68k/luna68k/locore.s:1.59	Sat Mar 22 16:52:07 2014
+++ src/sys/arch/luna68k/luna68k/locore.s	Tue Sep  1 13:46:14 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.59 2014/03/22 16:52:07 tsutsui Exp $ */
+/* $NetBSD: locore.s,v 1.60 2015/09/01 13:46:14 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -287,7 +287,7 @@ Lmotommu1:
 	RELOC(protott1,%a0)		| tt1 range 8000.-.
 	.long	0xf0100c00		| pmove %a0@,mmutt1
 	pflusha
-	RELOC(prototc,%a0)		| %tc: SRP,CRP,4KB page,A=10bit,B=10bit
+	RELOC(prototc,%a0)		| %tc: SRP,CRP,4KB or 8KB page
 	pmove	%a0@,%tc
 /*
  * Should be running mapped from this point on
@@ -909,13 +909,21 @@ GLOBAL(protocrp)
 	.long	0x8002,0	| prototype CPU root pointer
 
 GLOBAL(prototc)
+#if PGSHIFT == 13
+	.long	0x82d08b00	| %tc (SRP,CRP,8KB page, TIA/TIB=8/11bits)
+#else
 	.long	0x82c0aa00	| %tc (SRP,CRP,4KB page, TIA/TIB=10/10bits)
+#endif
 GLOBAL(protott0)		| tt0 0x4000.-0x7fff.
 	.long	0x403f8543	|
 GLOBAL(protott1)		| tt1 0x8000.-0x.
 	.long	0x807f8543	|
 GLOBAL(proto040tc)
+#if PGSHIFT == 13
+	.long	0xc000		| %tc (8KB page)
+#else
 	.long	0x8000		| %tc (4KB page)
+#endif
 GLOBAL(proto040tt0)		| tt0 0x4000.-0x7fff.
 	.long	0x403fa040	| kernel only, cache inhebit, serialized
 GLOBAL(proto040tt1)		| tt1 0x8000.-0x.



CVS commit: src/usr.bin/config

2015-09-01 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Sep  1 13:45:52 UTC 2015

Modified Files:
src/usr.bin/config: defs.h

Log Message:
Bump version for "buildprefix".


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/usr.bin/config/defs.h

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

Modified files:

Index: src/usr.bin/config/defs.h
diff -u src/usr.bin/config/defs.h:1.81 src/usr.bin/config/defs.h:1.82
--- src/usr.bin/config/defs.h:1.81	Tue Sep  1 13:42:48 2015
+++ src/usr.bin/config/defs.h	Tue Sep  1 13:45:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.81 2015/09/01 13:42:48 uebayasi Exp $	*/
+/*	$NetBSD: defs.h,v 1.82 2015/09/01 13:45:52 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -107,7 +107,7 @@ extern const char *progname;
  * The next two lines define the current version of the config(1) binary,
  * and the minimum version of the configuration files it supports.
  */
-#define CONFIG_VERSION		20150834
+#define CONFIG_VERSION		20150835
 #define CONFIG_MINVERSION	0
 
 /*



CVS commit: src/sys/external/bsd/dwc2/dist

2015-09-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep  1 14:03:00 UTC 2015

Modified Files:
src/sys/external/bsd/dwc2/dist: dwc2_core.c

Log Message:
kern/50185: dwctwo attach failure

Another hunk went walkabout during the import - reapply with a little
update


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/dwc2/dist/dwc2_core.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/external/bsd/dwc2/dist/dwc2_core.c
diff -u src/sys/external/bsd/dwc2/dist/dwc2_core.c:1.9 src/sys/external/bsd/dwc2/dist/dwc2_core.c:1.10
--- src/sys/external/bsd/dwc2/dist/dwc2_core.c:1.9	Tue Sep  1 06:24:21 2015
+++ src/sys/external/bsd/dwc2/dist/dwc2_core.c	Tue Sep  1 14:03:00 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2_core.c,v 1.9 2015/09/01 06:24:21 skrll Exp $	*/
+/*	$NetBSD: dwc2_core.c,v 1.10 2015/09/01 14:03:00 skrll Exp $	*/
 
 /*
  * core.c - DesignWare HS OTG Controller common routines
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2_core.c,v 1.9 2015/09/01 06:24:21 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2_core.c,v 1.10 2015/09/01 14:03:00 skrll Exp $");
 
 #include 
 #include 
@@ -686,12 +686,22 @@ static int dwc2_phy_init(struct dwc2_hso
 
 static int dwc2_gahbcfg_init(struct dwc2_hsotg *hsotg)
 {
+	struct dwc2_softc *sc = hsotg->hsotg_sc;
 	u32 ahbcfg = DWC2_READ_4(hsotg, GAHBCFG);
 
 	switch (hsotg->hw_params.arch) {
 	case GHWCFG2_EXT_DMA_ARCH:
-		dev_err(hsotg->dev, "External DMA Mode not supported\n");
-		return -EINVAL;
+		dev_dbg(hsotg->dev, "External DMA Mode\n");
+		if (!sc->sc_set_dma_addr) {
+			dev_err(hsotg->dev, "External DMA Mode not supported\n");
+			return -EINVAL;
+		}
+		if (hsotg->core_params->ahbcfg != -1) {
+			ahbcfg &= GAHBCFG_CTRL_MASK;
+			ahbcfg |= hsotg->core_params->ahbcfg &
+  ~GAHBCFG_CTRL_MASK;
+		}
+		break;
 
 	case GHWCFG2_INT_DMA_ARCH:
 		dev_dbg(hsotg->dev, "Internal DMA Mode\n");



CVS commit: src/sys/lib/libx86emu

2015-09-01 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Sep  1 13:46:29 UTC 2015

Modified Files:
src/sys/lib/libx86emu: files.x86emu

Log Message:
Use "prefix" to specify path out of $S.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/lib/libx86emu/files.x86emu

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

Modified files:

Index: src/sys/lib/libx86emu/files.x86emu
diff -u src/sys/lib/libx86emu/files.x86emu:1.3 src/sys/lib/libx86emu/files.x86emu:1.4
--- src/sys/lib/libx86emu/files.x86emu:1.3	Fri Mar 13 18:25:58 2009
+++ src/sys/lib/libx86emu/files.x86emu	Tue Sep  1 13:46:29 2015
@@ -1,7 +1,11 @@
 defflag	X86EMU
 
-file	../common/lib/libx86emu/x86emu.c	x86emu
-file	../common/lib/libx86emu/x86emu_i8254.c	x86emu
-file	../common/lib/libx86emu/x86emu_util.c	x86emu
+prefix		../common/lib/libx86emu
+
+file	x86emu.c	x86emu
+file	x86emu_i8254.c	x86emu
+file	x86emu_util.c	x86emu
+
+prefix
 
 makeoptions	x86emu	CPPFLAGS+="-I$S/../common/include"



CVS commit: src/sys/arch/luna68k/stand/boot

2015-09-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Sep  1 13:46:50 UTC 2015

Modified Files:
src/sys/arch/luna68k/stand/boot: devopen.c

Log Message:
Fix indent.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/luna68k/stand/boot/devopen.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/luna68k/stand/boot/devopen.c
diff -u src/sys/arch/luna68k/stand/boot/devopen.c:1.9 src/sys/arch/luna68k/stand/boot/devopen.c:1.10
--- src/sys/arch/luna68k/stand/boot/devopen.c:1.9	Sat Feb 14 05:58:02 2015
+++ src/sys/arch/luna68k/stand/boot/devopen.c	Tue Sep  1 13:46:50 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.9 2015/02/14 05:58:02 tsutsui Exp $	*/
+/*	$NetBSD: devopen.c,v 1.10 2015/09/01 13:46:50 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -136,7 +136,7 @@ make_device(const char *str, int *devp, 
 	 */
 	/* find end of dev type name */
 	for (cp = str, i = 0; *cp != '\0' && *cp != '(' && i < MAXDEVNAME; i++)
-			devname[i] = *cp++;
+		devname[i] = *cp++;
 	if (*cp != '(') {
 		return -1;
 	}



CVS commit: src/usr.bin/config

2015-09-01 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Sep  1 13:42:48 UTC 2015

Modified Files:
src/usr.bin/config: config.5 defs.h files.c gram.y scan.l util.c

Log Message:
Introduce a new syntax, "buildprefix", to specify prefix of files under kernel
build subdirectory.  This is not used now that everything is built at the
top of kernel build directory.  It will become mandatory for source/object
files put out of kernel source tree to specify corresponding build subdirectory.
Only ``no dots''  relative path is accepted as "buildprefix".


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/config/config.5
cvs rdiff -u -r1.80 -r1.81 src/usr.bin/config/defs.h
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/config/files.c
cvs rdiff -u -r1.51 -r1.52 src/usr.bin/config/gram.y
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/config/scan.l
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/config/util.c

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

Modified files:

Index: src/usr.bin/config/config.5
diff -u src/usr.bin/config/config.5:1.33 src/usr.bin/config/config.5:1.34
--- src/usr.bin/config/config.5:1.33	Tue Sep  1 01:50:14 2015
+++ src/usr.bin/config/config.5	Tue Sep  1 13:42:48 2015
@@ -1,4 +1,4 @@
-.\" $NetBSD: config.5,v 1.33 2015/09/01 01:50:14 pgoyette Exp $
+.\" $NetBSD: config.5,v 1.34 2015/09/01 13:42:48 uebayasi Exp $
 .\"
 .\"  Copyright (c) 2006, 2007 The NetBSD Foundation.
 .\"  All rights reserved.
@@ -24,7 +24,7 @@
 .\"  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\"  POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 31, 2015
+.Dd September 1, 2015
 .Dt CONFIG 5
 .Os
 .Sh NAME
@@ -254,6 +254,7 @@ The argument obeys the same rules as for
 If
 .Ar path
 is given, it pushes a new prefix for
+.Ic file ,
 .Ic include
 and
 .Ic cinclude .
@@ -265,6 +266,21 @@ The
 .Ar path
 argument is either absolute or relative to the current defined prefix, which
 defaults to the top of the kernel source tree.
+.It Ic buildprefix Op Ar path
+If
+.Ar path
+is given, it pushes a new build prefix for
+.Ic file .
+.Ic buildprefix
+statements act like a stack, and an empty
+.Ar path
+argument has the latest prefix popped out.
+The
+.Ar path
+argument is relative to the current defined buildprefix, which
+defaults to the top of the kernel build directory.
+When prefix is either absolute or relative out of the kernel source tree (../),
+buildprefix must be defined.
 .It Ic ifdef Ar attribute
 .It Ic ifndef Ar attribute
 .It Ic elifdef Ar attribute

Index: src/usr.bin/config/defs.h
diff -u src/usr.bin/config/defs.h:1.80 src/usr.bin/config/defs.h:1.81
--- src/usr.bin/config/defs.h:1.80	Tue Sep  1 12:46:20 2015
+++ src/usr.bin/config/defs.h	Tue Sep  1 13:42:48 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.80 2015/09/01 12:46:20 uebayasi Exp $	*/
+/*	$NetBSD: defs.h,v 1.81 2015/09/01 13:42:48 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -346,6 +346,7 @@ struct files {
 	const char *fi_dir;	/* path to file */
 	const char *fi_path;	/* full file path */
 	const char *fi_prefix;	/* any file prefix */
+	const char *fi_buildprefix;	/* prefix in builddir */
 	int fi_suffix;		/* single char suffix */
 	size_t fi_len;		/* path string length */
 	struct condexpr *fi_optx; /* options expression */
@@ -391,6 +392,10 @@ struct condexpr {
  * File/object prefixes.  These are arranged in a stack, and affect
  * the behavior of the source path.
  */
+
+struct prefix;
+SLIST_HEAD(prefixlist, prefix);
+
 struct prefix {
 	SLIST_ENTRY(prefix)	pf_next;	/* next prefix in stack */
 	const char		*pf_prefix;	/* the actual prefix */
@@ -482,8 +487,10 @@ struct filelist		allcfiles;	/* list of a
 struct filelist		allsfiles;	/* list of all .S files */
 struct filelist		allofiles;	/* list of all .o files */
 
-SLIST_HEAD(, prefix)	prefixes,	/* prefix stack */
+struct prefixlist	prefixes,	/* prefix stack */
 			allprefixes;	/* all prefixes used (after popped) */
+struct prefixlist	buildprefixes,	/* build prefix stack */
+			allbuildprefixes;/* all build prefixes used (after popped) */
 SLIST_HEAD(, prefix)	curdirs;	/* curdir stack */
 
 extern struct attr allattr;
@@ -614,6 +621,8 @@ int	onlist(struct nvlist *, void *);
 /* util.c */
 void	prefix_push(const char *);
 void	prefix_pop(void);
+void	buildprefix_push(const char *);
+void	buildprefix_pop(void);
 char	*sourcepath(const char *);
 extern	int dflag;
 #define	CFGDBG(n, ...) \

Index: src/usr.bin/config/files.c
diff -u src/usr.bin/config/files.c:1.24 src/usr.bin/config/files.c:1.25
--- src/usr.bin/config/files.c:1.24	Tue Sep  1 12:46:20 2015
+++ src/usr.bin/config/files.c	Tue Sep  1 13:42:48 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: files.c,v 1.24 2015/09/01 12:46:20 uebayasi Exp $	*/
+/*	$NetBSD: files.c,v 1.25 2015/09/01 13:42:48 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: files.c,v 1.24 2015/09/01 12:46:20 uebayasi Exp 

CVS commit: src/sys/arch/luna68k/stand/boot

2015-09-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Sep  1 13:55:26 UTC 2015

Modified Files:
src/sys/arch/luna68k/stand/boot: devopen.c

Log Message:
Use the default boot device if a kernel name without device is specificed.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/luna68k/stand/boot/devopen.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/luna68k/stand/boot/devopen.c
diff -u src/sys/arch/luna68k/stand/boot/devopen.c:1.10 src/sys/arch/luna68k/stand/boot/devopen.c:1.11
--- src/sys/arch/luna68k/stand/boot/devopen.c:1.10	Tue Sep  1 13:46:50 2015
+++ src/sys/arch/luna68k/stand/boot/devopen.c	Tue Sep  1 13:55:25 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.10 2015/09/01 13:46:50 tsutsui Exp $	*/
+/*	$NetBSD: devopen.c,v 1.11 2015/09/01 13:55:25 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -138,58 +138,71 @@ make_device(const char *str, int *devp, 
 	for (cp = str, i = 0; *cp != '\0' && *cp != '(' && i < MAXDEVNAME; i++)
 		devname[i] = *cp++;
 	if (*cp != '(') {
-		return -1;
-	}
-	devname[i] = '\0';
-	/* compare dev type name */
-	for (dp = devsw; dp->dv_name; dp++)
-		if (!strcmp(devname, dp->dv_name))
-			break;
-	cp++;
-	if (dp->dv_name == NULL) {
-		return -1;
-	}
-	dev = dp - devsw;
-	/* get mixed controller and unit number */
-	haveunit = false;
-	for (; *cp != ',' && *cp != ')'; cp++) {
-		if (*cp == '\0')
+		/* no device name is specified; assume default */
+		cp = str;
+		/* compare dev type name */
+		for (dp = devsw; dp->dv_name; dp++)
+			if (!strcmp(default_bootdev, dp->dv_name))
+break;
+		if (dp->dv_name == NULL) {
 			return -1;
-		if (*cp >= '0' && *cp <= '9') {
-			unit = unit * 10 + *cp - '0';
-			haveunit = true;
 		}
-	}
-	if (unit < 0 || CTLR(unit) >= 2 || TARGET(unit) > 7) {
-#ifdef DEBUG
-		printf("%s: invalid unit number (%d)\n", __func__, unit);
-#endif
-		return -1;
-	}
-	if (!haveunit && strcmp(devname, default_bootdev) == 0)
+		dev = dp - devsw;
 		unit = default_unit;
-	/* get optional partition number */
-	if (*cp == ',')
+	} else {
+		devname[i] = '\0';
+		/* compare dev type name */
+		for (dp = devsw; dp->dv_name; dp++)
+			if (!strcmp(devname, dp->dv_name))
+break;
 		cp++;
-
-	for (; /* *cp != ',' && */ *cp != ')'; cp++) {
-		if (*cp == '\0')
+		if (dp->dv_name == NULL) {
 			return -1;
-		if (*cp >= '0' && *cp <= '9')
-			part = part * 10 + *cp - '0';
-	}
-	if (part < 0 || part >= MAXPARTITIONS) {
+		}
+		dev = dp - devsw;
+		/* get mixed controller and unit number */
+		haveunit = false;
+		for (; *cp != ',' && *cp != ')'; cp++) {
+			if (*cp == '\0')
+return -1;
+			if (*cp >= '0' && *cp <= '9') {
+unit = unit * 10 + *cp - '0';
+haveunit = true;
+			}
+		}
+		if (unit < 0 || CTLR(unit) >= 2 || TARGET(unit) > 7) {
+#ifdef DEBUG
+			printf("%s: invalid unit number (%d)\n",
+			__func__, unit);
+#endif
+			return -1;
+		}
+		if (!haveunit && strcmp(devname, default_bootdev) == 0)
+			unit = default_unit;
+		/* get optional partition number */
+		if (*cp == ',')
+			cp++;
+
+		for (; /* *cp != ',' && */ *cp != ')'; cp++) {
+			if (*cp == '\0')
+return -1;
+			if (*cp >= '0' && *cp <= '9')
+part = part * 10 + *cp - '0';
+		}
+		if (part < 0 || part >= MAXPARTITIONS) {
 #ifdef DEBUG
-		printf("%s: invalid partition number (%d)\n", __func__, part);
+			printf("%s: invalid partition number (%d)\n",
+			__func__, part);
 #endif
-		return -1;
+			return -1;
+		}
+		cp++;
 	}
 	/* check out end of dev spec */
 	*devp  = dev;
 	*unitp = unit;
 	*partp = part;
 	if (fname != NULL) {
-		cp++;
 		if (*cp == '\0')
 			*fname = "netbsd";
 		else



CVS commit: src/usr.bin/config

2015-09-01 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Sep  1 16:01:23 UTC 2015

Modified Files:
src/usr.bin/config: config.1 defs.h files.c main.c mkmakefile.c

Log Message:
Experimental ``suffix rules + subdirectories'' build support (-S).


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/config/config.1
cvs rdiff -u -r1.82 -r1.83 src/usr.bin/config/defs.h
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/config/files.c
cvs rdiff -u -r1.83 -r1.84 src/usr.bin/config/main.c
cvs rdiff -u -r1.54 -r1.55 src/usr.bin/config/mkmakefile.c

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

Modified files:

Index: src/usr.bin/config/config.1
diff -u src/usr.bin/config/config.1:1.18 src/usr.bin/config/config.1:1.19
--- src/usr.bin/config/config.1:1.18	Thu Jul 16 08:42:53 2015
+++ src/usr.bin/config/config.1	Tue Sep  1 16:01:23 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: config.1,v 1.18 2015/07/16 08:42:53 dholland Exp $
+.\"	$NetBSD: config.1,v 1.19 2015/09/01 16:01:23 uebayasi Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" from: @(#)config.8	8.2 (Berkeley) 4/19/94
 .\"
-.Dd July 16, 2015
+.Dd September 1, 2015
 .Dt CONFIG 1
 .Os
 .Sh NAME
@@ -37,7 +37,7 @@
 .Nd build kernel compilation directories
 .Sh SYNOPSIS
 .Nm
-.Op Fl dMPpv
+.Op Fl dMPpSv
 .Op Fl b Ar builddir
 .Op Fl D Ar var=value
 .Op Fl s Ar srcdir
@@ -151,6 +151,8 @@ is used to prepare a kernel build direct
 when it is used in combination with the
 .Fl L
 flag.
+.It Fl S
+Use suffix rules and build objects under subdirectories (experimental).
 .It Fl U Ar var
 Undefine the makeoption
 .Ar var .

Index: src/usr.bin/config/defs.h
diff -u src/usr.bin/config/defs.h:1.82 src/usr.bin/config/defs.h:1.83
--- src/usr.bin/config/defs.h:1.82	Tue Sep  1 13:45:52 2015
+++ src/usr.bin/config/defs.h	Tue Sep  1 16:01:23 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.82 2015/09/01 13:45:52 uebayasi Exp $	*/
+/*	$NetBSD: defs.h,v 1.83 2015/09/01 16:01:23 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -107,7 +107,7 @@ extern const char *progname;
  * The next two lines define the current version of the config(1) binary,
  * and the minimum version of the configuration files it supports.
  */
-#define CONFIG_VERSION		20150835
+#define CONFIG_VERSION		20150840
 #define CONFIG_MINVERSION	0
 
 /*
@@ -556,6 +556,7 @@ void	emit_params(void);
 
 /* main.c */
 extern	int Mflag;
+extern	int Sflag;
 void	addoption(const char *, const char *);
 void	addfsoption(const char *);
 void	addmkoption(const char *, const char *);

Index: src/usr.bin/config/files.c
diff -u src/usr.bin/config/files.c:1.25 src/usr.bin/config/files.c:1.26
--- src/usr.bin/config/files.c:1.25	Tue Sep  1 13:42:48 2015
+++ src/usr.bin/config/files.c	Tue Sep  1 16:01:23 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: files.c,v 1.25 2015/09/01 13:42:48 uebayasi Exp $	*/
+/*	$NetBSD: files.c,v 1.26 2015/09/01 16:01:23 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: files.c,v 1.25 2015/09/01 13:42:48 uebayasi Exp $");
+__RCSID("$NetBSD: files.c,v 1.26 2015/09/01 16:01:23 uebayasi Exp $");
 
 #include 
 #include 
@@ -274,6 +274,19 @@ fixfiles(void)
 	struct nvlist *flathead, **flatp;
 	int err, sel;
 
+	if (Sflag) {
+ 		struct config *cf;
+ 		char swapname[100];
+
+		addfile("devsw.c", NULL, 0, NULL);
+		addfile("ioconf.c", NULL, 0, NULL);
+ 		TAILQ_FOREACH(cf, , cf_next) {
+ 			(void)snprintf(swapname, sizeof(swapname), "swap%s.c",
+ 			cf->cf_name);
+ 			addfile(intern(swapname), NULL, 0, NULL);
+ 		}
+	}
+
 	err = 0;
 	TAILQ_FOREACH(fi, , fi_next) {
 

Index: src/usr.bin/config/main.c
diff -u src/usr.bin/config/main.c:1.83 src/usr.bin/config/main.c:1.84
--- src/usr.bin/config/main.c:1.83	Tue Sep  1 14:32:20 2015
+++ src/usr.bin/config/main.c	Tue Sep  1 16:01:23 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.83 2015/09/01 14:32:20 uebayasi Exp $	*/
+/*	$NetBSD: main.c,v 1.84 2015/09/01 16:01:23 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: main.c,v 1.83 2015/09/01 14:32:20 uebayasi Exp $");
+__RCSID("$NetBSD: main.c,v 1.84 2015/09/01 16:01:23 uebayasi Exp $");
 
 #ifndef MAKE_BOOTSTRAP
 #include 
@@ -90,6 +90,7 @@ int	vflag;/* verbose output */
 int	Pflag;/* pack locators */
 int	Lflag;/* lint config generation */
 int	Mflag;/* modular build */
+int	Sflag;/* suffix rules & subdirectory */
 int	handling_cmdlineopts;		/* currently processing -D/-U options */
 
 int	yyparse(void);
@@ -168,7 +169,7 @@ main(int argc, char **argv)
 
 	pflag = 0;
 	xflag = 0;
-	while ((ch = getopt(argc, argv, "D:LMPU:dgpvb:s:x")) != -1) {
+	while ((ch = getopt(argc, argv, "D:LMPSU:dgpvb:s:x")) != -1) {
 		switch (ch) {
 
 		case 'd':
@@ -227,6 +228,10 @@ main(int argc, char **argv)
 			srcdir = optarg;
 			break;
 

CVS commit: src/sys/conf

2015-09-01 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Tue Sep  1 16:04:04 UTC 2015

Modified Files:
src/sys/conf: Makefile.kern.inc

Log Message:
Experimental suffix-rules build (disabled by default).


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/sys/conf/Makefile.kern.inc

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

Modified files:

Index: src/sys/conf/Makefile.kern.inc
diff -u src/sys/conf/Makefile.kern.inc:1.216 src/sys/conf/Makefile.kern.inc:1.217
--- src/sys/conf/Makefile.kern.inc:1.216	Sun Aug 30 21:16:10 2015
+++ src/sys/conf/Makefile.kern.inc	Tue Sep  1 16:04:04 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.kern.inc,v 1.216 2015/08/30 21:16:10 uebayasi Exp $
+#	$NetBSD: Makefile.kern.inc,v 1.217 2015/09/01 16:04:04 uebayasi Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -216,7 +216,11 @@ SYSLIBCOMPATLN?=	${COMPATLIBLN}
 ## MD_CFILES, MD_SFILES, and MD_OBJS, along with build rules for same.
 ##
 
-MI_CFILES=devsw.c ioconf.c param.c
+MI_CFILES=	param.c
+.if !defined(___USE_SUFFIX_RULES___)
+MI_CFILES+=	devsw.c ioconf.c
+.endif
+
 # the need for a MI_SFILES variable is dubitable at best
 MI_OBJS=${MI_CFILES:S/.c/.o/}
 
@@ -504,7 +508,11 @@ CWARNFLAGS+=	${CWARNFLAGS.${.IMPSRC:T}}
 .if !defined(COPY_SYMTAB)
 build_kernel: .USE
 	${SYSTEM_LD_HEAD}
+.if !defined(___USE_SUFFIX_RULES___)
 	${SYSTEM_LD} ${.TARGET} swap${.TARGET}.o
+.else
+	${SYSTEM_LD} ${.TARGET}
+.endif
 	${SYSTEM_LD_TAIL_STAGE2}
 .else
 .for k in ${KERNELS}
@@ -514,13 +522,21 @@ build_kernel: .USE
 	${CC} ${CFLAGS} ${CPPFLAGS} -DCOPY_SYMTAB \
 	-c $S/kern/kern_ksyms_buf.c -o kern_ksyms_buf.o
 	${SYSTEM_LD_HEAD}
+.if !defined(___USE_SUFFIX_RULES___)
 	${SYSTEM_LD} ${.TARGET} swap${.TARGET}.o kern_ksyms_buf.o
+.else
+	${SYSTEM_LD} ${.TARGET} kern_ksyms_buf.o
+.endif
 	${SYSTEM_LD_TAIL_STAGE1}
 	${CC} ${CFLAGS} ${CPPFLAGS} -DCOPY_SYMTAB \
 	-DSYMTAB_SPACE=$$(${DBSYM} -P ${.TARGET}${TARGETSFX}) \
 	-c $S/kern/kern_ksyms_buf.c -o kern_ksyms_buf_real.o
 	${SYSTEM_LD_HEAD}
+.if !defined(___USE_SUFFIX_RULES___)
 	${SYSTEM_LD} ${.TARGET} swap${.TARGET}.o kern_ksyms_buf_real.o
+.else
+	${SYSTEM_LD} ${.TARGET} kern_ksyms_buf_real.o
+.endif
 	${SYSTEM_LD_TAIL_STAGE2}
 .endif