CVS commit: src/sys/dev/usb

2012-01-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jan  9 10:57:35 UTC 2012

Modified Files:
src/sys/dev/usb: auvitek.c auvitek_dtv.c

Log Message:
make sure kernel lock is held when calling into usb stack


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/auvitek.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/usb/auvitek_dtv.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/usb/auvitek.c
diff -u src/sys/dev/usb/auvitek.c:1.7 src/sys/dev/usb/auvitek.c:1.8
--- src/sys/dev/usb/auvitek.c:1.7	Sun Oct  2 19:15:39 2011
+++ src/sys/dev/usb/auvitek.c	Mon Jan  9 10:57:34 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: auvitek.c,v 1.7 2011/10/02 19:15:39 jmcneill Exp $ */
+/* $NetBSD: auvitek.c,v 1.8 2012/01/09 10:57:34 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill jmcne...@invisible.ca
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: auvitek.c,v 1.7 2011/10/02 19:15:39 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: auvitek.c,v 1.8 2012/01/09 10:57:34 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -359,8 +359,11 @@ auvitek_read_1(struct auvitek_softc *sc,
 	USETW(req.wIndex, reg);
 	USETW(req.wLength, sizeof(data));
 
+	KERNEL_LOCK(1, curlwp);
 	err = usbd_do_request_flags(sc-sc_udev, req, data, 0,
 	actlen, USBD_DEFAULT_TIMEOUT);
+	KERNEL_UNLOCK_ONE(curlwp);
+
 	if (err)
 		printf(%s: read failed: %s\n, device_xname(sc-sc_dev),
 		usbd_errstr(err));
@@ -381,8 +384,11 @@ auvitek_write_1(struct auvitek_softc *sc
 	USETW(req.wIndex, reg);
 	USETW(req.wLength, 0);
 
+	KERNEL_LOCK(1, curlwp);
 	err = usbd_do_request_flags(sc-sc_udev, req, NULL, 0,
 	actlen, USBD_DEFAULT_TIMEOUT);
+	KERNEL_UNLOCK_ONE(curlwp);
+
 	if (err)
 		printf(%s: write failed: %s\n, device_xname(sc-sc_dev),
 		usbd_errstr(err));

Index: src/sys/dev/usb/auvitek_dtv.c
diff -u src/sys/dev/usb/auvitek_dtv.c:1.4 src/sys/dev/usb/auvitek_dtv.c:1.5
--- src/sys/dev/usb/auvitek_dtv.c:1.4	Sun Oct  2 19:15:40 2011
+++ src/sys/dev/usb/auvitek_dtv.c	Mon Jan  9 10:57:34 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: auvitek_dtv.c,v 1.4 2011/10/02 19:15:40 jmcneill Exp $ */
+/* $NetBSD: auvitek_dtv.c,v 1.5 2012/01/09 10:57:34 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: auvitek_dtv.c,v 1.4 2011/10/02 19:15:40 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: auvitek_dtv.c,v 1.5 2012/01/09 10:57:34 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -257,8 +257,11 @@ auvitek_dtv_init_pipes(struct auvitek_so
 {
 	usbd_status err;
 
+	KERNEL_LOCK(1, curlwp);
 	err = usbd_open_pipe(sc-sc_bulk_iface, sc-sc_ab.ab_endpt,
 	USBD_EXCLUSIVE_USE, sc-sc_ab.ab_pipe);
+	KERNEL_UNLOCK_ONE(curlwp);
+
 	if (err) {
 		aprint_error_dev(sc-sc_dev, couldn't open bulk-in pipe: %s\n,
 		usbd_errstr(err));
@@ -272,8 +275,10 @@ static int
 auvitek_dtv_close_pipes(struct auvitek_softc *sc)
 {
 	if (sc-sc_ab.ab_pipe != NULL) {
+		KERNEL_LOCK(1, curlwp);
 		usbd_abort_pipe(sc-sc_ab.ab_pipe);
 		usbd_close_pipe(sc-sc_ab.ab_pipe);
+		KERNEL_UNLOCK_ONE(curlwp);
 		sc-sc_ab.ab_pipe = NULL;
 	}
 
@@ -348,7 +353,11 @@ auvitek_dtv_bulk_start1(struct auvitek_b
 	//USBD_SHORT_XFER_OK|USBD_NO_COPY, USBD_NO_TIMEOUT,
 	USBD_NO_COPY, 100,
 	auvitek_dtv_bulk_cb);
+
+	KERNEL_LOCK(1, curlwp);
 	err = usbd_transfer(bx-bx_xfer);
+	KERNEL_UNLOCK_ONE(curlwp);
+
 	if (err != USBD_IN_PROGRESS) {
 		aprint_error_dev(sc-sc_dev, USB error: %s\n,
 		usbd_errstr(err));



CVS commit: src/sys/dev/usb

2012-01-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jan  9 11:02:19 UTC 2012

Modified Files:
src/sys/dev/usb: emdtv.c emdtv_dtv.c

Log Message:
make sure kernel lock is held when calling into usb stack


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/usb/emdtv.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/emdtv_dtv.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/usb/emdtv.c
diff -u src/sys/dev/usb/emdtv.c:1.6 src/sys/dev/usb/emdtv.c:1.7
--- src/sys/dev/usb/emdtv.c:1.6	Fri Dec 23 00:51:43 2011
+++ src/sys/dev/usb/emdtv.c	Mon Jan  9 11:02:18 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: emdtv.c,v 1.6 2011/12/23 00:51:43 jakllsch Exp $ */
+/* $NetBSD: emdtv.c,v 1.7 2012/01/09 11:02:18 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2008, 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: emdtv.c,v 1.6 2011/12/23 00:51:43 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: emdtv.c,v 1.7 2012/01/09 11:02:18 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -319,7 +319,10 @@ emdtv_read_multi_1(struct emdtv_softc *s
 	USETW(request.wIndex, index);
 	USETW(request.wLength, count);
 
+	KERNEL_LOCK(1, curlwp);
 	status = usbd_do_request(sc-sc_udev, request, datap);
+	KERNEL_UNLOCK_ONE(curlwp);
+
 	if (status != USBD_NORMAL_COMPLETION)
 		aprint_error_dev(sc-sc_dev, couldn't read %x/%x: %s\n,
 		req, index, usbd_errstr(status));
@@ -347,7 +350,10 @@ emdtv_write_multi_1(struct emdtv_softc *
 	USETW(request.wIndex, index);
 	USETW(request.wLength, count);
 
+	KERNEL_LOCK(1, curlwp);
 	status = usbd_do_request(sc-sc_udev, request, __UNCONST(datap));
+	KERNEL_UNLOCK_ONE(curlwp);
+
 	if (status != USBD_NORMAL_COMPLETION)
 		aprint_error_dev(sc-sc_dev, couldn't read %x/%x: %s\n,
 		req, index, usbd_errstr(status));

Index: src/sys/dev/usb/emdtv_dtv.c
diff -u src/sys/dev/usb/emdtv_dtv.c:1.7 src/sys/dev/usb/emdtv_dtv.c:1.8
--- src/sys/dev/usb/emdtv_dtv.c:1.7	Fri Dec 23 00:51:43 2011
+++ src/sys/dev/usb/emdtv_dtv.c	Mon Jan  9 11:02:18 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: emdtv_dtv.c,v 1.7 2011/12/23 00:51:43 jakllsch Exp $ */
+/* $NetBSD: emdtv_dtv.c,v 1.8 2012/01/09 11:02:18 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2008, 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: emdtv_dtv.c,v 1.7 2011/12/23 00:51:43 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: emdtv_dtv.c,v 1.8 2012/01/09 11:02:18 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -306,6 +306,7 @@ emdtv_dtv_start_transfer(void *priv,
 	aprint_debug_dev(sc-sc_dev, allocating isoc xfers (pktsz %d)\n,
 	sc-sc_isoc_maxpacketsize);
 
+	KERNEL_LOCK(1, curlwp);
 	for (i = 0; i  EMDTV_NXFERS; i++) {
 		sc-sc_ix[i].ix_xfer = usbd_alloc_xfer(sc-sc_udev);
 		sc-sc_ix[i].ix_buf = usbd_alloc_buffer(sc-sc_ix[i].ix_xfer,
@@ -313,6 +314,7 @@ emdtv_dtv_start_transfer(void *priv,
 		aprint_debug_dev(sc-sc_dev,   ix[%d] xfer %p buf %p\n,
 		i, sc-sc_ix[i].ix_xfer, sc-sc_ix[i].ix_buf);
 	}
+	KERNEL_UNLOCK_ONE(curlwp);
 
 	aprint_debug_dev(sc-sc_dev, starting isoc transactions\n);
 
@@ -332,6 +334,7 @@ emdtv_dtv_stop_transfer(void *priv)
 
 	sc-sc_streaming = false;
 
+	KERNEL_LOCK(1, curlwp);
 	if (sc-sc_isoc_pipe != NULL)
 		usbd_abort_pipe(sc-sc_isoc_pipe);
 
@@ -341,6 +344,7 @@ emdtv_dtv_stop_transfer(void *priv)
 			sc-sc_ix[i].ix_xfer = NULL;
 			sc-sc_ix[i].ix_buf = NULL;
 		}
+	KERNEL_UNLOCK_ONE(curlwp);
 
 	sc-sc_dtvsubmitcb = NULL;
 	sc-sc_dtvsubmitarg = NULL;
@@ -378,7 +382,10 @@ emdtv_dtv_isoc_start(struct emdtv_softc 
 			 EMDTV_NFRAMES,
 			 USBD_NO_COPY | USBD_SHORT_XFER_OK,
 			 emdtv_dtv_isoc);
+
+	KERNEL_LOCK(1, curlwp);
 	usbd_transfer(ix-ix_xfer);
+	KERNEL_UNLOCK_ONE(curlwp);
 
 	return 0;
 }



CVS commit: src/external/public-domain/sqlite/dist

2012-01-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan  9 11:20:21 UTC 2012

Modified Files:
src/external/public-domain/sqlite/dist: sqlite3.c

Log Message:
When aggregate-allocating an index structure make sure to provide at least
natural alignement for pointers.
This makes firefox 3.6 work again on sparc64.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/public-domain/sqlite/dist/sqlite3.c

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

Modified files:

Index: src/external/public-domain/sqlite/dist/sqlite3.c
diff -u src/external/public-domain/sqlite/dist/sqlite3.c:1.2 src/external/public-domain/sqlite/dist/sqlite3.c:1.3
--- src/external/public-domain/sqlite/dist/sqlite3.c:1.2	Wed Nov  2 23:19:48 2011
+++ src/external/public-domain/sqlite/dist/sqlite3.c	Mon Jan  9 11:20:20 2012
@@ -81883,7 +81883,8 @@ SQLITE_PRIVATE Index *sqlite3CreateIndex
   Token *pName = 0;/* Unqualified name of the index to create */
   struct ExprList_item *pListItem; /* For looping over pList */
   int nCol;
-  int nExtra = 0;
+  int nExtra = 0, nPad = 0;
+  size_t nOff;
   char *zExtra;
 
   assert( pStart==0 || pEnd!=0 ); /* pEnd must be non-NULL if pStart is */
@@ -82053,6 +82054,8 @@ SQLITE_PRIVATE Index *sqlite3CreateIndex
   */
   nName = sqlite3Strlen30(zName);
   nCol = pList-nExpr;
+  nOff = sizeof(*pIndex)+sizeof(tRowcnt)*(nCol+1);
+  nPad = ((nOff + (sizeof(char*)-1))  ~ (sizeof(char*)-1)) - nOff;
   pIndex = sqlite3DbMallocZero(db, 
   sizeof(Index) +  /* Index structure  */
   sizeof(tRowcnt)*(nCol+1) +   /* Index.aiRowEst   */
@@ -82060,13 +82063,14 @@ SQLITE_PRIVATE Index *sqlite3CreateIndex
   sizeof(char *)*nCol +/* Index.azColl */
   sizeof(u8)*nCol +/* Index.aSortOrder */
   nName + 1 +  /* Index.zName  */
-  nExtra   /* Collation sequence names */
+  nExtra + /* Collation sequence names */
+  nPad
   );
   if( db-mallocFailed ){
 goto exit_create_index;
   }
   pIndex-aiRowEst = (tRowcnt*)(pIndex[1]);
-  pIndex-azColl = (char**)(pIndex-aiRowEst[nCol+1]);
+  pIndex-azColl = (char**)((char*)(pIndex-aiRowEst[nCol+1])+nPad);
   pIndex-aiColumn = (int *)(pIndex-azColl[nCol]);
   pIndex-aSortOrder = (u8 *)(pIndex-aiColumn[nCol]);
   pIndex-zName = (char *)(pIndex-aSortOrder[nCol]);
@@ -130641,7 +130645,7 @@ SQLITE_API int sqlite3_extension_init(
 **May you share freely, never taking more than you give.
 **
 *
-** $Id: sqlite3.c,v 1.2 2011/11/02 23:19:48 christos Exp $
+** $Id: sqlite3.c,v 1.3 2012/01/09 11:20:20 martin Exp $
 **
 ** This file implements an integration between the ICU library 
 ** (International Components for Unicode, an open-source library 



CVS commit: src/usr.sbin/installboot/arch

2012-01-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan  9 11:44:54 UTC 2012

Modified Files:
src/usr.sbin/installboot/arch: hp700.c

Log Message:
Make it an error for the partition to exceed the PDC limit.

Inspired by PR/45742


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/installboot/arch/hp700.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/installboot/arch/hp700.c
diff -u src/usr.sbin/installboot/arch/hp700.c:1.4 src/usr.sbin/installboot/arch/hp700.c:1.5
--- src/usr.sbin/installboot/arch/hp700.c:1.4	Mon Apr 28 20:24:16 2008
+++ src/usr.sbin/installboot/arch/hp700.c	Mon Jan  9 11:44:53 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: hp700.c,v 1.4 2008/04/28 20:24:16 martin Exp $	*/
+/*	$NetBSD: hp700.c,v 1.5 2012/01/09 11:44:53 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include sys/cdefs.h
 #if !defined(__lint)
-__RCSID($NetBSD: hp700.c,v 1.4 2008/04/28 20:24:16 martin Exp $);
+__RCSID($NetBSD: hp700.c,v 1.5 2012/01/09 11:44:53 skrll Exp $);
 #endif	/* !__lint */
 
 /* We need the target disklabel.h, not the hosts one. */
@@ -178,9 +178,10 @@ hp700_setboot(ib_params *params)
 	} else if (be32toh(label.l.d_partitions[0].p_offset) +
 	be32toh(label.l.d_partitions[0].p_size) 
 	((unsigned)2*1024*1024*1024) / secsize) {
-		warnx(WARNING: Partition `a' of `%s' exceeds 2GB boundary.,
+		warnx(Partition `a' of `%s' exceeds 2GB boundary.,
 		params-filesystem);
-		warnx(WARNING: It won't boot since hp700 PDC can handle only 2GB.);
+		warnx(It won't boot since hp700 PDC can handle only 2GB.);
+		goto done;
 	}
 
 	/* read boot loader */



CVS commit: src/distrib/utils/sysinst/arch/hp700

2012-01-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan  9 11:51:41 UTC 2012

Modified Files:
src/distrib/utils/sysinst/arch/hp700: md.c msg.md.de msg.md.en
msg.md.es msg.md.fr msg.md.pl

Log Message:
Error if the root partition exceeds the PDC 2GB limit. The check now
catches invalid existing partitions. PR/45742

Thanks to martin for the German translation. The others are all my fault.

Thanks to mrg for comments


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/distrib/utils/sysinst/arch/hp700/md.c
cvs rdiff -u -r1.5 -r1.6 src/distrib/utils/sysinst/arch/hp700/msg.md.de \
src/distrib/utils/sysinst/arch/hp700/msg.md.en \
src/distrib/utils/sysinst/arch/hp700/msg.md.es \
src/distrib/utils/sysinst/arch/hp700/msg.md.pl
cvs rdiff -u -r1.6 -r1.7 src/distrib/utils/sysinst/arch/hp700/msg.md.fr

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

Modified files:

Index: src/distrib/utils/sysinst/arch/hp700/md.c
diff -u src/distrib/utils/sysinst/arch/hp700/md.c:1.13 src/distrib/utils/sysinst/arch/hp700/md.c:1.14
--- src/distrib/utils/sysinst/arch/hp700/md.c:1.13	Thu Jan  5 21:32:36 2012
+++ src/distrib/utils/sysinst/arch/hp700/md.c	Mon Jan  9 11:51:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.13 2012/01/05 21:32:36 christos Exp $	*/
+/*	$NetBSD: md.c,v 1.14 2012/01/09 11:51:41 skrll Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -50,6 +50,8 @@
 #include msg_defs.h
 #include menu_defs.h
 
+#define HP700_PDC_LIMIT	((unsigned)2*1024*1024*1024)
+
 void
 md_init(void)
 {
@@ -108,7 +110,7 @@ md_get_info(void)
 	/*
 	 * hp700 PDC can only address up to 2GB.
 	 */
-	root_limit = ((unsigned)2*1024*1024*1024) / (unsigned)sectorsize;
+	root_limit = HP700_PDC_LIMIT / (unsigned)sectorsize;
 
 	return 1;
 }
@@ -128,6 +130,23 @@ md_make_bsd_partitions(void)
 int
 md_check_partitions(void)
 {
+	/* Check the root partition is sane. */
+	uint32_t limit = HP700_PDC_LIMIT / (unsigned)sectorsize;
+	int part;
+
+	for (part = PART_A; part  MAXPARTITIONS; part++) {
+		if (strcmp(bsdlabel[part].pi_mount, /) == 0) {
+			uint32_t offset = bsdlabel[part].pi_offset;
+			uint32_t size = bsdlabel[part].pi_size;
+
+			if (offset  limit || offset + size  limit) {
+msg_display(MSG_md_pdclimit);
+process_menu(MENU_ok, NULL);
+return 0;
+			}
+		}
+	}
+
 	return 1;
 }
 

Index: src/distrib/utils/sysinst/arch/hp700/msg.md.de
diff -u src/distrib/utils/sysinst/arch/hp700/msg.md.de:1.5 src/distrib/utils/sysinst/arch/hp700/msg.md.de:1.6
--- src/distrib/utils/sysinst/arch/hp700/msg.md.de:1.5	Mon Apr  4 08:30:29 2011
+++ src/distrib/utils/sysinst/arch/hp700/msg.md.de	Mon Jan  9 11:51:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.md.de,v 1.5 2011/04/04 08:30:29 mbalmer Exp $	*/
+/*	$NetBSD: msg.md.de,v 1.6 2012/01/09 11:51:41 skrll Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -50,3 +50,6 @@ message dobootblks
 
 message set_kernel_1
 {Kernel (GENERIC)}
+
+message md_pdclimit
+{Die Root-Partition überschreitet die PDC Grenze von 2GB}
Index: src/distrib/utils/sysinst/arch/hp700/msg.md.en
diff -u src/distrib/utils/sysinst/arch/hp700/msg.md.en:1.5 src/distrib/utils/sysinst/arch/hp700/msg.md.en:1.6
--- src/distrib/utils/sysinst/arch/hp700/msg.md.en:1.5	Mon Apr  4 08:30:29 2011
+++ src/distrib/utils/sysinst/arch/hp700/msg.md.en	Mon Jan  9 11:51:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.md.en,v 1.5 2011/04/04 08:30:29 mbalmer Exp $	*/
+/*	$NetBSD: msg.md.en,v 1.6 2012/01/09 11:51:41 skrll Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -50,3 +50,6 @@ message dobootblks
 
 message set_kernel_1
 {Kernel (GENERIC)}
+
+message md_pdclimit
+{The root partition extends beyond the PDC limit of 2GB}
Index: src/distrib/utils/sysinst/arch/hp700/msg.md.es
diff -u src/distrib/utils/sysinst/arch/hp700/msg.md.es:1.5 src/distrib/utils/sysinst/arch/hp700/msg.md.es:1.6
--- src/distrib/utils/sysinst/arch/hp700/msg.md.es:1.5	Mon Apr  4 08:30:29 2011
+++ src/distrib/utils/sysinst/arch/hp700/msg.md.es	Mon Jan  9 11:51:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.md.es,v 1.5 2011/04/04 08:30:29 mbalmer Exp $	*/
+/*	$NetBSD: msg.md.es,v 1.6 2012/01/09 11:51:41 skrll Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -50,3 +50,6 @@ message dobootblks
 
 message set_kernel_1
 {Kernel (GENERIC)}
+
+message md_pdclimit
+{La partición raíz se extiende más allá del límite de 2 GB PDC}
Index: src/distrib/utils/sysinst/arch/hp700/msg.md.pl
diff -u src/distrib/utils/sysinst/arch/hp700/msg.md.pl:1.5 src/distrib/utils/sysinst/arch/hp700/msg.md.pl:1.6
--- src/distrib/utils/sysinst/arch/hp700/msg.md.pl:1.5	Mon Apr  4 08:30:29 2011
+++ src/distrib/utils/sysinst/arch/hp700/msg.md.pl	Mon Jan  9 11:51:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.md.pl,v 1.5 2011/04/04 08:30:29 mbalmer Exp $	*/
+/*	$NetBSD: msg.md.pl,v 1.6 2012/01/09 11:51:41 skrll Exp $	*/
 /* Based on english version: */
 /*	

CVS commit: src/distrib/i386/ramdisks/ramdisk-big

2012-01-09 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Jan  9 11:52:43 UTC 2012

Modified Files:
src/distrib/i386/ramdisks/ramdisk-big: list

Log Message:
Add /sbin/dkctl. This allows you to drop to a command prompt and enable
writecaches before installing, if necessary.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/distrib/i386/ramdisks/ramdisk-big/list

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

Modified files:

Index: src/distrib/i386/ramdisks/ramdisk-big/list
diff -u src/distrib/i386/ramdisks/ramdisk-big/list:1.5 src/distrib/i386/ramdisks/ramdisk-big/list:1.6
--- src/distrib/i386/ramdisks/ramdisk-big/list:1.5	Sun Feb 13 04:14:58 2011
+++ src/distrib/i386/ramdisks/ramdisk-big/list	Mon Jan  9 11:52:43 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: list,v 1.5 2011/02/13 04:14:58 jym Exp $
+#	$NetBSD: list,v 1.6 2012/01/09 11:52:43 sborrill Exp $
 
 PROG	bin/chio
 PROG	bin/dd
@@ -10,6 +10,7 @@ PROG	bin/sync
 
 PROG	libexec/lfs_cleanerd
 
+PROG	sbin/dkctl
 PROG	sbin/fdisk
 PROG	sbin/mbrlabel
 PROG	sbin/mount_ext2fs



CVS commit: src/sys/arch

2012-01-09 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Mon Jan  9 12:58:49 UTC 2012

Modified Files:
src/sys/arch/x86/x86: pmap.c
src/sys/arch/xen/x86: xen_pmap.c

Log Message:
Harden cross-cpu L3 sync - avoid optimisations that may race.
Update ci-ci_kpm_pdir from user pmap, not global pmap_kernel() entry which may 
get clobbered by other CPUs.
XXX: Look into why we use pmap_kernel() userspace entries at all.


To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.153 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/xen/x86/xen_pmap.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/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.152 src/sys/arch/x86/x86/pmap.c:1.153
--- src/sys/arch/x86/x86/pmap.c:1.152	Mon Jan  9 04:55:35 2012
+++ src/sys/arch/x86/x86/pmap.c	Mon Jan  9 12:58:49 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.152 2012/01/09 04:55:35 cherry Exp $	*/
+/*	$NetBSD: pmap.c,v 1.153 2012/01/09 12:58:49 cherry Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.152 2012/01/09 04:55:35 cherry Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.153 2012/01/09 12:58:49 cherry Exp $);
 
 #include opt_user_ldt.h
 #include opt_lockdebug.h
@@ -1882,20 +1882,14 @@ pmap_free_ptp(struct pmap *pmap, struct 
 		 * If ptp is a L3 currently mapped in kernel space,
 		 * on any cpu, clear it before freeing
 		 */
-		struct cpu_info *ci;
-		CPU_INFO_ITERATOR cii;
+		if (level == PTP_LEVELS - 1) {
+			pmap_pte_set(pmap_kernel()-pm_pdir[index], 0);
+			/*
+			 * Update the per-cpu PD on all cpus the current
+			 * pmap is active on 
+			 */ 
+			xen_kpm_sync(pmap, index);
 
-		for (CPU_INFO_FOREACH(cii, ci)) {
-			if (pmap_pdirpa(pmap, 0) == ci-ci_xen_current_user_pgd
-			 level == PTP_LEVELS - 1) {
-pmap_pte_set(pmap_kernel()-pm_pdir[index], 0);
-/*
- * Update the per-cpu PD on all cpus the current
- * pmap is active on 
- */ 
-xen_kpm_sync(pmap, index);
-break;
-			}
 		}
 #  endif /*__x86_64__ */
 		invaladdr = level == 1 ? (vaddr_t)ptes :

Index: src/sys/arch/xen/x86/xen_pmap.c
diff -u src/sys/arch/xen/x86/xen_pmap.c:1.12 src/sys/arch/xen/x86/xen_pmap.c:1.13
--- src/sys/arch/xen/x86/xen_pmap.c:1.12	Fri Dec 30 16:55:21 2011
+++ src/sys/arch/xen/x86/xen_pmap.c	Mon Jan  9 12:58:49 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_pmap.c,v 1.12 2011/12/30 16:55:21 cherry Exp $	*/
+/*	$NetBSD: xen_pmap.c,v 1.13 2012/01/09 12:58:49 cherry Exp $	*/
 
 /*
  * Copyright (c) 2007 Manuel Bouyer.
@@ -102,7 +102,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xen_pmap.c,v 1.12 2011/12/30 16:55:21 cherry Exp $);
+__KERNEL_RCSID(0, $NetBSD: xen_pmap.c,v 1.13 2012/01/09 12:58:49 cherry Exp $);
 
 #include opt_user_ldt.h
 #include opt_lockdebug.h
@@ -576,6 +576,8 @@ pmap_kpm_sync_xcall(void *arg1, void *ar
 
 	struct pmap *pmap = arg1;
 	int index = *(int *)arg2;
+	KASSERT(pmap == pmap_kernel() || index  PDIR_SLOT_PTE);
+	
 	struct cpu_info *ci = xpq_cpu();
 
 	if (pmap == pmap_kernel()) {
@@ -596,7 +598,7 @@ pmap_kpm_sync_xcall(void *arg1, void *ar
 	}
 	
 	pmap_pte_set(ci-ci_kpm_pdir[index],
-	pmap_kernel()-pm_pdir[index]);
+	pmap-pm_pdir[index]);
 	pmap_pte_flush();
 #endif /* PAE || __x86_64__ */
 }
@@ -650,6 +652,7 @@ xen_kpm_sync(struct pmap *pmap, int inde
 #else /* MULTIPROCESSOR */
 #define CPU_IS_CURCPU(ci) __predict_true((ci) == curcpu())
 #endif /* MULTIPROCESSOR */
+#if 0 /* XXX: Race with remote pmap_load() */
 if (ci-ci_want_pmapload 
 !CPU_IS_CURCPU(ci)) {
 	/*
@@ -659,7 +662,7 @@ xen_kpm_sync(struct pmap *pmap, int inde
 	 */
 	continue;
 }
-
+#endif /* 0 */
 where = xc_unicast(XC_HIGHPRI, pmap_kpm_sync_xcall,
 pmap, index, ci);
 xc_wait(where);



CVS commit: src/sys/arch

2012-01-09 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Mon Jan  9 13:04:13 UTC 2012

Modified Files:
src/sys/arch/amd64/include: pmap.h
src/sys/arch/i386/include: pmap.h
src/sys/arch/xen/x86: x86_xpmap.c

Log Message:
Make cross-cpu pte access MP safe.
XXX: review cases of use of pmap_set_pte() vs direct use of 
xpq_queue_pte_update()


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/amd64/include/pmap.h
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/i386/include/pmap.h
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/xen/x86/x86_xpmap.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/amd64/include/pmap.h
diff -u src/sys/arch/amd64/include/pmap.h:1.28 src/sys/arch/amd64/include/pmap.h:1.29
--- src/sys/arch/amd64/include/pmap.h:1.28	Sun Nov  6 15:18:18 2011
+++ src/sys/arch/amd64/include/pmap.h	Mon Jan  9 13:04:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.28 2011/11/06 15:18:18 cherry Exp $	*/
+/*	$NetBSD: pmap.h,v 1.29 2012/01/09 13:04:13 cherry Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -263,6 +263,8 @@
 atomic_and_ulong((volatile unsigned long *)p, ~(b))
 #define pmap_pte_flush()		/* nothing */
 #else
+extern kmutex_t pte_lock;
+
 static __inline pt_entry_t
 pmap_pa2pte(paddr_t pa)
 {
@@ -277,54 +279,57 @@ pmap_pte2pa(pt_entry_t pte)
 static __inline void
 pmap_pte_set(pt_entry_t *pte, pt_entry_t npte)
 {
-	int s = splvm();
+	mutex_enter(pte_lock);
 	xpq_queue_pte_update(xpmap_ptetomach(pte), npte);
-	splx(s);
+	mutex_exit(pte_lock);
 }
 
 static __inline pt_entry_t
 pmap_pte_cas(volatile pt_entry_t *ptep, pt_entry_t o, pt_entry_t n)
 {
-	int s = splvm();
-
-	pt_entry_t opte = *ptep;
+	pt_entry_t opte;
 
+	mutex_enter(pte_lock);
+	opte = *ptep;
 	if (opte == o) {
 		xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(ptep)), n);
 		xpq_flush_queue();
 	}
-	splx(s);
+
+	mutex_exit(pte_lock);
 	return opte;
 }
 
 static __inline pt_entry_t
 pmap_pte_testset(volatile pt_entry_t *pte, pt_entry_t npte)
 {
-	int s = splvm();
-	pt_entry_t opte = *pte;
+	pt_entry_t opte;
+
+	mutex_enter(pte_lock);
+	opte = *pte;
 	xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)), npte);
 	xpq_flush_queue();
-	splx(s);
+	mutex_exit(pte_lock);
 	return opte;
 }
 
 static __inline void
 pmap_pte_setbits(volatile pt_entry_t *pte, pt_entry_t bits)
 {
-	int s = splvm();
+	mutex_enter(pte_lock);
 	xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)), (*pte) | bits);
 	xpq_flush_queue();
