CVS commit: src/lib/libterminfo

2013-06-07 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Jun  7 13:16:18 UTC 2013

Modified Files:
src/lib/libterminfo: compile.c curterm.c setupterm.c term.c term.h ti.c
tparm.c tputs.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libterminfo/compile.c \
src/lib/libterminfo/curterm.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libterminfo/setupterm.c
cvs rdiff -u -r1.16 -r1.17 src/lib/libterminfo/term.c
cvs rdiff -u -r1.15 -r1.16 src/lib/libterminfo/term.h
cvs rdiff -u -r1.2 -r1.3 src/lib/libterminfo/ti.c src/lib/libterminfo/tputs.c
cvs rdiff -u -r1.14 -r1.15 src/lib/libterminfo/tparm.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/libterminfo/compile.c
diff -u src/lib/libterminfo/compile.c:1.8 src/lib/libterminfo/compile.c:1.9
--- src/lib/libterminfo/compile.c:1.8	Sun Jun  3 23:19:10 2012
+++ src/lib/libterminfo/compile.c	Fri Jun  7 13:16:18 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: compile.c,v 1.8 2012/06/03 23:19:10 joerg Exp $ */
+/* $NetBSD: compile.c,v 1.9 2013/06/07 13:16:18 roy Exp $ */
 
 /*
  * Copyright (c) 2009, 2010, 2011 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: compile.c,v 1.8 2012/06/03 23:19:10 joerg Exp $");
+__RCSID("$NetBSD: compile.c,v 1.9 2013/06/07 13:16:18 roy Exp $");
 
 #if !HAVE_NBTOOL_CONFIG_H || HAVE_SYS_ENDIAN_H
 #include 
@@ -115,7 +115,7 @@ _ti_find_cap(TBUF *tbuf, char type, shor
 			break;
 		}
 	}
-	
+
 	errno = ESRCH;
 	return NULL;
 }
@@ -151,7 +151,7 @@ _ti_find_extra(TBUF *tbuf, const char *c
 			break;
 		}
 	}
-	
+
 	errno = ESRCH;
 	return NULL;
 }
@@ -174,19 +174,19 @@ _ti_store_extra(TIC *tic, int wrn, char 
 			return 0;
 		}
 	}
-	
+
 	l = strlen(id) + 1;
 	if (l > UINT16_T_MAX) {
 		dowarn(flags, "%s: %s: cap name is too long", tic->name, id);
 		return 0;
 	}
-	
+
 	if (!_ti_grow_tbuf(&tic->extras,
 		l + strl + (sizeof(uint16_t) * 2) + 1))
 		return 0;
 	le16enc(tic->extras.buf + tic->extras.bufpos, l);
 	tic->extras.bufpos += sizeof(uint16_t);
- 	memcpy(tic->extras.buf + tic->extras.bufpos, id, l);
+	memcpy(tic->extras.buf + tic->extras.bufpos, id, l);
 	tic->extras.bufpos += l;
 	tic->extras.buf[tic->extras.bufpos++] = type;
 	switch (type) {
@@ -237,14 +237,14 @@ _ti_flatten(uint8_t **buf, const TIC *ti
 	*buf = malloc(buflen);
 	if (*buf == NULL)
 		return -1;
-	
+
 	cap = *buf;
 	*cap++ = 1;
 	le16enc(cap, len);
 	cap += sizeof(uint16_t);
 	memcpy(cap, tic->name, len);
 	cap += len;
-	
+
 	le16enc(cap, alen);
 	cap += sizeof(uint16_t);
 	if (tic->alias != NULL) {
@@ -269,7 +269,7 @@ _ti_flatten(uint8_t **buf, const TIC *ti
 		memcpy(cap, tic->flags.buf, tic->flags.bufpos);
 		cap += tic->flags.bufpos;
 	}
-	
+
 	if (tic->nums.entries == 0) {
 		le16enc(cap, 0);
 		cap += sizeof(uint16_t);
@@ -281,7 +281,7 @@ _ti_flatten(uint8_t **buf, const TIC *ti
 		memcpy(cap, tic->nums.buf, tic->nums.bufpos);
 		cap += tic->nums.bufpos;
 	}
-	
+
 	if (tic->strs.entries == 0) {
 		le16enc(cap, 0);
 		cap += sizeof(uint16_t);
@@ -293,7 +293,7 @@ _ti_flatten(uint8_t **buf, const TIC *ti
 		memcpy(cap, tic->strs.buf, tic->strs.bufpos);
 		cap += tic->strs.bufpos;
 	}
-	
+
 	if (tic->extras.entries == 0) {
 		le16enc(cap, 0);
 		cap += sizeof(uint16_t);
@@ -315,7 +315,7 @@ encode_string(const char *term, const ch
 {
 	int slash, i, num;
 	char ch, *p, *s, last;
-	
+
 	if (_ti_grow_tbuf(tbuf, strlen(str) + 1) == NULL)
 		return -1;
 	p = s = tbuf->buf + tbuf->bufpos;
@@ -392,7 +392,6 @@ encode_string(const char *term, const ch
 			*p++ = '\t';
 			break;
 		default:
-	
 			/* We should warn here */
 		case '^':
 		case ',':
@@ -454,7 +453,7 @@ _ti_compile(char *cap, int flags)
 	TBUF buf;
 	TIC *tic;
 
-	_DIAGASSERT(cap != NULL);	
+	_DIAGASSERT(cap != NULL);
 
 	name = _ti_get_token(&cap, ',');
 	if (name == NULL) {
Index: src/lib/libterminfo/curterm.c
diff -u src/lib/libterminfo/curterm.c:1.8 src/lib/libterminfo/curterm.c:1.9
--- src/lib/libterminfo/curterm.c:1.8	Wed Oct  5 10:46:08 2011
+++ src/lib/libterminfo/curterm.c	Fri Jun  7 13:16:18 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: curterm.c,v 1.8 2011/10/05 10:46:08 roy Exp $ */
+/* $NetBSD: curterm.c,v 1.9 2013/06/07 13:16:18 roy Exp $ */
 
 /*
  * Copyright (c) 2009, 2011 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: curterm.c,v 1.8 2011/10/05 10:46:08 roy Exp $");
+__RCSID("$NetBSD: curterm.c,v 1.9 2013/06/07 13:16:18 roy Exp $");
 
 #include 
 #include 
@@ -64,7 +64,7 @@ _ti_setospeed(TERMINAL *term)
 	size_t i;
 
 	_DIAGASSERT(term != NULL);
-	
+
 	term->_ospeed = 0;
 	if (tcgetattr(term->fildes, &termios) == 0) {
 		os = cfgetospeed(&termios);

Index: src/lib/libterminfo/setupterm.c
diff -u src/lib/libterminfo/setupterm.c:1.3 src/lib/libterminfo/setupterm.c:1.4
--- src/lib/libterminfo/setupterm.c:1.3	Mon Oct  3 19:18:55 2011
+++ src/lib/libterminfo/setupterm.c	Fri Jun  7 13:16:18

CVS commit: src/etc/ssh

2013-06-07 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Fri Jun  7 16:44:17 UTC 2013

Modified Files:
src/etc/ssh: ssh_known_hosts

Log Message:
fix narn-names -> mollari
add ecdsa keys (in many cases, pre-emptive strikes)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/etc/ssh/ssh_known_hosts

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

Modified files:

Index: src/etc/ssh/ssh_known_hosts
diff -u src/etc/ssh/ssh_known_hosts:1.7 src/etc/ssh/ssh_known_hosts:1.8
--- src/etc/ssh/ssh_known_hosts:1.7	Sun May  8 13:19:08 2011
+++ src/etc/ssh/ssh_known_hosts	Fri Jun  7 16:44:17 2013
@@ -1,27 +1,51 @@
-#	$NetBSD: ssh_known_hosts,v 1.7 2011/05/08 13:19:08 spz Exp $
+#	$NetBSD: ssh_known_hosts,v 1.8 2013/06/07 16:44:17 spz Exp $
 #
 anoncvs.netbsd.org ssh-rsa B3NzaC1yc2EBIwAAAIEA3QiBl8leG9fqIJpKeNov0PKq5YryFFiroMWOPUv4hDFn8R0jC07YVaR/OSBrr37CTmGX5AFceXPzoFnLlwCqWR7rXg4NR75FTlTp9CG9EBAEtU8mee27KDrUFBTZdfVl2+aRYoAI5fTXA+0vpIO68Cq843vRWUZCcwinS4cNLUU=
 
+anoncvs.netbsd.org ecdsa-sha2-nistp521 E2VjZHNhLXNoYTItbmlzdHA1MjEIbmlzdHA1MjEAAACFBAFhP4E9+oDpCQZ9yVQA7OzDF0tHnL3eykrqEt3hS+rdHXA0Ak5uCaxi2Aj2JRnAKW1JYbjQ5hyKHYZ2o6SfDimqaQBAt18nWm4CCKc20UbSgyWaH/x+O3J68j5n43MY8gHycPKcLHly2FjhDhuhHuoYODfq9GYn3okYsMu2T/i6Tg+SKw==
+#
 cvs.netbsd.org,cvs4.netbsd.org,cvs6.netbsd.org ssh-rsa B3NzaC1yc2EBIwAAAIEA1b7MS3j0v6NzPr/Snh8OJTILvGLD9OA/zdrTfzQdq3doJjkLKJhD4WYj8SonaauEKuqzdJa1KVilj44GCrJBnjwbWg2BdJWLzB5YFmNgvmXwoqrl9kRyzMVk47UOxeREIipXldKajkCTc/nwa1mGrsCwVlC+TwAhWIyjyza6MOk=
 
+cvs.netbsd.org,cvs4.netbsd.org,cvs6.netbsd.org ecdsa-sha2-nistp521 E2VjZHNhLXNoYTItbmlzdHA1MjEIbmlzdHA1MjEAAACFBAGFloNiNSqIkMFVBUglnE9AgBI6J5cLh4hej8DZEtn4InWbFD3dxIFLvw8ZA3qLpVX/TCjFt++MEO3w5GJ2L7a2zQHGIn50E5KVcHuh9arVYRhLPqs9Vfl6ANJ6WiQ81f5k/dZ6ESI8BwqOyQY22/zTujyL8FGHvlZukNsB4iie7Wl+/Q==
+#
 ftp.netbsd.org,ftp4.netbsd.org,ftp6.netbsd.org ssh-rsa B3NzaC1yc2EBIwAAAIEAv+tO1aHHsW1McwHgnJ28qsXn8gH8z/61yopJzmOKuHH07zBYOnhenAcni6E0+BRavSXXIuuTDdyxEyWcTqXoR0LEVShTzAFmZS3RyzTVl7A+Fp644lNnRaJh1380H+20uZjcKSPU0IudG5J7QllMbJY9RnIBFjGLzTb4vrC8GIc=
 
-mail.netbsd.org,homeworld.netbsd.org ssh-rsa B3NzaC1yc2EBIwAAAIEAt8UJLhW8iou8Ack7V5XrzfCgzOkdK75+xDZePMBPg+CYDLnHbP1+KQaSrvfnvDzCvgOUXHOkGji1jbrtzDYwv7Itw0hRUo7TxR99c3bTomb9U0vWV5k4FDIyz4xJXWBJMVkKseAWAXgnc5FSdB6V/e21TAISJBl9dolhqOGVsxM=
+morden.netbsd.org ssh-rsa B3NzaC1yc2EBIwAAAIEAv+tO1aHHsW1McwHgnJ28qsXn8gH8z/61yopJzmOKuHH07zBYOnhenAcni6E0+BRavSXXIuuTDdyxEyWcTqXoR0LEVShTzAFmZS3RyzTVl7A+Fp644lNnRaJh1380H+20uZjcKSPU0IudG5J7QllMbJY9RnIBFjGLzTb4vrC8GIc=
 
-www.netbsd.org,www4.netbsd.org,gnats.netbsd.org ssh-rsa B3NzaC1yc2EBIwAAAIEAyBrlCbbZ2lQxWt7c9Ru0byoOktalLWKJ4t0kzWp6C2oVa+Ll1c1TO2FJb34DCZqULfSHaMmKgq647d75npk9GeXXLk8QwcX6kNl7QFnHo7GUHnHtiZAjTMbYmYOaNLi1PjwyQH+9yeRQYsGW7xejTsyK0yuRKROdCl/QU9gkB3s=
+ftp.netbsd.org,ftp4.netbsd.org,ftp6.netbsd.org ecdsa-sha2-nistp521 E2VjZHNhLXNoYTItbmlzdHA1MjEIbmlzdHA1MjEAAACFBAFp8B5B8/cosThWLYgZp0jQGIqduvJUlra4gyCCqKLnaTn44cPltjjDWp1UHRsdVjm8ka81EYSJ95ZgD8lbPE/XZwBBmisSzTVoQT+b2x7ENPz2BOAgjxX5Lljy6Z2vpky8Gtu2nNJlFtekPbAS4wyDxHuwR5SZMEYNPTWegtBcvm460A==
 
+morden.netbsd.org ecdsa-sha2-nistp521 E2VjZHNhLXNoYTItbmlzdHA1MjEIbmlzdHA1MjEAAACFBAFp8B5B8/cosThWLYgZp0jQGIqduvJUlra4gyCCqKLnaTn44cPltjjDWp1UHRsdVjm8ka81EYSJ95ZgD8lbPE/XZwBBmisSzTVoQT+b2x7ENPz2BOAgjxX5Lljy6Z2vpky8Gtu2nNJlFtekPbAS4wyDxHuwR5SZMEYNPTWegtBcvm460A==
+#
+mail.netbsd.org,homeworld.netbsd.org ssh-rsa B3NzaC1yc2EBIwAAAIEAt8UJLhW8iou8Ack7V5XrzfCgzOkdK75+xDZePMBPg+CYDLnHbP1+KQaSrvfnvDzCvgOUXHOkGji1jbrtzDYwv7Itw0hRUo7TxR99c3bTomb9U0vWV5k4FDIyz4xJXWBJMVkKseAWAXgnc5FSdB6V/e21TAISJBl9dolhqOGVsxM=
+
+mail.netbsd.org,homeworld.netbsd.org ecdsa-sha2-nistp521 E2VjZHNhLXNoYTItbmlzdHA1MjEIbmlzdHA1MjEAAACFBADOK8FUImVH0iPCzfwBD9gT8AUELweTGWry8eBXFbxCDcOYW+4HRtUuY7OqP/sJ8tlYCNg9F+PjAIDqp72h6YgPcQH2/M/8ZXizAT7y7uCiysYxMKYbmuBHqVybaJd5rWUNL19JE6e3H+KBkwYQbf7Jrrs6RhDYMCguPmi6ppNEEEAAcQ==
+#
 pkgbuild.netbsd.org ssh-rsa B3NzaC1yc2EBIwAAAIEAz2c3dFuPdL75gpvwiYinwQ5jiRlfe3HvbXbMkTvpZxLFBQWTVkcDr/yd+vCiWcqVKVENX2tIvT91gPM9/iw7Wl82rxZ54jjaL0pWPL0yjSVhSFxff9pH+as5hgX4l1HjmXLB6v+MWyYVmOSpB01NfVVV2Z9+BGp3Y7i+U5pCdf0=
 
+pkgbuild.netbsd.org ecdsa-sha2-nistp521 E2VjZHNhLXNoYTItbmlzdHA1MjEIbmlzdHA1MjEAAACFBAE7rzIErnIESapcXZJYCMmlNlS3cbeE9zbvraS0/woWexchdhVxLOi/qkfqM5U0Zkin1ooNsUfEYmaJ1k1T+LHbzAAGwZMo/aESnTEekYgBSwhHUj1EjIWeeN/bet9HJrz9Y4WGd2MOXHL88T+cUzfHLEneYrrVe6FDbAlMpSPw4OAOAQ==
+#
 build.netbsd.org ssh-rsa B3NzaC1yc2EBIwAAAIEAzmmcuzoX0D/qDFdDJDyRgQGkUaNTEu7GdruMg1N+ajqvEoKQHQEEBrMdDbeYqCUYacHyhTRMrP6vZ27iX90rl9iS1lR2iPHp/mbnf+iV/BzdWROPvJWxp9/Am/DrYL+Idah5AYNnkC7fon9n+BeMqPDXYGYl/U+dAzp+8GHPhRc=
 
-blog.netbsd.org,rt.netbsd.org,monitor.netbsd.org,releng.netbsd.org,wiki.netbsd.org ssh-rsa B3NzaC1yc2EBIwAAAIEArWf/facPOPEDY9ZfTpiNHK0HQFv05VtvR/LzgBAXnugAD87VdlkSKTj97UGkEjxIVFDMc2Wfh5THeCNvl38sScY9JGtKaE1VSCdmmVyG2d1Ky4XjARS3l4/ZYiBbZRNGm34

CVS commit: src/usr.sbin/pppd/pppd

2013-06-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun  7 17:17:15 UTC 2013

Modified Files:
src/usr.sbin/pppd/pppd: sys-bsd.c

Log Message:
- skip addresses that don't have a link address by finding the link address
  immediately.
- don't skip v6 only interfaces.
- default to the first interface with a link address or to the best matching
  one, printing a warning if there are more than one.
- consume data after sending messages to the routing socket.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/usr.sbin/pppd/pppd/sys-bsd.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.sbin/pppd/pppd/sys-bsd.c
diff -u src/usr.sbin/pppd/pppd/sys-bsd.c:1.65 src/usr.sbin/pppd/pppd/sys-bsd.c:1.66
--- src/usr.sbin/pppd/pppd/sys-bsd.c:1.65	Sat Sep 24 16:19:39 2011
+++ src/usr.sbin/pppd/pppd/sys-bsd.c	Fri Jun  7 13:17:14 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys-bsd.c,v 1.65 2011/09/24 20:19:39 christos Exp $	*/
+/*	$NetBSD: sys-bsd.c,v 1.66 2013/06/07 17:17:14 christos Exp $	*/
 
 /*
  * sys-bsd.c - System-dependent procedures for setting up
@@ -79,7 +79,7 @@
 #if 0
 #define RCSID	"Id: sys-bsd.c,v 1.47 2000/04/13 12:04:23 paulus Exp "
 #else
-__RCSID("$NetBSD: sys-bsd.c,v 1.65 2011/09/24 20:19:39 christos Exp $");
+__RCSID("$NetBSD: sys-bsd.c,v 1.66 2013/06/07 17:17:14 christos Exp $");
 #endif
 #endif
 
@@ -1540,6 +1540,27 @@ cifdefaultroute(int u, u_int32_t l, u_in
 return dodefaultroute(g, 'c');
 }
 
+#if RTM_VERSION >= 3
+static struct {
+struct rt_msghdr		hdr;
+char			space[512];
+} arpmsg;
+
+static int arpmsg_valid;
+
+static void
+consume(int routes) {
+ssize_t l;
+pid_t pid = getpid();
+struct rt_msghdr *rtm = &arpmsg.hdr;
+
+do
+	l = read(routes, &arpmsg, sizeof(arpmsg));
+while (l > 0 && (rtm->rtm_seq != rtm_seq || rtm->rtm_pid != pid));
+if (l < 0)
+	warn("read from routing socket");
+}
+
 /*
  * dodefaultroute - talk to a routing socket to add/delete a default route.
  */
@@ -1555,7 +1576,7 @@ dodefaultroute(u_int32_t g, int cmd)
 	struct sockaddr_dl	ifp;
 } rtmsg;
 