-	splx(s);
+	mutex_exit(pte_lock);
 }
 
 static __inline void
 pmap_pte_clearbits(volatile pt_entry_t *pte, pt_entry_t bits)
 {	
-	int s = splvm();
+	mutex_enter(pte_lock);
 	xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)),
 	(*pte)  ~bits);
 	xpq_flush_queue();
-	splx(s);
+	mutex_exit(pte_lock);
 }
 
 static __inline void

Index: src/sys/arch/i386/include/pmap.h
diff -u src/sys/arch/i386/include/pmap.h:1.112 src/sys/arch/i386/include/pmap.h:1.113
--- src/sys/arch/i386/include/pmap.h:1.112	Sun Nov  6 15:18:18 2011
+++ src/sys/arch/i386/include/pmap.h	Mon Jan  9 13:04:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.112 2011/11/06 15:18:18 cherry Exp $	*/
+/*	$NetBSD: pmap.h,v 1.113 2012/01/09 13:04:13 cherry Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -354,6 +354,8 @@
 #endif /* PAE */
 
 #else /* XEN */
+extern kmutex_t pte_lock;
+
 static __inline pt_entry_t
 pmap_pa2pte(paddr_t pa)
 {
@@ -368,54 +370,57 @@ pmap_pte2pa(pt_entry_t pte)
 static __inline void
 pmap_pte_set(pt_entry_t *pte, pt_entry_t npte)
 {
-	int s = splvm();
+	mutex_enter(pte_lock);
 	xpq_queue_pte_update(xpmap_ptetomach(pte), npte);
-	splx(s);
+	mutex_exit(pte_lock);
 }
 
 static __inline pt_entry_t
 pmap_pte_cas(volatile pt_entry_t *ptep, pt_entry_t o, pt_entry_t n)
 {
-	int s = splvm();
-	pt_entry_t opte = *ptep;
+	pt_entry_t opte;
 
+	mutex_enter(pte_lock);
+	opte = *ptep;
 	if (opte == o) {
 		xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(ptep)), n);
 		xpq_flush_queue();
 	}
-	splx(s);
+	mutex_exit(pte_lock);
 	return opte;
 }
 
 static __inline pt_entry_t
 pmap_pte_testset(volatile pt_entry_t *pte, pt_entry_t npte)
 {
-	int s = splvm();
-	pt_entry_t opte = *pte;
+	pt_entry_t opte;
+
+	mutex_enter(pte_lock);
+	opte = *pte;
 	xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)),
 	npte);
 	xpq_flush_queue();
-	splx(s);
+	mutex_exit(pte_lock);
 	return opte;
 }
 
 static __inline void
 pmap_pte_setbits(volatile pt_entry_t *pte, pt_entry_t bits)
 {
-	int s = splvm();
+	mutex_enter(pte_lock);
 	xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)), (*pte) | bits);
 	xpq_flush_queue();
-	splx(s);
+	mutex_exit(pte_lock);
 }
 
 static __inline void
 pmap_pte_clearbits(volatile pt_entry_t *pte, pt_entry_t bits)
 {	
-	int s = splvm();
+	mutex_enter(pte_lock);
 	xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)),
 	

CVS commit: src/sys/arch/xen/xen

2012-01-09 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Mon Jan  9 13:33:38 UTC 2012

Modified Files:
src/sys/arch/xen/xen: clock.c

Log Message:
Remove obsolete comment.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/xen/xen/clock.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/xen/xen/clock.c
diff -u src/sys/arch/xen/xen/clock.c:1.58 src/sys/arch/xen/xen/clock.c:1.59
--- src/sys/arch/xen/xen/clock.c:1.58	Wed Dec  7 15:47:43 2011
+++ src/sys/arch/xen/xen/clock.c	Mon Jan  9 13:33:38 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.58 2011/12/07 15:47:43 cegger Exp $	*/
+/*	$NetBSD: clock.c,v 1.59 2012/01/09 13:33:38 cherry Exp $	*/
 
 /*
  *
@@ -29,7 +29,7 @@
 #include opt_xen.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.58 2011/12/07 15:47:43 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.59 2012/01/09 13:33:38 cherry Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -395,7 +395,6 @@ sysctl_xen_timepush(SYSCTLFN_ARGS)
 #endif
 
 /* ARGSUSED */
-/* SMP note: Timecounter uses vcpu0's clock */
 u_int
 xen_get_timecount(struct timecounter *tc)
 {



CVS commit: src/sys/arch/xen/xen

2012-01-09 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Mon Jan  9 13:35:42 UTC 2012

Modified Files:
src/sys/arch/xen/xen: clock.c

Log Message:
Remove redundant use of curcpu().


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/xen/xen/clock.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/xen/xen/clock.c
diff -u src/sys/arch/xen/xen/clock.c:1.59 src/sys/arch/xen/xen/clock.c:1.60
--- src/sys/arch/xen/xen/clock.c:1.59	Mon Jan  9 13:33:38 2012
+++ src/sys/arch/xen/xen/clock.c	Mon Jan  9 13:35:42 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.59 2012/01/09 13:33:38 cherry Exp $	*/
+/*	$NetBSD: clock.c,v 1.60 2012/01/09 13:35:42 cherry Exp $	*/
 
 /*
  *
@@ -29,7 +29,7 @@
 #include opt_xen.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.59 2012/01/09 13:33:38 cherry Exp $);
+__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.60 2012/01/09 13:35:42 cherry Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -237,7 +237,7 @@ xen_wall_time(struct timespec *wt)
 		 * Under Xen3, shadow-ts is the wall time less system time
 		 * get_vcpu_time() will update shadow
 		 */
-		nsec = get_vcpu_time(curcpu());
+		nsec = get_vcpu_time(ci);
 		*wt = shadow-ts;
 		nsec += wt-tv_nsec;
 	} while (!time_values_up_to_date(ci));



CVS commit: src/sys/arch

2012-01-09 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Mon Jan  9 13:51:54 UTC 2012

Modified Files:
src/sys/arch: README

Log Message:
Changed description for sandpoint to reflect the focus on consumer NAS.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/README

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/README
diff -u src/sys/arch/README:1.56 src/sys/arch/README:1.57
--- src/sys/arch/README:1.56	Mon Oct 24 17:21:29 2011
+++ src/sys/arch/README	Mon Jan  9 13:51:54 2012
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.56 2011/10/24 17:21:29 christos Exp $
+$NetBSD: README,v 1.57 2012/01/09 13:51:54 phx Exp $
 
 acorn26	arm	2509	Acorn ARM2- and ARM3-based machines
 acorn32	arm	2008	Acorn computers Ltd. ARM 6/7/SA based machines
@@ -45,7 +45,7 @@ ofppc	powerpc,powerpc64	19980528	Open Fi
 pmax	mipsel,mips64el	19931012	Digital Equipment Corp. MIPS based machines
 prep	powerpc	2229	PowerPC Reference Platform machines
 rs6000	powerpc	20071217	MCA-based IBM RS/6000 wokstations
-sandpoint	powerpc	20010211	Motorola Sandpoint reference platform and DINK32 machines
+sandpoint	powerpc	20010211	Motorola Sandpoint based NAS systems
 sbmips	mipseb,mipsel,mips64eb,mips64el	20020306	Broadcom's SiByte processor evaluation boards
 sgimips	mipseb,mips64eb	2614	MIPS based Silicon Graphics machines
 shark	arm	19960131	Digital Network Appliance Reference Design (Shark)



CVS commit: src/sys/netinet

2012-01-09 Thread Liam J. Foy
Module Name:src
Committed By:   liamjfoy
Date:   Mon Jan  9 14:31:22 UTC 2012

Modified Files:
src/sys/netinet: igmp.c in_gif.c ip_icmp.c ip_input.c

Log Message:
check against NULL


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/netinet/igmp.c
cvs rdiff -u -r1.61 -r1.62 src/sys/netinet/in_gif.c
cvs rdiff -u -r1.127 -r1.128 src/sys/netinet/ip_icmp.c
cvs rdiff -u -r1.297 -r1.298 src/sys/netinet/ip_input.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/netinet/igmp.c
diff -u src/sys/netinet/igmp.c:1.52 src/sys/netinet/igmp.c:1.53
--- src/sys/netinet/igmp.c:1.52	Sun Jul 17 20:54:53 2011
+++ src/sys/netinet/igmp.c	Mon Jan  9 14:31:21 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: igmp.c,v 1.52 2011/07/17 20:54:53 joerg Exp $	*/
+/*	$NetBSD: igmp.c,v 1.53 2012/01/09 14:31:21 liamjfoy Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -40,7 +40,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: igmp.c,v 1.52 2011/07/17 20:54:53 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: igmp.c,v 1.53 2012/01/09 14:31:21 liamjfoy Exp $);
 
 #include opt_mrouting.h
 
@@ -191,7 +191,7 @@ igmp_input(struct mbuf *m, ...)
 	}
 	if (((m-m_flags  M_EXT)  (ip-ip_src.s_addr  IN_CLASSA_NET) == 0)
 	|| m-m_len  minlen) {
-		if ((m = m_pullup(m, minlen)) == 0) {
+		if ((m = m_pullup(m, minlen)) == NULL) {
 			IGMP_STATINC(IGMP_STAT_RCV_TOOSHORT);
 			return;
 		}

Index: src/sys/netinet/in_gif.c
diff -u src/sys/netinet/in_gif.c:1.61 src/sys/netinet/in_gif.c:1.62
--- src/sys/netinet/in_gif.c:1.61	Sun Jul 17 20:54:53 2011
+++ src/sys/netinet/in_gif.c	Mon Jan  9 14:31:22 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_gif.c,v 1.61 2011/07/17 20:54:53 joerg Exp $	*/
+/*	$NetBSD: in_gif.c,v 1.62 2012/01/09 14:31:22 liamjfoy Exp $	*/
 /*	$KAME: in_gif.c,v 1.66 2001/07/29 04:46:09 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: in_gif.c,v 1.61 2011/07/17 20:54:53 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: in_gif.c,v 1.62 2012/01/09 14:31:22 liamjfoy Exp $);
 
 #include opt_inet.h
 #include opt_iso.h
@@ -131,7 +131,7 @@ in_gif_output(struct ifnet *ifp, int fam
 		proto = IPPROTO_IPV6;
 		if (m-m_len  sizeof(*ip6)) {
 			m = m_pullup(m, sizeof(*ip6));
-			if (!m)
+			if (m == NULL)
 return ENOBUFS;
 		}
 		ip6 = mtod(m, const struct ip6_hdr *);

Index: src/sys/netinet/ip_icmp.c
diff -u src/sys/netinet/ip_icmp.c:1.127 src/sys/netinet/ip_icmp.c:1.128
--- src/sys/netinet/ip_icmp.c:1.127	Sat Dec 31 20:41:58 2011
+++ src/sys/netinet/ip_icmp.c	Mon Jan  9 14:31:22 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_icmp.c,v 1.127 2011/12/31 20:41:58 christos Exp $	*/
+/*	$NetBSD: ip_icmp.c,v 1.128 2012/01/09 14:31:22 liamjfoy Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -94,7 +94,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ip_icmp.c,v 1.127 2011/12/31 20:41:58 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: ip_icmp.c,v 1.128 2012/01/09 14:31:22 liamjfoy Exp $);
 
 #include opt_ipsec.h
 
@@ -425,7 +425,7 @@ icmp_input(struct mbuf *m, ...)
 		goto freeit;
 	}
 	i = hlen + min(icmplen, ICMP_ADVLENMIN);
-	if ((m-m_len  i || M_READONLY(m))  (m = m_pullup(m, i)) == 0) {
+	if ((m-m_len  i || M_READONLY(m))  (m = m_pullup(m, i)) == NULL) {
 		ICMP_STATINC(ICMP_STAT_TOOSHORT);
 		return;
 	}

Index: src/sys/netinet/ip_input.c
diff -u src/sys/netinet/ip_input.c:1.297 src/sys/netinet/ip_input.c:1.298
--- src/sys/netinet/ip_input.c:1.297	Mon Dec 19 11:59:56 2011
+++ src/sys/netinet/ip_input.c	Mon Jan  9 14:31:22 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_input.c,v 1.297 2011/12/19 11:59:56 drochner Exp $	*/
+/*	$NetBSD: ip_input.c,v 1.298 2012/01/09 14:31:22 liamjfoy Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ip_input.c,v 1.297 2011/12/19 11:59:56 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: ip_input.c,v 1.298 2012/01/09 14:31:22 liamjfoy Exp $);
 
 #include opt_inet.h
 #include opt_compat_netbsd.h
@@ -456,7 +456,7 @@ ip_input(struct mbuf *m)
 		goto bad;
 	}
 	if (hlen  m-m_len) {
-		if ((m = m_pullup(m, hlen)) == 0) {
+		if ((m = m_pullup(m, hlen)) == NULL) {
 			IP_STATINC(IP_STAT_BADHLEN);
 			return;
 		}



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

2012-01-09 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Jan  9 14:56:35 UTC 2012

Modified Files:
src/sys/arch/usermode/dev: ld_thunkbus.c

Log Message:
sizeof_t is allways =0 and the check for =0 thus allways is true and amd64
complains about this. This might explain the odd write errors that could
sometimes be reported. Those are/were probably a side effect of this.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/usermode/dev/ld_thunkbus.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/usermode/dev/ld_thunkbus.c
diff -u src/sys/arch/usermode/dev/ld_thunkbus.c:1.27 src/sys/arch/usermode/dev/ld_thunkbus.c:1.28
--- src/sys/arch/usermode/dev/ld_thunkbus.c:1.27	Fri Jan  6 20:40:51 2012
+++ src/sys/arch/usermode/dev/ld_thunkbus.c	Mon Jan  9 14:56:35 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ld_thunkbus.c,v 1.27 2012/01/06 20:40:51 reinoud Exp $ */
+/* $NetBSD: ld_thunkbus.c,v 1.28 2012/01/09 14:56:35 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.27 2012/01/06 20:40:51 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.28 2012/01/09 14:56:35 reinoud Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -149,7 +149,7 @@ ld_thunkbus_complete(void *arg)
 	struct ld_thunkbus_transfer *tt = sc-sc_tt;
 	struct buf *bp = tt-tt_bp;
 	off_t offset = bp-b_rawblkno * ld-sc_secsize;
-	size_t ret;
+	int64_t ret;
 
 	if (!sc-busy)
 		panic(%s: but not busy?\n, __func__);



CVS commit: src/sys/arch/usermode/usermode

2012-01-09 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Jan  9 14:58:15 UTC 2012

Modified Files:
src/sys/arch/usermode/usermode: pmap.c

Log Message:
As ppn is a uintptr_t, it can never be negative so the check is invalid.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/arch/usermode/usermode/pmap.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/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.98 src/sys/arch/usermode/usermode/pmap.c:1.99
--- src/sys/arch/usermode/usermode/pmap.c:1.98	Sat Jan  7 19:44:13 2012
+++ src/sys/arch/usermode/usermode/pmap.c	Mon Jan  9 14:58:15 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.98 2012/01/07 19:44:13 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.99 2012/01/09 14:58:15 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.98 2012/01/07 19:44:13 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.99 2012/01/09 14:58:15 reinoud Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -581,7 +581,6 @@ pv_get(pmap_t pmap, uintptr_t ppn, uintp
 
 	/* extra sanity */
 	assert(ppn  phys_npages);
-	assert(ppn = 0);
 
 	pv = pv_alloc();
 	if (pv == NULL)



CVS commit: src/sys/arch/hp700/hp700

2012-01-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan  9 15:15:40 UTC 2012

Modified Files:
src/sys/arch/hp700/hp700: mainbus.c

Log Message:
Avoid a warning in kernels w/o LCD support


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/hp700/hp700/mainbus.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/hp700/hp700/mainbus.c
diff -u src/sys/arch/hp700/hp700/mainbus.c:1.79 src/sys/arch/hp700/hp700/mainbus.c:1.80
--- src/sys/arch/hp700/hp700/mainbus.c:1.79	Wed Feb 23 08:27:17 2011
+++ src/sys/arch/hp700/hp700/mainbus.c	Mon Jan  9 15:15:40 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.79 2011/02/23 08:27:17 skrll Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.80 2012/01/09 15:15:40 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.79 2011/02/23 08:27:17 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.80 2012/01/09 15:15:40 martin Exp $);
 
 #include locators.h
 #include power.h