-if ((routes = socket(PF_ROUTE, SOCK_RAW, AF_INET)) < 0) {
+if ((routes = socket(PF_ROUTE, SOCK_RAW, 0)) < 0) {
 	if (!doing_cleanup)
 	error("%s: Couldn't %s default route: socket: %m", __func__,
 		cmd == 's' ? "add" : "delete");
@@ -1596,42 +1617,55 @@ dodefaultroute(u_int32_t g, int cmd)
 	close(routes);
 	return 0;
 }
+consume(routes);
 
 close(routes);
 default_route_gateway = (cmd == 's') ? g : 0;
 return 1;
 }
 
-#if RTM_VERSION >= 3
+
+#if 0
+static void
+hdrprint(const struct rt_msghdr *rtm) {
+	printf("rtm_msglen=%u\n", rtm->rtm_msglen);
+	printf("rtm_version=%u\n", rtm->rtm_version);
+	printf("rtm_type=%u\n", rtm->rtm_type);
+	printf("rtm_index=%u\n", rtm->rtm_index);
+	printf("rtm_flags=%x\n", rtm->rtm_flags);
+	printf("rtm_addrs=%d\n", rtm->rtm_addrs);
+	printf("rtm_pid=%lu\n", (unsigned long)rtm->rtm_pid);
+	printf("rtm_seq=%d\n", rtm->rtm_seq);
+	printf("rtm_errno=%d\n", rtm->rtm_errno);
+	printf("rtm_use=%d\n", rtm->rtm_use);
+	printf("rtm_inits=%d\n", rtm->rtm_inits);
+	printf("rtm_rmx.rmx_expire=%lld\n", (long long)rtm->rtm_rmx.rmx_expire);
+}
+#endif
+
 
 /*
  * sifproxyarp - Make a proxy ARP entry for the peer.
  */
-static struct {
-struct rt_msghdr		hdr;
-struct sockaddr_inarp	dst;
-struct sockaddr_dl		hwa;
-char			extra[128];
-} arpmsg;
-
-static int arpmsg_valid;
-
 int
 sifproxyarp(int unit, u_int32_t hisaddr)
 {
 int routes;
+struct sockaddr_inarp dst;
+struct sockaddr_dl sdl;
+char *cp;
 
 /*
  * Get the hardware address of an interface on the same subnet
  * as our local address.
  */
 memset(&arpmsg, 0, sizeof(arpmsg));
-if (!get_ether_addr(hisaddr, &arpmsg.hwa)) {
+if (!get_ether_addr(hisaddr, &sdl)) {
 	error("%s: Cannot determine ethernet address for proxy ARP", __func__);
 	return 0;
 }
 
-if ((routes = socket(PF_ROUTE, SOCK_RAW, AF_INET)) < 0) {
+if ((routes = socket(PF_ROUTE, SOCK_RAW, 0)) < 0) {
 	error("%s: Couldn't add proxy arp entry: socket: %m", __func__);
 	return 0;
 }
@@ -1642,19 +1676,29 @@ sifproxyarp(int unit, u_int32_t hisaddr)
 arpmsg.hdr.rtm_seq = ++rtm_seq;
 arpmsg.hdr.rtm_addrs = RTA_DST | RTA_GATEWAY;
 arpmsg.hdr.rtm_inits = RTV_EXPIRE;
-arpmsg.dst.sin_len = sizeof(struct sockaddr_inarp);
-arpmsg.dst.sin_family = AF_INET;
-arpmsg.dst.sin_addr.s_addr = hisaddr;
-arpmsg.dst.sin_other = SIN_PROXY;
 
-arpmsg.hdr.rtm_msglen = (char *) &arpmsg.hwa - (char *) &arpmsg
-	+ RT_ROUNDUP(arpmsg.hwa.sdl_len);
+memset(&dst, 0, sizeof(dst));
+dst.sin_len = sizeof(struct sockaddr_in);
+dst.sin_family = AF_INET;
+dst.sin_addr.s_addr = hisaddr;
+dst.sin_other = SIN_PROXY;
+
+cp = arpmsg.space;
+#define NEXTADDR(s) \
+(void)memcpy(cp, &s, (size_t)((struct sockaddr *)(void *)&s)

CVS commit: src/usr.sbin/arp

2013-06-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun  7 17:18:33 UTC 2013

Modified Files:
src/usr.sbin/arp: arp.c

Log Message:
allow ifscope with pub and proxy


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/arp/arp.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.sbin/arp/arp.c
diff -u src/usr.sbin/arp/arp.c:1.50 src/usr.sbin/arp/arp.c:1.51
--- src/usr.sbin/arp/arp.c:1.50	Thu Jun  6 21:09:10 2013
+++ src/usr.sbin/arp/arp.c	Fri Jun  7 13:18:33 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: arp.c,v 1.50 2013/06/07 01:09:10 christos Exp $ */
+/*	$NetBSD: arp.c,v 1.51 2013/06/07 17:18:33 christos Exp $ */
 
 /*
  * Copyright (c) 1984, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1984, 19
 #if 0
 static char sccsid[] = "@(#)arp.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: arp.c,v 1.50 2013/06/07 01:09:10 christos Exp $");
+__RCSID("$NetBSD: arp.c,v 1.51 2013/06/07 17:18:33 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -169,7 +169,7 @@ main(int argc, char **argv)
 		}
 		break;
 	case 's':
-		if (argc < 2 || argc > 5)
+		if (argc < 2 || argc > 7)
 			usage();
 		return (set(argc, argv) ? 1 : 0);
 	case 'f':



CVS commit: src/lib/libutil

2013-06-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun  7 17:23:26 UTC 2013

Modified Files:
src/lib/libutil: sockaddr_snprintf.3 sockaddr_snprintf.c

Log Message:
Add a debugging format that prints all the fields with names.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libutil/sockaddr_snprintf.3
cvs rdiff -u -r1.9 -r1.10 src/lib/libutil/sockaddr_snprintf.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/libutil/sockaddr_snprintf.3
diff -u src/lib/libutil/sockaddr_snprintf.3:1.7 src/lib/libutil/sockaddr_snprintf.3:1.8
--- src/lib/libutil/sockaddr_snprintf.3:1.7	Sat Apr 11 12:13:49 2009
+++ src/lib/libutil/sockaddr_snprintf.3	Fri Jun  7 13:23:26 2013
@@ -1,4 +1,4 @@
-.\" $NetBSD: sockaddr_snprintf.3,v 1.7 2009/04/11 16:13:49 joerg Exp $
+.\" $NetBSD: sockaddr_snprintf.3,v 1.8 2013/06/07 17:23:26 christos Exp $
 .\"
 .\" Copyright (c) 2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 9, 2005
+.Dd June 7, 2013
 .Dt SOCKADDR_SNPRINTF 3
 .Os
 .Sh NAME
@@ -109,6 +109,10 @@ this is the hostname associated with the
 For all other address families, it is the same as the
 .Dq a
 format.
+.It D
+Debugging output:
+For all addresses, print all their fields as
+.Dq field_name=value .
 .It f
 The numeric value of the family of the address is printed.
 .It l

Index: src/lib/libutil/sockaddr_snprintf.c
diff -u src/lib/libutil/sockaddr_snprintf.c:1.9 src/lib/libutil/sockaddr_snprintf.c:1.10
--- src/lib/libutil/sockaddr_snprintf.c:1.9	Mon Apr 28 16:23:03 2008
+++ src/lib/libutil/sockaddr_snprintf.c	Fri Jun  7 13:23:26 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: sockaddr_snprintf.c,v 1.9 2008/04/28 20:23:03 martin Exp $	*/
+/*	$NetBSD: sockaddr_snprintf.c,v 1.10 2013/06/07 17:23:26 christos Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: sockaddr_snprintf.c,v 1.9 2008/04/28 20:23:03 martin Exp $");
+__RCSID("$NetBSD: sockaddr_snprintf.c,v 1.10 2013/06/07 17:23:26 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -44,9 +44,71 @@ __RCSID("$NetBSD: sockaddr_snprintf.c,v 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
+static int
+debug_at(char *str, size_t len, const struct sockaddr_at *sat)
+{
+	return snprintf(str, len, "sat_len=%u, sat_family=%u, sat_port=%u, "
+	"sat_addr.s_net=%u, sat_addr.s_node=%u, "
+	"sat_range.r_netrange.nr_phase=%u, "
+	"sat_range.r_netrange.nr_firstnet=%u, "
+	"sat_range.r_netrange.nr_lastnet=%u",
+	sat->sat_len, sat->sat_family, sat->sat_port,
+	sat->sat_addr.s_net, sat->sat_addr.s_node,
+	sat->sat_range.r_netrange.nr_phase,
+	sat->sat_range.r_netrange.nr_firstnet,
+	sat->sat_range.r_netrange.nr_lastnet);
+}
+
+static int
+debug_in(char *str, size_t len, const struct sockaddr_in *sin)
+{
+	return snprintf(str, len, "sin_len=%u, sin_family=%u, sin_port=%u, "
+	"sin_addr.s_addr=%08x",
+	sin->sin_len, sin->sin_family, sin->sin_port,
+	sin->sin_addr.s_addr);
+}
+
+static int
+debug_in6(char *str, size_t len, const struct sockaddr_in6 *sin6)
+{
+	const uint8_t *s = sin6->sin6_addr.s6_addr;
+
+	return snprintf(str, len, "sin6_len=%u, sin6_family=%u, sin6_port=%u, "
+	"sin6_flowinfo=%u, "
+	"sin6_addr=%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:"
+	"%02x:%02x:%02x:%02x:%02x:%02x, sin6_scope_id=%u",
+	sin6->sin6_len, sin6->sin6_family, sin6->sin6_port,
+	sin6->sin6_flowinfo, s[0x0], s[0x1], s[0x2], s[0x3], s[0x4], s[0x5],
+	s[0x6], s[0x7], s[0x8], s[0x9], s[0xa], s[0xb], s[0xc], s[0xd],
+	s[0xe], s[0xf], sin6->sin6_scope_id);
+}
+
+static int
+debug_un(char *str, size_t len, const struct sockaddr_un *sun)
+{
+	return snprintf(str, len, "sun_len=%u, sun_family=%u, sun_path=%*s",
+	sun->sun_len, sun->sun_family, (int)sizeof(sun->sun_path),
+	sun->sun_path);
+}
+
+static int
+debug_dl(char *str, size_t len, const struct sockaddr_dl *sdl)
+{
+	const uint8_t *s = (const void *)sdl->sdl_data;
+
+	return snprintf(str, len, "sdl_len=%u, sdl_family=%u, sdl_index=%u, "
+	"sdl_type=%u, sdl_nlen=%u, sdl_alen=%u, sdl_slen=%u, sdl_data="
+	"%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
+	sdl->sdl_len, sdl->sdl_family, sdl->sdl_index,
+	sdl->sdl_type, sdl->sdl_nlen, sdl->sdl_alen, sdl->sdl_slen,
+	s[0x0], s[0x1], s[0x2], s[0x3], s[0x4], s[0x5],
+	s[0x6], s[0x7], s[0x8], s[0x9], s[0xa], s[0xb]);
+}
+
 int
 sockaddr_snprintf(char * const sbuf, const size_t len, const char * const fmt,
 const struct sockaddr * const sa)
@@ -207,6 +269,28 @@ sockaddr_snprintf(char * const sbuf, con
 ADDNA();
 			}
 			break;
+		case 'D':
+			switch (sa->sa_fam

CVS commit: src/usr.sbin/arp

2013-06-07 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Fri Jun  7 18:33:53 UTC 2013

Modified Files:
src/usr.sbin/arp: arp.8

Log Message:
"temp", "pub", and "proxy" are keywords, not replaceable
parameters, so do not use ".Ar" markup.  Use either no markup,
or ".Dq" markup, depending on context.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/arp/arp.8

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

Modified files:

Index: src/usr.sbin/arp/arp.8
diff -u src/usr.sbin/arp/arp.8:1.21 src/usr.sbin/arp/arp.8:1.22
--- src/usr.sbin/arp/arp.8:1.21	Mon Apr 25 22:20:29 2011
+++ src/usr.sbin/arp/arp.8	Fri Jun  7 18:33:53 2013
@@ -1,4 +1,4 @@
-.\"	$NetBSD: arp.8,v 1.21 2011/04/25 22:20:29 wiz Exp $
+.\"	$NetBSD: arp.8,v 1.22 2013/06/07 18:33:53 apb Exp $
 .\"
 .\" Copyright (c) 1985, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -49,11 +49,11 @@
 .Nm
 .Op Fl v
 .Fl d Ar hostname
-.Op Ar proxy
+.Op proxy
 .Nm
 .Fl s Ar hostname ether_addr
-.Op Ar temp
-.Op Ar pub Op Ar proxy
+.Op temp
+.Op pub Op proxy
 .Nm
 .Fl f Ar filename
 .Sh DESCRIPTION
@@ -82,7 +82,7 @@ with the
 .Fl d
 flag.
 If the
-.Cm proxy
+.Dq proxy
 keyword is specified, only the published
 .Dq proxy only
 .Tn ARP
@@ -103,8 +103,8 @@ Entries in the file should be of the for
 .Pp
 .Bd -filled -offset indent -compact
 .Ar hostname ether_addr
-.Op Ar temp
-.Op Ar pub
+.Op temp
+.Op pub
 .Ed
 .Pp
 with argument meanings as described below.
@@ -121,10 +121,10 @@ with the Ethernet address
 .Ar ether_addr .
 The Ethernet address is given as six hex bytes separated by colons.
 The entry will be permanent unless the word
-.Ar temp
+.Dq temp
 is given in the command.
 If the word
-.Ar pub
+.Dq pub
 is given, the entry will be "published"; i.e., this system will
 act as an
 .Tn ARP
@@ -133,7 +133,7 @@ responding to requests for
 .Ar hostname
 even though the host address is not its own.
 If the word
-.Ar proxy
+.Dq proxy
 is also given, the published entry will be a
 .Dq proxy only
 entry.



CVS commit: src/external/mit/xorg/lib/freetype/freetype

2013-06-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jun  7 19:28:25 UTC 2013

Modified Files:
src/external/mit/xorg/lib/freetype/freetype: Makefile

Log Message:
Fix a few library substitutions


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/external/mit/xorg/lib/freetype/freetype/Makefile

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

Modified files:

Index: src/external/mit/xorg/lib/freetype/freetype/Makefile
diff -u src/external/mit/xorg/lib/freetype/freetype/Makefile:1.12 src/external/mit/xorg/lib/freetype/freetype/Makefile:1.13
--- src/external/mit/xorg/lib/freetype/freetype/Makefile:1.12	Fri Jun  7 06:15:46 2013
+++ src/external/mit/xorg/lib/freetype/freetype/Makefile	Fri Jun  7 19:28:25 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.12 2013/06/07 06:15:46 mrg Exp $
+#	$NetBSD: Makefile,v 1.13 2013/06/07 19:28:25 martin Exp $
 
 .include 
 
@@ -31,9 +31,9 @@ CONFIG_SUBST=	${TOOL_SED} \
 		-e 's,%includedir%,${X11INCDIR},' \
 		-e 's,%ft_version%,${FT_VERSION},' \
 		-e 's,%build_libtool_libs%,yes,' \
-		-e 's,%FT2_EXTRA_LIBS%,,' \
-		-e 's,%LIBZ%,-lz,' \
-		-e 's,%LIBBZ2%,-lbz2,' \
+		-e 's,@FT2_EXTRA_LIBS@,,' \
+		-e 's,@LIBZ@,-lz,' \
+		-e 's,@LIBBZ2@,-lbz2,' \
 		-e 's,@FT2_EXTRA_LIBS@,,' \
 		-e 's,@LIBZ@,-lz,' \
 		-e 's,@LIBBZ2@,-lbz2,'



CVS commit: src/common/lib/libc/hash/sha2

2013-06-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun  7 22:40:34 UTC 2013

Modified Files:
src/common/lib/libc/hash/sha2: sha2.c

Log Message:
PR/47908: Gary Grebus: SHA256_Transform and SHA512_Transform are called
by openssl with unaligned buffers. All other Transforms can handle unaligned
buffers so make these handle them too.
XXX[1]: any better fixes are welcome
XXX[2]: pullup-5, pullup-6


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/common/lib/libc/hash/sha2/sha2.c

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

Modified files:

Index: src/common/lib/libc/hash/sha2/sha2.c
diff -u src/common/lib/libc/hash/sha2/sha2.c:1.21 src/common/lib/libc/hash/sha2/sha2.c:1.22
--- src/common/lib/libc/hash/sha2/sha2.c:1.21	Sun Jan 24 16:11:18 2010
+++ src/common/lib/libc/hash/sha2/sha2.c	Fri Jun  7 18:40:34 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: sha2.c,v 1.21 2010/01/24 21:11:18 joerg Exp $ */
+/* $NetBSD: sha2.c,v 1.22 2013/06/07 22:40:34 christos Exp $ */
 /*	$KAME: sha2.c,v 1.9 2003/07/20 00:28:38 itojun Exp $	*/
 
 /*
@@ -43,7 +43,7 @@
 #include 
 
 #if defined(_KERNEL) || defined(_STANDALONE)
-__KERNEL_RCSID(0, "$NetBSD: sha2.c,v 1.21 2010/01/24 21:11:18 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sha2.c,v 1.22 2013/06/07 22:40:34 christos Exp $");
 
 #include 	/* XXX: to pull  for vax memset(9) */
 #include 
@@ -51,7 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: sha2.c,v 1.2
 #else
 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: sha2.c,v 1.21 2010/01/24 21:11:18 joerg Exp $");
+__RCSID("$NetBSD: sha2.c,v 1.22 2013/06/07 22:40:34 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -63,13 +63,13 @@ __RCSID("$NetBSD: sha2.c,v 1.21 2010/01/
 #include 
 
 #if HAVE_NBTOOL_CONFIG_H
-#  if HAVE_SYS_ENDIAN_H
-#include 
-#  else
-#   undef htobe32
-#   undef htobe64
-#   undef be32toh
-#   undef be64toh
+# if HAVE_SYS_ENDIAN_H
+#  include 
+# else
+#  undef htobe32
+#  undef htobe64
+#  undef be32toh
+#  undef be64toh
 
 static uint32_t
 htobe32(uint32_t x)
@@ -104,7 +104,15 @@ be64toh(uint64_t x)
 {
 	return htobe64(x);
 }
-#  endif
+# define align(a) (&adata, (a))
+# endif
+#endif
+
+#ifndef align
+# define align(a) \
+(((uintptr_t)(a) & (sizeof(adata) - 1)) ? \
+	(memcpy(&adata, (a), sizeof(adata)), &adata) : \
+	(a))
 #endif
 
 /*** SHA-256/384/512 Various Length Definitions ***/
@@ -326,7 +334,7 @@ SHA256_Init(SHA256_CTX *context)
 /* Unrolled SHA-256 round macros: */
 
 #define ROUND256_0_TO_15(a,b,c,d,e,f,g,h)	\
-	W256[j] = be32toh(*data);		\
+	W256[j] = be32toh(*align(data));		\
 	++data;	\
 	T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \
  K256[j] + W256[j]; \
@@ -351,6 +359,7 @@ SHA256_Transform(SHA256_CTX *context, co
 	uint32_t	a, b, c, d, e, f, g, h, s0, s1;
 	uint32_t	T1, *W256;
 	int		j;
+	uint32_t	adata;
 
 	W256 = (uint32_t *)context->buffer;
 
@@ -411,6 +420,7 @@ SHA256_Transform(SHA256_CTX *context, co
 	uint32_t	a, b, c, d, e, f, g, h, s0, s1;
 	uint32_t	T1, T2, *W256;
 	int		j;
+	uint32_t	adata;
 
 	W256 = (uint32_t *)(void *)context->buffer;
 
@@ -426,7 +436,7 @@ SHA256_Transform(SHA256_CTX *context, co
 
 	j = 0;
 	do {
-		W256[j] = be32toh(*data);
+		W256[j] = be32toh(*align(data));
 		++data;
 		/* Apply the SHA-256 compression function to update a..h */
 		T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + W256[j];
@@ -672,7 +682,7 @@ SHA512_Init(SHA512_CTX *context)
 
 /* Unrolled SHA-512 round macros: */
 #define ROUND512_0_TO_15(a,b,c,d,e,f,g,h)	\
-	W512[j] = be64toh(*data);		\
+	W512[j] = be64toh(*align(data));		\
 	++data;	\
 	T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \
  K512[j] + W512[j]; \
@@ -697,6 +707,7 @@ SHA512_Transform(SHA512_CTX *context, co
 	uint64_t	a, b, c, d, e, f, g, h, s0, s1;
 	uint64_t	T1, *W512 = (uint64_t *)context->buffer;
 	int		j;
+	uint64_t	adata;
 
 	/* Initialize registers with the prev. intermediate value */
 	a = context->state[0];
@@ -754,6 +765,7 @@ SHA512_Transform(SHA512_CTX *context, co
 	uint64_t	a, b, c, d, e, f, g, h, s0, s1;
 	uint64_t	T1, T2, *W512 = (void *)context->buffer;
 	int		j;
+	uint64_t	adata;
 
 	/* Initialize registers with the prev. intermediate value */
 	a = context->state[0];
@@ -767,7 +779,7 @@ SHA512_Transform(SHA512_CTX *context, co
 
 	j = 0;
 	do {
-		W512[j] = be64toh(*data);
+		W512[j] = be64toh(*align(data));
 		++data;
 		/* Apply the SHA-512 compression function to update a..h */
 		T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + W512[j];



CVS commit: src/sys/ufs/ufs

2013-06-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Fri Jun  7 23:37:53 UTC 2013

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

Log Message:
typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 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.21 src/sys/ufs/ufs/dir.h:1.22
--- src/sys/ufs/ufs/dir.h:1.21	Wed Jul 22 04:49:19 2009
+++ src/sys/ufs/ufs/dir.h	Fri Jun  7 23:37:53 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.h,v 1.21 2009/07/22 04:49:19 dholland Exp $	*/
+/*	$NetBSD: dir.h,v 1.22 2013/06/07 23:37:53 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -145,7 +145,7 @@ struct dirtemplate {
 };
 
 /*
- * This is the old format of directories, sanz type element.
+ * This is the old format of directories, sans type element.
  */
 struct odirtemplate {
 	u_int32_t	dot_ino;



CVS commit: src/external/mit/xorg/lib/freetype/freetype

2013-06-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Jun  8 00:37:33 UTC 2013

Modified Files:
src/external/mit/xorg/lib/freetype/freetype: Makefile

Log Message:
revert previous; it was already done in the previous previous.

while here, make freetype-config depend upon Makefile, so it
will be rebuilt for update builds properly.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
src/external/mit/xorg/lib/freetype/freetype/Makefile

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

Modified files:

Index: src/external/mit/xorg/lib/freetype/freetype/Makefile
diff -u src/external/mit/xorg/lib/freetype/freetype/Makefile:1.13 src/external/mit/xorg/lib/freetype/freetype/Makefile:1.14
--- src/external/mit/xorg/lib/freetype/freetype/Makefile:1.13	Fri Jun  7 19:28:25 2013
+++ src/external/mit/xorg/lib/freetype/freetype/Makefile	Sat Jun  8 00:37:33 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.13 2013/06/07 19:28:25 martin Exp $
+#	$NetBSD: Makefile,v 1.14 2013/06/08 00:37:33 mrg Exp $
 
 .include 
 
@@ -31,15 +31,15 @@ CONFIG_SUBST=	${TOOL_SED} \
 		-e 's,%includedir%,${X11INCDIR},' \
 		-e 's,%ft_version%,${FT_VERSION},' \
 		-e 's,%build_libtool_libs%,yes,' \
-		-e 's,@FT2_EXTRA_LIBS@,,' \
-		-e 's,@LIBZ@,-lz,' \
-		-e 's,@LIBBZ2@,-lbz2,' \
+		-e 's,%FT2_EXTRA_LIBS%,,' \
+		-e 's,%LIBZ%,-lz,' \
+		-e 's,%LIBBZ2%,-lbz2,' \
 		-e 's,@FT2_EXTRA_LIBS@,,' \
 		-e 's,@LIBZ@,-lz,' \
 		-e 's,@LIBBZ2@,-lbz2,'
 
 .PATH: ${X11SRCDIR.freetype}/builds/unix
-freetype-config: freetype-config.in
+freetype-config: freetype-config.in Makefile
 	${_MKTARGET_CREATE}
 	${CONFIG_SUBST} < ${.ALLSRC} > ${.TARGET}
 



CVS commit: src/sys/ufs/lfs

2013-06-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Jun  8 02:04:31 UTC 2013

Modified Files:
src/sys/ufs/lfs: Makefile lfs.h ulfs_dir.h ulfs_inode.h
ulfs_quotacommon.h
Added Files:
src/sys/ufs/lfs: lfs_inode.h

Log Message:
Split the definitions suitable for userland out of ulfs_inode.h into
lfs_inode.h. Since fsck_lfs, newfs_lfs, and lfs_cleanerd want to reuse
the inode structure for their own internal use, and some of them share
parts of the kernel code as well, the best way forward is to provide a
relatively sanitized header that doesn't bring in stray material.

Shuffle a few other definitions around so that lfs_inode.h depends
only on lfs.h.

Install lfs_inode.h into /usr/include.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/ufs/lfs/Makefile
cvs rdiff -u -r1.141 -r1.142 src/sys/ufs/lfs/lfs.h
cvs rdiff -u -r0 -r1.1 src/sys/ufs/lfs/lfs_inode.h
cvs rdiff -u -r1.3 -r1.4 src/sys/ufs/lfs/ulfs_dir.h \
src/sys/ufs/lfs/ulfs_quotacommon.h
cvs rdiff -u -r1.5 -r1.6 src/sys/ufs/lfs/ulfs_inode.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/Makefile
diff -u src/sys/ufs/lfs/Makefile:1.1 src/sys/ufs/lfs/Makefile:1.2
--- src/sys/ufs/lfs/Makefile:1.1	Fri Jun 12 23:23:12 1998
+++ src/sys/ufs/lfs/Makefile	Sat Jun  8 02:04:31 2013
@@ -1,7 +1,7 @@
-#	$NetBSD: Makefile,v 1.1 1998/06/12 23:23:12 cgd Exp $
+#	$NetBSD: Makefile,v 1.2 2013/06/08 02:04:31 dholland Exp $
 
 INCSDIR= /usr/include/ufs/lfs
 
-INCS=	lfs.h lfs_extern.h
+INCS=	lfs.h lfs_inode.h lfs_extern.h
 
 .include 

Index: src/sys/ufs/lfs/lfs.h
diff -u src/sys/ufs/lfs/lfs.h:1.141 src/sys/ufs/lfs/lfs.h:1.142
--- src/sys/ufs/lfs/lfs.h:1.141	Thu Jun  6 00:52:14 2013
+++ src/sys/ufs/lfs/lfs.h	Sat Jun  8 02:04:31 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs.h,v 1.141 2013/06/06 00:52:14 dholland Exp $	*/
+/*	$NetBSD: lfs.h,v 1.142 2013/06/08 02:04:31 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -181,6 +181,19 @@ typedef struct lfs_res_blk {
 #define LFS_N_SEG	2
 
 /*
+ * Directories
+ */
+
+/*
+ * Theoretically, directories can be more than 2Gb in length; however, in
+ * practice this seems unlikely. So, we define the type doff_t as a 32-bit
+ * quantity to keep down the cost of doing lookup on a 32-bit machine.
+ */
+#define	doff_t		int32_t
+#define	lfs_doff_t	int32_t
+#define	MAXDIRSIZE	(0x7fff)
+
+/*
  * "struct buf" associated definitions
  */
 

Index: src/sys/ufs/lfs/ulfs_dir.h
diff -u src/sys/ufs/lfs/ulfs_dir.h:1.3 src/sys/ufs/lfs/ulfs_dir.h:1.4
--- src/sys/ufs/lfs/ulfs_dir.h:1.3	Thu Jun  6 01:25:25 2013
+++ src/sys/ufs/lfs/ulfs_dir.h	Sat Jun  8 02:04:31 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ulfs_dir.h,v 1.3 2013/06/06 01:25:25 dholland Exp $	*/
+/*	$NetBSD: ulfs_dir.h,v 1.4 2013/06/08 02:04:31 dholland Exp $	*/
 /*  from NetBSD: dir.h,v 1.21 2009/07/22 04:49:19 dholland Exp  */
 
 /*
@@ -41,14 +41,6 @@
 #define	_UFS_LFS_ULFS_DIR_H_
 
 /*
- * Theoretically, directories can be more than 2Gb in length; however, in
- * practice this seems unlikely. So, we define the type doff_t as a 32-bit
- * quantity to keep down the cost of doing lookup on a 32-bit machine.
- */
-#define	doff_t		int32_t
-#define	MAXDIRSIZE	(0x7fff)
-
-/*
  * A directory consists of some number of blocks of DIRBLKSIZ
  * bytes, where DIRBLKSIZ is chosen such that it can be transferred
  * to disk in a single atomic operation (e.g. 512 bytes on most machines).
Index: src/sys/ufs/lfs/ulfs_quotacommon.h
diff -u src/sys/ufs/lfs/ulfs_quotacommon.h:1.3 src/sys/ufs/lfs/ulfs_quotacommon.h:1.4
--- src/sys/ufs/lfs/ulfs_quotacommon.h:1.3	Thu Jun  6 00:49:28 2013
+++ src/sys/ufs/lfs/ulfs_quotacommon.h	Sat Jun  8 02:04:31 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ulfs_quotacommon.h,v 1.3 2013/06/06 00:49:28 dholland Exp $	*/
+/*	$NetBSD: ulfs_quotacommon.h,v 1.4 2013/06/08 02:04:31 dholland Exp $	*/
 /*  from NetBSD: quota.h,v 1.30 2012/08/26 02:32:14 dholland Exp  */
 
 /*
@@ -38,23 +38,15 @@
 #ifndef	_UFS_LFS_ULFS_QUOTACOMMON_H_
 #define	_UFS_LFS_ULFS_QUOTACOMMON_H_
 
+#include 
+#include 
+
 /*
  * These definitions are common to the original disk quota implementation
  * (quota1) and the newer implementation (quota2)
  */
 
 /*
- * The following constants define the usage of the quota file array in the
- * ulfsmount structure and dquot array in the inode structure.  The semantics
- * of the elements of these arrays are defined in the routine lfs_getinoquota;
- * the remainder of the quota code treats them generically and need not be
- * inspected when changing the size of the array.
- */
-#define	ULFS_MAXQUOTAS	2
-#define	ULFS_USRQUOTA	0	/* element used for user quotas */
-#define	ULFS_GRPQUOTA	1	/* element used for group quotas */
-
-/*
  * Initializer for the strings corresponding to the quota ID types.
  * (in quota1 these are also the default names of the quota files)
  */

Index:

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

2013-06-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Jun  8 02:06:17 UTC 2013

Modified Files:
src/distrib/sets/lists/comp: mi

Log Message:
Set lists for lfs_inode.h.


To generate a diff of this commit:
cvs rdiff -u -r1.1822 -r1.1823 src/distrib/sets/lists/comp/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/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1822 src/distrib/sets/lists/comp/mi:1.1823
--- src/distrib/sets/lists/comp/mi:1.1822	Wed May 22 16:03:43 2013
+++ src/distrib/sets/lists/comp/mi	Sat Jun  8 02:06:17 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1822 2013/05/22 16:03:43 christos Exp $
+#	$NetBSD: mi,v 1.1823 2013/06/08 02:06:17 dholland Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2757,6 +2757,7 @@
 ./usr/include/ufs/ffs/fs.h			comp-c-include
 ./usr/include/ufs/lfs/lfs.h			comp-c-include
 ./usr/include/ufs/lfs/lfs_extern.h		comp-c-include
+./usr/include/ufs/lfs/lfs_inode.h		comp-c-include
 ./usr/include/ufs/mfs/mfs_extern.h		comp-c-include
 ./usr/include/ufs/mfs/mfsiom.h			comp-obsolete		obsolete
 ./usr/include/ufs/mfs/mfsnode.h			comp-c-include



CVS commit: src

2013-06-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Jun  8 02:09:36 UTC 2013

Modified Files:
src/libexec/lfs_cleanerd: lfs_cleanerd.c
src/sbin/fsck_lfs: inode.c pass6.c segwrite.c setup.c
src/sbin/newfs_lfs: make_lfs.c
src/sys/ufs/lfs: lfs.h ulfs_dinode.h

Log Message:
Move the dinode (on-disk inode) structures to lfs.h, since they are
and will be obviously required by userland tools that need to read
the on-disk structures.

Also, DINODE{1,2}_SIZE -> LFS_DINODE{1,2}_SIZE.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/libexec/lfs_cleanerd/lfs_cleanerd.c
cvs rdiff -u -r1.45 -r1.46 src/sbin/fsck_lfs/inode.c
cvs rdiff -u -r1.27 -r1.28 src/sbin/fsck_lfs/pass6.c
cvs rdiff -u -r1.23 -r1.24 src/sbin/fsck_lfs/segwrite.c
cvs rdiff -u -r1.41 -r1.42 src/sbin/fsck_lfs/setup.c
cvs rdiff -u -r1.22 -r1.23 src/sbin/newfs_lfs/make_lfs.c
cvs rdiff -u -r1.142 -r1.143 src/sys/ufs/lfs/lfs.h
cvs rdiff -u -r1.4 -r1.5 src/sys/ufs/lfs/ulfs_dinode.h

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.33 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.34
--- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.33	Thu Jun  6 00:53:35 2013
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.c	Sat Jun  8 02:09:35 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.33 2013/06/06 00:53:35 dholland Exp $	 */
+/* $NetBSD: lfs_cleanerd.c,v 1.34 2013/06/08 02:09:35 dholland Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -485,7 +485,7 @@ parse_pseg(struct clfs *fs, daddr_t dadd
 bip[*bic - 1].bi_segcreate = ssp->ss_create;
 bip[*bic - 1].bi_version = dip[i].di_gen;
 bip[*bic - 1].bi_bp = &(dip[i]);
-bip[*bic - 1].bi_size = DINODE1_SIZE;
+bip[*bic - 1].bi_size = LFS_DINODE1_SIZE;
 			}
 			inoc += i;
 			daddr += btofsb(fs, fs->lfs_ibsize);

Index: src/sbin/fsck_lfs/inode.c
diff -u src/sbin/fsck_lfs/inode.c:1.45 src/sbin/fsck_lfs/inode.c:1.46
--- src/sbin/fsck_lfs/inode.c:1.45	Thu Jun  6 00:54:49 2013
+++ src/sbin/fsck_lfs/inode.c	Sat Jun  8 02:09:35 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: inode.c,v 1.45 2013/06/06 00:54:49 dholland Exp $	 */
+/* $NetBSD: inode.c,v 1.46 2013/06/08 02:09:35 dholland Exp $	 */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -113,7 +113,7 @@ ginode(ino_t ino)
 	if (din_table[ino] == 0x0) {
 		LFS_IENTRY(ifp, fs, ino, bp);
 		din_table[ino] = ifp->if_daddr;
-		seg_table[dtosn(fs, ifp->if_daddr)].su_nbytes += DINODE1_SIZE;
+		seg_table[dtosn(fs, ifp->if_daddr)].su_nbytes += LFS_DINODE1_SIZE;
 		brelse(bp, 0);
 	}
 	return (VTOI(vp)->i_din.ffs1_din);
@@ -476,9 +476,9 @@ clearinode(ino_t inumber)
 		SEGUSE *sup;
 		u_int32_t oldsn = dtosn(fs, daddr);
 
-		seg_table[oldsn].su_nbytes -= DINODE1_SIZE;
+		seg_table[oldsn].su_nbytes -= LFS_DINODE1_SIZE;
 		LFS_SEGENTRY(sup, fs, oldsn, bp);
-		sup->su_nbytes -= DINODE1_SIZE;
+		sup->su_nbytes -= LFS_DINODE1_SIZE;
 		LFS_WRITESEGENTRY(sup, fs, oldsn, bp);	/* Ifile */
 	}
 }

Index: src/sbin/fsck_lfs/pass6.c
diff -u src/sbin/fsck_lfs/pass6.c:1.27 src/sbin/fsck_lfs/pass6.c:1.28
--- src/sbin/fsck_lfs/pass6.c:1.27	Thu Jun  6 00:54:49 2013
+++ src/sbin/fsck_lfs/pass6.c	Sat Jun  8 02:09:35 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: pass6.c,v 1.27 2013/06/06 00:54:49 dholland Exp $	 */
+/* $NetBSD: pass6.c,v 1.28 2013/06/08 02:09:35 dholland Exp $	 */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -237,9 +237,9 @@ remove_ino(struct uvnode *vp, ino_t ino)
 			vp = lfs_raw_vget(fs, ino, fs->lfs_ivnode->v_fd, daddr);
 
 		LFS_SEGENTRY(sup, fs, dtosn(fs, daddr), sbp);
-		sup->su_nbytes -= DINODE1_SIZE;
+		sup->su_nbytes -= LFS_DINODE1_SIZE;
 		VOP_BWRITE(sbp);
-		seg_table[dtosn(fs, daddr)].su_nbytes -= DINODE1_SIZE;
+		seg_table[dtosn(fs, daddr)].su_nbytes -= LFS_DINODE1_SIZE;
 	} else
 		brelse(bp, 0);
 
@@ -454,15 +454,15 @@ readdress_inode(struct ulfs1_dinode *dp,
 	/* Finally account the inode itself */
 	sn = dtosn(fs, odaddr);
 	LFS_SEGENTRY(sup, fs, sn, bp);
-	sup->su_nbytes -= DINODE1_SIZE;
+	sup->su_nbytes -= LFS_DINODE1_SIZE;
 	VOP_BWRITE(bp);
-	seg_table[sn].su_nbytes -= DINODE1_SIZE;
+	seg_table[sn].su_nbytes -= LFS_DINODE1_SIZE;
 
 	sn = dtosn(fs, daddr);
 	LFS_SEGENTRY(sup, fs, sn, bp);
-	sup->su_nbytes += DINODE1_SIZE;
+	sup->su_nbytes += LFS_DINODE1_SIZE;
 	VOP_BWRITE(bp);
-	seg_table[sn].su_nbytes += DINODE1_SIZE;
+	seg_table[sn].su_nbytes += LFS_DINODE1_SIZE;
 }
 
 /*
@@ -521,9 +521,9 @@ alloc_inode(ino_t thisino, ulfs_daddr_t 
 	
 	/* Account for new location */
 	LFS_SEGENTRY(sup, fs, dtosn(fs, daddr), bp);
-	sup->su_nbytes += DINODE1_SIZE;
+	sup->su_nbytes += LFS_DINODE1_SIZE;
 	VOP_BWRITE(bp);
-	seg_table[dtosn(fs, daddr)].su_nbytes += DINODE1_SIZE;
+	seg_table[dtosn(fs, daddr)].su_nbytes += LFS_DINODE1_SIZE;
 }
 
 /*

Index: src/sbin/fsck_lfs/segwrite.c
diff -u src/sbin/fsck_lfs/segwrite

CVS commit: src

2013-06-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Jun  8 02:11:11 UTC 2013

Modified Files:
src/sbin/fsck_lfs: dir.c inode.c pass1.c pass2.c utilities.c
src/sbin/newfs_lfs: make_lfs.c
src/sys/ufs/lfs: lfs_rfw.c lfs_segment.c lfs_vfsops.c lfs_vnops.c
ulfs_dinode.h ulfs_rename.c ulfs_vnops.c

Log Message:
Stick LFS_ in front of IFMT, IFIFO, IFREG, etc. so as not to conflict
with the UFS copies of these symbols. (Which themselves ought to have
UFS_ stuck on.)


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sbin/fsck_lfs/dir.c
cvs rdiff -u -r1.46 -r1.47 src/sbin/fsck_lfs/inode.c
cvs rdiff -u -r1.33 -r1.34 src/sbin/fsck_lfs/pass1.c \
src/sbin/fsck_lfs/utilities.c
cvs rdiff -u -r1.19 -r1.20 src/sbin/fsck_lfs/pass2.c
cvs rdiff -u -r1.23 -r1.24 src/sbin/newfs_lfs/make_lfs.c
cvs rdiff -u -r1.15 -r1.16 src/sys/ufs/lfs/lfs_rfw.c
cvs rdiff -u -r1.227 -r1.228 src/sys/ufs/lfs/lfs_segment.c
cvs rdiff -u -r1.302 -r1.303 src/sys/ufs/lfs/lfs_vfsops.c
cvs rdiff -u -r1.245 -r1.246 src/sys/ufs/lfs/lfs_vnops.c
cvs rdiff -u -r1.5 -r1.6 src/sys/ufs/lfs/ulfs_dinode.h
cvs rdiff -u -r1.3 -r1.4 src/sys/ufs/lfs/ulfs_rename.c
cvs rdiff -u -r1.6 -r1.7 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.27 src/sbin/fsck_lfs/dir.c:1.28
--- src/sbin/fsck_lfs/dir.c:1.27	Thu Jun  6 00:52:50 2013
+++ src/sbin/fsck_lfs/dir.c	Sat Jun  8 02:11:11 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.27 2013/06/06 00:52:50 dholland Exp $	 */
+/* $NetBSD: dir.c,v 1.28 2013/06/08 02:11:11 dholland Exp $	 */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -317,7 +317,7 @@ fileerror(ino_t cwd, ino_t ino, const ch
 	else {
 		if (ftypeok(VTOD(vp)))
 			pfatal("%s=%s\n",
-			(VTOI(vp)->i_ffs1_mode & IFMT) == IFDIR ?
+			(VTOI(vp)->i_ffs1_mode & LFS_IFMT) == LFS_IFDIR ?
 			"DIR" : "FILE", pathbuf);
 		else
 			pfatal("NAME=%s\n", pathbuf);
@@ -337,7 +337,7 @@ adjust(struct inodesc *idesc, short lcnt
 			clri(idesc, "UNREF", 0);
 	} else {
 		pwarn("LINK COUNT %s", (lfdir == idesc->id_number) ? lfname :
-		((dp->di_mode & IFMT) == IFDIR ? "DIR" : "FILE"));
+		((dp->di_mode & LFS_IFMT) == LFS_IFDIR ? "DIR" : "FILE"));
 		pinode(idesc->id_number);
 		printf(" COUNT %d SHOULD BE %d",
 		dp->di_nlink, dp->di_nlink - lcnt);
@@ -406,7 +406,7 @@ linkup(ino_t orphan, ino_t parentdir)
 	memset(&idesc, 0, sizeof(struct inodesc));
 	vp = vget(fs, orphan);
 	dp = VTOD(vp);
-	lostdir = (dp->di_mode & IFMT) == IFDIR;
+	lostdir = (dp->di_mode & LFS_IFMT) == LFS_IFDIR;
 	pwarn("UNREF %s ", lostdir ? "DIR" : "FILE");
 	pinode(orphan);
 	if (preen && dp->di_size == 0)
@@ -448,7 +448,7 @@ linkup(ino_t orphan, ino_t parentdir)
 	}
 	vp = vget(fs, lfdir);
 	dp = VTOD(vp);
-	if ((dp->di_mode & IFMT) != IFDIR) {
+	if ((dp->di_mode & LFS_IFMT) != LFS_IFDIR) {
 		pfatal("lost+found IS NOT A DIRECTORY");
 		if (reply("REALLOCATE") == 0)
 			return (0);
@@ -622,7 +622,7 @@ allocdir(ino_t parent, ino_t request, in
 	struct dirtemplate *dirp;
 	struct uvnode *vp;
 
-	ino = allocino(request, IFDIR | mode);
+	ino = allocino(request, LFS_IFDIR | mode);
 	dirp = &dirhead;
 	dirp->dot_ino = ino;
 	dirp->dotdot_ino = parent;

Index: src/sbin/fsck_lfs/inode.c
diff -u src/sbin/fsck_lfs/inode.c:1.46 src/sbin/fsck_lfs/inode.c:1.47
--- src/sbin/fsck_lfs/inode.c:1.46	Sat Jun  8 02:09:35 2013
+++ src/sbin/fsck_lfs/inode.c	Sat Jun  8 02:11:11 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: inode.c,v 1.46 2013/06/08 02:09:35 dholland Exp $	 */
+/* $NetBSD: inode.c,v 1.47 2013/06/08 02:11:11 dholland Exp $	 */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -137,9 +137,9 @@ ckinode(struct ulfs1_dinode *dp, struct 
 		idesc->id_fix = DONTKNOW;
 	idesc->id_entryno = 0;
 	idesc->id_filesize = dp->di_size;
-	mode = dp->di_mode & IFMT;
-	if (mode == IFBLK || mode == IFCHR ||
-	(mode == IFLNK && (dp->di_size < fs->lfs_maxsymlinklen ||
+	mode = dp->di_mode & LFS_IFMT;
+	if (mode == LFS_IFBLK || mode == LFS_IFCHR ||
+	(mode == LFS_IFLNK && (dp->di_size < fs->lfs_maxsymlinklen ||
 		(fs->lfs_maxsymlinklen == 0 &&
 			dp->di_blocks == 0
 		return (KEEPON);
@@ -432,7 +432,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 & IFMT) == IFDIR ? "DIR" : "FILE");
+		  (VTOI(vp)->i_ffs1_mode & LFS_IFMT) == LFS_IFDIR ? "DIR" : "FILE");
 		pinode(idesc->id_number);
 	}
 	if ((flag & 0x2) || preen || reply("CLEAR") == 1) {
@@ -594,12 +594,12 @@ allocino(ino_t request, int type)
 	if (ino == maxino)
 		extend_ifile(fs);
 
-	switch (type & IFMT) {
-	case IFDIR:
+	switch (type & LFS_IFMT) {
+	case LFS_IFDIR:
 		statemap[ino] = DSTATE;
 		break;
-	case IFREG:
-	case IFLNK:
+	case LFS_IFREG:
+	case LFS_IFLNK:
 		statemap[ino] = FSTATE;
 		bre

CVS commit: src/sys/ufs/lfs

2013-06-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Jun  8 02:11:49 UTC 2013

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

Log Message:
Now move LFS_IFMT and friends from ulfs_dinode.h to lfs.h.


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/sys/ufs/lfs/lfs.h
cvs rdiff -u -r1.6 -r1.7 src/sys/ufs/lfs/ulfs_dinode.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.143 src/sys/ufs/lfs/lfs.h:1.144
--- src/sys/ufs/lfs/lfs.h:1.143	Sat Jun  8 02:09:35 2013
+++ src/sys/ufs/lfs/lfs.h	Sat Jun  8 02:11:49 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs.h,v 1.143 2013/06/08 02:09:35 dholland Exp $	*/
+/*	$NetBSD: lfs.h,v 1.144 2013/06/08 02:11:49 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -271,6 +271,17 @@ struct ulfs2_dinode {
 #define	LFS_DINODE1_SIZE	(sizeof(struct ulfs1_dinode))	/* 128 */
 #define	LFS_DINODE2_SIZE	(sizeof(struct ulfs2_dinode))
 
+/* File types, found in the upper bits of di_mode. */
+#define	LFS_IFMT	017		/* Mask of file type. */
+#define	LFS_IFIFO	001		/* Named pipe (fifo). */
+#define	LFS_IFCHR	002		/* Character device. */
+#define	LFS_IFDIR	004		/* Directory file. */
+#define	LFS_IFBLK	006		/* Block device. */
+#define	LFS_IFREG	010		/* Regular file. */
+#define	LFS_IFLNK	012		/* Symbolic link. */
+#define	LFS_IFSOCK	014		/* UNIX domain socket. */
+#define	LFS_IFWHT	016		/* Whiteout. */
+
 /*
  * "struct buf" associated definitions
  */

Index: src/sys/ufs/lfs/ulfs_dinode.h
diff -u src/sys/ufs/lfs/ulfs_dinode.h:1.6 src/sys/ufs/lfs/ulfs_dinode.h:1.7
--- src/sys/ufs/lfs/ulfs_dinode.h:1.6	Sat Jun  8 02:11:11 2013
+++ src/sys/ufs/lfs/ulfs_dinode.h	Sat Jun  8 02:11:49 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ulfs_dinode.h,v 1.6 2013/06/08 02:11:11 dholland Exp $	*/
+/*	$NetBSD: ulfs_dinode.h,v 1.7 2013/06/08 02:11:49 dholland Exp $	*/
 /*  from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp  */
 
 /*
@@ -89,15 +89,4 @@
 #define	ISGID		0002000		/* Set-gid. */
 #define	ISUID		0004000		/* Set-uid. */
 
-/* File types. */
-#define	LFS_IFMT	017		/* Mask of file type. */
-#define	LFS_IFIFO	001		/* Named pipe (fifo). */
-#define	LFS_IFCHR	002		/* Character device. */
-#define	LFS_IFDIR	004		/* Directory file. */
-#define	LFS_IFBLK	006		/* Block device. */
-#define	LFS_IFREG	010		/* Regular file. */
-#define	LFS_IFLNK	012		/* Symbolic link. */
-#define	LFS_IFSOCK	014		/* UNIX domain socket. */
-#define	LFS_IFWHT	016		/* Whiteout. */
-
 #endif /* !_UFS_LFS_ULFS_DINODE_H_ */



CVS commit: src/sys/ufs/lfs

2013-06-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Jun  8 02:13:33 UTC 2013

Modified Files:
src/sys/ufs/lfs: lfs.h ulfs_dinode.h ulfs_dir.h ulfs_dirhash.h
ulfs_lookup.c ulfsmount.h

Log Message:
Move stuff to lfs.h that's needed by userland:
   LFS_DT_*
   ULFS_ROOTINO
   ULFS_WINO
   struct lfs_direct
   struct lfs_dirtemplate
   struct lfs_odirtemplate
   struct ulfs_args

Also fix FFS_MAXNAMLEN -> LFS_MAXNAMLEN in several places.


To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 src/sys/ufs/lfs/lfs.h
cvs rdiff -u -r1.8 -r1.9 src/sys/ufs/lfs/ulfs_dinode.h
cvs rdiff -u -r1.5 -r1.6 src/sys/ufs/lfs/ulfs_dir.h
cvs rdiff -u -r1.3 -r1.4 src/sys/ufs/lfs/ulfs_dirhash.h
cvs rdiff -u -r1.7 -r1.8 src/sys/ufs/lfs/ulfs_lookup.c
cvs rdiff -u -r1.6 -r1.7 src/sys/ufs/lfs/ulfsmount.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.144 src/sys/ufs/lfs/lfs.h:1.145
--- src/sys/ufs/lfs/lfs.h:1.144	Sat Jun  8 02:11:49 2013
+++ src/sys/ufs/lfs/lfs.h	Sat Jun  8 02:13:33 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs.h,v 1.144 2013/06/08 02:11:49 dholland Exp $	*/
+/*	$NetBSD: lfs.h,v 1.145 2013/06/08 02:13:33 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -88,6 +88,23 @@
 #define	LFS_LOSTFOUNDINO 3		/* 3: lost+found inode number */
 #define	LFS_FIRST_INUM	4		/* 4: first free inode number */
 
+/*
+ * The root inode is the root of the file system.  Inode 0 can't be used for
+ * normal purposes and historically bad blocks were linked to inode 1, thus
+ * the root inode is 2.  (Inode 1 is no longer used for this purpose, however
+ * numerous dump tapes make this assumption, so we are stuck with it).
+ */
+#define	ULFS_ROOTINO	((ino_t)2)
+
+/*
+ * The Whiteout inode# is a dummy non-zero inode number which will
+ * never be allocated to a real file.  It is used as a place holder
+ * in the directory entry which has been tagged as a LFS_DT_WHT entry.
+ * See the comments about ULFS_ROOTINO above.
+ */
+#define	ULFS_WINO	((ino_t)1)
+
+
 #define	LFS_V1_SUMMARY_SIZE	512 /* V1 fixed summary size */
 #define	LFS_DFL_SUMMARY_SIZE	512	/* Default summary size */
 
@@ -193,6 +210,64 @@ typedef struct lfs_res_blk {
 #define	lfs_doff_t	int32_t
 #define	MAXDIRSIZE	(0x7fff)
 
+#define	LFS_MAXNAMLEN	255
+
+/*
+ * File types for d_type
+ */
+#define	LFS_DT_UNKNOWN	 0
+#define	LFS_DT_FIFO	 1
+#define	LFS_DT_CHR	 2
+#define	LFS_DT_DIR	 4
+#define	LFS_DT_BLK	 6
+#define	LFS_DT_REG	 8
+#define	LFS_DT_LNK	10
+#define	LFS_DT_SOCK	12
+#define	LFS_DT_WHT	14
+
+/*
+ * (See notes in ulfs_dir.h)
+ */
+#define d_ino d_fileno
+struct lfs_direct {
+	u_int32_t d_fileno;		/* inode number of entry */
+	u_int16_t d_reclen;		/* length of this record */
+	u_int8_t  d_type; 		/* file type, see below */
+	u_int8_t  d_namlen;		/* length of string in d_name */
+	char	  d_name[LFS_MAXNAMLEN + 1];/* name with length <= LFS_MAXNAMLEN */
+};
+
+/*
+ * Template for manipulating directories.  Should use struct lfs_direct's,
+ * but the name field is LFS_MAXNAMLEN - 1, and this just won't do.
+ */
+struct lfs_dirtemplate {
+	u_int32_t	dot_ino;
+	int16_t		dot_reclen;
+	u_int8_t	dot_type;
+	u_int8_t	dot_namlen;
+	char		dot_name[4];	/* must be multiple of 4 */
+	u_int32_t	dotdot_ino;
+	int16_t		dotdot_reclen;
+	u_int8_t	dotdot_type;
+	u_int8_t	dotdot_namlen;
+	char		dotdot_name[4];	/* ditto */
+};
+
+/*
+ * This is the old format of directories, sans type element.
+ */
+struct lfs_odirtemplate {
+	u_int32_t	dot_ino;
+	int16_t		dot_reclen;
+	u_int16_t	dot_namlen;
+	char		dot_name[4];	/* must be multiple of 4 */
+	u_int32_t	dotdot_ino;
+	int16_t		dotdot_reclen;
+	u_int16_t	dotdot_namlen;
+	char		dotdot_name[4];	/* ditto */
+};
+
 /*
  * Inodes
  */
@@ -1288,6 +1363,13 @@ struct lfs_fhandle {
 # define ASSERT_MAYBE_SEGLOCK(x)
 #endif /* !notyet */
 
+/*
+ * Arguments to mount LFS filesystems
+ */
+struct ulfs_args {
+	char	*fspec;			/* block special device to mount */
+};
+
 __BEGIN_DECLS
 void lfs_itimes(struct inode *, const struct timespec *,
 const struct timespec *, const struct timespec *);

Index: src/sys/ufs/lfs/ulfs_dinode.h
diff -u src/sys/ufs/lfs/ulfs_dinode.h:1.8 src/sys/ufs/lfs/ulfs_dinode.h:1.9
--- src/sys/ufs/lfs/ulfs_dinode.h:1.8	Sat Jun  8 02:12:56 2013
+++ src/sys/ufs/lfs/ulfs_dinode.h	Sat Jun  8 02:13:33 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ulfs_dinode.h,v 1.8 2013/06/08 02:12:56 dholland Exp $	*/
+/*	$NetBSD: ulfs_dinode.h,v 1.9 2013/06/08 02:13:33 dholland Exp $	*/
 /*  from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp  */
 
 /*
@@ -56,22 +56,6 @@
 #include 
 
 /*
- * The root inode is the root of the file system.  Inode 0 can't be used for
- * normal purposes and historically bad blocks were linked to inode 1, thus
- * the root inode is 2.  (Inode 1 is no longer used for this purpose, however
- * numerous 

CVS commit: src

2013-06-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Jun  8 02:12:56 UTC 2013

Modified Files:
src/sbin/fsck_lfs: dir.c extern.h fsck.h inode.c pass2.c
src/sbin/newfs_lfs: make_lfs.c
src/sys/ufs/lfs: ulfs_dinode.h ulfs_dir.h ulfs_dirhash.c ulfs_dirhash.h
ulfs_extern.h ulfs_lookup.c ulfs_rename.c ulfs_vfsops.c
ulfs_vnops.c

Log Message:
struct direct -> struct lfs_direct
struct dirtemplate -> struct lfs_dirtemplate
struct odirtemplate -> struct lfs_odirtemplate
DT_* -> LFS_DT_*


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sbin/fsck_lfs/dir.c
cvs rdiff -u -r1.10 -r1.11 src/sbin/fsck_lfs/extern.h
cvs rdiff -u -r1.19 -r1.20 src/sbin/fsck_lfs/fsck.h
cvs rdiff -u -r1.47 -r1.48 src/sbin/fsck_lfs/inode.c
cvs rdiff -u -r1.20 -r1.21 src/sbin/fsck_lfs/pass2.c
cvs rdiff -u -r1.24 -r1.25 src/sbin/newfs_lfs/make_lfs.c
cvs rdiff -u -r1.7 -r1.8 src/sys/ufs/lfs/ulfs_dinode.h \
src/sys/ufs/lfs/ulfs_vfsops.c src/sys/ufs/lfs/ulfs_vnops.c
cvs rdiff -u -r1.4 -r1.5 src/sys/ufs/lfs/ulfs_dir.h \
src/sys/ufs/lfs/ulfs_rename.c
cvs rdiff -u -r1.3 -r1.4 src/sys/ufs/lfs/ulfs_dirhash.c
cvs rdiff -u -r1.2 -r1.3 src/sys/ufs/lfs/ulfs_dirhash.h
cvs rdiff -u -r1.5 -r1.6 src/sys/ufs/lfs/ulfs_extern.h
cvs rdiff -u -r1.6 -r1.7 src/sys/ufs/lfs/ulfs_lookup.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.28 src/sbin/fsck_lfs/dir.c:1.29
--- src/sbin/fsck_lfs/dir.c:1.28	Sat Jun  8 02:11:11 2013
+++ src/sbin/fsck_lfs/dir.c	Sat Jun  8 02:12:56 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.28 2013/06/08 02:11:11 dholland Exp $	 */
+/* $NetBSD: dir.c,v 1.29 2013/06/08 02:12:56 dholland Exp $	 */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -55,23 +55,23 @@
 
 const char *lfname = "lost+found";
 int lfmode = 01700;
-struct dirtemplate emptydir = {
+struct lfs_dirtemplate emptydir = {
 	.dot_ino = 0,
 	.dot_reclen = DIRBLKSIZ,
 };
-struct dirtemplate dirhead = {
+struct lfs_dirtemplate dirhead = {
 	.dot_ino = 0,
 	.dot_reclen = 12,
-	.dot_type = DT_DIR,
+	.dot_type = LFS_DT_DIR,
 	.dot_namlen = 1,
 	.dot_name = ".",
 	.dotdot_ino = 0,
 	.dotdot_reclen = DIRBLKSIZ - 12,
-	.dotdot_type = DT_DIR,
+	.dotdot_type = LFS_DT_DIR,
 	.dotdot_namlen = 2,
 	.dotdot_name = ".."
 };
-struct odirtemplate odirhead = {
+struct lfs_odirtemplate odirhead = {
 	.dot_ino = 0,
 	.dot_reclen = 12,
 	.dot_namlen = 1,
@@ -84,7 +84,7 @@ struct odirtemplate odirhead = {
 
 static int expanddir(struct uvnode *, struct ulfs1_dinode *, char *);
 static void freedir(ino_t, ino_t);
-static struct direct *fsck_readdir(struct uvnode *, struct inodesc *);
+static struct lfs_direct *fsck_readdir(struct uvnode *, struct inodesc *);
 static int lftempname(char *, ino_t);
 static int mkentry(struct inodesc *);
 static int chgino(struct inodesc *);
@@ -131,7 +131,7 @@ propagate(void)
 int
 dirscan(struct inodesc *idesc)
 {
-	struct direct *dp;
+	struct lfs_direct *dp;
 	struct ubuf *bp;
 	int dsize, n;
 	long blksiz;
@@ -155,7 +155,7 @@ dirscan(struct inodesc *idesc)
 	dp = fsck_readdir(vp, idesc)) {
 		dsize = dp->d_reclen;
 		memcpy(dbuf, dp, (size_t) dsize);
-		idesc->id_dirp = (struct direct *) dbuf;
+		idesc->id_dirp = (struct lfs_direct *) dbuf;
 		if ((n = (*idesc->id_func) (idesc)) & ALTERED) {
 			bread(vp, idesc->id_lblkno, blksiz, NOCRED, 0, &bp);
 			memcpy(bp->b_data + idesc->id_loc - dsize, dbuf,
@@ -172,10 +172,10 @@ dirscan(struct inodesc *idesc)
 /*
  * get next entry in a directory.
  */
-static struct direct *
+static struct lfs_direct *
 fsck_readdir(struct uvnode *vp, struct inodesc *idesc)
 {
-	struct direct *dp, *ndp;
+	struct lfs_direct *dp, *ndp;
 	struct ubuf *bp;
 	long size, blksiz, fix, dploc;
 
@@ -183,7 +183,7 @@ fsck_readdir(struct uvnode *vp, struct i
 	bread(vp, idesc->id_lblkno, blksiz, NOCRED, 0, &bp);
 	if (idesc->id_loc % DIRBLKSIZ == 0 && idesc->id_filesize > 0 &&
 	idesc->id_loc < blksiz) {
-		dp = (struct direct *) (bp->b_data + idesc->id_loc);
+		dp = (struct lfs_direct *) (bp->b_data + idesc->id_loc);
 		if (dircheck(idesc, dp))
 			goto dpok;
 		brelse(bp, 0);
@@ -191,7 +191,7 @@ fsck_readdir(struct uvnode *vp, struct i
 			return (0);
 		fix = dofix(idesc, "DIRECTORY CORRUPTED");
 		bread(vp, idesc->id_lblkno, blksiz, NOCRED, 0, &bp);
-		dp = (struct direct *) (bp->b_data + idesc->id_loc);
+		dp = (struct lfs_direct *) (bp->b_data + idesc->id_loc);
 		dp->d_reclen = DIRBLKSIZ;
 		dp->d_ino = 0;
 		dp->d_type = 0;
@@ -211,14 +211,14 @@ dpok:
 		return NULL;
 	}
 	dploc = idesc->id_loc;
-	dp = (struct direct *) (bp->b_data + dploc);
+	dp = (struct lfs_direct *) (bp->b_data + dploc);
 	idesc->id_loc += dp->d_reclen;
 	idesc->id_filesize -= dp->d_reclen;
 	if ((idesc->id_loc % DIRBLKSIZ) == 0) {
 		brelse(bp, 0);
 		return dp;
 	}
-	ndp = (struct direct *) (bp->b_data + idesc->id_loc);
+	ndp = (struct lfs_direct 

CVS commit: src

2013-06-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Jun  8 02:14:46 UTC 2013

Modified Files:
src/sbin/fsck_lfs: dir.c inode.c pass1.c pass2.c
src/sbin/newfs_lfs: make_lfs.c
src/sys/ufs/lfs: lfs.h lfs_vfsops.c ulfs_dir.h ulfs_dirhash.c
ulfs_dirhash.h ulfs_extattr.c ulfs_lookup.c ulfs_rename.c
ulfs_vnops.c

Log Message:
DIRBLKSIZ -> LFS_DIRBLKSIZ
DIRECTSIZ -> LFS_DIRECTSIZ
DIRSIZ -> LFS_DIRSIZ
OLDDIRFMT -> LFS_OLDDIRFMT
NEWDIRFMT -> LFS_NEWDIRFMT
IFTODT -> LFS_IFTODT
DTTOIF -> LFS_DTTOIF


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sbin/fsck_lfs/dir.c
cvs rdiff -u -r1.48 -r1.49 src/sbin/fsck_lfs/inode.c
cvs rdiff -u -r1.34 -r1.35 src/sbin/fsck_lfs/pass1.c
cvs rdiff -u -r1.21 -r1.22 src/sbin/fsck_lfs/pass2.c
cvs rdiff -u -r1.25 -r1.26 src/sbin/newfs_lfs/make_lfs.c
cvs rdiff -u -r1.145 -r1.146 src/sys/ufs/lfs/lfs.h
cvs rdiff -u -r1.303 -r1.304 src/sys/ufs/lfs/lfs_vfsops.c
cvs rdiff -u -r1.6 -r1.7 src/sys/ufs/lfs/ulfs_dir.h
cvs rdiff -u -r1.4 -r1.5 src/sys/ufs/lfs/ulfs_dirhash.c \
src/sys/ufs/lfs/ulfs_dirhash.h src/sys/ufs/lfs/ulfs_extattr.c
cvs rdiff -u -r1.8 -r1.9 src/sys/ufs/lfs/ulfs_lookup.c \
src/sys/ufs/lfs/ulfs_vnops.c
cvs rdiff -u -r1.5 -r1.6 src/sys/ufs/lfs/ulfs_rename.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.29 src/sbin/fsck_lfs/dir.c:1.30
--- src/sbin/fsck_lfs/dir.c:1.29	Sat Jun  8 02:12:56 2013
+++ src/sbin/fsck_lfs/dir.c	Sat Jun  8 02:14:46 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.29 2013/06/08 02:12:56 dholland Exp $	 */
+/* $NetBSD: dir.c,v 1.30 2013/06/08 02:14:46 dholland Exp $	 */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -57,7 +57,7 @@ const char *lfname = "lost+found";
 int lfmode = 01700;
 struct lfs_dirtemplate emptydir = {
 	.dot_ino = 0,
-	.dot_reclen = DIRBLKSIZ,
+	.dot_reclen = LFS_DIRBLKSIZ,
 };
 struct lfs_dirtemplate dirhead = {
 	.dot_ino = 0,
@@ -66,7 +66,7 @@ struct lfs_dirtemplate dirhead = {
 	.dot_namlen = 1,
 	.dot_name = ".",
 	.dotdot_ino = 0,
-	.dotdot_reclen = DIRBLKSIZ - 12,
+	.dotdot_reclen = LFS_DIRBLKSIZ - 12,
 	.dotdot_type = LFS_DT_DIR,
 	.dotdot_namlen = 2,
 	.dotdot_name = ".."
@@ -77,7 +77,7 @@ struct lfs_odirtemplate odirhead = {
 	.dot_namlen = 1,
 	.dot_name = ".",
 	.dotdot_ino = 0,
-	.dotdot_reclen = DIRBLKSIZ - 12,
+	.dotdot_reclen = LFS_DIRBLKSIZ - 12,
 	.dotdot_namlen = 2,
 	.dotdot_name = ".."
 };
@@ -135,14 +135,14 @@ dirscan(struct inodesc *idesc)
 	struct ubuf *bp;
 	int dsize, n;
 	long blksiz;
-	char dbuf[DIRBLKSIZ];
+	char dbuf[LFS_DIRBLKSIZ];
 	struct uvnode *vp;
 
 	if (idesc->id_type != DATA)
 		errexit("wrong type to dirscan %d", idesc->id_type);
 	if (idesc->id_entryno == 0 &&
-	(idesc->id_filesize & (DIRBLKSIZ - 1)) != 0)
-		idesc->id_filesize = roundup(idesc->id_filesize, DIRBLKSIZ);
+	(idesc->id_filesize & (LFS_DIRBLKSIZ - 1)) != 0)
+		idesc->id_filesize = roundup(idesc->id_filesize, LFS_DIRBLKSIZ);
 	blksiz = idesc->id_numfrags * fs->lfs_fsize;
 	if (chkrange(idesc->id_blkno, idesc->id_numfrags)) {
 		idesc->id_filesize -= blksiz;
@@ -181,7 +181,7 @@ fsck_readdir(struct uvnode *vp, struct i
 
 	blksiz = idesc->id_numfrags * fs->lfs_fsize;
 	bread(vp, idesc->id_lblkno, blksiz, NOCRED, 0, &bp);
-	if (idesc->id_loc % DIRBLKSIZ == 0 && idesc->id_filesize > 0 &&
+	if (idesc->id_loc % LFS_DIRBLKSIZ == 0 && idesc->id_filesize > 0 &&
 	idesc->id_loc < blksiz) {
 		dp = (struct lfs_direct *) (bp->b_data + idesc->id_loc);
 		if (dircheck(idesc, dp))
@@ -192,7 +192,7 @@ fsck_readdir(struct uvnode *vp, struct i
 		fix = dofix(idesc, "DIRECTORY CORRUPTED");
 		bread(vp, idesc->id_lblkno, blksiz, NOCRED, 0, &bp);
 		dp = (struct lfs_direct *) (bp->b_data + idesc->id_loc);
-		dp->d_reclen = DIRBLKSIZ;
+		dp->d_reclen = LFS_DIRBLKSIZ;
 		dp->d_ino = 0;
 		dp->d_type = 0;
 		dp->d_namlen = 0;
@@ -201,8 +201,8 @@ fsck_readdir(struct uvnode *vp, struct i
 			VOP_BWRITE(bp);
 		else
 			brelse(bp, 0);
-		idesc->id_loc += DIRBLKSIZ;
-		idesc->id_filesize -= DIRBLKSIZ;
+		idesc->id_loc += LFS_DIRBLKSIZ;
+		idesc->id_filesize -= LFS_DIRBLKSIZ;
 		return (dp);
 	}
 dpok:
@@ -214,7 +214,7 @@ dpok:
 	dp = (struct lfs_direct *) (bp->b_data + dploc);
 	idesc->id_loc += dp->d_reclen;
 	idesc->id_filesize -= dp->d_reclen;
-	if ((idesc->id_loc % DIRBLKSIZ) == 0) {
+	if ((idesc->id_loc % LFS_DIRBLKSIZ) == 0) {
 		brelse(bp, 0);
 		return dp;
 	}
@@ -222,7 +222,7 @@ dpok:
 	if (idesc->id_loc < blksiz && idesc->id_filesize > 0 &&
 	dircheck(idesc, ndp) == 0) {
 		brelse(bp, 0);
-		size = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ);
+		size = LFS_DIRBLKSIZ - (idesc->id_loc % LFS_DIRBLKSIZ);
 		idesc->id_loc += size;
 		idesc->id_filesize -= size;
 		if (idesc->id_fix == IGNORE)
@@ -253,7 +253,7 @@ dircheck(struct inodesc *idesc, struct l
 	u_char namlen, type;
 	int spaceleft;
 
-	spaceleft = DIRBLKSIZ - (idesc->

CVS commit: src/sys/ufs/lfs

2013-06-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Jun  8 02:15:12 UTC 2013

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

Log Message:
Move more symbols to lfs.h:
   LFS_DIRBLKSIZ
   LFS_DIRECTSIZ
   LFS_DIRSIZ
   LFS_OLDDIRFMT
   LFS_NEWDIRFMT
   LFS_IFTODT
   LFS_DTTOIF
   ULFS{,1,2}_MAXSYMLINKLEN


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/sys/ufs/lfs/lfs.h
cvs rdiff -u -r1.9 -r1.10 src/sys/ufs/lfs/ulfs_dinode.h
cvs rdiff -u -r1.7 -r1.8 src/sys/ufs/lfs/ulfs_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/lfs/lfs.h
diff -u src/sys/ufs/lfs/lfs.h:1.146 src/sys/ufs/lfs/lfs.h:1.147
--- src/sys/ufs/lfs/lfs.h:1.146	Sat Jun  8 02:14:46 2013
+++ src/sys/ufs/lfs/lfs.h	Sat Jun  8 02:15:12 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs.h,v 1.146 2013/06/08 02:14:46 dholland Exp $	*/
+/*	$NetBSD: lfs.h,v 1.147 2013/06/08 02:15:12 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -258,6 +258,10 @@ typedef struct lfs_res_blk {
 LFS_DIRECTSIZ((dp)->d_type) : LFS_DIRECTSIZ((dp)->d_namlen))
 #endif
 
+/* Constants for the first argument of LFS_DIRSIZ */
+#define LFS_OLDDIRFMT	1
+#define LFS_NEWDIRFMT	0
+
 /*
  * Theoretically, directories can be more than 2Gb in length; however, in
  * practice this seems unlikely. So, we define the type doff_t as a 32-bit
@@ -415,6 +419,16 @@ struct ulfs2_dinode {
 #define	LFS_IFWHT	016		/* Whiteout. */
 
 /*
+ * 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 ULFS_MAXSYMLINKLEN(ip) \
+	((ip)->i_ump->um_fstype == ULFS1) ? \
+	ULFS1_MAXSYMLINKLEN : ULFS2_MAXSYMLINKLEN
+
+/*
  * "struct buf" associated definitions
  */
 

Index: src/sys/ufs/lfs/ulfs_dinode.h
diff -u src/sys/ufs/lfs/ulfs_dinode.h:1.9 src/sys/ufs/lfs/ulfs_dinode.h:1.10
--- src/sys/ufs/lfs/ulfs_dinode.h:1.9	Sat Jun  8 02:13:33 2013
+++ src/sys/ufs/lfs/ulfs_dinode.h	Sat Jun  8 02:15:12 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ulfs_dinode.h,v 1.9 2013/06/08 02:13:33 dholland Exp $	*/
+/*	$NetBSD: ulfs_dinode.h,v 1.10 2013/06/08 02:15:12 dholland Exp $	*/
 /*  from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp  */
 
 /*
@@ -55,16 +55,6 @@
 
 #include 
 
-/*
- * 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 ULFS_MAXSYMLINKLEN(ip) \
-	((ip)->i_ump->um_fstype == ULFS1) ? \
-	ULFS1_MAXSYMLINKLEN : ULFS2_MAXSYMLINKLEN
-
 /* File permissions. */
 #define	IEXEC		100		/* Executable. */
 #define	IWRITE		200		/* Writable. */

Index: src/sys/ufs/lfs/ulfs_dir.h
diff -u src/sys/ufs/lfs/ulfs_dir.h:1.7 src/sys/ufs/lfs/ulfs_dir.h:1.8
--- src/sys/ufs/lfs/ulfs_dir.h:1.7	Sat Jun  8 02:14:46 2013
+++ src/sys/ufs/lfs/ulfs_dir.h	Sat Jun  8 02:15:12 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ulfs_dir.h,v 1.7 2013/06/08 02:14:46 dholland Exp $	*/
+/*	$NetBSD: ulfs_dir.h,v 1.8 2013/06/08 02:15:12 dholland Exp $	*/
 /*  from NetBSD: dir.h,v 1.21 2009/07/22 04:49:19 dholland Exp  */
 
 /*
@@ -40,7 +40,4 @@
 #ifndef _UFS_LFS_ULFS_DIR_H_
 #define	_UFS_LFS_ULFS_DIR_H_
 
-#define LFS_OLDDIRFMT	1
-#define LFS_NEWDIRFMT	0
-
 #endif /* !_UFS_LFS_ULFS_DIR_H_ */



CVS commit: src/sys/ufs/lfs

2013-06-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Jun  8 02:16:30 UTC 2013

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

Log Message:
As nearly all the content of ulfs_dir.h and ulfs_dinode.h has migrated
to lfs.h, propagate the copyright notices too.


To generate a diff of this commit:
cvs rdiff -u -r1.147 -r1.148 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.147 src/sys/ufs/lfs/lfs.h:1.148
--- src/sys/ufs/lfs/lfs.h:1.147	Sat Jun  8 02:15:12 2013
+++ src/sys/ufs/lfs/lfs.h	Sat Jun  8 02:16:30 2013
@@ -1,4 +1,7 @@
-/*	$NetBSD: lfs.h,v 1.147 2013/06/08 02:15:12 dholland Exp $	*/
+/*	$NetBSD: lfs.h,v 1.148 2013/06/08 02:16:30 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  */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -58,6 +61,85 @@
  *
  *	@(#)lfs.h	8.9 (Berkeley) 5/8/95
  */
+/*
+ * Copyright (c) 2002 Networks Associates Technology, Inc.
+ * All rights reserved.
+ *
+ * This software was developed for the FreeBSD Project by Marshall
+ * Kirk McKusick and Network Associates Laboratories, the Security
+ * Research Division of Network Associates, Inc. under DARPA/SPAWAR
+ * contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS
+ * research program
+ *
+ * Copyright (c) 1982, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *may be used to endorse or promote products derived from this software
+ *without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)dinode.h	8.9 (Berkeley) 3/29/95
+ */
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *may be used to endorse or promote products derived from this software
+ *without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECI

CVS commit: src

2013-06-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Jun  8 02:16:03 UTC 2013

Modified Files:
src/libexec/lfs_cleanerd: Makefile
src/sbin/fsck_lfs: Makefile dir.c inode.c lfs.c main.c pass0.c pass1.c
pass2.c pass3.c pass4.c pass5.c pass6.c segwrite.c setup.c
utilities.c vars.c vnode.c
src/sbin/newfs_lfs: Makefile make_lfs.c newfs.c
src/sys/ufs/lfs: lfs_itimes.c

Log Message:
Tidy up the LFS userland build hacks.
Don't use -I${NETBSDSRCDIR}/sys; don't include files other than the
exported LFS headers, which are lfs.h, lfs_inode.h, and (for now)
lfs_extern.h.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/libexec/lfs_cleanerd/Makefile
cvs rdiff -u -r1.18 -r1.19 src/sbin/fsck_lfs/Makefile
cvs rdiff -u -r1.30 -r1.31 src/sbin/fsck_lfs/dir.c
cvs rdiff -u -r1.49 -r1.50 src/sbin/fsck_lfs/inode.c
cvs rdiff -u -r1.38 -r1.39 src/sbin/fsck_lfs/lfs.c
cvs rdiff -u -r1.44 -r1.45 src/sbin/fsck_lfs/main.c
cvs rdiff -u -r1.34 -r1.35 src/sbin/fsck_lfs/pass0.c \
src/sbin/fsck_lfs/utilities.c
cvs rdiff -u -r1.35 -r1.36 src/sbin/fsck_lfs/pass1.c
cvs rdiff -u -r1.22 -r1.23 src/sbin/fsck_lfs/pass2.c
cvs rdiff -u -r1.12 -r1.13 src/sbin/fsck_lfs/pass3.c
cvs rdiff -u -r1.20 -r1.21 src/sbin/fsck_lfs/pass4.c
cvs rdiff -u -r1.26 -r1.27 src/sbin/fsck_lfs/pass5.c
cvs rdiff -u -r1.28 -r1.29 src/sbin/fsck_lfs/pass6.c
cvs rdiff -u -r1.24 -r1.25 src/sbin/fsck_lfs/segwrite.c
cvs rdiff -u -r1.42 -r1.43 src/sbin/fsck_lfs/setup.c
cvs rdiff -u -r1.16 -r1.17 src/sbin/fsck_lfs/vars.c
cvs rdiff -u -r1.13 -r1.14 src/sbin/fsck_lfs/vnode.c
cvs rdiff -u -r1.10 -r1.11 src/sbin/newfs_lfs/Makefile
cvs rdiff -u -r1.26 -r1.27 src/sbin/newfs_lfs/make_lfs.c
cvs rdiff -u -r1.27 -r1.28 src/sbin/newfs_lfs/newfs.c
cvs rdiff -u -r1.14 -r1.15 src/sys/ufs/lfs/lfs_itimes.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/Makefile
diff -u src/libexec/lfs_cleanerd/Makefile:1.16 src/libexec/lfs_cleanerd/Makefile:1.17
--- src/libexec/lfs_cleanerd/Makefile:1.16	Thu Jun  6 00:54:49 2013
+++ src/libexec/lfs_cleanerd/Makefile	Sat Jun  8 02:16:03 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.16 2013/06/06 00:54:49 dholland Exp $
+#	$NetBSD: Makefile,v 1.17 2013/06/08 02:16:03 dholland Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 .include "Makefile.inc"
@@ -6,9 +6,6 @@
 PROG=	lfs_cleanerd
 MAN=	lfs_cleanerd.8
 
-# XXX
-CPPFLAGS+=-I${NETBSDSRCDIR}/sys
-
 BINDIR=		/libexec
 .if (${MKDYNAMICROOT} == "no")
 LDSTATIC?=  -static

Index: src/sbin/fsck_lfs/Makefile
diff -u src/sbin/fsck_lfs/Makefile:1.18 src/sbin/fsck_lfs/Makefile:1.19
--- src/sbin/fsck_lfs/Makefile:1.18	Thu Jun  6 00:54:49 2013
+++ src/sbin/fsck_lfs/Makefile	Sat Jun  8 02:16:03 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.18 2013/06/06 00:54:49 dholland Exp $
+#	$NetBSD: Makefile,v 1.19 2013/06/08 02:16:03 dholland Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/5/93
 
 WARNS?=	3	# XXX: sign-compare issues
@@ -17,9 +17,6 @@ CPPFLAGS+=-I${.CURDIR} -I${FSCK} -DIN_FS
 CPPFLAGS+="-DKASSERT(x)="
 # -DVERBOSE_BLOCKMAP 
 
-# XXX
-CPPFLAGS+=-I${NETBSDSRCDIR}/sys
-
 LDADD+=-lutil
 DPADD+=${LIBUTIL}
 

Index: src/sbin/fsck_lfs/dir.c
diff -u src/sbin/fsck_lfs/dir.c:1.30 src/sbin/fsck_lfs/dir.c:1.31
--- src/sbin/fsck_lfs/dir.c:1.30	Sat Jun  8 02:14:46 2013
+++ src/sbin/fsck_lfs/dir.c	Sat Jun  8 02:16:03 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.30 2013/06/08 02:14:46 dholland Exp $	 */
+/* $NetBSD: dir.c,v 1.31 2013/06/08 02:16:03 dholland Exp $	 */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -35,10 +35,8 @@
 #include 
 #include 
 
-#include 
-#include 
-#include 
 #include 
+#include 
 
 #include 
 #include 

Index: src/sbin/fsck_lfs/inode.c
diff -u src/sbin/fsck_lfs/inode.c:1.49 src/sbin/fsck_lfs/inode.c:1.50
--- src/sbin/fsck_lfs/inode.c:1.49	Sat Jun  8 02:14:46 2013
+++ src/sbin/fsck_lfs/inode.c	Sat Jun  8 02:16:03 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: inode.c,v 1.49 2013/06/08 02:14:46 dholland Exp $	 */
+/* $NetBSD: inode.c,v 1.50 2013/06/08 02:16:03 dholland Exp $	 */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -65,10 +65,8 @@
 #include 
 
 #define vnode uvnode
-#define _SYS_VNODE_H_ /* XXX */
-#include 
-#include 
 #include 
+#include 
 #undef vnode
 
 #include 

Index: src/sbin/fsck_lfs/lfs.c
diff -u src/sbin/fsck_lfs/lfs.c:1.38 src/sbin/fsck_lfs/lfs.c:1.39
--- src/sbin/fsck_lfs/lfs.c:1.38	Thu Jun  6 00:54:49 2013
+++ src/sbin/fsck_lfs/lfs.c	Sat Jun  8 02:16:03 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs.c,v 1.38 2013/06/06 00:54:49 dholland Exp $ */
+/* $NetBSD: lfs.c,v 1.39 2013/06/08 02:16:03 dholland Exp $ */
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -71,10 +71,8 @@
 #include 
 
 #define vnode uvnode
-#define _SYS_VNODE_H_ /* XXX */
-#include 
-#include 
 #include 
+#include 
 #undef vnode
 
 #include 

Index: src/sbin/fsck_lfs/main.c
diff -u src/sbin/fsck_lf

CVS commit: src/sys/net

2013-06-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jun  8 02:42:56 UTC 2013

Modified Files:
src/sys/net: route.c

Log Message:
PR/44032: Proxy entries stopped working with pppd. The issue here is that
the route entry was added, but the RTF_LLINFO bit was not set, making arp -a
not showing the entry, but netstat -rn -f inet showing it with the missing
L bit. The order of resolution in ifa_ifwithroute() is that if a destination
address is found, then the interface chosen for the route is that of the
destination. This does not work for link-level addresses since the ppp
interface does not arp (uses link_rtrequest, not arp_rtrequest), so the
bit is never set. The easy solution here is to check that the gateway is
a link address, and use the interface which we chose for the link address
as opposed to the interface that routes to the destination. This restores
the previous behavior, but is it correct?


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/net/route.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/net/route.c
diff -u src/sys/net/route.c:1.126 src/sys/net/route.c:1.127
--- src/sys/net/route.c:1.126	Mon Jan 30 15:01:08 2012
+++ src/sys/net/route.c	Fri Jun  7 22:42:56 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: route.c,v 1.126 2012/01/30 20:01:08 christos Exp $	*/
+/*	$NetBSD: route.c,v 1.127 2013/06/08 02:42:56 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -93,7 +93,7 @@
 #include "opt_route.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.126 2012/01/30 20:01:08 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.127 2013/06/08 02:42:56 christos Exp $");
 
 #include 
 #include 
@@ -594,7 +594,7 @@ ifa_ifwithroute(int flags, const struct 
 		 * we can use the local address.
 		 */
 		ifa = NULL;
-		if (flags & RTF_HOST)
+		if ((flags & RTF_HOST) && gateway->sa_family != AF_LINK)
 			ifa = ifa_ifwithdstaddr(dst);
 		if (ifa == NULL)
 			ifa = ifa_ifwithaddr(gateway);
@@ -619,7 +619,7 @@ ifa_ifwithroute(int flags, const struct 
 	if (ifa->ifa_addr->sa_family != dst->sa_family) {
 		struct ifaddr *oifa = ifa;
 		ifa = ifaof_ifpforaddr(dst, ifa->ifa_ifp);
-		if (ifa == 0)
+		if (ifa == NULL)
 			ifa = oifa;
 	}
 	return ifa;



CVS commit: src/sys/arch/i386/conf

2013-06-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Jun  8 02:43:10 UTC 2013

Modified Files:
src/sys/arch/i386/conf: ALL

Log Message:
Add the new LFS options.


To generate a diff of this commit:
cvs rdiff -u -r1.358 -r1.359 src/sys/arch/i386/conf/ALL

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/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.358 src/sys/arch/i386/conf/ALL:1.359
--- src/sys/arch/i386/conf/ALL:1.358	Wed Jun  5 23:08:01 2013
+++ src/sys/arch/i386/conf/ALL	Sat Jun  8 02:43:10 2013
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.358 2013/06/05 23:08:01 christos Exp $
+# $NetBSD: ALL,v 1.359 2013/06/08 02:43:10 dholland Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"ALL-$Revision: 1.358 $"
+#ident 		"ALL-$Revision: 1.359 $"
 
 maxusers	64		# estimated number of users
 
@@ -200,6 +200,12 @@ options 	FFS_EI		# FFS Endian Independen
 options 	WAPBL		# File system journaling support
 options 	UFS_DIRHASH	# UFS Large Directory Hashing - Experimental
 options 	UFS_EXTATTR
+options 	LFS_EI		# LFS endian-independent support - experimental
+options 	LFS_DIRHASH	# LFS version of UFS_DIRHASH - experimental
+options 	LFS_EXTATTR	# extended attributes for LFS - experimental
+options 	LFS_EXTATTR_AUTOSTART	# like UFS_EXTATTR_AUTOSTART
+options 	LFS_QUOTA	# quotas for LFS - experimental
+options 	LFS_QUOTA2	# new-style quotas for LFS - experimental
 options 	NFSSERVER	# Network File System server
 options 	FFS_NO_SNAPSHOT	# No FFS snapshot support
 options 	EXT2FS_SYSTEM_FLAGS # makes ext2fs file flags (append and



CVS commit: src/sys

2013-06-07 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sat Jun  8 03:26:05 UTC 2013

Modified Files:
src/sys/netinet: ip_output.c
src/sys/netipsec: ipsec.c ipsec.h

Log Message:
Split IPSec logic from ip_output() into a separate routine - ipsec4_output().
No change to the mechanism intended.  Tested by christos@.


To generate a diff of this commit:
cvs rdiff -u -r1.220 -r1.221 src/sys/netinet/ip_output.c
cvs rdiff -u -r1.58 -r1.59 src/sys/netipsec/ipsec.c
cvs rdiff -u -r1.32 -r1.33 src/sys/netipsec/ipsec.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/netinet/ip_output.c
diff -u src/sys/netinet/ip_output.c:1.220 src/sys/netinet/ip_output.c:1.221
--- src/sys/netinet/ip_output.c:1.220	Wed Jun  5 19:01:26 2013
+++ src/sys/netinet/ip_output.c	Sat Jun  8 03:26:05 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.220 2013/06/05 19:01:26 christos Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.221 2013/06/08 03:26:05 rmind Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.220 2013/06/05 19:01:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.221 2013/06/08 03:26:05 rmind Exp $");
 
 #include "opt_pfil_hooks.h"
 #include "opt_inet.h"
@@ -132,12 +132,8 @@ __KERNEL_RCSID(0, "$NetBSD: ip_output.c,
 #include 
 #endif
 
-#ifdef IPSEC
 #include 
 #include 
-#include 
-#endif	/* IPSEC*/
-
 
 static struct mbuf *ip_insertoptions(struct mbuf *, struct mbuf *, int *);
 static struct ifnet *ip_multicast_if(struct in_addr *, int *);
@@ -171,18 +167,14 @@ ip_output(struct mbuf *m0, ...)
 	struct ifaddr *xifa;
 	struct mbuf *opt;
 	struct route *ro;
-	int flags, sw_csum;
-	int *mtu_p;
+	int flags, sw_csum, *mtu_p;
 	u_long mtu;
 	struct ip_moptions *imo;
 	struct socket *so;
 	va_list ap;
-	int natt_frag = 0;
-#ifdef IPSEC
-	struct inpcb *inp;
 	struct secpolicy *sp = NULL;
-	int s;
-#endif
+	bool natt_frag = false;
+	bool __unused done = false;
 	union {
 		struct sockaddr		dst;
 		struct sockaddr_in	dst4;
@@ -205,12 +197,6 @@ ip_output(struct mbuf *m0, ...)
 	va_end(ap);
 
 	MCLAIM(m, &ip_tx_mowner);
-#ifdef IPSEC
-	if (so != NULL && so->so_proto->pr_domain->dom_family == AF_INET)
-		inp = (struct inpcb *)so->so_pcb;
-	else
-		inp = NULL;
-#endif /* IPSEC */
 
 #ifdef	DIAGNOSTIC
 	if ((m->m_flags & M_PKTHDR) == 0)
@@ -488,94 +474,12 @@ sendit:
 		ip->ip_off |= htons(IP_DF);
 
 #ifdef IPSEC
-	/*
-	 * Check the security policy (SP) for the packet and, if
-	 * required, do IPsec-related processing.  There are two
-	 * cases here; the first time a packet is sent through
-	 * it will be untagged and handled by ipsec4_checkpolicy.
-	 * If the packet is resubmitted to ip_output (e.g. after
-	 * AH, ESP, etc. processing), there will be a tag to bypass
-	 * the lookup and related policy checking.
-	 */
-	if (!ipsec_outdone(m)) {
-		s = splsoftnet();
-		if (inp != NULL &&
-		IPSEC_PCB_SKIP_IPSEC(inp->inp_sp, IPSEC_DIR_OUTBOUND)) {
-			splx(s);
-			goto spd_done;
-		}
-		sp = ipsec4_checkpolicy(m, IPSEC_DIR_OUTBOUND, flags,
-&error, inp);
-		/*
-		 * There are four return cases:
-		 *sp != NULL	 	apply IPsec policy
-		 *sp == NULL, error == 0	no IPsec handling needed
-		 *sp == NULL, error == -EINVAL  discard packet w/o error
-		 *sp == NULL, error != 0	discard packet, report error
-		 */
-		if (sp != NULL) {
-			/*
-			 * NAT-T ESP fragmentation: don't do IPSec processing
-			 * now, we'll do it on each fragmented packet.
-			 */
-			if (sp->req->sav && (sp->req->sav->natt_type &
-			(UDP_ENCAP_ESPINUDP|UDP_ENCAP_ESPINUDP_NON_IKE))) {
-if (ntohs(ip->ip_len) > sp->req->sav->esp_frag)
-{
-	natt_frag = 1;
-	mtu = sp->req->sav->esp_frag;
-	splx(s);
-	goto spd_done;
-}
-			}
-
-			/*
-			 * Do delayed checksums now because we send before
-			 * this is done in the normal processing path.
-			 */
-			if (m->m_pkthdr.csum_flags & (M_CSUM_TCPv4|M_CSUM_UDPv4)) {
-in_delayed_cksum(m);
-m->m_pkthdr.csum_flags &= ~(M_CSUM_TCPv4|M_CSUM_UDPv4);
-			}
-
-#ifdef __FreeBSD__
-			ip->ip_len = htons(ip->ip_len);
-			ip->ip_off = htons(ip->ip_off);
-#endif
-
-			/* NB: callee frees mbuf */
-			error = ipsec4_process_packet(m, sp->req, flags, 0);
-			/*
-			 * Preserve KAME behaviour: ENOENT can be returned
-			 * when an SA acquire is in progress.  Don't propagate
-			 * this to user-level; it confuses applications.
-			 *
-			 * XXX this will go away when the SADB is redone.
-			 */
-			if (error == ENOENT)
-error = 0;
-			splx(s);
-			goto done;
-		} else {
-			splx(s);
-
-			if (error != 0) {
-/*
- * Hack: -EINVAL is used to signal that a packet
- * should be silently discarded.  This is typically
- * because we asked key management for an SA and
- * it was delayed (e.g. kicked up to IKE).
- */
-if (error == -EINVAL)
-		

CVS commit: src/sys/ufs/ufs

2013-06-07 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Sat Jun  8 05:47:02 UTC 2013

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

Log Message:
fix clearing of system-flags (schg, sappnd). clearing system flags is possible 
again
at securelevel < 1.
reviewed by christos@


To generate a diff of this commit:
cvs rdiff -u -r1.212 -r1.213 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.212 src/sys/ufs/ufs/ufs_vnops.c:1.213
--- src/sys/ufs/ufs/ufs_vnops.c:1.212	Mon Mar 18 19:35:48 2013
+++ src/sys/ufs/ufs/ufs_vnops.c	Sat Jun  8 05:47:02 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_vnops.c,v 1.212 2013/03/18 19:35:48 plunky Exp $	*/
+/*	$NetBSD: ufs_vnops.c,v 1.213 2013/06/08 05:47:02 kardel Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.212 2013/03/18 19:35:48 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.213 2013/06/08 05:47:02 kardel Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -503,7 +503,7 @@ ufs_setattr(void *v)
 			action |= KAUTH_VNODE_HAS_SYSFLAGS;
 		}
 
-		if ((vap->va_flags & UF_SETTABLE) != vap->va_flags) {
+		if ((vap->va_flags & SF_SETTABLE) != (ip->i_flags & SF_SETTABLE)) {
 			action |= KAUTH_VNODE_WRITE_SYSFLAGS;
 			changing_sysflags = true;
 		}



CVS commit: src/lib/libc/sys

2013-06-07 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Sat Jun  8 06:05:03 UTC 2013

Modified Files:
src/lib/libc/sys: chflags.2

Log Message:
Bring description in sync with errors-section and implementation reality.
(changing super-user only flags is not silently ignored)


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/lib/libc/sys/chflags.2

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/sys/chflags.2
diff -u src/lib/libc/sys/chflags.2:1.27 src/lib/libc/sys/chflags.2:1.28
--- src/lib/libc/sys/chflags.2:1.27	Sat Aug  6 11:28:24 2011
+++ src/lib/libc/sys/chflags.2	Sat Jun  8 06:05:03 2013
@@ -1,4 +1,4 @@
-.\"	$NetBSD: chflags.2,v 1.27 2011/08/06 11:28:24 jruoho Exp $
+.\"	$NetBSD: chflags.2,v 1.28 2013/06/08 06:05:03 kardel Exp $
 .\"
 .\" Copyright (c) 1989, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -98,8 +98,6 @@ The
 and
 .Dv SF_APPEND
 flags may only be set or unset by the super-user.
-Attempts by the non-super-user to set the super-user only flags
-are silently ignored.
 These flags may be set at any time, but normally may only be unset when
 the system is in single-user mode.
 (See