@@ -1359,7 +1359,9 @@ mbattach(device_t parent, device_t self,
 	struct mainbus_softc *sc = device_private(self);
 	struct confargs nca;
 	bus_space_handle_t ioh;
+#if NLCD  0
 	int err;
+#endif
 
 	sc-sc_dv = self;
 	mb_attached = 1;



CVS commit: src

2012-01-09 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Mon Jan  9 15:16:31 UTC 2012

Modified Files:
src/distrib/sets/lists/man: mi
src/share/man/man4: Makefile fast_ipsec.4 ipsec.4 options.4
src/sys/netinet6: files.ipsec
src/sys/netipsec: files.netipsec
Added Files:
src/share/man/man4: kame_ipsec.4

Log Message:
Make FAST_IPSEC the default IPSEC implementation which is built
into the kernel if the IPSEC kernel option is given.
The old implementation is still available as KAME_IPSEC.
Do some minimal manpage adjustment -- kame_ipsec(4) is a copy
of the old ipsec(4) and the latter is now a copy of fast_ipsec(4).


To generate a diff of this commit:
cvs rdiff -u -r1.1363 -r1.1364 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.576 -r1.577 src/share/man/man4/Makefile
cvs rdiff -u -r1.9 -r1.10 src/share/man/man4/fast_ipsec.4
cvs rdiff -u -r1.31 -r1.32 src/share/man/man4/ipsec.4
cvs rdiff -u -r0 -r1.1 src/share/man/man4/kame_ipsec.4
cvs rdiff -u -r1.409 -r1.410 src/share/man/man4/options.4
cvs rdiff -u -r1.7 -r1.8 src/sys/netinet6/files.ipsec
cvs rdiff -u -r1.8 -r1.9 src/sys/netipsec/files.netipsec

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/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1363 src/distrib/sets/lists/man/mi:1.1364
--- src/distrib/sets/lists/man/mi:1.1363	Wed Jan  4 16:25:15 2012
+++ src/distrib/sets/lists/man/mi	Mon Jan  9 15:16:30 2012
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1363 2012/01/04 16:25:15 yamt Exp $
+# $NetBSD: mi,v 1.1364 2012/01/09 15:16:30 drochner Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -1236,6 +1236,7 @@
 ./usr/share/man/cat4/jme.0			man-sys-catman		.cat
 ./usr/share/man/cat4/jmide.0			man-sys-catman		.cat
 ./usr/share/man/cat4/joy.0			man-sys-catman		.cat
+./usr/share/man/cat4/kame_ipsec.0		man-sys-catman		.cat
 ./usr/share/man/cat4/kloader.0			man-sys-catman		.cat
 ./usr/share/man/cat4/kse.0			man-sys-catman		.cat
 ./usr/share/man/cat4/ksyms.0			man-sys-catman		.cat
@@ -6719,6 +6720,7 @@
 ./usr/share/man/man4/jme.4			man-sys-man		.man
 ./usr/share/man/man4/jmide.4			man-sys-man		.man
 ./usr/share/man/man4/joy.4			man-sys-man		.man
+./usr/share/man/man4/kame_ipsec.4		man-sys-man		.man
 ./usr/share/man/man4/kloader.4			man-sys-man		.man
 ./usr/share/man/man4/kse.4			man-sys-man		.man
 ./usr/share/man/man4/ksyms.4			man-sys-man		.man

Index: src/share/man/man4/Makefile
diff -u src/share/man/man4/Makefile:1.576 src/share/man/man4/Makefile:1.577
--- src/share/man/man4/Makefile:1.576	Wed Jan  4 16:25:16 2012
+++ src/share/man/man4/Makefile	Mon Jan  9 15:16:31 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.576 2012/01/04 16:25:16 yamt Exp $
+#	$NetBSD: Makefile,v 1.577 2012/01/09 15:16:31 drochner Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 MAN=	aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -35,7 +35,7 @@ MAN=	aac.4 ac97.4 acardide.4 aceride.4 a
 	ioasic.4 ioat.4 iop.4 iophy.4 iopsp.4 ip.4 ipkdb.4 ipmi.4 ipw.4 \
 	irmce.4 iso.4 isp.4 isv.4 itesio.4 iteide.4 iwi.4 iwn.4 ixg.4 ixpide.4 \
 	jme.4 jmide.4 joy.4 \
-	kloader.4 kse.4 ksyms.4 kttcp.4 \
+	kame_ipsec.4 kloader.4 kse.4 ksyms.4 kttcp.4 \
 	lc.4 ld.4 lii.4 lo.4 lxtphy.4 \
 	mainbus.4 makphy.4 mbe.4 mca.4 mcclock.4 md.4 mfb.4 mfi.4 mhzc.4 \
 	midi.4 mii.4 mk48txx.4 mlx.4 mly.4 mpls.4 mpt.4 mpu.4 mtd.4 \

Index: src/share/man/man4/fast_ipsec.4
diff -u src/share/man/man4/fast_ipsec.4:1.9 src/share/man/man4/fast_ipsec.4:1.10
--- src/share/man/man4/fast_ipsec.4:1.9	Tue Sep 21 13:47:41 2010
+++ src/share/man/man4/fast_ipsec.4	Mon Jan  9 15:16:31 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: fast_ipsec.4,v 1.9 2010/09/21 13:47:41 degroote Exp $
+.\	$NetBSD: fast_ipsec.4,v 1.10 2012/01/09 15:16:31 drochner Exp $
 .\	$FreeBSD: fast_ipsec.4,v 1.2 2003/03/03 11:51:30 ru Exp $
 .\
 .\ Copyright (c) 2004
@@ -28,17 +28,16 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 .\ THE POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd April 24, 2007
+.Dd January 9, 2012
 .Dt FAST_IPSEC 4
 .Os
 .Sh NAME
 .Nm fast_ipsec
 .Nd Fast IPsec hardware-accelerated IP Security Protocols
 .Sh SYNOPSIS
-.Cd options FAST_IPSEC
+.Cd options IPSEC
 .Cd options IPSEC_DEBUG
 .Cd options IPSEC_NAT_T
-.Cd pseudo-device crypto
 .Sh DESCRIPTION
 .Tn IPsec
 is a set of protocols,

Index: src/share/man/man4/ipsec.4
diff -u src/share/man/man4/ipsec.4:1.31 src/share/man/man4/ipsec.4:1.32
--- src/share/man/man4/ipsec.4:1.31	Sun May 17 02:22:43 2009
+++ src/share/man/man4/ipsec.4	Mon Jan  9 15:16:31 2012
@@ -1,8 +1,11 @@
-.\	$NetBSD: ipsec.4,v 1.31 2009/05/17 02:22:43 fair Exp $
-.\	$KAME: ipsec.4,v 1.17 2001/06/27 15:25:10 itojun Exp $
+.\	$NetBSD: ipsec.4,v 1.32 2012/01/09 15:16:31 drochner Exp $
+.\	$FreeBSD: fast_ipsec.4,v 1.2 2003/03/03 11:51:30 ru Exp $
 .\
-.\ Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
-.\ All rights reserved.
+.\ Copyright (c) 2004
+.\	

CVS commit: src

2012-01-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan  9 15:19:45 UTC 2012

Modified Files:
src/distrib/sets/lists/comp: mi
src/include: Makefile
Added Files:
src/include: quota.h

Log Message:
Add quota.h with the new libquota API.

This is the user/application API and does not include the kernel
interface. Definitions shared with the kernel are found in
sys/quota.h.

Since I've been working on a local branch I have taken the liberty of
moving the latest-so-far version of quota.h to the front of the
patch queue. This loses (a small amount of) history but has the
advantage of avoiding unnecessary version bumps of libquota.so.


To generate a diff of this commit:
cvs rdiff -u -r1.1724 -r1.1725 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.136 -r1.137 src/include/Makefile
cvs rdiff -u -r0 -r1.1 src/include/quota.h

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.1724 src/distrib/sets/lists/comp/mi:1.1725
--- src/distrib/sets/lists/comp/mi:1.1724	Sat Jan  7 18:42:38 2012
+++ src/distrib/sets/lists/comp/mi	Mon Jan  9 15:19:44 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1724 2012/01/07 18:42:38 christos Exp $
+#	$NetBSD: mi,v 1.1725 2012/01/09 15:19:44 dholland Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -2213,6 +2213,7 @@
 ./usr/include/puffs.hcomp-puffs-include
 ./usr/include/puffsdump.h			comp-puffs-include
 ./usr/include/pwd.hcomp-c-include
+./usr/include/quota.hcomp-c-include
 ./usr/include/quota/quota.h			comp-c-include
 ./usr/include/quota/quotaprop.h			comp-c-include
 ./usr/include/radlib.hcomp-c-include

Index: src/include/Makefile
diff -u src/include/Makefile:1.136 src/include/Makefile:1.137
--- src/include/Makefile:1.136	Fri Aug 26 21:22:10 2011
+++ src/include/Makefile	Mon Jan  9 15:19:45 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.136 2011/08/26 21:22:10 dyoung Exp $
+#	$NetBSD: Makefile,v 1.137 2012/01/09 15:19:45 dholland Exp $
 #	@(#)Makefile	8.2 (Berkeley) 1/4/94
 
 # Doing a make includes builds /usr/include
@@ -16,7 +16,7 @@ INCS=	a.out.h aio.h ar.h assert.h atomic
 	login_cap.h lwp.h malloc.h math.h md2.h \
 	memory.h mntopts.h monetary.h mpool.h mqueue.h \
 	ndbm.h netconfig.h netdb.h netgroup.h nlist.h nl_types.h nsswitch.h \
-	paths.h pwd.h randomid.h ranlib.h re_comp.h regex.h regexp.h \
+	paths.h pwd.h quota.h randomid.h ranlib.h re_comp.h regex.h regexp.h \
 	resolv.h res_update.h rmt.h sched.h search.h semaphore.h setjmp.h \
 	sgtty.h signal.h stab.h stdbool.h stddef.h stdio.h stdlib.h string.h \
 	strings.h stringlist.h struct.h sysexits.h tar.h time.h \

Added files:

Index: src/include/quota.h
diff -u /dev/null src/include/quota.h:1.1
--- /dev/null	Mon Jan  9 15:19:46 2012
+++ src/include/quota.h	Mon Jan  9 15:19:45 2012
@@ -0,0 +1,102 @@
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by David A. Holland.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _QUOTA_H_
+#define _QUOTA_H_
+
+#include sys/types.h
+#include sys/quota.h
+
+struct quotahandle; /* Opaque. */
+struct quotacursor; /* Opaque. */
+
+/* quota id types (entities being billed) */
+#define QUOTA_IDTYPE_USER	0
+#define QUOTA_IDTYPE_GROUP	1
+
+/* quota object types (things being limited) */
+#define QUOTA_OBJTYPE_BLOCKS	0
+#define QUOTA_OBJTYPE_FILES	1
+
+/* id value for default */
+#define QUOTA_DEFAULTID		((id_t)-1)
+
+/* limit value for no limit */
+#define QUOTA_NOLIMIT		

CVS commit: src/lib/libquota

2012-01-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan  9 15:22:39 UTC 2012

Modified Files:
src/lib/libquota: Makefile
Added Files:
src/lib/libquota: quota_cursor.c quota_delete.c quota_get.c
quota_open.c quota_put.c quota_schema.c

Log Message:
Add stub entry points of the entire new quota interface. These fail or
do nothing for the time being; however, putting them all in up front
avoids the need to do multiple bumps of the libquota.so version.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libquota/Makefile
cvs rdiff -u -r0 -r1.1 src/lib/libquota/quota_cursor.c \
src/lib/libquota/quota_delete.c src/lib/libquota/quota_get.c \
src/lib/libquota/quota_open.c src/lib/libquota/quota_put.c \
src/lib/libquota/quota_schema.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/libquota/Makefile
diff -u src/lib/libquota/Makefile:1.1 src/lib/libquota/Makefile:1.2
--- src/lib/libquota/Makefile:1.1	Thu Mar 24 17:05:43 2011
+++ src/lib/libquota/Makefile	Mon Jan  9 15:22:38 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2011/03/24 17:05:43 bouyer Exp $
+#	$NetBSD: Makefile,v 1.2 2012/01/09 15:22:38 dholland Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/4/93
 
 .include bsd.own.mk
@@ -14,4 +14,9 @@ LIBDPLIBS+= rpcsvc  ${.CURDIR}/../li
 SRCS+=	getfsquota.c getnfsquota.c getufsquota.c
 MAN=
 
+SRCS+=	quota_open.c
+SRCS+=	quota_schema.c
+SRCS+=	quota_get.c quota_put.c quota_delete.c
+SRCS+=	quota_cursor.c
+
 .include bsd.lib.mk

Added files:

Index: src/lib/libquota/quota_cursor.c
diff -u /dev/null src/lib/libquota/quota_cursor.c:1.1
--- /dev/null	Mon Jan  9 15:22:39 2012
+++ src/lib/libquota/quota_cursor.c	Mon Jan  9 15:22:38 2012
@@ -0,0 +1,93 @@
+/*	$NetBSD: quota_cursor.c,v 1.1 2012/01/09 15:22:38 dholland Exp $	*/
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by David A. Holland.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#include sys/cdefs.h
+__RCSID($NetBSD: quota_cursor.c,v 1.1 2012/01/09 15:22:38 dholland Exp $);
+
+#include stdlib.h
+#include errno.h
+
+#include quota.h
+
+/* ARGSUSED */
+struct quotacursor *
+quota_opencursor(struct quotahandle *qh)
+{
+	errno = ENOSYS;
+	return NULL;
+}
+
+/* ARGSUSED */
+void
+quotacursor_close(struct quotacursor *qc)
+{
+}
+
+/* ARGSUSED */
+int
+quotacursor_skipidtype(struct quotacursor *qc, unsigned idtype)
+{
+	errno = ENOSYS;
+	return -1;
+}
+
+/* ARGSUSED */
+int
+quotacursor_get(struct quotacursor *qc,
+		struct quotakey *qk_ret, struct quotaval *qv_ret)
+{
+	errno = ENOSYS;
+	return -1;
+}
+
+/* ARGSUSED */
+int
+quotacursor_getn(struct quotacursor *qc,
+		 struct quotakey *keys, struct quotaval *vals, 
+		 unsigned maxnum)
+{
+	errno = ENOSYS;
+	return -1;
+}
+
+/* ARGSUSED */
+int
+quotacursor_atend(struct quotacursor *qc)
+{
+	return 0;
+}
+
+/* ARGSUSED */
+int
+quotacursor_rewind(struct quotacursor *qc)
+{
+	errno = ENOSYS;
+	return -1;
+}
Index: src/lib/libquota/quota_delete.c
diff -u /dev/null src/lib/libquota/quota_delete.c:1.1
--- /dev/null	Mon Jan  9 15:22:39 2012
+++ src/lib/libquota/quota_delete.c	Mon Jan  9 15:22:38 2012
@@ -0,0 +1,44 @@
+/*	$NetBSD: quota_delete.c,v 1.1 2012/01/09 15:22:38 dholland Exp $	*/
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by David A. Holland.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided 

CVS commit: src

2012-01-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan  9 15:24:38 UTC 2012

Modified Files:
src/distrib/sets/lists/base: ad.mips64eb ad.mips64el md.amd64
md.sparc64 shl.mi
src/distrib/sets/lists/comp: ad.mips64eb ad.mips64el md.amd64
md.sparc64 shl.mi
src/lib/libquota: shlib_version

Log Message:
Bump minor version of libquota.so.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/distrib/sets/lists/base/ad.mips64eb
cvs rdiff -u -r1.75 -r1.76 src/distrib/sets/lists/base/ad.mips64el
cvs rdiff -u -r1.148 -r1.149 src/distrib/sets/lists/base/md.amd64
cvs rdiff -u -r1.141 -r1.142 src/distrib/sets/lists/base/md.sparc64
cvs rdiff -u -r1.610 -r1.611 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.63 -r1.64 src/distrib/sets/lists/comp/ad.mips64eb \
src/distrib/sets/lists/comp/ad.mips64el
cvs rdiff -u -r1.147 -r1.148 src/distrib/sets/lists/comp/md.amd64
cvs rdiff -u -r1.132 -r1.133 src/distrib/sets/lists/comp/md.sparc64
cvs rdiff -u -r1.203 -r1.204 src/distrib/sets/lists/comp/shl.mi
cvs rdiff -u -r1.1 -r1.2 src/lib/libquota/shlib_version

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/base/ad.mips64eb
diff -u src/distrib/sets/lists/base/ad.mips64eb:1.76 src/distrib/sets/lists/base/ad.mips64eb:1.77
--- src/distrib/sets/lists/base/ad.mips64eb:1.76	Tue Dec 27 16:52:52 2011
+++ src/distrib/sets/lists/base/ad.mips64eb	Mon Jan  9 15:24:37 2012
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips64eb,v 1.76 2011/12/27 16:52:52 christos Exp $
+# $NetBSD: ad.mips64eb,v 1.77 2012/01/09 15:24:37 dholland Exp $
 ./libexec/ld.elf_so-64base-compat-shlib	compat,pic
 ./libexec/ld.elf_so-o32base-sysutil-bin	compat,pic
 ./usr/lib/64	base-compat-lib
@@ -200,7 +200,7 @@
 ./usr/lib/64/libpuffs.so.2			base-compat-shlib	compat,pic
 ./usr/lib/64/libpuffs.so.2.0			base-compat-shlib	compat,pic
 ./usr/lib/64/libquota.so.0			base-compat-shlib	compat,pic
-./usr/lib/64/libquota.so.0.0			base-compat-shlib	compat,pic
+./usr/lib/64/libquota.so.0.1			base-compat-shlib	compat,pic
 ./usr/lib/64/libradius.so.4			base-compat-shlib	compat,pic
 ./usr/lib/64/libradius.so.4.0			base-compat-shlib	compat,pic
 ./usr/lib/64/librefuse.so.2			base-compat-shlib	compat,pic
@@ -496,7 +496,7 @@
 ./usr/lib/o32/libpuffs.so.2			base-compat-shlib	compat,pic
 ./usr/lib/o32/libpuffs.so.2.0			base-compat-shlib	compat,pic
 ./usr/lib/o32/libquota.so.0			base-compat-shlib	compat,pic
-./usr/lib/o32/libquota.so.0.0			base-compat-shlib	compat,pic
+./usr/lib/o32/libquota.so.0.1			base-compat-shlib	compat,pic
 ./usr/lib/o32/libradius.so.4			base-compat-shlib	compat,pic
 ./usr/lib/o32/libradius.so.4.0			base-compat-shlib	compat,pic
 ./usr/lib/o32/librefuse.so.2			base-compat-shlib	compat,pic

Index: src/distrib/sets/lists/base/ad.mips64el
diff -u src/distrib/sets/lists/base/ad.mips64el:1.75 src/distrib/sets/lists/base/ad.mips64el:1.76
--- src/distrib/sets/lists/base/ad.mips64el:1.75	Tue Dec 27 16:52:52 2011
+++ src/distrib/sets/lists/base/ad.mips64el	Mon Jan  9 15:24:37 2012
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips64el,v 1.75 2011/12/27 16:52:52 christos Exp $
+# $NetBSD: ad.mips64el,v 1.76 2012/01/09 15:24:37 dholland Exp $
 ./libexec/ld.elf_so-64base-compat-shlib	compat,pic
 ./libexec/ld.elf_so-o32base-sysutil-bin	compat,pic
 ./usr/lib/64	base-compat-lib
@@ -200,7 +200,7 @@
 ./usr/lib/64/libpuffs.so.2			base-compat-shlib	compat,pic
 ./usr/lib/64/libpuffs.so.2.0			base-compat-shlib	compat,pic
 ./usr/lib/64/libquota.so.0			base-compat-shlib	compat,pic
-./usr/lib/64/libquota.so.0.0			base-compat-shlib	compat,pic
+./usr/lib/64/libquota.so.0.1			base-compat-shlib	compat,pic
 ./usr/lib/64/libradius.so.4			base-compat-shlib	compat,pic
 ./usr/lib/64/libradius.so.4.0			base-compat-shlib	compat,pic
 ./usr/lib/64/librefuse.so.2			base-compat-shlib	compat,pic
@@ -496,7 +496,7 @@
 ./usr/lib/o32/libpuffs.so.2			base-compat-shlib	compat,pic
 ./usr/lib/o32/libpuffs.so.2.0			base-compat-shlib	compat,pic
 ./usr/lib/o32/libquota.so.0			base-compat-shlib	compat,pic
-./usr/lib/o32/libquota.so.0.0			base-compat-shlib	compat,pic
+./usr/lib/o32/libquota.so.0.1			base-compat-shlib	compat,pic
 ./usr/lib/o32/libradius.so.4			base-compat-shlib	compat,pic
 ./usr/lib/o32/libradius.so.4.0			base-compat-shlib	compat,pic
 ./usr/lib/o32/librefuse.so.2			base-compat-shlib	compat,pic

Index: src/distrib/sets/lists/base/md.amd64
diff -u src/distrib/sets/lists/base/md.amd64:1.148 src/distrib/sets/lists/base/md.amd64:1.149
--- src/distrib/sets/lists/base/md.amd64:1.148	Tue Dec 27 16:52:52 2011
+++ src/distrib/sets/lists/base/md.amd64	Mon Jan  9 15:24:37 2012
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.148 2011/12/27 16:52:52 christos Exp $
+# $NetBSD: md.amd64,v 1.149 2012/01/09 15:24:37 dholland Exp $
 ./dev/lms0	base-obsolete		obsolete
 ./dev/mms0	base-obsolete		obsolete
 ./libexec/ld.elf_so-i386			base-sys-shlib	

CVS commit: src/crypto/dist/ipsec-tools/src

2012-01-09 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Mon Jan  9 15:25:14 UTC 2012

Modified Files:
src/crypto/dist/ipsec-tools/src/libipsec: key_debug.c pfkey.c
pfkey_dump.c
src/crypto/dist/ipsec-tools/src/setkey: parse.y setkey.8 token.l

Log Message:
allow setkey(8) set and display the ESP fragment size in the NAT-T case,
userland part of PR kern/44952 by Wolfgang Stukenbrock, just changed
the frag option name to esp_frag, for consistency to the existing
option of similar effect in racoon(8)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/crypto/dist/ipsec-tools/src/libipsec/key_debug.c
cvs rdiff -u -r1.22 -r1.23 src/crypto/dist/ipsec-tools/src/libipsec/pfkey.c
cvs rdiff -u -r1.19 -r1.20 \
src/crypto/dist/ipsec-tools/src/libipsec/pfkey_dump.c
cvs rdiff -u -r1.14 -r1.15 src/crypto/dist/ipsec-tools/src/setkey/parse.y
cvs rdiff -u -r1.28 -r1.29 src/crypto/dist/ipsec-tools/src/setkey/setkey.8
cvs rdiff -u -r1.16 -r1.17 src/crypto/dist/ipsec-tools/src/setkey/token.l

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

Modified files:

Index: src/crypto/dist/ipsec-tools/src/libipsec/key_debug.c
diff -u src/crypto/dist/ipsec-tools/src/libipsec/key_debug.c:1.9 src/crypto/dist/ipsec-tools/src/libipsec/key_debug.c:1.10
--- src/crypto/dist/ipsec-tools/src/libipsec/key_debug.c:1.9	Fri Dec  5 06:02:20 2008
+++ src/crypto/dist/ipsec-tools/src/libipsec/key_debug.c	Mon Jan  9 15:25:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: key_debug.c,v 1.9 2008/12/05 06:02:20 tteras Exp $	*/
+/*	$NetBSD: key_debug.c,v 1.10 2012/01/09 15:25:13 drochner Exp $	*/
 
 /*	$KAME: key_debug.c,v 1.29 2001/08/16 14:25:41 itojun Exp $	*/
 
@@ -85,6 +85,9 @@ static void kdebug_sockaddr __P((struct 
 #ifdef SADB_X_EXT_NAT_T_TYPE
 static void kdebug_sadb_x_nat_t_type __P((struct sadb_ext *ext));
 static void kdebug_sadb_x_nat_t_port __P((struct sadb_ext *ext));
+#ifdef SADB_X_EXT_NAT_T_FRAG
+static void kdebug_sadb_x_nat_t_frag __P((struct sadb_ext *ext));
+#endif
 #endif
 
 #ifdef SADB_X_EXT_PACKET
@@ -192,6 +195,11 @@ kdebug_sadb(base)
 		case SADB_X_EXT_NAT_T_OA:
 			kdebug_sadb_address(ext);
 			break;
+#ifdef SADB_X_EXT_NAT_T_FRAG
+		case SADB_X_EXT_NAT_T_FRAG:
+			kdebug_sadb_x_nat_t_frag(ext);
+			break;
+#endif
 #endif
 #ifdef SADB_X_EXT_PACKET
 		case SADB_X_EXT_PACKET:
@@ -543,6 +551,20 @@ kdebug_sadb_x_nat_t_port(struct sadb_ext
 
 	return;
 }
+#ifdef SADB_X_EXT_NAT_T_FRAG
+static void kdebug_sadb_x_nat_t_frag (struct sadb_ext *ext)
+{
+	struct sadb_x_nat_t_frag *esp_frag = (void *)ext;
+
+	/* sanity check */
+	if (ext == NULL)
+		panic(kdebug_sadb_x_nat_t_frag: NULL pointer was passed.\n);
+
+	printf(sadb_x_nat_t_frag{ esp_frag=%u }\n, esp_frag-sadb_x_nat_t_frag_fraglen);
+
+	return;
+}
+#endif
 #endif
 
 #ifdef SADB_X_EXT_PACKET

Index: src/crypto/dist/ipsec-tools/src/libipsec/pfkey.c
diff -u src/crypto/dist/ipsec-tools/src/libipsec/pfkey.c:1.22 src/crypto/dist/ipsec-tools/src/libipsec/pfkey.c:1.23
--- src/crypto/dist/ipsec-tools/src/libipsec/pfkey.c:1.22	Mon Nov 14 13:24:04 2011
+++ src/crypto/dist/ipsec-tools/src/libipsec/pfkey.c	Mon Jan  9 15:25:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pfkey.c,v 1.22 2011/11/14 13:24:04 tteras Exp $	*/
+/*	$NetBSD: pfkey.c,v 1.23 2012/01/09 15:25:13 drochner Exp $	*/
 
 /*	$KAME: pfkey.c,v 1.47 2003/10/02 19:52:12 itojun Exp $	*/
 
@@ -2034,6 +2034,9 @@ pfkey_align(struct sadb_msg *msg, caddr_
 		case SADB_X_EXT_NAT_T_TYPE:
 		case SADB_X_EXT_NAT_T_SPORT:
 		case SADB_X_EXT_NAT_T_DPORT:
+#ifdef SADB_X_EXT_NAT_T_FRAG
+		case SADB_X_EXT_NAT_T_FRAG:
+#endif
 		case SADB_X_EXT_NAT_T_OA:
 #endif
 #ifdef SADB_X_EXT_TAG

Index: src/crypto/dist/ipsec-tools/src/libipsec/pfkey_dump.c
diff -u src/crypto/dist/ipsec-tools/src/libipsec/pfkey_dump.c:1.19 src/crypto/dist/ipsec-tools/src/libipsec/pfkey_dump.c:1.20
--- src/crypto/dist/ipsec-tools/src/libipsec/pfkey_dump.c:1.19	Thu May 26 21:50:02 2011
+++ src/crypto/dist/ipsec-tools/src/libipsec/pfkey_dump.c	Mon Jan  9 15:25:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pfkey_dump.c,v 1.19 2011/05/26 21:50:02 drochner Exp $	*/
+/*	$NetBSD: pfkey_dump.c,v 1.20 2012/01/09 15:25:13 drochner Exp $	*/
 
 /*	$KAME: pfkey_dump.c,v 1.45 2003/09/08 10:14:56 itojun Exp $	*/
 
@@ -260,6 +260,9 @@ pfkey_sadump1(m, withports)
 	struct sadb_x_nat_t_type *natt_type;
 	struct sadb_x_nat_t_port *natt_sport, *natt_dport;
 	struct sadb_address *natt_oa;
+#ifdef SADB_X_EXT_NAT_T_FRAG
+	struct sadb_x_nat_t_frag *esp_frag;
+#endif
 
 	int use_natt = 0;
 #endif
@@ -300,6 +303,9 @@ pfkey_sadump1(m, withports)
 	natt_sport = (void *)mhp[SADB_X_EXT_NAT_T_SPORT];
 	natt_dport = (void *)mhp[SADB_X_EXT_NAT_T_DPORT];
 	natt_oa = (void *)mhp[SADB_X_EXT_NAT_T_OA];
+#ifdef SADB_X_EXT_NAT_T_FRAG
+	esp_frag = (void *)mhp[SADB_X_EXT_NAT_T_FRAG];
+#endif
 
 	if (natt_type  natt_type-sadb_x_nat_t_type_type)
 		use_natt = 1;
@@ -371,6 +377,11 @@ pfkey_sadump1(m, withports)
 	if (use_natt  natt_oa)
 		

CVS commit: src/lib/libtelnet

2012-01-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan  9 15:25:34 UTC 2012

Modified Files:
src/lib/libtelnet: Makefile auth.c enc-proto.h enc_des.c encrypt.c
encrypt.h genget.c kerberos5.c misc.h sra.c

Log Message:
PR/45805: Borodin Oleg: telnet/telnetd with -DAUTHENTICATION -DENCRYPTION
(rfc2941)
- minimal fixes to compile with WARNS=4
- separate kerberos (USE_KERBEROS) from encryption (MKCRYPTO)


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/lib/libtelnet/Makefile
cvs rdiff -u -r1.19 -r1.20 src/lib/libtelnet/auth.c
cvs rdiff -u -r1.8 -r1.9 src/lib/libtelnet/enc-proto.h \
src/lib/libtelnet/encrypt.h src/lib/libtelnet/misc.h
cvs rdiff -u -r1.14 -r1.15 src/lib/libtelnet/enc_des.c
cvs rdiff -u -r1.15 -r1.16 src/lib/libtelnet/encrypt.c
cvs rdiff -u -r1.11 -r1.12 src/lib/libtelnet/genget.c
cvs rdiff -u -r1.18 -r1.19 src/lib/libtelnet/kerberos5.c
cvs rdiff -u -r1.10 -r1.11 src/lib/libtelnet/sra.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/libtelnet/Makefile
diff -u src/lib/libtelnet/Makefile:1.33 src/lib/libtelnet/Makefile:1.34
--- src/lib/libtelnet/Makefile:1.33	Mon Jun 20 03:43:58 2011
+++ src/lib/libtelnet/Makefile	Mon Jan  9 10:25:33 2012
@@ -1,5 +1,5 @@
 #	from: @(#)Makefile	8.2 (Berkeley) 12/15/93
-#	$NetBSD: Makefile,v 1.33 2011/06/20 07:43:58 mrg Exp $
+#	$NetBSD: Makefile,v 1.34 2012/01/09 15:25:33 christos Exp $
 
 USE_FORT?= yes	# network protocol library
 
@@ -7,7 +7,7 @@ LIBISPRIVATE=	yes
 
 .include bsd.own.mk
 
-WARNS?=	1
+WARNS?=	4
 
 LIB=	telnet
 SRCS=	auth.c encrypt.c genget.c getent.c misc.c
@@ -15,11 +15,13 @@ SRCS=	auth.c encrypt.c genget.c getent.c
 CPPFLAGS+= -DHAS_CGETENT
 CPPFLAGS+= -I${.CURDIR}
 
-.if (${USE_KERBEROS} != no)
+.if ${MKCRYPTO} != no
 SRCS+=	enc_des.c
 CPPFLAGS+= -DENCRYPTION -DAUTHENTICATION
 CPPFLAGS+= -DDES_ENCRYPTION
+.endif
 
+.if ${USE_KERBEROS} != no
 SRCS+=	kerberos5.c
 CPPFLAGS+= -DKRB5
 .endif

Index: src/lib/libtelnet/auth.c
diff -u src/lib/libtelnet/auth.c:1.19 src/lib/libtelnet/auth.c:1.20
--- src/lib/libtelnet/auth.c:1.19	Sun Mar 19 23:03:22 2006
+++ src/lib/libtelnet/auth.c	Mon Jan  9 10:25:33 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: auth.c,v 1.19 2006/03/20 04:03:22 christos Exp $	*/
+/*	$NetBSD: auth.c,v 1.20 2012/01/09 15:25:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)auth.c	8.3 (Berkeley) 5/30/95
 #else
-__RCSID($NetBSD: auth.c,v 1.19 2006/03/20 04:03:22 christos Exp $);
+__RCSID($NetBSD: auth.c,v 1.20 2012/01/09 15:25:33 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -162,7 +162,7 @@ Authenticator authenticators[] = {
 	{ 0, 0, 0, 0, 0, 0, 0, 0 },
 };
 
-static Authenticator NoAuth = { 0 };
+static Authenticator NoAuth = { .type = 0 };
 
 static int	i_support = 0;
 static int	i_wont_support = 0;
@@ -395,10 +395,10 @@ auth_send(data, cnt)
 	 */
 	if (data  _auth_send_data ||
 	data  _auth_send_data + sizeof(_auth_send_data)) {
-		auth_send_cnt = cnt  sizeof(_auth_send_data)
+		auth_send_cnt = (size_t)cnt  sizeof(_auth_send_data)
 	? sizeof(_auth_send_data)
-	: cnt;
-		memmove((void *)_auth_send_data, (void *)data, auth_send_cnt);
+	: (size_t)cnt;
+		memmove(_auth_send_data, data, auth_send_cnt);
 		auth_send_data = _auth_send_data;
 	} else {
 		/*
@@ -517,7 +517,7 @@ auth_name(data, cnt)
 			printf(%s: Empty name in NAME\r\n, Name);
 		return;
 	}
-	if (cnt  sizeof(savename) - 1) {
+	if ((size_t)cnt  sizeof(savename) - 1) {
 		if (auth_debug_mode)
 			printf(%s: Name in NAME (%d) exceeds %ld length\r\n,
 	Name, cnt, (long)sizeof(savename)-1);

Index: src/lib/libtelnet/enc-proto.h
diff -u src/lib/libtelnet/enc-proto.h:1.8 src/lib/libtelnet/enc-proto.h:1.9
--- src/lib/libtelnet/enc-proto.h:1.8	Sun Feb  6 13:00:30 2005
+++ src/lib/libtelnet/enc-proto.h	Mon Jan  9 10:25:33 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: enc-proto.h,v 1.8 2005/02/06 18:00:30 agc Exp $	*/
+/*	$NetBSD: enc-proto.h,v 1.9 2012/01/09 15:25:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -85,7 +85,7 @@ void encrypt_enc_keyid(unsigned char *, 
 void encrypt_dec_keyid(unsigned char *, int);
 struct key_info;
 void encrypt_keyid(struct key_info *, unsigned char *, int);
-void encrypt_send_keyid(int, unsigned char *, int, int);
+void encrypt_send_keyid(int, const unsigned char *, int, int);
 void encrypt_auto(int);
 void decrypt_auto(int);
 void encrypt_start_output(int);
@@ -134,7 +134,7 @@ void ofb64_session(Session_Key *, int);
 int ofb64_keyid(int, unsigned char *, int *);
 void ofb64_printsub(unsigned char *, int, unsigned char *, int);
 
-void fb64_printsub(unsigned char *, int, unsigned char *, int,
-unsigned char *);
+void fb64_printsub(const unsigned char *, int, unsigned char *, int,
+const unsigned char *);
 
 #endif	/* ENCRYPTION */
Index: src/lib/libtelnet/encrypt.h
diff -u src/lib/libtelnet/encrypt.h:1.8 

CVS commit: src/lib/libquota

2012-01-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan  9 15:27:05 UTC 2012

Modified Files:
src/lib/libquota: Makefile quota_get.c quota_open.c
Added Files:
src/lib/libquota: quota_proplib.c quotapvt.h

Log Message:
Add initial versions of quota_open(), quota_close(), quota_get(),
calling proplib code mostly taken from getufsquota().

Correct the proplib refcount handling in the code from getufsquota(),
where it was (as far as I can tell) wrong.

Avoid doing illegal and unsafe casts from (struct quotaval *)
to (uint64_t *).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libquota/Makefile
cvs rdiff -u -r1.1 -r1.2 src/lib/libquota/quota_get.c \
src/lib/libquota/quota_open.c
cvs rdiff -u -r0 -r1.1 src/lib/libquota/quota_proplib.c \
src/lib/libquota/quotapvt.h

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

Modified files:

Index: src/lib/libquota/Makefile
diff -u src/lib/libquota/Makefile:1.2 src/lib/libquota/Makefile:1.3
--- src/lib/libquota/Makefile:1.2	Mon Jan  9 15:22:38 2012
+++ src/lib/libquota/Makefile	Mon Jan  9 15:27:04 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2012/01/09 15:22:38 dholland Exp $
+#	$NetBSD: Makefile,v 1.3 2012/01/09 15:27:04 dholland Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/4/93
 
 .include bsd.own.mk
@@ -18,5 +18,6 @@ SRCS+=	quota_open.c
 SRCS+=	quota_schema.c
 SRCS+=	quota_get.c quota_put.c quota_delete.c
 SRCS+=	quota_cursor.c
+SRCS+=	quota_proplib.c
 
 .include bsd.lib.mk

Index: src/lib/libquota/quota_get.c
diff -u src/lib/libquota/quota_get.c:1.1 src/lib/libquota/quota_get.c:1.2
--- src/lib/libquota/quota_get.c:1.1	Mon Jan  9 15:22:38 2012
+++ src/lib/libquota/quota_get.c	Mon Jan  9 15:27:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quota_get.c,v 1.1 2012/01/09 15:22:38 dholland Exp $	*/
+/*	$NetBSD: quota_get.c,v 1.2 2012/01/09 15:27:04 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,22 +29,23 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: quota_get.c,v 1.1 2012/01/09 15:22:38 dholland Exp $);
-
-#include errno.h
+__RCSID($NetBSD: quota_get.c,v 1.2 2012/01/09 15:27:04 dholland Exp $);
 
 #include quota.h
+#include quotapvt.h
 
-/* ARGSUSED */
 void
 quotaval_clear(struct quotaval *qv)
 {
+	qv-qv_hardlimit = QUOTA_NOLIMIT;
+	qv-qv_softlimit = QUOTA_NOLIMIT;
+	qv-qv_usage = 0;
+	qv-qv_expiretime = QUOTA_NOTIME;
+	qv-qv_grace = QUOTA_NOTIME;
 }
 
-/* ARGSUSED */
 int
 quota_get(struct quotahandle *qh, const struct quotakey *qk, struct quotaval *qv)
 {
-	errno = ENOSYS;
-	return -1;
+	return __quota_proplib_get(qh, qk, qv);
 }
Index: src/lib/libquota/quota_open.c
diff -u src/lib/libquota/quota_open.c:1.1 src/lib/libquota/quota_open.c:1.2
--- src/lib/libquota/quota_open.c:1.1	Mon Jan  9 15:22:38 2012
+++ src/lib/libquota/quota_open.c	Mon Jan  9 15:27:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quota_open.c,v 1.1 2012/01/09 15:22:38 dholland Exp $	*/
+/*	$NetBSD: quota_open.c,v 1.2 2012/01/09 15:27:04 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,26 +29,39 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: quota_open.c,v 1.1 2012/01/09 15:22:38 dholland Exp $);
+__RCSID($NetBSD: quota_open.c,v 1.2 2012/01/09 15:27:04 dholland Exp $);
 
+#include stdlib.h
 #include string.h
 #include errno.h
 
 #include quota.h
+#include quotapvt.h
 
-/* ARGSUSED */
 struct quotahandle *
 quota_open(const char *path)
 {
-	errno = ENOSYS;
-	return NULL;
+	struct quotahandle *qh;
+	int serrno;
+
+	qh = malloc(sizeof(*qh));
+	if (qh == NULL) {
+		return NULL;
+	}
+	qh-qh_mountpoint = strdup(path);
+	if (qh-qh_mountpoint == NULL) {
+		serrno = errno;
+		free(qh);
+		errno = serrno;
+		return NULL;
+	}
+	return qh;
 }
 
 const char *
 quota_getmountpoint(struct quotahandle *qh)
 {
-	errno = ENOSYS;
-	return NULL;
+	return qh-qh_mountpoint;
 }
 
 const char *
@@ -58,8 +71,9 @@ quota_getmountdevice(struct quotahandle 
 	return NULL;
 }
 
-/* ARGSUSED */
 void
 quota_close(struct quotahandle *qh)
 {
+	free(qh-qh_mountpoint);
+	free(qh);
 }

Added files:

Index: src/lib/libquota/quota_proplib.c
diff -u /dev/null src/lib/libquota/quota_proplib.c:1.1
--- /dev/null	Mon Jan  9 15:27:05 2012
+++ src/lib/libquota/quota_proplib.c	Mon Jan  9 15:27:04 2012
@@ -0,0 +1,306 @@
+/*	$NetBSD: quota_proplib.c,v 1.1 2012/01/09 15:27:04 dholland Exp $	*/
+/*-
+  * Copyright (c) 2011 Manuel Bouyer
+  * All rights reserved.
+  *
+  * Redistribution and use in source and binary forms, with or without
+  * modification, are permitted provided that the following conditions
+  * are met:
+  * 1. Redistributions of source code must retain the above copyright
+  *notice, this list of conditions and the following disclaimer.
+  * 2. Redistributions in binary form must reproduce the above copyright
+  *notice, this list of conditions and the following disclaimer in the
+  *documentation 

CVS commit: src/lib/libquota

2012-01-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan  9 15:28:31 UTC 2012

Modified Files:
src/lib/libquota: getufsquota.c

Log Message:
Rework getufsquota() in terms of the new quota API.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libquota/getufsquota.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/libquota/getufsquota.c
diff -u src/lib/libquota/getufsquota.c:1.4 src/lib/libquota/getufsquota.c:1.5
--- src/lib/libquota/getufsquota.c:1.4	Fri Nov 25 16:55:05 2011
+++ src/lib/libquota/getufsquota.c	Mon Jan  9 15:28:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: getufsquota.c,v 1.4 2011/11/25 16:55:05 dholland Exp $ */
+/*	$NetBSD: getufsquota.c,v 1.5 2012/01/09 15:28:31 dholland Exp $ */
 
 /*-
   * Copyright (c) 2011 Manuel Bouyer
@@ -27,24 +27,95 @@
   */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: getufsquota.c,v 1.4 2011/11/25 16:55:05 dholland Exp $);
+__RCSID($NetBSD: getufsquota.c,v 1.5 2012/01/09 15:28:31 dholland Exp $);
 
+#include sys/types.h
 #include stdio.h
 #include stdlib.h
+#include string.h
 #include errno.h
 #include err.h
-#include string.h
-
-#include sys/types.h
 
 #include quota/quotaprop.h
 #include quota/quota.h
 
-/* retrieve quotas with ufs semantics from vfs, for the given user id */
+#include quota.h
+
+/*
+ * Return true if QV contains any actual information.
+ *
+ * XXX when qv_grace is not available it should be set to QUOTA_NOTIME,
+ * not zero, but this is currently not always the case.
+ */
+static int
+quotaval_nonempty(const struct quotaval *qv)
+{
+	if (qv-qv_hardlimit != QUOTA_NOLIMIT ||
+	qv-qv_softlimit != QUOTA_NOLIMIT ||
+	qv-qv_usage != 0 ||
+	qv-qv_expiretime != QUOTA_NOTIME ||
+	(qv-qv_grace != QUOTA_NOTIME  qv-qv_grace != 0)) {
+		return 1;
+	}
+	return 0;
+}
+
+/*
+ * retrieve quotas with ufs semantics from vfs, for the given user id
+ *
+ * What this actually does is: for mount point MP, and id ID, which
+ * can be either a uid or a gid depending on what string CLASS
+ * contains, fetch both block and file quotas and store them in QV,
+ * namely in qv[0] and qv[1] respectively.
+ */
 int
 getufsquota(const char *mp, struct quotaval *qv, uid_t id,
 const char *class)
 {
+#if 1
+	struct quotakey qk;
+	struct quotahandle *qh;
+
+	qh = quota_open(mp);
+	if (qh == NULL) {
+		return -1;
+	}
+
+	qk.qk_id = id;
+	if (!strcmp(class, QUOTADICT_CLASS_USER)) {
+		qk.qk_idtype = QUOTA_IDTYPE_USER;
+	} else if (!strcmp(class, QUOTADICT_CLASS_GROUP)) {
+		qk.qk_idtype = QUOTA_IDTYPE_GROUP;
+	} else {
+		errno = EINVAL;
+		return -1;
+	}
+
+	/*
+	 * Use explicit indexes on qv[] to make sure this continues
+	 * to work the way it used to (for compat) independent of
+	 * what might happen to the symbolic constants.
+	 */
+
+	qk.qk_objtype = QUOTA_OBJTYPE_BLOCKS;
+	if (quota_get(qh, qk, qv[0])  0) {
+		return -1;
+	}
+
+	qk.qk_objtype = QUOTA_OBJTYPE_FILES;
+	if (quota_get(qh, qk, qv[1])  0) {
+		return -1;
+	}
+
+	quota_close(qh);
+
+	if (quotaval_nonempty(qv[0]) || quotaval_nonempty(qv[1])) {
+		return 1;
+	}
+
+	return 0;
+
+#else /* old code for reference */
 	prop_dictionary_t dict, data, cmd;
 	prop_array_t cmds, datas;
 	struct plistref pref;
@@ -175,4 +246,5 @@ end_cmds:
 end_dict:
 	prop_object_release(dict);
 	return -1;
+#endif
 }



CVS commit: src/lib/libquota

2012-01-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan  9 15:29:56 UTC 2012

Modified Files:
src/lib/libquota: Makefile quota_get.c quota_open.c quotapvt.h
Added Files:
src/lib/libquota: quota_nfs.c

Log Message:
Add quota_nfs.c and implement quota_get() for nfs, using
code from getnfsquota().

Also implement quota_getmountdevice().


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libquota/Makefile
cvs rdiff -u -r1.2 -r1.3 src/lib/libquota/quota_get.c \
src/lib/libquota/quota_open.c
cvs rdiff -u -r0 -r1.1 src/lib/libquota/quota_nfs.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libquota/quotapvt.h

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

Modified files:

Index: src/lib/libquota/Makefile
diff -u src/lib/libquota/Makefile:1.3 src/lib/libquota/Makefile:1.4
--- src/lib/libquota/Makefile:1.3	Mon Jan  9 15:27:04 2012
+++ src/lib/libquota/Makefile	Mon Jan  9 15:29:55 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.3 2012/01/09 15:27:04 dholland Exp $
+#	$NetBSD: Makefile,v 1.4 2012/01/09 15:29:55 dholland Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/4/93
 
 .include bsd.own.mk
@@ -19,5 +19,6 @@ SRCS+=	quota_schema.c
 SRCS+=	quota_get.c quota_put.c quota_delete.c
 SRCS+=	quota_cursor.c
 SRCS+=	quota_proplib.c
+SRCS+=	quota_nfs.c
 
 .include bsd.lib.mk

Index: src/lib/libquota/quota_get.c
diff -u src/lib/libquota/quota_get.c:1.2 src/lib/libquota/quota_get.c:1.3
--- src/lib/libquota/quota_get.c:1.2	Mon Jan  9 15:27:04 2012
+++ src/lib/libquota/quota_get.c	Mon Jan  9 15:29:55 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quota_get.c,v 1.2 2012/01/09 15:27:04 dholland Exp $	*/
+/*	$NetBSD: quota_get.c,v 1.3 2012/01/09 15:29:55 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: quota_get.c,v 1.2 2012/01/09 15:27:04 dholland Exp $);
+__RCSID($NetBSD: quota_get.c,v 1.3 2012/01/09 15:29:55 dholland Exp $);
 
 #include quota.h
 #include quotapvt.h
@@ -47,5 +47,9 @@ quotaval_clear(struct quotaval *qv)
 int
 quota_get(struct quotahandle *qh, const struct quotakey *qk, struct quotaval *qv)
 {
-	return __quota_proplib_get(qh, qk, qv);
+	if (qh-qh_isnfs) {
+		return __quota_nfs_get(qh, qk, qv);
+	} else {
+		return __quota_proplib_get(qh, qk, qv);
+	}
 }
Index: src/lib/libquota/quota_open.c
diff -u src/lib/libquota/quota_open.c:1.2 src/lib/libquota/quota_open.c:1.3
--- src/lib/libquota/quota_open.c:1.2	Mon Jan  9 15:27:04 2012
+++ src/lib/libquota/quota_open.c	Mon Jan  9 15:29:56 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quota_open.c,v 1.2 2012/01/09 15:27:04 dholland Exp $	*/
+/*	$NetBSD: quota_open.c,v 1.3 2012/01/09 15:29:56 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,8 +29,10 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: quota_open.c,v 1.2 2012/01/09 15:27:04 dholland Exp $);
+__RCSID($NetBSD: quota_open.c,v 1.3 2012/01/09 15:29:56 dholland Exp $);
 
+#include sys/types.h
+#include sys/statvfs.h
 #include stdlib.h
 #include string.h
 #include errno.h
@@ -41,20 +43,64 @@ __RCSID($NetBSD: quota_open.c,v 1.2 201
 struct quotahandle *
 quota_open(const char *path)
 {
+
+	struct statvfs stv;
 	struct quotahandle *qh;
+	int isnfs;
 	int serrno;
 
+	if (statvfs(path, stv)  0) {
+		return NULL;
+	}
+
+	/*
+	 * We need to know up front if the volume is NFS. If so, we
+	 * don't go to the kernel at all but instead do RPCs to the
+	 * NFS server's rpc.rquotad. Therefore, don't check the
+	 * mount flags for quota support or do anything else that
+	 * reaches the kernel.
+	 */
+	
+	if (!strcmp(stv.f_fstypename, nfs)) {
+		isnfs = 1;
+	} else {
+		isnfs = 0;
+		if ((stv.f_flag  ST_QUOTA) == 0) {
+			/* XXX: correct errno? */
+			errno = EOPNOTSUPP;
+			return NULL;
+		}
+	}
+
 	qh = malloc(sizeof(*qh));
 	if (qh == NULL) {
 		return NULL;
 	}
-	qh-qh_mountpoint = strdup(path);
+
+	/*
+	 * Get the mount point from statvfs; this way the passed-in
+	 * path can be any path on the volume.
+	 */
+
+	qh-qh_mountpoint = strdup(stv.f_mntonname);
 	if (qh-qh_mountpoint == NULL) {
 		serrno = errno;
 		free(qh);
 		errno = serrno;
 		return NULL;
 	}
+
+	qh-qh_mountdevice = strdup(stv.f_mntfromname);
+	if (qh-qh_mountdevice == NULL) {
+		serrno = errno;
+		free(qh-qh_mountpoint);
+		free(qh);
+		errno = serrno;
+		return NULL;
+	}
+
+	qh-qh_isnfs = isnfs;
+
 	return qh;
 }
 
@@ -67,13 +113,13 @@ quota_getmountpoint(struct quotahandle *
 const char *
 quota_getmountdevice(struct quotahandle *qh)
 {
-	errno = ENOSYS;
-	return NULL;
+	return qh-qh_mountdevice;
 }
 
 void
 quota_close(struct quotahandle *qh)
 {
+	free(qh-qh_mountdevice);
 	free(qh-qh_mountpoint);
 	free(qh);
 }

Index: src/lib/libquota/quotapvt.h
diff -u src/lib/libquota/quotapvt.h:1.1 src/lib/libquota/quotapvt.h:1.2
--- src/lib/libquota/quotapvt.h:1.1	Mon Jan  9 15:27:04 2012
+++ src/lib/libquota/quotapvt.h	Mon Jan  9 

CVS commit: src/lib/libquota

2012-01-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan  9 15:31:12 UTC 2012

Modified Files:
src/lib/libquota: getfsquota.c getnfsquota.c getufsquota.c quotapvt.h

Log Message:
Redo getfsquota() and getnfsquota() using the new API.

Change the previous getufsquota() to __quota_getquota() and call it
from all three functions: getfsquota(), getufsquota(), and getnfsquota().


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libquota/getfsquota.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libquota/getnfsquota.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libquota/getufsquota.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libquota/quotapvt.h

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

Modified files:

Index: src/lib/libquota/getfsquota.c
diff -u src/lib/libquota/getfsquota.c:1.3 src/lib/libquota/getfsquota.c:1.4
--- src/lib/libquota/getfsquota.c:1.3	Fri Nov 25 16:55:05 2011
+++ src/lib/libquota/getfsquota.c	Mon Jan  9 15:31:11 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: getfsquota.c,v 1.3 2011/11/25 16:55:05 dholland Exp $ */
+/*	$NetBSD: getfsquota.c,v 1.4 2012/01/09 15:31:11 dholland Exp $ */
 
 /*-
   * Copyright (c) 2011 Manuel Bouyer
@@ -27,39 +27,20 @@
   */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: getfsquota.c,v 1.3 2011/11/25 16:55:05 dholland Exp $);
+__RCSID($NetBSD: getfsquota.c,v 1.4 2012/01/09 15:31:11 dholland Exp $);
 
-#include stdio.h
-#include stdlib.h
-#include errno.h
-#include err.h
-#include string.h
+#include quota.h
+#include quota/quota.h
 
-#include sys/types.h
-#include sys/statvfs.h
+#include quotapvt.h
 
-#include quota/quotaprop.h
-#include quota/quota.h
 
-/* retrieve quotas with ufs semantics from vfs, for the given user id */
+/*
+ * retrieve quotas with ufs semantics from vfs, for the given user id
+ */
 int
 getfsquota(const char *path, struct quotaval *qv, uid_t id,
 const char *class)
 {
-	struct statvfs v;
-
-	if (statvfs(path, v)  0) {
-		return -1;
-	}
-	if (strcmp(v.f_fstypename, nfs) == 0)
-		return getnfsquota(v.f_mntfromname, qv, id, class);
-	else {
-		if ((v.f_flag  ST_QUOTA) == 0)
-			return 0;
-		/*
-		 * assume all quota-enabled local filesystems have UFS
-		 * semantic for now
-		 */
-		return getufsquota(v.f_mntonname, qv, id, class);
-	}
+	return __quota_getquota(path, qv, id, class);
 }

Index: src/lib/libquota/getnfsquota.c
diff -u src/lib/libquota/getnfsquota.c:1.4 src/lib/libquota/getnfsquota.c:1.5
--- src/lib/libquota/getnfsquota.c:1.4	Fri Nov 25 16:55:05 2011
+++ src/lib/libquota/getnfsquota.c	Mon Jan  9 15:31:11 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: getnfsquota.c,v 1.4 2011/11/25 16:55:05 dholland Exp $	*/
+/*	$NetBSD: getnfsquota.c,v 1.5 2012/01/09 15:31:11 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -42,170 +42,84 @@ __COPYRIGHT(@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = @(#)quota.c	8.4 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: getnfsquota.c,v 1.4 2011/11/25 16:55:05 dholland Exp $);
+__RCSID($NetBSD: getnfsquota.c,v 1.5 2012/01/09 15:31:11 dholland Exp $);
 #endif
 #endif /* not lint */
 
-/*
- * Disk quota reporting program.
- */
-#include sys/param.h
 #include sys/types.h
-#include sys/socket.h
-
-#include ctype.h
-#include err.h
-#include errno.h
-#include netdb.h
-#include stdio.h
+#include sys/mount.h
 #include stdlib.h
 #include string.h
-#include time.h
-#include unistd.h
+#include errno.h
 
+#include quota.h
 #include quota/quota.h
-#include quota/quotaprop.h
 
-#include rpc/rpc.h
-#include rpc/pmap_prot.h
-#include rpcsvc/rquota.h
-
-/* convert a rquota limit to our semantic */
-static uint64_t
-rqlim2qlim(uint32_t lim)
-{
-	if (lim == 0)
-		return UQUAD_MAX;
-	else
-		return (lim - 1);
-}
- 
-static int
-callaurpc(const char *host, rpcprog_t prognum, rpcvers_t versnum,
-rpcproc_t procnum, xdrproc_t inproc, void *in, xdrproc_t outproc, void *out)
-{
-	struct sockaddr_in server_addr;
-	enum clnt_stat clnt_stat;
-	struct hostent *hp;
-	struct timeval timeout, tottimeout;
- 
-	CLIENT *client = NULL;
-	int sock = RPC_ANYSOCK;
- 
-	if ((hp = gethostbyname(host)) == NULL)
-		return (int) RPC_UNKNOWNHOST;
-	timeout.tv_usec = 0;
-	timeout.tv_sec = 6;
-	memmove(server_addr.sin_addr, hp-h_addr, hp-h_length);
-	server_addr.sin_family = AF_INET;
-	server_addr.sin_port =  0;
-
-	if ((client = clntudp_create(server_addr, prognum,
-	versnum, timeout, sock)) == NULL)
-		return (int) rpc_createerr.cf_stat;
-
-	client-cl_auth = authunix_create_default();
-	tottimeout.tv_sec = 25;
-	tottimeout.tv_usec = 0;
-	clnt_stat = clnt_call(client, procnum, inproc, in,
-	outproc, out, tottimeout);
- 
-	return (int) clnt_stat;
-}
+#include quotapvt.h
 
 int
 getnfsquota(const char *mp, struct quotaval *qv,
 uint32_t id, const char *class)
 {
-	struct getquota_args gq_args;
-	struct ext_getquota_args ext_gq_args;
-	struct getquota_rslt gq_rslt;
-	struct timeval tv;
-	char *host, *path;
-	int ret, rpcqtype;
-
-	if (strcmp(class, QUOTADICT_CLASS_USER) == 

CVS commit: src/lib/libquota

2012-01-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan  9 15:32:39 UTC 2012

Modified Files:
src/lib/libquota: quota_proplib.c

Log Message:
Handle default ID case in quota_get(), based on logic found in
/usr/bin/quota.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libquota/quota_proplib.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/libquota/quota_proplib.c
diff -u src/lib/libquota/quota_proplib.c:1.1 src/lib/libquota/quota_proplib.c:1.2
--- src/lib/libquota/quota_proplib.c:1.1	Mon Jan  9 15:27:04 2012
+++ src/lib/libquota/quota_proplib.c	Mon Jan  9 15:32:38 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quota_proplib.c,v 1.1 2012/01/09 15:27:04 dholland Exp $	*/
+/*	$NetBSD: quota_proplib.c,v 1.2 2012/01/09 15:32:38 dholland Exp $	*/
 /*-
   * Copyright (c) 2011 Manuel Bouyer
   * All rights reserved.
@@ -26,7 +26,7 @@
   */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: quota_proplib.c,v 1.1 2012/01/09 15:27:04 dholland Exp $);
+__RCSID($NetBSD: quota_proplib.c,v 1.2 2012/01/09 15:32:38 dholland Exp $);
 
 #include string.h
 #include errno.h
@@ -73,10 +73,18 @@ __quota_proplib_get(struct quotahandle *
 		errno = ENOMEM;
 		return -1;
 	}
-	if (!prop_dictionary_set_uint32(data, id, qk-qk_id)) {
-		prop_object_release(data);
-		errno = ENOMEM;
-		return -1;
+	if (qk-qk_id == QUOTA_DEFAULTID) {
+		if (!prop_dictionary_set_cstring(data, id, default)) {
+			prop_object_release(data);
+			errno = ENOMEM;
+			return -1;
+		}
+	} else {
+		if (!prop_dictionary_set_uint32(data, id, qk-qk_id)) {
+			prop_object_release(data);
+			errno = ENOMEM;
+			return -1;
+		}
 	}
 
 	datas = prop_array_create();



CVS commit: src/usr.bin/quota

2012-01-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan  9 15:35:44 UTC 2012

Modified Files:
src/usr.bin/quota: Makefile quota.c

Log Message:
Clean up usr.bin/quota to use the new libquota API.
(with one relatively minor exception remaining)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/quota/Makefile
cvs rdiff -u -r1.43 -r1.44 src/usr.bin/quota/quota.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/quota/Makefile
diff -u src/usr.bin/quota/Makefile:1.10 src/usr.bin/quota/Makefile:1.11
--- src/usr.bin/quota/Makefile:1.10	Thu Mar 24 17:05:46 2011
+++ src/usr.bin/quota/Makefile	Mon Jan  9 15:35:44 2012
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.10 2011/03/24 17:05:46 bouyer Exp $	
+#	$NetBSD: Makefile,v 1.11 2012/01/09 15:35:44 dholland Exp $	
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
 
 WARNS ?= 4
 .include bsd.own.mk
 PROG=	quota
-SRCS=	quota.c printquota.c getvfsquota.c
+SRCS=	quota.c printquota.c
 
 CPPFLAGS+= -I${NETBSDSRCDIR}/usr.bin/quota
 DPADD=	${LIBQUOTA} ${LIBRPCSVC} ${LIBPROP}

Index: src/usr.bin/quota/quota.c
diff -u src/usr.bin/quota/quota.c:1.43 src/usr.bin/quota/quota.c:1.44
--- src/usr.bin/quota/quota.c:1.43	Wed Nov 30 16:12:32 2011
+++ src/usr.bin/quota/quota.c	Mon Jan  9 15:35:44 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quota.c,v 1.43 2011/11/30 16:12:32 dholland Exp $	*/
+/*	$NetBSD: quota.c,v 1.44 2012/01/09 15:35:44 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT(@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = @(#)quota.c	8.4 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: quota.c,v 1.43 2011/11/30 16:12:32 dholland Exp $);
+__RCSID($NetBSD: quota.c,v 1.44 2012/01/09 15:35:44 dholland Exp $);
 #endif
 #endif /* not lint */
 
@@ -70,7 +70,7 @@ __RCSID($NetBSD: quota.c,v 1.43 2011/11
 #include time.h
 #include unistd.h
 
-#include quota/quotaprop.h
+#include quota.h
 #include quota/quota.h
 
 #include printquota.h
@@ -78,26 +78,25 @@ __RCSID($NetBSD: quota.c,v 1.43 2011/11
 
 struct quotause {
 	struct	quotause *next;
-	long	flags;
 	uid_t	id;
 	struct	quotaval *qvs;
 	unsigned numqvs;
 	char	fsname[MAXPATHLEN + 1];
+	struct	quotahandle *qh;
 };
-#define	FOUND	0x01
-#define	QUOTA2	0x02
 
 static int	anyusage(struct quotaval *, unsigned);
 static int	anyover(struct quotaval *, unsigned, time_t);
 static const char *getovermsg(struct quotaval *, const char *, time_t);
 static struct quotause	*getprivs(id_t, int);
-static void	heading(int, id_t, const char *, const char *);
+static void	heading(int, const char *, id_t, const char *, const char *);
 static int	isover(struct quotaval *qv, time_t now);
-static void	printqv(struct quotaval *, int, int, time_t);
+static void	printqv(struct quotaval *, int, time_t);
 static void	showgid(gid_t);
 static void	showgrpname(const char *);
-static void	showonequota(int, id_t, const char *, struct quotause *);
-static void	showquotas(int, id_t, const char *);
+static void	showonequota(int, const char *, id_t, const char *,
+			 struct quotause *);
+static void	showquotas(int, const char *, id_t, const char *);
 static void	showuid(uid_t);
 static void	showusrname(const char *);
 static int	unlimited(struct quotaval *qvs, unsigned numqvs);
@@ -157,9 +156,9 @@ main(int argc, char *argv[])
 			errx(1, -d: permission denied);
 #endif
 		if (uflag)
-			showquotas(QUOTA_CLASS_USER, 0, );
+			showquotas(QUOTA_IDTYPE_USER, user, 0, );
 		if (gflag)
-			showquotas(QUOTA_CLASS_GROUP, 0, );
+			showquotas(QUOTA_IDTYPE_GROUP, group, 0, );
 		return 0;
 	}
 	if (argc == 0) {
@@ -233,7 +232,7 @@ showuid(uid_t uid)
 		warnx(%s (uid %d): permission denied, name, uid);
 		return;
 	}
-	showquotas(QUOTA_CLASS_USER, uid, name);
+	showquotas(QUOTA_IDTYPE_USER, user, uid, name);
 }
 
 /*
@@ -252,7 +251,7 @@ showusrname(const char *name)
 		warnx(%s (uid %d): permission denied, name, pwd-pw_uid);
 		return;
 	}
-	showquotas(QUOTA_CLASS_USER, pwd-pw_uid, name);
+	showquotas(QUOTA_IDTYPE_USER, user, pwd-pw_uid, name);
 }
 
 /*
@@ -286,7 +285,7 @@ showgid(gid_t gid)
 			return;
 		}
 	}
-	showquotas(QUOTA_CLASS_GROUP, gid, name);
+	showquotas(QUOTA_IDTYPE_GROUP, group, gid, name);
 }
 
 /*
@@ -320,39 +319,35 @@ showgrpname(const char *name)
 			return;
 		}
 	}
-	showquotas(QUOTA_CLASS_GROUP, grp-gr_gid, name);
+	showquotas(QUOTA_IDTYPE_GROUP, group, grp-gr_gid, name);
 }
 
 static void
-showquotas(int type, id_t id, const char *idname)
+showquotas(int idtype, const char *idtypename, id_t id, const char *idname)
 {
 	struct quotause *qup;
 	struct quotause *quplist;
 
 	needheading = 1;
 
-	quplist = getprivs(id, type);
+	quplist = getprivs(id, idtype);
 	for (qup = quplist; qup; qup = qup-next) {
-		showonequota(type, id, idname, qup);
+		showonequota(idtype, idtypename, id, idname, qup);
 	}
 	if (!qflag) {
 		/* In case nothing printed, issue a header saying none */
-		

CVS commit: src/libexec/rpc.rquotad

2012-01-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan  9 15:37:34 UTC 2012

Modified Files:
src/libexec/rpc.rquotad: rquotad.c

Log Message:
Update rquotad to use the new libquota API.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/libexec/rpc.rquotad/rquotad.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/rpc.rquotad/rquotad.c
diff -u src/libexec/rpc.rquotad/rquotad.c:1.31 src/libexec/rpc.rquotad/rquotad.c:1.32
--- src/libexec/rpc.rquotad/rquotad.c:1.31	Fri Nov 25 16:55:05 2011
+++ src/libexec/rpc.rquotad/rquotad.c	Mon Jan  9 15:37:34 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rquotad.c,v 1.31 2011/11/25 16:55:05 dholland Exp $	*/
+/*	$NetBSD: rquotad.c,v 1.32 2012/01/09 15:37:34 dholland Exp $	*/
 
 /*
  * by Manuel Bouyer (bou...@ensta.fr). Public domain.
@@ -6,7 +6,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: rquotad.c,v 1.31 2011/11/25 16:55:05 dholland Exp $);
+__RCSID($NetBSD: rquotad.c,v 1.32 2012/01/09 15:37:34 dholland Exp $);
 #endif
 
 #include sys/param.h
@@ -26,15 +26,14 @@ __RCSID($NetBSD: rquotad.c,v 1.31 2011/
 #include grp.h
 #include errno.h
 #include unistd.h
-
 #include syslog.h
 
-#include quota/quotaprop.h
-#include quota/quota.h
 #include rpc/rpc.h
 #include rpcsvc/rquota.h
 #include arpa/inet.h
 
+#include quota.h
+
 static void rquota_service(struct svc_req *request, SVCXPRT *transp);
 static void ext_rquota_service(struct svc_req *request, SVCXPRT *transp);
 static void sendquota(struct svc_req *request, int vers, SVCXPRT *transp);
@@ -42,15 +41,6 @@ __dead static void cleanup(int);
 
 static int from_inetd = 1;
 
-static uint32_t
-qlim2rqlim(uint64_t lim)
-{
-	if (lim == UQUAD_MAX)
-		return 0;
-	else
-		return (lim + 1);
-}
-
 static void 
 cleanup(int dummy)
 {
@@ -163,6 +153,58 @@ ext_rquota_service(struct svc_req *reque
 		exit(0);
 }
 
+/*
+ * Convert a limit to rquota representation (where 0 == unlimited).
+ * Clamp the result into a uint32_t.
+ */
+static uint32_t
+limit_to_rquota(uint64_t lim)
+{
+	if (lim == QUOTA_NOLIMIT || lim  0xfffeUL)
+		return 0;
+	else
+		return (lim + 1);
+}
+
+/*
+ * Convert a time to rquota representation.
+ */
+static uint32_t
+time_to_rquota(time_t when, time_t now)
+{
+	if (when == QUOTA_NOTIME) {
+		return 0;
+	} else {
+		return when - now;
+	}
+}
+
+/*
+ * Convert to rquota representation.
+ */
+static void
+quotavals_to_rquota(const struct quotaval *blocks,
+		const struct quotaval *files,
+		struct rquota *rq)
+{
+	struct timeval now;
+
+	gettimeofday(now, NULL);
+
+	rq-rq_active = TRUE;
+	rq-rq_bsize = DEV_BSIZE;
+
+	rq-rq_bhardlimit = limit_to_rquota(blocks-qv_hardlimit);
+	rq-rq_bsoftlimit = limit_to_rquota(blocks-qv_softlimit);
+	rq-rq_curblocks = blocks-qv_usage;
+	rq-rq_btimeleft = time_to_rquota(blocks-qv_expiretime, now.tv_sec);
+
+	rq-rq_fhardlimit = limit_to_rquota(files-qv_hardlimit);
+	rq-rq_fsoftlimit = limit_to_rquota(files-qv_softlimit);
+	rq-rq_curfiles = files-qv_usage;
+	rq-rq_ftimeleft = time_to_rquota(files-qv_expiretime, now.tv_sec);
+}
+
 /* read quota for the specified id, and send it */
 static void
 sendquota(struct svc_req *request, int vers, SVCXPRT *transp)
@@ -170,9 +212,10 @@ sendquota(struct svc_req *request, int v
 	struct getquota_args getq_args;
 	struct ext_getquota_args ext_getq_args;
 	struct getquota_rslt getq_rslt;
-	struct quotaval qv[QUOTA_NLIMITS];
-	const char *class;
-	struct timeval timev;
+	struct quotahandle *qh;
+	struct quotakey qk;
+	struct quotaval blocks, files;
+	int idtype;
 
 	memset((char *)getq_args, 0, sizeof(getq_args));
 	memset((char *)ext_getq_args, 0, sizeof(ext_getq_args));
@@ -197,10 +240,10 @@ sendquota(struct svc_req *request, int v
 	}
 	switch (ext_getq_args.gqa_type) {
 	case RQUOTA_USRQUOTA:
-		class = QUOTADICT_CLASS_USER;
+		idtype = QUOTA_IDTYPE_USER;
 		break;
 	case RQUOTA_GRPQUOTA:
-		class = QUOTADICT_CLASS_GROUP;
+		idtype = QUOTA_IDTYPE_GROUP;
 		break;
 	default:
 		getq_rslt.status = Q_NOQUOTA;
@@ -209,32 +252,52 @@ sendquota(struct svc_req *request, int v
 	if (request-rq_cred.oa_flavor != AUTH_UNIX) {
 		/* bad auth */
 		getq_rslt.status = Q_EPERM;
-	} else if (!getufsquota(ext_getq_args.gqa_pathp, qv,
-	ext_getq_args.gqa_id, class)) {
+		goto out;
+	}
+
+	/*
+	 * XXX validate the path...
+	 */
+
+	qh = quota_open(ext_getq_args.gqa_pathp);
+	if (qh == NULL) {
+		/*
+		 * There are only three possible responses: success,
+		 * permission denied, and no quota, so we return
+		 * the last for essentially all errors.
+		 */
+		if (errno == EPERM || errno == EACCES) {
+			getq_rslt.status = Q_EPERM;
+			goto out;
+		}
+		getq_rslt.status = Q_NOQUOTA;
+		goto out;
+	}
+
+	qk.qk_id = ext_getq_args.gqa_id;
+	qk.qk_idtype = idtype;
+	qk.qk_objtype = QUOTA_OBJTYPE_BLOCKS;
+	if (quota_get(qh, qk, blocks)  0) {
 		/* failed, return noquota */
+		quota_close(qh);
 		getq_rslt.status = Q_NOQUOTA;
-	

CVS commit: src/usr.sbin/repquota

2012-01-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan  9 15:38:20 UTC 2012

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

Log Message:
Begin cleaning up repquota.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/repquota/repquota.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/repquota/repquota.c
diff -u src/usr.sbin/repquota/repquota.c:1.33 src/usr.sbin/repquota/repquota.c:1.34
--- src/usr.sbin/repquota/repquota.c:1.33	Fri Nov 25 16:55:06 2011
+++ src/usr.sbin/repquota/repquota.c	Mon Jan  9 15:38:20 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: repquota.c,v 1.33 2011/11/25 16:55:06 dholland Exp $	*/
+/*	$NetBSD: repquota.c,v 1.34 2012/01/09 15:38:20 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT(@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = @(#)repquota.c	8.2 (Berkeley) 11/22/94;
 #else
-__RCSID($NetBSD: repquota.c,v 1.33 2011/11/25 16:55:06 dholland Exp $);
+__RCSID($NetBSD: repquota.c,v 1.34 2012/01/09 15:38:20 dholland Exp $);
 #endif
 #endif /* not lint */
 
@@ -64,10 +64,9 @@ __RCSID($NetBSD: repquota.c,v 1.33 2011
 #include string.h
 #include unistd.h
 
-#include quota/quotaprop.h
 #include quota/quota.h
 #include ufs/ufs/quota1.h
-#include sys/quota.h
+#include quota.h
 
 #include printquota.h
 #include quotautil.h
@@ -158,18 +157,18 @@ main(int argc, char **argv)
 			continue;
 		if (aflag) {
 			if (gflag)
-errs += repquota(fst[i], QUOTA_CLASS_GROUP);
+errs += repquota(fst[i], QUOTA_IDTYPE_GROUP);
 			if (uflag)
-errs += repquota(fst[i], QUOTA_CLASS_USER);
+errs += repquota(fst[i], QUOTA_IDTYPE_USER);
 			continue;
 		}
 		if ((argnum = oneof(fst[i].f_mntonname, argv, argc)) = 0 ||
 		(argnum = oneof(fst[i].f_mntfromname, argv, argc)) = 0) {
 			done |= 1U  argnum;
 			if (gflag)
-errs += repquota(fst[i], QUOTA_CLASS_GROUP);
+errs += repquota(fst[i], QUOTA_IDTYPE_GROUP);
 			if (uflag)
-errs += repquota(fst[i], QUOTA_CLASS_USER);
+errs += repquota(fst[i], QUOTA_IDTYPE_USER);
 		}
 	}
 	if (xflag)
@@ -191,15 +190,15 @@ usage(void)
 }
 
 static int
-repquota(const struct statvfs *vfs, int class)
+repquota(const struct statvfs *vfs, int idtype)
 {
-	if (repquota2(vfs, class) != 0)
-		return repquota1(vfs, class);
+	if (repquota2(vfs, idtype) != 0)
+		return repquota1(vfs, idtype);
 	return 0;
 }
 
 static int
-repquota2(const struct statvfs *vfs, int class)
+repquota2(const struct statvfs *vfs, int idtype)
 {
 	prop_dictionary_t dict, data, cmd;
 	prop_array_t cmds, datas;
@@ -219,10 +218,10 @@ repquota2(const struct statvfs *vfs, int
 	if (dict == NULL || cmds == NULL || datas == NULL)
 		errx(1, can't allocate proplist);
 	if (!quota_prop_add_command(cmds, getall,
-	ufs_quota_class_names[class], datas))
+	ufs_quota_class_names[idtype], datas))
 		err(1, prop_add_command);
 	if (!quota_prop_add_command(cmds, get version,
-	ufs_quota_class_names[class], prop_array_create()))
+	ufs_quota_class_names[idtype], prop_array_create()))
 		err(1, prop_add_command);
 	if (!prop_dictionary_set(dict, commands, cmds))
 		err(1, prop_dictionary_set(command));
@@ -263,7 +262,7 @@ repquota2(const struct statvfs *vfs, int
 			if (error8 != EOPNOTSUPP) {
 errno = error8;
 warn(get %s quotas,
-ufs_quota_class_names[class]);
+ufs_quota_class_names[idtype]);
 			}
 			return error8;
 		}
@@ -284,9 +283,9 @@ repquota2(const struct statvfs *vfs, int
 		if (dataiter == NULL)
 			err(1, prop_array_iterator);
 
-		valid[class] = 0;
+		valid[idtype] = 0;
 		while ((data = prop_object_iterator_next(dataiter)) != NULL) {
-			valid[class] = 1;
+			valid[idtype] = 1;
 			strid = NULL;
 			if (!prop_dictionary_get_uint32(data, id, id)) {
 if (!prop_dictionary_get_cstring_nocopy(data,
@@ -297,10 +296,10 @@ repquota2(const struct statvfs *vfs, int
 	wrong id string %s in quota entry,
 	strid);
 }
-qvp = defaultqv[class];
+qvp = defaultqv[idtype];
 			} else {
-if ((fup = lookup(id, class)) == 0)
-	fup = addid(id, class, (char *)0);
+if ((fup = lookup(id, idtype)) == 0)
+	fup = addid(id, idtype, (char *)0);
 qvp = fup-fu_qv;
 			}
 			values[QUOTA_LIMIT_BLOCK] =
@@ -318,13 +317,13 @@ repquota2(const struct statvfs *vfs, int
 	}
 	prop_object_iterator_release(cmditer);
 	prop_object_release(dict);
-	if (xflag == 0  valid[class])
-		printquotas(class, vfs, version);
+	if (xflag == 0  valid[idtype])
+		printquotas(idtype, vfs, version);
 	return 0;
 }
 
 static int
-repquota1(const struct statvfs *vfs, int class)
+repquota1(const struct statvfs *vfs, int idtype)
 {
 	char qfpathname[MAXPATHLEN];
 	struct fstab *fs;
@@ -333,7 +332,7 @@ repquota1(const struct statvfs *vfs, int
 	uint32_t id;
 	struct dqblk dqbuf;
 	time_t bgrace = MAX_DQ_TIME, igrace = MAX_DQ_TIME;
-	int type = ufsclass2qtype(class);
+	int type 

CVS commit: src/usr.sbin/repquota

2012-01-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan  9 15:38:59 UTC 2012

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

Log Message:
More work on repquota.
   - open quotahandles, pass them around, use them for metadata
   - split up some of the proplib code


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/repquota/repquota.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/repquota/repquota.c
diff -u src/usr.sbin/repquota/repquota.c:1.34 src/usr.sbin/repquota/repquota.c:1.35
--- src/usr.sbin/repquota/repquota.c:1.34	Mon Jan  9 15:38:20 2012
+++ src/usr.sbin/repquota/repquota.c	Mon Jan  9 15:38:59 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: repquota.c,v 1.34 2012/01/09 15:38:20 dholland Exp $	*/
+/*	$NetBSD: repquota.c,v 1.35 2012/01/09 15:38:59 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT(@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = @(#)repquota.c	8.2 (Berkeley) 11/22/94;
 #else
-__RCSID($NetBSD: repquota.c,v 1.34 2012/01/09 15:38:20 dholland Exp $);
+__RCSID($NetBSD: repquota.c,v 1.35 2012/01/09 15:38:59 dholland Exp $);
 #endif
 #endif /* not lint */
 
@@ -94,11 +94,11 @@ static int	xflag = 0;		/* export */
 static struct fileusage *addid(uint32_t, int, const char *);
 static struct fileusage *lookup(uint32_t, int);
 static struct fileusage *qremove(uint32_t, int);
-static int	repquota(const struct statvfs *, int);
-static int	repquota2(const struct statvfs *, int);
-static int	repquota1(const struct statvfs *, int);
+static int	repquota(struct quotahandle *, int);
+static int	repquota2(struct quotahandle *, int);
+static int	repquota1(struct quotahandle *, int);
 static void	usage(void) __attribute__((__noreturn__));
-static void	printquotas(int, const struct statvfs *, int);
+static void	printquotas(int, struct quotahandle *);
 static void	exportquotas(void);
 
 int
@@ -109,6 +109,7 @@ main(int argc, char **argv)
 	int ch;
 	struct statvfs *fst;
 	int nfst;
+	struct quotahandle *qh;
 
 	while ((ch = getopt(argc, argv, Daguhvx)) != -1) {
 		switch(ch) {
@@ -155,21 +156,35 @@ main(int argc, char **argv)
 	for (i = 0; i  nfst; i++) {
 		if ((fst[i].f_flag  ST_QUOTA) == 0)
 			continue;
-		if (aflag) {
-			if (gflag)
-errs += repquota(fst[i], QUOTA_IDTYPE_GROUP);
-			if (uflag)
-errs += repquota(fst[i], QUOTA_IDTYPE_USER);
-			continue;
-		}
-		if ((argnum = oneof(fst[i].f_mntonname, argv, argc)) = 0 ||
-		(argnum = oneof(fst[i].f_mntfromname, argv, argc)) = 0) {
+		/* check if we want this volume */
+		if (!aflag) {
+			argnum = oneof(fst[i].f_mntonname, argv, argc);
+			if (argnum  0) {
+argnum = oneof(fst[i].f_mntfromname,
+	   argv, argc);
+			}
+			if (argnum  0) {
+continue;
+			}
 			done |= 1U  argnum;
-			if (gflag)
-errs += repquota(fst[i], QUOTA_IDTYPE_GROUP);
-			if (uflag)
-errs += repquota(fst[i], QUOTA_IDTYPE_USER);
 		}
+
+		qh = quota_open(fst[i].f_mntonname);
+		if (qh == NULL) {
+			/* XXX: check this errno */
+			if (errno == EOPNOTSUPP || errno == ENXIO) {
+continue;
+			}
+			warn(%s: quota_open, fst[i].f_mntonname);
+			continue;
+		}
+
+		if (gflag)
+			errs += repquota(qh, QUOTA_IDTYPE_GROUP);
+		if (uflag)
+			errs += repquota(qh, QUOTA_IDTYPE_USER);
+
+		quota_close(qh);
 	}
 	if (xflag)
 		exportquotas();
@@ -190,26 +205,20 @@ usage(void)
 }
 
 static int
-repquota(const struct statvfs *vfs, int idtype)
+repquota(struct quotahandle *qh, int idtype)
 {
-	if (repquota2(vfs, idtype) != 0)
-		return repquota1(vfs, idtype);
+	if (repquota2(qh, idtype) != 0)
+		return repquota1(qh, idtype);
 	return 0;
 }
 
 static int
-repquota2(const struct statvfs *vfs, int idtype)
+repquota2_getstuff(struct quotahandle *qh, int idtype, prop_array_t *ret)
 {
-	prop_dictionary_t dict, data, cmd;
+	prop_dictionary_t dict, cmd;
 	prop_array_t cmds, datas;
 	struct plistref pref;
-	int8_t error8, version = 0;
-	prop_object_iterator_t cmditer, dataiter;
-	struct quotaval *qvp;
-	struct fileusage *fup;
-	const char *strid;
-	uint32_t id;
-	uint64_t *values[QUOTA_NLIMITS];
+	int8_t error8;
 
 	dict = quota_prop_create();
 	cmds = prop_array_create();
@@ -220,9 +229,6 @@ repquota2(const struct statvfs *vfs, int
 	if (!quota_prop_add_command(cmds, getall,
 	ufs_quota_class_names[idtype], datas))
 		err(1, prop_add_command);
-	if (!quota_prop_add_command(cmds, get version,
-	ufs_quota_class_names[idtype], prop_array_create()))
-		err(1, prop_add_command);
 	if (!prop_dictionary_set(dict, commands, cmds))
 		err(1, prop_dictionary_set(command));
 	if (Dflag)
@@ -232,7 +238,7 @@ repquota2(const struct statvfs *vfs, int
 		err(1, prop_dictionary_send_syscall);
 	prop_object_release(dict);
 
-	if (quotactl(vfs-f_mntonname, pref) != 0)
+	if (quotactl(quota_getmountpoint(qh), pref) != 0)
 		err(1, quotactl);
 
 	if (prop_dictionary_recv_syscall(pref, dict) != 0) 

CVS commit: src/lib/libquota

2012-01-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan  9 15:40:10 UTC 2012

Modified Files:
src/lib/libquota: quota_cursor.c quota_proplib.c quotapvt.h

Log Message:
Implement the libquota cursor interface, using proplib code from repquota.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libquota/quota_cursor.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libquota/quota_proplib.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libquota/quotapvt.h

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

Modified files:

Index: src/lib/libquota/quota_cursor.c
diff -u src/lib/libquota/quota_cursor.c:1.1 src/lib/libquota/quota_cursor.c:1.2
--- src/lib/libquota/quota_cursor.c:1.1	Mon Jan  9 15:22:38 2012
+++ src/lib/libquota/quota_cursor.c	Mon Jan  9 15:40:10 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quota_cursor.c,v 1.1 2012/01/09 15:22:38 dholland Exp $	*/
+/*	$NetBSD: quota_cursor.c,v 1.2 2012/01/09 15:40:10 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,65 +29,81 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: quota_cursor.c,v 1.1 2012/01/09 15:22:38 dholland Exp $);
+__RCSID($NetBSD: quota_cursor.c,v 1.2 2012/01/09 15:40:10 dholland Exp $);
 
 #include stdlib.h
 #include errno.h
 
 #include quota.h
+#include quotapvt.h
 
-/* ARGSUSED */
 struct quotacursor *
 quota_opencursor(struct quotahandle *qh)
 {
-	errno = ENOSYS;
-	return NULL;
+	struct quotacursor *qc;
+	int serrno;
+
+	if (qh-qh_isnfs) {
+		errno = EOPNOTSUPP;
+		return NULL;
+	}
+
+	qc = malloc(sizeof(*qc));
+	if (qc == NULL) {
+		return NULL;
+	}
+
+	qc-qc_qh = qh;
+	qc-u.qc_proplib = __quota_proplib_cursor_create();
+
+	if (qc-u.qc_proplib == NULL) {
+		serrno = errno;
+		free(qc);
+		errno = serrno;
+		return NULL;
+	}
+	return qc;
 }
 
-/* ARGSUSED */
 void
 quotacursor_close(struct quotacursor *qc)
 {
+	__quota_proplib_cursor_destroy(qc-u.qc_proplib);
+	free(qc);
 }
 
-/* ARGSUSED */
 int
 quotacursor_skipidtype(struct quotacursor *qc, unsigned idtype)
 {
-	errno = ENOSYS;
-	return -1;
+	return __quota_proplib_cursor_skipidtype(qc-u.qc_proplib, idtype);
 }
 
-/* ARGSUSED */
 int
 quotacursor_get(struct quotacursor *qc,
 		struct quotakey *qk_ret, struct quotaval *qv_ret)
 {
-	errno = ENOSYS;
-	return -1;
+	return __quota_proplib_cursor_get(qc-qc_qh, qc-u.qc_proplib,
+	  qk_ret, qv_ret);
 }
 
-/* ARGSUSED */
 int
 quotacursor_getn(struct quotacursor *qc,
 		 struct quotakey *keys, struct quotaval *vals, 
 		 unsigned maxnum)
 {
-	errno = ENOSYS;
-	return -1;
+	return __quota_proplib_cursor_getn(qc-qc_qh, qc-u.qc_proplib,
+	   keys, vals, maxnum);
 }
 
-/* ARGSUSED */
 int
 quotacursor_atend(struct quotacursor *qc)
 {
-	return 0;
+	return __quota_proplib_cursor_atend(qc-qc_qh,
+	qc-u.qc_proplib);
 }
 
-/* ARGSUSED */
 int
 quotacursor_rewind(struct quotacursor *qc)
 {
-	errno = ENOSYS;
-	return -1;
+	return __quota_proplib_cursor_rewind(qc-u.qc_proplib);
 }

Index: src/lib/libquota/quota_proplib.c
diff -u src/lib/libquota/quota_proplib.c:1.3 src/lib/libquota/quota_proplib.c:1.4
--- src/lib/libquota/quota_proplib.c:1.3	Mon Jan  9 15:34:34 2012
+++ src/lib/libquota/quota_proplib.c	Mon Jan  9 15:40:10 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quota_proplib.c,v 1.3 2012/01/09 15:34:34 dholland Exp $	*/
+/*	$NetBSD: quota_proplib.c,v 1.4 2012/01/09 15:40:10 dholland Exp $	*/
 /*-
   * Copyright (c) 2011 Manuel Bouyer
   * All rights reserved.
@@ -26,9 +26,11 @@
   */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: quota_proplib.c,v 1.3 2012/01/09 15:34:34 dholland Exp $);
+__RCSID($NetBSD: quota_proplib.c,v 1.4 2012/01/09 15:40:10 dholland Exp $);
 
+#include stdlib.h
 #include string.h
+#include limits.h
 #include errno.h
 #include err.h
 
@@ -38,6 +40,21 @@ __RCSID($NetBSD: quota_proplib.c,v 1.3 
 #include quota/quotaprop.h
 #include quota/quota.h
 
+struct proplib_quotacursor {
+	prop_array_t users;
+	prop_array_t groups;
+
+	unsigned numusers;
+	unsigned numgroups;
+
+	unsigned haveusers;
+	unsigned havegroups;
+
+	unsigned didusers;
+	unsigned pos;
+	unsigned didblocks;
+};
+
 static int
 __quota_proplib_getversion(struct quotahandle *qh, int8_t *version_ret)
 {
@@ -163,6 +180,63 @@ __quota_proplib_getimplname(struct quota
 	return unknown;
 }
 
+static int
+__quota_proplib_extractval(int objtype, prop_dictionary_t data,
+			   struct quotaval *qv)
+{
+	uint64_t vals[UFS_QUOTA_NENTRIES];
+	uint64_t *valptrs[1];
+	int limitcode;
+
+	/*
+	 * So, the way proptoquota64 works is that you pass it an
+	 * array of pointers to uint64. Each of these pointers is
+	 * supposed to point to 5 (UFS_QUOTA_NENTRIES) uint64s. This
+	 * array of pointers is the second argument. The third and
+	 * forth argument are the names of the five values to extract,
+	 * and UFS_QUOTA_NENTRIES. The last two arguments are the
+	 * names assocated with the pointers (QUOTATYPE_LDICT_BLOCK,
+	 * QUOTADICT_LTYPE_FILE) and the number of pointers. 

CVS commit: src/usr.sbin/repquota

2012-01-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan  9 15:40:47 UTC 2012

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

Log Message:
Make repquota use the libquota cursor interface.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/usr.sbin/repquota/repquota.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/repquota/repquota.c
diff -u src/usr.sbin/repquota/repquota.c:1.35 src/usr.sbin/repquota/repquota.c:1.36
--- src/usr.sbin/repquota/repquota.c:1.35	Mon Jan  9 15:38:59 2012
+++ src/usr.sbin/repquota/repquota.c	Mon Jan  9 15:40:47 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: repquota.c,v 1.35 2012/01/09 15:38:59 dholland Exp $	*/
+/*	$NetBSD: repquota.c,v 1.36 2012/01/09 15:40:47 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT(@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = @(#)repquota.c	8.2 (Berkeley) 11/22/94;
 #else
-__RCSID($NetBSD: repquota.c,v 1.35 2012/01/09 15:38:59 dholland Exp $);
+__RCSID($NetBSD: repquota.c,v 1.36 2012/01/09 15:40:47 dholland Exp $);
 #endif
 #endif /* not lint */
 
@@ -213,134 +213,53 @@ repquota(struct quotahandle *qh, int idt
 }
 
 static int
-repquota2_getstuff(struct quotahandle *qh, int idtype, prop_array_t *ret)
-{
-	prop_dictionary_t dict, cmd;
-	prop_array_t cmds, datas;
-	struct plistref pref;
-	int8_t error8;
-
-	dict = quota_prop_create();
-	cmds = prop_array_create();
-	datas = prop_array_create();
-
-	if (dict == NULL || cmds == NULL || datas == NULL)
-		errx(1, can't allocate proplist);
-	if (!quota_prop_add_command(cmds, getall,
-	ufs_quota_class_names[idtype], datas))
-		err(1, prop_add_command);
-	if (!prop_dictionary_set(dict, commands, cmds))
-		err(1, prop_dictionary_set(command));
-	if (Dflag)
-		printf(message to kernel:\n%s\n,
-		prop_dictionary_externalize(dict));
-	if (prop_dictionary_send_syscall(dict, pref) != 0)
-		err(1, prop_dictionary_send_syscall);
-	prop_object_release(dict);
-
-	if (quotactl(quota_getmountpoint(qh), pref) != 0)
-		err(1, quotactl);
-
-	if (prop_dictionary_recv_syscall(pref, dict) != 0) {
-		err(1, prop_dictionary_recv_syscall);
-	}
-	if (Dflag)
-		printf(reply from kernel:\n%s\n,
-		prop_dictionary_externalize(dict));
-	if ((errno = quota_get_cmds(dict, cmds)) != 0) {
-		err(1, quota_get_cmds);
-	}
-
-	cmd = prop_array_get(cmds, 0);
-	if (cmd == NULL) {
-		err(1, prop_array_get(cmds));
-	}
-
-	const char *cmdstr;
-	if (!prop_dictionary_get_cstring_nocopy(cmd, command,
-	cmdstr))
-		err(1, prop_get(command));
-
-	if (!prop_dictionary_get_int8(cmd, return, error8))
-		err(1, prop_get(return));
-
-	if (error8) {
-		prop_object_release(dict);
-		if (error8 != EOPNOTSUPP) {
-			errno = error8;
-			warn(get %s quotas,
-			ufs_quota_class_names[idtype]);
-		}
-		return 1;
-	}
-	datas = prop_dictionary_get(cmd, data);
-	if (datas == NULL)
-		err(1, prop_dict_get(datas));
-
-	prop_object_retain(datas);
-	prop_object_release(dict);
-
-	*ret = datas;
-	return 0;
-}
-
-static int
 repquota2(struct quotahandle *qh, int idtype)
 {
-	prop_dictionary_t data;
-	prop_array_t datas;
-	prop_object_iterator_t dataiter;
+	struct quotacursor *qc;
+	struct quotakey qk;
+	struct quotaval qv;
 	struct quotaval *qvp;
 	struct fileusage *fup;
-	const char *strid;
-	uint32_t id;
-	uint64_t *values[QUOTA_NLIMITS];
 
-	if (repquota2_getstuff(qh, idtype, datas)) {
+	qc = quota_opencursor(qh);
+	if (qc == NULL) {
 		return 1;
 	}
 
-		dataiter = prop_array_iterator(datas);
-		if (dataiter == NULL)
-			err(1, prop_array_iterator);
-
-		valid[idtype] = 0;
-		while ((data = prop_object_iterator_next(dataiter)) != NULL) {
-			valid[idtype] = 1;
-			strid = NULL;
-			if (!prop_dictionary_get_uint32(data, id, id)) {
-if (!prop_dictionary_get_cstring_nocopy(data,
-id, strid))
-	errx(1, can't find id in quota entry);
-if (strcmp(strid, default) != 0) {
-	errx(1,
-	wrong id string %s in quota entry,
-	strid);
-}
-qvp = defaultqv[idtype];
-			} else {
-if ((fup = lookup(id, idtype)) == 0)
-	fup = addid(id, idtype, (char *)0);
-qvp = fup-fu_qv;
-			}
-			values[QUOTA_LIMIT_BLOCK] =
-			qvp[QUOTA_LIMIT_BLOCK].qv_hardlimit;
-			values[QUOTA_LIMIT_FILE] =
-			qvp[QUOTA_LIMIT_FILE].qv_hardlimit;
-
-			errno = proptoquota64(data, values,
-			ufs_quota_entry_names, UFS_QUOTA_NENTRIES,
-			ufs_quota_limit_names, QUOTA_NLIMITS);
-			if (errno)
-err(1, proptoquota64);
+	if (idtype == QUOTA_IDTYPE_USER) {
+		quotacursor_skipidtype(qc, QUOTA_IDTYPE_GROUP);
+	}
+	if (idtype == QUOTA_IDTYPE_GROUP) {
+		quotacursor_skipidtype(qc, QUOTA_IDTYPE_USER);
+	}
+
+	valid[idtype] = 0;
+	while (!quotacursor_atend(qc)) {
+		if (quotacursor_get(qc, qk, qv)) {
+			err(1, %s: quotacursor_get, quota_getmountpoint(qh));
+		}
+		if (qk.qk_idtype != idtype) {
+			continue;
 		}
-		

CVS commit: src/crypto/dist/ipsec-tools/src/setkey

2012-01-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Jan  9 15:41:22 UTC 2012

Modified Files:
src/crypto/dist/ipsec-tools/src/setkey: setkey.8

Log Message:
Bump date for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/crypto/dist/ipsec-tools/src/setkey/setkey.8

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

Modified files:

Index: src/crypto/dist/ipsec-tools/src/setkey/setkey.8
diff -u src/crypto/dist/ipsec-tools/src/setkey/setkey.8:1.29 src/crypto/dist/ipsec-tools/src/setkey/setkey.8:1.30
--- src/crypto/dist/ipsec-tools/src/setkey/setkey.8:1.29	Mon Jan  9 15:25:13 2012
+++ src/crypto/dist/ipsec-tools/src/setkey/setkey.8	Mon Jan  9 15:41:21 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: setkey.8,v 1.29 2012/01/09 15:25:13 drochner Exp $
+.\	$NetBSD: setkey.8,v 1.30 2012/01/09 15:41:21 wiz Exp $
 .\
 .\ Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\ SUCH DAMAGE.
 .\
-.Dd May 23, 2011
+.Dd January 9, 2012
 .Dt SETKEY 8
 .Os
 .\



CVS commit: src/lib/libquota

2012-01-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan  9 15:41:59 UTC 2012

Modified Files:
src/lib/libquota: Makefile quota_cursor.c quota_open.c quota_proplib.c
quotapvt.h
Added Files:
src/lib/libquota: quota_oldfiles.c

Log Message:
Implement fallback direct access to quota1-type quota files.
Uses (mostly) code from repquota. Add some missing pieces that
weren't in repquota.

Use the direct file access code for cursors if proplib reports the
quota version is 1.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libquota/Makefile \
src/lib/libquota/quota_proplib.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libquota/quota_cursor.c
cvs rdiff -u -r0 -r1.1 src/lib/libquota/quota_oldfiles.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libquota/quota_open.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libquota/quotapvt.h

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

Modified files:

Index: src/lib/libquota/Makefile
diff -u src/lib/libquota/Makefile:1.4 src/lib/libquota/Makefile:1.5
--- src/lib/libquota/Makefile:1.4	Mon Jan  9 15:29:55 2012
+++ src/lib/libquota/Makefile	Mon Jan  9 15:41:58 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2012/01/09 15:29:55 dholland Exp $
+#	$NetBSD: Makefile,v 1.5 2012/01/09 15:41:58 dholland Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/4/93
 
 .include bsd.own.mk
@@ -20,5 +20,6 @@ SRCS+=	quota_get.c quota_put.c quota_del
 SRCS+=	quota_cursor.c
 SRCS+=	quota_proplib.c
 SRCS+=	quota_nfs.c
+SRCS+=	quota_oldfiles.c
 
 .include bsd.lib.mk
Index: src/lib/libquota/quota_proplib.c
diff -u src/lib/libquota/quota_proplib.c:1.4 src/lib/libquota/quota_proplib.c:1.5
--- src/lib/libquota/quota_proplib.c:1.4	Mon Jan  9 15:40:10 2012
+++ src/lib/libquota/quota_proplib.c	Mon Jan  9 15:41:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quota_proplib.c,v 1.4 2012/01/09 15:40:10 dholland Exp $	*/
+/*	$NetBSD: quota_proplib.c,v 1.5 2012/01/09 15:41:58 dholland Exp $	*/
 /*-
   * Copyright (c) 2011 Manuel Bouyer
   * All rights reserved.
@@ -26,7 +26,7 @@
   */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: quota_proplib.c,v 1.4 2012/01/09 15:40:10 dholland Exp $);
+__RCSID($NetBSD: quota_proplib.c,v 1.5 2012/01/09 15:41:58 dholland Exp $);
 
 #include stdlib.h
 #include string.h
@@ -55,7 +55,7 @@ struct proplib_quotacursor {
 	unsigned didblocks;
 };
 
-static int
+int
 __quota_proplib_getversion(struct quotahandle *qh, int8_t *version_ret)
 {
 	const char *idtype;

Index: src/lib/libquota/quota_cursor.c
diff -u src/lib/libquota/quota_cursor.c:1.2 src/lib/libquota/quota_cursor.c:1.3
--- src/lib/libquota/quota_cursor.c:1.2	Mon Jan  9 15:40:10 2012
+++ src/lib/libquota/quota_cursor.c	Mon Jan  9 15:41:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quota_cursor.c,v 1.2 2012/01/09 15:40:10 dholland Exp $	*/
+/*	$NetBSD: quota_cursor.c,v 1.3 2012/01/09 15:41:58 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: quota_cursor.c,v 1.2 2012/01/09 15:40:10 dholland Exp $);
+__RCSID($NetBSD: quota_cursor.c,v 1.3 2012/01/09 15:41:58 dholland Exp $);
 
 #include stdlib.h
 #include errno.h
@@ -41,6 +41,7 @@ struct quotacursor *
 quota_opencursor(struct quotahandle *qh)
 {
 	struct quotacursor *qc;
+	int8_t version;
 	int serrno;
 
 	if (qh-qh_isnfs) {
@@ -48,19 +49,45 @@ quota_opencursor(struct quotahandle *qh)
 		return NULL;
 	}
 
+	if (__quota_proplib_getversion(qh, version)) {
+		return NULL;
+	}
+
+	/*
+	 * For the time being at least the version 1 kernel code
+	 * cannot do cursors.
+	 */
+	if (version == 1  !qh-qh_hasoldfiles) {
+		if (__quota_oldfiles_initialize(qh)) {
+			return NULL;
+		}
+	}
+
 	qc = malloc(sizeof(*qc));
 	if (qc == NULL) {
 		return NULL;
 	}
 
 	qc-qc_qh = qh;
-	qc-u.qc_proplib = __quota_proplib_cursor_create();
 
-	if (qc-u.qc_proplib == NULL) {
-		serrno = errno;
-		free(qc);
-		errno = serrno;
-		return NULL;
+	if (version == 1) {
+		qc-qc_type = QC_OLDFILES;
+		qc-u.qc_oldfiles = __quota_oldfiles_cursor_create(qh);
+		if (qc-u.qc_oldfiles == NULL) {
+			serrno = errno;
+			free(qc);
+			errno = serrno;
+			return NULL;
+		}
+	} else {
+		qc-qc_type = QC_PROPLIB;
+		qc-u.qc_proplib = __quota_proplib_cursor_create();
+		if (qc-u.qc_proplib == NULL) {
+			serrno = errno;
+			free(qc);
+			errno = serrno;
+			return NULL;
+		}
 	}
 	return qc;
 }
@@ -68,22 +95,47 @@ quota_opencursor(struct quotahandle *qh)
 void
 quotacursor_close(struct quotacursor *qc)
 {
-	__quota_proplib_cursor_destroy(qc-u.qc_proplib);
+	switch (qc-qc_type) {
+	case QC_PROPLIB:
+		__quota_proplib_cursor_destroy(qc-u.qc_proplib);
+		break;
+	case QC_OLDFILES:
+		__quota_oldfiles_cursor_destroy(qc-u.qc_oldfiles);
+		break;
+	}
 	free(qc);
 }
 
 int
 quotacursor_skipidtype(struct quotacursor *qc, unsigned idtype)
 {
-	return __quota_proplib_cursor_skipidtype(qc-u.qc_proplib, idtype);
+	switch (qc-qc_type) {
+	case 

CVS commit: src/sys/netipsec

2012-01-09 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Mon Jan  9 15:42:08 UTC 2012

Modified Files:
src/sys/netipsec: key.c

Log Message:
allow the ESP fragment length in the NAT-T case to be reported back
through the pfkey interface, kernel part of PR kern/44952
by Wolfgang Stukenbrock


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/netipsec/key.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/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.75 src/sys/netipsec/key.c:1.76
--- src/sys/netipsec/key.c:1.75	Mon Dec 19 11:47:16 2011
+++ src/sys/netipsec/key.c	Mon Jan  9 15:42:08 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.75 2011/12/19 11:47:16 drochner Exp $	*/
+/*	$NetBSD: key.c,v 1.76 2012/01/09 15:42:08 drochner Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 	
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: key.c,v 1.75 2011/12/19 11:47:16 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: key.c,v 1.76 2012/01/09 15:42:08 drochner Exp $);
 
 /*
  * This code is referd to RFC 2367
@@ -427,6 +427,7 @@ static struct mbuf *key_setdumpsa (struc
 #ifdef IPSEC_NAT_T
 static struct mbuf *key_setsadbxport (u_int16_t, u_int16_t);
 static struct mbuf *key_setsadbxtype (u_int16_t);
+static struct mbuf *key_setsadbxfrag (u_int16_t);
 #endif
 static void key_porttosaddr (union sockaddr_union *, u_int16_t);
 static int key_checksalen (const union sockaddr_union *);
@@ -3629,9 +3630,15 @@ key_setdumpsa(struct secasvar *sav, u_in
 SADB_X_EXT_NAT_T_SPORT);
 			break;
 
+		case SADB_X_EXT_NAT_T_FRAG:
+			/* don't send frag info if not set */
+			if (sav-natt_type == 0 || sav-esp_frag == IP_MAXPACKET)
+continue;
+			m = key_setsadbxfrag(sav-esp_frag);
+			break;
+
 		case SADB_X_EXT_NAT_T_OAI:
 		case SADB_X_EXT_NAT_T_OAR:
-		case SADB_X_EXT_NAT_T_FRAG:
 			continue;
 #endif
 
@@ -3749,6 +3756,35 @@ key_setsadbxport(u_int16_t port, u_int16
 	return m;
 }
 
+/*
+ * set fragmentation info in sadb_x_nat_t_frag
+ */
+static struct mbuf *
+key_setsadbxfrag(u_int16_t flen)
+{
+	struct mbuf *m;
+	size_t len;
+	struct sadb_x_nat_t_frag *p;
+
+	len = PFKEY_ALIGN8(sizeof(struct sadb_x_nat_t_frag));
+
+	m = key_alloc_mbuf(len);
+	if (!m || m-m_next) {  /*XXX*/
+		if (m)
+			m_freem(m);
+		return NULL;
+	}
+
+	p = mtod(m, struct sadb_x_nat_t_frag *);
+
+	memset(p, 0, len);
+	p-sadb_x_nat_t_frag_len = PFKEY_UNIT64(len);
+	p-sadb_x_nat_t_frag_exttype = SADB_X_EXT_NAT_T_FRAG;
+	p-sadb_x_nat_t_frag_fraglen = flen;
+
+	return m;
+}
+
 /* 
  * Get port from sockaddr, port is in network order
  */



CVS commit: src/usr.sbin/repquota

2012-01-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan  9 15:42:37 UTC 2012

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

Log Message:
Remove the explicit fallback direct file access code from repquota and
rely on libquota.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/repquota/repquota.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/repquota/repquota.c
diff -u src/usr.sbin/repquota/repquota.c:1.36 src/usr.sbin/repquota/repquota.c:1.37
--- src/usr.sbin/repquota/repquota.c:1.36	Mon Jan  9 15:40:47 2012
+++ src/usr.sbin/repquota/repquota.c	Mon Jan  9 15:42:37 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: repquota.c,v 1.36 2012/01/09 15:40:47 dholland Exp $	*/
+/*	$NetBSD: repquota.c,v 1.37 2012/01/09 15:42:37 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT(@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = @(#)repquota.c	8.2 (Berkeley) 11/22/94;
 #else
-__RCSID($NetBSD: repquota.c,v 1.36 2012/01/09 15:40:47 dholland Exp $);
+__RCSID($NetBSD: repquota.c,v 1.37 2012/01/09 15:42:37 dholland Exp $);
 #endif
 #endif /* not lint */
 
@@ -65,11 +65,10 @@ __RCSID($NetBSD: repquota.c,v 1.36 2012
 #include unistd.h
 
 #include quota/quota.h
-#include ufs/ufs/quota1.h
+#include quota/quotaprop.h
 #include quota.h
 
 #include printquota.h
-#include quotautil.h
 
 struct fileusage {
 	struct	fileusage *fu_next;
@@ -95,11 +94,10 @@ static struct fileusage *addid(uint32_t,
 static struct fileusage *lookup(uint32_t, int);
 static struct fileusage *qremove(uint32_t, int);
 static int	repquota(struct quotahandle *, int);
-static int	repquota2(struct quotahandle *, int);
-static int	repquota1(struct quotahandle *, int);
 static void	usage(void) __attribute__((__noreturn__));
 static void	printquotas(int, struct quotahandle *);
 static void	exportquotas(void);
+static int	oneof(const char *, char *[], int cnt);
 
 int
 main(int argc, char **argv)
@@ -207,14 +205,6 @@ usage(void)
 static int
 repquota(struct quotahandle *qh, int idtype)
 {
-	if (repquota2(qh, idtype) != 0)
-		return repquota1(qh, idtype);
-	return 0;
-}
-
-static int
-repquota2(struct quotahandle *qh, int idtype)
-{
 	struct quotacursor *qc;
 	struct quotakey qk;
 	struct quotaval qv;
@@ -263,72 +253,6 @@ repquota2(struct quotahandle *qh, int id
 	return 0;
 }
 
-static int
-repquota1(struct quotahandle *qh, int idtype)
-{
-	char qfpathname[MAXPATHLEN];
-	struct fstab *fs;
-	struct fileusage *fup;
-	FILE *qf;
-	uint32_t id;
-	struct dqblk dqbuf;
-	time_t bgrace = MAX_DQ_TIME, igrace = MAX_DQ_TIME;
-	int type = ufsclass2qtype(idtype);
-	const char *mountpoint;
-
-	mountpoint = quota_getmountpoint(qh);
-
-	setfsent();
-	while ((fs = getfsent()) != NULL) {
-		if (strcmp(fs-fs_vfstype, ffs) == 0 
-		   strcmp(fs-fs_file, mountpoint) == 0)
-			break;
-	}
-	endfsent();
-	if (fs == NULL) {
-		warnx(%s not found in fstab, mountpoint);
-		return 1;
-	}
-	if (!hasquota(qfpathname, sizeof(qfpathname), fs, type))
-		return 0;
-		
-	if ((qf = fopen(qfpathname, r)) == NULL) {
-		warn(Cannot open `%s', qfpathname);
-		return 1;
-	}
-	for (id = 0; ; id++) {
-		fread(dqbuf, sizeof(struct dqblk), 1, qf);
-		if (feof(qf))
-			break;
-		if (id == 0) {
-			if (dqbuf.dqb_btime  0)
-bgrace = dqbuf.dqb_btime;
-			if (dqbuf.dqb_itime  0)
-igrace = dqbuf.dqb_itime;
-		}
-		if (dqbuf.dqb_curinodes == 0  dqbuf.dqb_curblocks == 0 
-		dqbuf.dqb_bsoftlimit == 0  dqbuf.dqb_bhardlimit == 0 
-		dqbuf.dqb_isoftlimit == 0  dqbuf.dqb_ihardlimit == 0)
-			continue;
-		if ((fup = lookup(id, idtype)) == 0)
-			fup = addid(id, idtype, (char *)0);
-		dqblk_to_quotaval(dqbuf, fup-fu_qv);
-		fup-fu_qv[QUOTA_LIMIT_BLOCK].qv_grace = bgrace;
-		fup-fu_qv[QUOTA_LIMIT_FILE].qv_grace = igrace;
-	}
-	defaultqv[idtype][QUOTA_LIMIT_BLOCK].qv_grace = bgrace;
-	defaultqv[idtype][QUOTA_LIMIT_FILE].qv_grace = igrace;
-	defaultqv[idtype][QUOTA_LIMIT_BLOCK].qv_softlimit = 
-	defaultqv[idtype][QUOTA_LIMIT_BLOCK].qv_hardlimit = 
-	defaultqv[idtype][QUOTA_LIMIT_FILE].qv_softlimit = 
-	defaultqv[idtype][QUOTA_LIMIT_FILE].qv_hardlimit = QUOTA_NOLIMIT;
-	fclose(qf);
-	valid[idtype] = 1;
-	if (xflag == 0)
-		printquotas(idtype, qh);
-	return 0;
-}
-
 static void
 printquotas(int idtype, struct quotahandle *qh)
 {
@@ -591,3 +515,17 @@ addid(uint32_t id, int idtype, const cha
 	fup-fu_qv[QUOTA_LIMIT_FILE] = defaultqv[idtype][QUOTA_LIMIT_FILE];
 	return fup;
 }
+
+/*
+ * Check to see if target appears in list of size cnt.
+ */
+static int
+oneof(const char *target, char *list[], int cnt)
+{
+	int i;
+
+	for (i = 0; i  cnt; i++)
+		if (strcmp(target, list[i]) == 0)
+			return i;
+	return -1;
+}



CVS commit: src/lib/libquota

2012-01-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan  9 15:43:19 UTC 2012

Modified Files:
src/lib/libquota: quota_delete.c quota_proplib.c quota_put.c quotapvt.h

Log Message:
Implement quota_put() and quota_delete() using code from edquota(8).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libquota/quota_delete.c \
src/lib/libquota/quota_put.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libquota/quota_proplib.c
cvs rdiff -u -r1.6 -r1.7 src/lib/libquota/quotapvt.h

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

Modified files:

Index: src/lib/libquota/quota_delete.c
diff -u src/lib/libquota/quota_delete.c:1.1 src/lib/libquota/quota_delete.c:1.2
--- src/lib/libquota/quota_delete.c:1.1	Mon Jan  9 15:22:38 2012
+++ src/lib/libquota/quota_delete.c	Mon Jan  9 15:43:19 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quota_delete.c,v 1.1 2012/01/09 15:22:38 dholland Exp $	*/
+/*	$NetBSD: quota_delete.c,v 1.2 2012/01/09 15:43:19 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,16 +29,20 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: quota_delete.c,v 1.1 2012/01/09 15:22:38 dholland Exp $);
+__RCSID($NetBSD: quota_delete.c,v 1.2 2012/01/09 15:43:19 dholland Exp $);
 
 #include errno.h
 
 #include quota.h
+#include quotapvt.h
 
-/* ARGSUSED */
 int
 quota_delete(struct quotahandle *qh, const struct quotakey *qk)
 {
-	errno = ENOSYS;
-	return -1;
+	if (qh-qh_isnfs) {
+		errno = EOPNOTSUPP;
+		return -1;
+	} else {
+		return __quota_proplib_delete(qh, qk);
+	}
 }
Index: src/lib/libquota/quota_put.c
diff -u src/lib/libquota/quota_put.c:1.1 src/lib/libquota/quota_put.c:1.2
--- src/lib/libquota/quota_put.c:1.1	Mon Jan  9 15:22:38 2012
+++ src/lib/libquota/quota_put.c	Mon Jan  9 15:43:19 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quota_put.c,v 1.1 2012/01/09 15:22:38 dholland Exp $	*/
+/*	$NetBSD: quota_put.c,v 1.2 2012/01/09 15:43:19 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,17 +29,21 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: quota_put.c,v 1.1 2012/01/09 15:22:38 dholland Exp $);
+__RCSID($NetBSD: quota_put.c,v 1.2 2012/01/09 15:43:19 dholland Exp $);
 
 #include errno.h
 
 #include quota.h
+#include quotapvt.h
 
-/* ARGSUSED */
 int
 quota_put(struct quotahandle *qh, const struct quotakey *qk,
 	  const struct quotaval *qv)
 {
-	errno = ENOSYS;
-	return -1;
+	if (qh-qh_isnfs) {
+		errno = EOPNOTSUPP;
+		return -1;
+	} else {
+		return __quota_proplib_put(qh, qk, qv);
+	}
 }

Index: src/lib/libquota/quota_proplib.c
diff -u src/lib/libquota/quota_proplib.c:1.5 src/lib/libquota/quota_proplib.c:1.6
--- src/lib/libquota/quota_proplib.c:1.5	Mon Jan  9 15:41:58 2012
+++ src/lib/libquota/quota_proplib.c	Mon Jan  9 15:43:19 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quota_proplib.c,v 1.5 2012/01/09 15:41:58 dholland Exp $	*/
+/*	$NetBSD: quota_proplib.c,v 1.6 2012/01/09 15:43:19 dholland Exp $	*/
 /*-
   * Copyright (c) 2011 Manuel Bouyer
   * All rights reserved.
@@ -26,7 +26,7 @@
   */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: quota_proplib.c,v 1.5 2012/01/09 15:41:58 dholland Exp $);
+__RCSID($NetBSD: quota_proplib.c,v 1.6 2012/01/09 15:43:19 dholland Exp $);
 
 #include stdlib.h
 #include string.h
@@ -468,6 +468,239 @@ __quota_proplib_get(struct quotahandle *
 	return 0;
 }
 
+int
+__quota_proplib_put(struct quotahandle *qh, const struct quotakey *qk,
+		const struct quotaval *qv)
+{
+	prop_dictionary_t dict, data, cmd;
+	prop_array_t cmds, datas;
+	struct plistref pref;
+	int8_t error8;
+	uint64_t *valuesp[QUOTA_NLIMITS];
+	const char *idtype;
+	unsigned limitcode, otherlimitcode;
+	unsigned otherobjtype;
+	struct quotakey qk2;
+	struct quotaval qv2;
+
+	switch (qk-qk_idtype) {
+	case QUOTA_IDTYPE_USER:
+		idtype = ufs_quota_class_names[QUOTA_CLASS_USER];
+		break;
+	case QUOTA_IDTYPE_GROUP:
+		idtype = ufs_quota_class_names[QUOTA_CLASS_GROUP];
+		break;
+	default:
+		errno = EINVAL;
+		return -1;
+	}
+
+	switch (qk-qk_objtype) {
+	case QUOTA_OBJTYPE_BLOCKS:
+		limitcode = QUOTA_LIMIT_BLOCK;
+		otherlimitcode = QUOTA_LIMIT_FILE;
+		otherobjtype = QUOTA_OBJTYPE_FILES;
+		break;
+	case QUOTA_OBJTYPE_FILES:
+		limitcode = QUOTA_LIMIT_FILE;
+		otherlimitcode = QUOTA_LIMIT_BLOCK;
+		otherobjtype = QUOTA_OBJTYPE_BLOCKS;
+		break;
+	default:
+		errno = EINVAL;
+		return -1;
+	}
+
+	/* XXX in addition to being invalid/unsafe this also discards const */
+	valuesp[limitcode] = __UNCONST(qv-qv_hardlimit);
+
+	/*
+	 * You cannot set just the block info or just the file info.
+	 * You have to set both together, or EINVAL comes back. So we
+	 * have to fetch the current values for the other object type,
+	 * and stuff both into the RPC packet. Blah. XXX.
+	 */
+	qk2.qk_idtype = qk-qk_idtype;
+	qk2.qk_id = qk-qk_id;
+	qk2.qk_objtype = otherobjtype;
+	if (__quota_proplib_get(qh, qk2, qv2)) {
+		if (errno == 

CVS commit: src/usr.sbin/edquota

2012-01-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan  9 15:44:05 UTC 2012

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

Log Message:
Use quota_put() and quota_delete() to update quotas instead of making
quota proplib RPCs.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/edquota/edquota.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/edquota/edquota.c
diff -u src/usr.sbin/edquota/edquota.c:1.39 src/usr.sbin/edquota/edquota.c:1.40
--- src/usr.sbin/edquota/edquota.c:1.39	Fri Nov 25 16:55:05 2011
+++ src/usr.sbin/edquota/edquota.c	Mon Jan  9 15:44:05 2012
@@ -1,4 +1,4 @@
-/*  $NetBSD: edquota.c,v 1.39 2011/11/25 16:55:05 dholland Exp $ */
+/*  $NetBSD: edquota.c,v 1.40 2012/01/09 15:44:05 dholland Exp $ */
 /*
  * Copyright (c) 1980, 1990, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -41,7 +41,7 @@ __COPYRIGHT(@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = from: @(#)edquota.c	8.3 (Berkeley) 4/27/95;
 #else
-__RCSID($NetBSD: edquota.c,v 1.39 2011/11/25 16:55:05 dholland Exp $);
+__RCSID($NetBSD: edquota.c,v 1.40 2012/01/09 15:44:05 dholland Exp $);
 #endif
 #endif /* not lint */
 
@@ -56,6 +56,7 @@ __RCSID($NetBSD: edquota.c,v 1.39 2011/
 #include sys/types.h
 #include sys/statvfs.h
 
+#include quota.h
 #include quota/quotaprop.h
 #include quota/quota.h
 #include ufs/ufs/quota1.h
@@ -360,81 +361,39 @@ getprivs2(long id, int quotaclass, const
 static void
 putprivs2(uint32_t id, int quotaclass, struct quotause *qup)
 {
+	struct quotahandle *qh;
+	struct quotakey qk;
+	char idname[32];
+
+	if (qup-flags  DEFAULT) {
+		snprintf(idname, sizeof(idname), %s default,
+			 quotaclass == QUOTA_IDTYPE_USER ? user : group);
+		id = QUOTA_DEFAULTID;
+	} else {
+		snprintf(idname, sizeof(idname), %s %u,
+			 quotaclass == QUOTA_IDTYPE_USER ? uid : gid, id);
+	}
 
-	prop_dictionary_t dict, data, cmd;
-	prop_array_t cmds, datas;
-	struct plistref pref;
-	int8_t error8;
-	uint64_t *valuesp[QUOTA_NLIMITS];
-
-	valuesp[QL_BLK] =
-	qup-qv[QL_BLK].qv_hardlimit;
-	valuesp[QL_FL] =
-	qup-qv[QL_FL].qv_hardlimit;
-
-	data = quota64toprop(id, (qup-flags  DEFAULT) ? 1 : 0,
-	valuesp, ufs_quota_entry_names, UFS_QUOTA_NENTRIES,
-	ufs_quota_limit_names, QUOTA_NLIMITS);
-
-	if (data == NULL)
-		err(1, quota64toprop(id));
-
-	dict = quota_prop_create();
-	cmds = prop_array_create();
-	datas = prop_array_create();
-
-	if (dict == NULL || cmds == NULL || datas == NULL) {
-		errx(1, can't allocate proplist);
-	}
-
-	if (!prop_array_add_and_rel(datas, data))
-		err(1, prop_array_add(data));
-	
-	if (!quota_prop_add_command(cmds, set,
-	ufs_quota_class_names[quotaclass], datas))
-		err(1, prop_add_command);
-	if (!prop_dictionary_set(dict, commands, cmds))
-		err(1, prop_dictionary_set(command));
-	if (Dflag)
-		printf(message to kernel:\n%s\n,
-		prop_dictionary_externalize(dict));
-
-	if (prop_dictionary_send_syscall(dict, pref) != 0)
-		err(1, prop_dictionary_send_syscall);
-	prop_object_release(dict);
-
-	if (quotactl(qup-fsname, pref) != 0)
-		err(1, quotactl);
-
-	if (prop_dictionary_recv_syscall(pref, dict) != 0) {
-		err(1, prop_dictionary_recv_syscall);
-	}
-
-	if (Dflag)
-		printf(reply from kernel:\n%s\n,
-		prop_dictionary_externalize(dict));
-
-	if ((errno = quota_get_cmds(dict, cmds)) != 0) {
-		err(1, quota_get_cmds);
-	}
-	/* only one command, no need to iter */
-	cmd = prop_array_get(cmds, 0);
-	if (cmd == NULL)
-		err(1, prop_array_get(cmd));
-
-	if (!prop_dictionary_get_int8(cmd, return, error8))
-		err(1, prop_get(return));
-
-	if (error8) {
-		errno = error8;
-		if (qup-flags  DEFAULT)
-			warn(set default %s quota,
-			ufs_quota_class_names[quotaclass]);
-		else
-			warn(set %s quota for %u,
-			ufs_quota_class_names[quotaclass], id);
+	qh = quota_open(qup-fsname);
+	if (qh == NULL) {
+		err(1, %s: quota_open, qup-fsname);
 	}
-	prop_object_release(dict);
+
+	qk.qk_idtype = quotaclass;
+	qk.qk_id = id;
+	qk.qk_objtype = QUOTA_OBJTYPE_BLOCKS;
+	if (quota_put(qh, qk, qup-qv[QL_BLK])) {
+		err(1, %s: quota_put (%s blocks), qup-fsname, idname);
+	}
+
+	qk.qk_idtype = quotaclass;
+	qk.qk_id = id;
+	qk.qk_objtype = QUOTA_OBJTYPE_FILES;
+	if (quota_put(qh, qk, qup-qv[QL_FL])) {
+		err(1, %s: quota_put (%s files), qup-fsname, idname);
+	}
+
+	quota_close(qh);
 }
 
 
@@ -519,42 +478,35 @@ putprivs(uint32_t id, int quotaclass, st
 static void
 clearpriv(int argc, char **argv, const char *filesys, int quotaclass)
 {
-	prop_array_t cmds, datas;
-	prop_dictionary_t protodict, dict, data, cmd;
-	struct plistref pref;
-	bool ret;
 	struct statvfs *fst;
 	int nfst, i;
-	int8_t error8;
 	int id;
-
-	/* build a generic command */
-	protodict = quota_prop_create();
-	cmds = prop_array_create();
-	datas = prop_array_create();
-	if 

CVS commit: src/usr.sbin/edquota

2012-01-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan  9 15:44:42 UTC 2012

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

Log Message:
quotaclass - idtype. After lengthy wrangling on the mailing lists
the best conclusion for naming was to give up on classes and types
and use idtype for users vs. groups and objtype for blocks vs. files.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/usr.sbin/edquota/edquota.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/edquota/edquota.c
diff -u src/usr.sbin/edquota/edquota.c:1.40 src/usr.sbin/edquota/edquota.c:1.41
--- src/usr.sbin/edquota/edquota.c:1.40	Mon Jan  9 15:44:05 2012
+++ src/usr.sbin/edquota/edquota.c	Mon Jan  9 15:44:42 2012
@@ -1,4 +1,4 @@
-/*  $NetBSD: edquota.c,v 1.40 2012/01/09 15:44:05 dholland Exp $ */
+/*  $NetBSD: edquota.c,v 1.41 2012/01/09 15:44:42 dholland Exp $ */
 /*
  * Copyright (c) 1980, 1990, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -41,7 +41,7 @@ __COPYRIGHT(@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = from: @(#)edquota.c	8.3 (Berkeley) 4/27/95;
 #else
-__RCSID($NetBSD: edquota.c,v 1.40 2012/01/09 15:44:05 dholland Exp $);
+__RCSID($NetBSD: edquota.c,v 1.41 2012/01/09 15:44:42 dholland Exp $);
 #endif
 #endif /* not lint */
 
@@ -122,26 +122,26 @@ static int Dflag = 0;
  * getinoquota as to the interpretation of quota classes.
  */
 static int
-getidbyname(const char *name, int quotaclass)
+getidbyname(const char *name, int idtype)
 {
 	struct passwd *pw;
 	struct group *gr;
 
 	if (alldigits(name))
 		return atoi(name);
-	switch(quotaclass) {
-	case QUOTA_CLASS_USER:
+	switch (idtype) {
+	case QUOTA_IDTYPE_USER:
 		if ((pw = getpwnam(name)) != NULL)
 			return pw-pw_uid;
 		warnx(%s: no such user, name);
 		break;
-	case QUOTA_CLASS_GROUP:
+	case QUOTA_IDTYPE_GROUP:
 		if ((gr = getgrnam(name)) != NULL)
 			return gr-gr_gid;
 		warnx(%s: no such group, name);
 		break;
 	default:
-		warnx(%d: unknown quota type, quotaclass);
+		warnx(%d: unknown quota type, idtype);
 		break;
 	}
 	sleep(1);
@@ -244,7 +244,7 @@ quotalist_append(struct quotalist *qlist
 // ffs quota v1
 
 static void
-putprivs1(uint32_t id, int quotaclass, struct quotause *qup)
+putprivs1(uint32_t id, int idtype, struct quotause *qup)
 {
 	struct dqblk dqblk;
 	int fd;
@@ -266,7 +266,7 @@ putprivs1(uint32_t id, int quotaclass, s
 }
 
 static struct quotause *
-getprivs1(long id, int quotaclass, const char *filesys)
+getprivs1(long id, int idtype, const char *filesys)
 {
 	struct fstab *fs;
 	char qfpathname[MAXPATHLEN];
@@ -286,7 +286,7 @@ getprivs1(long id, int quotaclass, const
 		return NULL;
 
 	if (!hasquota(qfpathname, sizeof(qfpathname), fs,
-	ufsclass2qtype(quotaclass)))
+	ufsclass2qtype(idtype)))
 		return NULL;
 
 	qup = quotause_create();
@@ -335,7 +335,7 @@ getprivs1(long id, int quotaclass, const
 // ffs quota v2
 
 static struct quotause *
-getprivs2(long id, int quotaclass, const char *filesys, int defaultq)
+getprivs2(long id, int idtype, const char *filesys, int defaultq)
 {
 	struct quotause *qup;
 	int8_t version;
@@ -345,10 +345,10 @@ getprivs2(long id, int quotaclass, const
 	if (defaultq)
 		qup-flags |= DEFAULT;
 	if (!getvfsquota(filesys, qup-qv, version,
-	id, quotaclass, defaultq, Dflag)) {
+	id, idtype, defaultq, Dflag)) {
 		/* no entry, get default entry */
 		if (!getvfsquota(filesys, qup-qv, version,
-		id, quotaclass, 1, Dflag)) {
+		id, idtype, 1, Dflag)) {
 			free(qup);
 			return NULL;
 		}
@@ -359,7 +359,7 @@ getprivs2(long id, int quotaclass, const
 }
 
 static void
-putprivs2(uint32_t id, int quotaclass, struct quotause *qup)
+putprivs2(uint32_t id, int idtype, struct quotause *qup)
 {
 	struct quotahandle *qh;
 	struct quotakey qk;
@@ -367,11 +367,11 @@ putprivs2(uint32_t id, int quotaclass, s
 
 	if (qup-flags  DEFAULT) {
 		snprintf(idname, sizeof(idname), %s default,
-			 quotaclass == QUOTA_IDTYPE_USER ? user : group);
+			 idtype == QUOTA_IDTYPE_USER ? user : group);
 		id = QUOTA_DEFAULTID;
 	} else {
 		snprintf(idname, sizeof(idname), %s %u,
-			 quotaclass == QUOTA_IDTYPE_USER ? uid : gid, id);
+			 idtype == QUOTA_IDTYPE_USER ? uid : gid, id);
 	}
 
 	qh = quota_open(qup-fsname);
@@ -379,14 +379,14 @@ putprivs2(uint32_t id, int quotaclass, s
 		err(1, %s: quota_open, qup-fsname);
 	}
 
-	qk.qk_idtype = quotaclass;
+	qk.qk_idtype = idtype;
 	qk.qk_id = id;
 	qk.qk_objtype = QUOTA_OBJTYPE_BLOCKS;
 	if (quota_put(qh, qk, qup-qv[QL_BLK])) {
 		err(1, %s: quota_put (%s blocks), qup-fsname, idname);
 	}
 
-	qk.qk_idtype = quotaclass;
+	qk.qk_idtype = idtype;
 	qk.qk_id = id;
 	qk.qk_objtype = QUOTA_OBJTYPE_FILES;
 	if (quota_put(qh, qk, qup-qv[QL_FL])) {
@@ -403,7 +403,7 @@ putprivs2(uint32_t id, int quotaclass, s
  * Collect the requested quota information.
  */
 static struct quotalist *

CVS commit: src/lib/libquota

2012-01-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Jan  9 15:45:19 UTC 2012

Modified Files:
src/lib/libquota: quota_oldfiles.c quotapvt.h

Log Message:
Implement quota_put and quota_delete for the fallback direct file
access backend.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libquota/quota_oldfiles.c
cvs rdiff -u -r1.7 -r1.8 src/lib/libquota/quotapvt.h

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

Modified files:

Index: src/lib/libquota/quota_oldfiles.c
diff -u src/lib/libquota/quota_oldfiles.c:1.1 src/lib/libquota/quota_oldfiles.c:1.2
--- src/lib/libquota/quota_oldfiles.c:1.1	Mon Jan  9 15:41:58 2012
+++ src/lib/libquota/quota_oldfiles.c	Mon Jan  9 15:45:19 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quota_oldfiles.c,v 1.1 2012/01/09 15:41:58 dholland Exp $	*/
+/*	$NetBSD: quota_oldfiles.c,v 1.2 2012/01/09 15:45:19 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -64,7 +64,7 @@ struct oldfiles_quotacursor {
 };
 
 static uint64_t
-dqblk_limit(uint32_t val)
+dqblk_getlimit(uint32_t val)
 {
 	if (val == 0) {
 		return QUOTA_NOLIMIT;
@@ -73,11 +73,21 @@ dqblk_limit(uint32_t val)
 	}
 }
 
+static uint32_t
+dqblk_setlimit(uint64_t val)
+{
+	if (val == QUOTA_NOLIMIT  val = 0xUL) {
+		return 0;
+	} else {
+		return (uint32_t)val + 1;
+	}
+}
+
 static void
 dqblk_getblocks(const struct dqblk *dq, struct quotaval *qv)
 {
-	qv-qv_hardlimit = dqblk_limit(dq-dqb_bhardlimit);
-	qv-qv_softlimit = dqblk_limit(dq-dqb_bsoftlimit);
+	qv-qv_hardlimit = dqblk_getlimit(dq-dqb_bhardlimit);
+	qv-qv_softlimit = dqblk_getlimit(dq-dqb_bsoftlimit);
 	qv-qv_usage = dq-dqb_curblocks;
 	qv-qv_expiretime = dq-dqb_btime;
 	qv-qv_grace = QUOTA_NOTIME;
@@ -86,13 +96,33 @@ dqblk_getblocks(const struct dqblk *dq, 
 static void
 dqblk_getfiles(const struct dqblk *dq, struct quotaval *qv)
 {
-	qv-qv_hardlimit = dqblk_limit(dq-dqb_ihardlimit);
-	qv-qv_softlimit = dqblk_limit(dq-dqb_isoftlimit);
+	qv-qv_hardlimit = dqblk_getlimit(dq-dqb_ihardlimit);
+	qv-qv_softlimit = dqblk_getlimit(dq-dqb_isoftlimit);
 	qv-qv_usage = dq-dqb_curinodes;
 	qv-qv_expiretime = dq-dqb_itime;
 	qv-qv_grace = QUOTA_NOTIME;
 }
 
+static void
+dqblk_putblocks(const struct quotaval *qv, struct dqblk *dq)
+{
+	dq-dqb_bhardlimit = dqblk_setlimit(qv-qv_hardlimit);
+	dq-dqb_bsoftlimit = dqblk_setlimit(qv-qv_softlimit);
+	dq-dqb_curblocks = qv-qv_usage;
+	dq-dqb_btime = qv-qv_expiretime;
+	/* ignore qv-qv_grace */
+}
+
+static void
+dqblk_putfiles(const struct quotaval *qv, struct dqblk *dq)
+{
+	dq-dqb_ihardlimit = dqblk_setlimit(qv-qv_hardlimit);
+	dq-dqb_isoftlimit = dqblk_setlimit(qv-qv_softlimit);
+	dq-dqb_curinodes = qv-qv_usage;
+	dq-dqb_itime = qv-qv_expiretime;
+	/* ignore qv-qv_grace */
+}
+
 static int
 __quota_oldfiles_open(struct quotahandle *qh, const char *path, int *fd_ret)
 {
@@ -249,8 +279,11 @@ __quota_oldfiles_doget(struct quotahandl
 	result = pread(file, dq, sizeof(dq), pos);
 	if (result  0) {
 		return -1;
-	}
-	if ((size_t)result != sizeof(dq)) {
+	} else if (result == 0) {
+		/* Past EOF; no quota info on file for this ID */
+		errno = ENOENT;
+		return -1;
+	} else if ((size_t)result != sizeof(dq)) {
 		errno = EFTYPE;
 		return -1;
 	}
@@ -296,6 +329,112 @@ __quota_oldfiles_doget(struct quotahandl
 	return 0;
 }
 
+static int
+__quota_oldfiles_doput(struct quotahandle *qh, const struct quotakey *qk,
+		   const struct quotaval *qv)
+{
+	int file;
+	off_t pos;
+	struct quotaval qv2;
+	struct dqblk dq;
+	ssize_t result;
+
+	switch (qk-qk_idtype) {
+	case QUOTA_IDTYPE_USER:
+		file = qh-qh_userfile;
+		break;
+	case QUOTA_IDTYPE_GROUP:
+		file = qh-qh_groupfile;
+		break;
+	default:
+		errno = EINVAL;
+		return -1;
+	}
+
+	if (qk-qk_id == QUOTA_DEFAULTID) {
+		pos = 0;
+	} else {
+		pos = qk-qk_id * sizeof(struct dqblk);
+	}
+
+	result = pread(file, dq, sizeof(dq), pos);
+	if (result  0) {
+		return -1;
+	} else if (result == 0) {
+		/* Past EOF; fill in a blank dq to start from */
+		dq.dqb_bhardlimit = 0;
+		dq.dqb_bsoftlimit = 0;
+		dq.dqb_curblocks = 0;
+		dq.dqb_ihardlimit = 0;
+		dq.dqb_isoftlimit = 0;
+		dq.dqb_curinodes = 0;
+		dq.dqb_btime = 0;
+		dq.dqb_itime = 0;
+	} else if ((size_t)result != sizeof(dq)) {
+		errno = EFTYPE;
+		return -1;
+	}
+
+	switch (qk-qk_objtype) {
+	case QUOTA_OBJTYPE_BLOCKS:
+		dqblk_getblocks(dq, qv2);
+		break;
+	case QUOTA_OBJTYPE_FILES:
+		dqblk_getfiles(dq, qv2);
+		break;
+	default:
+		errno = EINVAL;
+		return -1;
+	}
+
+	if (qk-qk_id == QUOTA_DEFAULTID) {
+		qv2.qv_hardlimit = qv-qv_hardlimit;
+		qv2.qv_softlimit = qv-qv_softlimit;
+		/* leave qv2.qv_usage unchanged */
+		qv2.qv_expiretime = qv-qv_grace;
+		/* skip qv2.qv_grace */
+
+		/* ignore qv-qv_usage */
+		/* ignore qv-qv_expiretime */
+	} else if (qk-qk_id == 0) {
+		/* leave qv2.qv_hardlimit unchanged */
+		/* leave qv2.qv_softlimit unchanged */
+		qv2.qv_usage = qv-qv_usage;
+		/* leave 

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

2012-01-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan  9 16:03:27 UTC 2012

Modified Files:
src/sys/arch/hp700/stand/boot: Makefile
Removed Files:
src/sys/arch/hp700/stand/boot: boot.8

Log Message:
Use NOMAN and delete a file.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/hp700/stand/boot/Makefile
cvs rdiff -u -r1.1 -r0 src/sys/arch/hp700/stand/boot/boot.8

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/hp700/stand/boot/Makefile
diff -u src/sys/arch/hp700/stand/boot/Makefile:1.7 src/sys/arch/hp700/stand/boot/Makefile:1.8
--- src/sys/arch/hp700/stand/boot/Makefile:1.7	Sat May 10 19:11:59 2008
+++ src/sys/arch/hp700/stand/boot/Makefile	Mon Jan  9 16:03:26 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.7 2008/05/10 19:11:59 skrll Exp $
+#	$NetBSD: Makefile,v 1.8 2012/01/09 16:03:26 skrll Exp $
 
 #	$OpenBSD: Makefile,v 1.10 2000/05/31 19:56:51 mickey Exp $
 
@@ -6,6 +6,8 @@ PROG=		boot
 PROGSOURCE=	srt0.S boot.c bootinfo.c ct.c conf.c lf.c lif.c tgets.c
 NEWVERSWHAT=	LIF/FFS/LFS Boot
 
+NOMAN=		# defined
+
 CLEANFILES+=	boot.gdb boot.map
 
 # IODC can handle only 2GB, and need not to use 64bit integer



CVS commit: src

2012-01-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan  9 16:04:46 UTC 2012

Modified Files:
src/distrib/sets/lists/man: mi
src/share/man/man8/man8.hp700: Makefile
Added Files:
src/share/man/man8/man8.hp700: mkboot.8

Log Message:
Add a mkboot(8) man page.


To generate a diff of this commit:
cvs rdiff -u -r1.1364 -r1.1365 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.3 -r1.4 src/share/man/man8/man8.hp700/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man8/man8.hp700/mkboot.8

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/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1364 src/distrib/sets/lists/man/mi:1.1365
--- src/distrib/sets/lists/man/mi:1.1364	Mon Jan  9 15:16:30 2012
+++ src/distrib/sets/lists/man/mi	Mon Jan  9 16:04:45 2012
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1364 2012/01/09 15:16:30 drochner Exp $
+# $NetBSD: mi,v 1.1365 2012/01/09 16:04:45 skrll Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -2333,6 +2333,7 @@
 ./usr/share/man/cat8/hp300/makedev.0		man-obsolete		obsolete
 ./usr/share/man/cat8/hp700/MAKEDEV.0		man-obsolete		obsolete
 ./usr/share/man/cat8/hp700/boot.0		man-sys-catman		.cat
+./usr/share/man/cat8/hp700/mkboot.0		man-sys-catman		.cat
 ./usr/share/man/cat8/hp700/makedev.0		man-obsolete		obsolete
 ./usr/share/man/cat8/hpcarm/MAKEDEV.0		man-obsolete		obsolete
 ./usr/share/man/cat8/hpcarm/boot.0		man-sys-catman		.cat
@@ -5021,6 +5022,7 @@
 ./usr/share/man/html8/hp300/crash.html		man-sys-htmlman		html
 ./usr/share/man/html8/hp300/format.html		man-sys-htmlman		html
 ./usr/share/man/html8/hp700/boot.html		man-sys-htmlman		html
+./usr/share/man/html8/hp700/mkboot.html		man-sys-htmlman		html
 ./usr/share/man/html8/hpcarm/boot.html		man-sys-htmlman		html
 ./usr/share/man/html8/hpcboot.html		man-sys-htmlman		html
 ./usr/share/man/html8/hpcmips/boot.html		man-sys-htmlman		html
@@ -7816,6 +7818,7 @@
 ./usr/share/man/man8/hp300/makedev.8		man-obsolete		obsolete
 ./usr/share/man/man8/hp700/MAKEDEV.8		man-obsolete		obsolete
 ./usr/share/man/man8/hp700/boot.8		man-sys-man		.man
+./usr/share/man/man8/hp700/mkboot.8		man-sys-man		.man
 ./usr/share/man/man8/hp700/makedev.8		man-obsolete		obsolete
 ./usr/share/man/man8/hpcarm/MAKEDEV.8		man-obsolete		obsolete
 ./usr/share/man/man8/hpcarm/boot.8		man-sys-man		.man

Index: src/share/man/man8/man8.hp700/Makefile
diff -u src/share/man/man8/man8.hp700/Makefile:1.3 src/share/man/man8/man8.hp700/Makefile:1.4
--- src/share/man/man8/man8.hp700/Makefile:1.3	Sat Aug  7 22:05:08 2004
+++ src/share/man/man8/man8.hp700/Makefile	Mon Jan  9 16:04:46 2012
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.3 2004/08/07 22:05:08 chs Exp $
+#	$NetBSD: Makefile,v 1.4 2012/01/09 16:04:46 skrll Exp $
 
-MAN=	boot.8
+MAN=	boot.8 mkboot.8
 MANSUBDIR=/hp700
 
 .include bsd.man.mk

Added files:

Index: src/share/man/man8/man8.hp700/mkboot.8
diff -u /dev/null src/share/man/man8/man8.hp700/mkboot.8:1.1
--- /dev/null	Mon Jan  9 16:04:46 2012
+++ src/share/man/man8/man8.hp700/mkboot.8	Mon Jan  9 16:04:46 2012
@@ -0,0 +1,64 @@
+.\	$NetBSD: mkboot.8,v 1.1 2012/01/09 16:04:46 skrll Exp $
+.\
+.\	$OpenBSD: mkboot.8,v 1.9 2007/05/31 19:20:03 jmc Exp $
+.\
+.\ Copyright (c) 1990, 1993
+.\	The Regents of the University of California.  All rights reserved.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\ 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.
+.\
+.Dd January 9, 2012
+.Dt MKBOOT 8 hp700
+.Os
+.Sh NAME
+.Nm mkboot
+.Nd 

CVS commit: src/usr.bin/telnet

2012-01-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan  9 16:08:56 UTC 2012

Modified Files:
src/usr.bin/telnet: Makefile authenc.c commands.c externs.h main.c
sys_bsd.c telnet.c utilities.c

Log Message:
PR/45805: Borodin Oleg: telnet/telnetd with -DAUTHENTICATION -DENCRYPTION
(rfc2941)
- Minimal diffs to separate MKCRYPTO from USE_KERBEROS


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/usr.bin/telnet/Makefile
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/telnet/authenc.c
cvs rdiff -u -r1.67 -r1.68 src/usr.bin/telnet/commands.c
cvs rdiff -u -r1.35 -r1.36 src/usr.bin/telnet/externs.h
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/telnet/main.c
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/telnet/sys_bsd.c
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/telnet/telnet.c
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/telnet/utilities.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/telnet/Makefile
diff -u src/usr.bin/telnet/Makefile:1.48 src/usr.bin/telnet/Makefile:1.49
--- src/usr.bin/telnet/Makefile:1.48	Wed Oct  5 06:48:54 2011
+++ src/usr.bin/telnet/Makefile	Mon Jan  9 11:08:55 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.48 2011/10/05 10:48:54 roy Exp $
+#	$NetBSD: Makefile,v 1.49 2012/01/09 16:08:55 christos Exp $
 #
 # Copyright (c) 1990 The Regents of the University of California.
 # All rights reserved.
@@ -34,7 +34,7 @@
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
 #
 
-WARNS?=	1	# XXX -Wshadow etc.  fix asap
+WARNS?=	4	# XXX -Wshadow etc.  fix asap
 CWARNFLAGS.clang+=	-Wno-tautological-compare -Wno-format-security
 
 .include bsd.own.mk
@@ -64,19 +64,22 @@ CPPFLAGS+=-DINET6
 LIBTELNETDIR!=	cd ${.CURDIR}/../../lib/libtelnet; ${PRINTOBJDIR}
 
 .if (${USE_KERBEROS} != no)
-CPPFLAGS+=-DKRB5 -DFORWARD -DAUTHENTICATION -DENCRYPTION
-LDADD+= -lkrb5 -lasn1 -lcrypto -lcrypt
-DPADD+=	${LIBKRB5} ${LIBASN1} ${LIBCRYPTO} ${LIBCRYPT}
+CPPFLAGS+=-DKRB5 -DFORWARD
+LDADD+= -lkrb5 -lasn1 -lcom_err -lroken
+DPADD+=	${LIBKRB5} ${LIBASN1} ${LIBCOM_ERR} ${LIBROKEN}
+.endif
+
+.if (${MKCRYPTO} != no)
+CPPFLAGS+=-DAUTHENTICATION -DENCRYPTION
+LDADD+= -ldes -lcrypto -lcrypt
+DPADD+=	${LIBDES} ${LIBCRYPTO} ${LIBCRYPT}
+.endif
 
 .if (${USE_PAM} != no)
 LDADD+= -lpam ${PAM_STATIC_LDADD}
 DPADD+=	${LIBPAM} ${PAM_STATIC_DPADD}
 .endif
 
-LDADD+= -ldes -lcom_err -lroken
-DPADD+=	${LIBDES} ${LIBCOM_ERR} ${LIBROKEN}
-.endif
-
 .if defined(HAVE_GCC) || defined(HAVE_PCC)
 .for f in commands telnet terminal utilities
 COPTS.${f}.c+=  -Wno-pointer-sign

Index: src/usr.bin/telnet/authenc.c
diff -u src/usr.bin/telnet/authenc.c:1.12 src/usr.bin/telnet/authenc.c:1.13
--- src/usr.bin/telnet/authenc.c:1.12	Thu Aug  7 07:16:07 2003
+++ src/usr.bin/telnet/authenc.c	Mon Jan  9 11:08:55 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: authenc.c,v 1.12 2003/08/07 11:16:07 agc Exp $	*/
+/*	$NetBSD: authenc.c,v 1.13 2012/01/09 16:08:55 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)authenc.c	8.1 (Berkeley) 6/6/93;
 #else
-__RCSID($NetBSD: authenc.c,v 1.12 2003/08/07 11:16:07 agc Exp $);
+__RCSID($NetBSD: authenc.c,v 1.13 2012/01/09 16:08:55 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -87,7 +87,7 @@ telnet_getenv(char *val)
 }
 
 char *
-telnet_gets(char *prompt, char *result, int length, int echo)
+telnet_gets(char *prmpt, char *result, int length, int echo)
 {
 	extern int globalmode;
 	int om = globalmode;
@@ -95,9 +95,9 @@ telnet_gets(char *prompt, char *result, 
 
 	TerminalNewMode(-1);
 	if (echo) {
-		printf(%s, prompt);
+		printf(%s, prmpt);
 		res = fgets(result, length, stdin);
-	} else if ((res = getpass(prompt)) != NULL) {
+	} else if ((res = getpass(prmpt)) != NULL) {
 		strlcpy(result, res, length);
 		res = result;
 	}

Index: src/usr.bin/telnet/commands.c
diff -u src/usr.bin/telnet/commands.c:1.67 src/usr.bin/telnet/commands.c:1.68
--- src/usr.bin/telnet/commands.c:1.67	Mon Dec 18 09:18:40 2006
+++ src/usr.bin/telnet/commands.c	Mon Jan  9 11:08:55 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: commands.c,v 1.67 2006/12/18 14:18:40 christos Exp $	*/
+/*	$NetBSD: commands.c,v 1.68 2012/01/09 16:08:55 christos Exp $	*/
 
 /*
  * Copyright (C) 1997 and 1998 WIDE Project.
@@ -63,7 +63,7 @@
 #if 0
 static char sccsid[] = @(#)commands.c	8.4 (Berkeley) 5/30/95;
 #else
-__RCSID($NetBSD: commands.c,v 1.67 2006/12/18 14:18:40 christos Exp $);
+__RCSID($NetBSD: commands.c,v 1.68 2012/01/09 16:08:55 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -109,8 +109,8 @@ char	*hostname;
 static char _hostname[MAXHOSTNAMELEN];
 
 typedef struct {
-	char	*name;		/* command name */
-	char	*help;		/* help string (NULL for no help) */
+	const char	*name;	/* command name */
+	const char	*help;	/* help string (NULL for no help) */
 	int	(*handler)	/* routine which executes command */
 			(int, char *[]);
 	int	needconnect;	/* Do we need to be connected to execute? */
@@ -123,7 +123,7 @@ static 

CVS commit: src/share/man/man4

2012-01-09 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Mon Jan  9 16:17:37 UTC 2012

Modified Files:
src/share/man/man4: fast_ipsec.4 ipsec.4

Log Message:
fix confusing references, from wiz


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/share/man/man4/fast_ipsec.4
cvs rdiff -u -r1.32 -r1.33 src/share/man/man4/ipsec.4

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

Modified files:

Index: src/share/man/man4/fast_ipsec.4
diff -u src/share/man/man4/fast_ipsec.4:1.10 src/share/man/man4/fast_ipsec.4:1.11
--- src/share/man/man4/fast_ipsec.4:1.10	Mon Jan  9 15:16:31 2012
+++ src/share/man/man4/fast_ipsec.4	Mon Jan  9 16:17:37 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: fast_ipsec.4,v 1.10 2012/01/09 15:16:31 drochner Exp $
+.\	$NetBSD: fast_ipsec.4,v 1.11 2012/01/09 16:17:37 drochner Exp $
 .\	$FreeBSD: fast_ipsec.4,v 1.2 2003/03/03 11:51:30 ru Exp $
 .\
 .\ Copyright (c) 2004
@@ -77,7 +77,7 @@ To selectively enable/disable protocols,
 .Sh DIAGNOSTICS
 To be added.
 .Sh SEE ALSO
-.Xr ipsec 4 ,
+.Xr kame_ipsec 4 ,
 .Xr setkey 8 ,
 .Xr sysctl 8 ,
 .Xr opencrypto 9

Index: src/share/man/man4/ipsec.4
diff -u src/share/man/man4/ipsec.4:1.32 src/share/man/man4/ipsec.4:1.33
--- src/share/man/man4/ipsec.4:1.32	Mon Jan  9 15:16:31 2012
+++ src/share/man/man4/ipsec.4	Mon Jan  9 16:17:37 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: ipsec.4,v 1.32 2012/01/09 15:16:31 drochner Exp $
+.\	$NetBSD: ipsec.4,v 1.33 2012/01/09 16:17:37 drochner Exp $
 .\	$FreeBSD: fast_ipsec.4,v 1.2 2003/03/03 11:51:30 ru Exp $
 .\
 .\ Copyright (c) 2004
@@ -29,7 +29,7 @@
 .\ THE POSSIBILITY OF SUCH DAMAGE.
 .\
 .Dd January 9, 2012
-.Dt FAST_IPSEC 4
+.Dt IPSEC 4
 .Os
 .Sh NAME
 .Nm fast_ipsec
@@ -77,7 +77,7 @@ To selectively enable/disable protocols,
 .Sh DIAGNOSTICS
 To be added.
 .Sh SEE ALSO
-.Xr ipsec 4 ,
+.Xr kame_ipsec 4 ,
 .Xr setkey 8 ,
 .Xr sysctl 8 ,
 .Xr opencrypto 9



CVS commit: src/share/man/man4

2012-01-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Jan  9 16:35:20 UTC 2012

Modified Files:
src/share/man/man4: ipsec.4

Log Message:
Fix another reference to point to kame_ipsec for setup instructions (for now).


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/share/man/man4/ipsec.4

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

Modified files:

Index: src/share/man/man4/ipsec.4
diff -u src/share/man/man4/ipsec.4:1.33 src/share/man/man4/ipsec.4:1.34
--- src/share/man/man4/ipsec.4:1.33	Mon Jan  9 16:17:37 2012
+++ src/share/man/man4/ipsec.4	Mon Jan  9 16:35:20 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: ipsec.4,v 1.33 2012/01/09 16:17:37 drochner Exp $
+.\	$NetBSD: ipsec.4,v 1.34 2012/01/09 16:35:20 wiz Exp $
 .\	$FreeBSD: fast_ipsec.4,v 1.2 2003/03/03 11:51:30 ru Exp $
 .\
 .\ Copyright (c) 2004
@@ -63,7 +63,7 @@ implementation is intended to be compati
 implementation.
 This documentation concentrates on differences from that software.
 The user should refer to
-.Xr ipsec 4
+.Xr kame_ipsec 4
 for basic information on setting up and using these protocols.
 .Pp
 System configuration requires the



CVS commit: src/libexec/telnetd

2012-01-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan  9 16:36:48 UTC 2012

Modified Files:
src/libexec/telnetd: Makefile ext.h state.c sys_term.c telnetd.c
utility.c

Log Message:
PR/45805: Borodin Oleg: telnet/telnetd with -DAUTHENTICATION -DENCRYPTION
(rfc2941)
- separate MKCRYPTO from USE_KERBEROS
- WARNS=4


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/libexec/telnetd/Makefile
cvs rdiff -u -r1.20 -r1.21 src/libexec/telnetd/ext.h
cvs rdiff -u -r1.28 -r1.29 src/libexec/telnetd/state.c
cvs rdiff -u -r1.44 -r1.45 src/libexec/telnetd/sys_term.c
cvs rdiff -u -r1.52 -r1.53 src/libexec/telnetd/telnetd.c
cvs rdiff -u -r1.31 -r1.32 src/libexec/telnetd/utility.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/telnetd/Makefile
diff -u src/libexec/telnetd/Makefile:1.48 src/libexec/telnetd/Makefile:1.49
--- src/libexec/telnetd/Makefile:1.48	Sun Apr 24 17:42:06 2011
+++ src/libexec/telnetd/Makefile	Mon Jan  9 11:36:48 2012
@@ -1,7 +1,7 @@
-#	$NetBSD: Makefile,v 1.48 2011/04/24 21:42:06 elric Exp $
+#	$NetBSD: Makefile,v 1.49 2012/01/09 16:36:48 christos Exp $
 #	from: @(#)Makefile	8.2 (Berkeley) 12/15/93
 
-WARNS?=	2		# XXX: const issues in sys_term.c
+WARNS?=	4		# XXX: const issues in sys_term.c
 
 .include bsd.own.mk
 
@@ -22,17 +22,18 @@ LIBTELNETDIR!=	cd ${.CURDIR}/../../lib/l
 
 .if (${USE_KERBEROS} != no)
 CPPFLAGS+=-DKRB5 -DAUTHENTICATION -DENCRYPTION
-LDADD+= -lkrb5 -lasn1 -lcrypto -lcrypt
-DPADD+=	${LIBKRB5} ${LIBASN1} ${LIBCRYPTO} ${LIBCRYPT}
+LDADD+= -lkrb5 -lasn1 -lcom_err -lroken
+DPADD+=	${LIBKRB5} ${LIBASN1} ${LIBCOM_ERR} ${LIBROKEN}
+.endif
+
+.if (${MKCRYPTO} != no)
+LDADD+=-ldes -lcrypto -lcrypt
+DPADD+=${LIBDES} ${LIBCRYPTO} ${LIBCRYPT}
+.endif
 
 .if (${USE_PAM} != no)
 LDADD+= -lpam ${PAM_STATIC_LDADD}
 DPADD+=	${LIBPAM} ${PAM_STATIC_DPADD}
 .endif
 
-LDADD+=	 -ldes -lcom_err -lroken
-DPADD+=	${LIBDES} ${LIBCOM_ERR} ${LIBROKEN}
-
-.endif
-
 .include bsd.prog.mk

Index: src/libexec/telnetd/ext.h
diff -u src/libexec/telnetd/ext.h:1.20 src/libexec/telnetd/ext.h:1.21
--- src/libexec/telnetd/ext.h:1.20	Tue Jun 21 18:29:53 2005
+++ src/libexec/telnetd/ext.h	Mon Jan  9 11:36:48 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ext.h,v 1.20 2005/06/21 22:29:53 lha Exp $	*/
+/*	$NetBSD: ext.h,v 1.21 2012/01/09 16:36:48 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -90,7 +90,7 @@ extern void
 	doeof(void),
 	dooption(int),
 	dontoption(int),
-	edithost(char *, char *),
+	edithost(const char *, const char *),
 	fatal(int, const char *),
 	fatalperror(int, const char *),
 	get_slc_defaults(void),
@@ -103,7 +103,7 @@ extern void
 	netflush(void),
 #ifdef DIAGNOSTICS
 	printoption(const char *, int),
-	printdata(char *, char *, int),
+	printdata(const char *, char *, int),
 #ifndef ENCRYPTION
 	printsub(int, unsigned char *, int),
 #endif
@@ -130,7 +130,7 @@ extern void
 	tty_binaryout(int);
 
 extern char *
-	putf(char *, char *);
+	putf(const char *, char *);
 
 extern int
 	end_slc(unsigned char **),

Index: src/libexec/telnetd/state.c
diff -u src/libexec/telnetd/state.c:1.28 src/libexec/telnetd/state.c:1.29
--- src/libexec/telnetd/state.c:1.28	Fri Dec 23 11:56:54 2011
+++ src/libexec/telnetd/state.c	Mon Jan  9 11:36:48 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: state.c,v 1.28 2011/12/23 16:56:54 christos Exp $	*/
+/*	$NetBSD: state.c,v 1.29 2012/01/09 16:36:48 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)state.c	8.5 (Berkeley) 5/30/95;
 #else
-__RCSID($NetBSD: state.c,v 1.28 2011/12/23 16:56:54 christos Exp $);
+__RCSID($NetBSD: state.c,v 1.29 2012/01/09 16:36:48 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -45,10 +45,6 @@ __RCSID($NetBSD: state.c,v 1.28 2011/12
 
 static int envvarok(char *);
 
-unsigned const char	doopt[] = { IAC, DO, '%', 'c', 0 };
-unsigned const char	dont[] = { IAC, DONT, '%', 'c', 0 };
-unsigned const char	will[] = { IAC, WILL, '%', 'c', 0 };
-unsigned const char	wont[] = { IAC, WONT, '%', 'c', 0 };
 int	not42 = 1;
 
 /*
@@ -437,7 +433,7 @@ send_do(int option, int init)
 			set_his_want_state_will(option);
 		do_dont_resp[option]++;
 	}
-	(void) output_data((const char *)doopt, option);
+	(void) output_data(%c%c%c, IAC, DO, option);
 
 	DIAG(TD_OPTIONS, printoption(td: send do, option));
 }
@@ -657,7 +653,7 @@ send_dont(int option, int init)
 		set_his_want_state_wont(option);
 		do_dont_resp[option]++;
 	}
-	(void) output_data((const char *)dont, option);
+	(void) output_data(%c%c%c, IAC, DONT, option);
 
 	DIAG(TD_OPTIONS, printoption(td: send dont, option));
 }
@@ -805,7 +801,7 @@ send_will(int option, int init)
 		set_my_want_state_will(option);
 		will_wont_resp[option]++;
 	}
-	(void) output_data((const char *)will, option);
+	(void) output_data(%c%c%c, IAC, WILL, option);
 
 	DIAG(TD_OPTIONS, printoption(td: send will, option));
 }
@@ -959,7 +955,7 @@ send_wont(int 

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

2012-01-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan  9 16:59:37 UTC 2012

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

Log Message:
Fix set list. kame_ipsec.html was missing.


To generate a diff of this commit:
cvs rdiff -u -r1.1365 -r1.1366 src/distrib/sets/lists/man/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/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1365 src/distrib/sets/lists/man/mi:1.1366
--- src/distrib/sets/lists/man/mi:1.1365	Mon Jan  9 16:04:45 2012
+++ src/distrib/sets/lists/man/mi	Mon Jan  9 16:59:36 2012
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1365 2012/01/09 16:04:45 skrll Exp $
+# $NetBSD: mi,v 1.1366 2012/01/09 16:59:36 skrll Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -4058,6 +4058,7 @@
 ./usr/share/man/html4/jme.html			man-sys-htmlman		html
 ./usr/share/man/html4/jmide.html		man-sys-htmlman		html
 ./usr/share/man/html4/joy.html			man-sys-htmlman		html
+./usr/share/man/html4/kame_ipsec.html		man-sys-htmlman		html
 ./usr/share/man/html4/kloader.html		man-sys-htmlman		html
 ./usr/share/man/html4/kse.html			man-sys-htmlman		html
 ./usr/share/man/html4/ksyms.html		man-sys-htmlman		html



CVS commit: src/distrib/amd64/ramdisks/ramdisk

2012-01-09 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Jan  9 17:45:03 UTC 2012

Modified Files:
src/distrib/amd64/ramdisks/ramdisk: list

Log Message:
Add dkctl to install ramdisk so that you can enable disk writecaches before
install, if necessary.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/distrib/amd64/ramdisks/ramdisk/list

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

Modified files:

Index: src/distrib/amd64/ramdisks/ramdisk/list
diff -u src/distrib/amd64/ramdisks/ramdisk/list:1.13 src/distrib/amd64/ramdisks/ramdisk/list:1.14
--- src/distrib/amd64/ramdisks/ramdisk/list:1.13	Sun Feb 13 04:14:58 2011
+++ src/distrib/amd64/ramdisks/ramdisk/list	Mon Jan  9 17:45:03 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: list,v 1.13 2011/02/13 04:14:58 jym Exp $
+#	$NetBSD: list,v 1.14 2012/01/09 17:45:03 sborrill Exp $
 
 PROG	bin/chio
 PROG	bin/dd
@@ -10,6 +10,7 @@ PROG	bin/sync
 
 PROG	libexec/lfs_cleanerd
 
+PROG	sbin/dkctl
 PROG	sbin/fdisk
 PROG	sbin/mbrlabel
 PROG	sbin/mount_ext2fs



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

2012-01-09 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Mon Jan  9 19:25:41 UTC 2012

Modified Files:
src/sys/arch/usermode/conf: GENERIC.common

Log Message:
also add union file system


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/usermode/conf/GENERIC.common

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/usermode/conf/GENERIC.common
diff -u src/sys/arch/usermode/conf/GENERIC.common:1.14 src/sys/arch/usermode/conf/GENERIC.common:1.15
--- src/sys/arch/usermode/conf/GENERIC.common:1.14	Sun Jan  8 19:23:37 2012
+++ src/sys/arch/usermode/conf/GENERIC.common	Mon Jan  9 19:25:40 2012
@@ -1,9 +1,9 @@
-# $NetBSD: GENERIC.common,v 1.14 2012/01/08 19:23:37 agc Exp $
+# $NetBSD: GENERIC.common,v 1.15 2012/01/09 19:25:40 agc Exp $
 
 include arch/usermode/conf/std.usermode
 
 options 	INCLUDE_CONFIG_FILE
-#ident 		GENERIC-$Revision: 1.14 $
+#ident 		GENERIC-$Revision: 1.15 $
 maxusers 	32
 
 makeoptions	DEBUG=-O1 -g3
@@ -38,6 +38,7 @@ file-system	FDESC
 file-system	KERNFS
 file-system	NULLFS
 file-system	PROCFS
+file-system	UNION
 file-system	PTYFS
 file-system	TMPFS
 file-system	NFS



CVS commit: src/usr.sbin/installboot

2012-01-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan  9 19:39:19 UTC 2012

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

Log Message:
s/ISO9660/ISO 9660/ for consistency with rest of man page.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/usr.sbin/installboot/installboot.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/installboot/installboot.8
diff -u src/usr.sbin/installboot/installboot.8:1.79 src/usr.sbin/installboot/installboot.8:1.80
--- src/usr.sbin/installboot/installboot.8:1.79	Thu Nov  3 20:09:18 2011
+++ src/usr.sbin/installboot/installboot.8	Mon Jan  9 19:39:18 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: installboot.8,v 1.79 2011/11/03 20:09:18 martin Exp $
+.\	$NetBSD: installboot.8,v 1.80 2012/01/09 19:39:18 skrll Exp $
 .\
 .\ Copyright (c) 2002-2009 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -610,7 +610,7 @@ bootstrap:
 .Dl Ic installboot -v -o timeout=5 /dev/rwd0a /usr/mdec/bootxx_ffsv1
 .
 .Pp
-Create a bootable CD-ROM with an ISO9660
+Create a bootable CD-ROM with an ISO 9660
 file system for an i386 system with a serial console:
 .Dl Ic mkdir cdrom
 .Dl Ic cp sys/arch/i386/compile/mykernel/netbsd cdrom/netbsd



CVS commit: src/usr.sbin/installboot

2012-01-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan  9 19:40:09 UTC 2012

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

Log Message:
Update for hp700. Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/usr.sbin/installboot/installboot.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/installboot/installboot.8
diff -u src/usr.sbin/installboot/installboot.8:1.80 src/usr.sbin/installboot/installboot.8:1.81
--- src/usr.sbin/installboot/installboot.8:1.80	Mon Jan  9 19:39:18 2012
+++ src/usr.sbin/installboot/installboot.8	Mon Jan  9 19:40:09 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: installboot.8,v 1.80 2012/01/09 19:39:18 skrll Exp $
+.\	$NetBSD: installboot.8,v 1.81 2012/01/09 19:40:09 skrll Exp $
 .\
 .\ Copyright (c) 2002-2009 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 August 3, 2011
+.Dd January 9, 2012
 .Dt INSTALLBOOT 8
 .Os
 .Sh NAME
@@ -521,6 +521,27 @@ is not found.
 .
 .El
 .
+.Ss Nx Ns Tn /hp700 files
+.
+.Bl -tag -width /usr/mdec/bootxx_ustarfs
+.
+.It Pa /usr/mdec/xxboot
+.Nx Ns Tn /hp700
+primary bootstrap for
+.Sy FFSv1 ,
+.Sy FFSv2 ,
+.Sy LFSv1 ,
+and
+.Sy LFSv2 .
+.It Pa /usr/mdec/cdboot
+.Nx Ns Tn /hp700
+primary bootstrap for ISO 9660 file system.
+.It Pa /usr/mdec/sdboot
+Synonym for
+.Pa /usr/mdec/xxboot
+.
+.El
+.
 .Ss Nx Ns Tn /macppc files
 .
 .Bl -tag -width /usr/mdec/bootxx_ustarfs



CVS commit: src/sys/arch/hp700/hp700

2012-01-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan  9 19:40:55 UTC 2012

Modified Files:
src/sys/arch/hp700/hp700: machdep.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/hp700/hp700/machdep.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/hp700/hp700/machdep.c
diff -u src/sys/arch/hp700/hp700/machdep.c:1.103 src/sys/arch/hp700/hp700/machdep.c:1.104
--- src/sys/arch/hp700/hp700/machdep.c:1.103	Mon Jan  2 16:13:12 2012
+++ src/sys/arch/hp700/hp700/machdep.c	Mon Jan  9 19:40:54 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.103 2012/01/02 16:13:12 skrll Exp $	*/
+/*	$NetBSD: machdep.c,v 1.104 2012/01/09 19:40:54 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.103 2012/01/02 16:13:12 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.104 2012/01/09 19:40:54 skrll Exp $);
 
 #include opt_cputype.h
 #include opt_ddb.h
@@ -450,11 +450,13 @@ hppa_init(paddr_t start, void *bi)
 	if (bi != NULL)
 		memcpy(bootinfo, bi, sizeof(struct bootinfo));
 
-	pdc_init();	/* init PDC iface, so we can call em easy */
+	/* init PDC iface, so we can call em easy */
+	pdc_init();
 
 	cpu_hzticks = (PAGE0-mem_10msec * 100) / hz;
 
-	delay_init();	/* calculate CPU clock ratio */
+	/* calculate CPU clock ratio */
+	delay_init();
 
 	/* fetch the monarch/default cpu hpa */
 	



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

2012-01-09 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Jan  9 20:39:39 UTC 2012

Modified Files:
src/sys/arch/usermode/dev: if_veth.c

Log Message:
Don't directly call softint_shedule() when we might be in an SPL level too
high.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/dev/if_veth.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/usermode/dev/if_veth.c
diff -u src/sys/arch/usermode/dev/if_veth.c:1.2 src/sys/arch/usermode/dev/if_veth.c:1.3
--- src/sys/arch/usermode/dev/if_veth.c:1.2	Mon Dec 26 14:51:20 2011
+++ src/sys/arch/usermode/dev/if_veth.c	Mon Jan  9 20:39:39 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: if_veth.c,v 1.2 2011/12/26 14:51:20 jmcneill Exp $ */
+/* $NetBSD: if_veth.c,v 1.3 2012/01/09 20:39:39 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_veth.c,v 1.2 2011/12/26 14:51:20 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_veth.c,v 1.3 2012/01/09 20:39:39 reinoud Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -174,7 +174,9 @@ veth_rx(void *priv)
 {
 	struct veth_softc *sc = priv;
 
-	softint_schedule(sc-sc_rx_intr);
+	curcpu()-ci_idepth++;
+	spl_intr(IPL_NET, softint_schedule, sc-sc_rx_intr);
+	curcpu()-ci_idepth--;
 
 	return 0;
 }



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

2012-01-09 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Jan  9 21:01:31 UTC 2012

Modified Files:
src/sys/arch/usermode/dev: ld_thunkbus.c

Log Message:
Re-implement aio for ld_thunkbus. It seems to work fine though its not set by
default; define LD_USE_AIO or uncomment its setting at the top of the
sourcefile to enable it.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/usermode/dev/ld_thunkbus.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/usermode/dev/ld_thunkbus.c
diff -u src/sys/arch/usermode/dev/ld_thunkbus.c:1.28 src/sys/arch/usermode/dev/ld_thunkbus.c:1.29
--- src/sys/arch/usermode/dev/ld_thunkbus.c:1.28	Mon Jan  9 14:56:35 2012
+++ src/sys/arch/usermode/dev/ld_thunkbus.c	Mon Jan  9 21:01:31 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ld_thunkbus.c,v 1.28 2012/01/09 14:56:35 reinoud Exp $ */
+/* $NetBSD: ld_thunkbus.c,v 1.29 2012/01/09 21:01:31 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.28 2012/01/09 14:56:35 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.29 2012/01/09 21:01:31 reinoud Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -50,12 +50,18 @@ static int	ld_thunkbus_ldstart(struct ld
 static int	ld_thunkbus_lddump(struct ld_softc *, void *, int, int);
 static int	ld_thunkbus_ldflush(struct ld_softc *, int);
 
+//#define LD_USE_AIO
+
+#ifdef LD_USE_AIO
+static int	ld_aio_sig(void *);
+#endif
 static void	ld_thunkbus_complete(void *arg);
 
 struct ld_thunkbus_softc;
 
 struct ld_thunkbus_transfer {
 	struct ld_thunkbus_softc *tt_sc;
+	struct aiocb	tt_aio;
 	struct buf	*tt_bp;
 };
 
@@ -64,6 +70,7 @@ struct ld_thunkbus_softc {
 
 	int		sc_fd;
 	void		*sc_ih;
+	void		*sc_aio_ih;
 
 	struct ld_thunkbus_transfer sc_tt;
 	bool		busy;
@@ -120,11 +127,118 @@ ld_thunkbus_attach(device_t parent, devi
 	sc-sc_ih = softint_establish(SOFTINT_BIO,
 	ld_thunkbus_complete, ld);
 
+#ifdef LD_USE_AIO
+	sc-sc_aio_ih = sigio_intr_establish(ld_aio_sig, sc);
+	if (sc-sc_aio_ih == NULL)
+		panic(couldn't establish aio sig interrupt);
+#endif
+
 	sc-busy = false;
 
 	ldattach(ld);
 }
 
+#ifdef LD_USE_AIO
+static int
+ld_aio_sig(void *arg)
+{
+	struct ld_softc *ld = arg;
+	struct ld_thunkbus_softc *sc = (struct ld_thunkbus_softc *)ld;
+
+	curcpu()-ci_idepth++;
+	spl_intr(IPL_BIO, softint_schedule, sc-sc_ih);
+	curcpu()-ci_idepth--;
+
+	return 0;
+}
+
+static int
+ld_thunkbus_ldstart(struct ld_softc *ld, struct buf *bp)
+{
+	struct ld_thunkbus_softc *sc = (struct ld_thunkbus_softc *)ld;
+	struct ld_thunkbus_transfer *tt = sc-sc_tt;
+	off_t offset = bp-b_rawblkno * ld-sc_secsize;
+	off_t disksize = ld-sc_secsize * ld-sc_secperunit;
+	int error;
+
+	tt-tt_sc = sc;
+	tt-tt_bp = bp;
+
+	memset(tt-tt_aio, 0, sizeof(tt-tt_aio));
+	tt-tt_aio.aio_fildes = sc-sc_fd;
+	tt-tt_aio.aio_buf = bp-b_data;
+	tt-tt_aio.aio_nbytes = bp-b_bcount;
+	tt-tt_aio.aio_offset = offset;
+
+	tt-tt_aio.aio_sigevent.sigev_notify = SIGEV_SIGNAL;
+	tt-tt_aio.aio_sigevent.sigev_signo = SIGIO;
+	tt-tt_aio.aio_sigevent.sigev_value.sival_ptr = tt;
+#if 0
+	device_printf(sc-sc_ld.sc_dv, %s addr %p, off=%lld, count=%lld\n,
+	(bp-b_flags  B_READ) ? rd : wr,
+	bp-b_data,
+	(long long)bp-b_rawblkno,
+	(long long)bp-b_bcount);
+#endif
+	if (sc-busy)
+		panic(%s: reentry, __func__);
+
+	if ((offset  0) || (offset + bp-b_bcount  disksize)) {
+		error = EIO;
+		bp-b_error = error;
+		bp-b_resid = bp-b_bcount;
+	} else {
+		sc-busy = true;
+		if (bp-b_flags  B_READ)
+			error = thunk_aio_read(tt-tt_aio);
+		else
+			error = thunk_aio_write(tt-tt_aio);
+	}
+	return error;
+}
+
+static void
+ld_thunkbus_complete(void *arg)
+{
+	struct ld_softc *ld = arg;
+	struct ld_thunkbus_softc *sc = (struct ld_thunkbus_softc *)ld;
+	struct ld_thunkbus_transfer *tt = sc-sc_tt;
+	struct buf *bp = tt-tt_bp;
+	int error;
+
+	/*
+	 * check if our aio has finished, we could be called for whatever
+	 * reason, for whatever SIGIO since signals can be missed.
+	 */
+	if (!sc-busy)
+		return;
+
+	/* check if it was OUR sigio */
+	error = thunk_aio_error(tt-tt_aio);
+	if (error == EINPROGRESS)
+		return;
+
+	/* use the result */
+	if ((error == 0) 
+	thunk_aio_return(tt-tt_aio) != -1) {
+		bp-b_resid = 0;
+	} else {
+		bp-b_error = error;
+		bp-b_resid = bp-b_bcount;
+	}
+
+	thunk_printf_debug(\tfin\n);
+	if (bp-b_error)
+		thunk_printf_debug(error!\n);
+
+	sc-busy = false;
+	lddone(sc-sc_ld, bp);
+}
+
+
+#else /* LD_USE_AIO */
+
+
 static int
 ld_thunkbus_ldstart(struct ld_softc *ld, struct buf *bp)
 {
@@ -154,13 +268,6 @@ ld_thunkbus_complete(void *arg)
 	if (!sc-busy)
 		panic(%s: but not busy?\n, __func__);
 
-	if (offset  0 ||
-	offset + bp-b_bcount  ld-sc_secsize * ld-sc_secperunit) {
-		bp-b_error = EIO;
-		bp-b_resid = bp-b_bcount;
-		goto done;
-	}
-
 	

CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2012-01-09 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jan  9 22:03:13 UTC 2012

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixlp_pcie.c

Log Message:
Use a map of bar0 sizes instead of a switch statement.
Return the proper IRT entry for the 2nd i2c controller.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/arch/mips/rmi/rmixlp_pcie.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/mips/rmi/rmixlp_pcie.c
diff -u src/sys/arch/mips/rmi/rmixlp_pcie.c:1.1.2.7 src/sys/arch/mips/rmi/rmixlp_pcie.c:1.1.2.8
--- src/sys/arch/mips/rmi/rmixlp_pcie.c:1.1.2.7	Wed Jan  4 16:17:54 2012
+++ src/sys/arch/mips/rmi/rmixlp_pcie.c	Mon Jan  9 22:03:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixlp_pcie.c,v 1.1.2.7 2012/01/04 16:17:54 matt Exp $	*/
+/*	$NetBSD: rmixlp_pcie.c,v 1.1.2.8 2012/01/09 22:03:13 matt Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixlp_pcie.c,v 1.1.2.7 2012/01/04 16:17:54 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixlp_pcie.c,v 1.1.2.8 2012/01/09 22:03:13 matt Exp $);
 
 #include opt_pci.h
 #include pci.h
@@ -132,6 +132,8 @@ static struct rmixlp_pcie_softc {
 		[RMIXLP_PCITAG_IDX(RMIXLP_NAE_PCITAG)] = 4-0x2,
 		[RMIXLP_PCITAG_IDX(RMIXLP_POE_PCITAG)] = 4-0x2000,
 		[RMIXLP_PCITAG_IDX(RMIXLP_AHCI_PCITAG)] = 4-0x400,
+		[RMIXLP_PCITAG_IDX(RMIXLP_FMN_PCITAG)] = 4-0x4000,
+		[RMIXLP_PCITAG_IDX(RMIXLP_SRIO_PCITAG)] = 4-0x2,
 	},
 };
 
@@ -962,49 +964,22 @@ rmixlp_pcie_conf_read(void *v, pcitag_t 
 	 offset == 0x60)
 		offset = 0x100;
 
+	/*
+	 * I2C incorrectly reports the wrong IRT for the 2nd I2C controller
+	 * so correct it here.
+	 */
+	if (tag == RMIXLP_I2C2_PCITAG  offset == PCI_RMIXLP_IRTINFO)
+		return 0x00010088;
+
 	if (_RMIXL_PCITAG_BUS(tag) == 0  (_RMIXL_PCITAG_DEV(tag)  7)  0) {
-		if (tag == sc-sc_mapprobe) {
-			if (offset == PCI_MAPREG_START + 4) {
-aprint_debug_dev(sc-sc_dev,
-tag %#lx reg %#x: %#x\n,
-tag, offset, 0x);
-return 0x;
-			}
-#if 0
-			return sc-sc_bus0_bar0_sizes[RMIXLP_PCITAG_IDX(tag)];
-#else
-			switch (_RMIXL_PCITAG_DEV(tag)) {
-			case _RMIXL_PCITAG_DEV(RMIXLP_EHCI0_PCITAG):
-rv = 4-0x400;
-break;
-			case _RMIXL_PCITAG_DEV(RMIXLP_NAE_PCITAG):
-switch (_RMIXL_PCITAG_FUNC(tag)) {
-case _RMIXL_PCITAG_FUNC(RMIXLP_NAE_PCITAG):
-	rv = 4-0x2;
-	break;
-case _RMIXL_PCITAG_FUNC(RMIXLP_POE_PCITAG):
-	rv = 4-0x2000;
-	break;
-case _RMIXL_PCITAG_FUNC(RMIXLP_AHCI_PCITAG):
-	rv = 4-0x400;
-	break;
-default:
-	rv = 0x;
-	break;
-}
-break;
-			case _RMIXL_PCITAG_DEV(RMIXLP_FMN_PCITAG):
-rv = 4-0x4000;
-break;
-			default:
-rv = 0x;
-break;
-			}
+		if (tag == sc-sc_mapprobe  (offset  -8) == PCI_BAR0) {
+			rv = (offset == PCI_BAR0)
+			? sc-sc_bus0_bar0_sizes[RMIXLP_PCITAG_IDX(tag)]
+			: 0x;
 			aprint_debug_dev(sc-sc_dev,
 			conf_read: tag %#lx reg %#x: %#x\n,
 			tag, offset, rv);
 			return rv;
-#endif
 		}
 	}
 



CVS commit: src/share/man/man8/man8.hp700

2012-01-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan  9 22:08:12 UTC 2012

Modified Files:
src/share/man/man8/man8.hp700: mkboot.8

Log Message:
Fix NetBSD version in history.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man8/man8.hp700/mkboot.8

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

Modified files:

Index: src/share/man/man8/man8.hp700/mkboot.8
diff -u src/share/man/man8/man8.hp700/mkboot.8:1.1 src/share/man/man8/man8.hp700/mkboot.8:1.2
--- src/share/man/man8/man8.hp700/mkboot.8:1.1	Mon Jan  9 16:04:46 2012
+++ src/share/man/man8/man8.hp700/mkboot.8	Mon Jan  9 22:08:12 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: mkboot.8,v 1.1 2012/01/09 16:04:46 skrll Exp $
+.\	$NetBSD: mkboot.8,v 1.2 2012/01/09 22:08:12 skrll Exp $
 .\
 .\	$OpenBSD: mkboot.8,v 1.9 2007/05/31 19:20:03 jmc Exp $
 .\
@@ -61,4 +61,4 @@ utility first appeared in
 It was adapted for
 .Nx
 and first appeared in
-.Nx XXX .
+.Nx 3.0 .



CVS commit: src/sys/arch/usermode/usermode

2012-01-09 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Jan  9 22:20:53 UTC 2012

Modified Files:
src/sys/arch/usermode/usermode: intr.c

Log Message:
If the spl list is full also notify on the ttycons since it might otherwise
not allways be possible to print the panic correctdue due to the spl level.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/usermode/usermode/intr.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/usermode/usermode/intr.c
diff -u src/sys/arch/usermode/usermode/intr.c:1.13 src/sys/arch/usermode/usermode/intr.c:1.14
--- src/sys/arch/usermode/usermode/intr.c:1.13	Sat Jan  7 18:07:57 2012
+++ src/sys/arch/usermode/usermode/intr.c	Mon Jan  9 22:20:53 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.c,v 1.13 2012/01/07 18:07:57 jmcneill Exp $ */
+/* $NetBSD: intr.c,v 1.14 2012/01/09 22:20:53 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.13 2012/01/07 18:07:57 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.14 2012/01/09 22:20:53 reinoud Exp $);
 
 #include sys/types.h
 
@@ -89,8 +89,10 @@ spl_intr(int x, void (*func)(void *), vo
 	spli-arg = arg;
 
 	spl_intr_wr[x] = (spl_intr_wr[x] + 1) % MAX_QUEUED_EVENTS;
-	if (spl_intr_wr[x] == spl_intr_rd[x])
+	if (spl_intr_wr[x] == spl_intr_rd[x]) {
+		thunk_printf(%s: spl list %d full!\n, __func__, x);
 		panic(%s: spl list %d full!\n, __func__, x);
+	}
 }
 
 int



CVS commit: src/sys/netinet

2012-01-09 Thread Liam J. Foy
Module Name:src
Committed By:   liamjfoy
Date:   Mon Jan  9 22:26:44 UTC 2012

Modified Files:
src/sys/netinet: udp_usrreq.c

Log Message:
minor typo fix


To generate a diff of this commit:
cvs rdiff -u -r1.184 -r1.185 src/sys/netinet/udp_usrreq.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/netinet/udp_usrreq.c
diff -u src/sys/netinet/udp_usrreq.c:1.184 src/sys/netinet/udp_usrreq.c:1.185
--- src/sys/netinet/udp_usrreq.c:1.184	Mon Dec 19 11:59:57 2011
+++ src/sys/netinet/udp_usrreq.c	Mon Jan  9 22:26:44 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: udp_usrreq.c,v 1.184 2011/12/19 11:59:57 drochner Exp $	*/
+/*	$NetBSD: udp_usrreq.c,v 1.185 2012/01/09 22:26:44 liamjfoy Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: udp_usrreq.c,v 1.184 2011/12/19 11:59:57 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: udp_usrreq.c,v 1.185 2012/01/09 22:26:44 liamjfoy Exp $);
 
 #include opt_inet.h
 #include opt_compat_netbsd.h
@@ -1611,7 +1611,7 @@ udp4_espinudp(struct mbuf **mp, int off,
 	esp4_input(n, iphdrlen);
 #endif
 
-	/* We handled it, it shoudln't be handled by UDP */
+	/* We handled it, it shouldn't be handled by UDP */
 	return 1;
 }
 #endif



CVS commit: src/sys/dev/ic

2012-01-09 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Jan 10 01:43:05 UTC 2012

Modified Files:
src/sys/dev/ic: ahcisata_core.c

Log Message:
When a port reset fails, it is important to know which port.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ic/ahcisata_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/dev/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.32 src/sys/dev/ic/ahcisata_core.c:1.33
--- src/sys/dev/ic/ahcisata_core.c:1.32	Sat Aug 20 16:03:48 2011
+++ src/sys/dev/ic/ahcisata_core.c	Tue Jan 10 01:43:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.32 2011/08/20 16:03:48 jakllsch Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.33 2012/01/10 01:43:05 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ahcisata_core.c,v 1.32 2011/08/20 16:03:48 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: ahcisata_core.c,v 1.33 2012/01/10 01:43:05 jakllsch Exp $);
 
 #include sys/types.h
 #include sys/malloc.h
@@ -579,7 +579,7 @@ ahci_reset_channel(struct ata_channel *c
 	ahci_channel_stop(sc, chp, flags);
 	if (sata_reset_interface(chp, sc-sc_ahcit, achp-ahcic_scontrol,
 	achp-ahcic_sstatus) != SStatus_DET_DEV) {
-		printf(%s: port reset failed\n, AHCINAME(sc));
+		printf(%s: port %d reset failed\n, AHCINAME(sc), chp-ch_channel);
 		/* XXX and then ? */
 	}
 	if (chp-ch_queue-active_xfer) {



CVS commit: src/distrib/notes/common

2012-01-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Jan 10 01:57:27 UTC 2012

Modified Files:
src/distrib/notes/common: xfer

Log Message:
spz and riz request that we don't list ftp.NetBSD.org's IP addresses.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/distrib/notes/common/xfer

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

Modified files:

Index: src/distrib/notes/common/xfer
diff -u src/distrib/notes/common/xfer:1.72 src/distrib/notes/common/xfer:1.73
--- src/distrib/notes/common/xfer:1.72	Sat Dec 17 15:40:22 2011
+++ src/distrib/notes/common/xfer	Tue Jan 10 01:57:27 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: xfer,v 1.72 2011/12/17 15:40:22 tsutsui Exp $
+.\	$NetBSD: xfer,v 1.73 2012/01/10 01:57:27 snj Exp $
 .\
 .\ Copyright (c) 1999-2004 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -149,14 +149,6 @@ machine.
 Finally, you need to know the numeric IP address of the
 .Nx
 machine itself.
-If you don't have access to a functioning nameserver during
-installation, the IPv4 address of
-.Sy ftp.NetBSD.org
-is
-.Li 199.233.217.249
-and the IPv6 address is
-.Li 2001:470:4867:99:230:48ff:fec6:9aaa:21
-(as of December, 2011).
 .Pp
 Once you have this information, you can proceed to the next
 step in the installation or upgrade process.