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

2012-01-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jan 28 08:05:03 UTC 2012

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

Log Message:
Fix mm_md_direct_mapped_phys


To generate a diff of this commit:
cvs rdiff -u -r1.205.4.1.2.1.2.61 -r1.205.4.1.2.1.2.62 \
src/sys/arch/mips/mips/mips_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/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.61 src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.62
--- src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.61	Sat Jan 28 00:56:34 2012
+++ src/sys/arch/mips/mips/mips_machdep.c	Sat Jan 28 08:05:03 2012
@@ -2439,21 +2439,20 @@ bool
 mm_md_direct_mapped_phys(paddr_t pa, vaddr_t *vap)
 {
 #ifdef _LP64
-	if (MIPS_XKSEG_P(pa)) {
-		*vap = MIPS_PHYS_TO_XKPHYS_CACHED(pa);
-		return true;
-	}
-#endif
+	*vap = MIPS_PHYS_TO_XKPHYS_CACHED(pa);
+	return true;
+#else
 #ifdef ENABLE_MIPS_KSEGX
 	if (mips_ksegx_start = pa  pa  mips_ksegx_start + VM_KSEGX_SIZE) {
 		*vap = VM_KSEGX_ADDRESS + pa - mips_ksegx_start;
 		return true;
 	}
 #endif
-	if (MIPS_KSEG0_P(pa)) {
+	if (pa = MIPS_PHYS_MASK) {
 		*vap = MIPS_PHYS_TO_KSEG0(pa);
 		return true;
 	}
 	return false;
+#endif
 }
 



CVS commit: src/sys/dev/ic

2012-01-28 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Sat Jan 28 08:29:55 UTC 2012

Modified Files:
src/sys/dev/ic: dm9000.c dm9000reg.h dm9000var.h

Log Message:
- add DM9000 internal PHY manipulating routines.
- now capable of auto-negotiation, use this as default media selection.
- add multicast filter support.
- code cleanup.

Code update from Paul Fleischer.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/dm9000.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/ic/dm9000reg.h \
src/sys/dev/ic/dm9000var.h

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

Modified files:

Index: src/sys/dev/ic/dm9000.c
diff -u src/sys/dev/ic/dm9000.c:1.3 src/sys/dev/ic/dm9000.c:1.4
--- src/sys/dev/ic/dm9000.c:1.3	Thu Jun 30 20:09:39 2011
+++ src/sys/dev/ic/dm9000.c	Sat Jan 28 08:29:55 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: dm9000.c,v 1.3 2011/06/30 20:09:39 wiz Exp $	*/
+/*	$NetBSD: dm9000.c,v 1.4 2012/01/28 08:29:55 nisimura Exp $	*/
 
 /*
  * Copyright (c) 2009 Paul Fleischer
@@ -89,6 +89,7 @@
 #include sys/cdefs.h
 
 #include sys/param.h
+#include sys/kernel.h
 #include sys/systm.h
 #include sys/mbuf.h
 #include sys/syslog.h
@@ -117,7 +118,7 @@
 
 #if 1
 #undef DM9000_DEBUG
-#undef  DM9000_TX_DEBUG
+#undef DM9000_TX_DEBUG
 #undef DM9000_TX_DATA_DEBUG
 #undef DM9000_RX_DEBUG
 #undef  DM9000_RX_DATA_DEBUG
@@ -159,9 +160,13 @@
 #define TX_DATA_DPRINTF(s) do {} while (/*CONSTCOND*/0)
 #endif
 
-
+/*** Internal PHY functions ***/
 uint16_t dme_phy_read(struct dme_softc *sc, int reg);
-void dme_phy_write(struct dme_softc *sc, int reg, uint16_t value);
+void	dme_phy_write(struct dme_softc *sc, int reg, uint16_t value);
+void	dme_phy_init(struct dme_softc *sc);
+void	dme_phy_reset(struct dme_softc *sc);
+void	dme_phy_update_media(struct dme_softc *sc);
+void	dme_phy_check_link(void *arg);
 
 /*** Methods registered in struct ifnet ***/
 void	dme_start_output(struct ifnet *ifp);
@@ -186,6 +191,17 @@ voiddme_receive(struct dme_softc *sc
 /* Software Initialize/Reset of the DM9000 */
 voiddme_reset(struct dme_softc *sc);
 
+/* Configure multicast filter */
+void	dme_set_addr_filter(struct dme_softc *sc);
+
+/* Set media */
+int	dme_set_media(struct dme_softc *sc, int media);
+
+/* Read/write packet data from/to DM9000 IC in various transfer sizes */
+int	dme_pkt_read_2(struct dme_softc *sc, struct ifnet *ifp, struct mbuf **outBuf);
+int	dme_pkt_write_2(struct dme_softc *sc, struct mbuf *bufChain);
+/* TODO: Implement 8 and 32 bit read/write functions */
+
 uint16_t
 dme_phy_read(struct dme_softc *sc, int reg)
 {
@@ -199,9 +215,6 @@ dme_phy_read(struct dme_softc *sc, int r
 	/* Wait until access to PHY has completed */
 	while (dme_read(sc, DM9000_EPCR)  DM9000_EPCR_ERRE);
 
-	/* XXX: The delay is probably not necessary as we just busy-waited */
-	delay(200);
-
 	/* Reset ERPRR-bit */
 	dme_write(sc, DM9000_EPCR, DM9000_EPCR_EPOS_PHY);
 
@@ -228,19 +241,172 @@ dme_phy_write(struct dme_softc *sc, int 
 	/* Wait until access to PHY has completed */
 	while(dme_read(sc, DM9000_EPCR)  DM9000_EPCR_ERRE);
 
-
-	/* XXX: The delay is probably not necessary as we just busy-waited */
-	delay(200);
-
 	/* Reset ERPRR-bit */
 	dme_write(sc, DM9000_EPCR, DM9000_EPCR_EPOS_PHY);
 }
 
+void
+dme_phy_init(struct dme_softc *sc)
+{
+	u_int ifm_media = sc-sc_media.ifm_media;
+	uint32_t bmcr, anar;
+
+	bmcr = dme_phy_read(sc, DM9000_PHY_BMCR);
+	anar = dme_phy_read(sc, DM9000_PHY_ANAR);
+
+	anar = anar  ~DM9000_PHY_ANAR_10_HDX
+		 ~DM9000_PHY_ANAR_10_FDX
+		 ~DM9000_PHY_ANAR_TX_HDX
+		 ~DM9000_PHY_ANAR_TX_FDX;
+
+	switch (IFM_SUBTYPE(ifm_media)) {
+	case IFM_AUTO:
+		bmcr |= DM9000_PHY_BMCR_AUTO_NEG_EN;
+		anar |= DM9000_PHY_ANAR_10_HDX |
+			DM9000_PHY_ANAR_10_FDX |
+			DM9000_PHY_ANAR_TX_HDX |
+			DM9000_PHY_ANAR_TX_FDX;
+		break;
+	case IFM_10_T:
+		//bmcr = ~DM9000_PHY_BMCR_AUTO_NEG_EN;
+		bmcr = ~DM9000_PHY_BMCR_SPEED_SELECT;
+		if (ifm_media  IFM_FDX)
+			anar |= DM9000_PHY_ANAR_10_FDX;
+		else
+			anar |= DM9000_PHY_ANAR_10_HDX;
+		break;
+	case IFM_100_TX:
+		//bmcr = ~DM9000_PHY_BMCR_AUTO_NEG_EN;
+		bmcr |= DM9000_PHY_BMCR_SPEED_SELECT;
+		if (ifm_media  IFM_FDX)
+			anar |= DM9000_PHY_ANAR_TX_FDX;
+		else
+			anar |= DM9000_PHY_ANAR_TX_HDX;
+
+		break;
+	}
+
+	if(ifm_media  IFM_FDX) {
+		bmcr |= DM9000_PHY_BMCR_DUPLEX_MODE;
+	} else {
+		bmcr = ~DM9000_PHY_BMCR_DUPLEX_MODE;
+	}
+
+	dme_phy_write(sc, DM9000_PHY_BMCR, bmcr);
+	dme_phy_write(sc, DM9000_PHY_ANAR, anar);
+}
+
+void
+dme_phy_reset(struct dme_softc *sc)
+{
+	uint32_t reg;
+
+	/* PHY Reset */
+	dme_phy_write(sc, DM9000_PHY_BMCR, DM9000_PHY_BMCR_RESET);
+
+	reg = dme_read(sc, DM9000_GPCR);
+	dme_write(sc, DM9000_GPCR, reg  ~DM9000_GPCR_GPIO0_OUT);
+	reg = dme_read(sc, DM9000_GPR);
+	dme_write(sc, DM9000_GPR, reg | DM9000_GPR_PHY_PWROFF);
+
+	dme_phy_init(sc);
+
+	reg = dme_read(sc, DM9000_GPR);
+	dme_write(sc, DM9000_GPR, reg  ~DM9000_GPR_PHY_PWROFF);
+	reg = dme_read(sc, 

CVS commit: src/sys

2012-01-28 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Sat Jan 28 08:37:22 UTC 2012

Modified Files:
src/sys/conf: files
Added Files:
src/sys/dev/ic: uda1341.c uda1341reg.h uda1341var.h

Log Message:
Add UDA1341TS audio CODEC support.  Code is written by
Paul Fleischer.


To generate a diff of this commit:
cvs rdiff -u -r1.1039 -r1.1040 src/sys/conf/files
cvs rdiff -u -r0 -r1.1 src/sys/dev/ic/uda1341.c src/sys/dev/ic/uda1341reg.h \
src/sys/dev/ic/uda1341var.h

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

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1039 src/sys/conf/files:1.1040
--- src/sys/conf/files:1.1039	Sun Jan 22 06:44:30 2012
+++ src/sys/conf/files	Sat Jan 28 08:37:22 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1039 2012/01/22 06:44:30 christos Exp $
+#	$NetBSD: files,v 1.1040 2012/01/28 08:37:22 nisimura Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20100430
@@ -913,6 +913,10 @@ file	dev/ic/cs4231.c			audiocs
 define	ac97
 file	dev/ic/ac97.c			ac97
 
+# UDA1341 CODEC support
+define	uda1341
+file	dev/ic/uda1341.c		uda1341
+
 # Oki MSM6258 support code
 #
 define msm6258

Added files:

Index: src/sys/dev/ic/uda1341.c
diff -u /dev/null src/sys/dev/ic/uda1341.c:1.1
--- /dev/null	Sat Jan 28 08:37:22 2012
+++ src/sys/dev/ic/uda1341.c	Sat Jan 28 08:37:22 2012
@@ -0,0 +1,762 @@
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Paul Fleischer p...@xpg.dk
+ *
+ * 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
+
+#include sys/param.h
+#include sys/device.h
+#include sys/audioio.h
+#include sys/fcntl.h
+
+#include dev/audio_if.h
+
+#include dev/ic/uda1341var.h
+#include dev/ic/uda1341reg.h
+
+/*#define UDA1341_DEBUG*/
+
+#ifdef UDA1341_DEBUG
+#define DPRINTF(x) do {printf x; } while (/*CONSTCOND*/0)
+#else
+#define DPRINTF(s) do {} while (/*CONSTCOND*/0)
+#endif
+
+const struct audio_format uda1341_formats[UDA1341_NFORMATS] =
+{
+	{NULL, AUMODE_PLAY|AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_LE, 8, 8, 2,
+	 AUFMT_STEREO, 0, {8000, 48000}
+	},
+	{NULL, AUMODE_PLAY|AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_LE, 16, 16, 2,
+	 AUFMT_STEREO, 0, {8000, 48000}
+	},
+	{NULL, AUMODE_PLAY|AUMODE_RECORD, AUDIO_ENCODING_ULINEAR_LE, 8, 8, 2,
+	 AUFMT_STEREO, 0, {8000, 48000}
+	},
+	{NULL, AUMODE_PLAY|AUMODE_RECORD, AUDIO_ENCODING_ULINEAR_LE, 16, 16, 2,
+	 AUFMT_STEREO, 0, {8000, 48000}
+	},
+};
+
+static void uda1341_update_sound_settings(struct uda1341_softc *sc);
+
+
+int
+uda1341_attach(struct uda1341_softc *sc)
+{
+	sc-sc_system_clock = UDA1341_CLOCK_NA;
+	sc-sc_l3_write = NULL;
+	sc-sc_volume = 127;
+	sc-sc_bass = 0;
+	sc-sc_treble = 0;
+	sc-sc_mode = 0;
+	sc-sc_mute = 0;
+	sc-sc_ogain = 0;
+	sc-sc_deemphasis = UDA1341_DEEMPHASIS_AUTO;
+	sc-sc_dac_power = 0;
+	sc-sc_adc_power = 0;
+	sc-sc_inmix1 = 0;
+	sc-sc_inmix2 = 0;
+	sc-sc_micvol = 0;
+	sc-sc_inmode = 0;
+	sc-sc_agc = 0;
+	sc-sc_agc_lvl = 0;
+	sc-sc_ch2_gain = 0;
+
+	return 0;
+}
+
+int
+uda1341_query_encodings(void *handle, audio_encoding_t *ae)
+{
+	switch(ae-index) {
+	case 0:
+		strlcpy(ae-name, AudioEmulaw, sizeof(ae-name));
+		ae-encoding = AUDIO_ENCODING_ULAW;
+		ae-precision = 8;
+		ae-flags = AUDIO_ENCODINGFLAG_EMULATED;
+		break;
+	case 1:
+		strlcpy(ae-name, AudioEslinear_le, sizeof(ae-name));
+		ae-encoding = AUDIO_ENCODING_SLINEAR_LE;
+		ae-precision = 8;
+		ae-flags = 0;
+		break;
+	case 2:
+		strlcpy(ae-name, AudioEslinear_le, sizeof(ae-name));
+		ae-encoding = AUDIO_ENCODING_SLINEAR_LE;
+		ae-precision = 16;
+		ae-flags = 0;
+		

CVS commit: src/sys/arch/x86/x86

2012-01-28 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Jan 28 08:57:09 UTC 2012

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

Log Message:
Fix pae xen build.


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/sys/arch/x86/x86/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.156 src/sys/arch/x86/x86/pmap.c:1.157
--- src/sys/arch/x86/x86/pmap.c:1.156	Sat Jan 28 07:19:17 2012
+++ src/sys/arch/x86/x86/pmap.c	Sat Jan 28 08:57:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.156 2012/01/28 07:19:17 cherry Exp $	*/
+/*	$NetBSD: pmap.c,v 1.157 2012/01/28 08:57:09 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.156 2012/01/28 07:19:17 cherry Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.157 2012/01/28 08:57:09 cherry Exp $);
 
 #include opt_user_ldt.h
 #include opt_lockdebug.h
@@ -795,13 +795,13 @@ pmap_map_ptes(struct pmap *pmap, struct 
 	pmap-pm_ncsw = l-l_ncsw;
 	*pmap2 = curpmap;
 	*ptepp = PTE_BASE;
-#ifdef XEN
+#if defined(XEN)  defined(__x86_64__)
 	KASSERT(ci-ci_normal_pdes[PTP_LEVELS - 2] == L4_BASE);
 	ci-ci_normal_pdes[PTP_LEVELS - 2] = pmap-pm_pdir;
 	*pdeppp = ci-ci_normal_pdes;
-#else /* XEN */
+#else /* XEN  __x86_64__ */
 	*pdeppp = normal_pdes;
-#endif /* XEN */
+#endif /* XEN  __x86_64__ */
 }
 
 /*



CVS commit: src/external/gpl3/gcc/dist/gcc/config/vax

2012-01-28 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Jan 28 11:24:05 UTC 2012

Modified Files:
src/external/gpl3/gcc/dist/gcc/config/vax: elf.h

Log Message:
Pull in revision 1.4 from src/gnu/dist/gcc4/gcc/config/vax/elf.h:

  Emit DWARF relocation in its expected form

PR toolchain/43314


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl3/gcc/dist/gcc/config/vax/elf.h

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/vax/elf.h
diff -u src/external/gpl3/gcc/dist/gcc/config/vax/elf.h:1.1.1.1 src/external/gpl3/gcc/dist/gcc/config/vax/elf.h:1.2
--- src/external/gpl3/gcc/dist/gcc/config/vax/elf.h:1.1.1.1	Tue Jun 21 01:22:25 2011
+++ src/external/gpl3/gcc/dist/gcc/config/vax/elf.h	Sat Jan 28 11:24:05 2012
@@ -109,5 +109,5 @@ along with GCC; see the file COPYING3.  
 fputs (integer_asm_op (SIZE, FALSE), FILE);		\
 fprintf (FILE, %%pcrel%d(, SIZE * 8);		\
 assemble_name (FILE, LABEL);			\
-fputc (')', FILE);	\
+fprintf (FILE, %+d), SIZE);			\
   } while (0)



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

2012-01-28 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Jan 28 12:15:19 UTC 2012

Modified Files:
src/sys/arch/xen/x86: cpu.c

Log Message:
Update comments to remove references to alternate pte space.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/xen/x86/cpu.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/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.78 src/sys/arch/xen/x86/cpu.c:1.79
--- src/sys/arch/xen/x86/cpu.c:1.78	Sat Jan 28 07:19:17 2012
+++ src/sys/arch/xen/x86/cpu.c	Sat Jan 28 12:15:19 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.78 2012/01/28 07:19:17 cherry Exp $	*/
+/*	$NetBSD: cpu.c,v 1.79 2012/01/28 12:15:19 cherry Exp $	*/
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.78 2012/01/28 07:19:17 cherry Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.79 2012/01/28 12:15:19 cherry Exp $);
 
 #include opt_ddb.h
 #include opt_multiprocessor.h
@@ -1244,16 +1244,9 @@ cpu_load_pmap(struct pmap *pmap)
   * considered to be a canonical SHADOW PDIR with the following
   * properties: 
   * - Its recursive mapping points to itself
-  * - per-cpu recurseive mappings point to themselves
+  * - per-cpu recurseive mappings point to themselves on __x86_64__
   * - per-cpu L4 pages' kernel entries are expected to be in sync with
   *   the shadow
-  * - APDP_PDE_SHADOW accesses the shadow pdir
-  * - APDP_PDE accesses the per-cpu pdir
-  * - alternate mappings are considered per-cpu - however, x86 pmap
-  *   currently partially consults the shadow - this works because the
-  *   shadow PDE is updated together with the per-cpu entry (see:
-  *   xen_pmap.c: pmap_map_ptes(), and the pmap is locked while the
-  * alternate ptes are mapped in.
   */
 
 void



CVS commit: src/lib/csu/arch/sh3

2012-01-28 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Jan 28 12:21:14 UTC 2012

Modified Files:
src/lib/csu/arch/sh3: crt0.S

Log Message:
Asm cosmetic.  Add a comment that explains what this trampoline does.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/sh3/crt0.S

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

Modified files:

Index: src/lib/csu/arch/sh3/crt0.S
diff -u src/lib/csu/arch/sh3/crt0.S:1.1 src/lib/csu/arch/sh3/crt0.S:1.2
--- src/lib/csu/arch/sh3/crt0.S:1.1	Sat Aug  7 18:01:34 2010
+++ src/lib/csu/arch/sh3/crt0.S	Sat Jan 28 12:21:13 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.S,v 1.1 2010/08/07 18:01:34 joerg Exp $ */
+/* $NetBSD: crt0.S,v 1.2 2012/01/28 12:21:13 uwe Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -37,11 +37,17 @@
 
 #include machine/asm.h
 
-RCSID($NetBSD: crt0.S,v 1.1 2010/08/07 18:01:34 joerg Exp $)
+RCSID($NetBSD: crt0.S,v 1.2 2012/01/28 12:21:13 uwe Exp $)
 
 STRONG_ALIAS(_start,__start)
 
+/*
+ * Kernel setregs() passes all arguments in registers to avoid
+ * copyout.  This trampoline pushes 5th and 6th arguments into stack,
+ * where C ABI expects them to be, and calls the real startup code
+ * written in C.
+ */
 _ENTRY(__start)
-	mov.l	r9,@-r15
-	bra ___start
-	mov.l	r8,@-r15
+	mov.l	r9, @-sp
+	bra	___start
+	 mov.l	r8, @-sp



CVS commit: src/sys

2012-01-28 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sat Jan 28 12:22:34 UTC 2012

Modified Files:
src/sys/kern: kern_sleepq.c kern_synch.c
src/sys/rump/librump/rumpkern: ltsleep.c
src/sys/sys: proc.h

Log Message:
Remove obsolete ltsleep(9) and wakeup_one(9).


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/kern/kern_sleepq.c
cvs rdiff -u -r1.296 -r1.297 src/sys/kern/kern_synch.c
cvs rdiff -u -r1.28 -r1.29 src/sys/rump/librump/rumpkern/ltsleep.c
cvs rdiff -u -r1.313 -r1.314 src/sys/sys/proc.h

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

Modified files:

Index: src/sys/kern/kern_sleepq.c
diff -u src/sys/kern/kern_sleepq.c:1.44 src/sys/kern/kern_sleepq.c:1.45
--- src/sys/kern/kern_sleepq.c:1.44	Mon Oct 31 12:18:32 2011
+++ src/sys/kern/kern_sleepq.c	Sat Jan 28 12:22:33 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sleepq.c,v 1.44 2011/10/31 12:18:32 yamt Exp $	*/
+/*	$NetBSD: kern_sleepq.c,v 1.45 2012/01/28 12:22:33 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_sleepq.c,v 1.44 2011/10/31 12:18:32 yamt Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_sleepq.c,v 1.45 2012/01/28 12:22:33 rmind Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -54,7 +54,7 @@ __KERNEL_RCSID(0, $NetBSD: kern_sleepq.
 
 static int	sleepq_sigtoerror(lwp_t *, int);
 
-/* General purpose sleep table, used by ltsleep() and condition variables. */
+/* General purpose sleep table, used by mtsleep() and condition variables. */
 sleeptab_t	sleeptab	__cacheline_aligned;
 
 /*

Index: src/sys/kern/kern_synch.c
diff -u src/sys/kern/kern_synch.c:1.296 src/sys/kern/kern_synch.c:1.297
--- src/sys/kern/kern_synch.c:1.296	Sun Nov  6 14:11:00 2011
+++ src/sys/kern/kern_synch.c	Sat Jan 28 12:22:33 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_synch.c,v 1.296 2011/11/06 14:11:00 dholland Exp $	*/
+/*	$NetBSD: kern_synch.c,v 1.297 2012/01/28 12:22:33 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009
@@ -69,7 +69,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_synch.c,v 1.296 2011/11/06 14:11:00 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_synch.c,v 1.297 2012/01/28 12:22:33 rmind Exp $);
 
 #include opt_kstack.h
 #include opt_perfctrs.h
@@ -176,28 +176,19 @@ synch_init(void)
  * signal needs to be delivered, ERESTART is returned if the current system
  * call should be restarted if possible, and EINTR is returned if the system
  * call should be interrupted by the signal (return EINTR).
- *
- * The interlock is held until we are on a sleep queue. The interlock will
- * be locked before returning back to the caller unless the PNORELOCK flag
- * is specified, in which case the interlock will always be unlocked upon
- * return.
  */
 int
-ltsleep(wchan_t ident, pri_t priority, const char *wmesg, int timo,
-	volatile struct simplelock *interlock)
+tsleep(wchan_t ident, pri_t priority, const char *wmesg, int timo)
 {
 	struct lwp *l = curlwp;
 	sleepq_t *sq;
 	kmutex_t *mp;
-	int error;
 
 	KASSERT((l-l_pflag  LP_INTR) == 0);
 	KASSERT(ident != lbolt);
 
 	if (sleepq_dontsleep(l)) {
 		(void)sleepq_abort(NULL, 0);
-		if ((priority  PNORELOCK) != 0)
-			simple_unlock(interlock);
 		return 0;
 	}
 
@@ -205,18 +196,7 @@ ltsleep(wchan_t ident, pri_t priority, c
 	sq = sleeptab_lookup(sleeptab, ident, mp);
 	sleepq_enter(sq, l, mp);
 	sleepq_enqueue(sq, ident, wmesg, sleep_syncobj);
-
-	if (interlock != NULL) {
-		KASSERT(simple_lock_held(interlock));
-		simple_unlock(interlock);
-	}
-
-	error = sleepq_block(timo, priority  PCATCH);
-
-	if (interlock != NULL  (priority  PNORELOCK) == 0)
-		simple_lock(interlock);
- 
-	return error;
+	return sleepq_block(timo, priority  PCATCH);
 }
 
 int
@@ -245,7 +225,7 @@ mtsleep(wchan_t ident, pri_t priority, c
 
 	if ((priority  PNORELOCK) == 0)
 		mutex_enter(mtx);
- 
+
 	return error;
 }
 
@@ -318,26 +298,6 @@ wakeup(wchan_t ident)
 }
 
 /*
- * OBSOLETE INTERFACE
- *
- * Make the highest priority LWP first in line on the specified
- * identifier runnable.
- */
-void 
-wakeup_one(wchan_t ident)
-{
-	sleepq_t *sq;
-	kmutex_t *mp;
-
-	if (__predict_false(cold))
-		return;
-
-	sq = sleeptab_lookup(sleeptab, ident, mp);
-	sleepq_wake(sq, ident, 1, mp);
-}
-
-
-/*
  * General yield call.  Puts the current LWP back on its run queue and
  * performs a voluntary context switch.  Should only be called when the
  * current LWP explicitly requests it (eg sched_yield(2)).

Index: src/sys/rump/librump/rumpkern/ltsleep.c
diff -u src/sys/rump/librump/rumpkern/ltsleep.c:1.28 src/sys/rump/librump/rumpkern/ltsleep.c:1.29
--- src/sys/rump/librump/rumpkern/ltsleep.c:1.28	Wed Dec  1 14:59:38 2010
+++ src/sys/rump/librump/rumpkern/ltsleep.c	Sat Jan 28 12:22:33 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ltsleep.c,v 1.28 2010/12/01 14:59:38 pooka Exp $	*/
+/*	$NetBSD: 

CVS commit: src/tests/rump/kernspace

2012-01-28 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sat Jan 28 12:23:56 UTC 2012

Modified Files:
src/tests/rump/kernspace: tsleep.c

Log Message:
tsleep(9) no more.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/rump/kernspace/tsleep.c

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

Modified files:

Index: src/tests/rump/kernspace/tsleep.c
diff -u src/tests/rump/kernspace/tsleep.c:1.2 src/tests/rump/kernspace/tsleep.c:1.3
--- src/tests/rump/kernspace/tsleep.c:1.2	Sun Aug  7 14:03:16 2011
+++ src/tests/rump/kernspace/tsleep.c	Sat Jan 28 12:23:56 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: tsleep.c,v 1.2 2011/08/07 14:03:16 rmind Exp $	*/
+/*	$NetBSD: tsleep.c,v 1.3 2012/01/28 12:23:56 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 #if !defined(lint)
-__RCSID($NetBSD: tsleep.c,v 1.2 2011/08/07 14:03:16 rmind Exp $);
+__RCSID($NetBSD: tsleep.c,v 1.3 2012/01/28 12:23:56 rmind Exp $);
 #endif /* !lint */
 
 #include sys/param.h
@@ -43,35 +43,6 @@ __RCSID($NetBSD: tsleep.c,v 1.2 2011/08
 #define NTHREADS 10
 
 /*
- * kernel lock is interlock
- */
-static void
-bigthread(void *arg)
-{
-	static int wakeups;
-	struct simplelock slock;
-	int i;
-
-	simple_lock_init(slock);
-	for (i = 0; i  1000; i++) {
-		wakeup(bigthread);
-		if (wakeups = NTHREADS-1)
-			break;
-		if (arg) {
-			simple_lock(slock);
-			ltsleep(bigthread, PNORELOCK, hii, 0, slock);
-		} else {
-			tsleep(bigthread, 0, hii, 0);
-		}
-	}
-
-	wakeup(bigthread);
-	wakeups++;
-
-	kthread_exit(0);
-}
-
-/*
  * mpsafe thread.  need dedicated interlock
  */
 static kmutex_t mymtx;
@@ -112,17 +83,9 @@ tinythread(void *arg)
 void
 rumptest_tsleep()
 {
-	struct lwp *bigl[NTHREADS];
 	struct lwp *notbigl[NTHREADS];
 	int rv, i;
 
-	for (i = 0; i  NTHREADS; i++) {
-		rv = kthread_create(PRI_NONE, KTHREAD_MUSTJOIN,
-		NULL, bigthread, (void *)(uintptr_t)i, bigl[i], b);
-		if (rv)
-			panic(thread create failed: %d, rv);
-	}
-
 	mutex_init(mymtx, MUTEX_DEFAULT, IPL_NONE);
 
 	for (i = 0; i  NTHREADS; i++) {
@@ -133,10 +96,6 @@ rumptest_tsleep()
 	}
 
 	for (i = 0; i  NTHREADS; i++) {
-		kthread_join(bigl[i]);
-	}
-
-	for (i = 0; i  NTHREADS; i++) {
 		kthread_join(notbigl[i]);
 	}
 }



CVS commit: src/sys/sys

2012-01-28 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sat Jan 28 12:27:31 UTC 2012

Modified Files:
src/sys/sys: param.h

Log Message:
Welcome to 5.99.61: major UVM/kmem/vmem changes, tsleep and wakeup_one removal.


To generate a diff of this commit:
cvs rdiff -u -r1.403 -r1.404 src/sys/sys/param.h

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

Modified files:

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.403 src/sys/sys/param.h:1.404
--- src/sys/sys/param.h:1.403	Wed Jan 25 19:47:18 2012
+++ src/sys/sys/param.h	Sat Jan 28 12:27:30 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.403 2012/01/25 19:47:18 tron Exp $	*/
+/*	$NetBSD: param.h,v 1.404 2012/01/28 12:27:30 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -63,7 +63,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	599006000	/* NetBSD 5.99.60 */
+#define	__NetBSD_Version__	599006100	/* NetBSD 5.99.61 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) = __NetBSD_Version__)



CVS commit: src/lib/csu/arch/sh3

2012-01-28 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Jan 28 12:44:19 UTC 2012

Modified Files:
src/lib/csu/arch/sh3: crti.S

Log Message:
Add a comment that explains what this code does.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/sh3/crti.S

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

Modified files:

Index: src/lib/csu/arch/sh3/crti.S
diff -u src/lib/csu/arch/sh3/crti.S:1.1 src/lib/csu/arch/sh3/crti.S:1.2
--- src/lib/csu/arch/sh3/crti.S:1.1	Sat Aug  7 18:01:34 2010
+++ src/lib/csu/arch/sh3/crti.S	Sat Jan 28 12:44:19 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: crti.S,v 1.1 2010/08/07 18:01:34 joerg Exp $ */
+/* $NetBSD: crti.S,v 1.2 2012/01/28 12:44:19 uwe Exp $ */
 
 /*-
  * Copyright (c) 2001 Ross Harvey
@@ -35,10 +35,16 @@
 
 #include machine/asm.h
 
-RCSID($NetBSD: crti.S,v 1.1 2010/08/07 18:01:34 joerg Exp $)
+RCSID($NetBSD: crti.S,v 1.2 2012/01/28 12:44:19 uwe Exp $)
 
 #include sysident.S
 
+
+/*
+ * Provide function prologues for the code in .init and .fini sections.
+ * Corresponding epilogues are in crtn.S
+ */
+
 	.section .init, ax, @progbits
 	.align 4
 	.globl _init



CVS commit: src/lib/csu/arch/sh3

2012-01-28 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Jan 28 12:45:43 UTC 2012

Modified Files:
src/lib/csu/arch/sh3: crtn.S

Log Message:
Add a comment that explains what this code does.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/sh3/crtn.S

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

Modified files:

Index: src/lib/csu/arch/sh3/crtn.S
diff -u src/lib/csu/arch/sh3/crtn.S:1.1 src/lib/csu/arch/sh3/crtn.S:1.2
--- src/lib/csu/arch/sh3/crtn.S:1.1	Sat Aug  7 18:01:34 2010
+++ src/lib/csu/arch/sh3/crtn.S	Sat Jan 28 12:45:43 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: crtn.S,v 1.1 2010/08/07 18:01:34 joerg Exp $ */
+/* $NetBSD: crtn.S,v 1.2 2012/01/28 12:45:43 uwe Exp $ */
 
 /*-
  * Copyright (c) 2001 Ross Harvey
@@ -35,7 +35,13 @@
 
 #include machine/asm.h
 
-RCSID($NetBSD: crtn.S,v 1.1 2010/08/07 18:01:34 joerg Exp $)
+RCSID($NetBSD: crtn.S,v 1.2 2012/01/28 12:45:43 uwe Exp $)
+
+
+/*
+ * Provide function epilogues for the code in .init and .fini sections.
+ * Corresponding prologues are in crti.S
+ */
 
 	.section .init, ax, @progbits
 	mov	r14, sp



CVS commit: src/share/man/man9

2012-01-28 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sat Jan 28 13:12:52 UTC 2012

Modified Files:
src/share/man/man9: ltsleep.9

Log Message:
Update ltsleep(9) man page.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/share/man/man9/ltsleep.9

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/man9/ltsleep.9
diff -u src/share/man/man9/ltsleep.9:1.12 src/share/man/man9/ltsleep.9:1.13
--- src/share/man/man9/ltsleep.9:1.12	Wed Apr 30 13:10:58 2008
+++ src/share/man/man9/ltsleep.9	Sat Jan 28 13:12:52 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: ltsleep.9,v 1.12 2008/04/30 13:10:58 martin Exp $
+.\	$NetBSD: ltsleep.9,v 1.13 2012/01/28 13:12:52 rmind Exp $
 .\
 .\ Copyright (c) 1996, 2002, 2007 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 June 17, 2007
+.Dd January 28, 2012
 .Dt LTSLEEP 9
 .Os
 .Sh NAME
@@ -38,8 +38,6 @@
 .Sh SYNOPSIS
 .In sys/proc.h
 .Ft int
-.Fn ltsleep wchan_t ident pri_t priority const char *wmesg int timo volatile struct simplelock *slock
-.Ft int
 .Fn tsleep wchan_t ident pri_t priority const char *wmesg int timo
 .Ft void
 .Fn wakeup wchan_t ident
@@ -47,6 +45,10 @@
 .Em The interfaces described in this manual page are obsolete
 .Em and will be removed from a future version of the system.
 .Pp
+.Em The
+.Em Fn ltsleep
+.Em interface has been obsoleted and removed from the system.
+.Pp
 .Em Please see the
 .Xr condvar 9 ,
 .Xr mutex 9 ,
@@ -55,7 +57,7 @@
 .Em manual pages for information on kernel synchronisation primitives.
 .Pp
 These functions implement voluntary context switching.
-.Fn ltsleep
+.Fn tsleep
 and
 .Fn tsleep
 are used throughout the kernel whenever processing in the current context
@@ -82,7 +84,7 @@ again -- retry the action that blocked i
 condition has cleared.
 .Pp
 The
-.Fn ltsleep
+.Fn tsleep
 function takes the following arguments:
 .Bl -tag -width priority
 .It Fa ident
@@ -108,12 +110,6 @@ If the flag
 is OR'ed into
 .Fa priority
 the process checks for posted signals before and after sleeping.
-If the flag
-.Dv PNORELOCK
-is OR'ed into
-.Fa priority ,
-.Fa slock
-is NOT re-locked after process resume.
 .It Fa wmesg
 A pointer to a character string indicating the reason a process is sleeping.
 The kernel does not use the string, but makes it available
@@ -132,27 +128,9 @@ was posted,
 .Fn tsleep
 will return
 .Er EWOULDBLOCK .
-.It Fa slock
-If not NULL, the
-.Fa slock
-interlock is unlocked once the scheduler lock is acquired.
-Unless
-.Dv PNORELOCK
-was set,
-.Fa slock
-is locked again once
-the process is resumed from sleep.
-This provides wakeup-before-sleep condition protection facility.
 .El
 .Pp
 The
-.Fn tsleep
-macro is functionally equivalent to:
-.Bd -literal -offset indent
-ltsleep(ident, priority, wmesg, timo, NULL)
-.Ed
-.Pp
-The
 .Fn wakeup
 function will mark all processes which are currently sleeping on the identifier
 .Fa ident
@@ -172,11 +150,11 @@ lock
 only one of them will succeed in acquiring the lock when it is released.
 All others will have to go back to sleep and wait for the next opportunity.
 .Sh RETURN VALUES
-.Fn ltsleep
+.Fn tsleep
 returns 0 if it returns as a result of a
 .Fn wakeup .
 If a
-.Fn ltsleep
+.Fn tsleep
 returns as a result of a signal, the return value is
 .Er ERESTART
 if the signal has the
@@ -187,7 +165,7 @@ and
 .Er EINTR
 otherwise.
 If
-.Fn ltsleep
+.Fn tsleep
 returns because of a timeout it returns
 .Er EWOULDBLOCK .
 .Sh SEE ALSO



CVS commit: src/external/gpl3/gcc/dist/libstdc++-v3/libsupc++

2012-01-28 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Jan 28 14:21:52 UTC 2012

Modified Files:
src/external/gpl3/gcc/dist/libstdc++-v3/libsupc++: exception_ptr.h

Log Message:
Merge r171807 from upstream:
exception_ptr.h needs the forward declaration because it's
included from typeinfo before typeinfo defines std::type_info.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/gcc/dist/libstdc++-v3/libsupc++/exception_ptr.h

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

Modified files:

Index: src/external/gpl3/gcc/dist/libstdc++-v3/libsupc++/exception_ptr.h
diff -u src/external/gpl3/gcc/dist/libstdc++-v3/libsupc++/exception_ptr.h:1.1.1.1 src/external/gpl3/gcc/dist/libstdc++-v3/libsupc++/exception_ptr.h:1.2
--- src/external/gpl3/gcc/dist/libstdc++-v3/libsupc++/exception_ptr.h:1.1.1.1	Tue Jun 21 01:24:47 2011
+++ src/external/gpl3/gcc/dist/libstdc++-v3/libsupc++/exception_ptr.h	Sat Jan 28 14:21:52 2012
@@ -129,7 +129,7 @@ namespace std 
   operator==(const exception_ptr, const exception_ptr) throw() 
   __attribute__ ((__pure__));
 
-  const type_info*
+  const class type_info*
   __cxa_exception_type() const throw() __attribute__ ((__pure__));
 };
 



CVS commit: src/external/gpl3/gcc/lib/libgomp

2012-01-28 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Jan 28 14:24:53 UTC 2012

Modified Files:
src/external/gpl3/gcc/lib/libgomp: Makefile

Log Message:
Disable -Wconversion for clang.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/gpl3/gcc/lib/libgomp/Makefile

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

Modified files:

Index: src/external/gpl3/gcc/lib/libgomp/Makefile
diff -u src/external/gpl3/gcc/lib/libgomp/Makefile:1.5 src/external/gpl3/gcc/lib/libgomp/Makefile:1.6
--- src/external/gpl3/gcc/lib/libgomp/Makefile:1.5	Fri Sep 23 09:36:37 2011
+++ src/external/gpl3/gcc/lib/libgomp/Makefile	Sat Jan 28 14:24:53 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2011/09/23 09:36:37 tron Exp $
+#	$NetBSD: Makefile,v 1.6 2012/01/28 14:24:53 joerg Exp $
 
 # build GCC's libgomp, so that -fopenmp works.
 
@@ -50,6 +50,8 @@ CPPFLAGS+= \
 	-I${ARCHDIR}
 CFLAGS+=-pthread
 
+CWARNFLAGS.clang+=	-Wno-conversion
+
 # libgomp.so.1.0 is in GCC 4.5.
 SHLIB_MAJOR=	1
 SHLIB_MINOR=	0



CVS commit: src/sys/uvm

2012-01-28 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sat Jan 28 14:37:35 UTC 2012

Modified Files:
src/sys/uvm: uvm_object.h

Log Message:
Describe UVM object and explain lock sharing a little.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/uvm/uvm_object.h

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

Modified files:

Index: src/sys/uvm/uvm_object.h
diff -u src/sys/uvm/uvm_object.h:1.31 src/sys/uvm/uvm_object.h:1.32
--- src/sys/uvm/uvm_object.h:1.31	Sun Jun 12 03:36:03 2011
+++ src/sys/uvm/uvm_object.h	Sat Jan 28 14:37:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_object.h,v 1.31 2011/06/12 03:36:03 rmind Exp $	*/
+/*	$NetBSD: uvm_object.h,v 1.32 2012/01/28 14:37:35 rmind Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -30,16 +30,24 @@
 #ifndef _UVM_UVM_OBJECT_H_
 #define _UVM_UVM_OBJECT_H_
 
-/*
- * uvm_object.h
- */
-
 #include sys/queue.h
 #include sys/rbtree.h
 #include uvm/uvm_pglist.h
 
 /*
- * uvm_object: all that is left of mach objects.
+ * The UVM memory object interface.  Notes:
+ *
+ * A UVM memory object represents a list of pages, which are managed by
+ * the object's pager operations (uvm_object::pgops).  All pages belonging
+ * to an object are owned by it and thus protected by the object lock.
+ *
+ * The lock (uvm_object::vmobjlock) may be shared amongst the UVM objects.
+ * By default, the lock is allocated dynamically using mutex_obj(9) cache.
+ * Lock sharing is normally used when there is an underlying object.  For
+ * example, vnode representing a file may have an underlying node, which
+ * is the case for tmpfs and layered file systems.  In such case, vnode's
+ * UVM object and the underlying UVM object shares the lock (note that the
+ * vnode_t::v_interlock points to uvm_object::vmobjlock).
  */
 
 struct uvm_object {



CVS commit: src/sbin/ifconfig

2012-01-28 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Sat Jan 28 15:01:44 UTC 2012

Modified Files:
src/sbin/ifconfig: ifconfig.8 ifconfig.c

Log Message:
When ifconfig is invoked without any arguments, display the list of
all network interfaces (equivalent to ifconfig -a), instead of displaying
the usage.  (This is consistent with the behaviour on FreeBSD and OpenBSD.)


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sbin/ifconfig/ifconfig.8
cvs rdiff -u -r1.226 -r1.227 src/sbin/ifconfig/ifconfig.c

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

Modified files:

Index: src/sbin/ifconfig/ifconfig.8
diff -u src/sbin/ifconfig/ifconfig.8:1.103 src/sbin/ifconfig/ifconfig.8:1.104
--- src/sbin/ifconfig/ifconfig.8:1.103	Tue May 31 16:17:30 2011
+++ src/sbin/ifconfig/ifconfig.8	Sat Jan 28 15:01:44 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: ifconfig.8,v 1.103 2011/05/31 16:17:30 riastradh Exp $
+.\	$NetBSD: ifconfig.8,v 1.104 2012/01/28 15:01:44 mbalmer Exp $
 .\
 .\ Copyright (c) 1983, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\ @(#)ifconfig.8	8.4 (Berkeley) 6/1/94
 .\
-.Dd November 15, 2010
+.Dd January 28, 2012
 .Dt IFCONFIG 8
 .Os
 .Sh NAME
@@ -805,6 +805,12 @@ flag may be used instead of an interface
 This flag instructs
 .Nm
 to display information about all interfaces in the system.
+This is also the default behaviour when no arguments are given to
+.Nm
+on the command line.
+When
+.Fl a
+is used, the output can be modified by adding more flags:
 .Fl d
 limits this to interfaces that are down,
 .Fl u

Index: src/sbin/ifconfig/ifconfig.c
diff -u src/sbin/ifconfig/ifconfig.c:1.226 src/sbin/ifconfig/ifconfig.c:1.227
--- src/sbin/ifconfig/ifconfig.c:1.226	Mon Aug 29 14:35:00 2011
+++ src/sbin/ifconfig/ifconfig.c	Sat Jan 28 15:01:44 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ifconfig.c,v 1.226 2011/08/29 14:35:00 joerg Exp $	*/
+/*	$NetBSD: ifconfig.c,v 1.227 2012/01/28 15:01:44 mbalmer Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
 #ifndef lint
 __COPYRIGHT(@(#) Copyright (c) 1983, 1993\
  The Regents of the University of California.  All rights reserved.);
-__RCSID($NetBSD: ifconfig.c,v 1.226 2011/08/29 14:35:00 joerg Exp $);
+__RCSID($NetBSD: ifconfig.c,v 1.227 2012/01/28 15:01:44 mbalmer Exp $);
 #endif /* not lint */
 
 #include sys/param.h
@@ -77,7 +77,7 @@ __RCSID($NetBSD: ifconfig.c,v 1.226 201
 #include net/if_ether.h
 #include netinet/in.h		/* XXX */
 #include netinet/in_var.h	/* XXX */
- 
+
 #include netdb.h
 
 #include sys/protosw.h
@@ -418,7 +418,7 @@ register_family(struct afswtch *af)
 	SIMPLEQ_INSERT_TAIL(aflist, af, af_next);
 	return 0;
 }
- 
+
 int
 register_flag(int flag)
 {
@@ -434,7 +434,7 @@ register_flag(int flag)
 
 	return 0;
 }
- 
+
 static int
 flag_index(int flag)
 {
@@ -467,7 +467,7 @@ get_flag(int flag)
 
 	if ((idx = flag_index(flag)) == -1)
 		return false;
-		
+
 	return gflagset[idx];
 }
 
@@ -482,7 +482,7 @@ init_parser(void)
 		err(EXIT_FAILURE, parser_init(iface_only));
 	if (parser_init(iface_start.pif_parser) == -1)
 		err(EXIT_FAILURE, parser_init(iface_start));
- 
+
 	SIMPLEQ_FOREACH(b, cmdloop_branches, b_next)
 		pbranch_addbranch(command_root, b-b_parser);
 
@@ -557,7 +557,11 @@ main(int argc, char **argv)
 	start = init_parser();
 
 	/* Parse command-line options */
-	aflag = Nflag = vflag = zflag = false;
+	Nflag = vflag = zflag = false;
+	aflag = argc == 1 ? true : false;
+	if (aflag)
+		start = opt_family_only.pb_parser;
+
 	while ((ch = getopt(argc, argv, gflags)) != -1) {
 		switch (ch) {
 		case 'A':
@@ -571,7 +575,7 @@ main(int argc, char **argv)
 		case 'b':
 			bflag = true;
 			break;
-			
+
 		case 'C':
 			Cflag = true;
 			break;
@@ -988,7 +992,7 @@ setifflags(prop_dictionary_t env, prop_d
 	if (direct_ioctl(env, SIOCSIFFLAGS, ifr) == -1)
 		return -1;
 
-	return 0; 
+	return 0;
 }
 
 static int
@@ -1078,7 +1082,7 @@ do_setifpreference(prop_dictionary_t env
 
 	if (!prop_dictionary_get_int16(env, preference,
 	ifap.ifap_preference))
-		return; 
+		return;
 
 	d = (prop_data_t)prop_dictionary_get(env, address);
 	assert(d != NULL);



CVS commit: src/lib/csu/arch/sh3

2012-01-28 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Jan 28 15:08:47 UTC 2012

Added Files:
src/lib/csu/arch/sh3: crtend.S

Log Message:
Steal arch/i386/crtend.S


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/lib/csu/arch/sh3/crtend.S

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

Added files:

Index: src/lib/csu/arch/sh3/crtend.S
diff -u /dev/null src/lib/csu/arch/sh3/crtend.S:1.1
--- /dev/null	Sat Jan 28 15:08:47 2012
+++ src/lib/csu/arch/sh3/crtend.S	Sat Jan 28 15:08:47 2012
@@ -0,0 +1,52 @@
+/*	$NetBSD: crtend.S,v 1.1 2012/01/28 15:08:47 uwe Exp $	*/
+/*-
+ * Copyright (c) 2010 Joerg Sonnenberger jo...@netbsd.org
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in
+ *the documentation and/or other materials provided with the
+ *distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
+ * COPYRIGHT HOLDERS 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 machine/asm.h
+
+RCSID($NetBSD: crtend.S,v 1.1 2012/01/28 15:08:47 uwe Exp $)
+
+	.section	.ctors, aw, @progbits
+	.align 4
+	.global		__CTOR_LIST_END__
+	.hidden 	__CTOR_LIST_END__
+__CTOR_LIST_END__:
+	.long 0
+
+	.section	.dtors, aw, @progbits
+	.align 4
+	.long 0
+
+	.section	.eh_frame, a, @progbits
+	.align 4
+	.long 0
+
+	.section	.jcr, aw, @progbits
+	.align 4
+	.long 0



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

2012-01-28 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Jan 28 15:10:24 UTC 2012

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

Log Message:
Add new directories for trousers to sets lists.  The directories get
created even if they're not populated.

Hello again, christos!


To generate a diff of this commit:
cvs rdiff -u -r1.977 -r1.978 src/distrib/sets/lists/base/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/base/mi
diff -u src/distrib/sets/lists/base/mi:1.977 src/distrib/sets/lists/base/mi:1.978
--- src/distrib/sets/lists/base/mi:1.977	Tue Jan 17 18:53:22 2012
+++ src/distrib/sets/lists/base/mi	Sat Jan 28 15:10:24 2012
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.977 2012/01/17 18:53:22 joerg Exp $
+# $NetBSD: mi,v 1.978 2012/01/28 15:10:24 pgoyette Exp $
 #
 # Note:	Don't delete entries from here - mark them as obsolete instead,
 #	unless otherwise stated below.
@@ -898,6 +898,8 @@
 ./usr/include/ssbase-obsolete		obsolete
 ./usr/include/sspbase-c-usr
 ./usr/include/sysbase-c-usr
+./usr/include/trousersbase-c-usr
+./usr/include/tssbase-c-usr
 ./usr/include/ufsbase-c-usr
 ./usr/include/ufs/ext2fs			base-c-usr
 ./usr/include/ufs/ffsbase-c-usr
@@ -5005,6 +5007,7 @@
 ./var/spool/uucppublicbase-obsolete		obsolete
 ./var/tmp	base-sys-root
 ./var/tmp/vi.recoverbase-util-root
+./var/tpm	base-sys-root
 ./var/www	base-netutil-root
 ./var/yp	base-nis-root
 ./var/yp/bindingbase-nis-root



CVS commit: src/sys/uvm

2012-01-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jan 28 15:43:34 UTC 2012

Modified Files:
src/sys/uvm: uvm_page.c

Log Message:
Replace locking checks with uvm_page_locked_p.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/uvm/uvm_page.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/uvm/uvm_page.c
diff -u src/sys/uvm/uvm_page.c:1.179 src/sys/uvm/uvm_page.c:1.180
--- src/sys/uvm/uvm_page.c:1.179	Fri Jan 27 19:48:41 2012
+++ src/sys/uvm/uvm_page.c	Sat Jan 28 15:43:34 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.179 2012/01/27 19:48:41 para Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.180 2012/01/28 15:43:34 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_page.c,v 1.179 2012/01/27 19:48:41 para Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_page.c,v 1.180 2012/01/28 15:43:34 matt Exp $);
 
 #include opt_ddb.h
 #include opt_uvmhist.h
@@ -1623,11 +1623,7 @@ uvm_page_unbusy(struct vm_page **pgs, in
 			continue;
 		}
 
-		KASSERT(pg-uobject == NULL ||
-		mutex_owned(pg-uobject-vmobjlock));
-		KASSERT(pg-uobject != NULL ||
-		(pg-uanon != NULL  mutex_owned(pg-uanon-an_lock)));
-
+		KASSERT(uvm_page_locked_p(pg));
 		KASSERT(pg-flags  PG_BUSY);
 		KASSERT((pg-flags  PG_PAGEOUT) == 0);
 		if (pg-flags  PG_WANTED) {
@@ -1668,12 +1664,7 @@ uvm_page_own(struct vm_page *pg, const c
 
 	uobj = pg-uobject;
 	anon = pg-uanon;
-	if (uobj != NULL) {
-		KASSERT(mutex_owned(uobj-vmobjlock));
-	} else if (anon != NULL) {
-		KASSERT(mutex_owned(anon-an_lock));
-	}
-
+	KASSERT(uvm_page_locked_p(pg));
 	KASSERT((pg-flags  PG_WANTED) == 0);
 
 	/* gain ownership? */



CVS commit: src/crypto/external/cpl/tpm-tools/dist/man/man8

2012-01-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 28 16:03:46 UTC 2012

Modified Files:
src/crypto/external/cpl/tpm-tools/dist/man/man8: tpm_changeownerauth.8

Log Message:
remove stray .TP


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/crypto/external/cpl/tpm-tools/dist/man/man8/tpm_changeownerauth.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/external/cpl/tpm-tools/dist/man/man8/tpm_changeownerauth.8
diff -u src/crypto/external/cpl/tpm-tools/dist/man/man8/tpm_changeownerauth.8:1.1.1.1 src/crypto/external/cpl/tpm-tools/dist/man/man8/tpm_changeownerauth.8:1.2
--- src/crypto/external/cpl/tpm-tools/dist/man/man8/tpm_changeownerauth.8:1.1.1.1	Fri Jan 27 21:57:41 2012
+++ src/crypto/external/cpl/tpm-tools/dist/man/man8/tpm_changeownerauth.8	Sat Jan 28 11:03:46 2012
@@ -64,7 +64,6 @@ Change password to a new one when curren
 .TP
 \fB-r\fR, \fB\-\-set-well-known\fR
 Change password to a secret of all zeros (20 bytes of zeros). It must be specified which password (owner, SRK or both) to change
-.TP
 .SH SEE ALSO
 .PP
 \fBtpm_version\fR(1), \fBtpm_takeownership\fR(8), \fBtcsd\fR(8)



CVS commit: src/crypto/external/cpl/tpm-tools

2012-01-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 28 16:04:15 UTC 2012

Added Files:
src/crypto/external/cpl/tpm-tools: Makefile Makefile.inc
src/crypto/external/cpl/tpm-tools/bin: Makefile Makefile.inc
Makefile.prog
src/crypto/external/cpl/tpm-tools/bin/tpm_changeownerauth: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_clear: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_createek: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_getpubek: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_nvdefine: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_nvinfo: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_nvread: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_nvrelease: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_nvwrite: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_resetdalock: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_restrictpubek: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_restrictsrk: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_revokeek: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_sealdata: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_selftest: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_setactive: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_setclearable: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_setenable: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_setoperatorauth: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_setownable: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_setpresence: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_takeownership: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_unsealdata: Makefile
src/crypto/external/cpl/tpm-tools/bin/tpm_version: Makefile
src/crypto/external/cpl/tpm-tools/lib: Makefile Makefile.inc
src/crypto/external/cpl/tpm-tools/lib/libtpm_unseal: Makefile
src/crypto/external/cpl/tpm-tools/lib/libtpm_utils: Makefile

Log Message:
Add build glue: no pkcs11 yes.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/crypto/external/cpl/tpm-tools/Makefile \
src/crypto/external/cpl/tpm-tools/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/crypto/external/cpl/tpm-tools/bin/Makefile \
src/crypto/external/cpl/tpm-tools/bin/Makefile.inc \
src/crypto/external/cpl/tpm-tools/bin/Makefile.prog
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_changeownerauth/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_clear/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_createek/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_getpubek/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_nvdefine/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_nvinfo/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_nvread/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_nvrelease/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_nvwrite/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_resetdalock/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_restrictpubek/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_restrictsrk/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_revokeek/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_sealdata/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_selftest/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_setactive/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_setclearable/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_setenable/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_setoperatorauth/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_setownable/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_setpresence/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_takeownership/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_unsealdata/Makefile
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/bin/tpm_version/Makefile
cvs rdiff -u -r0 -r1.1 src/crypto/external/cpl/tpm-tools/lib/Makefile \
src/crypto/external/cpl/tpm-tools/lib/Makefile.inc
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/cpl/tpm-tools/lib/libtpm_unseal/Makefile
cvs rdiff -u -r0 -r1.1 \

CVS commit: src/crypto/external/cpl/tpm-tools/include

2012-01-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 28 16:05:20 UTC 2012

Added Files:
src/crypto/external/cpl/tpm-tools/include: config.h

Log Message:
Add configuration glue


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/crypto/external/cpl/tpm-tools/include/config.h

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

Added files:

Index: src/crypto/external/cpl/tpm-tools/include/config.h
diff -u /dev/null src/crypto/external/cpl/tpm-tools/include/config.h:1.1
--- /dev/null	Sat Jan 28 11:05:20 2012
+++ src/crypto/external/cpl/tpm-tools/include/config.h	Sat Jan 28 11:05:20 2012
@@ -0,0 +1,118 @@
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.in by autoheader.  */
+
+/* Define to 1 if translation of program messages to the user's native
+   language is requested. */
+/* #undef ENABLE_NLS */
+
+/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
+   CoreFoundation framework. */
+/* #undef HAVE_CFLOCALECOPYCURRENT */
+
+/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
+   the CoreFoundation framework. */
+/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */
+
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+   */
+/* #undef HAVE_DCGETTEXT */
+
+/* Define to 1 if you have the dlfcn.h header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define if the GNU gettext() function is already present or preinstalled. */
+/* #undef HAVE_GETTEXT */
+
+/* Define if you have the iconv() function. */
+#define HAVE_ICONV 1
+
+/* Define to 1 if you have the inttypes.h header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you support file names longer than 14 characters. */
+#define HAVE_LONG_FILE_NAMES 1
+
+/* Define to 1 if you have the memory.h header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the stdint.h header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the stdlib.h header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the strings.h header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the string.h header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the sys/stat.h header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the sys/types.h header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the unistd.h header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#define LT_OBJDIR .libs/
+
+/* Name of package */
+#define PACKAGE tpm-tools
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT trousers-t...@lists.sf.net
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME tpm-tools
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING tpm-tools 1.3.7
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME tpm-tools
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL 
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION 1.3.7
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#define RETSIGTYPE void
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION 1.3.7
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `int' if sys/types.h doesn't define. */
+/* #undef gid_t */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `int' if sys/types.h does not define. */
+/* #undef mode_t */
+
+/* Define to `long int' if sys/types.h does not define. */
+/* #undef off_t */
+
+/* Define to `int' if sys/types.h does not define. */
+/* #undef pid_t */
+
+/* Define to `unsigned int' if sys/types.h does not define. */
+/* #undef size_t */
+
+/* Define to `int' if sys/types.h doesn't define. */
+/* #undef uid_t */



CVS commit: src/sys/arch/arm/arm32

2012-01-28 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jan 28 16:16:41 UTC 2012

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Since we don't do MULTIPROCESSOR, and hence preemption, locking the pvlists
doesn't really matter.


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 src/sys/arch/arm/arm32/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/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.226 src/sys/arch/arm/arm32/pmap.c:1.227
--- src/sys/arch/arm/arm32/pmap.c:1.226	Sat Jan 28 00:11:46 2012
+++ src/sys/arch/arm/arm32/pmap.c	Sat Jan 28 16:16:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.226 2012/01/28 00:11:46 matt Exp $	*/
+/*	$NetBSD: pmap.c,v 1.227 2012/01/28 16:16:41 matt Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -211,7 +211,7 @@
 #include machine/param.h
 #include arm/arm32/katelib.h
 
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.226 2012/01/28 00:11:46 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.227 2012/01/28 16:16:41 matt Exp $);
 
 #ifdef PMAP_DEBUG
 
@@ -2843,7 +2843,9 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_
 			/*
 			 * We're changing the attrs of an existing mapping.
 			 */
+#ifdef MULTIPROCESSOR
 			KASSERT(uvm_page_locked_p(pg));
+#endif
 			oflags = pmap_modify_pv(md, pa, pm, va,
 			PVF_WRITE | PVF_EXEC | PVF_WIRED |
 			PVF_MOD | PVF_REF, nflags);
@@ -2873,7 +2875,9 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_
  * It is part of our managed memory so we
  * must remove it from the PV list
  */
+#ifdef MULTIPROCESSOR
 KASSERT(uvm_page_locked_p(opg));
+#endif
 pv = pmap_remove_pv(omd, opa, pm, va);
 pmap_vac_me_harder(omd, opa, pm, 0);
 oflags = pv-pv_flags;
@@ -2911,7 +2915,9 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_
 return (ENOMEM);
 			}
 
+#ifdef MULTIPROCESSOR
 			KASSERT(uvm_page_locked_p(pg));
+#endif
 			pmap_enter_pv(md, pa, pv, pm, va, nflags);
 		}
 	} else {
@@ -2941,7 +2947,9 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_
 			struct vm_page_md *omd = VM_PAGE_TO_MD(opg);
 			paddr_t opa = VM_PAGE_TO_PHYS(opg);
 
+#ifdef MULTIPROCESSOR
 			KASSERT(uvm_page_locked_p(opg));
+#endif
 			pv = pmap_remove_pv(omd, opa, pm, va);
 			pmap_vac_me_harder(omd, opa, pm, 0);
 			oflags = pv-pv_flags;
@@ -3024,7 +3032,9 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_
 		if (pg != NULL) {
 			struct vm_page_md *md = VM_PAGE_TO_MD(pg);
 
+#ifdef MULTIPROCESSOR
 			KASSERT(uvm_page_locked_p(pg));
+#endif
 			pmap_vac_me_harder(md, pa, pm, va);
 		}
 	}
@@ -3032,7 +3042,9 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_
 	if (pg) {
 		struct vm_page_md *md = VM_PAGE_TO_MD(pg);
 
+#ifdef MULTIPROCESSOR
 		KASSERT(uvm_page_locked_p(pg));
+#endif
 		KASSERT((md-pvh_attrs  PVF_DMOD) == 0 || (md-pvh_attrs  (PVF_DIRTY|PVF_NC)));
 		KASSERT(((md-pvh_attrs  PVF_WRITE) == 0) == (md-urw_mappings + md-krw_mappings == 0));
 	}
@@ -3136,7 +3148,9 @@ pmap_remove(pmap_t pm, vaddr_t sva, vadd
 struct vm_page_md *md = VM_PAGE_TO_MD(pg);
 struct pv_entry *pv;
 
+#ifdef MULTIPROCESSOR
 KASSERT(uvm_page_locked_p(pg));
+#endif
 pv = pmap_remove_pv(md, pa, pm, sva);
 pmap_vac_me_harder(md, pa, pm, 0);
 if (pv != NULL) {
@@ -3261,7 +3275,6 @@ pmap_kremove_pg(struct vm_page *pg, vadd
 	paddr_t pa = VM_PAGE_TO_PHYS(pg);
 	struct pv_entry *pv;
 
-	KASSERT(uvm_page_locked_p(pg));
 	KASSERT(arm_cache_prefer_mask == 0 || md-pvh_attrs  (PVF_COLORED|PVF_NC));
 	KASSERT((md-pvh_attrs  PVF_KMPAGE) == 0);
 
@@ -3334,7 +3347,6 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v
 			KASSERT(opg != pg);
 			KASSERT((omd-pvh_attrs  PVF_KMPAGE) == 0);
 			KASSERT((flags  PMAP_KMPAGE) == 0);
-			KASSERT(uvm_page_locked_p(opg));
 			pv = pmap_kremove_pg(opg, va);
 		}
 #endif
@@ -3352,7 +3364,9 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v
 	PTE_SYNC(ptep);
 
 	if (pg) {
+#ifdef MULTIPROCESSOR
 		KASSERT(uvm_page_locked_p(pg));
+#endif
 		if (flags  PMAP_KMPAGE) {
 			KASSERT(md-urw_mappings == 0);
 			KASSERT(md-uro_mappings == 0);
@@ -3439,7 +3453,6 @@ pmap_kremove(vaddr_t va, vsize_t len)
 			opte = *ptep;
 			opg = PHYS_TO_VM_PAGE(l2pte_pa(opte));
 			if (opg) {
-KASSERT(uvm_page_locked_p(opg));
 struct vm_page_md *omd = VM_PAGE_TO_MD(opg);
 
 if (omd-pvh_attrs  PVF_KMPAGE) {
@@ -3610,7 +3623,9 @@ pmap_protect(pmap_t pm, vaddr_t sva, vad
 	struct vm_page_md *md = VM_PAGE_TO_MD(pg);
 	paddr_t pa = VM_PAGE_TO_PHYS(pg);
 
+#ifdef MULTIPROCESSOR
 	KASSERT(uvm_page_locked_p(pg));
+#endif
 	f = pmap_modify_pv(md, pa, pm, sva,
 	clr_mask, 0);
 	pmap_vac_me_harder(md, pa, pm, sva);
@@ -3693,7 +3708,9 @@ pmap_page_protect(struct vm_page *pg, vm
 	printf(pmap_page_protect: md %p (0x%08lx), prot 0x%x\n,
 	md, pa, prot));
 
+#ifdef MULTIPROCESSOR
 	KASSERT(uvm_page_locked_p(pg));
+#endif
 
 	switch(prot) {
 	case VM_PROT_READ|VM_PROT_WRITE:
@@ -3731,7 +3748,9 @@ 

CVS commit: src/sys/fs/hfs

2012-01-28 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Jan 28 16:24:35 UTC 2012

Modified Files:
src/sys/fs/hfs: hfs.h

Log Message:
Include sys/malloc.h for MALLOC_DECLARE.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/fs/hfs/hfs.h

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

Modified files:

Index: src/sys/fs/hfs/hfs.h
diff -u src/sys/fs/hfs/hfs.h:1.7 src/sys/fs/hfs/hfs.h:1.8
--- src/sys/fs/hfs/hfs.h:1.7	Wed Sep  3 22:57:46 2008
+++ src/sys/fs/hfs/hfs.h	Sat Jan 28 16:24:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: hfs.h,v 1.7 2008/09/03 22:57:46 gmcgarry Exp $	*/
+/*	$NetBSD: hfs.h,v 1.8 2012/01/28 16:24:35 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@@ -118,6 +118,7 @@ typedef struct {
 } hfs_libcb_argsread;
 
 #ifdef _KERNEL
+#include sys/malloc.h
 
 MALLOC_DECLARE(M_HFSMNT);	/* defined in hfs_vfsops.c */
 



CVS commit: src/sys/arch

2012-01-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 28 16:30:23 UTC 2012

Modified Files:
src/sys/arch/alpha/alpha: vm_machdep.c
src/sys/arch/powerpc/powerpc: vm_machdep.c

Log Message:
Typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/alpha/alpha/vm_machdep.c
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/powerpc/powerpc/vm_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/alpha/alpha/vm_machdep.c
diff -u src/sys/arch/alpha/alpha/vm_machdep.c:1.109 src/sys/arch/alpha/alpha/vm_machdep.c:1.110
--- src/sys/arch/alpha/alpha/vm_machdep.c:1.109	Sat Jan 21 21:50:24 2012
+++ src/sys/arch/alpha/alpha/vm_machdep.c	Sat Jan 28 16:30:23 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_machdep.c,v 1.109 2012/01/21 21:50:24 matt Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.110 2012/01/28 16:30:23 skrll Exp $ */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: vm_machdep.c,v 1.109 2012/01/21 21:50:24 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: vm_machdep.c,v 1.110 2012/01/28 16:30:23 skrll Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -276,7 +276,7 @@ cpu_uarea_free(void *vva)
 		return false;
 
 	/*
-	 * Since the pages are physically contiguous, the vm_page structurs
+	 * Since the pages are physically contiguous, the vm_page structure
 	 * will be as well.
 	 */
 	struct vm_page *pg = PHYS_TO_VM_PAGE(PMAP_UNMAP_POOLPAGE(va));

Index: src/sys/arch/powerpc/powerpc/vm_machdep.c
diff -u src/sys/arch/powerpc/powerpc/vm_machdep.c:1.92 src/sys/arch/powerpc/powerpc/vm_machdep.c:1.93
--- src/sys/arch/powerpc/powerpc/vm_machdep.c:1.92	Sat Jul  2 01:26:29 2011
+++ src/sys/arch/powerpc/powerpc/vm_machdep.c	Sat Jan 28 16:30:23 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.92 2011/07/02 01:26:29 matt Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.93 2012/01/28 16:30:23 skrll Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vm_machdep.c,v 1.92 2011/07/02 01:26:29 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: vm_machdep.c,v 1.93 2012/01/28 16:30:23 skrll Exp $);
 
 #include opt_altivec.h
 #include opt_multiprocessor.h
@@ -331,7 +331,7 @@ cpu_uarea_free(void *vva)
 		return false;
 
 	/*
-	 * Since the pages are physically contiguous, the vm_page structurs
+	 * Since the pages are physically contiguous, the vm_page structure
 	 * will be as well.
 	 */
 	struct vm_page *pg = PHYS_TO_VM_PAGE(PMAP_UNMAP_POOLPAGE(va));



CVS commit: src/sys/kern

2012-01-28 Thread Lars Heidieker
Module Name:src
Committed By:   para
Date:   Sat Jan 28 18:02:56 UTC 2012

Modified Files:
src/sys/kern: vfs_wapbl.c

Log Message:
replacing malloc(9) with kmem(9)
wapbl_entries get there own pool, they are freed from softint context

ok: rmind@


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/kern/vfs_wapbl.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/kern/vfs_wapbl.c
diff -u src/sys/kern/vfs_wapbl.c:1.50 src/sys/kern/vfs_wapbl.c:1.51
--- src/sys/kern/vfs_wapbl.c:1.50	Fri Jan 27 19:48:40 2012
+++ src/sys/kern/vfs_wapbl.c	Sat Jan 28 18:02:56 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_wapbl.c,v 1.50 2012/01/27 19:48:40 para Exp $	*/
+/*	$NetBSD: vfs_wapbl.c,v 1.51 2012/01/28 18:02:56 para Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #define WAPBL_INTERNAL
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_wapbl.c,v 1.50 2012/01/27 19:48:40 para Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_wapbl.c,v 1.51 2012/01/28 18:02:56 para Exp $);
 
 #include sys/param.h
 #include sys/bitops.h
@@ -49,7 +49,6 @@ __KERNEL_RCSID(0, $NetBSD: vfs_wapbl.c,
 #include sys/uio.h
 #include sys/vnode.h
 #include sys/file.h
-#include sys/malloc.h
 #include sys/module.h
 #include sys/resourcevar.h
 #include sys/conf.h
@@ -63,16 +62,9 @@ __KERNEL_RCSID(0, $NetBSD: vfs_wapbl.c,
 
 #include miscfs/specfs/specdev.h
 
-#if 0 /* notyet */
-#define	wapbl_malloc(s) kmem_intr_alloc((s), KM_SLEEP)
-#define	wapbl_free(a, s) kmem_intr_free((a), (s))
-#define	wapbl_calloc(n, s) kmem_intr_zalloc((n)*(s), KM_SLEEP)
-#else
-MALLOC_JUSTDEFINE(M_WAPBL, wapbl, write-ahead physical block logging);
-#define	wapbl_malloc(s) malloc((s), M_WAPBL, M_WAITOK)
-#define	wapbl_free(a, s) free((a), M_WAPBL)
-#define	wapbl_calloc(n, s) malloc((n)*(s), M_WAPBL, M_WAITOK | M_ZERO)
-#endif
+#define	wapbl_alloc(s) kmem_alloc((s), KM_SLEEP)
+#define	wapbl_free(a, s) kmem_free((a), (s))
+#define	wapbl_calloc(n, s) kmem_zalloc((n)*(s), KM_SLEEP)
 
 static struct sysctllog *wapbl_sysctl;
 static int wapbl_flush_disk_cache = 1;
@@ -92,7 +84,7 @@ static int wapbl_verbose_commit = 0;
 
 #define	KDASSERT(x) assert(x)
 #define	KASSERT(x) assert(x)
-#define	wapbl_malloc(s) malloc(s)
+#define	wapbl_alloc(s) malloc(s)
 #define	wapbl_free(a, s) free(a)
 #define	wapbl_calloc(n, s) calloc((n), (s))
 
@@ -220,6 +212,8 @@ static inline size_t wapbl_space_used(si
 
 #ifdef _KERNEL
 
+static struct pool wapbl_entry_pool;
+
 #define	WAPBL_INODETRK_SIZE 83
 static int wapbl_ino_pool_refcount;
 static struct pool wapbl_ino_pool;
@@ -310,7 +304,10 @@ wapbl_sysctl_init(void)
 static void
 wapbl_init(void)
 {
-	//malloc_type_attach(M_WAPBL);
+
+	pool_init(wapbl_entry_pool, sizeof(struct wapbl_entry), 0, 0, 0,
+	wapblentrypl, pool_allocator_kmem, IPL_VM);
+
 	wapbl_sysctl_init();
 }
 
@@ -318,8 +315,12 @@ wapbl_init(void)
 static int
 wapbl_fini(bool interface)
 {
+
 	if (aio_sysctl != NULL)
 		 sysctl_teardown(aio_sysctl);
+
+	pool_destroy(wapbl_entry_pool);
+
 	return 0;
 }
 #endif
@@ -483,9 +484,9 @@ wapbl_start(struct wapbl ** wlp, struct 
 	/* XXX tie this into resource estimation */
 	wl-wl_dealloclim = wl-wl_bufbytes_max / mp-mnt_stat.f_bsize / 2;
 	
-	wl-wl_deallocblks = wapbl_malloc(sizeof(*wl-wl_deallocblks) *
+	wl-wl_deallocblks = wapbl_alloc(sizeof(*wl-wl_deallocblks) *
 	wl-wl_dealloclim);
-	wl-wl_dealloclens = wapbl_malloc(sizeof(*wl-wl_dealloclens) *
+	wl-wl_dealloclens = wapbl_alloc(sizeof(*wl-wl_dealloclens) *
 	wl-wl_dealloclim);
 
 	wapbl_inodetrk_init(wl, WAPBL_INODETRK_SIZE);
@@ -503,7 +504,7 @@ wapbl_start(struct wapbl ** wlp, struct 
 		wc-wc_log_dev_bshift = wl-wl_log_dev_bshift;
 		wc-wc_fs_dev_bshift = wl-wl_fs_dev_bshift;
 		wl-wl_wc_header = wc;
-		wl-wl_wc_scratch = wapbl_malloc(len);
+		wl-wl_wc_scratch = wapbl_alloc(len);
 	}
 
 	/*
@@ -657,7 +658,7 @@ wapbl_discard(struct wapbl *wl)
 #ifdef WAPBL_DEBUG_BUFBYTES
 			KASSERT(we-we_unsynced_bufbytes == 0);
 #endif
-			wapbl_free(we, sizeof(*we));
+			pool_put(wapbl_entry_pool, we);
 		}
 	}
 
@@ -1239,7 +1240,7 @@ wapbl_biodone(struct buf *bp)
 #ifdef WAPBL_DEBUG_BUFBYTES
 			KASSERT(we-we_unsynced_bufbytes == 0);
 #endif
-			wapbl_free(we, sizeof(*we));
+			pool_put(wapbl_entry_pool, we);
 		}
 
 		brelse(bp, 0);
@@ -1331,7 +1332,7 @@ wapbl_biodone(struct buf *bp)
 			if (we-we_error)
 errcnt++;
 			SIMPLEQ_REMOVE_HEAD(wl-wl_entries, we_entries);
-			wapbl_free(we, sizeof(*we));
+			pool_put(wapbl_entry_pool, we);
 		}
 
 		if (delta) {
@@ -1472,7 +1473,7 @@ wapbl_flush(struct wapbl *wl, int waitfo
 	if (error)
 		goto out2;
 
-	we = wapbl_calloc(1, sizeof(*we));
+	we = pool_get(wapbl_entry_pool, PR_WAITOK);
 
 #ifdef WAPBL_DEBUG_BUFBYTES
 	WAPBL_PRINTF(WAPBL_PRINT_FLUSH,
@@ -2093,7 +2094,7 @@ wapbl_write_blocks(struct wapbl *wl, off
 		if (padding) {
 			void *zero;
 			
-			zero = wapbl_malloc(padding);
+	

CVS commit: src/sys/uvm

2012-01-28 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sat Jan 28 19:12:10 UTC 2012

Modified Files:
src/sys/uvm: uvm_page.h

Log Message:
Improve description on struct vm_page and explain locking a little bit more.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/uvm/uvm_page.h

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

Modified files:

Index: src/sys/uvm/uvm_page.h
diff -u src/sys/uvm/uvm_page.h:1.73 src/sys/uvm/uvm_page.h:1.74
--- src/sys/uvm/uvm_page.h:1.73	Sun Jun 12 03:36:03 2011
+++ src/sys/uvm/uvm_page.h	Sat Jan 28 19:12:10 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.h,v 1.73 2011/06/12 03:36:03 rmind Exp $	*/
+/*	$NetBSD: uvm_page.h,v 1.74 2012/01/28 19:12:10 rmind Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -64,83 +64,76 @@
 #ifndef _UVM_UVM_PAGE_H_
 #define _UVM_UVM_PAGE_H_
 
-/*
- * uvm_page.h
- */
+#include uvm/uvm_extern.h
+#include uvm/uvm_pglist.h
 
-/*
- *	Resident memory system definitions.
- */
+#include sys/rbtree.h
 
 /*
- *	Management of resident (logical) pages.
- *
- *	A small structure is kept for each resident
- *	page, indexed by page number.  Each structure
- *	is an element of several lists:
- *
- *		A red-black tree rooted with the containing
- *		object is used to quickly perform object+
- *		offset lookups
- *
- *		A list of all pages for a given object,
- *		so they can be quickly deactivated at
- *		time of deallocation.
+ * Management of resident (logical) pages.
  *
- *		An ordered list of pages due for pageout.
+ * Each resident page has a vm_page structure, indexed by page number.
+ * There are several lists in the structure:
  *
- *	In addition, the structure contains the object
- *	and offset to which this page belongs (for pageout),
- *	and sundry status bits.
+ * - A red-black tree rooted with the containing object is used to
+ *   quickly perform object+offset lookups.
+ * - A list of all pages for a given object, for a quick deactivation
+ *   at a time of deallocation.
+ * - An ordered list of pages due for pageout.
+ *
+ * In addition, the structure contains the object and offset to which
+ * this page belongs (for pageout) and sundry status bits.
+ *
+ * Note that the page structure has no lock of its own.  The page is
+ * generally protected by its owner's lock (UVM object or amap/anon).
+ * It should be noted that UVM has to serialize pmap(9) operations on
+ * the managed pages, e.g. for pmap_enter() calls.  Hence, the lock
+ * order is as follows:
+ *
+ *	[vmpage-owner-lock] -
+ *		any pmap locks (e.g. PV hash lock)
+ *
+ * Since the kernel is always self-consistent, no serialization is
+ * required for unmanaged mappings, e.g. for pmap_kenter_pa() calls.
+ *
+ * Field markings and the corresponding locks:
+ *
+ * o:	page owner's lock (UVM object or amap/anon)
+ * p:	lock on the page queues
+ * o|p:	either lock can be acquired
+ * op:	both locks are required
+ * ?:	locked by pmap or assumed page owner's lock
  *
- *	Fields in this structure are locked either by the lock on the
- *	object that the page belongs to (O) or by the lock on the page
- *	queues (P) [or both].
+ * UVM and pmap(9) may use uvm_page_locked_p() to assert whether the
+ * page owner's lock is acquired.
  */
 
-/*
- * locking note: the mach version of this data structure had bit
- * fields for the flags, and the bit fields were divided into two
- * items (depending on who locked what).  some time, in BSD, the bit
- * fields were dumped and all the flags were lumped into one short.
- * that is fine for a single threaded uniprocessor OS, but bad if you
- * want to actual make use of locking.  so, we've separated things
- * back out again.
- *
- * note the page structure has no lock of its own.
- */
-
-#include uvm/uvm_extern.h
-#include uvm/uvm_pglist.h
-
-#include sys/rbtree.h
-
 struct vm_page {
-	struct rb_node		rb_node;	/* tree of pages in obj (O) */
+	struct rb_node		rb_node;	/* o: tree of pages in obj */
 
 	union {
 		TAILQ_ENTRY(vm_page) queue;
 		LIST_ENTRY(vm_page) list;
-	} pageq;/* queue info for FIFO
-		 * queue or free list (P) */
+	} pageq;/* p: queue info for FIFO
+		 * queue or free list */
 	union {
 		TAILQ_ENTRY(vm_page) queue;
 		LIST_ENTRY(vm_page) list;
-	} listq;/* pages in same object (O)*/
+	} listq;/* o: pages in same object */
 
-	struct vm_anon		*uanon;		/* anon (O,P) */
-	struct uvm_object	*uobject;	/* object (O,P) */
-	voff_t			offset;		/* offset into object (O,P) */
-	uint16_t		flags;		/* object flags [O] */
+	struct vm_anon		*uanon;		/* o,p: anon */
+	struct uvm_object	*uobject;	/* o,p: object */
+	voff_t			offset;		/* o,p: offset into object */
+	uint16_t		flags;		/* o: object flags */
 	uint16_t		loan_count;	/* number of active loans
-		 * to read: [O or P]
-		 * to modify: [O _and_ P] */
-	uint16_t		wire_count;	/* wired down map refs [P] */
-	uint16_t		pqflags;	/* page queue flags 

CVS commit: src/doc

2012-01-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 28 19:43:48 UTC 2012

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
document tpm-tools


To generate a diff of this commit:
cvs rdiff -u -r1.901 -r1.902 src/doc/3RDPARTY
cvs rdiff -u -r1.1656 -r1.1657 src/doc/CHANGES

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.901 src/doc/3RDPARTY:1.902
--- src/doc/3RDPARTY:1.901	Fri Jan 27 21:21:22 2012
+++ src/doc/3RDPARTY	Sat Jan 28 14:43:47 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.901 2012/01/28 02:21:22 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.902 2012/01/28 19:43:47 christos Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1260,3 +1260,15 @@ Responsible:	christos
 License:	CPL
 Notes:
 		Need to feed back local changes
+
+Package:	tpm-tools
+Version:	1.3.7.1
+Current Vers:	1.3.7.1
+Maintainer:	http://trousers.sourceforge.net
+Archive Site:	http://trousers.sourceforge.net
+Home Page:	http://trousers.sourceforge.net
+Mailing List:	http://trousers.sourceforge.net
+Responsible:	christos
+License:	CPL
+Notes:
+		Need to feed back local changes

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1656 src/doc/CHANGES:1.1657
--- src/doc/CHANGES:1.1656	Fri Jan 27 21:21:23 2012
+++ src/doc/CHANGES	Sat Jan 28 14:43:47 2012
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1656 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1657 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -1215,3 +1215,4 @@ Changes from NetBSD 5.0 to NetBSD 6.0:
 	dhcpcd(8): Import dhcpcd-5.5.0 [roy 20120125]
 	x86: Stop building boot ROM images for old NICs. [jnemeth 20120127]
 	TrouSerS: Import trousers-0.3.8 [christos 20120127]
+	tpm-tools: Import tpm-tools-1.3.7.1 [christos 20120128]



CVS commit: src/doc

2012-01-28 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sat Jan 28 19:49:33 UTC 2012

Modified Files:
src/doc: CHANGES

Log Message:
Mention direct map for amd64, UVM/kmem/vmem improvements and ltsleep() removal.


To generate a diff of this commit:
cvs rdiff -u -r1.1657 -r1.1658 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1657 src/doc/CHANGES:1.1658
--- src/doc/CHANGES:1.1657	Sat Jan 28 19:43:47 2012
+++ src/doc/CHANGES	Sat Jan 28 19:49:33 2012
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1657 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1658 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -1198,6 +1198,8 @@ Changes from NetBSD 5.0 to NetBSD 6.0:
 	sandpoint: Iomega Storcenter support. [phx 20111228]
 	fincore(1): Add a utility to query file cache. [yamt 20120104]
 	tprof(8), tpfmt(1): Add a sampling-based profiler. [yamt 20120104]
+	amd64: Add direct map support (mapping of all physical memory
+		using large pages). [chs 20111204]
 	adventure(6): New save file format. Please regenerate (restore
 		and re-save) any old save files. [dholland 20120107]
 	x86, xen: Add cpu ucode loading support via cpuctl(8). [cegger 20120113]
@@ -1214,5 +1216,8 @@ Changes from NetBSD 5.0 to NetBSD 6.0:
 		[macallan 20120123]
 	dhcpcd(8): Import dhcpcd-5.5.0 [roy 20120125]
 	x86: Stop building boot ROM images for old NICs. [jnemeth 20120127]
+	kernel: Major improvements to uvm_map(9), uvm_km(9), kmem(9)
+		and vmem(9) layers. [para 20120127]
+	kernel: Remove ltsleep(9) and wakeup_one(9). [rmind 20120128]
 	TrouSerS: Import trousers-0.3.8 [christos 20120127]
 	tpm-tools: Import tpm-tools-1.3.7.1 [christos 20120128]



CVS commit: src/share/mk

2012-01-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 28 21:32:14 UTC 2012

Modified Files:
src/share/mk: bsd.README bsd.lib.mk bsd.sys.mk

Log Message:
Provide a way to override the default objcopy flags for library modules.


To generate a diff of this commit:
cvs rdiff -u -r1.290 -r1.291 src/share/mk/bsd.README
cvs rdiff -u -r1.318 -r1.319 src/share/mk/bsd.lib.mk
cvs rdiff -u -r1.210 -r1.211 src/share/mk/bsd.sys.mk

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

Modified files:

Index: src/share/mk/bsd.README
diff -u src/share/mk/bsd.README:1.290 src/share/mk/bsd.README:1.291
--- src/share/mk/bsd.README:1.290	Sat Nov  5 18:56:30 2011
+++ src/share/mk/bsd.README	Sat Jan 28 16:32:13 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.README,v 1.290 2011/11/05 22:56:30 christos Exp $
+#	$NetBSD: bsd.README,v 1.291 2012/01/28 21:32:13 christos Exp $
 #	@(#)bsd.README	8.2 (Berkeley) 4/2/94
 
 This is the README file for the make include files for the NetBSD
@@ -1731,6 +1731,9 @@ OBJCFLAGS	Options to ${OBJC}.  [${CFLAGS
 
 OBJCOPY		Copy and translate object files.  [objcopy]
 
+OBJCOPYLIBFLAGS	Flags to pass to objcopy when library objects are
+		being built. [${.TARGET} =~ *.po ? -X : -x]
+
 OBJDUMP		Display information from object files.  [objdump]
 
 RANLIB		Generate index to archive.  [ranlib]

Index: src/share/mk/bsd.lib.mk
diff -u src/share/mk/bsd.lib.mk:1.318 src/share/mk/bsd.lib.mk:1.319
--- src/share/mk/bsd.lib.mk:1.318	Fri Oct  7 05:15:22 2011
+++ src/share/mk/bsd.lib.mk	Sat Jan 28 16:32:14 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.lib.mk,v 1.318 2011/10/07 09:15:22 mrg Exp $
+#	$NetBSD: bsd.lib.mk,v 1.319 2012/01/28 21:32:14 christos Exp $
 #	@(#)bsd.lib.mk	8.3 (Berkeley) 4/22/94
 
 .include bsd.init.mk
@@ -214,7 +214,7 @@ CTFFLAGS+=	-g
 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .endif
 .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
-	${OBJCOPY} -x ${.TARGET}
+	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
 .endif
 
 .c.po:
@@ -224,7 +224,7 @@ CTFFLAGS+=	-g
 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .endif
 .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
-	${OBJCOPY} -X ${.TARGET}
+	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
 .endif
 
 .c.go:
@@ -235,21 +235,21 @@ CTFFLAGS+=	-g
 	${_MKTARGET_COMPILE}
 	${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
 .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
-	${OBJCOPY} -x ${.TARGET}
+	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
 .endif
 
 .cc.o .cpp.o .cxx.o .C.o:
 	${_MKTARGET_COMPILE}
 	${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
 .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
-	${OBJCOPY} -x ${.TARGET}
+	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
 .endif
 
 .cc.po .cpp.po .cxx.po .C.po:
 	${_MKTARGET_COMPILE}
 	${COMPILE.cc} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
 .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
-	${OBJCOPY} -X ${.TARGET}
+	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
 .endif
 
 .cc.go .cpp.go .cxx.go .C.go:
@@ -260,7 +260,7 @@ CTFFLAGS+=	-g
 	${_MKTARGET_COMPILE}
 	${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
 .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
-	${OBJCOPY} -x ${.TARGET}
+	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
 .endif
 
 .f.o:
@@ -270,7 +270,7 @@ CTFFLAGS+=	-g
 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .endif
 .if !defined(FOPTS) || empty(FOPTS:M*-g*)
-	${OBJCOPY} -x ${.TARGET}
+	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
 .endif
 
 .f.po:
@@ -280,7 +280,7 @@ CTFFLAGS+=	-g
 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .endif
 .if !defined(FOPTS) || empty(FOPTS:M*-g*)
-	${OBJCOPY} -X ${.TARGET}
+	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
 .endif
 
 .f.go:
@@ -291,7 +291,7 @@ CTFFLAGS+=	-g
 	${_MKTARGET_COMPILE}
 	${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
 .if !defined(FOPTS) || empty(FOPTS:M*-g*)
-	${OBJCOPY} -x ${.TARGET}
+	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
 .endif
 
 .f.ln:
@@ -305,7 +305,7 @@ CTFFLAGS+=	-g
 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .endif
 .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
-	${OBJCOPY} -x ${.TARGET}
+	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
 .endif
 
 .m.po:
@@ -315,21 +315,21 @@ CTFFLAGS+=	-g
 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .endif
 .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
-	${OBJCOPY} -X ${.TARGET}
+	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
 .endif
 
 .m.go:
 	${_MKTARGET_COMPILE}
 	${COMPILE.m} ${DEBUGFLAGS} -g ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
 .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
-	${OBJCOPY} -X ${.TARGET}
+	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
 .endif
 
 .m.pico:
 	${_MKTARGET_COMPILE}
 	${COMPILE.m} ${CSHLIBFLAGS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
 .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
-	${OBJCOPY} -x ${.TARGET}
+	

CVS commit: src/lib/libpam/modules

2012-01-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 28 21:34:22 UTC 2012

Modified Files:
src/lib/libpam/modules: mod.mk

Log Message:
Use -X so that the link-set symbols are not stripped.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libpam/modules/mod.mk

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

Modified files:

Index: src/lib/libpam/modules/mod.mk
diff -u src/lib/libpam/modules/mod.mk:1.9 src/lib/libpam/modules/mod.mk:1.10
--- src/lib/libpam/modules/mod.mk:1.9	Mon May  3 18:12:32 2010
+++ src/lib/libpam/modules/mod.mk	Sat Jan 28 16:34:22 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: mod.mk,v 1.9 2010/05/03 22:12:32 christos Exp $
+#	$NetBSD: mod.mk,v 1.10 2012/01/28 21:34:22 christos Exp $
 
 NOLINT=		# don't build a lint library
 NOPROFILE=	# don't build a profile library
@@ -23,6 +23,9 @@ libinstall:: ${DESTDIR}${LIBDIR}/${LIB}.
 libinstall::
 .endif
 
+# Don't use -x because strips link_set symbols (which are local)
+OBJCOPYLIBFLAGS=-X
+
 .include bsd.lib.mk
 
 ${DESTDIR}${LIBDIR}/${LIB}.so.${SHLIB_MAJOR}: lib${LIB}.so.${SHLIB_FULLVERSION}



CVS commit: src/distrib/notes/sandpoint

2012-01-28 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sat Jan 28 21:48:01 UTC 2012

Modified Files:
src/distrib/notes/sandpoint: prep

Log Message:
Use MAX3232 instead of MAX232 for the serial converter.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/distrib/notes/sandpoint/prep

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/sandpoint/prep
diff -u src/distrib/notes/sandpoint/prep:1.7 src/distrib/notes/sandpoint/prep:1.8
--- src/distrib/notes/sandpoint/prep:1.7	Thu Feb  3 21:04:52 2011
+++ src/distrib/notes/sandpoint/prep	Sat Jan 28 21:48:00 2012
@@ -1,12 +1,12 @@
-.\	$NetBSD: prep,v 1.7 2011/02/03 21:04:52 phx Exp $
+.\	$NetBSD: prep,v 1.8 2012/01/28 21:48:00 phx Exp $
 .
 To install
 .Nx \*V
-on your 824x based NAS system you need to get access to its serial console.
+on your 824x based NAS system you need to get access to the serial console.
 This requires to open the case, locate the serial header on the main board
 and attach a (usually
-.Tn MAX232
-based) RS/232 cable to it, which you will
+.Tn MAX3232
+based) 3.3V TTL level to RS/232 converter to it, which you will
 connect to a terminal.
 The procedure how to build such a cable for your NAS system is not
 part of this documentation. Please refer to



CVS commit: src/distrib/notes/sandpoint

2012-01-28 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sat Jan 28 21:48:32 UTC 2012

Modified Files:
src/distrib/notes/sandpoint: hardware

Log Message:
Update list of supported NAS products.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/distrib/notes/sandpoint/hardware

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/sandpoint/hardware
diff -u src/distrib/notes/sandpoint/hardware:1.11 src/distrib/notes/sandpoint/hardware:1.12
--- src/distrib/notes/sandpoint/hardware:1.11	Thu Feb  3 21:04:52 2011
+++ src/distrib/notes/sandpoint/hardware	Sat Jan 28 21:48:32 2012
@@ -1,4 +1,4 @@
-.\$NetBSD: hardware,v 1.11 2011/02/03 21:04:52 phx Exp $
+.\$NetBSD: hardware,v 1.12 2012/01/28 21:48:32 phx Exp $
 .
 .Nx*M
 is a port based on Motorola's
@@ -20,7 +20,16 @@ evaluation boards are still supported.
 The listed models of the following vendors are supported (installed NIC
 and disk device in brackets):
 .(tag 8n
-.It Em KuroBox, Buffalo
+.It Em Allnet
+.Pp
+.(bullet -compact
+.Pq Em re/iteide
+6250
+.It
+.Pq Em re/satalink
+6260
+.bullet)
+.It Em Buffalo, KuroBox
 .Pp
 .(bullet -compact
 .Pq Em tlp/cmdide
@@ -32,15 +41,78 @@ KuroBox HG
 .Pq Em re/iteide
 Gigabit LinkStation HD-HGLAN
 .It
-.Pq Em sk/iteide
-LinkStation LANxxxG
-.It
 .Pq Em re/iteide
 Classic TeraStation HD-HTGL
 .It
 .Pq Em re/satalink
 TeraStation Pro TS-TGL v1
 .bullet)
+.It Em Conceptronic
+.Pp
+.(bullet -compact
+.Pq Em stge/acardide
+CH3WNAS
+.bullet)
+.It Em D-Link
+.Pp
+.(bullet -compact
+.Pq Em stge/acardide
+DSM-G600 Rev.B
+.bullet)
+.It Em Encore
+.Pp
+.(bullet -compact
+.Pq Em re/iteide
+ENNHD-1000
+.bullet)
+.It Em Fujitsu-Siemens
+.Pp
+.(bullet -compact
+.Pq Em re/satalink
+AMS150, SBLAN2
+.bullet)
+.It Em Iomega
+.Pp
+.(bullet -compact
+.Pq Em re/viaide
+StorCenter G2
+.bullet)
+.It Em LevelOne
+.Pp
+.(bullet -compact
+.Pq Em re/satalink
+FNS-5000B
+.bullet)
+.It Em Longshine
+.Pp
+.(bullet -compact
+.Pq Em re/satalink
+LCS-8311
+.bullet)
+.It Em Netronix
+.Pp
+.(bullet -compact
+.Pq Em re/iteide
+NH-230
+.It
+.Pq Em re/satalink
+NH-231
+.bullet)
+.It Em Planex
+.Pp
+.(bullet -compact
+.Pq Em re/iteide
+NAS-01G
+.bullet)
+.It Em Qnap
+.Pp
+.(bullet -compact
+.Pq Em wm/satalink
+TS-100, TS-101(V1.02)
+.It
+.Pq Em re/satalink
+TS-101(V200), TS-201
+.bullet)
 .It Em Synology
 .Pp
 .(bullet -compact
@@ -54,21 +126,6 @@ DS-109j, DS-209j
 .Pq Em sk/satalink
 CS-406, RS-406, CS-406e, CS-407e
 .bullet)
-.It Em QNAP
-.Pp
-.(bullet -compact
-.Pq Em wm/satalink
-TS-100
-.It
-.Pq Em wm/satalink
-TS-101, TS-201
-.bullet)
-.It Em iomega
-.Pp
-.(bullet -compact
-.Pq Em re/viaide
-StorCenter XXX
-.bullet)
 .tag)
 .
 .Ss2 824x NAS supported boot devices and media



CVS commit: src/external/bsd/openpam/dist/include/security

2012-01-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 28 21:52:14 UTC 2012

Modified Files:
src/external/bsd/openpam/dist/include/security: openpam.h

Log Message:
fix the link_set name.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/bsd/openpam/dist/include/security/openpam.h

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

Modified files:

Index: src/external/bsd/openpam/dist/include/security/openpam.h
diff -u src/external/bsd/openpam/dist/include/security/openpam.h:1.3 src/external/bsd/openpam/dist/include/security/openpam.h:1.4
--- src/external/bsd/openpam/dist/include/security/openpam.h:1.3	Sun Dec 25 18:18:56 2011
+++ src/external/bsd/openpam/dist/include/security/openpam.h	Sat Jan 28 16:52:14 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: openpam.h,v 1.3 2011/12/25 23:18:56 christos Exp $	*/
+/*	$NetBSD: openpam.h,v 1.4 2012/01/28 21:52:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002-2003 Networks Associates Technology, Inc.
@@ -346,7 +346,7 @@ struct pam_module {
 			[PAM_SM_CHAUTHTOK] = _PAM_SM_CHAUTHTOK		\
 		},			\
 	};\
-	DATA_SET(_openpam_static_modules, _pam_module)
+	DATA_SET(openpam_static_modules, _pam_module)
 #else
 /* normal case */
 # define PAM_EXTERN



CVS commit: src/lib/libpam/modules

2012-01-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 28 21:54:26 UTC 2012

Modified Files:
src/lib/libpam/modules: mod.mk

Log Message:
remove unneeded change


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libpam/modules/mod.mk

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

Modified files:

Index: src/lib/libpam/modules/mod.mk
diff -u src/lib/libpam/modules/mod.mk:1.10 src/lib/libpam/modules/mod.mk:1.11
--- src/lib/libpam/modules/mod.mk:1.10	Sat Jan 28 16:34:22 2012
+++ src/lib/libpam/modules/mod.mk	Sat Jan 28 16:54:26 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: mod.mk,v 1.10 2012/01/28 21:34:22 christos Exp $
+#	$NetBSD: mod.mk,v 1.11 2012/01/28 21:54:26 christos Exp $
 
 NOLINT=		# don't build a lint library
 NOPROFILE=	# don't build a profile library
@@ -23,9 +23,6 @@ libinstall:: ${DESTDIR}${LIBDIR}/${LIB}.
 libinstall::
 .endif
 
-# Don't use -x because strips link_set symbols (which are local)
-OBJCOPYLIBFLAGS=-X
-
 .include bsd.lib.mk
 
 ${DESTDIR}${LIBDIR}/${LIB}.so.${SHLIB_MAJOR}: lib${LIB}.so.${SHLIB_FULLVERSION}



CVS commit: src/sys/kern

2012-01-28 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sat Jan 28 23:05:48 UTC 2012

Modified Files:
src/sys/kern: subr_vmem.c

Log Message:
- Make subr_vmem.c compile as standalone again.
- Reduce some #ifdefs.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/kern/subr_vmem.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/kern/subr_vmem.c
diff -u src/sys/kern/subr_vmem.c:1.66 src/sys/kern/subr_vmem.c:1.67
--- src/sys/kern/subr_vmem.c:1.66	Fri Jan 27 19:48:40 2012
+++ src/sys/kern/subr_vmem.c	Sat Jan 28 23:05:48 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_vmem.c,v 1.66 2012/01/27 19:48:40 para Exp $	*/
+/*	$NetBSD: subr_vmem.c,v 1.67 2012/01/28 23:05:48 rmind Exp $	*/
 
 /*-
  * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi,
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.66 2012/01/27 19:48:40 para Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.67 2012/01/28 23:05:48 rmind Exp $);
 
 #if defined(_KERNEL)
 #include opt_ddb.h
@@ -85,6 +85,7 @@ VMEM_EVCNT_DEFINE(bt_inuse)
 kcondvar_t name;
 
 #else /* defined(_KERNEL) */
+#include stdio.h
 #include errno.h
 #include assert.h
 #include stdlib.h
@@ -220,7 +221,6 @@ static kmutex_t vmem_list_lock;
 static LIST_HEAD(, vmem) vmem_list = LIST_HEAD_INITIALIZER(vmem_list);
 #endif /* defined(_KERNEL) */
 
-
 /*  misc */
 
 #define	VMEM_ALIGNUP(addr, align) \
@@ -234,34 +234,14 @@ static LIST_HEAD(, vmem) vmem_list = LIS
 
 #if !defined(_KERNEL)
 #define	xmalloc(sz, flags)	malloc(sz)
-#define	xfree(p)		free(p)
+#define	xfree(p, sz)		free(p)
 #define	bt_alloc(vm, flags)	malloc(sizeof(bt_t))
 #define	bt_free(vm, bt)		free(bt)
-#else	/* !defined(_KERNEL) */
-
-static inline void *
-xmalloc(size_t sz, vm_flag_t flags)
-{
-
-#if defined(_KERNEL)
-	return kmem_alloc(sz, (flags  VM_SLEEP) ? KM_SLEEP : KM_NOSLEEP);
-#else /* defined(_KERNEL) */
-	return malloc(sz);
-#endif /* defined(_KERNEL) */
-}
-
-static inline void
-xfree(void *p, size_t sz)
-{
-
-#if defined(_KERNEL)
-	kmem_free(p, sz);
 #else /* defined(_KERNEL) */
-	free(p);
-#endif /* defined(_KERNEL) */
-}
 
-#if defined(_KERNEL)
+#define	xmalloc(sz, flags) \
+kmem_alloc(sz, ((flags)  VM_SLEEP) ? KM_SLEEP : KM_NOSLEEP);
+#define	xfree(p, sz)		kmem_free(p, sz);
 
 #define BT_MINRESERVE 6
 #define BT_MAXFREE 64
@@ -288,8 +268,7 @@ static size_t vmem_btag_count = STATIC_B
 
 /*  boundary tag */
 
-#define BT_PER_PAGE \
-	(PAGE_SIZE / sizeof(bt_t))
+#define	BT_PER_PAGE	(PAGE_SIZE / sizeof(bt_t))
 
 static int bt_refill(vmem_t *vm, vm_flag_t flags);
 
@@ -361,14 +340,11 @@ bt_refill(vmem_t *vm, vm_flag_t flags)
 
 	return 0;
 }
-#endif /* defined(_KERNEL) */
 
 static inline bt_t *
 bt_alloc(vmem_t *vm, vm_flag_t flags)
 {
 	bt_t *bt;
-
-#if defined(_KERNEL)
 again:
 	VMEM_LOCK(vm);
 	if (vm-vm_nfreetags  BT_MINRESERVE 
@@ -384,9 +360,6 @@ again:
 	vm-vm_nfreetags--;
 	VMEM_UNLOCK(vm);
 	VMEM_EVCNT_INCR(bt_inuse);
-#else /* defined(_KERNEL) */
-	bt = malloc(sizeof *bt);
-#endif /* defined(_KERNEL) */
 
 	return bt;
 }
@@ -395,7 +368,6 @@ static inline void
 bt_free(vmem_t *vm, bt_t *bt)
 {
 
-#if defined(_KERNEL)
 	VMEM_LOCK(vm);
 	LIST_INSERT_HEAD(vm-vm_freetags, bt, bt_freelist);
 	vm-vm_nfreetags++;
@@ -410,15 +382,12 @@ bt_free(vmem_t *vm, bt_t *bt)
 	}
 	VMEM_UNLOCK(vm);
 	VMEM_EVCNT_DECR(bt_inuse);
-#else /* defined(_KERNEL) */
-	free(bt);
-#endif /* defined(_KERNEL) */
 }
 
-#endif	/* !defined(_KERNEL) */
+#endif	/* defined(_KERNEL) */
 
 /*
- * freelist[0] ... [1, 1] 
+ * freelist[0] ... [1, 1]
  * freelist[1] ... [2, 3]
  * freelist[2] ... [4, 7]
  * freelist[3] ... [8, 15]
@@ -1056,8 +1025,7 @@ vmem_create_internal(const char *name, v
 vmem_t *
 vmem_create(const char *name, vmem_addr_t base, vmem_size_t size,
 vmem_size_t quantum, vmem_import_t *importfn, vmem_release_t *releasefn,
-vmem_t *source, vmem_size_t qcache_max, vm_flag_t flags,
-int ipl)
+vmem_t *source, vmem_size_t qcache_max, vm_flag_t flags, int ipl)
 {
 
 	KASSERT((flags  (VM_SLEEP|VM_NOSLEEP)) != 0);
@@ -1077,8 +1045,7 @@ vmem_create(const char *name, vmem_addr_
 vmem_t *
 vmem_xcreate(const char *name, vmem_addr_t base, vmem_size_t size,
 vmem_size_t quantum, vmem_ximport_t *importfn, vmem_release_t *releasefn,
-vmem_t *source, vmem_size_t qcache_max, vm_flag_t flags,
-int ipl)
+vmem_t *source, vmem_size_t qcache_max, vm_flag_t flags, int ipl)
 {
 
 	KASSERT((flags  (VM_SLEEP|VM_NOSLEEP)) != 0);
@@ -1865,4 +1832,3 @@ main(void)
 	exit(EXIT_SUCCESS);
 }
 #endif /* defined(UNITTEST) */
-



CVS commit: src/sys

2012-01-28 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sat Jan 28 23:09:07 UTC 2012

Modified Files:
src/sys/kern: kern_malloc.c subr_kmem.c
src/sys/sys: kmem.h

Log Message:
- Instead of kmem_cache_max, calculate max index and avoid a shift.
- Use __read_mostly and __cacheline_aligned.
- Make kmem_{intr_alloc,free} public.
- Misc.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/kern/kern_malloc.c
cvs rdiff -u -r1.39 -r1.40 src/sys/kern/subr_kmem.c
cvs rdiff -u -r1.7 -r1.8 src/sys/sys/kmem.h

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

Modified files:

Index: src/sys/kern/kern_malloc.c
diff -u src/sys/kern/kern_malloc.c:1.134 src/sys/kern/kern_malloc.c:1.135
--- src/sys/kern/kern_malloc.c:1.134	Fri Jan 27 19:48:40 2012
+++ src/sys/kern/kern_malloc.c	Sat Jan 28 23:09:06 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_malloc.c,v 1.134 2012/01/27 19:48:40 para Exp $	*/
+/*	$NetBSD: kern_malloc.c,v 1.135 2012/01/28 23:09:06 rmind Exp $	*/
 
 /*
  * Copyright (c) 1987, 1991, 1993
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_malloc.c,v 1.134 2012/01/27 19:48:40 para Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_malloc.c,v 1.135 2012/01/28 23:09:06 rmind Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -90,10 +90,6 @@ struct malloc_type *kmemstatistics;
 
 kmutex_t malloc_lock;
 
-extern void *kmem_intr_alloc(size_t, km_flag_t);
-extern void *kmem_intr_zalloc(size_t, km_flag_t);
-extern void kmem_intr_free(void *, size_t);
-
 struct malloc_header {
 	size_t mh_size;
 };

Index: src/sys/kern/subr_kmem.c
diff -u src/sys/kern/subr_kmem.c:1.39 src/sys/kern/subr_kmem.c:1.40
--- src/sys/kern/subr_kmem.c:1.39	Fri Jan 27 19:48:40 2012
+++ src/sys/kern/subr_kmem.c	Sat Jan 28 23:09:06 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_kmem.c,v 1.39 2012/01/27 19:48:40 para Exp $	*/
+/*	$NetBSD: subr_kmem.c,v 1.40 2012/01/28 23:09:06 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_kmem.c,v 1.39 2012/01/27 19:48:40 para Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_kmem.c,v 1.40 2012/01/28 23:09:06 rmind Exp $);
 
 #include sys/param.h
 #include sys/callback.h
@@ -77,12 +77,10 @@ __KERNEL_RCSID(0, $NetBSD: subr_kmem.c,
 
 #include lib/libkern/libkern.h
 
-struct kmem_cache_info {
-	int kc_size;
-	const char *kc_name;
-};
-
-static const struct kmem_cache_info kmem_cache_sizes[] = {
+static const struct kmem_cache_info {
+	size_t		kc_size;
+	const char *	kc_name;
+} kmem_cache_sizes[] = {
 	{  8, kmem-8 },
 	{ 16, kmem-16 },
 	{ 24, kmem-24 },
@@ -111,17 +109,17 @@ static const struct kmem_cache_info kmem
 };
 
 /*
- * KMEM_ALIGN is the smalles guaranteed alignment and
- * also the smallest allocateable quanta.
- * Every cache size which is a multiply of CACHE_LINE_SIZE
- * gets CACHE_LINE_SIZE alignment.
+ * KMEM_ALIGN is the smallest guaranteed alignment and also the
+ * smallest allocateable quantum.  Every cache size is a multiply
+ * of CACHE_LINE_SIZE and gets CACHE_LINE_SIZE alignment.
  */
-#define KMEM_ALIGN	8
-#define KMEM_SHIFT	3
-#define KMEM_MAXSIZE	4096
+#define	KMEM_ALIGN		8
+#define	KMEM_SHIFT		3
+#define	KMEM_MAXSIZE		4096
+#define	KMEM_CACHE_COUNT	(KMEM_MAXSIZE  KMEM_SHIFT)
 
-static pool_cache_t kmem_cache[KMEM_MAXSIZE  KMEM_SHIFT];
-static size_t kmem_cache_max;
+static pool_cache_t kmem_cache[KMEM_CACHE_COUNT] __cacheline_aligned;
+static size_t kmem_cache_maxidx __read_mostly;
 
 #if defined(DEBUG)
 int kmem_guard_depth = 0;
@@ -139,8 +137,8 @@ static int kmem_poison_ctor(void *, void
 static void kmem_poison_fill(void *, size_t);
 static void kmem_poison_check(void *, size_t);
 #else /* defined(KMEM_POISON) */
-#define kmem_poison_fill(p, sz)		/* nothing */
-#define kmem_poison_check(p, sz)		/* nothing */
+#define	kmem_poison_fill(p, sz)		/* nothing */
+#define	kmem_poison_check(p, sz)	/* nothing */
 #endif /* defined(KMEM_POISON) */
 
 #if defined(KMEM_REDZONE)
@@ -150,7 +148,7 @@ static void kmem_poison_check(void *, si
 #endif /* defined(KMEM_REDZONE) */
 
 #if defined(KMEM_SIZE)
-#define	SIZE_SIZE	(max(KMEM_ALIGN, sizeof(size_t)))
+#define	SIZE_SIZE	(MAX(KMEM_ALIGN, sizeof(size_t)))
 static void kmem_size_set(void *, size_t);
 static void kmem_size_check(void *, size_t);
 #else
@@ -162,15 +160,10 @@ static void kmem_size_check(void *, size
 CTASSERT(KM_SLEEP == PR_WAITOK);
 CTASSERT(KM_NOSLEEP == PR_NOWAIT);
 
-void * kmem_intr_alloc(size_t size, km_flag_t kmflags);
-void * kmem_intr_zalloc(size_t size, km_flag_t kmflags);
-void kmem_intr_free(void *, size_t size);
-
 void *
 kmem_intr_alloc(size_t size, km_flag_t kmflags)
 {
-	size_t index;
-	size_t allocsz;
+	size_t allocsz, index;
 	pool_cache_t pc;
 	uint8_t *p;
 
@@ -182,20 +175,18 @@ kmem_intr_alloc(size_t size, km_flag_t k
 		(kmflags  KM_SLEEP) != 0);
 	}
 #endif
-
 	allocsz = kmem_roundup_size(size) + 

CVS commit: src/share/mk

2012-01-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 28 23:13:24 UTC 2012

Modified Files:
src/share/mk: bsd.lib.mk

Log Message:
rename to OBJCOPYLIBFLAGS


To generate a diff of this commit:
cvs rdiff -u -r1.319 -r1.320 src/share/mk/bsd.lib.mk

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

Modified files:

Index: src/share/mk/bsd.lib.mk
diff -u src/share/mk/bsd.lib.mk:1.319 src/share/mk/bsd.lib.mk:1.320
--- src/share/mk/bsd.lib.mk:1.319	Sat Jan 28 16:32:14 2012
+++ src/share/mk/bsd.lib.mk	Sat Jan 28 18:13:24 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.lib.mk,v 1.319 2012/01/28 21:32:14 christos Exp $
+#	$NetBSD: bsd.lib.mk,v 1.320 2012/01/28 23:13:24 christos Exp $
 #	@(#)bsd.lib.mk	8.3 (Berkeley) 4/22/94
 
 .include bsd.init.mk
@@ -214,7 +214,7 @@ CTFFLAGS+=	-g
 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .endif
 .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
-	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
 .endif
 
 .c.po:
@@ -224,7 +224,7 @@ CTFFLAGS+=	-g
 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .endif
 .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
-	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
 .endif
 
 .c.go:
@@ -235,21 +235,21 @@ CTFFLAGS+=	-g
 	${_MKTARGET_COMPILE}
 	${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
 .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
-	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
 .endif
 
 .cc.o .cpp.o .cxx.o .C.o:
 	${_MKTARGET_COMPILE}
 	${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
 .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
-	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
 .endif
 
 .cc.po .cpp.po .cxx.po .C.po:
 	${_MKTARGET_COMPILE}
 	${COMPILE.cc} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
 .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
-	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
 .endif
 
 .cc.go .cpp.go .cxx.go .C.go:
@@ -260,7 +260,7 @@ CTFFLAGS+=	-g
 	${_MKTARGET_COMPILE}
 	${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
 .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
-	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
 .endif
 
 .f.o:
@@ -270,7 +270,7 @@ CTFFLAGS+=	-g
 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .endif
 .if !defined(FOPTS) || empty(FOPTS:M*-g*)
-	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
 .endif
 
 .f.po:
@@ -280,7 +280,7 @@ CTFFLAGS+=	-g
 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .endif
 .if !defined(FOPTS) || empty(FOPTS:M*-g*)
-	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
 .endif
 
 .f.go:
@@ -291,7 +291,7 @@ CTFFLAGS+=	-g
 	${_MKTARGET_COMPILE}
 	${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
 .if !defined(FOPTS) || empty(FOPTS:M*-g*)
-	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
 .endif
 
 .f.ln:
@@ -305,7 +305,7 @@ CTFFLAGS+=	-g
 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .endif
 .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
-	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
 .endif
 
 .m.po:
@@ -315,21 +315,21 @@ CTFFLAGS+=	-g
 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .endif
 .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
-	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
 .endif
 
 .m.go:
 	${_MKTARGET_COMPILE}
 	${COMPILE.m} ${DEBUGFLAGS} -g ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
 .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
-	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
 .endif
 
 .m.pico:
 	${_MKTARGET_COMPILE}
 	${COMPILE.m} ${CSHLIBFLAGS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
 .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
-	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
 .endif
 
 .s.o:
@@ -338,7 +338,7 @@ CTFFLAGS+=	-g
 .if defined(CTFCONVERT)
 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .endif
-	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
 
 .S.o:
 	${_MKTARGET_COMPILE}
@@ -346,7 +346,7 @@ CTFFLAGS+=	-g
 .if defined(CTFCONVERT)
 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .endif
-	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
 
 .s.po:
 	${_MKTARGET_COMPILE}
@@ -354,7 +354,7 @@ CTFFLAGS+=	-g
 .if defined(CTFCONVERT)
 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .endif
-	${OBJCOPY} ${OBJCOPYFLAGS} ${.TARGET}
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
 
 .S.po:
 	${_MKTARGET_COMPILE}
@@ -362,7 +362,7 @@ CTFFLAGS+=	-g
 .if defined(CTFCONVERT)
 	

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

2012-01-28 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Jan 28 23:51:07 UTC 2012

Update of /cvsroot/src/external/public-domain/sqlite/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv21691

Log Message:
Update to sqlite 3.7.10:
- Default schema format changed to version 4
- Various bugfixes and improvements.

Status:

Vendor Tag: SQLITE
Release Tags:   sqlite-3-7-10

U src/external/public-domain/sqlite/dist/sqlite3ext.h
C src/external/public-domain/sqlite/dist/sqlite3.c
U src/external/public-domain/sqlite/dist/shell.c
U src/external/public-domain/sqlite/dist/sqlite3.h

1 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jSQLITE:yesterday -jSQLITE 
src/external/public-domain/sqlite/dist



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

2012-01-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 29 00:50:59 UTC 2012

Modified Files:
src/sys/arch/shark/conf: GENERIC

Log Message:
Bump SYMTAB_SPACE


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/shark/conf/GENERIC

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/shark/conf/GENERIC
diff -u src/sys/arch/shark/conf/GENERIC:1.97 src/sys/arch/shark/conf/GENERIC:1.98
--- src/sys/arch/shark/conf/GENERIC:1.97	Sun Dec 18 00:49:32 2011
+++ src/sys/arch/shark/conf/GENERIC	Sat Jan 28 19:50:59 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: GENERIC,v 1.97 2011/12/18 05:49:32 dholland Exp $
+#	$NetBSD: GENERIC,v 1.98 2012/01/29 00:50:59 christos Exp $
 #
 # Generic Shark configuration.
 #
@@ -7,7 +7,7 @@ include	arch/shark/conf/std.shark
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		GENERIC-$Revision: 1.97 $
+#ident		GENERIC-$Revision: 1.98 $
 
 # estimated number of users
 maxusers	32
@@ -161,7 +161,7 @@ options 	MODULAR		# new style module(7) 
 options 	DIAGNOSTIC	# internal consistency checks
 #options 	PMAP_DEBUG	# Enable pmap_debug_level code
 options 	DDB		# in-kernel debugger
-options 	SYMTAB_SPACE=44 	# reserve symbol space for DDB
+options 	SYMTAB_SPACE=45 	# reserve symbol space for DDB
 # (needed because we boot netbsd.aout)
 #options 	DDB_ONPANIC=0	# don't run DDB at panictime
 #options 	DDB_HISTORY_SIZE=100	# Enable history editing in DDB



CVS commit: src

2012-01-28 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sun Jan 29 00:58:14 UTC 2012

Modified Files:
src/sbin/fsck_ffs: setup.c
src/sys/ufs/ffs: ffs_vfsops.c

Log Message:
use FS_UFS[12]_MAGIC_SWAPPED instead of bswap32(FS_UFS[12]_MAGIC).


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sbin/fsck_ffs/setup.c
cvs rdiff -u -r1.274 -r1.275 src/sys/ufs/ffs/ffs_vfsops.c

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

Modified files:

Index: src/sbin/fsck_ffs/setup.c
diff -u src/sbin/fsck_ffs/setup.c:1.94 src/sbin/fsck_ffs/setup.c:1.95
--- src/sbin/fsck_ffs/setup.c:1.94	Sun Aug 14 12:32:01 2011
+++ src/sbin/fsck_ffs/setup.c	Sun Jan 29 00:58:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: setup.c,v 1.94 2011/08/14 12:32:01 christos Exp $	*/
+/*	$NetBSD: setup.c,v 1.95 2012/01/29 00:58:13 nonaka Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)setup.c	8.10 (Berkeley) 5/9/95;
 #else
-__RCSID($NetBSD: setup.c,v 1.94 2011/08/14 12:32:01 christos Exp $);
+__RCSID($NetBSD: setup.c,v 1.95 2012/01/29 00:58:13 nonaka Exp $);
 #endif
 #endif /* not lint */
 
@@ -692,7 +692,7 @@ static int
 detect_byteorder(struct fs *fs, int sblockoff)
 {
 	if (sblockoff == SBLOCK_UFS2  (fs-fs_magic == FS_UFS1_MAGIC ||
-	fs-fs_magic == bswap32(FS_UFS1_MAGIC)))
+	fs-fs_magic == FS_UFS1_MAGIC_SWAPPED))
 		/* Likely to be the first alternate of a fs with 64k blocks */
 		return -1;
 	if (fs-fs_magic == FS_UFS1_MAGIC || fs-fs_magic == FS_UFS2_MAGIC) {
@@ -704,8 +704,8 @@ detect_byteorder(struct fs *fs, int sblo
 			doswap = do_blkswap = do_dirswap = 1;
 		}
 		return 0;
-	} else if (fs-fs_magic == bswap32(FS_UFS1_MAGIC) ||
-		   fs-fs_magic == bswap32(FS_UFS2_MAGIC)) {
+	} else if (fs-fs_magic == FS_UFS1_MAGIC_SWAPPED ||
+		   fs-fs_magic == FS_UFS2_MAGIC_SWAPPED) {
 		if (endian == 0 || BYTE_ORDER != endian) {
 			needswap = 1;
 			doswap = do_blkswap = do_dirswap = 0;

Index: src/sys/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.274 src/sys/ufs/ffs/ffs_vfsops.c:1.275
--- src/sys/ufs/ffs/ffs_vfsops.c:1.274	Sat Jan 28 00:00:06 2012
+++ src/sys/ufs/ffs/ffs_vfsops.c	Sun Jan 29 00:58:14 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_vfsops.c,v 1.274 2012/01/28 00:00:06 rmind Exp $	*/
+/*	$NetBSD: ffs_vfsops.c,v 1.275 2012/01/29 00:58:14 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ffs_vfsops.c,v 1.274 2012/01/28 00:00:06 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: ffs_vfsops.c,v 1.275 2012/01/29 00:58:14 nonaka Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_ffs.h
@@ -927,7 +927,7 @@ ffs_mountfs(struct vnode *devvp, struct 
 			fsbsize = fs-fs_bsize;
 #ifdef FFS_EI
 			needswap = 0;
-		} else if (fs-fs_magic == bswap32(FS_UFS1_MAGIC)) {
+		} else if (fs-fs_magic == FS_UFS1_MAGIC_SWAPPED) {
 			sbsize = bswap32(fs-fs_sbsize);
 			fstype = UFS1;
 			fsbsize = bswap32(fs-fs_bsize);
@@ -939,7 +939,7 @@ ffs_mountfs(struct vnode *devvp, struct 
 			fsbsize = fs-fs_bsize;
 #ifdef FFS_EI
 			needswap = 0;
-		} else if (fs-fs_magic == bswap32(FS_UFS2_MAGIC)) {
+		} else if (fs-fs_magic == FS_UFS2_MAGIC_SWAPPED) {
 			sbsize = bswap32(fs-fs_sbsize);
 			fstype = UFS2;
 			fsbsize = bswap32(fs-fs_bsize);



CVS commit: src

2012-01-28 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Sun Jan 29 06:22:02 UTC 2012

Modified Files:
src/lib/libperfuse: debug.c ops.c perfuse_priv.h subr.c
src/usr.sbin/perfused: perfused.8 perfused.c perfused.h

Log Message:
Improve FUSE trace facility


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libperfuse/debug.c
cvs rdiff -u -r1.49 -r1.50 src/lib/libperfuse/ops.c
cvs rdiff -u -r1.24 -r1.25 src/lib/libperfuse/perfuse_priv.h
cvs rdiff -u -r1.14 -r1.15 src/lib/libperfuse/subr.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/perfused/perfused.8
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/perfused/perfused.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/perfused/perfused.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/libperfuse/debug.c
diff -u src/lib/libperfuse/debug.c:1.8 src/lib/libperfuse/debug.c:1.9
--- src/lib/libperfuse/debug.c:1.8	Thu Dec 29 04:25:49 2011
+++ src/lib/libperfuse/debug.c	Sun Jan 29 06:22:01 2012
@@ -1,4 +1,4 @@
-/*  $NetBSD: debug.c,v 1.8 2011/12/29 04:25:49 riz Exp $ */
+/*  $NetBSD: debug.c,v 1.9 2012/01/29 06:22:01 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -27,6 +27,9 @@
 
 #include puffs.h
 #include stdio.h
+#include stdlib.h
+#include err.h
+#include errno.h
 #include sys/types.h
 
 #include perfuse_if.h
@@ -127,6 +130,64 @@ perfuse_opdump_in(ps, pm)
 	return buf;
 }
 
+struct perfuse_trace *
+perfuse_trace_begin(ps, opc, pm)
+	struct perfuse_state *ps;
+	puffs_cookie_t opc;
+	perfuse_msg_t *pm;
+{
+	struct perfuse_trace *pt;
+
+	if ((pt = malloc(sizeof(*pt))) == NULL)
+		DERR(EX_OSERR, malloc failed);
+
+	pt-pt_opcode = ps-ps_get_inhdr(pm)-opcode;
+	pt-pt_status = inxchg;
+
+	if (clock_gettime(CLOCK_REALTIME, pt-pt_start) != 0)
+		DERR(EX_OSERR, clock_gettime failed);
+
+	if (opc == 0)
+		(void)strcpy(pt-pt_path, );
+	else
+		(void)strlcpy(pt-pt_path, 
+			  perfuse_node_path(opc),
+			  sizeof(pt-pt_path));
+
+	(void)strlcpy(pt-pt_extra,
+		  perfuse_opdump_in(ps, pm),
+		  sizeof(pt-pt_extra));
+
+	TAILQ_INSERT_TAIL(ps-ps_trace, pt, pt_list);
+	ps-ps_tracecount++;
+
+	return pt;
+}
+
+void
+perfuse_trace_end(ps, pt, error)
+	struct perfuse_state *ps;
+	struct perfuse_trace *pt;
+	int error;
+{
+	if (clock_gettime(CLOCK_REALTIME, pt-pt_end) != 0)
+		DERR(EX_OSERR, clock_gettime failed);
+
+	pt-pt_status = done;
+	pt-pt_error = error;
+
+	while (ps-ps_tracecount  PERFUSE_TRACECOUNT_MAX) {
+		struct perfuse_trace *fpt = TAILQ_FIRST(ps-ps_trace);
+
+		if (fpt == NULL || fpt-pt_status != done)
+			break;
+
+		TAILQ_REMOVE(ps-ps_trace, fpt, pt_list);
+		free(fpt);
+		ps-ps_tracecount--;
+	}
+}
+
 void
 perfuse_trace_dump(pu, fp)
 	struct puffs_usermount *pu;
@@ -159,7 +220,7 @@ perfuse_trace_dump(pu, fp)
 	TAILQ_FOREACH(pt, ps-ps_trace, pt_list) {
 		const char *quote = pt-pt_path[0] != '\0' ? \ : ;
 
-		fprintf(fp, % PRIu64 .%09ld %s %s%s%s %s ,  
+		fprintf(fp, %ld.%09ld %s %s%s%s %s ,  
 			pt-pt_start.tv_sec, pt-pt_start.tv_nsec,
 			perfuse_opname(pt-pt_opcode),
 			quote, pt-pt_path, quote,
@@ -172,7 +233,7 @@ perfuse_trace_dump(pu, fp)
 			ts.tv_nsec = 0;	/* delint */
 			timespecsub(pt-pt_end, pt-pt_start, ts);
 
-			fprintf(fp, error = %d elapsed = % PRIu64 .%09lu ,
+			fprintf(fp, error = %d elapsed = %ld.%09lu ,
 pt-pt_error, ts.tv_sec, ts.tv_nsec);
 
 			count[pt-pt_opcode]++;
@@ -206,8 +267,7 @@ perfuse_trace_dump(pu, fp)
 			min = 0;
 		}
 			
-		fprintf(fp, %s\t%d\t% PRId64 .%09ld\t% PRId64 
-		.%09ld\t% PRId64 .%09ld\t\n,
+		fprintf(fp, %s\t%d\t%ld.%09ld\t%ld.%09ld\t%ld.%09ld\t\n,
 			perfuse_opname(i), count[i],
 			min, ts_min[i].tv_nsec,
 			(time_t)(avg / 10L), (long)(avg % 10L),

Index: src/lib/libperfuse/ops.c
diff -u src/lib/libperfuse/ops.c:1.49 src/lib/libperfuse/ops.c:1.50
--- src/lib/libperfuse/ops.c:1.49	Wed Dec 28 17:33:53 2011
+++ src/lib/libperfuse/ops.c	Sun Jan 29 06:22:02 2012
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.49 2011/12/28 17:33:53 manu Exp $ */
+/*  $NetBSD: ops.c,v 1.50 2012/01/29 06:22:02 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -207,7 +207,6 @@ xchg_msg(pu, opc, pm, len, wait)
 	struct perfuse_state *ps;
 	struct perfuse_node_data *pnd;
 	struct perfuse_trace *pt = NULL;
-	int opcode;
 	int error;
 
 	ps = puffs_getspecific(pu);
@@ -228,31 +227,8 @@ xchg_msg(pu, opc, pm, len, wait)
 	/*
 	 * Record FUSE call start if requested
 	 */
-	opcode = ps-ps_get_inhdr(pm)-opcode;
-	if (perfuse_diagflags  PDF_TRACE) {
-		if ((pt = malloc(sizeof(*pt))) == NULL)
-			DERR(EX_OSERR, malloc failed);
-
-		pt-pt_opcode = opcode;
-		pt-pt_status = inxchg;
-
-		if (opc == 0)
-			(void)strcpy(pt-pt_path, );
-		else
-			(void)strlcpy(pt-pt_path, 
-  perfuse_node_path(opc),
-  sizeof(pt-pt_path));
-
-		(void)strlcpy(pt-pt_extra,
-			  perfuse_opdump_in(ps, pm),
-			  

CVS commit: src

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:23:21 UTC 2012

Modified Files:
src/sys/compat/common: vfs_syscalls_50.c
src/sys/ufs/ufs: quota1.h quota1_subr.c ufs_quota1.c
src/usr.sbin/edquota: edquota.c

Log Message:
Change dqblk_to_quotaval() from quota1_subr.c to dqblk_to_quotavals(),
and pass in two single quotaval structs (for blocks and inodes)
instead of an array of (implicitly) QUOTA_NLIMITS quotaval structs
indexed by constants from quotaprop.h.

Note: because this code is used by COMPAT_50 as well as ufs, this
change requires a kernel version bump. (The code is also used by
edquota, but via .PATH so it's not ABI-sensitive there.)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/compat/common/vfs_syscalls_50.c
cvs rdiff -u -r1.5 -r1.6 src/sys/ufs/ufs/quota1.h
cvs rdiff -u -r1.6 -r1.7 src/sys/ufs/ufs/quota1_subr.c \
src/sys/ufs/ufs/ufs_quota1.c
cvs rdiff -u -r1.41 -r1.42 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/sys/compat/common/vfs_syscalls_50.c
diff -u src/sys/compat/common/vfs_syscalls_50.c:1.10 src/sys/compat/common/vfs_syscalls_50.c:1.11
--- src/sys/compat/common/vfs_syscalls_50.c:1.10	Fri Nov 25 16:55:05 2011
+++ src/sys/compat/common/vfs_syscalls_50.c	Sun Jan 29 06:23:20 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_50.c,v 1.10 2011/11/25 16:55:05 dholland Exp $	*/
+/*	$NetBSD: vfs_syscalls_50.c,v 1.11 2012/01/29 06:23:20 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_50.c,v 1.10 2011/11/25 16:55:05 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_50.c,v 1.11 2012/01/29 06:23:20 dholland Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -452,7 +452,9 @@ do_quotaonoff:
 		ufs_quota_limit_names, QUOTA_NLIMITS);
 		if (error)
 			goto out_dict;
-		quotaval_to_dqblk(qv, dqblk);
+		quotavals_to_dqblk(qv[QUOTA_LIMIT_BLOCK],
+   qv[QUOTA_LIMIT_FILE],
+   dqblk);
 		error = copyout(dqblk, SCARG(uap, arg), sizeof(dqblk));
 		goto out_dict;
 		
@@ -460,7 +462,8 @@ do_quotaonoff:
 		error = copyin(SCARG(uap, arg), dqblk, sizeof(dqblk));
 		if (error)
 			goto out_datas;
-		dqblk_to_quotaval(dqblk, qv);
+		dqblk_to_quotavals(dqblk, qv[QUOTA_LIMIT_BLOCK],
+   qv[QUOTA_LIMIT_FILE]);
 
 		error = ENOMEM;
 		data = quota64toprop(SCARG(uap, uid), 0, values,

Index: src/sys/ufs/ufs/quota1.h
diff -u src/sys/ufs/ufs/quota1.h:1.5 src/sys/ufs/ufs/quota1.h:1.6
--- src/sys/ufs/ufs/quota1.h:1.5	Fri Nov 25 16:55:05 2011
+++ src/sys/ufs/ufs/quota1.h	Sun Jan 29 06:23:20 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quota1.h,v 1.5 2011/11/25 16:55:05 dholland Exp $	*/
+/*	$NetBSD: quota1.h,v 1.6 2012/01/29 06:23:20 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -104,8 +104,9 @@ struct dqblk {
 };
 
 /* quota1_subr.c */
-struct quota2_entry;
-void dqblk_to_quotaval(const struct dqblk *, struct quotaval *);
-void quotaval_to_dqblk(const struct quotaval *, struct dqblk *);
+void dqblk_to_quotavals(const struct dqblk *,
+			struct quotaval *, struct quotaval *);
+void quotavals_to_dqblk(const struct quotaval *, const struct quotaval *,
+			struct dqblk *);
 
 #endif /* !_UFS_UFS_QUOTA1_H_ */

Index: src/sys/ufs/ufs/quota1_subr.c
diff -u src/sys/ufs/ufs/quota1_subr.c:1.6 src/sys/ufs/ufs/quota1_subr.c:1.7
--- src/sys/ufs/ufs/quota1_subr.c:1.6	Fri Nov 25 16:55:05 2011
+++ src/sys/ufs/ufs/quota1_subr.c	Sun Jan 29 06:23:20 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: quota1_subr.c,v 1.6 2011/11/25 16:55:05 dholland Exp $ */
+/* $NetBSD: quota1_subr.c,v 1.7 2012/01/29 06:23:20 dholland Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -26,13 +26,12 @@
   */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: quota1_subr.c,v 1.6 2011/11/25 16:55:05 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: quota1_subr.c,v 1.7 2012/01/29 06:23:20 dholland Exp $);
 
 #include sys/types.h
 #include machine/limits.h
 
 #include sys/quota.h
-#include quota/quotaprop.h
 #include ufs/ufs/quota1.h
 
 static uint64_t
@@ -54,42 +53,36 @@ q2e2dqblk_limit(uint64_t lim)
 }
 
 void
-dqblk_to_quotaval(const struct dqblk *dqblk, struct quotaval *qv)
+dqblk_to_quotavals(const struct dqblk *dqblk,
+		   struct quotaval *blocks, struct quotaval *files)
 {
 	/* XXX is qv_grace getting handled correctly? */
 
-	qv[QUOTA_LIMIT_BLOCK].qv_hardlimit =
-	dqblk2q2e_limit(dqblk-dqb_bhardlimit);
-	qv[QUOTA_LIMIT_BLOCK].qv_softlimit =
-	dqblk2q2e_limit(dqblk-dqb_bsoftlimit);
-	qv[QUOTA_LIMIT_BLOCK].qv_usage   = dqblk-dqb_curblocks;
-	qv[QUOTA_LIMIT_BLOCK].qv_expiretime  = dqblk-dqb_btime;
-
-	qv[QUOTA_LIMIT_FILE].qv_hardlimit =
-	dqblk2q2e_limit(dqblk-dqb_ihardlimit);
-	qv[QUOTA_LIMIT_FILE].qv_softlimit =
-	

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:26:55 UTC 2012

Modified Files:
src/sys/conf: files
src/sys/rump/librump/rumpvfs: Makefile.rumpvfs
Added Files:
src/sys/kern: vfs_quotactl.c

Log Message:
Add vfs_quotactl.c. This is where filesystem-independent quota
handling will go.


To generate a diff of this commit:
cvs rdiff -u -r1.1040 -r1.1041 src/sys/conf/files
cvs rdiff -u -r0 -r1.1 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.31 -r1.32 src/sys/rump/librump/rumpvfs/Makefile.rumpvfs

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

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1040 src/sys/conf/files:1.1041
--- src/sys/conf/files:1.1040	Sat Jan 28 08:37:22 2012
+++ src/sys/conf/files	Sun Jan 29 06:26:54 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1040 2012/01/28 08:37:22 nisimura Exp $
+#	$NetBSD: files,v 1.1041 2012/01/29 06:26:54 dholland Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20100430
@@ -1622,6 +1622,7 @@ file	kern/vfs_init.c
 file	kern/vfs_lockf.c
 file	kern/vfs_lookup.c
 file	kern/vfs_mount.c
+file	kern/vfs_quotactl.c
 file	kern/vfs_subr.c
 file	kern/vfs_syscalls.c
 file	kern/vfs_trans.c

Index: src/sys/rump/librump/rumpvfs/Makefile.rumpvfs
diff -u src/sys/rump/librump/rumpvfs/Makefile.rumpvfs:1.31 src/sys/rump/librump/rumpvfs/Makefile.rumpvfs:1.32
--- src/sys/rump/librump/rumpvfs/Makefile.rumpvfs:1.31	Sat Apr  2 04:28:58 2011
+++ src/sys/rump/librump/rumpvfs/Makefile.rumpvfs	Sun Jan 29 06:26:55 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rumpvfs,v 1.31 2011/04/02 04:28:58 rmind Exp $
+#	$NetBSD: Makefile.rumpvfs,v 1.32 2012/01/29 06:26:55 dholland Exp $
 #
 
 .include ${RUMPTOP}/Makefile.rump
@@ -52,7 +52,7 @@ SRCS+=	subr_bufq.c bufq_disksort.c bufq_
 SRCS+=	mfs_miniroot.c
 
 #quota2 plists
-SRCS+= quota1_subr.c
+SRCS+= quota1_subr.c vfs_quotactl.c
 
 # dev
 # firmload is technically part of rumpdev, but it's pure vfs in nature.

Added files:

Index: src/sys/kern/vfs_quotactl.c
diff -u /dev/null src/sys/kern/vfs_quotactl.c:1.1
--- /dev/null	Sun Jan 29 06:26:55 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 06:26:55 2012
@@ -0,0 +1,40 @@
+/*	$NetBSD: vfs_quotactl.c,v 1.1 2012/01/29 06:26:55 dholland Exp $	*/
+
+/*
+ * Copyright (c) 1982, 1986, 1990, 1993, 1995
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Robert Elz at The University of Melbourne.
+ *
+ * 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.
+ *
+ *	@(#)ufs_quota.c	8.5 (Berkeley) 5/20/95
+ *	From ufs_quota.c,v 1.70 2011/03/24 17:05:46 bouyer Exp
+ */
+
+#include sys/cdefs.h
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.1 2012/01/29 06:26:55 dholland Exp $);
+



CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:29:05 UTC 2012

Modified Files:
src/sys/compat/common: vfs_syscalls_50.c
src/sys/compat/netbsd32: netbsd32_netbsd.c
src/sys/kern: vfs_quotactl.c vfs_syscalls.c
src/sys/sys: mount.h

Log Message:
Add vfs_quotactl() in between the syscall and VFS_QUOTACTL. Call it
from the COMPAT_50 code as well as the current sys_quotactl instead
of going directly to VFS_QUOTACTL. Doesn't actually do anything yet.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/compat/common/vfs_syscalls_50.c
cvs rdiff -u -r1.175 -r1.176 src/sys/compat/netbsd32/netbsd32_netbsd.c
cvs rdiff -u -r1.1 -r1.2 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.442 -r1.443 src/sys/kern/vfs_syscalls.c
cvs rdiff -u -r1.201 -r1.202 src/sys/sys/mount.h

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

Modified files:

Index: src/sys/compat/common/vfs_syscalls_50.c
diff -u src/sys/compat/common/vfs_syscalls_50.c:1.11 src/sys/compat/common/vfs_syscalls_50.c:1.12
--- src/sys/compat/common/vfs_syscalls_50.c:1.11	Sun Jan 29 06:23:20 2012
+++ src/sys/compat/common/vfs_syscalls_50.c	Sun Jan 29 06:29:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_50.c,v 1.11 2012/01/29 06:23:20 dholland Exp $	*/
+/*	$NetBSD: vfs_syscalls_50.c,v 1.12 2012/01/29 06:29:04 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_50.c,v 1.11 2012/01/29 06:23:20 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_50.c,v 1.12 2012/01/29 06:29:04 dholland Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -391,7 +391,7 @@ compat_50_sys_quotactl(struct lwp *l, co
 do_quotaonoff:
 		if (!prop_dictionary_set_and_rel(dict, commands, cmds))
 			goto out_dict;
-		error = VFS_QUOTACTL(mp, dict);
+		error = vfs_quotactl(mp, dict);
 		if (error)
 			goto out_dict;
 		if ((error = quota_get_cmds(dict, cmds)) != 0)
@@ -423,7 +423,7 @@ do_quotaonoff:
 			goto out_cmds;
 		if (!prop_dictionary_set_and_rel(dict, commands, cmds))
 			goto out_dict;
-		error = VFS_QUOTACTL(mp, dict);
+		error = vfs_quotactl(mp, dict);
 		if (error)
 			goto out_dict;
 		if ((error = quota_get_cmds(dict, cmds)) != 0)
@@ -479,7 +479,7 @@ do_quotaonoff:
 			goto out_cmds;
 		if (!prop_dictionary_set_and_rel(dict, commands, cmds))
 			goto out_dict;
-		error = VFS_QUOTACTL(mp, dict);
+		error = vfs_quotactl(mp, dict);
 		if (error)
 			goto out_dict;
 		if ((error = quota_get_cmds(dict, cmds)) != 0)
@@ -508,7 +508,7 @@ do_quotaonoff:
 			goto out_cmds;
 		if (!prop_dictionary_set_and_rel(dict, commands, cmds))
 			goto out_dict;
-		error = VFS_QUOTACTL(mp, dict);
+		error = vfs_quotactl(mp, dict);
 		if (error)
 			goto out_dict;
 		if ((error = quota_get_cmds(dict, cmds)) != 0)

Index: src/sys/compat/netbsd32/netbsd32_netbsd.c
diff -u src/sys/compat/netbsd32/netbsd32_netbsd.c:1.175 src/sys/compat/netbsd32/netbsd32_netbsd.c:1.176
--- src/sys/compat/netbsd32/netbsd32_netbsd.c:1.175	Tue Nov 15 14:13:17 2011
+++ src/sys/compat/netbsd32/netbsd32_netbsd.c	Sun Jan 29 06:29:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_netbsd.c,v 1.175 2011/11/15 14:13:17 njoly Exp $	*/
+/*	$NetBSD: netbsd32_netbsd.c,v 1.176 2012/01/29 06:29:04 dholland Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001, 2008 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: netbsd32_netbsd.c,v 1.175 2011/11/15 14:13:17 njoly Exp $);
+__KERNEL_RCSID(0, $NetBSD: netbsd32_netbsd.c,v 1.176 2012/01/29 06:29:04 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_ddb.h
@@ -1210,7 +1210,7 @@ netbsd32___quotactl50(struct lwp *l, con
 	error = prop_dictionary_copyin(pref, dict);
 	if (error)
 		return error;
-	error = VFS_QUOTACTL(mp, dict);
+	error = vfs_quotactl(mp, dict);
 	vrele(vp);
 	if (!error)
 		error = prop_dictionary_copyout(pref, dict);

Index: src/sys/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.1 src/sys/kern/vfs_quotactl.c:1.2
--- src/sys/kern/vfs_quotactl.c:1.1	Sun Jan 29 06:26:55 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 06:29:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.1 2012/01/29 06:26:55 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.2 2012/01/29 06:29:05 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -36,5 +36,12 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.1 2012/01/29 06:26:55 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.2 2012/01/29 06:29:05 dholland Exp $);
 
+#include sys/mount.h
+
+int
+vfs_quotactl(struct mount *mp, prop_dictionary_t dict)
+{
+	return VFS_QUOTACTL(mp, dict);
+}

Index: src/sys/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.442 src/sys/kern/vfs_syscalls.c:1.443
--- src/sys/kern/vfs_syscalls.c:1.442	Fri Dec  2 12:30:14 2011
+++ 

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:32:44 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c vfs_subr.c
src/sys/miscfs/genfs: layer_extern.h layer_vfsops.c
src/sys/sys: mount.h
src/sys/ufs/ufs: ufs_extern.h ufs_vfsops.c

Log Message:
Move the code for iterating over the multiple RPC calls in a quota
proplib XML packet to vfs_quotactl.c out of sys/ufs/ufs.

Add a dummy extra arg to VFS_QUOTACTL for compile safety.

Note: this change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.426 -r1.427 src/sys/kern/vfs_subr.c
cvs rdiff -u -r1.29 -r1.30 src/sys/miscfs/genfs/layer_extern.h
cvs rdiff -u -r1.34 -r1.35 src/sys/miscfs/genfs/layer_vfsops.c
cvs rdiff -u -r1.202 -r1.203 src/sys/sys/mount.h
cvs rdiff -u -r1.66 -r1.67 src/sys/ufs/ufs/ufs_extern.h
cvs rdiff -u -r1.43 -r1.44 src/sys/ufs/ufs/ufs_vfsops.c

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

Modified files:

Index: src/sys/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.2 src/sys/kern/vfs_quotactl.c:1.3
--- src/sys/kern/vfs_quotactl.c:1.2	Sun Jan 29 06:29:05 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 06:32:43 2012
@@ -1,4 +1,41 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.2 2012/01/29 06:29:05 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.3 2012/01/29 06:32:43 dholland Exp $	*/
+
+/*
+ * Copyright (c) 1991, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *may be used to endorse or promote products derived from this software
+ *without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ufs_vfsops.c	8.8 (Berkeley) 5/20/95
+ *	From NetBSD: ufs_vfsops.c,v 1.42 2011/03/24 17:05:46 bouyer Exp
+ */
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -32,16 +69,50 @@
  * SUCH DAMAGE.
  *
  *	@(#)ufs_quota.c	8.5 (Berkeley) 5/20/95
- *	From ufs_quota.c,v 1.70 2011/03/24 17:05:46 bouyer Exp
+ *	From NetBSD: ufs_quota.c,v 1.70 2011/03/24 17:05:46 bouyer Exp
+ */
+
+/*
+ * Note that both of the copyrights above are moderately spurious;
+ * this code should almost certainly have the Copyright 2010 Manuel
+ * Bouyer notice and license found in e.g. sys/ufs/ufs/quota2_subr.c.
+ * However, they're what was on the files this code was sliced out of.
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.2 2012/01/29 06:29:05 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.3 2012/01/29 06:32:43 dholland Exp $);
 
 #include sys/mount.h
+#include quota/quotaprop.h
 
 int
 vfs_quotactl(struct mount *mp, prop_dictionary_t dict)
 {
-	return VFS_QUOTACTL(mp, dict);
+	prop_dictionary_t cmddict;
+	prop_array_t commands;
+	prop_object_iterator_t iter;
+	int error;
+
+	error = quota_get_cmds(dict, commands);
+	if (error) {
+		return error;
+	}
+
+	iter = prop_array_iterator(commands);
+	if (iter == NULL) {
+		return ENOMEM;
+	}
+
+	while ((cmddict = prop_object_iterator_next(iter)) != NULL) {
+		if (prop_object_type(cmddict) != PROP_TYPE_DICTIONARY) {
+			/* XXX shouldn't this be an error? */
+			continue;
+		}
+		error = VFS_QUOTACTL(mp, cmddict, 0/*dummy*/);
+		if (error) {
+			break;
+		}
+	}
+	

CVS commit: src/sys/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:33:51 UTC 2012

Added Files:
src/sys/sys: quotactl.h

Log Message:
Add sys/quotactl.h. This will hold the definitions for quotactl, which
are not supposed to be exposed to applications. (Only to libquota.)

So far it doesn't actually contain anything yet.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/sys/quotactl.h

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

Added files:

Index: src/sys/sys/quotactl.h
diff -u /dev/null src/sys/sys/quotactl.h:1.1
--- /dev/null	Sun Jan 29 06:33:51 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 06:33:51 2012
@@ -0,0 +1,41 @@
+/*	$NetBSD: quotactl.h,v 1.1 2012/01/29 06:33:51 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.
+ */
+
+#ifndef _SYS_QUOTACTL_H_
+#define _SYS_QUOTACTL_H_
+
+/*
+ * Note - this is an internal interface. Application code (and,
+ * really, anything that isn't libquota or inside the kernel) should
+ * use the quota.h API instead.
+ */
+
+
+#endif /* _SYS_QUOTACTL_H_ */



CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:34:59 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c vfs_subr.c
src/sys/miscfs/genfs: layer_extern.h layer_vfsops.c
src/sys/sys: mount.h quotactl.h
src/sys/ufs/ufs: ufs_extern.h ufs_quota.c ufs_vfsops.c

Log Message:
Move the proplib-based quota command dispatching (that is, the code
that knows the magic string names for the allowed actions) out of
UFS-specific code and to fs-independent code.

This introduces QUOTACTL_* operation codes and changes the signature
of VFS_QUOTACTL() again for compile safety.

Note: this change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.427 -r1.428 src/sys/kern/vfs_subr.c
cvs rdiff -u -r1.30 -r1.31 src/sys/miscfs/genfs/layer_extern.h
cvs rdiff -u -r1.35 -r1.36 src/sys/miscfs/genfs/layer_vfsops.c
cvs rdiff -u -r1.203 -r1.204 src/sys/sys/mount.h
cvs rdiff -u -r1.1 -r1.2 src/sys/sys/quotactl.h
cvs rdiff -u -r1.67 -r1.68 src/sys/ufs/ufs/ufs_extern.h
cvs rdiff -u -r1.70 -r1.71 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.44 -r1.45 src/sys/ufs/ufs/ufs_vfsops.c

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

Modified files:

Index: src/sys/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.3 src/sys/kern/vfs_quotactl.c:1.4
--- src/sys/kern/vfs_quotactl.c:1.3	Sun Jan 29 06:32:43 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 06:34:57 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.3 2012/01/29 06:32:43 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.4 2012/01/29 06:34:57 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,11 +80,72 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.3 2012/01/29 06:32:43 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.4 2012/01/29 06:34:57 dholland Exp $);
 
 #include sys/mount.h
+#include sys/quotactl.h
 #include quota/quotaprop.h
 
+static int
+vfs_quotactl_cmd(struct mount *mp, prop_dictionary_t cmddict)
+{
+	int error;
+	const char *cmd, *type;
+	int op;
+	prop_array_t datas;
+	int q2type;
+
+	if (!prop_dictionary_get_cstring_nocopy(cmddict, command, cmd))
+		return EINVAL;
+	if (!prop_dictionary_get_cstring_nocopy(cmddict, type, type))
+		return EINVAL;
+
+	if (!strcmp(type, QUOTADICT_CLASS_USER)) {
+		q2type = QUOTA_CLASS_USER;
+	} else if (!strcmp(type, QUOTADICT_CLASS_GROUP)) {
+		q2type = QUOTA_CLASS_GROUP;
+	} else {
+		/* XXX this is a bad errno for this case */
+		return EOPNOTSUPP;
+	}
+
+	datas = prop_dictionary_get(cmddict, data);
+	if (datas == NULL || prop_object_type(datas) != PROP_TYPE_ARRAY)
+		return EINVAL;
+
+	prop_object_retain(datas);
+	prop_dictionary_remove(cmddict, data); /* prepare for return */
+
+	if (strcmp(cmd, get version) == 0) {
+		op = QUOTACTL_GETVERSION;
+	} else if (strcmp(cmd, quotaon) == 0) {
+		op = QUOTACTL_QUOTAON;
+	} else if (strcmp(cmd, quotaoff) == 0) {
+		op = QUOTACTL_QUOTAOFF;
+	} else if (strcmp(cmd, get) == 0) {
+		op = QUOTACTL_GET;
+	} else if (strcmp(cmd, set) == 0) {
+		op = QUOTACTL_SET;
+	} else if (strcmp(cmd, getall) == 0) {
+		op = QUOTACTL_GETALL;
+	} else if (strcmp(cmd, clear) == 0) {
+		op = QUOTACTL_CLEAR;
+	} else {
+		/* XXX this a bad errno for this case */
+		error = EOPNOTSUPP;
+		goto fail;
+	}
+
+	error = VFS_QUOTACTL(mp, op, cmddict, q2type, datas);
+
+ fail:
+	error = (prop_dictionary_set_int8(cmddict, return,
+	error) ? 0 : ENOMEM);
+	prop_object_release(datas);
+
+	return error;
+}
+
 int
 vfs_quotactl(struct mount *mp, prop_dictionary_t dict)
 {
@@ -108,7 +169,7 @@ vfs_quotactl(struct mount *mp, prop_dict
 			/* XXX shouldn't this be an error? */
 			continue;
 		}
-		error = VFS_QUOTACTL(mp, cmddict, 0/*dummy*/);
+		error = vfs_quotactl_cmd(mp, cmddict);
 		if (error) {
 			break;
 		}

Index: src/sys/kern/vfs_subr.c
diff -u src/sys/kern/vfs_subr.c:1.427 src/sys/kern/vfs_subr.c:1.428
--- src/sys/kern/vfs_subr.c:1.427	Sun Jan 29 06:32:43 2012
+++ src/sys/kern/vfs_subr.c	Sun Jan 29 06:34:57 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_subr.c,v 1.427 2012/01/29 06:32:43 dholland Exp $	*/
+/*	$NetBSD: vfs_subr.c,v 1.428 2012/01/29 06:34:57 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_subr.c,v 1.427 2012/01/29 06:32:43 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_subr.c,v 1.428 2012/01/29 06:34:57 dholland Exp $);
 
 #include opt_ddb.h
 #include opt_compat_netbsd.h
@@ -1006,14 +1006,15 @@ VFS_ROOT(struct mount *mp, struct vnode 
 }
 
 int
-VFS_QUOTACTL(struct mount *mp, prop_dictionary_t dict, int dummy)
+VFS_QUOTACTL(struct mount *mp, int op, prop_dictionary_t cmddict, int objtype,
+	 prop_array_t datas)
 {
 	int error;
 
 	if ((mp-mnt_iflag  IMNT_MPSAFE) == 0) {
 		KERNEL_LOCK(1, NULL);
 	}

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:36:07 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c vfs_subr.c
src/sys/miscfs/genfs: layer_extern.h layer_vfsops.c
src/sys/sys: mount.h quotactl.h
src/sys/ufs/ufs: ufs_extern.h ufs_quota.c ufs_vfsops.c

Log Message:
Introduce struct vfs_quotactl_args. Use it.

This change uglifies vfs_quotactl some in order to make room for
moving operation-specific but FS-independent logic out of ufs_quota.c.

Note: this change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.428 -r1.429 src/sys/kern/vfs_subr.c
cvs rdiff -u -r1.31 -r1.32 src/sys/miscfs/genfs/layer_extern.h
cvs rdiff -u -r1.36 -r1.37 src/sys/miscfs/genfs/layer_vfsops.c
cvs rdiff -u -r1.204 -r1.205 src/sys/sys/mount.h
cvs rdiff -u -r1.2 -r1.3 src/sys/sys/quotactl.h
cvs rdiff -u -r1.68 -r1.69 src/sys/ufs/ufs/ufs_extern.h
cvs rdiff -u -r1.71 -r1.72 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.45 -r1.46 src/sys/ufs/ufs/ufs_vfsops.c

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

Modified files:

Index: src/sys/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.4 src/sys/kern/vfs_quotactl.c:1.5
--- src/sys/kern/vfs_quotactl.c:1.4	Sun Jan 29 06:34:57 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 06:36:06 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.4 2012/01/29 06:34:57 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.5 2012/01/29 06:36:06 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,18 +80,115 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.4 2012/01/29 06:34:57 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.5 2012/01/29 06:36:06 dholland Exp $);
 
 #include sys/mount.h
 #include sys/quotactl.h
 #include quota/quotaprop.h
 
 static int
+vfs_quotactl_getversion(struct mount *mp,
+			prop_dictionary_t cmddict, int q2type,
+			prop_array_t datas)
+{
+	struct vfs_quotactl_args args;
+
+	args.qc_type = QCT_PROPLIB;
+	args.u.proplib.qc_cmddict = cmddict;
+	args.u.proplib.qc_q2type = q2type;
+	args.u.proplib.qc_datas = datas;
+	return VFS_QUOTACTL(mp, QUOTACTL_GETVERSION, args);
+}
+
+static int
+vfs_quotactl_quotaon(struct mount *mp,
+		 prop_dictionary_t cmddict, int q2type,
+		 prop_array_t datas)
+{
+	struct vfs_quotactl_args args;
+
+	args.qc_type = QCT_PROPLIB;
+	args.u.proplib.qc_cmddict = cmddict;
+	args.u.proplib.qc_q2type = q2type;
+	args.u.proplib.qc_datas = datas;
+	return VFS_QUOTACTL(mp, QUOTACTL_QUOTAON, args);
+}
+
+static int
+vfs_quotactl_quotaoff(struct mount *mp,
+			prop_dictionary_t cmddict, int q2type,
+			prop_array_t datas)
+{
+	struct vfs_quotactl_args args;
+
+	args.qc_type = QCT_PROPLIB;
+	args.u.proplib.qc_cmddict = cmddict;
+	args.u.proplib.qc_q2type = q2type;
+	args.u.proplib.qc_datas = datas;
+	return VFS_QUOTACTL(mp, QUOTACTL_QUOTAOFF, args);
+}
+
+static int
+vfs_quotactl_get(struct mount *mp,
+			prop_dictionary_t cmddict, int q2type,
+			prop_array_t datas)
+{
+	struct vfs_quotactl_args args;
+
+	args.qc_type = QCT_PROPLIB;
+	args.u.proplib.qc_cmddict = cmddict;
+	args.u.proplib.qc_q2type = q2type;
+	args.u.proplib.qc_datas = datas;
+	return VFS_QUOTACTL(mp, QUOTACTL_GET, args);
+}
+
+static int
+vfs_quotactl_set(struct mount *mp,
+			prop_dictionary_t cmddict, int q2type,
+			prop_array_t datas)
+{
+	struct vfs_quotactl_args args;
+
+	args.qc_type = QCT_PROPLIB;
+	args.u.proplib.qc_cmddict = cmddict;
+	args.u.proplib.qc_q2type = q2type;
+	args.u.proplib.qc_datas = datas;
+	return VFS_QUOTACTL(mp, QUOTACTL_SET, args);
+}
+
+static int
+vfs_quotactl_getall(struct mount *mp,
+			prop_dictionary_t cmddict, int q2type,
+			prop_array_t datas)
+{
+	struct vfs_quotactl_args args;
+
+	args.qc_type = QCT_PROPLIB;
+	args.u.proplib.qc_cmddict = cmddict;
+	args.u.proplib.qc_q2type = q2type;
+	args.u.proplib.qc_datas = datas;
+	return VFS_QUOTACTL(mp, QUOTACTL_GETALL, args);
+}
+
+static int
+vfs_quotactl_clear(struct mount *mp,
+			prop_dictionary_t cmddict, int q2type,
+			prop_array_t datas)
+{
+	struct vfs_quotactl_args args;
+
+	args.qc_type = QCT_PROPLIB;
+	args.u.proplib.qc_cmddict = cmddict;
+	args.u.proplib.qc_q2type = q2type;
+	args.u.proplib.qc_datas = datas;
+	return VFS_QUOTACTL(mp, QUOTACTL_CLEAR, args);
+}
+
+static int
 vfs_quotactl_cmd(struct mount *mp, prop_dictionary_t cmddict)
 {
 	int error;
 	const char *cmd, *type;
-	int op;
 	prop_array_t datas;
 	int q2type;
 
@@ -117,28 +214,24 @@ vfs_quotactl_cmd(struct mount *mp, prop_
 	prop_dictionary_remove(cmddict, data); /* prepare for return */
 
 	if (strcmp(cmd, get version) == 0) {
-		op = QUOTACTL_GETVERSION;
+		error = vfs_quotactl_getversion(mp, cmddict, q2type, datas);
 	} else if (strcmp(cmd, quotaon) == 0) {
-		op = QUOTACTL_QUOTAON;
+		error = vfs_quotactl_quotaon(mp, cmddict, q2type, datas);
 	} else if 

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:36:51 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c

Log Message:
Move proplib frobbing for QUOTACTL_GETVERSION to FS-independent code.

Note: this change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.3 -r1.4 src/sys/sys/quotactl.h
cvs rdiff -u -r1.72 -r1.73 src/sys/ufs/ufs/ufs_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/sys/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.5 src/sys/kern/vfs_quotactl.c:1.6
--- src/sys/kern/vfs_quotactl.c:1.5	Sun Jan 29 06:36:06 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 06:36:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.5 2012/01/29 06:36:06 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.6 2012/01/29 06:36:50 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.5 2012/01/29 06:36:06 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.6 2012/01/29 06:36:50 dholland Exp $);
 
 #include sys/mount.h
 #include sys/quotactl.h
@@ -91,13 +91,50 @@ vfs_quotactl_getversion(struct mount *mp
 			prop_dictionary_t cmddict, int q2type,
 			prop_array_t datas)
 {
+	prop_array_t replies;
+	prop_dictionary_t data;
+	int q2version;
 	struct vfs_quotactl_args args;
+	int error;
 
-	args.qc_type = QCT_PROPLIB;
-	args.u.proplib.qc_cmddict = cmddict;
-	args.u.proplib.qc_q2type = q2type;
-	args.u.proplib.qc_datas = datas;
-	return VFS_QUOTACTL(mp, QUOTACTL_GETVERSION, args);
+	KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY);
+	KASSERT(prop_object_type(datas) == PROP_TYPE_ARRAY);
+
+	args.qc_type = QCT_GETVERSION;
+	args.u.getversion.qc_version_ret = q2version;
+	error = VFS_QUOTACTL(mp, QUOTACTL_GETVERSION, args);
+	if (error) {
+		return error;
+	}
+
+	data = prop_dictionary_create();
+	if (data == NULL) {
+		return ENOMEM;
+	}
+
+	if (!prop_dictionary_set_int8(data, version, q2version)) {
+		prop_object_release(data);
+		return ENOMEM;
+	}
+
+	replies = prop_array_create();
+	if (replies == NULL) {
+		prop_object_release(data);
+		return ENOMEM;
+	}
+
+	if (!prop_array_add_and_rel(replies, data)) {
+		prop_object_release(data);
+		prop_object_release(replies);
+		return ENOMEM;
+	}
+
+	if (!prop_dictionary_set_and_rel(cmddict, data, replies)) {
+		prop_object_release(replies);
+		return ENOMEM;
+	}
+
+	return error;
 }
 
 static int

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.3 src/sys/sys/quotactl.h:1.4
--- src/sys/sys/quotactl.h:1.3	Sun Jan 29 06:36:06 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 06:36:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.3 2012/01/29 06:36:06 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.4 2012/01/29 06:36:50 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -48,7 +48,8 @@
 
 /* Argument encoding. */
 enum vfs_quotactl_argtypes {
-	QCT_PROPLIB,	/* getversion, quotaon/off, get, set, getall, clear */
+	QCT_PROPLIB,	/* quotaon/off, get, set, getall, clear */
+	QCT_GETVERSION,	/* getversion */
 };
 struct vfs_quotactl_args {
 	enum vfs_quotactl_argtypes qc_type;
@@ -58,6 +59,9 @@ struct vfs_quotactl_args {
 			int qc_q2type;
 			prop_array_t qc_datas;
 		} proplib;
+		struct {
+			int *qc_version_ret;
+		} getversion;
 	} u;
 };
 

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.72 src/sys/ufs/ufs/ufs_quota.c:1.73
--- src/sys/ufs/ufs/ufs_quota.c:1.72	Sun Jan 29 06:36:07 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 06:36:51 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.72 2012/01/29 06:36:07 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.73 2012/01/29 06:36:51 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.72 2012/01/29 06:36:07 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.73 2012/01/29 06:36:51 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -193,55 +193,27 @@ quota_handle_cmd_get_version(struct moun
 struct vfs_quotactl_args *args)
 {
 	struct ufsmount *ump = VFSTOUFS(mp);
-	prop_array_t replies;
-	prop_dictionary_t data;
-	int error = 0;
-	prop_dictionary_t cmddict;
-	prop_array_t datas;
+	int *version_ret;
 
-	KASSERT(args-qc_type == QCT_PROPLIB);
-	cmddict = args-u.proplib.qc_cmddict;
-	/* qc_q2type not used */
-	datas = args-u.proplib.qc_datas;
-
-	KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY);
-	KASSERT(prop_object_type(datas) == PROP_TYPE_ARRAY);
+	KASSERT(args-qc_type == QCT_GETVERSION);
+	version_ret = args-u.getversion.qc_version_ret;
 
 	if ((ump-um_flags  (UFS_QUOTA|UFS_QUOTA2)) == 

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:37:30 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c

Log Message:
Move first-layer proplib frobbing for QUOTACTL_GET to FS-independent code.
(step 1 of several)

Note: this change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.4 -r1.5 src/sys/sys/quotactl.h
cvs rdiff -u -r1.73 -r1.74 src/sys/ufs/ufs/ufs_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/sys/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.6 src/sys/kern/vfs_quotactl.c:1.7
--- src/sys/kern/vfs_quotactl.c:1.6	Sun Jan 29 06:36:50 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 06:37:30 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.6 2012/01/29 06:36:50 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.7 2012/01/29 06:37:30 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.6 2012/01/29 06:36:50 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.7 2012/01/29 06:37:30 dholland Exp $);
 
 #include sys/mount.h
 #include sys/quotactl.h
@@ -170,13 +170,74 @@ vfs_quotactl_get(struct mount *mp,
 			prop_dictionary_t cmddict, int q2type,
 			prop_array_t datas)
 {
+	prop_object_iterator_t iter;
+	prop_dictionary_t data;
+	uint32_t id;
+	int defaultq;
+	const char *idstr;
+	prop_array_t replies;
 	struct vfs_quotactl_args args;
+	int error;
 
-	args.qc_type = QCT_PROPLIB;
-	args.u.proplib.qc_cmddict = cmddict;
-	args.u.proplib.qc_q2type = q2type;
-	args.u.proplib.qc_datas = datas;
-	return VFS_QUOTACTL(mp, QUOTACTL_GET, args);
+	KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY);
+	KASSERT(prop_object_type(datas) == PROP_TYPE_ARRAY);
+
+	replies = prop_array_create();
+	if (replies == NULL) {
+		return ENOMEM;
+	}
+
+	iter = prop_array_iterator(datas);
+	if (iter == NULL) {
+		prop_object_release(replies);
+		return ENOMEM;
+	}
+
+	while ((data = prop_object_iterator_next(iter)) != NULL) {
+		if (!prop_dictionary_get_uint32(data, id, id)) {
+			if (!prop_dictionary_get_cstring_nocopy(data, id,
+			idstr))
+continue;
+			if (strcmp(idstr, default)) {
+error = EINVAL;
+goto fail;
+			}
+			id = 0;
+			defaultq = 1;
+		} else {
+			defaultq = 0;
+		}
+
+		args.qc_type = QCT_GET;
+		args.u.get.qc_q2type = q2type;
+		args.u.get.qc_id = id;
+		args.u.get.qc_defaultq = defaultq;
+		args.u.get.qc_replies = replies;
+		error = VFS_QUOTACTL(mp, QUOTACTL_GET, args);
+		if (error == EPERM) {
+			/* XXX does this make sense? */
+			continue;
+		} else if (error == ENOENT) {
+			/* XXX does *this* make sense? */
+			continue;
+		} else if (error) {
+			goto fail;
+		}
+	}
+
+	prop_object_iterator_release(iter);
+	if (!prop_dictionary_set_and_rel(cmddict, data, replies)) {
+		error = ENOMEM;
+	} else {
+		error = 0;
+	}
+
+	return error;
+
+ fail:
+	prop_object_iterator_release(iter);
+	prop_object_release(replies);
+	return error;
 }
 
 static int

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.4 src/sys/sys/quotactl.h:1.5
--- src/sys/sys/quotactl.h:1.4	Sun Jan 29 06:36:50 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 06:37:30 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.4 2012/01/29 06:36:50 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.5 2012/01/29 06:37:30 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -50,6 +50,7 @@
 enum vfs_quotactl_argtypes {
 	QCT_PROPLIB,	/* quotaon/off, get, set, getall, clear */
 	QCT_GETVERSION,	/* getversion */
+	QCT_GET,	/* get */
 };
 struct vfs_quotactl_args {
 	enum vfs_quotactl_argtypes qc_type;
@@ -62,6 +63,12 @@ struct vfs_quotactl_args {
 		struct {
 			int *qc_version_ret;
 		} getversion;
+		struct {
+			int qc_q2type;
+			id_t qc_id;
+			int qc_defaultq;
+			prop_array_t qc_replies;
+		} get;
 	} u;
 };
 

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.73 src/sys/ufs/ufs/ufs_quota.c:1.74
--- src/sys/ufs/ufs/ufs_quota.c:1.73	Sun Jan 29 06:36:51 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 06:37:30 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.73 2012/01/29 06:36:51 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.74 2012/01/29 06:37:30 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.73 2012/01/29 06:36:51 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.74 2012/01/29 06:37:30 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -230,56 +230,26 @@ static int 
 quota_handle_cmd_get(struct mount *mp, struct lwp *l, 
 struct vfs_quotactl_args *args)
 {
-	prop_array_t replies;
-	

CVS commit: src

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:38:24 UTC 2012

Modified Files:
src/include: quota.h
src/sys/sys: quota.h
src/sys/ufs/ufs: ufs_quota.c ufs_quota.h ufs_quota1.c ufs_quota2.c

Log Message:
Move second-layer proplib frobbing within ufs quota code up to the
first layer. (Step 2 of several for QUOTACTL_GET.)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/include/quota.h
cvs rdiff -u -r1.7 -r1.8 src/sys/sys/quota.h
cvs rdiff -u -r1.74 -r1.75 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.2 -r1.3 src/sys/ufs/ufs/ufs_quota.h
cvs rdiff -u -r1.7 -r1.8 src/sys/ufs/ufs/ufs_quota1.c
cvs rdiff -u -r1.4 -r1.5 src/sys/ufs/ufs/ufs_quota2.c

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

Modified files:

Index: src/include/quota.h
diff -u src/include/quota.h:1.1 src/include/quota.h:1.2
--- src/include/quota.h:1.1	Mon Jan  9 15:19:45 2012
+++ src/include/quota.h	Sun Jan 29 06:38:23 2012
@@ -44,9 +44,6 @@ struct quotacursor; /* Opaque. */
 #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		((uint64_t)0xULL)
 

Index: src/sys/sys/quota.h
diff -u src/sys/sys/quota.h:1.7 src/sys/sys/quota.h:1.8
--- src/sys/sys/quota.h:1.7	Sun Jan  1 15:41:16 2012
+++ src/sys/sys/quota.h	Sun Jan 29 06:38:23 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: quota.h,v 1.7 2012/01/01 15:41:16 dholland Exp $ */
+/* $NetBSD: quota.h,v 1.8 2012/01/29 06:38:23 dholland Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -30,6 +30,9 @@
 
 #include sys/types.h
 
+/* id value for default */
+#define QUOTA_DEFAULTID		((id_t)-1)
+
 /*
  * Structure used to describe the value part of a quota record.
  */

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.74 src/sys/ufs/ufs/ufs_quota.c:1.75
--- src/sys/ufs/ufs/ufs_quota.c:1.74	Sun Jan 29 06:37:30 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 06:38:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.74 2012/01/29 06:37:30 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.75 2012/01/29 06:38:24 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.74 2012/01/29 06:37:30 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.75 2012/01/29 06:38:24 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -226,6 +226,33 @@ quota_get_auth(struct mount *mp, struct 
 	KAUTH_REQ_SYSTEM_FS_QUOTA_GET, mp, KAUTH_ARG(id), NULL);
 }
 
+static int
+quota_fill_cmd_get_reply(id_t id,
+			 int defaultq,
+			 const struct quotaval *blocks,
+			 const struct quotaval *files,
+			 prop_array_t replies)
+{
+	prop_dictionary_t dict;
+
+	/* XXX illegal casts */
+	uint64_t *valuesp[QUOTA_NLIMITS];
+	valuesp[QUOTA_LIMIT_BLOCK] = (void *)(intptr_t)blocks-qv_hardlimit;
+	valuesp[QUOTA_LIMIT_FILE] =  (void *)(intptr_t)files-qv_hardlimit;
+
+	dict = quota64toprop(id, defaultq, valuesp,
+	ufs_quota_entry_names, UFS_QUOTA_NENTRIES,
+	ufs_quota_limit_names, QUOTA_NLIMITS);
+	if (dict == NULL)
+		return ENOMEM;
+	if (!prop_array_add_and_rel(replies, dict)) {
+		prop_object_release(dict);
+		return ENOMEM;
+	}
+
+	return 0;
+}
+
 static int 
 quota_handle_cmd_get(struct mount *mp, struct lwp *l, 
 struct vfs_quotactl_args *args)
@@ -236,6 +263,7 @@ quota_handle_cmd_get(struct mount *mp, s
 	int q2type;
 	int defaultq;
 	prop_array_t replies;
+	struct quotaval blocks, files;
 
 	KASSERT(args-qc_type == QCT_GET);
 	id = args-u.get.qc_id;
@@ -251,21 +279,25 @@ quota_handle_cmd_get(struct mount *mp, s
 		if (error != 0) 
 			return error;
 #ifdef QUOTA
-		if (ump-um_flags  UFS_QUOTA)
+		if (ump-um_flags  UFS_QUOTA) {
 			error = quota1_handle_cmd_get(ump, q2type, id, defaultq,
-			replies);
-		else
+			blocks, files);
+		} else
 #endif
 #ifdef QUOTA2
 		if (ump-um_flags  UFS_QUOTA2) {
 			error = quota2_handle_cmd_get(ump, q2type, id, defaultq,
-			replies);
+			blocks, files);
 		} else
 #endif
 			panic(quota_handle_cmd_get: no support ?);
 		
 		if (error != 0)
 			return error;
+
+		error = quota_fill_cmd_get_reply(id, defaultq,
+		 blocks, files,
+		 replies);
 	}
 
 	return error;

Index: src/sys/ufs/ufs/ufs_quota.h
diff -u src/sys/ufs/ufs/ufs_quota.h:1.2 src/sys/ufs/ufs/ufs_quota.h:1.3
--- src/sys/ufs/ufs/ufs_quota.h:1.2	Sun Mar  6 17:08:39 2011
+++ src/sys/ufs/ufs/ufs_quota.h	Sun Jan 29 06:38:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.h,v 1.2 2011/03/06 17:08:39 bouyer Exp $	*/
+/*	$NetBSD: ufs_quota.h,v 1.3 2012/01/29 06:38:24 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -113,7 +113,8 @@ int chkiq1(struct inode *, int32_t, kaut
 int q1sync(struct mount *);
 int dq1get(struct vnode *, u_long, struct ufsmount *, 

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:39:37 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c

Log Message:
Move what was second-layer proplib frobbing for QUOTACTL_GET to
FS-independent code. (Step 3 of probably 5 for QUOTACTL_GET.)

Note: this change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.5 -r1.6 src/sys/sys/quotactl.h
cvs rdiff -u -r1.75 -r1.76 src/sys/ufs/ufs/ufs_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/sys/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.7 src/sys/kern/vfs_quotactl.c:1.8
--- src/sys/kern/vfs_quotactl.c:1.7	Sun Jan 29 06:37:30 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 06:39:36 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.7 2012/01/29 06:37:30 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.8 2012/01/29 06:39:36 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,9 +80,10 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.7 2012/01/29 06:37:30 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.8 2012/01/29 06:39:36 dholland Exp $);
 
 #include sys/mount.h
+#include sys/quota.h
 #include sys/quotactl.h
 #include quota/quotaprop.h
 
@@ -166,17 +167,45 @@ vfs_quotactl_quotaoff(struct mount *mp,
 }
 
 static int
+vfs_quotactl_get_addreply(id_t id,
+			  int defaultq,
+			  const struct quotaval *blocks,
+			  const struct quotaval *files,
+			  prop_array_t replies)
+{
+	prop_dictionary_t dict;
+
+	/* XXX illegal casts */
+	uint64_t *valuesp[QUOTA_NLIMITS];
+	valuesp[QUOTA_LIMIT_BLOCK] = (void *)(intptr_t)blocks-qv_hardlimit;
+	valuesp[QUOTA_LIMIT_FILE] =  (void *)(intptr_t)files-qv_hardlimit;
+
+	dict = quota64toprop(id, defaultq, valuesp,
+	ufs_quota_entry_names, UFS_QUOTA_NENTRIES,
+	ufs_quota_limit_names, QUOTA_NLIMITS);
+	if (dict == NULL)
+		return ENOMEM;
+	if (!prop_array_add_and_rel(replies, dict)) {
+		prop_object_release(dict);
+		return ENOMEM;
+	}
+
+	return 0;
+}
+
+static int
 vfs_quotactl_get(struct mount *mp,
 			prop_dictionary_t cmddict, int q2type,
 			prop_array_t datas)
 {
 	prop_object_iterator_t iter;
 	prop_dictionary_t data;
+	prop_array_t replies;
 	uint32_t id;
 	int defaultq;
 	const char *idstr;
-	prop_array_t replies;
 	struct vfs_quotactl_args args;
+	struct quotaval blocks, files;
 	int error;
 
 	KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY);
@@ -212,7 +241,8 @@ vfs_quotactl_get(struct mount *mp,
 		args.u.get.qc_q2type = q2type;
 		args.u.get.qc_id = id;
 		args.u.get.qc_defaultq = defaultq;
-		args.u.get.qc_replies = replies;
+		args.u.get.qc_blocks_ret = blocks;
+		args.u.get.qc_files_ret = files;
 		error = VFS_QUOTACTL(mp, QUOTACTL_GET, args);
 		if (error == EPERM) {
 			/* XXX does this make sense? */
@@ -223,6 +253,10 @@ vfs_quotactl_get(struct mount *mp,
 		} else if (error) {
 			goto fail;
 		}
+
+		error = vfs_quotactl_get_addreply(id, defaultq,
+		  blocks, files,
+		  replies);
 	}
 
 	prop_object_iterator_release(iter);

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.5 src/sys/sys/quotactl.h:1.6
--- src/sys/sys/quotactl.h:1.5	Sun Jan 29 06:37:30 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 06:39:36 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.5 2012/01/29 06:37:30 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.6 2012/01/29 06:39:36 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -67,7 +67,8 @@ struct vfs_quotactl_args {
 			int qc_q2type;
 			id_t qc_id;
 			int qc_defaultq;
-			prop_array_t qc_replies;
+			struct quotaval *qc_blocks_ret;
+			struct quotaval *qc_files_ret;
 		} get;
 	} u;
 };

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.75 src/sys/ufs/ufs/ufs_quota.c:1.76
--- src/sys/ufs/ufs/ufs_quota.c:1.75	Sun Jan 29 06:38:24 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 06:39:37 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.75 2012/01/29 06:38:24 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.76 2012/01/29 06:39:37 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.75 2012/01/29 06:38:24 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.76 2012/01/29 06:39:37 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -226,33 +226,6 @@ quota_get_auth(struct mount *mp, struct 
 	KAUTH_REQ_SYSTEM_FS_QUOTA_GET, mp, KAUTH_ARG(id), NULL);
 }
 
-static int
-quota_fill_cmd_get_reply(id_t id,
-			 int defaultq,
-			 const struct quotaval *blocks,
-			 const struct quotaval *files,
-			 prop_array_t replies)
-{
-	prop_dictionary_t dict;
-
-	/* XXX illegal casts */
-	uint64_t 

CVS commit: src

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:40:58 UTC 2012

Modified Files:
src/include: quota.h
src/sys/kern: vfs_quotactl.c
src/sys/sys: quota.h quotactl.h
src/sys/ufs/ufs: ufs_quota.c ufs_quota.h ufs_quota1.c ufs_quota2.c

Log Message:
Per the FS-independent schema, get one quotaval at a time from the
filesystem, instead of blocks and files together.

This results in fetching each FS-level quota entry twice and therefore
doing slightly more work, but (1) quota access isn't a critical path
and (2) after fetching the block values the file values will be hot in
the cache, so it won't add much total time.

Also move more of the FS-independent defintions from quota.h to
sys/quota.h so we can use them internally.

Step 4 of 5 for QUOTACTL_GET.

Note: this change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/include/quota.h
cvs rdiff -u -r1.8 -r1.9 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.8 -r1.9 src/sys/sys/quota.h
cvs rdiff -u -r1.6 -r1.7 src/sys/sys/quotactl.h
cvs rdiff -u -r1.76 -r1.77 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.3 -r1.4 src/sys/ufs/ufs/ufs_quota.h
cvs rdiff -u -r1.8 -r1.9 src/sys/ufs/ufs/ufs_quota1.c
cvs rdiff -u -r1.5 -r1.6 src/sys/ufs/ufs/ufs_quota2.c

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

Modified files:

Index: src/include/quota.h
diff -u src/include/quota.h:1.2 src/include/quota.h:1.3
--- src/include/quota.h:1.2	Sun Jan 29 06:38:23 2012
+++ src/include/quota.h	Sun Jan 29 06:40:57 2012
@@ -36,26 +36,6 @@
 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
-
-/* limit value for no limit */
-#define QUOTA_NOLIMIT		((uint64_t)0xULL)
-
-/* time value for no time */
-#define QUOTA_NOTIME		((time_t)-1)
-
-
-struct quotakey {
-	int qk_idtype;
-	id_t qk_id;
-	int qk_objtype;
-};
 
 void quotaval_clear(struct quotaval *);
 

Index: src/sys/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.8 src/sys/kern/vfs_quotactl.c:1.9
--- src/sys/kern/vfs_quotactl.c:1.8	Sun Jan 29 06:39:36 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 06:40:57 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.8 2012/01/29 06:39:36 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.9 2012/01/29 06:40:57 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.8 2012/01/29 06:39:36 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.9 2012/01/29 06:40:57 dholland Exp $);
 
 #include sys/mount.h
 #include sys/quota.h
@@ -241,8 +241,25 @@ vfs_quotactl_get(struct mount *mp,
 		args.u.get.qc_q2type = q2type;
 		args.u.get.qc_id = id;
 		args.u.get.qc_defaultq = defaultq;
-		args.u.get.qc_blocks_ret = blocks;
-		args.u.get.qc_files_ret = files;
+		args.u.get.qc_objtype = QUOTA_OBJTYPE_BLOCKS;
+		args.u.get.qc_ret = blocks;
+		error = VFS_QUOTACTL(mp, QUOTACTL_GET, args);
+		if (error == EPERM) {
+			/* XXX does this make sense? */
+			continue;
+		} else if (error == ENOENT) {
+			/* XXX does *this* make sense? */
+			continue;
+		} else if (error) {
+			goto fail;
+		}
+
+		args.qc_type = QCT_GET;
+		args.u.get.qc_q2type = q2type;
+		args.u.get.qc_id = id;
+		args.u.get.qc_defaultq = defaultq;
+		args.u.get.qc_objtype = QUOTA_OBJTYPE_FILES;
+		args.u.get.qc_ret = files;
 		error = VFS_QUOTACTL(mp, QUOTACTL_GET, args);
 		if (error == EPERM) {
 			/* XXX does this make sense? */

Index: src/sys/sys/quota.h
diff -u src/sys/sys/quota.h:1.8 src/sys/sys/quota.h:1.9
--- src/sys/sys/quota.h:1.8	Sun Jan 29 06:38:23 2012
+++ src/sys/sys/quota.h	Sun Jan 29 06:40:57 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: quota.h,v 1.8 2012/01/29 06:38:23 dholland Exp $ */
+/* $NetBSD: quota.h,v 1.9 2012/01/29 06:40:57 dholland Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -30,9 +30,30 @@
 
 #include sys/types.h
 
+/* 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		((uint64_t)0xULL)
+
+/* time value for no time */
+#define QUOTA_NOTIME		((time_t)-1)
+
+
+struct quotakey {
+	int qk_idtype;
+	id_t qk_id;
+	int qk_objtype;
+};
+
 /*
  * Structure used to describe the value part of a quota record.
  */

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.6 src/sys/sys/quotactl.h:1.7
--- src/sys/sys/quotactl.h:1.6	Sun Jan 29 06:39:36 2012
+++ 

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:41:42 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c ufs_quota.h ufs_quota1.c ufs_quota2.c

Log Message:
Use struct quotakey with QUOTACTL_GET. Tidy up accordingly.

Step 5 of 5 for QUOTACTL_GET.

Note: this change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.7 -r1.8 src/sys/sys/quotactl.h
cvs rdiff -u -r1.77 -r1.78 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.4 -r1.5 src/sys/ufs/ufs/ufs_quota.h
cvs rdiff -u -r1.9 -r1.10 src/sys/ufs/ufs/ufs_quota1.c
cvs rdiff -u -r1.6 -r1.7 src/sys/ufs/ufs/ufs_quota2.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/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.9 src/sys/kern/vfs_quotactl.c:1.10
--- src/sys/kern/vfs_quotactl.c:1.9	Sun Jan 29 06:40:57 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 06:41:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.9 2012/01/29 06:40:57 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.10 2012/01/29 06:41:41 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.9 2012/01/29 06:40:57 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.10 2012/01/29 06:41:41 dholland Exp $);
 
 #include sys/mount.h
 #include sys/quota.h
@@ -167,19 +167,28 @@ vfs_quotactl_quotaoff(struct mount *mp,
 }
 
 static int
-vfs_quotactl_get_addreply(id_t id,
-			  int defaultq,
+vfs_quotactl_get_addreply(const struct quotakey *qk,
 			  const struct quotaval *blocks,
 			  const struct quotaval *files,
 			  prop_array_t replies)
 {
 	prop_dictionary_t dict;
+	id_t id;
+	int defaultq;
+	uint64_t *valuesp[QUOTA_NLIMITS];
 
 	/* XXX illegal casts */
-	uint64_t *valuesp[QUOTA_NLIMITS];
 	valuesp[QUOTA_LIMIT_BLOCK] = (void *)(intptr_t)blocks-qv_hardlimit;
 	valuesp[QUOTA_LIMIT_FILE] =  (void *)(intptr_t)files-qv_hardlimit;
 
+	if (qk-qk_id == QUOTA_DEFAULTID) {
+		id = 0;
+		defaultq = 1;
+	} else {
+		id = qk-qk_id;
+		defaultq = 0;
+	}
+
 	dict = quota64toprop(id, defaultq, valuesp,
 	ufs_quota_entry_names, UFS_QUOTA_NENTRIES,
 	ufs_quota_limit_names, QUOTA_NLIMITS);
@@ -195,16 +204,16 @@ vfs_quotactl_get_addreply(id_t id,
 
 static int
 vfs_quotactl_get(struct mount *mp,
-			prop_dictionary_t cmddict, int q2type,
+			prop_dictionary_t cmddict, int idtype,
 			prop_array_t datas)
 {
 	prop_object_iterator_t iter;
 	prop_dictionary_t data;
 	prop_array_t replies;
 	uint32_t id;
-	int defaultq;
 	const char *idstr;
 	struct vfs_quotactl_args args;
+	struct quotakey qk;
 	struct quotaval blocks, files;
 	int error;
 
@@ -223,6 +232,8 @@ vfs_quotactl_get(struct mount *mp,
 	}
 
 	while ((data = prop_object_iterator_next(iter)) != NULL) {
+		qk.qk_idtype = idtype;
+
 		if (!prop_dictionary_get_uint32(data, id, id)) {
 			if (!prop_dictionary_get_cstring_nocopy(data, id,
 			idstr))
@@ -231,17 +242,15 @@ vfs_quotactl_get(struct mount *mp,
 error = EINVAL;
 goto fail;
 			}
-			id = 0;
-			defaultq = 1;
+			qk.qk_id = QUOTA_DEFAULTID;
 		} else {
-			defaultq = 0;
+			qk.qk_id = id;
 		}
 
+		qk.qk_objtype = QUOTA_OBJTYPE_BLOCKS;
+
 		args.qc_type = QCT_GET;
-		args.u.get.qc_q2type = q2type;
-		args.u.get.qc_id = id;
-		args.u.get.qc_defaultq = defaultq;
-		args.u.get.qc_objtype = QUOTA_OBJTYPE_BLOCKS;
+		args.u.get.qc_key = qk;
 		args.u.get.qc_ret = blocks;
 		error = VFS_QUOTACTL(mp, QUOTACTL_GET, args);
 		if (error == EPERM) {
@@ -254,11 +263,10 @@ vfs_quotactl_get(struct mount *mp,
 			goto fail;
 		}
 
+		qk.qk_objtype = QUOTA_OBJTYPE_FILES;
+
 		args.qc_type = QCT_GET;
-		args.u.get.qc_q2type = q2type;
-		args.u.get.qc_id = id;
-		args.u.get.qc_defaultq = defaultq;
-		args.u.get.qc_objtype = QUOTA_OBJTYPE_FILES;
+		args.u.get.qc_key = qk;
 		args.u.get.qc_ret = files;
 		error = VFS_QUOTACTL(mp, QUOTACTL_GET, args);
 		if (error == EPERM) {
@@ -271,8 +279,7 @@ vfs_quotactl_get(struct mount *mp,
 			goto fail;
 		}
 
-		error = vfs_quotactl_get_addreply(id, defaultq,
-		  blocks, files,
+		error = vfs_quotactl_get_addreply(qk, blocks, files,
 		  replies);
 	}
 

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.7 src/sys/sys/quotactl.h:1.8
--- src/sys/sys/quotactl.h:1.7	Sun Jan 29 06:40:57 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 06:41:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.7 2012/01/29 06:40:57 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.8 2012/01/29 06:41:41 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -64,10 +64,7 @@ struct vfs_quotactl_args {
 			int *qc_version_ret;
 		} getversion;
 		struct {
-			int qc_q2type;
-			id_t qc_id;
-			int qc_defaultq;
-			int qc_objtype;
+			

CVS commit: src/sys/ufs/ufs

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:42:14 UTC 2012

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

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/ufs/ufs/ufs_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/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.78 src/sys/ufs/ufs/ufs_quota.c:1.79
--- src/sys/ufs/ufs/ufs_quota.c:1.78	Sun Jan 29 06:41:41 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 06:42:14 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.78 2012/01/29 06:41:41 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.79 2012/01/29 06:42:14 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.78 2012/01/29 06:41:41 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.79 2012/01/29 06:42:14 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -242,25 +242,23 @@ quota_handle_cmd_get(struct mount *mp, s
 	if ((ump-um_flags  (UFS_QUOTA|UFS_QUOTA2)) == 0)
 		return EOPNOTSUPP;
 	
-	/* avoid whitespace diffs */ {
-		error = quota_get_auth(mp, l, qk-qk_id);
-		if (error != 0) 
-			return error;
+	error = quota_get_auth(mp, l, qk-qk_id);
+	if (error != 0) 
+		return error;
 #ifdef QUOTA
-		if (ump-um_flags  UFS_QUOTA) {
-			error = quota1_handle_cmd_get(ump, qk, ret);
-		} else
+	if (ump-um_flags  UFS_QUOTA) {
+		error = quota1_handle_cmd_get(ump, qk, ret);
+	} else
 #endif
 #ifdef QUOTA2
-		if (ump-um_flags  UFS_QUOTA2) {
-			error = quota2_handle_cmd_get(ump, qk, ret);
-		} else
+	if (ump-um_flags  UFS_QUOTA2) {
+		error = quota2_handle_cmd_get(ump, qk, ret);
+	} else
 #endif
-			panic(quota_handle_cmd_get: no support ?);
+		panic(quota_handle_cmd_get: no support ?);
 		
-		if (error != 0)
-			return error;
-	}
+	if (error != 0)
+		return error;
 
 	return error;
 }



CVS commit: src/sys/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:43:34 UTC 2012

Modified Files:
src/sys/sys: quota.h

Log Message:
Improve comments.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/sys/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/sys/sys/quota.h
diff -u src/sys/sys/quota.h:1.9 src/sys/sys/quota.h:1.10
--- src/sys/sys/quota.h:1.9	Sun Jan 29 06:40:57 2012
+++ src/sys/sys/quota.h	Sun Jan 29 06:43:34 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: quota.h,v 1.9 2012/01/29 06:40:57 dholland Exp $ */
+/* $NetBSD: quota.h,v 1.10 2012/01/29 06:43:34 dholland Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -48,10 +48,13 @@
 #define QUOTA_NOTIME		((time_t)-1)
 
 
+/*
+ * Structure used to describe the key part of a quota record.
+ */
 struct quotakey {
-	int qk_idtype;
-	id_t qk_id;
-	int qk_objtype;
+	int qk_idtype;		/* type of id (user, group, etc.) */
+	id_t qk_id;		/* actual id number */
+	int qk_objtype;		/* type of fs object (blocks, files, etc.) */
 };
 
 /*



CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:44:33 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c

Log Message:
Move the top level iteration for QUOTACTL_SET from ufs to vfs_quotactl.

Note: this change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.8 -r1.9 src/sys/sys/quotactl.h
cvs rdiff -u -r1.79 -r1.80 src/sys/ufs/ufs/ufs_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/sys/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.10 src/sys/kern/vfs_quotactl.c:1.11
--- src/sys/kern/vfs_quotactl.c:1.10	Sun Jan 29 06:41:41 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 06:44:33 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.10 2012/01/29 06:41:41 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.11 2012/01/29 06:44:33 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.10 2012/01/29 06:41:41 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.11 2012/01/29 06:44:33 dholland Exp $);
 
 #include sys/mount.h
 #include sys/quota.h
@@ -303,13 +303,62 @@ vfs_quotactl_set(struct mount *mp,
 			prop_dictionary_t cmddict, int q2type,
 			prop_array_t datas)
 {
+	prop_array_t replies;
+	prop_object_iterator_t iter;
+	prop_dictionary_t data;
+	int defaultq;
+	uint32_t id;
+	const char *idstr;
 	struct vfs_quotactl_args args;
+	int error;
 
-	args.qc_type = QCT_PROPLIB;
-	args.u.proplib.qc_cmddict = cmddict;
-	args.u.proplib.qc_q2type = q2type;
-	args.u.proplib.qc_datas = datas;
-	return VFS_QUOTACTL(mp, QUOTACTL_SET, args);
+	KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY);
+	KASSERT(prop_object_type(datas) == PROP_TYPE_ARRAY);
+
+	replies = prop_array_create();
+	if (replies == NULL)
+		return ENOMEM;
+
+	iter = prop_array_iterator(datas);
+	if (iter == NULL) {
+		prop_object_release(replies);
+		return ENOMEM;
+	}
+
+	while ((data = prop_object_iterator_next(iter)) != NULL) {
+		if (!prop_dictionary_get_uint32(data, id, id)) {
+			if (!prop_dictionary_get_cstring_nocopy(data, id,
+			idstr))
+continue;
+			if (strcmp(idstr, default))
+continue;
+			id = 0;
+			defaultq = 1;
+		} else {
+			defaultq = 0;
+		}
+
+		args.qc_type = QCT_SET;
+		args.u.set.qc_id = id;
+		args.u.set.qc_defaultq = defaultq;
+		args.u.set.qc_q2type = q2type;
+		args.u.set.qc_data = data;
+		error = VFS_QUOTACTL(mp, QUOTACTL_SET, args);
+		if (error) {
+			goto err;
+		}
+	}
+	prop_object_iterator_release(iter);
+	if (!prop_dictionary_set_and_rel(cmddict, data, replies)) {
+		error = ENOMEM;
+	} else {
+		error = 0;
+	}
+	return error;
+err:
+	prop_object_iterator_release(iter);
+	prop_object_release(replies);
+	return error;
 }
 
 static int

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.8 src/sys/sys/quotactl.h:1.9
--- src/sys/sys/quotactl.h:1.8	Sun Jan 29 06:41:41 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 06:44:33 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.8 2012/01/29 06:41:41 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.9 2012/01/29 06:44:33 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -51,6 +51,7 @@ enum vfs_quotactl_argtypes {
 	QCT_PROPLIB,	/* quotaon/off, get, set, getall, clear */
 	QCT_GETVERSION,	/* getversion */
 	QCT_GET,	/* get */
+	QCT_SET,	/* set */
 };
 struct vfs_quotactl_args {
 	enum vfs_quotactl_argtypes qc_type;
@@ -67,6 +68,12 @@ struct vfs_quotactl_args {
 			const struct quotakey *qc_key;
 			struct quotaval *qc_ret;
 		} get;
+		struct {
+			id_t qc_id;
+			int qc_defaultq;
+			int qc_q2type;
+			prop_dictionary_t qc_data;
+		} set;
 	} u;
 };
 

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.79 src/sys/ufs/ufs/ufs_quota.c:1.80
--- src/sys/ufs/ufs/ufs_quota.c:1.79	Sun Jan 29 06:42:14 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 06:44:33 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.79 2012/01/29 06:42:14 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.80 2012/01/29 06:44:33 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.79 2012/01/29 06:42:14 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.80 2012/01/29 06:44:33 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -267,49 +267,26 @@ static int 
 quota_handle_cmd_set(struct mount *mp, struct lwp *l, 
 struct vfs_quotactl_args *args)
 {
-	prop_array_t replies;
-	prop_object_iterator_t iter;
-	prop_dictionary_t data;
-	uint32_t id;
 	struct ufsmount *ump = VFSTOUFS(mp);
-	int error, defaultq = 0;
-	const char *idstr;
-	prop_dictionary_t cmddict;
+	id_t id;
+	int 

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:45:26 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota1.c

Log Message:
Provide quota info to QUOTACTL_SET as two struct quotaval points
as well as via proplib.

Note: this change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.9 -r1.10 src/sys/sys/quotactl.h
cvs rdiff -u -r1.10 -r1.11 src/sys/ufs/ufs/ufs_quota1.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/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.11 src/sys/kern/vfs_quotactl.c:1.12
--- src/sys/kern/vfs_quotactl.c:1.11	Sun Jan 29 06:44:33 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 06:45:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.11 2012/01/29 06:44:33 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.12 2012/01/29 06:45:25 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.11 2012/01/29 06:44:33 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.12 2012/01/29 06:45:25 dholland Exp $);
 
 #include sys/mount.h
 #include sys/quota.h
@@ -299,6 +299,58 @@ vfs_quotactl_get(struct mount *mp,
 }
 
 static int
+vfs_quotactl_set_extractinfo(prop_dictionary_t data,
+			struct quotaval *blocks, struct quotaval *files)
+{
+	/*
+	 * 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. Most of
+	 * the existing code was unsafely casting struct quotaval
+	 * (formerly struct ufs_quota_entry) to (uint64_t *) and using
+	 * that as the block of 5 uint64s. Or worse, pointing to
+	 * subregions of that and reducing the number of uint64s to
+	 * pull adjacent values. Demons fly out of your nose!
+	 */
+
+	uint64_t bvals[UFS_QUOTA_NENTRIES];
+	uint64_t fvals[UFS_QUOTA_NENTRIES];
+	uint64_t *valptrs[QUOTA_NLIMITS];
+	int error;
+
+	valptrs[QUOTA_LIMIT_BLOCK] = bvals;
+	valptrs[QUOTA_LIMIT_FILE] = fvals;
+	error = proptoquota64(data, valptrs,
+			  ufs_quota_entry_names, UFS_QUOTA_NENTRIES,
+			  ufs_quota_limit_names, QUOTA_NLIMITS);
+	if (error) {
+		return error;
+	}
+
+	/*
+	 * There are no symbolic constants for these indexes!
+	 */
+
+	blocks-qv_hardlimit = bvals[0];
+	blocks-qv_softlimit = bvals[1];
+	blocks-qv_usage = bvals[2];
+	blocks-qv_expiretime = bvals[3];
+	blocks-qv_grace = bvals[4];
+	files-qv_hardlimit = fvals[0];
+	files-qv_softlimit = fvals[1];
+	files-qv_usage = fvals[2];
+	files-qv_expiretime = fvals[3];
+	files-qv_grace = fvals[4];
+
+	return 0;
+}
+
+static int
 vfs_quotactl_set(struct mount *mp,
 			prop_dictionary_t cmddict, int q2type,
 			prop_array_t datas)
@@ -309,6 +361,7 @@ vfs_quotactl_set(struct mount *mp,
 	int defaultq;
 	uint32_t id;
 	const char *idstr;
+	struct quotaval blocks, files;
 	struct vfs_quotactl_args args;
 	int error;
 
@@ -338,10 +391,17 @@ vfs_quotactl_set(struct mount *mp,
 			defaultq = 0;
 		}
 
+		error = vfs_quotactl_set_extractinfo(data, blocks, files);
+		if (error) {
+			goto err;
+		}
+
 		args.qc_type = QCT_SET;
 		args.u.set.qc_id = id;
 		args.u.set.qc_defaultq = defaultq;
 		args.u.set.qc_q2type = q2type;
+		args.u.set.qc_blocks = blocks;
+		args.u.set.qc_files = files;
 		args.u.set.qc_data = data;
 		error = VFS_QUOTACTL(mp, QUOTACTL_SET, args);
 		if (error) {

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.9 src/sys/sys/quotactl.h:1.10
--- src/sys/sys/quotactl.h:1.9	Sun Jan 29 06:44:33 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 06:45:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.9 2012/01/29 06:44:33 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.10 2012/01/29 06:45:26 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -72,6 +72,8 @@ struct vfs_quotactl_args {
 			id_t qc_id;
 			int qc_defaultq;
 			int qc_q2type;
+			const struct quotaval *qc_blocks;
+			const struct quotaval *qc_files;
 			prop_dictionary_t qc_data;
 		} set;
 	} u;

Index: src/sys/ufs/ufs/ufs_quota1.c
diff -u src/sys/ufs/ufs/ufs_quota1.c:1.10 src/sys/ufs/ufs/ufs_quota1.c:1.11
--- src/sys/ufs/ufs/ufs_quota1.c:1.10	Sun Jan 29 06:41:42 2012
+++ src/sys/ufs/ufs/ufs_quota1.c	Sun Jan 29 06:45:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota1.c,v 1.10 2012/01/29 06:41:42 dholland Exp $	*/
+/*	$NetBSD: ufs_quota1.c,v 1.11 2012/01/29 06:45:26 dholland Exp $	*/
 

CVS commit: src/sys/ufs/ufs

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:46:17 UTC 2012

Modified Files:
src/sys/ufs/ufs: ufs_quota.c ufs_quota.h ufs_quota1.c

Log Message:
For QUOTACTL_SET in quota1, use the quotaval data instead of proplib.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.5 -r1.6 src/sys/ufs/ufs/ufs_quota.h
cvs rdiff -u -r1.11 -r1.12 src/sys/ufs/ufs/ufs_quota1.c

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

Modified files:

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.80 src/sys/ufs/ufs/ufs_quota.c:1.81
--- src/sys/ufs/ufs/ufs_quota.c:1.80	Sun Jan 29 06:44:33 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 06:46:16 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.80 2012/01/29 06:44:33 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.81 2012/01/29 06:46:16 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.80 2012/01/29 06:44:33 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.81 2012/01/29 06:46:16 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -271,6 +271,8 @@ quota_handle_cmd_set(struct mount *mp, s
 	id_t id;
 	int defaultq;
 	int q2type;
+	const struct quotaval *blocks;
+	const struct quotaval *files;
 	prop_dictionary_t data;
 	int error;
 
@@ -278,6 +280,8 @@ quota_handle_cmd_set(struct mount *mp, s
 	id = args-u.set.qc_id;
 	defaultq = args-u.set.qc_defaultq;
 	q2type = args-u.set.qc_q2type;
+	blocks = args-u.set.qc_blocks;
+	files = args-u.set.qc_files;
 	data = args-u.set.qc_data;
 
 	KASSERT(prop_object_type(data) == PROP_TYPE_DICTIONARY);
@@ -294,7 +298,7 @@ quota_handle_cmd_set(struct mount *mp, s
 #ifdef QUOTA
 		if (ump-um_flags  UFS_QUOTA)
 			error = quota1_handle_cmd_set(ump, q2type, id, defaultq,
-			data);
+			blocks, files);
 		else
 #endif
 #ifdef QUOTA2

Index: src/sys/ufs/ufs/ufs_quota.h
diff -u src/sys/ufs/ufs/ufs_quota.h:1.5 src/sys/ufs/ufs/ufs_quota.h:1.6
--- src/sys/ufs/ufs/ufs_quota.h:1.5	Sun Jan 29 06:41:41 2012
+++ src/sys/ufs/ufs/ufs_quota.h	Sun Jan 29 06:46:16 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.h,v 1.5 2012/01/29 06:41:41 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.h,v 1.6 2012/01/29 06:46:16 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -115,7 +115,8 @@ int dq1get(struct vnode *, u_long, struc
 int dq1sync(struct vnode *, struct dquot *);
 int quota1_handle_cmd_get(struct ufsmount *, const struct quotakey *,
 struct quotaval *);
-int quota1_handle_cmd_set(struct ufsmount *, int, int, int, prop_dictionary_t);
+int quota1_handle_cmd_set(struct ufsmount *, int, int, int,
+const struct quotaval *, const struct quotaval *);
 int quota1_handle_cmd_quotaon(struct lwp *, struct ufsmount *, int,
 const char *);
 int quota1_handle_cmd_quotaoff(struct lwp *, struct ufsmount *, int);

Index: src/sys/ufs/ufs/ufs_quota1.c
diff -u src/sys/ufs/ufs/ufs_quota1.c:1.11 src/sys/ufs/ufs/ufs_quota1.c:1.12
--- src/sys/ufs/ufs/ufs_quota1.c:1.11	Sun Jan 29 06:45:26 2012
+++ src/sys/ufs/ufs/ufs_quota1.c	Sun Jan 29 06:46:16 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota1.c,v 1.11 2012/01/29 06:45:26 dholland Exp $	*/
+/*	$NetBSD: ufs_quota1.c,v 1.12 2012/01/29 06:46:16 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota1.c,v 1.11 2012/01/29 06:45:26 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota1.c,v 1.12 2012/01/29 06:46:16 dholland Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -543,25 +543,22 @@ quota1_handle_cmd_get(struct ufsmount *u
 	return 0;
 }
 
+static uint32_t
+quota1_encode_limit(uint64_t lim)
+{
+	if (lim == QUOTA_NOLIMIT || lim = 0x) {
+		return 0;
+	}
+	return lim;
+}
+
 int
 quota1_handle_cmd_set(struct ufsmount *ump, int type, int id,
-int defaultq, prop_dictionary_t data)
+int defaultq, const struct quotaval *blocks, const struct quotaval *files)
 {
 	struct dquot *dq;
 	struct dqblk dqb;
 	int error;
-	uint64_t bval[2];
-	uint64_t ival[2];
-	const char *val_limitsonly_grace[] = {QUOTADICT_LIMIT_GTIME};
-#define Q1_GTIME 0
-	const char *val_limitsonly_softhard[] =
-	{QUOTADICT_LIMIT_SOFT, QUOTADICT_LIMIT_HARD};
-#define Q1_SOFT 0
-#define Q1_HARD 1
-
-	uint64_t *valuesp[QUOTA_NLIMITS];
-	valuesp[QUOTA_LIMIT_BLOCK] = bval;
-	valuesp[QUOTA_LIMIT_FILE] = ival;
 
 	if (ump-um_quotas[type] == NULLVP)
 		return ENODEV;
@@ -569,28 +566,20 @@ quota1_handle_cmd_set(struct ufsmount *u
 	if (defaultq) {
 		/* just update grace times */
 		KASSERT(id == 0);
-		error = proptoquota64(data, valuesp, val_limitsonly_grace, 1,
-		ufs_quota_limit_names, QUOTA_NLIMITS);
-		if (error)
-			return error;
 		if ((error = dqget(NULLVP, id, ump, type, dq)) != 0)
 			return error;
 		

CVS commit: src/sys/ufs/ufs

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:46:50 UTC 2012

Modified Files:
src/sys/ufs/ufs: ufs_quota.c ufs_quota.h ufs_quota2.c

Log Message:
For QUOTACTL_SET in quota2, use the quotaval data instead of proplib.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.6 -r1.7 src/sys/ufs/ufs/ufs_quota.h
cvs rdiff -u -r1.7 -r1.8 src/sys/ufs/ufs/ufs_quota2.c

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

Modified files:

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.81 src/sys/ufs/ufs/ufs_quota.c:1.82
--- src/sys/ufs/ufs/ufs_quota.c:1.81	Sun Jan 29 06:46:16 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 06:46:49 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.81 2012/01/29 06:46:16 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.82 2012/01/29 06:46:49 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.81 2012/01/29 06:46:16 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.82 2012/01/29 06:46:49 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -304,7 +304,7 @@ quota_handle_cmd_set(struct mount *mp, s
 #ifdef QUOTA2
 		if (ump-um_flags  UFS_QUOTA2) {
 			error = quota2_handle_cmd_set(ump, q2type, id, defaultq,
-			data);
+			blocks, files);
 		} else
 #endif
 			panic(quota_handle_cmd_get: no support ?);

Index: src/sys/ufs/ufs/ufs_quota.h
diff -u src/sys/ufs/ufs/ufs_quota.h:1.6 src/sys/ufs/ufs/ufs_quota.h:1.7
--- src/sys/ufs/ufs/ufs_quota.h:1.6	Sun Jan 29 06:46:16 2012
+++ src/sys/ufs/ufs/ufs_quota.h	Sun Jan 29 06:46:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.h,v 1.6 2012/01/29 06:46:16 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.h,v 1.7 2012/01/29 06:46:50 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -125,7 +125,8 @@ int chkdq2(struct inode *, int64_t, kaut
 int chkiq2(struct inode *, int32_t, kauth_cred_t, int);
 int quota2_handle_cmd_get(struct ufsmount *, const struct quotakey *,
 struct quotaval *);
-int quota2_handle_cmd_set(struct ufsmount *, int, int, int, prop_dictionary_t);
+int quota2_handle_cmd_set(struct ufsmount *, int, int, int,
+const struct quotaval *, const struct quotaval *);
 int quota2_handle_cmd_clear(struct ufsmount *, int, int, int, prop_dictionary_t);
 int quota2_handle_cmd_getall(struct ufsmount *, int, prop_array_t);
 int q2sync(struct mount *);

Index: src/sys/ufs/ufs/ufs_quota2.c
diff -u src/sys/ufs/ufs/ufs_quota2.c:1.7 src/sys/ufs/ufs/ufs_quota2.c:1.8
--- src/sys/ufs/ufs/ufs_quota2.c:1.7	Sun Jan 29 06:41:42 2012
+++ src/sys/ufs/ufs/ufs_quota2.c	Sun Jan 29 06:46:50 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota2.c,v 1.7 2012/01/29 06:41:42 dholland Exp $ */
+/* $NetBSD: ufs_quota2.c,v 1.8 2012/01/29 06:46:50 dholland Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -26,7 +26,7 @@
   */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.7 2012/01/29 06:41:42 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.8 2012/01/29 06:46:50 dholland Exp $);
 
 #include sys/buf.h
 #include sys/param.h
@@ -74,32 +74,24 @@ static int quota2_walk_list(struct ufsmo
 int (*func)(struct ufsmount *, uint64_t *, struct quota2_entry *,
   uint64_t, void *));
 
-static int quota2_dict_update_q2e_limits(prop_dictionary_t,
-struct quota2_entry *);
 static prop_dictionary_t q2etoprop(struct quota2_entry *, int);
 
 static const char *limnames[] = INITQLNAMES;
 
-static int
-quota2_dict_update_q2e_limits(prop_dictionary_t data,
+static void
+quota2_dict_update_q2e_limits(const struct quotaval *blocks,
+const struct quotaval *files,
 struct quota2_entry *q2e)
 {
-	const char *val_limitsonly_names[] = INITQVNAMES_LIMITSONLY;
-
-	int i, error;
-	prop_dictionary_t val;
-
-	for (i = 0; i  N_QL; i++) {
-		if (!prop_dictionary_get_dict(data, limnames[i], val))
-			return EINVAL;
-		error = quotaprop_dict_get_uint64(val,
-		q2e-q2e_val[i].q2v_hardlimit,
-		val_limitsonly_names, N_QV, true);
-		if (error)
-			return error;
-	}
-	return 0;
+	q2e-q2e_val[QL_BLOCK].q2v_hardlimit = blocks-qv_hardlimit;
+	q2e-q2e_val[QL_BLOCK].q2v_softlimit = blocks-qv_softlimit;
+	q2e-q2e_val[QL_BLOCK].q2v_grace = blocks-qv_grace;
+
+	q2e-q2e_val[QL_FILE].q2v_hardlimit = blocks-qv_hardlimit;
+	q2e-q2e_val[QL_FILE].q2v_softlimit = blocks-qv_softlimit;
+	q2e-q2e_val[QL_FILE].q2v_grace = blocks-qv_grace;
 }
+
 static prop_dictionary_t
 q2etoprop(struct quota2_entry *q2e, int def)
 {
@@ -621,7 +613,7 @@ chkiq2(struct inode *ip, int32_t change,
 
 int
 quota2_handle_cmd_set(struct ufsmount *ump, int type, int id,
-int defaultq, prop_dictionary_t data)
+int defaultq, const struct quotaval *blocks, const struct quotaval *files)
 {
 	int error;
 	struct dquot *dq;
@@ -644,12 

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:47:38 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c ufs_quota.h ufs_quota1.c ufs_quota2.c

Log Message:
Pass only one objtype and its quotaval to QUOTACTL_SET at one time.

(The backend code to handle this is a lot tidier than I expected given
that the proplib code doesn't allow setting blocks and files
independently; I was afraid there would turn out to be a reason for
that...)

Note: this change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.10 -r1.11 src/sys/sys/quotactl.h
cvs rdiff -u -r1.82 -r1.83 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.7 -r1.8 src/sys/ufs/ufs/ufs_quota.h
cvs rdiff -u -r1.12 -r1.13 src/sys/ufs/ufs/ufs_quota1.c
cvs rdiff -u -r1.8 -r1.9 src/sys/ufs/ufs/ufs_quota2.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/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.12 src/sys/kern/vfs_quotactl.c:1.13
--- src/sys/kern/vfs_quotactl.c:1.12	Sun Jan 29 06:45:25 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 06:47:38 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.12 2012/01/29 06:45:25 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.13 2012/01/29 06:47:38 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.12 2012/01/29 06:45:25 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.13 2012/01/29 06:47:38 dholland Exp $);
 
 #include sys/mount.h
 #include sys/quota.h
@@ -379,6 +379,9 @@ vfs_quotactl_set(struct mount *mp,
 	}
 
 	while ((data = prop_object_iterator_next(iter)) != NULL) {
+
+		KASSERT(prop_object_type(data) == PROP_TYPE_DICTIONARY);
+
 		if (!prop_dictionary_get_uint32(data, id, id)) {
 			if (!prop_dictionary_get_cstring_nocopy(data, id,
 			idstr))
@@ -397,12 +400,22 @@ vfs_quotactl_set(struct mount *mp,
 		}
 
 		args.qc_type = QCT_SET;
+		args.u.set.qc_idtype = q2type;
+		args.u.set.qc_id = id;
+		args.u.set.qc_defaultq = defaultq;
+		args.u.set.qc_objtype = QUOTA_OBJTYPE_BLOCKS;
+		args.u.set.qc_val = blocks;
+		error = VFS_QUOTACTL(mp, QUOTACTL_SET, args);
+		if (error) {
+			goto err;
+		}
+
+		args.qc_type = QCT_SET;
+		args.u.set.qc_idtype = q2type;
 		args.u.set.qc_id = id;
 		args.u.set.qc_defaultq = defaultq;
-		args.u.set.qc_q2type = q2type;
-		args.u.set.qc_blocks = blocks;
-		args.u.set.qc_files = files;
-		args.u.set.qc_data = data;
+		args.u.set.qc_objtype = QUOTA_OBJTYPE_FILES;
+		args.u.set.qc_val = files;
 		error = VFS_QUOTACTL(mp, QUOTACTL_SET, args);
 		if (error) {
 			goto err;

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.10 src/sys/sys/quotactl.h:1.11
--- src/sys/sys/quotactl.h:1.10	Sun Jan 29 06:45:26 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 06:47:38 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.10 2012/01/29 06:45:26 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.11 2012/01/29 06:47:38 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -69,12 +69,11 @@ struct vfs_quotactl_args {
 			struct quotaval *qc_ret;
 		} get;
 		struct {
+			int qc_idtype;
 			id_t qc_id;
 			int qc_defaultq;
-			int qc_q2type;
-			const struct quotaval *qc_blocks;
-			const struct quotaval *qc_files;
-			prop_dictionary_t qc_data;
+			int qc_objtype;
+			const struct quotaval *qc_val;
 		} set;
 	} u;
 };

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.82 src/sys/ufs/ufs/ufs_quota.c:1.83
--- src/sys/ufs/ufs/ufs_quota.c:1.82	Sun Jan 29 06:46:49 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 06:47:38 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.82 2012/01/29 06:46:49 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.83 2012/01/29 06:47:38 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.82 2012/01/29 06:46:49 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.83 2012/01/29 06:47:38 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -268,23 +268,19 @@ quota_handle_cmd_set(struct mount *mp, s
 struct vfs_quotactl_args *args)
 {
 	struct ufsmount *ump = VFSTOUFS(mp);
+	int idtype;
 	id_t id;
 	int defaultq;
-	int q2type;
-	const struct quotaval *blocks;
-	const struct quotaval *files;
-	prop_dictionary_t data;
+	int objtype;
+	const struct quotaval *qv;
 	int error;
 
 	KASSERT(args-qc_type == QCT_SET);
+	idtype = args-u.set.qc_idtype;
 	id = args-u.set.qc_id;
 	defaultq = args-u.set.qc_defaultq;
-	q2type = args-u.set.qc_q2type;
-	blocks = args-u.set.qc_blocks;
-	files = args-u.set.qc_files;
-	data = args-u.set.qc_data;
-
-	KASSERT(prop_object_type(data) == 

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:48:51 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c ufs_quota.h ufs_quota1.c ufs_quota2.c

Log Message:
Combine the miscellaneous QUOTACTL_SET args into a struct quotakey.

Note: this change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.11 -r1.12 src/sys/sys/quotactl.h
cvs rdiff -u -r1.83 -r1.84 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.8 -r1.9 src/sys/ufs/ufs/ufs_quota.h
cvs rdiff -u -r1.13 -r1.14 src/sys/ufs/ufs/ufs_quota1.c
cvs rdiff -u -r1.9 -r1.10 src/sys/ufs/ufs/ufs_quota2.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/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.13 src/sys/kern/vfs_quotactl.c:1.14
--- src/sys/kern/vfs_quotactl.c:1.13	Sun Jan 29 06:47:38 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 06:48:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.13 2012/01/29 06:47:38 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.14 2012/01/29 06:48:50 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.13 2012/01/29 06:47:38 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.14 2012/01/29 06:48:50 dholland Exp $);
 
 #include sys/mount.h
 #include sys/quota.h
@@ -361,6 +361,7 @@ vfs_quotactl_set(struct mount *mp,
 	int defaultq;
 	uint32_t id;
 	const char *idstr;
+	struct quotakey qk;
 	struct quotaval blocks, files;
 	struct vfs_quotactl_args args;
 	int error;
@@ -399,22 +400,24 @@ vfs_quotactl_set(struct mount *mp,
 			goto err;
 		}
 
+		qk.qk_idtype = q2type;
+		qk.qk_id = defaultq ? QUOTA_DEFAULTID : id;
+		qk.qk_objtype = QUOTA_OBJTYPE_BLOCKS;
+
 		args.qc_type = QCT_SET;
-		args.u.set.qc_idtype = q2type;
-		args.u.set.qc_id = id;
-		args.u.set.qc_defaultq = defaultq;
-		args.u.set.qc_objtype = QUOTA_OBJTYPE_BLOCKS;
+		args.u.set.qc_key = qk;
 		args.u.set.qc_val = blocks;
 		error = VFS_QUOTACTL(mp, QUOTACTL_SET, args);
 		if (error) {
 			goto err;
 		}
 
+		qk.qk_idtype = q2type;
+		qk.qk_id = defaultq ? QUOTA_DEFAULTID : id;
+		qk.qk_objtype = QUOTA_OBJTYPE_FILES;
+
 		args.qc_type = QCT_SET;
-		args.u.set.qc_idtype = q2type;
-		args.u.set.qc_id = id;
-		args.u.set.qc_defaultq = defaultq;
-		args.u.set.qc_objtype = QUOTA_OBJTYPE_FILES;
+		args.u.set.qc_key = qk;
 		args.u.set.qc_val = files;
 		error = VFS_QUOTACTL(mp, QUOTACTL_SET, args);
 		if (error) {

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.11 src/sys/sys/quotactl.h:1.12
--- src/sys/sys/quotactl.h:1.11	Sun Jan 29 06:47:38 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 06:48:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.11 2012/01/29 06:47:38 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.12 2012/01/29 06:48:50 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -69,10 +69,7 @@ struct vfs_quotactl_args {
 			struct quotaval *qc_ret;
 		} get;
 		struct {
-			int qc_idtype;
-			id_t qc_id;
-			int qc_defaultq;
-			int qc_objtype;
+			const struct quotakey *qc_key;
 			const struct quotaval *qc_val;
 		} set;
 	} u;

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.83 src/sys/ufs/ufs/ufs_quota.c:1.84
--- src/sys/ufs/ufs/ufs_quota.c:1.83	Sun Jan 29 06:47:38 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 06:48:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.83 2012/01/29 06:47:38 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.84 2012/01/29 06:48:50 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.83 2012/01/29 06:47:38 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.84 2012/01/29 06:48:50 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -268,39 +268,38 @@ quota_handle_cmd_set(struct mount *mp, s
 struct vfs_quotactl_args *args)
 {
 	struct ufsmount *ump = VFSTOUFS(mp);
-	int idtype;
-	id_t id;
-	int defaultq;
-	int objtype;
+	const struct quotakey *qk;
 	const struct quotaval *qv;
+	id_t kauth_id;
 	int error;
 
 	KASSERT(args-qc_type == QCT_SET);
-	idtype = args-u.set.qc_idtype;
-	id = args-u.set.qc_id;
-	defaultq = args-u.set.qc_defaultq;
-	objtype = args-u.set.qc_objtype;
+	qk = args-u.set.qc_key;
 	qv = args-u.set.qc_val;
 
 	if ((ump-um_flags  (UFS_QUOTA|UFS_QUOTA2)) == 0)
 		return EOPNOTSUPP;
 
+	kauth_id = qk-qk_id;
+	if (kauth_id == QUOTA_DEFAULTID) {
+		kauth_id = 0;
+	}
+
 	/* avoid whitespace changes */
 	{
 		error = kauth_authorize_system(l-l_cred, KAUTH_SYSTEM_FS_QUOTA,
-		KAUTH_REQ_SYSTEM_FS_QUOTA_MANAGE, mp, KAUTH_ARG(id), NULL);
+		KAUTH_REQ_SYSTEM_FS_QUOTA_MANAGE, mp, 

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:49:44 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c ufs_quota.h ufs_quota1.c ufs_quota2.c

Log Message:
Rename QUOTACTL_SET to QUOTACTL_PUT, to match future intended API.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.12 -r1.13 src/sys/sys/quotactl.h
cvs rdiff -u -r1.84 -r1.85 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.9 -r1.10 src/sys/ufs/ufs/ufs_quota.h
cvs rdiff -u -r1.14 -r1.15 src/sys/ufs/ufs/ufs_quota1.c
cvs rdiff -u -r1.10 -r1.11 src/sys/ufs/ufs/ufs_quota2.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/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.14 src/sys/kern/vfs_quotactl.c:1.15
--- src/sys/kern/vfs_quotactl.c:1.14	Sun Jan 29 06:48:50 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 06:49:43 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.14 2012/01/29 06:48:50 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.15 2012/01/29 06:49:43 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.14 2012/01/29 06:48:50 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.15 2012/01/29 06:49:43 dholland Exp $);
 
 #include sys/mount.h
 #include sys/quota.h
@@ -299,7 +299,7 @@ vfs_quotactl_get(struct mount *mp,
 }
 
 static int
-vfs_quotactl_set_extractinfo(prop_dictionary_t data,
+vfs_quotactl_put_extractinfo(prop_dictionary_t data,
 			struct quotaval *blocks, struct quotaval *files)
 {
 	/*
@@ -351,7 +351,7 @@ vfs_quotactl_set_extractinfo(prop_dictio
 }
 
 static int
-vfs_quotactl_set(struct mount *mp,
+vfs_quotactl_put(struct mount *mp,
 			prop_dictionary_t cmddict, int q2type,
 			prop_array_t datas)
 {
@@ -395,7 +395,7 @@ vfs_quotactl_set(struct mount *mp,
 			defaultq = 0;
 		}
 
-		error = vfs_quotactl_set_extractinfo(data, blocks, files);
+		error = vfs_quotactl_put_extractinfo(data, blocks, files);
 		if (error) {
 			goto err;
 		}
@@ -404,10 +404,10 @@ vfs_quotactl_set(struct mount *mp,
 		qk.qk_id = defaultq ? QUOTA_DEFAULTID : id;
 		qk.qk_objtype = QUOTA_OBJTYPE_BLOCKS;
 
-		args.qc_type = QCT_SET;
-		args.u.set.qc_key = qk;
-		args.u.set.qc_val = blocks;
-		error = VFS_QUOTACTL(mp, QUOTACTL_SET, args);
+		args.qc_type = QCT_PUT;
+		args.u.put.qc_key = qk;
+		args.u.put.qc_val = blocks;
+		error = VFS_QUOTACTL(mp, QUOTACTL_PUT, args);
 		if (error) {
 			goto err;
 		}
@@ -416,10 +416,10 @@ vfs_quotactl_set(struct mount *mp,
 		qk.qk_id = defaultq ? QUOTA_DEFAULTID : id;
 		qk.qk_objtype = QUOTA_OBJTYPE_FILES;
 
-		args.qc_type = QCT_SET;
-		args.u.set.qc_key = qk;
-		args.u.set.qc_val = files;
-		error = VFS_QUOTACTL(mp, QUOTACTL_SET, args);
+		args.qc_type = QCT_PUT;
+		args.u.put.qc_key = qk;
+		args.u.put.qc_val = files;
+		error = VFS_QUOTACTL(mp, QUOTACTL_PUT, args);
 		if (error) {
 			goto err;
 		}
@@ -503,7 +503,7 @@ vfs_quotactl_cmd(struct mount *mp, prop_
 	} else if (strcmp(cmd, get) == 0) {
 		error = vfs_quotactl_get(mp, cmddict, q2type, datas);
 	} else if (strcmp(cmd, set) == 0) {
-		error = vfs_quotactl_set(mp, cmddict, q2type, datas);
+		error = vfs_quotactl_put(mp, cmddict, q2type, datas);
 	} else if (strcmp(cmd, getall) == 0) {
 		error = vfs_quotactl_getall(mp, cmddict, q2type, datas);
 	} else if (strcmp(cmd, clear) == 0) {

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.12 src/sys/sys/quotactl.h:1.13
--- src/sys/sys/quotactl.h:1.12	Sun Jan 29 06:48:50 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 06:49:43 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.12 2012/01/29 06:48:50 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.13 2012/01/29 06:49:43 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -42,7 +42,7 @@
 #define QUOTACTL_QUOTAON	1
 #define QUOTACTL_QUOTAOFF	2
 #define QUOTACTL_GET		3
-#define QUOTACTL_SET		4
+#define QUOTACTL_PUT		4
 #define QUOTACTL_GETALL		5
 #define QUOTACTL_CLEAR		6
 
@@ -51,7 +51,7 @@ enum vfs_quotactl_argtypes {
 	QCT_PROPLIB,	/* quotaon/off, get, set, getall, clear */
 	QCT_GETVERSION,	/* getversion */
 	QCT_GET,	/* get */
-	QCT_SET,	/* set */
+	QCT_PUT,	/* put */
 };
 struct vfs_quotactl_args {
 	enum vfs_quotactl_argtypes qc_type;
@@ -71,7 +71,7 @@ struct vfs_quotactl_args {
 		struct {
 			const struct quotakey *qc_key;
 			const struct quotaval *qc_val;
-		} set;
+		} put;
 	} u;
 };
 

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.84 src/sys/ufs/ufs/ufs_quota.c:1.85
--- src/sys/ufs/ufs/ufs_quota.c:1.84	Sun Jan 29 06:48:50 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 06:49:43 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.84 2012/01/29 06:48:50 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.85 

CVS commit: src/sys/ufs/ufs

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:50:15 UTC 2012

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

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/ufs/ufs/ufs_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/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.85 src/sys/ufs/ufs/ufs_quota.c:1.86
--- src/sys/ufs/ufs/ufs_quota.c:1.85	Sun Jan 29 06:49:43 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 06:50:15 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.85 2012/01/29 06:49:43 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.86 2012/01/29 06:50:15 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.85 2012/01/29 06:49:43 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.86 2012/01/29 06:50:15 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -285,28 +285,25 @@ quota_handle_cmd_put(struct mount *mp, s
 		kauth_id = 0;
 	}
 
-	/* avoid whitespace changes */
-	{
-		error = kauth_authorize_system(l-l_cred, KAUTH_SYSTEM_FS_QUOTA,
-		KAUTH_REQ_SYSTEM_FS_QUOTA_MANAGE, mp, KAUTH_ARG(kauth_id),
-		NULL);
-		if (error != 0)
-			goto err;
+	error = kauth_authorize_system(l-l_cred, KAUTH_SYSTEM_FS_QUOTA,
+	KAUTH_REQ_SYSTEM_FS_QUOTA_MANAGE, mp, KAUTH_ARG(kauth_id),
+	NULL);
+	if (error != 0)
+		goto err;
 #ifdef QUOTA
-		if (ump-um_flags  UFS_QUOTA)
-			error = quota1_handle_cmd_put(ump, qk, qv);
-		else
+	if (ump-um_flags  UFS_QUOTA)
+		error = quota1_handle_cmd_put(ump, qk, qv);
+	else
 #endif
 #ifdef QUOTA2
-		if (ump-um_flags  UFS_QUOTA2) {
-			error = quota2_handle_cmd_put(ump, qk, qv);
-		} else
+	if (ump-um_flags  UFS_QUOTA2) {
+		error = quota2_handle_cmd_put(ump, qk, qv);
+	} else
 #endif
-			panic(quota_handle_cmd_get: no support ?);
+		panic(quota_handle_cmd_get: no support ?);
 		
-		if (error  error != ENOENT)
-			goto err;
-	}
+	if (error  error != ENOENT)
+		goto err;
 
 	return 0;
  err:



CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:51:43 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c

Log Message:
Move toplevel proplib iteration of QUOTACTL_CLEAR to fs-independent code.

Note: this change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.13 -r1.14 src/sys/sys/quotactl.h
cvs rdiff -u -r1.87 -r1.88 src/sys/ufs/ufs/ufs_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/sys/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.15 src/sys/kern/vfs_quotactl.c:1.16
--- src/sys/kern/vfs_quotactl.c:1.15	Sun Jan 29 06:49:43 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 06:51:42 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.15 2012/01/29 06:49:43 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.16 2012/01/29 06:51:42 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.15 2012/01/29 06:49:43 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.16 2012/01/29 06:51:42 dholland Exp $);
 
 #include sys/mount.h
 #include sys/quota.h
@@ -456,13 +456,63 @@ vfs_quotactl_clear(struct mount *mp,
 			prop_dictionary_t cmddict, int q2type,
 			prop_array_t datas)
 {
+	prop_array_t replies;
+	prop_object_iterator_t iter;
+	prop_dictionary_t data;
+	uint32_t id;
+	int defaultq;
+	const char *idstr;
 	struct vfs_quotactl_args args;
+	int error;
 
-	args.qc_type = QCT_PROPLIB;
-	args.u.proplib.qc_cmddict = cmddict;
-	args.u.proplib.qc_q2type = q2type;
-	args.u.proplib.qc_datas = datas;
-	return VFS_QUOTACTL(mp, QUOTACTL_CLEAR, args);
+	KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY);
+	KASSERT(prop_object_type(datas) == PROP_TYPE_ARRAY);
+
+	replies = prop_array_create();
+	if (replies == NULL)
+		return ENOMEM;
+
+	iter = prop_array_iterator(datas);
+	if (iter == NULL) {
+		prop_object_release(replies);
+		return ENOMEM;
+	}
+
+	while ((data = prop_object_iterator_next(iter)) != NULL) {
+		if (!prop_dictionary_get_uint32(data, id, id)) {
+			if (!prop_dictionary_get_cstring_nocopy(data, id,
+			idstr))
+continue;
+			if (strcmp(idstr, default))
+continue;
+			id = 0;
+			defaultq = 1;
+		} else {
+			defaultq = 0;
+		}
+
+		args.qc_type = QCT_CLEAR;
+		args.u.clear.qc_idtype = q2type;
+		args.u.clear.qc_id = id;
+		args.u.clear.qc_defaultq = defaultq;
+		args.u.clear.qc_data = data;
+		error = VFS_QUOTACTL(mp, QUOTACTL_CLEAR, args);
+		if (error) {
+			goto err;
+		}
+	}
+
+	prop_object_iterator_release(iter);
+	if (!prop_dictionary_set_and_rel(cmddict, data, replies)) {
+		error = ENOMEM;
+	} else {
+		error = 0;
+	}
+	return error;
+err:
+	prop_object_iterator_release(iter);
+	prop_object_release(replies);
+	return error;
 }
 
 static int

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.13 src/sys/sys/quotactl.h:1.14
--- src/sys/sys/quotactl.h:1.13	Sun Jan 29 06:49:43 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 06:51:43 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.13 2012/01/29 06:49:43 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.14 2012/01/29 06:51:43 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -52,6 +52,7 @@ enum vfs_quotactl_argtypes {
 	QCT_GETVERSION,	/* getversion */
 	QCT_GET,	/* get */
 	QCT_PUT,	/* put */
+	QCT_CLEAR,	/* clear */
 };
 struct vfs_quotactl_args {
 	enum vfs_quotactl_argtypes qc_type;
@@ -72,6 +73,12 @@ struct vfs_quotactl_args {
 			const struct quotakey *qc_key;
 			const struct quotaval *qc_val;
 		} put;
+		struct {
+			int qc_idtype;
+			id_t qc_id;
+			int qc_defaultq;
+			prop_dictionary_t qc_data;
+		} clear;
 	} u;
 };
 

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.87 src/sys/ufs/ufs/ufs_quota.c:1.88
--- src/sys/ufs/ufs/ufs_quota.c:1.87	Sun Jan 29 06:50:53 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 06:51:43 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.87 2012/01/29 06:50:53 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.88 2012/01/29 06:51:43 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.87 2012/01/29 06:50:53 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.88 2012/01/29 06:51:43 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -315,56 +315,33 @@ static int 
 quota_handle_cmd_clear(struct mount *mp, struct lwp *l, 
 struct vfs_quotactl_args *args)
 {
-	prop_array_t replies;
-	prop_object_iterator_t iter;
-	prop_dictionary_t data;
-	uint32_t id;
 	struct ufsmount *ump = VFSTOUFS(mp);
-	int error, defaultq = 0;
-	const char *idstr;
-	prop_dictionary_t cmddict;
-	int q2type;

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:52:39 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c ufs_quota.h ufs_quota2.c

Log Message:
The handling of QUOTACTL_CLEAR does not use the proplib data
dictionary, so don't pass it.

Note: this change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.14 -r1.15 src/sys/sys/quotactl.h
cvs rdiff -u -r1.88 -r1.89 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.10 -r1.11 src/sys/ufs/ufs/ufs_quota.h
cvs rdiff -u -r1.11 -r1.12 src/sys/ufs/ufs/ufs_quota2.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/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.16 src/sys/kern/vfs_quotactl.c:1.17
--- src/sys/kern/vfs_quotactl.c:1.16	Sun Jan 29 06:51:42 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 06:52:38 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.16 2012/01/29 06:51:42 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.17 2012/01/29 06:52:38 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.16 2012/01/29 06:51:42 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.17 2012/01/29 06:52:38 dholland Exp $);
 
 #include sys/mount.h
 #include sys/quota.h
@@ -495,7 +495,6 @@ vfs_quotactl_clear(struct mount *mp,
 		args.u.clear.qc_idtype = q2type;
 		args.u.clear.qc_id = id;
 		args.u.clear.qc_defaultq = defaultq;
-		args.u.clear.qc_data = data;
 		error = VFS_QUOTACTL(mp, QUOTACTL_CLEAR, args);
 		if (error) {
 			goto err;

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.14 src/sys/sys/quotactl.h:1.15
--- src/sys/sys/quotactl.h:1.14	Sun Jan 29 06:51:43 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 06:52:39 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.14 2012/01/29 06:51:43 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.15 2012/01/29 06:52:39 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -77,7 +77,6 @@ struct vfs_quotactl_args {
 			int qc_idtype;
 			id_t qc_id;
 			int qc_defaultq;
-			prop_dictionary_t qc_data;
 		} clear;
 	} u;
 };

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.88 src/sys/ufs/ufs/ufs_quota.c:1.89
--- src/sys/ufs/ufs/ufs_quota.c:1.88	Sun Jan 29 06:51:43 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 06:52:39 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.88 2012/01/29 06:51:43 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.89 2012/01/29 06:52:39 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.88 2012/01/29 06:51:43 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.89 2012/01/29 06:52:39 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -319,16 +319,12 @@ quota_handle_cmd_clear(struct mount *mp,
 	int idtype;
 	id_t id;
 	int defaultq;
-	prop_dictionary_t data;
 	int error;
 
 	KASSERT(args-qc_type == QCT_CLEAR);
 	idtype = args-u.clear.qc_idtype;
 	id = args-u.clear.qc_id;
 	defaultq = args-u.clear.qc_defaultq;
-	data = args-u.clear.qc_data;
-
-	KASSERT(prop_object_type(data) == PROP_TYPE_DICTIONARY);
 
 	if ((ump-um_flags  UFS_QUOTA2) == 0)
 		return EOPNOTSUPP;
@@ -341,8 +337,8 @@ quota_handle_cmd_clear(struct mount *mp,
 			goto err;
 #ifdef QUOTA2
 		if (ump-um_flags  UFS_QUOTA2) {
-			error = quota2_handle_cmd_clear(ump, idtype, id, defaultq,
-			data);
+			error = quota2_handle_cmd_clear(ump, idtype, id,
+			defaultq);
 		} else
 #endif
 			panic(quota_handle_cmd_get: no support ?);

Index: src/sys/ufs/ufs/ufs_quota.h
diff -u src/sys/ufs/ufs/ufs_quota.h:1.10 src/sys/ufs/ufs/ufs_quota.h:1.11
--- src/sys/ufs/ufs/ufs_quota.h:1.10	Sun Jan 29 06:49:44 2012
+++ src/sys/ufs/ufs/ufs_quota.h	Sun Jan 29 06:52:39 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.h,v 1.10 2012/01/29 06:49:44 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.h,v 1.11 2012/01/29 06:52:39 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -127,7 +127,7 @@ int quota2_handle_cmd_get(struct ufsmoun
 struct quotaval *);
 int quota2_handle_cmd_put(struct ufsmount *, const struct quotakey *,
 const struct quotaval *);
-int quota2_handle_cmd_clear(struct ufsmount *, int, int, int, prop_dictionary_t);
+int quota2_handle_cmd_clear(struct ufsmount *, int, int, int);
 int quota2_handle_cmd_getall(struct ufsmount *, int, prop_array_t);
 int q2sync(struct mount *);
 int dq2get(struct vnode *, u_long, struct ufsmount *, int, struct dquot *);

Index: src/sys/ufs/ufs/ufs_quota2.c
diff -u src/sys/ufs/ufs/ufs_quota2.c:1.11 src/sys/ufs/ufs/ufs_quota2.c:1.12
--- src/sys/ufs/ufs/ufs_quota2.c:1.11	Sun Jan 29 06:49:44 

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:53:36 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c ufs_quota.h ufs_quota2.c

Log Message:
Improve the quota2 QUOTACTL_CLEAR code to allow clearing blocks and
files independently.

Note: this change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.15 -r1.16 src/sys/sys/quotactl.h
cvs rdiff -u -r1.89 -r1.90 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.11 -r1.12 src/sys/ufs/ufs/ufs_quota.h
cvs rdiff -u -r1.12 -r1.13 src/sys/ufs/ufs/ufs_quota2.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/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.17 src/sys/kern/vfs_quotactl.c:1.18
--- src/sys/kern/vfs_quotactl.c:1.17	Sun Jan 29 06:52:38 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 06:53:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.17 2012/01/29 06:52:38 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.18 2012/01/29 06:53:35 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.17 2012/01/29 06:52:38 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.18 2012/01/29 06:53:35 dholland Exp $);
 
 #include sys/mount.h
 #include sys/quota.h
@@ -495,6 +495,17 @@ vfs_quotactl_clear(struct mount *mp,
 		args.u.clear.qc_idtype = q2type;
 		args.u.clear.qc_id = id;
 		args.u.clear.qc_defaultq = defaultq;
+		args.u.clear.qc_objtype = QUOTA_OBJTYPE_BLOCKS;
+		error = VFS_QUOTACTL(mp, QUOTACTL_CLEAR, args);
+		if (error) {
+			goto err;
+		}
+
+		args.qc_type = QCT_CLEAR;
+		args.u.clear.qc_idtype = q2type;
+		args.u.clear.qc_id = id;
+		args.u.clear.qc_defaultq = defaultq;
+		args.u.clear.qc_objtype = QUOTA_OBJTYPE_FILES;
 		error = VFS_QUOTACTL(mp, QUOTACTL_CLEAR, args);
 		if (error) {
 			goto err;

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.15 src/sys/sys/quotactl.h:1.16
--- src/sys/sys/quotactl.h:1.15	Sun Jan 29 06:52:39 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 06:53:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.15 2012/01/29 06:52:39 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.16 2012/01/29 06:53:35 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -77,6 +77,7 @@ struct vfs_quotactl_args {
 			int qc_idtype;
 			id_t qc_id;
 			int qc_defaultq;
+			int qc_objtype;
 		} clear;
 	} u;
 };

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.89 src/sys/ufs/ufs/ufs_quota.c:1.90
--- src/sys/ufs/ufs/ufs_quota.c:1.89	Sun Jan 29 06:52:39 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 06:53:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.89 2012/01/29 06:52:39 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.90 2012/01/29 06:53:35 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.89 2012/01/29 06:52:39 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.90 2012/01/29 06:53:35 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -319,12 +319,14 @@ quota_handle_cmd_clear(struct mount *mp,
 	int idtype;
 	id_t id;
 	int defaultq;
+	int objtype;
 	int error;
 
 	KASSERT(args-qc_type == QCT_CLEAR);
 	idtype = args-u.clear.qc_idtype;
 	id = args-u.clear.qc_id;
 	defaultq = args-u.clear.qc_defaultq;
+	objtype = args-u.clear.qc_objtype;
 
 	if ((ump-um_flags  UFS_QUOTA2) == 0)
 		return EOPNOTSUPP;
@@ -338,7 +340,7 @@ quota_handle_cmd_clear(struct mount *mp,
 #ifdef QUOTA2
 		if (ump-um_flags  UFS_QUOTA2) {
 			error = quota2_handle_cmd_clear(ump, idtype, id,
-			defaultq);
+			defaultq, objtype);
 		} else
 #endif
 			panic(quota_handle_cmd_get: no support ?);

Index: src/sys/ufs/ufs/ufs_quota.h
diff -u src/sys/ufs/ufs/ufs_quota.h:1.11 src/sys/ufs/ufs/ufs_quota.h:1.12
--- src/sys/ufs/ufs/ufs_quota.h:1.11	Sun Jan 29 06:52:39 2012
+++ src/sys/ufs/ufs/ufs_quota.h	Sun Jan 29 06:53:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.h,v 1.11 2012/01/29 06:52:39 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.h,v 1.12 2012/01/29 06:53:35 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -127,7 +127,7 @@ int quota2_handle_cmd_get(struct ufsmoun
 struct quotaval *);
 int quota2_handle_cmd_put(struct ufsmount *, const struct quotakey *,
 const struct quotaval *);
-int quota2_handle_cmd_clear(struct ufsmount *, int, int, int);
+int quota2_handle_cmd_clear(struct ufsmount *, int, int, int, int);
 int quota2_handle_cmd_getall(struct ufsmount *, int, prop_array_t);
 int q2sync(struct mount *);
 int dq2get(struct vnode *, u_long, struct ufsmount *, int, struct dquot *);

Index: src/sys/ufs/ufs/ufs_quota2.c

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:54:34 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c ufs_quota.h ufs_quota2.c

Log Message:
QUOTACTL_CLEAR - QUOTACTL_DELETE to match intended API and user API.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.16 -r1.17 src/sys/sys/quotactl.h
cvs rdiff -u -r1.90 -r1.91 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.12 -r1.13 src/sys/ufs/ufs/ufs_quota.h
cvs rdiff -u -r1.13 -r1.14 src/sys/ufs/ufs/ufs_quota2.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/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.18 src/sys/kern/vfs_quotactl.c:1.19
--- src/sys/kern/vfs_quotactl.c:1.18	Sun Jan 29 06:53:35 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 06:54:34 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.18 2012/01/29 06:53:35 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.19 2012/01/29 06:54:34 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.18 2012/01/29 06:53:35 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.19 2012/01/29 06:54:34 dholland Exp $);
 
 #include sys/mount.h
 #include sys/quota.h
@@ -491,22 +491,22 @@ vfs_quotactl_clear(struct mount *mp,
 			defaultq = 0;
 		}
 
-		args.qc_type = QCT_CLEAR;
-		args.u.clear.qc_idtype = q2type;
-		args.u.clear.qc_id = id;
-		args.u.clear.qc_defaultq = defaultq;
-		args.u.clear.qc_objtype = QUOTA_OBJTYPE_BLOCKS;
-		error = VFS_QUOTACTL(mp, QUOTACTL_CLEAR, args);
+		args.qc_type = QCT_DELETE;
+		args.u.delete.qc_idtype = q2type;
+		args.u.delete.qc_id = id;
+		args.u.delete.qc_defaultq = defaultq;
+		args.u.delete.qc_objtype = QUOTA_OBJTYPE_BLOCKS;
+		error = VFS_QUOTACTL(mp, QUOTACTL_DELETE, args);
 		if (error) {
 			goto err;
 		}
 
-		args.qc_type = QCT_CLEAR;
-		args.u.clear.qc_idtype = q2type;
-		args.u.clear.qc_id = id;
-		args.u.clear.qc_defaultq = defaultq;
-		args.u.clear.qc_objtype = QUOTA_OBJTYPE_FILES;
-		error = VFS_QUOTACTL(mp, QUOTACTL_CLEAR, args);
+		args.qc_type = QCT_DELETE;
+		args.u.delete.qc_idtype = q2type;
+		args.u.delete.qc_id = id;
+		args.u.delete.qc_defaultq = defaultq;
+		args.u.delete.qc_objtype = QUOTA_OBJTYPE_FILES;
+		error = VFS_QUOTACTL(mp, QUOTACTL_DELETE, args);
 		if (error) {
 			goto err;
 		}

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.16 src/sys/sys/quotactl.h:1.17
--- src/sys/sys/quotactl.h:1.16	Sun Jan 29 06:53:35 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 06:54:34 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.16 2012/01/29 06:53:35 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.17 2012/01/29 06:54:34 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -44,15 +44,15 @@
 #define QUOTACTL_GET		3
 #define QUOTACTL_PUT		4
 #define QUOTACTL_GETALL		5
-#define QUOTACTL_CLEAR		6
+#define QUOTACTL_DELETE		6
 
 /* Argument encoding. */
 enum vfs_quotactl_argtypes {
-	QCT_PROPLIB,	/* quotaon/off, get, set, getall, clear */
+	QCT_PROPLIB,	/* quotaon/off, getall */
 	QCT_GETVERSION,	/* getversion */
 	QCT_GET,	/* get */
 	QCT_PUT,	/* put */
-	QCT_CLEAR,	/* clear */
+	QCT_DELETE,	/* delete */
 };
 struct vfs_quotactl_args {
 	enum vfs_quotactl_argtypes qc_type;
@@ -78,7 +78,7 @@ struct vfs_quotactl_args {
 			id_t qc_id;
 			int qc_defaultq;
 			int qc_objtype;
-		} clear;
+		} delete;
 	} u;
 };
 

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.90 src/sys/ufs/ufs/ufs_quota.c:1.91
--- src/sys/ufs/ufs/ufs_quota.c:1.90	Sun Jan 29 06:53:35 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 06:54:34 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.90 2012/01/29 06:53:35 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.91 2012/01/29 06:54:34 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.90 2012/01/29 06:53:35 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.91 2012/01/29 06:54:34 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -79,7 +79,7 @@ static int quota_handle_cmd_put(struct m
 struct vfs_quotactl_args *args);
 static int quota_handle_cmd_getall(struct mount *, struct lwp *,
 struct vfs_quotactl_args *args);
-static int quota_handle_cmd_clear(struct mount *, struct lwp *,
+static int quota_handle_cmd_delete(struct mount *, struct lwp *,
 struct vfs_quotactl_args *args);
 static int quota_handle_cmd_quotaon(struct mount *, struct lwp *, 
 struct vfs_quotactl_args *args);
@@ -178,8 +178,8 @@ quota_handle_cmd(struct mount *mp, struc
 	case QUOTACTL_GETALL:
 		error = quota_handle_cmd_getall(mp, l, args);
 		break;
-	case 

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:55:45 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c ufs_quota.h ufs_quota2.c

Log Message:
Package up the args of QUOTACTL_DELETE as a struct quotakey.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.17 -r1.18 src/sys/sys/quotactl.h
cvs rdiff -u -r1.91 -r1.92 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.13 -r1.14 src/sys/ufs/ufs/ufs_quota.h
cvs rdiff -u -r1.14 -r1.15 src/sys/ufs/ufs/ufs_quota2.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/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.19 src/sys/kern/vfs_quotactl.c:1.20
--- src/sys/kern/vfs_quotactl.c:1.19	Sun Jan 29 06:54:34 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 06:55:44 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.19 2012/01/29 06:54:34 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.20 2012/01/29 06:55:44 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.19 2012/01/29 06:54:34 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.20 2012/01/29 06:55:44 dholland Exp $);
 
 #include sys/mount.h
 #include sys/quota.h
@@ -462,6 +462,7 @@ vfs_quotactl_clear(struct mount *mp,
 	uint32_t id;
 	int defaultq;
 	const char *idstr;
+	struct quotakey qk;
 	struct vfs_quotactl_args args;
 	int error;
 
@@ -491,21 +492,23 @@ vfs_quotactl_clear(struct mount *mp,
 			defaultq = 0;
 		}
 
+		qk.qk_idtype = q2type;
+		qk.qk_id = defaultq ? QUOTA_DEFAULTID : id;
+		qk.qk_objtype = QUOTA_OBJTYPE_BLOCKS;
+
 		args.qc_type = QCT_DELETE;
-		args.u.delete.qc_idtype = q2type;
-		args.u.delete.qc_id = id;
-		args.u.delete.qc_defaultq = defaultq;
-		args.u.delete.qc_objtype = QUOTA_OBJTYPE_BLOCKS;
+		args.u.delete.qc_key = qk;
 		error = VFS_QUOTACTL(mp, QUOTACTL_DELETE, args);
 		if (error) {
 			goto err;
 		}
 
+		qk.qk_idtype = q2type;
+		qk.qk_id = defaultq ? QUOTA_DEFAULTID : id;
+		qk.qk_objtype = QUOTA_OBJTYPE_FILES;
+
 		args.qc_type = QCT_DELETE;
-		args.u.delete.qc_idtype = q2type;
-		args.u.delete.qc_id = id;
-		args.u.delete.qc_defaultq = defaultq;
-		args.u.delete.qc_objtype = QUOTA_OBJTYPE_FILES;
+		args.u.delete.qc_key = qk;
 		error = VFS_QUOTACTL(mp, QUOTACTL_DELETE, args);
 		if (error) {
 			goto err;

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.17 src/sys/sys/quotactl.h:1.18
--- src/sys/sys/quotactl.h:1.17	Sun Jan 29 06:54:34 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 06:55:44 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.17 2012/01/29 06:54:34 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.18 2012/01/29 06:55:44 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -74,10 +74,7 @@ struct vfs_quotactl_args {
 			const struct quotaval *qc_val;
 		} put;
 		struct {
-			int qc_idtype;
-			id_t qc_id;
-			int qc_defaultq;
-			int qc_objtype;
+			const struct quotakey *qc_key;
 		} delete;
 	} u;
 };

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.91 src/sys/ufs/ufs/ufs_quota.c:1.92
--- src/sys/ufs/ufs/ufs_quota.c:1.91	Sun Jan 29 06:54:34 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 06:55:44 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.91 2012/01/29 06:54:34 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.92 2012/01/29 06:55:44 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.91 2012/01/29 06:54:34 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.92 2012/01/29 06:55:44 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -316,17 +316,17 @@ quota_handle_cmd_delete(struct mount *mp
 struct vfs_quotactl_args *args)
 {
 	struct ufsmount *ump = VFSTOUFS(mp);
-	int idtype;
-	id_t id;
-	int defaultq;
-	int objtype;
+	const struct quotakey *qk;
+	id_t kauth_id;
 	int error;
 
 	KASSERT(args-qc_type == QCT_DELETE);
-	idtype = args-u.delete.qc_idtype;
-	id = args-u.delete.qc_id;
-	defaultq = args-u.delete.qc_defaultq;
-	objtype = args-u.delete.qc_objtype;
+	qk = args-u.delete.qc_key;
+
+	kauth_id = qk-qk_id;
+	if (kauth_id == QUOTA_DEFAULTID) {
+		kauth_id = 0;
+	}
 
 	if ((ump-um_flags  UFS_QUOTA2) == 0)
 		return EOPNOTSUPP;
@@ -334,13 +334,13 @@ quota_handle_cmd_delete(struct mount *mp
 	/* avoid whitespace changes */
 	{
 		error = kauth_authorize_system(l-l_cred, KAUTH_SYSTEM_FS_QUOTA,
-		KAUTH_REQ_SYSTEM_FS_QUOTA_MANAGE, mp, KAUTH_ARG(id), NULL);
+		KAUTH_REQ_SYSTEM_FS_QUOTA_MANAGE, mp, KAUTH_ARG(kauth_id),
+		NULL);
 		if (error != 0)
 			goto err;
 #ifdef QUOTA2
 		if (ump-um_flags  UFS_QUOTA2) {
-			error = quota2_handle_cmd_delete(ump, idtype, id,
-	

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 06:57:15 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c ufs_quota.h ufs_quota2.c

Log Message:
Begin adding quota cursor/iteration interface to VFS_QUOTACTL.

Add struct quotakcursor.
Add QUOTACTL_CURSOROPEN and QUOTACTL_CURSORCLOSE operations.
Implement the plumbing for them.
Add trivial implementations of them for quota2.
(iteration is not supported on quota1 for the time being, just as
getall isn't)
Have the proplib interpreter open and close a cursor around doing
QUOTACTL_GETALL.

Note: this change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.18 -r1.19 src/sys/sys/quotactl.h
cvs rdiff -u -r1.92 -r1.93 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.14 -r1.15 src/sys/ufs/ufs/ufs_quota.h
cvs rdiff -u -r1.15 -r1.16 src/sys/ufs/ufs/ufs_quota2.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/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.20 src/sys/kern/vfs_quotactl.c:1.21
--- src/sys/kern/vfs_quotactl.c:1.20	Sun Jan 29 06:55:44 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 06:57:15 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.20 2012/01/29 06:55:44 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.21 2012/01/29 06:57:15 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.20 2012/01/29 06:55:44 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.21 2012/01/29 06:57:15 dholland Exp $);
 
 #include sys/mount.h
 #include sys/quota.h
@@ -442,13 +442,32 @@ vfs_quotactl_getall(struct mount *mp,
 			prop_dictionary_t cmddict, int q2type,
 			prop_array_t datas)
 {
+	struct quotakcursor cursor;
 	struct vfs_quotactl_args args;
+	int error, error2;
+
+	args.qc_type = QCT_CURSOROPEN;
+	args.u.cursoropen.qc_cursor = cursor;
+	error = VFS_QUOTACTL(mp, QUOTACTL_CURSOROPEN, args);
+	if (error) {
+		return error;
+	}
 
 	args.qc_type = QCT_PROPLIB;
 	args.u.proplib.qc_cmddict = cmddict;
 	args.u.proplib.qc_q2type = q2type;
 	args.u.proplib.qc_datas = datas;
-	return VFS_QUOTACTL(mp, QUOTACTL_GETALL, args);
+	error = VFS_QUOTACTL(mp, QUOTACTL_GETALL, args);
+
+	args.qc_type = QCT_CURSORCLOSE;
+	args.u.cursorclose.qc_cursor = cursor;
+	error2 = VFS_QUOTACTL(mp, QUOTACTL_CURSORCLOSE, args);
+
+	if (error) {
+		return error;
+	}
+	error = error2;
+	return error;
 }
 
 static int

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.18 src/sys/sys/quotactl.h:1.19
--- src/sys/sys/quotactl.h:1.18	Sun Jan 29 06:55:44 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 06:57:15 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.18 2012/01/29 06:55:44 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.19 2012/01/29 06:57:15 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -37,6 +37,20 @@
  * use the quota.h API instead.
  */
 
+/*
+ * Semi-opaque structure for cursors. This holds the cursor state in
+ * userland; the size is exposed only to libquota, not to client code,
+ * and is meant to be large enough to accomodate all likely future
+ * expansion without being unduly bloated, as it will need to be
+ * copied in and out for every call using it.
+ */
+struct quotakcursor {
+	union {
+		char qkc_space[64];
+		uintmax_t __qkc_forcealign;
+	} u;
+};
+
 /* Command codes. */
 #define QUOTACTL_GETVERSION	0
 #define QUOTACTL_QUOTAON	1
@@ -45,6 +59,8 @@
 #define QUOTACTL_PUT		4
 #define QUOTACTL_GETALL		5
 #define QUOTACTL_DELETE		6
+#define QUOTACTL_CURSOROPEN	7
+#define QUOTACTL_CURSORCLOSE	8
 
 /* Argument encoding. */
 enum vfs_quotactl_argtypes {
@@ -53,6 +69,8 @@ enum vfs_quotactl_argtypes {
 	QCT_GET,	/* get */
 	QCT_PUT,	/* put */
 	QCT_DELETE,	/* delete */
+	QCT_CURSOROPEN,	/* open cursor */
+	QCT_CURSORCLOSE,/* close cursor */
 };
 struct vfs_quotactl_args {
 	enum vfs_quotactl_argtypes qc_type;
@@ -76,6 +94,12 @@ struct vfs_quotactl_args {
 		struct {
 			const struct quotakey *qc_key;
 		} delete;
+		struct {
+			struct quotakcursor *qc_cursor;
+		} cursoropen;
+		struct {
+			struct quotakcursor *qc_cursor;
+		} cursorclose;
 	} u;
 };
 

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.92 src/sys/ufs/ufs/ufs_quota.c:1.93
--- src/sys/ufs/ufs/ufs_quota.c:1.92	Sun Jan 29 06:55:44 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 06:57:15 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.92 2012/01/29 06:55:44 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.93 2012/01/29 06:57:15 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.92 2012/01/29 06:55:44 dholland Exp $);

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:00:40 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c ufs_quota.h ufs_quota2.c

Log Message:
Pass the cursor to QUOTACTL_GETALL. Don't pass unused proplib items.

Note: this change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.19 -r1.20 src/sys/sys/quotactl.h
cvs rdiff -u -r1.93 -r1.94 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.15 -r1.16 src/sys/ufs/ufs/ufs_quota.h
cvs rdiff -u -r1.16 -r1.17 src/sys/ufs/ufs/ufs_quota2.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/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.21 src/sys/kern/vfs_quotactl.c:1.22
--- src/sys/kern/vfs_quotactl.c:1.21	Sun Jan 29 06:57:15 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 07:00:39 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.21 2012/01/29 06:57:15 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.22 2012/01/29 07:00:39 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.21 2012/01/29 06:57:15 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.22 2012/01/29 07:00:39 dholland Exp $);
 
 #include sys/mount.h
 #include sys/quota.h
@@ -453,10 +453,10 @@ vfs_quotactl_getall(struct mount *mp,
 		return error;
 	}
 
-	args.qc_type = QCT_PROPLIB;
-	args.u.proplib.qc_cmddict = cmddict;
-	args.u.proplib.qc_q2type = q2type;
-	args.u.proplib.qc_datas = datas;
+	args.qc_type = QCT_GETALL;
+	args.u.getall.qc_cursor = cursor;
+	args.u.getall.qc_idtype = q2type;
+	args.u.getall.qc_cmddict = cmddict;
 	error = VFS_QUOTACTL(mp, QUOTACTL_GETALL, args);
 
 	args.qc_type = QCT_CURSORCLOSE;

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.19 src/sys/sys/quotactl.h:1.20
--- src/sys/sys/quotactl.h:1.19	Sun Jan 29 06:57:15 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 07:00:39 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.19 2012/01/29 06:57:15 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.20 2012/01/29 07:00:39 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -64,13 +64,14 @@ struct quotakcursor {
 
 /* Argument encoding. */
 enum vfs_quotactl_argtypes {
-	QCT_PROPLIB,	/* quotaon/off, getall */
+	QCT_PROPLIB,	/* quotaon/off */
 	QCT_GETVERSION,	/* getversion */
 	QCT_GET,	/* get */
 	QCT_PUT,	/* put */
 	QCT_DELETE,	/* delete */
 	QCT_CURSOROPEN,	/* open cursor */
 	QCT_CURSORCLOSE,/* close cursor */
+	QCT_GETALL,	/* get all */
 };
 struct vfs_quotactl_args {
 	enum vfs_quotactl_argtypes qc_type;
@@ -100,6 +101,11 @@ struct vfs_quotactl_args {
 		struct {
 			struct quotakcursor *qc_cursor;
 		} cursorclose;
+		struct {
+			struct quotakcursor *qc_cursor;
+			int qc_idtype;
+			prop_dictionary_t qc_cmddict;
+		} getall;
 	} u;
 };
 

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.93 src/sys/ufs/ufs/ufs_quota.c:1.94
--- src/sys/ufs/ufs/ufs_quota.c:1.93	Sun Jan 29 06:57:15 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 07:00:39 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.93 2012/01/29 06:57:15 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.94 2012/01/29 07:00:39 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.93 2012/01/29 06:57:15 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.94 2012/01/29 07:00:39 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -370,18 +370,17 @@ quota_handle_cmd_getall(struct mount *mp
 {
 	prop_array_t replies;
 	struct ufsmount *ump = VFSTOUFS(mp);
-	int error;
+	struct quotakcursor *cursor;
+	int idtype;
 	prop_dictionary_t cmddict;
-	int q2type;
-	prop_array_t datas;
+	int error;
 
-	KASSERT(args-qc_type == QCT_PROPLIB);
-	cmddict = args-u.proplib.qc_cmddict;
-	q2type = args-u.proplib.qc_q2type;
-	datas = args-u.proplib.qc_datas;
+	KASSERT(args-qc_type == QCT_GETALL);
+	cursor = args-u.getall.qc_cursor;
+	idtype = args-u.getall.qc_idtype;
+	cmddict = args-u.getall.qc_cmddict;
 
 	KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY);
-	KASSERT(prop_object_type(datas) == PROP_TYPE_ARRAY);
 
 	if ((ump-um_flags  UFS_QUOTA2) == 0)
 		return EOPNOTSUPP;
@@ -397,7 +396,7 @@ quota_handle_cmd_getall(struct mount *mp
 
 #ifdef QUOTA2
 	if (ump-um_flags  UFS_QUOTA2) {
-		error = quota2_handle_cmd_getall(ump, q2type, replies);
+		error = quota2_handle_cmd_getall(ump, cursor, idtype, replies);
 	} else
 #endif
 		panic(quota_handle_cmd_getall: no support ?);

Index: src/sys/ufs/ufs/ufs_quota.h
diff -u src/sys/ufs/ufs/ufs_quota.h:1.15 src/sys/ufs/ufs/ufs_quota.h:1.16
--- src/sys/ufs/ufs/ufs_quota.h:1.15	Sun Jan 

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:02:07 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c ufs_quota.h ufs_quota2.c

Log Message:
Hack QUOTACTL_GETALL to return results without using proplib.

(this interface is abusive and is going to be cleaned up in the
immediate future)

Note: this change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.20 -r1.21 src/sys/sys/quotactl.h
cvs rdiff -u -r1.94 -r1.95 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.16 -r1.17 src/sys/ufs/ufs/ufs_quota.h
cvs rdiff -u -r1.17 -r1.18 src/sys/ufs/ufs/ufs_quota2.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/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.22 src/sys/kern/vfs_quotactl.c:1.23
--- src/sys/kern/vfs_quotactl.c:1.22	Sun Jan 29 07:00:39 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 07:02:06 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.22 2012/01/29 07:00:39 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.23 2012/01/29 07:02:06 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,8 +80,9 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.22 2012/01/29 07:00:39 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.23 2012/01/29 07:02:06 dholland Exp $);
 
+#include sys/malloc.h /* XXX: temporary */
 #include sys/mount.h
 #include sys/quota.h
 #include sys/quotactl.h
@@ -437,14 +438,84 @@ err:
 	return error;
 }
 
+static prop_dictionary_t
+vfs_quotactl_getall_makereply(id_t id, int def,
+			  const struct quotaval *blocks,
+			  const struct quotaval *files)
+{
+#define INITQVNAMES_ALL { \
+QUOTADICT_LIMIT_HARD, \
+QUOTADICT_LIMIT_SOFT, \
+QUOTADICT_LIMIT_USAGE, \
+QUOTADICT_LIMIT_ETIME, \
+QUOTADICT_LIMIT_GTIME \
+}
+#define N_QV 5
+
+	const char *val_names[] = INITQVNAMES_ALL;
+	uint64_t vals[N_QV];
+	prop_dictionary_t dict1 = prop_dictionary_create();
+	prop_dictionary_t dict2;
+
+	if (dict1 == NULL)
+		return NULL;
+
+	if (def) {
+		if (!prop_dictionary_set_cstring_nocopy(dict1, id,
+		default)) {
+			goto err;
+		}
+	} else {
+		if (!prop_dictionary_set_uint32(dict1, id, id)) {
+			goto err;
+		}
+	}
+
+	vals[0] = blocks-qv_hardlimit;
+	vals[1] = blocks-qv_softlimit;
+	vals[2] = blocks-qv_usage;
+	vals[3] = blocks-qv_expiretime;
+	vals[4] = blocks-qv_grace;
+	dict2 = limits64toprop(vals, val_names, N_QV);
+	if (dict2 == NULL)
+		goto err;
+	if (!prop_dictionary_set_and_rel(dict1, QUOTADICT_LTYPE_BLOCK, dict2))
+		goto err;
+
+
+	vals[0] = files-qv_hardlimit;
+	vals[1] = files-qv_softlimit;
+	vals[2] = files-qv_usage;
+	vals[3] = files-qv_expiretime;
+	vals[4] = files-qv_grace;
+	dict2 = limits64toprop(vals, val_names, N_QV);
+	if (dict2 == NULL)
+		goto err;
+	if (!prop_dictionary_set_and_rel(dict1, QUOTADICT_LTYPE_FILE, dict2))
+		goto err;
+
+	return dict1;
+
+err:
+	prop_object_release(dict1);
+	return NULL;
+}
+
 static int
 vfs_quotactl_getall(struct mount *mp,
 			prop_dictionary_t cmddict, int q2type,
 			prop_array_t datas)
 {
 	struct quotakcursor cursor;
+	struct quota_getall_result result;
 	struct vfs_quotactl_args args;
+	prop_array_t replies;
+	prop_dictionary_t dict;
+	unsigned i;
 	int error, error2;
+	int skip = 0;
+
+	KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY);
 
 	args.qc_type = QCT_CURSOROPEN;
 	args.u.cursoropen.qc_cursor = cursor;
@@ -453,11 +524,75 @@ vfs_quotactl_getall(struct mount *mp,
 		return error;
 	}
 
+	result.qr_keys = NULL;
+	result.qr_vals = NULL;
+
 	args.qc_type = QCT_GETALL;
 	args.u.getall.qc_cursor = cursor;
 	args.u.getall.qc_idtype = q2type;
-	args.u.getall.qc_cmddict = cmddict;
+	args.u.getall.qc_result = result;
 	error = VFS_QUOTACTL(mp, QUOTACTL_GETALL, args);
+	/*
+	 * XXX this is bogus but up until now *all* errors
+	 * from inside quotactl_getall were suppressed by the
+	 * dispatching code in ufs_quota.c. Fixing that causes
+	 * repquota to break in an undesirable way; this is a
+	 * workaround.
+	 */
+	if (error == ENODEV || error == ENXIO) {
+		skip = 1;
+		error = 0;
+	}
+	if (error) {
+		goto err;
+	}
+
+	replies = prop_array_create();
+	if (replies == NULL) {
+		error = ENOMEM;
+		goto err;
+	}
+
+	if (skip) {
+		goto skip;
+	}
+
+	dict = vfs_quotactl_getall_makereply(0, 1, result.qr_defblocks,
+	 result.qr_deffiles);
+	if (!prop_array_add_and_rel(replies, dict)) {
+		error = ENOMEM;
+		goto err;
+	}
+
+	for (i = 0; i  result.qr_num; i += 2) {
+		dict = vfs_quotactl_getall_makereply(result.qr_keys[i].qk_id,0,
+		 result.qr_vals[i],
+		 result.qr_vals[i+1]);
+		if (dict == NULL) {
+			error = ENOMEM;
+			goto err;
+		}
+		if (!prop_array_add_and_rel(replies, dict)) {
+			error = ENOMEM;
+			goto err;
+		}
+	}
+

CVS commit: src/sys/ufs/ufs

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:03:47 UTC 2012

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

Log Message:
Teach quota2 QUOTACTL_GETALL to start in the middle, step 1.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/ufs/ufs/ufs_quota2.c

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

Modified files:

Index: src/sys/ufs/ufs/ufs_quota2.c
diff -u src/sys/ufs/ufs/ufs_quota2.c:1.18 src/sys/ufs/ufs/ufs_quota2.c:1.19
--- src/sys/ufs/ufs/ufs_quota2.c:1.18	Sun Jan 29 07:02:06 2012
+++ src/sys/ufs/ufs/ufs_quota2.c	Sun Jan 29 07:03:47 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota2.c,v 1.18 2012/01/29 07:02:06 dholland Exp $ */
+/* $NetBSD: ufs_quota2.c,v 1.19 2012/01/29 07:03:47 dholland Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -26,7 +26,7 @@
   */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.18 2012/01/29 07:02:06 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.19 2012/01/29 07:03:47 dholland Exp $);
 
 #include sys/buf.h
 #include sys/param.h
@@ -956,7 +956,12 @@ quota2_handle_cmd_get(struct ufsmount *u
 }
 
 struct ufsq2_cursor {
-	uint32_t q2c_magic;
+	uint32_t q2c_magic;	/* magic number */
+	int q2c_hashsize;	/* size of hash table at last go */
+
+	int q2c_defaults_done;	/* true if we've returned the default values */
+	int q2c_hashpos;	/* slot to start at in hash table */
+	int q2c_blocks_done;	/* true if we've returned the blocks value */
 };
 
 #define Q2C_MAGIC (0xbeebe111)
@@ -1010,6 +1015,7 @@ quota2_handle_cmd_getall(struct ufsmount
 	const int needswap = UFS_MPNEEDSWAP(ump);
 	struct getuids gu;
 	id_t junkid;
+	struct quotaval qv;
 	unsigned num, maxnum;
 
 	cursor = Q2CURSOR(qkc);
@@ -1026,9 +1032,21 @@ quota2_handle_cmd_getall(struct ufsmount
 		mutex_exit(dqlock);
 		return error;
 	}
-	quota2_ufs_rwq2e(q2h-q2h_defentry, q2e, needswap);
-	q2e_to_quotaval(q2e, 1, junkid, QL_BLOCK, result-qr_defblocks);
-	q2e_to_quotaval(q2e, 1, junkid, QL_FILE, result-qr_deffiles);
+
+	if (cursor-q2c_defaults_done == 0) {
+		quota2_ufs_rwq2e(q2h-q2h_defentry, q2e, needswap);
+		if (cursor-q2c_blocks_done == 0) {
+			q2e_to_quotaval(q2e, 1, junkid, QL_BLOCK, qv);
+			result-qr_defblocks = qv;
+			cursor-q2c_blocks_done = 1;
+		}
+		if (cursor-q2c_blocks_done == 1) {
+			q2e_to_quotaval(q2e, 1, junkid, QL_FILE, qv);
+			result-qr_deffiles = qv;
+			cursor-q2c_blocks_done = 0;
+			cursor-q2c_defaults_done = 1;
+		}
+	}
 
 	/*
 	 * we can't directly get entries as we can't walk the list
@@ -1038,7 +1056,22 @@ quota2_handle_cmd_getall(struct ufsmount
 	 */
 	memset(gu, 0, sizeof(gu));
 	quota2_hash_size = ufs_rw16(q2h-q2h_hash_size, needswap);
-	for (i = 0; i  quota2_hash_size ; i++) {
+
+	/* if the table size has changed, make the caller start over */
+	if (cursor-q2c_hashsize == 0) {
+		cursor-q2c_hashsize = quota2_hash_size;
+	} else if (cursor-q2c_hashsize != quota2_hash_size) {
+		error = EDEADLK;
+		goto fail;
+	}
+
+	/* why are these variables signed? */
+	if (cursor-q2c_hashpos  0) {
+		error = EINVAL;
+		goto fail;
+	}
+
+	for (i = cursor-q2c_hashpos; i  quota2_hash_size ; i++) {
 		offset = q2h-q2h_entries[i];
 		error = quota2_walk_list(ump, hbp, idtype, offset, 0, gu,
 		quota2_getuids_callback);
@@ -1048,7 +1081,9 @@ quota2_handle_cmd_getall(struct ufsmount
 			break;
 		}
 	}
+	cursor-q2c_hashpos = i;
 
+fail:
 	mutex_exit(dqlock);
 	brelse(hbp, 0);
 	if (error)
@@ -1085,6 +1120,10 @@ quota2_handle_cmd_cursoropen(struct ufsm
 	cursor = Q2CURSOR(qkc);
 
 	cursor-q2c_magic = Q2C_MAGIC;
+	cursor-q2c_hashsize = 0;
+	cursor-q2c_hashpos = 0;
+	cursor-q2c_defaults_done = 0;
+	cursor-q2c_blocks_done = 0;
 	return 0;
 }
 
@@ -1098,6 +1137,8 @@ quota2_handle_cmd_cursorclose(struct ufs
 		return EINVAL;
 	}
 
+	/* nothing to do */
+
 	return 0;
 }
 



CVS commit: src/sys/ufs/ufs

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:04:22 UTC 2012

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

Log Message:
Teach quota2 QUOTACTL_GETALL to start in the middle, step 2.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/ufs/ufs/ufs_quota2.c

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

Modified files:

Index: src/sys/ufs/ufs/ufs_quota2.c
diff -u src/sys/ufs/ufs/ufs_quota2.c:1.19 src/sys/ufs/ufs/ufs_quota2.c:1.20
--- src/sys/ufs/ufs/ufs_quota2.c:1.19	Sun Jan 29 07:03:47 2012
+++ src/sys/ufs/ufs/ufs_quota2.c	Sun Jan 29 07:04:21 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota2.c,v 1.19 2012/01/29 07:03:47 dholland Exp $ */
+/* $NetBSD: ufs_quota2.c,v 1.20 2012/01/29 07:04:21 dholland Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -26,7 +26,7 @@
   */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.19 2012/01/29 07:03:47 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.20 2012/01/29 07:04:21 dholland Exp $);
 
 #include sys/buf.h
 #include sys/param.h
@@ -961,6 +961,7 @@ struct ufsq2_cursor {
 
 	int q2c_defaults_done;	/* true if we've returned the default values */
 	int q2c_hashpos;	/* slot to start at in hash table */
+	int q2c_uidpos;		/* number of ids we've handled */
 	int q2c_blocks_done;	/* true if we've returned the blocks value */
 };
 
@@ -968,11 +969,34 @@ struct ufsq2_cursor {
 
 #define Q2CURSOR(qkc) ((struct ufsq2_cursor *)qkc-u.qkc_space[0])
 
+static int
+q2cursor_check(struct ufsq2_cursor *cursor)
+{
+	if (cursor-q2c_magic != Q2C_MAGIC) {
+		return EINVAL;
+	}
+	if (cursor-q2c_hashsize  0) {
+		return EINVAL;
+	}
+
+	if (cursor-q2c_defaults_done != 0  cursor-q2c_defaults_done != 1) {
+		return EINVAL;
+	}
+	if (cursor-q2c_hashpos  0 || cursor-q2c_uidpos  0) {
+		return EINVAL;
+	}
+	if (cursor-q2c_blocks_done != 0  cursor-q2c_blocks_done != 1) {
+		return EINVAL;
+	}
+	return 0;
+}
 
 struct getuids {
 	long nuids; /* number of uids in array */
 	long size;  /* size of array */
 	uid_t *uids; /* array of uids, dynamically allocated */
+	long skip;
+	long seen;
 };
 
 static int
@@ -985,6 +1009,10 @@ quota2_getuids_callback(struct ufsmount 
 	const int needswap = UFS_MPNEEDSWAP(ump);
 #endif
 
+	if (gu-skip  0) {
+		gu-skip--;
+		return 0;
+	}
 	if (gu-nuids == gu-size) {
 		newuids = realloc(gu-uids, gu-size + PAGE_SIZE, M_TEMP,
 		M_WAITOK);
@@ -997,6 +1025,7 @@ quota2_getuids_callback(struct ufsmount 
 	}
 	gu-uids[gu-nuids] = ufs_rw32(q2ep-q2e_uid, needswap);
 	gu-nuids++;
+	gu-seen++;
 	return 0;
 }
 
@@ -1019,12 +1048,14 @@ quota2_handle_cmd_getall(struct ufsmount
 	unsigned num, maxnum;
 
 	cursor = Q2CURSOR(qkc);
-	if (cursor-q2c_magic != Q2C_MAGIC) {
-		return EINVAL;
+	error = q2cursor_check(cursor);
+	if (error) {
+		return error;
 	}
 
-	if (ump-um_quotas[idtype] == NULLVP)
+	if (ump-um_quotas[idtype] == NULLVP) {
 		return ENODEV;
+	}
 
 	mutex_enter(dqlock);
 	error = getq2h(ump, idtype, hbp, q2h, 0);
@@ -1065,14 +1096,11 @@ quota2_handle_cmd_getall(struct ufsmount
 		goto fail;
 	}
 
-	/* why are these variables signed? */
-	if (cursor-q2c_hashpos  0) {
-		error = EINVAL;
-		goto fail;
-	}
-
+	gu.skip = cursor-q2c_uidpos;
+	gu.seen = 0;
 	for (i = cursor-q2c_hashpos; i  quota2_hash_size ; i++) {
 		offset = q2h-q2h_entries[i];
+		gu.seen = 0;
 		error = quota2_walk_list(ump, hbp, idtype, offset, 0, gu,
 		quota2_getuids_callback);
 		if (error) {
@@ -1082,6 +1110,7 @@ quota2_handle_cmd_getall(struct ufsmount
 		}
 	}
 	cursor-q2c_hashpos = i;
+	cursor-q2c_uidpos = gu.seen;
 
 fail:
 	mutex_exit(dqlock);
@@ -1121,8 +1150,10 @@ quota2_handle_cmd_cursoropen(struct ufsm
 
 	cursor-q2c_magic = Q2C_MAGIC;
 	cursor-q2c_hashsize = 0;
-	cursor-q2c_hashpos = 0;
+
 	cursor-q2c_defaults_done = 0;
+	cursor-q2c_hashpos = 0;
+	cursor-q2c_uidpos = 0;
 	cursor-q2c_blocks_done = 0;
 	return 0;
 }
@@ -1131,10 +1162,12 @@ int
 quota2_handle_cmd_cursorclose(struct ufsmount *ump, struct quotakcursor *qkc)
 {
 	struct ufsq2_cursor *cursor;
+	int error;
 
 	cursor = Q2CURSOR(qkc);
-	if (cursor-q2c_magic != Q2C_MAGIC) {
-		return EINVAL;
+	error = q2cursor_check(cursor);
+	if (error) {
+		return error;
 	}
 
 	/* nothing to do */



CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:05:13 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota2.c

Log Message:
Teach quota2 QUOTACTL_GETALL to acecpt a limit on how much it sends back.
Pass in a dummy limit for now.

Note: this change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.21 -r1.22 src/sys/sys/quotactl.h
cvs rdiff -u -r1.20 -r1.21 src/sys/ufs/ufs/ufs_quota2.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/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.23 src/sys/kern/vfs_quotactl.c:1.24
--- src/sys/kern/vfs_quotactl.c:1.23	Sun Jan 29 07:02:06 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 07:05:12 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.23 2012/01/29 07:02:06 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.24 2012/01/29 07:05:12 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.23 2012/01/29 07:02:06 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.24 2012/01/29 07:05:12 dholland Exp $);
 
 #include sys/malloc.h /* XXX: temporary */
 #include sys/mount.h
@@ -526,6 +526,8 @@ vfs_quotactl_getall(struct mount *mp,
 
 	result.qr_keys = NULL;
 	result.qr_vals = NULL;
+	result.qr_num = 0;
+	result.qr_max = 0x7fff; /* XXX bogus; but temporary */
 
 	args.qc_type = QCT_GETALL;
 	args.u.getall.qc_cursor = cursor;

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.21 src/sys/sys/quotactl.h:1.22
--- src/sys/sys/quotactl.h:1.21	Sun Jan 29 07:02:06 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 07:05:12 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.21 2012/01/29 07:02:06 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.22 2012/01/29 07:05:12 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -112,6 +112,7 @@ struct vfs_quotactl_args {
 struct quotakey *qr_keys;
 struct quotaval *qr_vals;
 unsigned qr_num;
+unsigned qr_max;
 			} *qc_result;
 		} getall;
 	} u;

Index: src/sys/ufs/ufs/ufs_quota2.c
diff -u src/sys/ufs/ufs/ufs_quota2.c:1.20 src/sys/ufs/ufs/ufs_quota2.c:1.21
--- src/sys/ufs/ufs/ufs_quota2.c:1.20	Sun Jan 29 07:04:21 2012
+++ src/sys/ufs/ufs/ufs_quota2.c	Sun Jan 29 07:05:12 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota2.c,v 1.20 2012/01/29 07:04:21 dholland Exp $ */
+/* $NetBSD: ufs_quota2.c,v 1.21 2012/01/29 07:05:12 dholland Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -26,7 +26,7 @@
   */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.20 2012/01/29 07:04:21 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.21 2012/01/29 07:05:12 dholland Exp $);
 
 #include sys/buf.h
 #include sys/param.h
@@ -829,7 +829,8 @@ out_dq:
 
 static int
 quota2_result_add_q2e(struct ufsmount *ump, int idtype,
-int id, struct quota_getall_result *result, unsigned pos)
+int id, struct quota_getall_result *result, unsigned pos,
+int skipfirst, int skiplast)
 {
 	struct dquot *dq;
 	int error;
@@ -859,15 +860,21 @@ quota2_result_add_q2e(struct ufsmount *u
 	mutex_exit(dq-dq_interlock);
 	dqrele(NULLVP, dq);
 
-	result-qr_keys[pos].qk_idtype = idtype;
-	result-qr_keys[pos].qk_objtype = QUOTA_OBJTYPE_BLOCKS;
-	q2e_to_quotaval(q2e, 0, result-qr_keys[pos].qk_id,
-			QL_BLOCK, result-qr_vals[pos]);
-
-	result-qr_keys[pos+1].qk_idtype = idtype;
-	result-qr_keys[pos+1].qk_objtype = QUOTA_OBJTYPE_FILES;
-	q2e_to_quotaval(q2e, 0, result-qr_keys[pos+1].qk_id,
-			QL_FILE, result-qr_vals[pos+1]);
+	if (skipfirst == 0) {
+		result-qr_keys[pos].qk_idtype = idtype;
+		result-qr_keys[pos].qk_objtype = QUOTA_OBJTYPE_BLOCKS;
+		q2e_to_quotaval(q2e, 0, result-qr_keys[pos].qk_id,
+QL_BLOCK, result-qr_vals[pos]);
+		pos++;
+	}
+
+	if (skiplast == 0) {
+		result-qr_keys[pos].qk_idtype = idtype;
+		result-qr_keys[pos].qk_objtype = QUOTA_OBJTYPE_FILES;
+		q2e_to_quotaval(q2e, 0, result-qr_keys[pos].qk_id,
+QL_FILE, result-qr_vals[pos]);
+		pos++;
+	}
 
 	return 0;
 }
@@ -997,6 +1004,7 @@ struct getuids {
 	uid_t *uids; /* array of uids, dynamically allocated */
 	long skip;
 	long seen;
+	long limit;
 };
 
 static int
@@ -1026,6 +1034,9 @@ quota2_getuids_callback(struct ufsmount 
 	gu-uids[gu-nuids] = ufs_rw32(q2ep-q2e_uid, needswap);
 	gu-nuids++;
 	gu-seen++;
+	if (gu-nuids == gu-limit) {
+		return Q2WL_ABORT;
+	}
 	return 0;
 }
 
@@ -1046,6 +1057,7 @@ quota2_handle_cmd_getall(struct ufsmount
 	id_t junkid;
 	struct quotaval qv;
 	unsigned num, maxnum;
+	int skipfirst, skiplast;
 
 	cursor = Q2CURSOR(qkc);
 	error = q2cursor_check(cursor);
@@ -1098,11 +1110,20 @@ quota2_handle_cmd_getall(struct ufsmount
 
 	gu.skip = 

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:06:02 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota2.c

Log Message:
Stop treating the default values specially in QUOTACTL_GETALL.

Note: this change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.22 -r1.23 src/sys/sys/quotactl.h
cvs rdiff -u -r1.21 -r1.22 src/sys/ufs/ufs/ufs_quota2.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/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.24 src/sys/kern/vfs_quotactl.c:1.25
--- src/sys/kern/vfs_quotactl.c:1.24	Sun Jan 29 07:05:12 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 07:06:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.24 2012/01/29 07:05:12 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.25 2012/01/29 07:06:01 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.24 2012/01/29 07:05:12 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.25 2012/01/29 07:06:01 dholland Exp $);
 
 #include sys/malloc.h /* XXX: temporary */
 #include sys/mount.h
@@ -512,6 +512,8 @@ vfs_quotactl_getall(struct mount *mp,
 	prop_array_t replies;
 	prop_dictionary_t dict;
 	unsigned i;
+	id_t id;
+	int defaultq;
 	int error, error2;
 	int skip = 0;
 
@@ -559,15 +561,15 @@ vfs_quotactl_getall(struct mount *mp,
 		goto skip;
 	}
 
-	dict = vfs_quotactl_getall_makereply(0, 1, result.qr_defblocks,
-	 result.qr_deffiles);
-	if (!prop_array_add_and_rel(replies, dict)) {
-		error = ENOMEM;
-		goto err;
-	}
-
 	for (i = 0; i  result.qr_num; i += 2) {
-		dict = vfs_quotactl_getall_makereply(result.qr_keys[i].qk_id,0,
+		id = result.qr_keys[i].qk_id;
+		if (id == QUOTA_DEFAULTID) {
+			id = 0;
+			defaultq = 1;
+		} else {
+			defaultq = 0;
+		}
+		dict = vfs_quotactl_getall_makereply(id, defaultq,
 		 result.qr_vals[i],
 		 result.qr_vals[i+1]);
 		if (dict == NULL) {

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.22 src/sys/sys/quotactl.h:1.23
--- src/sys/sys/quotactl.h:1.22	Sun Jan 29 07:05:12 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 07:06:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.22 2012/01/29 07:05:12 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.23 2012/01/29 07:06:01 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -107,8 +107,6 @@ struct vfs_quotactl_args {
 			struct quotakcursor *qc_cursor;
 			int qc_idtype;
 			struct quota_getall_result {
-struct quotaval qr_defblocks;
-struct quotaval qr_deffiles;
 struct quotakey *qr_keys;
 struct quotaval *qr_vals;
 unsigned qr_num;

Index: src/sys/ufs/ufs/ufs_quota2.c
diff -u src/sys/ufs/ufs/ufs_quota2.c:1.21 src/sys/ufs/ufs/ufs_quota2.c:1.22
--- src/sys/ufs/ufs/ufs_quota2.c:1.21	Sun Jan 29 07:05:12 2012
+++ src/sys/ufs/ufs/ufs_quota2.c	Sun Jan 29 07:06:02 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota2.c,v 1.21 2012/01/29 07:05:12 dholland Exp $ */
+/* $NetBSD: ufs_quota2.c,v 1.22 2012/01/29 07:06:02 dholland Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -26,7 +26,7 @@
   */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.21 2012/01/29 07:05:12 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.22 2012/01/29 07:06:02 dholland Exp $);
 
 #include sys/buf.h
 #include sys/param.h
@@ -1055,9 +1055,12 @@ quota2_handle_cmd_getall(struct ufsmount
 	const int needswap = UFS_MPNEEDSWAP(ump);
 	struct getuids gu;
 	id_t junkid;
-	struct quotaval qv;
+	struct quotakey bkey, fkey;
+	struct quotaval bval, fval;
+	int dobval = 0, dofval = 0;
 	unsigned num, maxnum;
 	int skipfirst, skiplast;
+	int maxreturn, numreturn;
 
 	cursor = Q2CURSOR(qkc);
 	error = q2cursor_check(cursor);
@@ -1069,6 +1072,9 @@ quota2_handle_cmd_getall(struct ufsmount
 		return ENODEV;
 	}
 
+	maxreturn = result-qr_max;
+	numreturn = 0;
+
 	mutex_enter(dqlock);
 	error = getq2h(ump, idtype, hbp, q2h, 0);
 	if (error) {
@@ -1079,13 +1085,19 @@ quota2_handle_cmd_getall(struct ufsmount
 	if (cursor-q2c_defaults_done == 0) {
 		quota2_ufs_rwq2e(q2h-q2h_defentry, q2e, needswap);
 		if (cursor-q2c_blocks_done == 0) {
-			q2e_to_quotaval(q2e, 1, junkid, QL_BLOCK, qv);
-			result-qr_defblocks = qv;
+			q2e_to_quotaval(q2e, 1, junkid, QL_BLOCK, bval);
+			bkey.qk_idtype = idtype;
+			bkey.qk_id = QUOTA_DEFAULTID;
+			bkey.qk_objtype = QUOTA_OBJTYPE_BLOCKS;
+			dobval = 1;
 			cursor-q2c_blocks_done = 1;
 		}
 		if (cursor-q2c_blocks_done == 1) {
-			q2e_to_quotaval(q2e, 1, junkid, QL_FILE, qv);
-			result-qr_deffiles = qv;
+			q2e_to_quotaval(q2e, 1, junkid, QL_FILE, fval);
+			fkey.qk_idtype = idtype;
+			fkey.qk_id = 

CVS commit: src/sys/kern

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:06:37 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c

Log Message:
Rearrange result processing for QUOTACTL_GETALL.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/kern/vfs_quotactl.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/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.25 src/sys/kern/vfs_quotactl.c:1.26
--- src/sys/kern/vfs_quotactl.c:1.25	Sun Jan 29 07:06:01 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 07:06:37 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.25 2012/01/29 07:06:01 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.26 2012/01/29 07:06:37 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.25 2012/01/29 07:06:01 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.26 2012/01/29 07:06:37 dholland Exp $);
 
 #include sys/malloc.h /* XXX: temporary */
 #include sys/mount.h
@@ -439,9 +439,45 @@ err:
 }
 
 static prop_dictionary_t
-vfs_quotactl_getall_makereply(id_t id, int def,
-			  const struct quotaval *blocks,
-			  const struct quotaval *files)
+vfs_quotactl_getall_makereply(const struct quotakey *key)
+{
+	prop_dictionary_t dict;
+	id_t id;
+	int defaultq;
+
+	dict = prop_dictionary_create();
+	if (dict == NULL)
+		return NULL;
+
+	id = key-qk_id;
+	if (id == QUOTA_DEFAULTID) {
+		id = 0;
+		defaultq = 1;
+	} else {
+		defaultq = 0;
+	}
+
+	if (defaultq) {
+		if (!prop_dictionary_set_cstring_nocopy(dict, id,
+		default)) {
+			goto err;
+		}
+	} else {
+		if (!prop_dictionary_set_uint32(dict, id, id)) {
+			goto err;
+		}
+	}
+
+	return dict;
+
+err:
+	prop_object_release(dict);
+	return NULL;
+}
+
+static int
+vfs_quotactl_getall_addreply(prop_dictionary_t thisreply,
+const struct quotakey *key, const struct quotaval *val)
 {
 #define INITQVNAMES_ALL { \
 QUOTADICT_LIMIT_HARD, \
@@ -454,51 +490,33 @@ vfs_quotactl_getall_makereply(id_t id, i
 
 	const char *val_names[] = INITQVNAMES_ALL;
 	uint64_t vals[N_QV];
-	prop_dictionary_t dict1 = prop_dictionary_create();
 	prop_dictionary_t dict2;
+	const char *objtypename;
 
-	if (dict1 == NULL)
-		return NULL;
-
-	if (def) {
-		if (!prop_dictionary_set_cstring_nocopy(dict1, id,
-		default)) {
-			goto err;
-		}
-	} else {
-		if (!prop_dictionary_set_uint32(dict1, id, id)) {
-			goto err;
-		}
+	switch (key-qk_objtype) {
+	case QUOTA_OBJTYPE_BLOCKS:
+		objtypename = QUOTADICT_LTYPE_BLOCK;
+		break;
+	case QUOTA_OBJTYPE_FILES:
+		objtypename = QUOTADICT_LTYPE_FILE;
+		break;
+	default:
+		return EINVAL;
 	}
 
-	vals[0] = blocks-qv_hardlimit;
-	vals[1] = blocks-qv_softlimit;
-	vals[2] = blocks-qv_usage;
-	vals[3] = blocks-qv_expiretime;
-	vals[4] = blocks-qv_grace;
-	dict2 = limits64toprop(vals, val_names, N_QV);
-	if (dict2 == NULL)
-		goto err;
-	if (!prop_dictionary_set_and_rel(dict1, QUOTADICT_LTYPE_BLOCK, dict2))
-		goto err;
-
-
-	vals[0] = files-qv_hardlimit;
-	vals[1] = files-qv_softlimit;
-	vals[2] = files-qv_usage;
-	vals[3] = files-qv_expiretime;
-	vals[4] = files-qv_grace;
+	vals[0] = val-qv_hardlimit;
+	vals[1] = val-qv_softlimit;
+	vals[2] = val-qv_usage;
+	vals[3] = val-qv_expiretime;
+	vals[4] = val-qv_grace;
 	dict2 = limits64toprop(vals, val_names, N_QV);
 	if (dict2 == NULL)
-		goto err;
-	if (!prop_dictionary_set_and_rel(dict1, QUOTADICT_LTYPE_FILE, dict2))
-		goto err;
+		return ENOMEM;
 
-	return dict1;
+	if (!prop_dictionary_set_and_rel(thisreply, objtypename, dict2))
+		return ENOMEM;
 
-err:
-	prop_object_release(dict1);
-	return NULL;
+	return 0;
 }
 
 static int
@@ -510,10 +528,11 @@ vfs_quotactl_getall(struct mount *mp,
 	struct quota_getall_result result;
 	struct vfs_quotactl_args args;
 	prop_array_t replies;
-	prop_dictionary_t dict;
+	prop_dictionary_t thisreply;
+	struct quotakey *key;
+	struct quotaval *val;
+	id_t lastid;
 	unsigned i;
-	id_t id;
-	int defaultq;
 	int error, error2;
 	int skip = 0;
 
@@ -561,23 +580,34 @@ vfs_quotactl_getall(struct mount *mp,
 		goto skip;
 	}
 
-	for (i = 0; i  result.qr_num; i += 2) {
-		id = result.qr_keys[i].qk_id;
-		if (id == QUOTA_DEFAULTID) {
-			id = 0;
-			defaultq = 1;
-		} else {
-			defaultq = 0;
-		}
-		dict = vfs_quotactl_getall_makereply(id, defaultq,
-		 result.qr_vals[i],
-		 result.qr_vals[i+1]);
-		if (dict == NULL) {
-			error = ENOMEM;
-			goto err;
+	thisreply = NULL;
+	lastid = 0; /* value not actually referenced */
+	for (i = 0; i  result.qr_num; i++) {
+		key = result.qr_keys[i];
+		val = result.qr_vals[i];
+
+		if (thisreply == NULL || key-qk_id != lastid) {
+			lastid = key-qk_id;
+			thisreply = vfs_quotactl_getall_makereply(key);
+			if (thisreply == NULL) {
+error = ENOMEM;
+goto err;
+			}
+			/*
+			 * Note: while we release our reference to

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:07:22 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c ufs_quota.h ufs_quota2.c

Log Message:
Call QUOTACTL_GETALL in a loop to get results 8 at a time. Make
the QUOTACTL_GETALL interface less abusive.

Note: this change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.23 -r1.24 src/sys/sys/quotactl.h
cvs rdiff -u -r1.95 -r1.96 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.17 -r1.18 src/sys/ufs/ufs/ufs_quota.h
cvs rdiff -u -r1.22 -r1.23 src/sys/ufs/ufs/ufs_quota2.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/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.26 src/sys/kern/vfs_quotactl.c:1.27
--- src/sys/kern/vfs_quotactl.c:1.26	Sun Jan 29 07:06:37 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 07:07:22 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.26 2012/01/29 07:06:37 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.27 2012/01/29 07:07:22 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.26 2012/01/29 07:06:37 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.27 2012/01/29 07:07:22 dholland Exp $);
 
 #include sys/malloc.h /* XXX: temporary */
 #include sys/mount.h
@@ -525,16 +525,18 @@ vfs_quotactl_getall(struct mount *mp,
 			prop_array_t datas)
 {
 	struct quotakcursor cursor;
-	struct quota_getall_result result;
+	struct quotakey *keys;
+	struct quotaval *vals;
+	unsigned loopmax = 8;
+	unsigned loopnum;
 	struct vfs_quotactl_args args;
 	prop_array_t replies;
-	prop_dictionary_t thisreply;
 	struct quotakey *key;
 	struct quotaval *val;
 	id_t lastid;
+	prop_dictionary_t thisreply;
 	unsigned i;
 	int error, error2;
-	int skip = 0;
 
 	KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY);
 
@@ -545,30 +547,8 @@ vfs_quotactl_getall(struct mount *mp,
 		return error;
 	}
 
-	result.qr_keys = NULL;
-	result.qr_vals = NULL;
-	result.qr_num = 0;
-	result.qr_max = 0x7fff; /* XXX bogus; but temporary */
-
-	args.qc_type = QCT_GETALL;
-	args.u.getall.qc_cursor = cursor;
-	args.u.getall.qc_idtype = q2type;
-	args.u.getall.qc_result = result;
-	error = VFS_QUOTACTL(mp, QUOTACTL_GETALL, args);
-	/*
-	 * XXX this is bogus but up until now *all* errors
-	 * from inside quotactl_getall were suppressed by the
-	 * dispatching code in ufs_quota.c. Fixing that causes
-	 * repquota to break in an undesirable way; this is a
-	 * workaround.
-	 */
-	if (error == ENODEV || error == ENXIO) {
-		skip = 1;
-		error = 0;
-	}
-	if (error) {
-		goto err;
-	}
+	keys = malloc(loopmax * sizeof(keys[0]), M_TEMP, M_WAITOK);
+	vals = malloc(loopmax * sizeof(vals[0]), M_TEMP, M_WAITOK);
 
 	replies = prop_array_create();
 	if (replies == NULL) {
@@ -576,43 +556,72 @@ vfs_quotactl_getall(struct mount *mp,
 		goto err;
 	}
 
-	if (skip) {
-		goto skip;
-	}
-
 	thisreply = NULL;
 	lastid = 0; /* value not actually referenced */
-	for (i = 0; i  result.qr_num; i++) {
-		key = result.qr_keys[i];
-		val = result.qr_vals[i];
-
-		if (thisreply == NULL || key-qk_id != lastid) {
-			lastid = key-qk_id;
-			thisreply = vfs_quotactl_getall_makereply(key);
-			if (thisreply == NULL) {
-error = ENOMEM;
-goto err;
-			}
-			/*
-			 * Note: while we release our reference to
-			 * thisreply here, we can (and do) continue to
-			 * use the pointer in the loop because the
-			 * copy attached to the replies array is not
-			 * going away.
-			 */
-			if (!prop_array_add_and_rel(replies, thisreply)) {
-error = ENOMEM;
-goto err;
-			}
+
+	while (1) {
+		args.qc_type = QCT_GETALL;
+		args.u.getall.qc_cursor = cursor;
+		args.u.getall.qc_keys = keys;
+		args.u.getall.qc_vals = vals;
+		args.u.getall.qc_maxnum = loopmax;
+		args.u.getall.qc_ret = loopnum;
+		args.u.getall.qc_idtype = q2type;	/* XXX */
+
+		error = VFS_QUOTACTL(mp, QUOTACTL_GETALL, args);
+		/*
+		 * XXX this is bogus but up until now *all* errors
+		 * from inside quotactl_getall were suppressed by the
+		 * dispatching code in ufs_quota.c. Fixing that causes
+		 * repquota to break in an undesirable way; this is a
+		 * workaround.
+		 */
+		if (error == ENODEV || error == ENXIO) {
+			error = 0;
+			break;
 		}
 
-		error = vfs_quotactl_getall_addreply(thisreply, key, val);
 		if (error) {
 			goto err;
 		}
-	}
 
-skip:
+		if (loopnum == 0) {
+			/* end of iteration */
+			break;
+		}
+
+		for (i = 0; i  loopnum; i++) {
+			key = keys[i];
+			val = vals[i];
+
+			if (thisreply == NULL || key-qk_id != lastid) {
+lastid = key-qk_id;
+thisreply = vfs_quotactl_getall_makereply(key);
+if (thisreply == NULL) {
+	error = ENOMEM;
+	goto err;
+}
+/*
+ * Note: 

CVS commit: src/sys/ufs/ufs

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:08:00 UTC 2012

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

Log Message:
Fix a preexisting array overrun and a preexisting free twice exposed
by cleanup and testing.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/ufs/ufs/ufs_quota2.c

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

Modified files:

Index: src/sys/ufs/ufs/ufs_quota2.c
diff -u src/sys/ufs/ufs/ufs_quota2.c:1.23 src/sys/ufs/ufs/ufs_quota2.c:1.24
--- src/sys/ufs/ufs/ufs_quota2.c:1.23	Sun Jan 29 07:07:22 2012
+++ src/sys/ufs/ufs/ufs_quota2.c	Sun Jan 29 07:08:00 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota2.c,v 1.23 2012/01/29 07:07:22 dholland Exp $ */
+/* $NetBSD: ufs_quota2.c,v 1.24 2012/01/29 07:08:00 dholland Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -26,7 +26,7 @@
   */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.23 2012/01/29 07:07:22 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.24 2012/01/29 07:08:00 dholland Exp $);
 
 #include sys/buf.h
 #include sys/param.h
@@ -1000,7 +1000,7 @@ q2cursor_check(struct ufsq2_cursor *curs
 
 struct getuids {
 	long nuids; /* number of uids in array */
-	long size;  /* size of array */
+	long maxuids;  /* number of uids allocated */
 	uid_t *uids; /* array of uids, dynamically allocated */
 	long skip;
 	long seen;
@@ -1013,6 +1013,7 @@ quota2_getuids_callback(struct ufsmount 
 {
 	struct getuids *gu = v;
 	uid_t *newuids;
+	long newmax;
 #ifdef FFS_EI
 	const int needswap = UFS_MPNEEDSWAP(ump);
 #endif
@@ -1021,15 +1022,15 @@ quota2_getuids_callback(struct ufsmount 
 		gu-skip--;
 		return 0;
 	}
-	if (gu-nuids == gu-size) {
-		newuids = realloc(gu-uids, gu-size + PAGE_SIZE, M_TEMP,
-		M_WAITOK);
+	if (gu-nuids == gu-maxuids) {
+		newmax = gu-maxuids + PAGE_SIZE / sizeof(uid_t);
+		newuids = realloc(gu-uids, newmax * sizeof(gu-uids[0]),
+		M_TEMP, M_WAITOK);
 		if (newuids == NULL) {
-			free(gu-uids, M_TEMP);
 			return ENOMEM;
 		}
 		gu-uids = newuids;
-		gu-size += (PAGE_SIZE / sizeof(uid_t));
+		gu-maxuids = newmax;
 	}
 	gu-uids[gu-nuids] = ufs_rw32(q2ep-q2e_uid, needswap);
 	gu-nuids++;



CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:08:58 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c ufs_quota.h ufs_quota2.c

Log Message:
Don't pass the idtype to QUOTACTL_GETALL. Instead, iterate both users
and groups.

This change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.24 -r1.25 src/sys/sys/quotactl.h
cvs rdiff -u -r1.96 -r1.97 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.18 -r1.19 src/sys/ufs/ufs/ufs_quota.h
cvs rdiff -u -r1.24 -r1.25 src/sys/ufs/ufs/ufs_quota2.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/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.27 src/sys/kern/vfs_quotactl.c:1.28
--- src/sys/kern/vfs_quotactl.c:1.27	Sun Jan 29 07:07:22 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 07:08:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.27 2012/01/29 07:07:22 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.28 2012/01/29 07:08:58 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.27 2012/01/29 07:07:22 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.28 2012/01/29 07:08:58 dholland Exp $);
 
 #include sys/malloc.h /* XXX: temporary */
 #include sys/mount.h
@@ -566,21 +566,8 @@ vfs_quotactl_getall(struct mount *mp,
 		args.u.getall.qc_vals = vals;
 		args.u.getall.qc_maxnum = loopmax;
 		args.u.getall.qc_ret = loopnum;
-		args.u.getall.qc_idtype = q2type;	/* XXX */
 
 		error = VFS_QUOTACTL(mp, QUOTACTL_GETALL, args);
-		/*
-		 * XXX this is bogus but up until now *all* errors
-		 * from inside quotactl_getall were suppressed by the
-		 * dispatching code in ufs_quota.c. Fixing that causes
-		 * repquota to break in an undesirable way; this is a
-		 * workaround.
-		 */
-		if (error == ENODEV || error == ENXIO) {
-			error = 0;
-			break;
-		}
-
 		if (error) {
 			goto err;
 		}
@@ -594,6 +581,11 @@ vfs_quotactl_getall(struct mount *mp,
 			key = keys[i];
 			val = vals[i];
 
+			if (key-qk_idtype != q2type) {
+/* don't want this result */
+continue;
+			}
+
 			if (thisreply == NULL || key-qk_id != lastid) {
 lastid = key-qk_id;
 thisreply = vfs_quotactl_getall_makereply(key);

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.24 src/sys/sys/quotactl.h:1.25
--- src/sys/sys/quotactl.h:1.24	Sun Jan 29 07:07:22 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 07:08:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.24 2012/01/29 07:07:22 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.25 2012/01/29 07:08:58 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -107,7 +107,6 @@ struct vfs_quotactl_args {
 			struct quotaval *qc_vals;
 			unsigned qc_maxnum;
 			unsigned *qc_ret;
-			int qc_idtype;
 		} getall;
 	} u;
 };

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.96 src/sys/ufs/ufs/ufs_quota.c:1.97
--- src/sys/ufs/ufs/ufs_quota.c:1.96	Sun Jan 29 07:07:22 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 07:08:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.96 2012/01/29 07:07:22 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.97 2012/01/29 07:08:58 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.96 2012/01/29 07:07:22 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.97 2012/01/29 07:08:58 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -374,7 +374,6 @@ quota_handle_cmd_getall(struct mount *mp
 	struct quotaval *vals;
 	unsigned maxnum;
 	unsigned *ret;
-	int idtype;
 	int error;
 
 	KASSERT(args-qc_type == QCT_GETALL);
@@ -383,7 +382,6 @@ quota_handle_cmd_getall(struct mount *mp
 	vals = args-u.getall.qc_vals;
 	maxnum = args-u.getall.qc_maxnum;
 	ret = args-u.getall.qc_ret;
-	idtype = args-u.getall.qc_idtype;
 
 	if ((ump-um_flags  UFS_QUOTA2) == 0)
 		return EOPNOTSUPP;
@@ -395,7 +393,7 @@ quota_handle_cmd_getall(struct mount *mp
 		
 #ifdef QUOTA2
 	if (ump-um_flags  UFS_QUOTA2) {
-		error = quota2_handle_cmd_getall(ump, cursor, idtype,
+		error = quota2_handle_cmd_getall(ump, cursor,
 		 keys, vals, maxnum, ret);
 	} else
 #endif

Index: src/sys/ufs/ufs/ufs_quota.h
diff -u src/sys/ufs/ufs/ufs_quota.h:1.18 src/sys/ufs/ufs/ufs_quota.h:1.19
--- src/sys/ufs/ufs/ufs_quota.h:1.18	Sun Jan 29 07:07:22 2012
+++ src/sys/ufs/ufs/ufs_quota.h	Sun Jan 29 07:08:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.h,v 1.18 2012/01/29 07:07:22 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.h,v 1.19 2012/01/29 07:08:58 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -131,7 +131,7 @@ int 

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:09:53 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c ufs_quota.h ufs_quota2.c

Log Message:
Add QUOTACTL_CURSORSKIPIDTYPE, QUOTACTL_CURSORATEND, QUOTACTL_CURSORREWIND.

This change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.25 -r1.26 src/sys/sys/quotactl.h
cvs rdiff -u -r1.97 -r1.98 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.19 -r1.20 src/sys/ufs/ufs/ufs_quota.h
cvs rdiff -u -r1.25 -r1.26 src/sys/ufs/ufs/ufs_quota2.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/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.28 src/sys/kern/vfs_quotactl.c:1.29
--- src/sys/kern/vfs_quotactl.c:1.28	Sun Jan 29 07:08:58 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 07:09:52 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.28 2012/01/29 07:08:58 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.29 2012/01/29 07:09:52 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.28 2012/01/29 07:08:58 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.29 2012/01/29 07:09:52 dholland Exp $);
 
 #include sys/malloc.h /* XXX: temporary */
 #include sys/mount.h
@@ -560,14 +560,14 @@ vfs_quotactl_getall(struct mount *mp,
 	lastid = 0; /* value not actually referenced */
 
 	while (1) {
-		args.qc_type = QCT_GETALL;
-		args.u.getall.qc_cursor = cursor;
-		args.u.getall.qc_keys = keys;
-		args.u.getall.qc_vals = vals;
-		args.u.getall.qc_maxnum = loopmax;
-		args.u.getall.qc_ret = loopnum;
+		args.qc_type = QCT_CURSORGET;
+		args.u.cursorget.qc_cursor = cursor;
+		args.u.cursorget.qc_keys = keys;
+		args.u.cursorget.qc_vals = vals;
+		args.u.cursorget.qc_maxnum = loopmax;
+		args.u.cursorget.qc_ret = loopnum;
 
-		error = VFS_QUOTACTL(mp, QUOTACTL_GETALL, args);
+		error = VFS_QUOTACTL(mp, QUOTACTL_CURSORGET, args);
 		if (error) {
 			goto err;
 		}

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.25 src/sys/sys/quotactl.h:1.26
--- src/sys/sys/quotactl.h:1.25	Sun Jan 29 07:08:58 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 07:09:52 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.25 2012/01/29 07:08:58 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.26 2012/01/29 07:09:52 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -57,10 +57,13 @@ struct quotakcursor {
 #define QUOTACTL_QUOTAOFF	2
 #define QUOTACTL_GET		3
 #define QUOTACTL_PUT		4
-#define QUOTACTL_GETALL		5
+#define QUOTACTL_CURSORGET	5
 #define QUOTACTL_DELETE		6
 #define QUOTACTL_CURSOROPEN	7
 #define QUOTACTL_CURSORCLOSE	8
+#define QUOTACTL_CURSORSKIPIDTYPE 9
+#define QUOTACTL_CURSORATEND	10
+#define QUOTACTL_CURSORREWIND	11
 
 /* Argument encoding. */
 enum vfs_quotactl_argtypes {
@@ -71,7 +74,10 @@ enum vfs_quotactl_argtypes {
 	QCT_DELETE,	/* delete */
 	QCT_CURSOROPEN,	/* open cursor */
 	QCT_CURSORCLOSE,/* close cursor */
-	QCT_GETALL,	/* get all */
+	QCT_CURSORGET,	/* get from cursor */
+	QCT_CURSORSKIPIDTYPE, /* iteration hint */
+	QCT_CURSORATEND,/* test cursor */
+	QCT_CURSORREWIND,/* reset cursor */
 };
 struct vfs_quotactl_args {
 	enum vfs_quotactl_argtypes qc_type;
@@ -103,11 +109,22 @@ struct vfs_quotactl_args {
 		} cursorclose;
 		struct {
 			struct quotakcursor *qc_cursor;
+			unsigned qc_idtype;
+		} cursorskipidtype;
+		struct {
+			struct quotakcursor *qc_cursor;
 			struct quotakey *qc_keys;
 			struct quotaval *qc_vals;
 			unsigned qc_maxnum;
 			unsigned *qc_ret;
-		} getall;
+		} cursorget;
+		struct {
+			struct quotakcursor *qc_cursor;
+			int *qc_ret; /* really boolean */
+		} cursoratend;
+		struct {
+			struct quotakcursor *qc_cursor;
+		} cursorrewind;
 	} u;
 };
 

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.97 src/sys/ufs/ufs/ufs_quota.c:1.98
--- src/sys/ufs/ufs/ufs_quota.c:1.97	Sun Jan 29 07:08:58 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 07:09:52 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.97 2012/01/29 07:08:58 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.98 2012/01/29 07:09:52 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.97 2012/01/29 07:08:58 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.98 2012/01/29 07:09:52 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -77,7 +77,7 @@ static int quota_handle_cmd_get(struct m
 struct vfs_quotactl_args *args);
 static int quota_handle_cmd_put(struct mount *, struct lwp *,
 struct vfs_quotactl_args *args);
-static int quota_handle_cmd_getall(struct mount *, struct lwp 

CVS commit: src/sys/kern

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:10:25 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c

Log Message:
Use QUOTACTL_CURSORSKIPIDTYPE and QUOTACTL_CURSORATEND in
vfs_quotactl. Have it restart from the beginning if it receives
EDEADLK, which requires QUOTACTL_CURSORREWIND.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/kern/vfs_quotactl.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/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.29 src/sys/kern/vfs_quotactl.c:1.30
--- src/sys/kern/vfs_quotactl.c:1.29	Sun Jan 29 07:09:52 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 07:10:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.29 2012/01/29 07:09:52 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.30 2012/01/29 07:10:24 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.29 2012/01/29 07:09:52 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.30 2012/01/29 07:10:24 dholland Exp $);
 
 #include sys/malloc.h /* XXX: temporary */
 #include sys/mount.h
@@ -529,8 +529,10 @@ vfs_quotactl_getall(struct mount *mp,
 	struct quotaval *vals;
 	unsigned loopmax = 8;
 	unsigned loopnum;
+	int skipidtype;
 	struct vfs_quotactl_args args;
 	prop_array_t replies;
+	int atend, atzero;
 	struct quotakey *key;
 	struct quotaval *val;
 	id_t lastid;
@@ -550,6 +552,15 @@ vfs_quotactl_getall(struct mount *mp,
 	keys = malloc(loopmax * sizeof(keys[0]), M_TEMP, M_WAITOK);
 	vals = malloc(loopmax * sizeof(vals[0]), M_TEMP, M_WAITOK);
 
+	skipidtype = (q2type == QUOTA_IDTYPE_USER ?
+		  QUOTA_IDTYPE_GROUP : QUOTA_IDTYPE_USER);
+	args.qc_type = QCT_CURSORSKIPIDTYPE;
+	args.u.cursorskipidtype.qc_cursor = cursor;
+	args.u.cursorskipidtype.qc_idtype = skipidtype;
+	error = VFS_QUOTACTL(mp, QUOTACTL_CURSORSKIPIDTYPE, args);
+	/* ignore if it fails */
+	(void)error;
+
 	replies = prop_array_create();
 	if (replies == NULL) {
 		error = ENOMEM;
@@ -558,8 +569,20 @@ vfs_quotactl_getall(struct mount *mp,
 
 	thisreply = NULL;
 	lastid = 0; /* value not actually referenced */
+	atzero = 0;
 
 	while (1) {
+		args.qc_type = QCT_CURSORATEND;
+		args.u.cursoratend.qc_cursor = cursor;
+		args.u.cursoratend.qc_ret = atend;
+		error = VFS_QUOTACTL(mp, QUOTACTL_CURSORATEND, args);
+		if (error) {
+			goto err;
+		}
+		if (atend) {
+			break;
+		}
+
 		args.qc_type = QCT_CURSORGET;
 		args.u.cursorget.qc_cursor = cursor;
 		args.u.cursorget.qc_keys = keys;
@@ -568,13 +591,58 @@ vfs_quotactl_getall(struct mount *mp,
 		args.u.cursorget.qc_ret = loopnum;
 
 		error = VFS_QUOTACTL(mp, QUOTACTL_CURSORGET, args);
+		if (error == EDEADLK) {
+			/*
+			 * transaction abort, start over
+			 */
+
+			args.qc_type = QCT_CURSORREWIND;
+			args.u.cursorrewind.qc_cursor = cursor;
+			error = VFS_QUOTACTL(mp, QUOTACTL_CURSORREWIND, args);
+			if (error) {
+goto err;
+			}
+
+			args.qc_type = QCT_CURSORSKIPIDTYPE;
+			args.u.cursorskipidtype.qc_cursor = cursor;
+			args.u.cursorskipidtype.qc_idtype = skipidtype;
+			error = VFS_QUOTACTL(mp, QUOTACTL_CURSORSKIPIDTYPE,
+	 args);
+			/* ignore if it fails */
+			(void)error;
+
+			prop_object_release(replies);
+			replies = prop_array_create();
+			if (replies == NULL) {
+error = ENOMEM;
+goto err;
+			}
+
+			thisreply = NULL;
+			lastid = 0;
+			atzero = 0;
+
+			continue;
+		}
 		if (error) {
 			goto err;
 		}
 
 		if (loopnum == 0) {
-			/* end of iteration */
-			break;
+			/*
+			 * This is not supposed to happen. However,
+			 * allow a return of zero items once as long
+			 * as something happens (including an atend
+			 * indication) on the next pass. If it happens
+			 * twice, warn and assume end of iteration.
+			 */
+			if (atzero) {
+printf(vfs_quotactl: zero items returned\n);
+break;
+			}
+			atzero = 1;
+		} else {
+			atzero = 0;
 		}
 
 		for (i = 0; i  loopnum; i++) {
@@ -616,15 +684,21 @@ vfs_quotactl_getall(struct mount *mp,
 	}
 
 	if (!prop_dictionary_set_and_rel(cmddict, data, replies)) {
+		replies = NULL;
 		error = ENOMEM;
 		goto err;
 	}
-
+	replies = NULL;
 	error = 0;
+
  err:
 	free(keys, M_TEMP);
 	free(vals, M_TEMP);
 
+	if (replies != NULL) {
+		prop_object_release(replies);
+	}
+
 	args.qc_type = QCT_CURSORCLOSE;
 	args.u.cursorclose.qc_cursor = cursor;
 	error2 = VFS_QUOTACTL(mp, QUOTACTL_CURSORCLOSE, args);



CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:11:12 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c

Log Message:
Move the proplib bits for QUOTACTL_QUOTAON out of the ufs code.

This change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.26 -r1.27 src/sys/sys/quotactl.h
cvs rdiff -u -r1.98 -r1.99 src/sys/ufs/ufs/ufs_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/sys/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.30 src/sys/kern/vfs_quotactl.c:1.31
--- src/sys/kern/vfs_quotactl.c:1.30	Sun Jan 29 07:10:24 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 07:11:12 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.30 2012/01/29 07:10:24 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.31 2012/01/29 07:11:12 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.30 2012/01/29 07:10:24 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.31 2012/01/29 07:11:12 dholland Exp $);
 
 #include sys/malloc.h /* XXX: temporary */
 #include sys/mount.h
@@ -144,12 +144,26 @@ vfs_quotactl_quotaon(struct mount *mp,
 		 prop_dictionary_t cmddict, int q2type,
 		 prop_array_t datas)
 {
+	prop_dictionary_t data;
+	const char *qfile;
 	struct vfs_quotactl_args args;
 
-	args.qc_type = QCT_PROPLIB;
-	args.u.proplib.qc_cmddict = cmddict;
-	args.u.proplib.qc_q2type = q2type;
-	args.u.proplib.qc_datas = datas;
+	KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY);
+	KASSERT(prop_object_type(datas) == PROP_TYPE_ARRAY);
+
+	if (prop_array_count(datas) != 1)
+		return EINVAL;
+
+	data = prop_array_get(datas, 0);
+	if (data == NULL)
+		return ENOMEM;
+	if (!prop_dictionary_get_cstring_nocopy(data, quotafile,
+	qfile))
+		return EINVAL;
+
+	args.qc_type = QCT_QUOTAON;
+	args.u.quotaon.qc_idtype = q2type;
+	args.u.quotaon.qc_quotafile = qfile;
 	return VFS_QUOTACTL(mp, QUOTACTL_QUOTAON, args);
 }
 

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.26 src/sys/sys/quotactl.h:1.27
--- src/sys/sys/quotactl.h:1.26	Sun Jan 29 07:09:52 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 07:11:12 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.26 2012/01/29 07:09:52 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.27 2012/01/29 07:11:12 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -67,7 +67,7 @@ struct quotakcursor {
 
 /* Argument encoding. */
 enum vfs_quotactl_argtypes {
-	QCT_PROPLIB,	/* quotaon/off */
+	QCT_PROPLIB,	/* quotaoff */
 	QCT_GETVERSION,	/* getversion */
 	QCT_GET,	/* get */
 	QCT_PUT,	/* put */
@@ -78,6 +78,7 @@ enum vfs_quotactl_argtypes {
 	QCT_CURSORSKIPIDTYPE, /* iteration hint */
 	QCT_CURSORATEND,/* test cursor */
 	QCT_CURSORREWIND,/* reset cursor */
+	QCT_QUOTAON,	/* quotaon */
 };
 struct vfs_quotactl_args {
 	enum vfs_quotactl_argtypes qc_type;
@@ -125,6 +126,10 @@ struct vfs_quotactl_args {
 		struct {
 			struct quotakcursor *qc_cursor;
 		} cursorrewind;
+		struct {
+			int qc_idtype;
+			const char *qc_quotafile;
+		} quotaon;
 	} u;
 };
 

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.98 src/sys/ufs/ufs/ufs_quota.c:1.99
--- src/sys/ufs/ufs/ufs_quota.c:1.98	Sun Jan 29 07:09:52 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 07:11:12 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.98 2012/01/29 07:09:52 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.99 2012/01/29 07:11:12 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.98 2012/01/29 07:09:52 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.99 2012/01/29 07:11:12 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -540,42 +540,25 @@ static int 
 quota_handle_cmd_quotaon(struct mount *mp, struct lwp *l, 
 struct vfs_quotactl_args *args)
 {
-	prop_dictionary_t data;
 	struct ufsmount *ump = VFSTOUFS(mp);
-	int error;
+	int idtype;
 	const char *qfile;
-	prop_dictionary_t cmddict;
-	int q2type;
-	prop_array_t datas;
-
-	KASSERT(args-qc_type == QCT_PROPLIB);
-	cmddict = args-u.proplib.qc_cmddict;
-	q2type = args-u.proplib.qc_q2type;
-	datas = args-u.proplib.qc_datas;
+	int error;
 
-	KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY);
-	KASSERT(prop_object_type(datas) == PROP_TYPE_ARRAY);
+	KASSERT(args-qc_type == QCT_QUOTAON);
+	idtype = args-u.quotaon.qc_idtype;
+	qfile = args-u.quotaon.qc_quotafile;
 
 	if ((ump-um_flags  UFS_QUOTA2) != 0)
 		return EBUSY;
 	
-	if (prop_array_count(datas) != 1)
-		return EINVAL;
-
-	data = prop_array_get(datas, 0);
-	if (data == NULL)
-		return ENOMEM;

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:11:55 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c

Log Message:
Move proplib bits for QUOTACTL_QUOTAOFF out of the ufs code.

This change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.27 -r1.28 src/sys/sys/quotactl.h
cvs rdiff -u -r1.99 -r1.100 src/sys/ufs/ufs/ufs_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/sys/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.31 src/sys/kern/vfs_quotactl.c:1.32
--- src/sys/kern/vfs_quotactl.c:1.31	Sun Jan 29 07:11:12 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 07:11:55 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.31 2012/01/29 07:11:12 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.32 2012/01/29 07:11:55 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.31 2012/01/29 07:11:12 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.32 2012/01/29 07:11:55 dholland Exp $);
 
 #include sys/malloc.h /* XXX: temporary */
 #include sys/mount.h
@@ -174,10 +174,14 @@ vfs_quotactl_quotaoff(struct mount *mp,
 {
 	struct vfs_quotactl_args args;
 
-	args.qc_type = QCT_PROPLIB;
-	args.u.proplib.qc_cmddict = cmddict;
-	args.u.proplib.qc_q2type = q2type;
-	args.u.proplib.qc_datas = datas;
+	KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY);
+	KASSERT(prop_object_type(datas) == PROP_TYPE_ARRAY);
+
+	if (prop_array_count(datas) != 0)
+		return EINVAL;
+
+	args.qc_type = QCT_QUOTAOFF;
+	args.u.quotaoff.qc_idtype = q2type;
 	return VFS_QUOTACTL(mp, QUOTACTL_QUOTAOFF, args);
 }
 

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.27 src/sys/sys/quotactl.h:1.28
--- src/sys/sys/quotactl.h:1.27	Sun Jan 29 07:11:12 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 07:11:55 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.27 2012/01/29 07:11:12 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.28 2012/01/29 07:11:55 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -67,7 +67,7 @@ struct quotakcursor {
 
 /* Argument encoding. */
 enum vfs_quotactl_argtypes {
-	QCT_PROPLIB,	/* quotaoff */
+	QCT_PROPLIB,	/* unused */
 	QCT_GETVERSION,	/* getversion */
 	QCT_GET,	/* get */
 	QCT_PUT,	/* put */
@@ -79,6 +79,7 @@ enum vfs_quotactl_argtypes {
 	QCT_CURSORATEND,/* test cursor */
 	QCT_CURSORREWIND,/* reset cursor */
 	QCT_QUOTAON,	/* quotaon */
+	QCT_QUOTAOFF,	/* quotaoff */
 };
 struct vfs_quotactl_args {
 	enum vfs_quotactl_argtypes qc_type;
@@ -130,6 +131,9 @@ struct vfs_quotactl_args {
 			int qc_idtype;
 			const char *qc_quotafile;
 		} quotaon;
+		struct {
+			int qc_idtype;
+		} quotaoff;
 	} u;
 };
 

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.99 src/sys/ufs/ufs/ufs_quota.c:1.100
--- src/sys/ufs/ufs/ufs_quota.c:1.99	Sun Jan 29 07:11:12 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 07:11:55 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.99 2012/01/29 07:11:12 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.100 2012/01/29 07:11:55 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.99 2012/01/29 07:11:12 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.100 2012/01/29 07:11:55 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -571,32 +571,22 @@ quota_handle_cmd_quotaoff(struct mount *
 struct vfs_quotactl_args *args)
 {
 	struct ufsmount *ump = VFSTOUFS(mp);
+	int idtype;
 	int error;
-	prop_dictionary_t cmddict;
-	int q2type;
-	prop_array_t datas;
-
-	KASSERT(args-qc_type == QCT_PROPLIB);
-	cmddict = args-u.proplib.qc_cmddict;
-	q2type = args-u.proplib.qc_q2type;
-	datas = args-u.proplib.qc_datas;
 
-	KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY);
-	KASSERT(prop_object_type(datas) == PROP_TYPE_ARRAY);
+	KASSERT(args-qc_type == QCT_QUOTAOFF);
+	idtype = args-u.quotaoff.qc_idtype;
 
 	if ((ump-um_flags  UFS_QUOTA2) != 0)
 		return EOPNOTSUPP;
 	
-	if (prop_array_count(datas) != 0)
-		return EINVAL;
-
 	error = kauth_authorize_system(l-l_cred, KAUTH_SYSTEM_FS_QUOTA,
 	KAUTH_REQ_SYSTEM_FS_QUOTA_ONOFF, mp, NULL, NULL);
 	if (error != 0) {
 		return error;
 	}
 #ifdef QUOTA
-	error = quota1_handle_cmd_quotaoff(l, ump, q2type);
+	error = quota1_handle_cmd_quotaoff(l, ump, idtype);
 #else
 	error = EOPNOTSUPP;
 #endif



CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:12:41 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c

Log Message:
Change QUOTACTL_GETVERSION to QUOTACTL_STAT. Add struct quotastat.

This change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.28 -r1.29 src/sys/sys/quotactl.h
cvs rdiff -u -r1.100 -r1.101 src/sys/ufs/ufs/ufs_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/sys/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.32 src/sys/kern/vfs_quotactl.c:1.33
--- src/sys/kern/vfs_quotactl.c:1.32	Sun Jan 29 07:11:55 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 07:12:40 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.32 2012/01/29 07:11:55 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.33 2012/01/29 07:12:40 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.32 2012/01/29 07:11:55 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.33 2012/01/29 07:12:40 dholland Exp $);
 
 #include sys/malloc.h /* XXX: temporary */
 #include sys/mount.h
@@ -95,6 +95,7 @@ vfs_quotactl_getversion(struct mount *mp
 {
 	prop_array_t replies;
 	prop_dictionary_t data;
+	struct quotastat stat;
 	int q2version;
 	struct vfs_quotactl_args args;
 	int error;
@@ -102,13 +103,24 @@ vfs_quotactl_getversion(struct mount *mp
 	KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY);
 	KASSERT(prop_object_type(datas) == PROP_TYPE_ARRAY);
 
-	args.qc_type = QCT_GETVERSION;
-	args.u.getversion.qc_version_ret = q2version;
-	error = VFS_QUOTACTL(mp, QUOTACTL_GETVERSION, args);
+	args.qc_type = QCT_STAT;
+	args.u.stat.qc_ret = stat;
+	error = VFS_QUOTACTL(mp, QUOTACTL_STAT, args);
 	if (error) {
 		return error;
 	}
 
+	/*
+	 * Set q2version based on the stat results. Currently there
+	 * are two valid values for q2version, 1 and 2, which we pick
+	 * based on whether quotacheck is required.
+	 */
+	if (stat.qs_restrictions  QUOTA_RESTRICT_NEEDSQUOTACHECK) {
+		q2version = 1;
+	} else {
+		q2version = 2;
+	}
+
 	data = prop_dictionary_create();
 	if (data == NULL) {
 		return ENOMEM;

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.28 src/sys/sys/quotactl.h:1.29
--- src/sys/sys/quotactl.h:1.28	Sun Jan 29 07:11:55 2012
+++ src/sys/sys/quotactl.h	Sun Jan 29 07:12:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.28 2012/01/29 07:11:55 dholland Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.29 2012/01/29 07:12:41 dholland Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -37,6 +37,26 @@
  * use the quota.h API instead.
  */
 
+/* Size of random quota strings */
+#define QUOTA_NAMELEN   32
+
+/*
+ * Restrictions for qs_restrictions.
+ */
+#define QUOTA_RESTRICT_NEEDSQUOTACHECK	0x1	/* quotacheck(8) required */
+#define QUOTA_RESTRICT_UNIFORMGRACE	0x2	/* grace time is global */
+#define QUOTA_RESTRICT_32BIT		0x4	/* values limited to 2^32 */
+
+/*  
+ * Structure for QUOTACTL_STAT.
+ */ 
+struct quotastat {
+	char qs_implname[QUOTA_NAMELEN];
+	unsigned qs_numidtypes;
+	unsigned qs_numobjtypes;
+	unsigned qs_restrictions;
+};
+
 /*
  * Semi-opaque structure for cursors. This holds the cursor state in
  * userland; the size is exposed only to libquota, not to client code,
@@ -52,7 +72,7 @@ struct quotakcursor {
 };
 
 /* Command codes. */
-#define QUOTACTL_GETVERSION	0
+#define QUOTACTL_STAT		0
 #define QUOTACTL_QUOTAON	1
 #define QUOTACTL_QUOTAOFF	2
 #define QUOTACTL_GET		3
@@ -68,7 +88,7 @@ struct quotakcursor {
 /* Argument encoding. */
 enum vfs_quotactl_argtypes {
 	QCT_PROPLIB,	/* unused */
-	QCT_GETVERSION,	/* getversion */
+	QCT_STAT,	/* stat */
 	QCT_GET,	/* get */
 	QCT_PUT,	/* put */
 	QCT_DELETE,	/* delete */
@@ -90,8 +110,8 @@ struct vfs_quotactl_args {
 			prop_array_t qc_datas;
 		} proplib;
 		struct {
-			int *qc_version_ret;
-		} getversion;
+			struct quotastat *qc_ret;
+		} stat;
 		struct {
 			const struct quotakey *qc_key;
 			struct quotaval *qc_ret;

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.100 src/sys/ufs/ufs/ufs_quota.c:1.101
--- src/sys/ufs/ufs/ufs_quota.c:1.100	Sun Jan 29 07:11:55 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 07:12:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.100 2012/01/29 07:11:55 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.101 2012/01/29 07:12:41 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.100 2012/01/29 07:11:55 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.101 2012/01/29 07:12:41 dholland 

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:13:43 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c vfs_subr.c
src/sys/sys: quotactl.h
src/sys/ufs/ufs: ufs_quota.c

Log Message:
Tidy up the VFS_QUOTACTL interface. Renumber the command codes in a
logical order (as opposed to the previous order, which accumulated
arbitrarily), remove the separate codes for argument encoding as
there's now a 1-1 mapping between ops and argument substructures,
and assert in VFS_QUOTACTL() itself that the op in the args structure
matches the op passed directly.

This change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.429 -r1.430 src/sys/kern/vfs_subr.c
cvs rdiff -u -r1.29 -r1.30 src/sys/sys/quotactl.h
cvs rdiff -u -r1.101 -r1.102 src/sys/ufs/ufs/ufs_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/sys/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.33 src/sys/kern/vfs_quotactl.c:1.34
--- src/sys/kern/vfs_quotactl.c:1.33	Sun Jan 29 07:12:40 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 07:13:42 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.33 2012/01/29 07:12:40 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.34 2012/01/29 07:13:42 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.33 2012/01/29 07:12:40 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.34 2012/01/29 07:13:42 dholland Exp $);
 
 #include sys/malloc.h /* XXX: temporary */
 #include sys/mount.h
@@ -103,7 +103,7 @@ vfs_quotactl_getversion(struct mount *mp
 	KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY);
 	KASSERT(prop_object_type(datas) == PROP_TYPE_ARRAY);
 
-	args.qc_type = QCT_STAT;
+	args.qc_op = QUOTACTL_STAT;
 	args.u.stat.qc_ret = stat;
 	error = VFS_QUOTACTL(mp, QUOTACTL_STAT, args);
 	if (error) {
@@ -173,7 +173,7 @@ vfs_quotactl_quotaon(struct mount *mp,
 	qfile))
 		return EINVAL;
 
-	args.qc_type = QCT_QUOTAON;
+	args.qc_op = QUOTACTL_QUOTAON;
 	args.u.quotaon.qc_idtype = q2type;
 	args.u.quotaon.qc_quotafile = qfile;
 	return VFS_QUOTACTL(mp, QUOTACTL_QUOTAON, args);
@@ -192,7 +192,7 @@ vfs_quotactl_quotaoff(struct mount *mp,
 	if (prop_array_count(datas) != 0)
 		return EINVAL;
 
-	args.qc_type = QCT_QUOTAOFF;
+	args.qc_op = QUOTACTL_QUOTAOFF;
 	args.u.quotaoff.qc_idtype = q2type;
 	return VFS_QUOTACTL(mp, QUOTACTL_QUOTAOFF, args);
 }
@@ -280,7 +280,7 @@ vfs_quotactl_get(struct mount *mp,
 
 		qk.qk_objtype = QUOTA_OBJTYPE_BLOCKS;
 
-		args.qc_type = QCT_GET;
+		args.qc_op = QUOTACTL_GET;
 		args.u.get.qc_key = qk;
 		args.u.get.qc_ret = blocks;
 		error = VFS_QUOTACTL(mp, QUOTACTL_GET, args);
@@ -296,7 +296,7 @@ vfs_quotactl_get(struct mount *mp,
 
 		qk.qk_objtype = QUOTA_OBJTYPE_FILES;
 
-		args.qc_type = QCT_GET;
+		args.qc_op = QUOTACTL_GET;
 		args.u.get.qc_key = qk;
 		args.u.get.qc_ret = files;
 		error = VFS_QUOTACTL(mp, QUOTACTL_GET, args);
@@ -435,7 +435,7 @@ vfs_quotactl_put(struct mount *mp,
 		qk.qk_id = defaultq ? QUOTA_DEFAULTID : id;
 		qk.qk_objtype = QUOTA_OBJTYPE_BLOCKS;
 
-		args.qc_type = QCT_PUT;
+		args.qc_op = QUOTACTL_PUT;
 		args.u.put.qc_key = qk;
 		args.u.put.qc_val = blocks;
 		error = VFS_QUOTACTL(mp, QUOTACTL_PUT, args);
@@ -447,7 +447,7 @@ vfs_quotactl_put(struct mount *mp,
 		qk.qk_id = defaultq ? QUOTA_DEFAULTID : id;
 		qk.qk_objtype = QUOTA_OBJTYPE_FILES;
 
-		args.qc_type = QCT_PUT;
+		args.qc_op = QUOTACTL_PUT;
 		args.u.put.qc_key = qk;
 		args.u.put.qc_val = files;
 		error = VFS_QUOTACTL(mp, QUOTACTL_PUT, args);
@@ -572,7 +572,7 @@ vfs_quotactl_getall(struct mount *mp,
 
 	KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY);
 
-	args.qc_type = QCT_CURSOROPEN;
+	args.qc_op = QUOTACTL_CURSOROPEN;
 	args.u.cursoropen.qc_cursor = cursor;
 	error = VFS_QUOTACTL(mp, QUOTACTL_CURSOROPEN, args);
 	if (error) {
@@ -584,7 +584,7 @@ vfs_quotactl_getall(struct mount *mp,
 
 	skipidtype = (q2type == QUOTA_IDTYPE_USER ?
 		  QUOTA_IDTYPE_GROUP : QUOTA_IDTYPE_USER);
-	args.qc_type = QCT_CURSORSKIPIDTYPE;
+	args.qc_op = QUOTACTL_CURSORSKIPIDTYPE;
 	args.u.cursorskipidtype.qc_cursor = cursor;
 	args.u.cursorskipidtype.qc_idtype = skipidtype;
 	error = VFS_QUOTACTL(mp, QUOTACTL_CURSORSKIPIDTYPE, args);
@@ -602,7 +602,7 @@ vfs_quotactl_getall(struct mount *mp,
 	atzero = 0;
 
 	while (1) {
-		args.qc_type = QCT_CURSORATEND;
+		args.qc_op = QUOTACTL_CURSORATEND;
 		args.u.cursoratend.qc_cursor = cursor;
 		args.u.cursoratend.qc_ret = atend;
 		error = VFS_QUOTACTL(mp, QUOTACTL_CURSORATEND, args);
@@ -613,7 +613,7 @@ vfs_quotactl_getall(struct mount *mp,
 			break;
 		}
 
-		args.qc_type = QCT_CURSORGET;
+		args.qc_op = QUOTACTL_CURSORGET;
 		args.u.cursorget.qc_cursor = cursor;
 		args.u.cursorget.qc_keys = keys;
 

CVS commit: src/sys

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:14:39 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c vfs_subr.c
src/sys/miscfs/genfs: layer_extern.h layer_vfsops.c
src/sys/sys: mount.h
src/sys/ufs/ufs: ufs_extern.h ufs_quota.c ufs_vfsops.c

Log Message:
Remove the extra op argument to VFS_QUOTACTL() - the op is now stored
purely in the args structure.

This change requires a kernel version bump.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/kern/vfs_quotactl.c
cvs rdiff -u -r1.430 -r1.431 src/sys/kern/vfs_subr.c
cvs rdiff -u -r1.32 -r1.33 src/sys/miscfs/genfs/layer_extern.h
cvs rdiff -u -r1.37 -r1.38 src/sys/miscfs/genfs/layer_vfsops.c
cvs rdiff -u -r1.205 -r1.206 src/sys/sys/mount.h
cvs rdiff -u -r1.69 -r1.70 src/sys/ufs/ufs/ufs_extern.h
cvs rdiff -u -r1.102 -r1.103 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.46 -r1.47 src/sys/ufs/ufs/ufs_vfsops.c

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

Modified files:

Index: src/sys/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.34 src/sys/kern/vfs_quotactl.c:1.35
--- src/sys/kern/vfs_quotactl.c:1.34	Sun Jan 29 07:13:42 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 07:14:38 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.34 2012/01/29 07:13:42 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.35 2012/01/29 07:14:38 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.34 2012/01/29 07:13:42 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.35 2012/01/29 07:14:38 dholland Exp $);
 
 #include sys/malloc.h /* XXX: temporary */
 #include sys/mount.h
@@ -105,7 +105,7 @@ vfs_quotactl_getversion(struct mount *mp
 
 	args.qc_op = QUOTACTL_STAT;
 	args.u.stat.qc_ret = stat;
-	error = VFS_QUOTACTL(mp, QUOTACTL_STAT, args);
+	error = VFS_QUOTACTL(mp, args);
 	if (error) {
 		return error;
 	}
@@ -176,7 +176,7 @@ vfs_quotactl_quotaon(struct mount *mp,
 	args.qc_op = QUOTACTL_QUOTAON;
 	args.u.quotaon.qc_idtype = q2type;
 	args.u.quotaon.qc_quotafile = qfile;
-	return VFS_QUOTACTL(mp, QUOTACTL_QUOTAON, args);
+	return VFS_QUOTACTL(mp, args);
 }
 
 static int
@@ -194,7 +194,7 @@ vfs_quotactl_quotaoff(struct mount *mp,
 
 	args.qc_op = QUOTACTL_QUOTAOFF;
 	args.u.quotaoff.qc_idtype = q2type;
-	return VFS_QUOTACTL(mp, QUOTACTL_QUOTAOFF, args);
+	return VFS_QUOTACTL(mp, args);
 }
 
 static int
@@ -283,7 +283,7 @@ vfs_quotactl_get(struct mount *mp,
 		args.qc_op = QUOTACTL_GET;
 		args.u.get.qc_key = qk;
 		args.u.get.qc_ret = blocks;
-		error = VFS_QUOTACTL(mp, QUOTACTL_GET, args);
+		error = VFS_QUOTACTL(mp, args);
 		if (error == EPERM) {
 			/* XXX does this make sense? */
 			continue;
@@ -299,7 +299,7 @@ vfs_quotactl_get(struct mount *mp,
 		args.qc_op = QUOTACTL_GET;
 		args.u.get.qc_key = qk;
 		args.u.get.qc_ret = files;
-		error = VFS_QUOTACTL(mp, QUOTACTL_GET, args);
+		error = VFS_QUOTACTL(mp, args);
 		if (error == EPERM) {
 			/* XXX does this make sense? */
 			continue;
@@ -438,7 +438,7 @@ vfs_quotactl_put(struct mount *mp,
 		args.qc_op = QUOTACTL_PUT;
 		args.u.put.qc_key = qk;
 		args.u.put.qc_val = blocks;
-		error = VFS_QUOTACTL(mp, QUOTACTL_PUT, args);
+		error = VFS_QUOTACTL(mp, args);
 		if (error) {
 			goto err;
 		}
@@ -450,7 +450,7 @@ vfs_quotactl_put(struct mount *mp,
 		args.qc_op = QUOTACTL_PUT;
 		args.u.put.qc_key = qk;
 		args.u.put.qc_val = files;
-		error = VFS_QUOTACTL(mp, QUOTACTL_PUT, args);
+		error = VFS_QUOTACTL(mp, args);
 		if (error) {
 			goto err;
 		}
@@ -574,7 +574,7 @@ vfs_quotactl_getall(struct mount *mp,
 
 	args.qc_op = QUOTACTL_CURSOROPEN;
 	args.u.cursoropen.qc_cursor = cursor;
-	error = VFS_QUOTACTL(mp, QUOTACTL_CURSOROPEN, args);
+	error = VFS_QUOTACTL(mp, args);
 	if (error) {
 		return error;
 	}
@@ -587,7 +587,7 @@ vfs_quotactl_getall(struct mount *mp,
 	args.qc_op = QUOTACTL_CURSORSKIPIDTYPE;
 	args.u.cursorskipidtype.qc_cursor = cursor;
 	args.u.cursorskipidtype.qc_idtype = skipidtype;
-	error = VFS_QUOTACTL(mp, QUOTACTL_CURSORSKIPIDTYPE, args);
+	error = VFS_QUOTACTL(mp, args);
 	/* ignore if it fails */
 	(void)error;
 
@@ -605,7 +605,7 @@ vfs_quotactl_getall(struct mount *mp,
 		args.qc_op = QUOTACTL_CURSORATEND;
 		args.u.cursoratend.qc_cursor = cursor;
 		args.u.cursoratend.qc_ret = atend;
-		error = VFS_QUOTACTL(mp, QUOTACTL_CURSORATEND, args);
+		error = VFS_QUOTACTL(mp, args);
 		if (error) {
 			goto err;
 		}
@@ -620,7 +620,7 @@ vfs_quotactl_getall(struct mount *mp,
 		args.u.cursorget.qc_maxnum = loopmax;
 		args.u.cursorget.qc_ret = loopnum;
 
-		error = VFS_QUOTACTL(mp, QUOTACTL_CURSORGET, args);
+		error = VFS_QUOTACTL(mp, args);
 		if (error == EDEADLK) {
 			/*
 			 * transaction abort, start over
@@ -628,7 +628,7 @@ vfs_quotactl_getall(struct mount *mp,
 
 			args.qc_op = QUOTACTL_CURSORREWIND;
 			

CVS commit: src

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:16:01 UTC 2012

Modified Files:
src/sys/compat/common: vfs_syscalls_50.c
src/sys/ufs/ufs: quota.h
src/usr.sbin/edquota: edquota.c

Log Message:
Rename static inline helper functions:
   ufsclass2qtype - quota_idtype_to_ufs
   qtype2ufsclass - quota_idtype_from_ufs

The reason for the direction of ufs changing is that the old names
were among the symbols using ufs to mean fs-independent. So the
old names were for translating ufsclass (fs-independent quota id
type) to qtype (ufs-specific quota id type) and vice versa.

These functions are used in only two places, both of which are
inappropriate, so at some point they should probably be removed.
They're also identity transformations so not particularly helpful,
unless one were to make a careful and concerted effort to distinguish
the ufs quota code numbers from the fs-independent ones. This has not
been done and is probably impossible without support from a program
verifier, and maybe not even then.

They are static inline, so no compat concerns arise.

Also adjust the symbols they use to avoid quota/quotaprop.h.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/compat/common/vfs_syscalls_50.c
cvs rdiff -u -r1.28 -r1.29 src/sys/ufs/ufs/quota.h
cvs rdiff -u -r1.42 -r1.43 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/sys/compat/common/vfs_syscalls_50.c
diff -u src/sys/compat/common/vfs_syscalls_50.c:1.12 src/sys/compat/common/vfs_syscalls_50.c:1.13
--- src/sys/compat/common/vfs_syscalls_50.c:1.12	Sun Jan 29 06:29:04 2012
+++ src/sys/compat/common/vfs_syscalls_50.c	Sun Jan 29 07:16:00 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_50.c,v 1.12 2012/01/29 06:29:04 dholland Exp $	*/
+/*	$NetBSD: vfs_syscalls_50.c,v 1.13 2012/01/29 07:16:00 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_50.c,v 1.12 2012/01/29 06:29:04 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_50.c,v 1.13 2012/01/29 07:16:00 dholland Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -338,6 +338,7 @@ compat_50_sys_quotactl(struct lwp *l, co
 	struct dqblk dqblk;
 	struct quotaval qv[QUOTA_NLIMITS];
 	uint64_t *values[QUOTA_NLIMITS];
+	int idtype;
 
 	values[QUOTA_LIMIT_BLOCK] = qv[QUOTA_LIMIT_BLOCK].qv_hardlimit;
 	values[QUOTA_LIMIT_FILE] = qv[QUOTA_LIMIT_FILE].qv_hardlimit;
@@ -376,16 +377,18 @@ compat_50_sys_quotactl(struct lwp *l, co
 		error = ENOMEM;
 		if (!prop_array_add_and_rel(datas, data))
 			goto out_datas;
+		idtype = quota_idtype_from_ufs(q1cmd  SUBCMDMASK);
 		if (!quota_prop_add_command(cmds, quotaon,
-		ufs_quota_class_names[qtype2ufsclass(q1cmd  SUBCMDMASK)],
+		ufs_quota_class_names[idtype],
 		datas))
 			goto out_cmds;
 		goto do_quotaonoff;
 
 	case Q_QUOTAOFF:
 		error = ENOMEM;
+		idtype = quota_idtype_from_ufs(q1cmd  SUBCMDMASK);
 		if (!quota_prop_add_command(cmds, quotaoff,
-		ufs_quota_class_names[qtype2ufsclass(q1cmd  SUBCMDMASK)],
+		ufs_quota_class_names[idtype],
 		datas))
 			goto out_cmds;
 do_quotaonoff:
@@ -417,8 +420,9 @@ do_quotaonoff:
 			goto out_data;
 		if (!prop_array_add_and_rel(datas, data))
 			goto out_datas;
+		idtype = quota_idtype_from_ufs(q1cmd  SUBCMDMASK);
 		if (!quota_prop_add_command(cmds, get,
-		ufs_quota_class_names[qtype2ufsclass(q1cmd  SUBCMDMASK)],
+		ufs_quota_class_names[idtype],
 		datas))
 			goto out_cmds;
 		if (!prop_dictionary_set_and_rel(dict, commands, cmds))
@@ -473,8 +477,9 @@ do_quotaonoff:
 			goto out_data;
 		if (!prop_array_add_and_rel(datas, data))
 			goto out_datas;
+		idtype = quota_idtype_from_ufs(q1cmd  SUBCMDMASK);
 		if (!quota_prop_add_command(cmds, set,
-		ufs_quota_class_names[qtype2ufsclass(q1cmd  SUBCMDMASK)],
+		ufs_quota_class_names[idtype],
 		datas))
 			goto out_cmds;
 		if (!prop_dictionary_set_and_rel(dict, commands, cmds))
@@ -502,8 +507,9 @@ do_quotaonoff:
 		 * emulate with a get version
 		 */
 		error = ENOMEM;
+		idtype = quota_idtype_from_ufs(q1cmd  SUBCMDMASK);
 		if (!quota_prop_add_command(cmds, get version,
-		ufs_quota_class_names[qtype2ufsclass(q1cmd  SUBCMDMASK)],
+		ufs_quota_class_names[idtype],
 		datas))
 			goto out_cmds;
 		if (!prop_dictionary_set_and_rel(dict, commands, cmds))

Index: src/sys/ufs/ufs/quota.h
diff -u src/sys/ufs/ufs/quota.h:1.28 src/sys/ufs/ufs/quota.h:1.29
--- src/sys/ufs/ufs/quota.h:1.28	Fri Mar 25 10:25:17 2011
+++ src/sys/ufs/ufs/quota.h	Sun Jan 29 07:16:00 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: quota.h,v 1.28 2011/03/25 10:25:17 bouyer Exp $	*/
+/*	$NetBSD: quota.h,v 1.29 2012/01/29 07:16:00 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -55,14 +55,14 @@
 
 
 #if 

CVS commit: src/sys/ufs/ufs

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:16:54 UTC 2012

Modified Files:
src/sys/ufs/ufs: quota2.h ufs_quota.c ufs_quota1.c ufs_quota2.c
ufs_vfsops.c

Log Message:
Remove references to quota/quotaprop.h in src/sys/ufs.
The remaining references in the kernel are in vfs_quotactl.c, the
compat_50 code for the old quotactl (to be fixed up), and the
code compiled from src/common/lib/libquota.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/ufs/ufs/quota2.h
cvs rdiff -u -r1.103 -r1.104 src/sys/ufs/ufs/ufs_quota.c
cvs rdiff -u -r1.15 -r1.16 src/sys/ufs/ufs/ufs_quota1.c
cvs rdiff -u -r1.26 -r1.27 src/sys/ufs/ufs/ufs_quota2.c
cvs rdiff -u -r1.47 -r1.48 src/sys/ufs/ufs/ufs_vfsops.c

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

Modified files:

Index: src/sys/ufs/ufs/quota2.h
diff -u src/sys/ufs/ufs/quota2.h:1.5 src/sys/ufs/ufs/quota2.h:1.6
--- src/sys/ufs/ufs/quota2.h:1.5	Tue Jun  7 14:56:13 2011
+++ src/sys/ufs/ufs/quota2.h	Sun Jan 29 07:16:53 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: quota2.h,v 1.5 2011/06/07 14:56:13 bouyer Exp $ */
+/* $NetBSD: quota2.h,v 1.6 2012/01/29 07:16:53 dholland Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -81,7 +81,10 @@ struct quota2_val {
 #define N_QL 2
 #define QL_BLOCK 0
 #define QL_FILE 1
-#define INITQLNAMES {QUOTADICT_LTYPE_BLOCK, QUOTADICT_LTYPE_FILE}
+#define INITQLNAMES { \
+	[QL_BLOCK] = block,	\
+	[QL_FILE] =  file,	\
+}
 
 struct quota2_entry {
 	/* block  inode limits and status */

Index: src/sys/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.103 src/sys/ufs/ufs/ufs_quota.c:1.104
--- src/sys/ufs/ufs/ufs_quota.c:1.103	Sun Jan 29 07:14:38 2012
+++ src/sys/ufs/ufs/ufs_quota.c	Sun Jan 29 07:16:53 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.103 2012/01/29 07:14:38 dholland Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.104 2012/01/29 07:16:53 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.103 2012/01/29 07:14:38 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.104 2012/01/29 07:16:53 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_quota.h
@@ -56,7 +56,6 @@ __KERNEL_RCSID(0, $NetBSD: ufs_quota.c,
 #include ufs/ufs/ufsmount.h
 #include ufs/ufs/ufs_extern.h
 #include ufs/ufs/ufs_quota.h
-#include quota/quotaprop.h
 
 kmutex_t dqlock;
 kcondvar_t dqcv;

Index: src/sys/ufs/ufs/ufs_quota1.c
diff -u src/sys/ufs/ufs/ufs_quota1.c:1.15 src/sys/ufs/ufs/ufs_quota1.c:1.16
--- src/sys/ufs/ufs/ufs_quota1.c:1.15	Sun Jan 29 06:49:44 2012
+++ src/sys/ufs/ufs/ufs_quota1.c	Sun Jan 29 07:16:53 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota1.c,v 1.15 2012/01/29 06:49:44 dholland Exp $	*/
+/*	$NetBSD: ufs_quota1.c,v 1.16 2012/01/29 07:16:53 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota1.c,v 1.15 2012/01/29 06:49:44 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota1.c,v 1.16 2012/01/29 07:16:53 dholland Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -47,7 +47,6 @@ __KERNEL_RCSID(0, $NetBSD: ufs_quota1.c
 #include sys/mount.h
 #include sys/kauth.h
 
-#include quota/quotaprop.h
 #include ufs/ufs/quota1.h
 #include ufs/ufs/inode.h
 #include ufs/ufs/ufsmount.h

Index: src/sys/ufs/ufs/ufs_quota2.c
diff -u src/sys/ufs/ufs/ufs_quota2.c:1.26 src/sys/ufs/ufs/ufs_quota2.c:1.27
--- src/sys/ufs/ufs/ufs_quota2.c:1.26	Sun Jan 29 07:09:52 2012
+++ src/sys/ufs/ufs/ufs_quota2.c	Sun Jan 29 07:16:54 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota2.c,v 1.26 2012/01/29 07:09:52 dholland Exp $ */
+/* $NetBSD: ufs_quota2.c,v 1.27 2012/01/29 07:16:54 dholland Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -26,7 +26,7 @@
   */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.26 2012/01/29 07:09:52 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.27 2012/01/29 07:16:54 dholland Exp $);
 
 #include sys/buf.h
 #include sys/param.h
@@ -51,7 +51,6 @@ __KERNEL_RCSID(0, $NetBSD: ufs_quota2.c
 #include ufs/ufs/ufs_extern.h
 #include ufs/ufs/ufs_quota.h
 #include ufs/ufs/ufs_wapbl.h
-#include quota/quotaprop.h
 
 /*
  * LOCKING:

Index: src/sys/ufs/ufs/ufs_vfsops.c
diff -u src/sys/ufs/ufs/ufs_vfsops.c:1.47 src/sys/ufs/ufs/ufs_vfsops.c:1.48
--- src/sys/ufs/ufs/ufs_vfsops.c:1.47	Sun Jan 29 07:14:39 2012
+++ src/sys/ufs/ufs/ufs_vfsops.c	Sun Jan 29 07:16:54 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_vfsops.c,v 1.47 2012/01/29 07:14:39 dholland Exp $	*/
+/*	$NetBSD: ufs_vfsops.c,v 1.48 2012/01/29 07:16:54 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_vfsops.c,v 1.47 2012/01/29 07:14:39 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_vfsops.c,v 1.48 

CVS commit: src/sys/ufs/ufs

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:17:41 UTC 2012

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

Log Message:
Remove now-unused declarations from quota2.h.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/ufs/ufs/quota2.h

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

Modified files:

Index: src/sys/ufs/ufs/quota2.h
diff -u src/sys/ufs/ufs/quota2.h:1.6 src/sys/ufs/ufs/quota2.h:1.7
--- src/sys/ufs/ufs/quota2.h:1.6	Sun Jan 29 07:16:53 2012
+++ src/sys/ufs/ufs/quota2.h	Sun Jan 29 07:17:41 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: quota2.h,v 1.6 2012/01/29 07:16:53 dholland Exp $ */
+/* $NetBSD: quota2.h,v 1.7 2012/01/29 07:17:41 dholland Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -55,23 +55,6 @@ struct quota2_val {
 	int64_t q2v_grace; /* allowed time for softlimit overflow */
 };
 
-/* NAMES for the above in the plist */
-#define INITQVNAMES_ALL { \
-QUOTADICT_LIMIT_HARD, \
-QUOTADICT_LIMIT_SOFT, \
-QUOTADICT_LIMIT_USAGE, \
-QUOTADICT_LIMIT_ETIME, \
-QUOTADICT_LIMIT_GTIME \
-}
-#define INITQVNAMES_LIMITSONLY { \
-QUOTADICT_LIMIT_HARD, \
-QUOTADICT_LIMIT_SOFT, \
-NULL, \
-NULL, \
-QUOTADICT_LIMIT_GTIME \
-}
-
-#define N_QV 5
 /*
  * On-disk description of a user or group quota
  * These entries are keept as linked list, either in one of the hash HEAD,



CVS commit: src/sys/ufs/ufs

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:18:17 UTC 2012

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

Log Message:
Remove #if 0'd proplib-related code.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/ufs/ufs/ufs_quota2.c

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

Modified files:

Index: src/sys/ufs/ufs/ufs_quota2.c
diff -u src/sys/ufs/ufs/ufs_quota2.c:1.27 src/sys/ufs/ufs/ufs_quota2.c:1.28
--- src/sys/ufs/ufs/ufs_quota2.c:1.27	Sun Jan 29 07:16:54 2012
+++ src/sys/ufs/ufs/ufs_quota2.c	Sun Jan 29 07:18:17 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota2.c,v 1.27 2012/01/29 07:16:54 dholland Exp $ */
+/* $NetBSD: ufs_quota2.c,v 1.28 2012/01/29 07:18:17 dholland Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -26,7 +26,7 @@
   */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.27 2012/01/29 07:16:54 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.28 2012/01/29 07:18:17 dholland Exp $);
 
 #include sys/buf.h
 #include sys/param.h
@@ -74,10 +74,6 @@ static int quota2_walk_list(struct ufsmo
 int (*func)(struct ufsmount *, uint64_t *, struct quota2_entry *,
   uint64_t, void *));
 
-#if 0
-static prop_dictionary_t q2etoprop(struct quota2_entry *, int);
-#endif
-
 static const char *limnames[] = INITQLNAMES;
 
 static void
@@ -93,44 +89,6 @@ quota2_dict_update_q2e_limits(int objtyp
 	q2e-q2e_val[objtype].q2v_grace = val-qv_grace;
 }
 
-#if 0
-static prop_dictionary_t
-q2etoprop(struct quota2_entry *q2e, int def)
-{
-	const char *val_names[] = INITQVNAMES_ALL;
-	prop_dictionary_t dict1 = prop_dictionary_create();
-	prop_dictionary_t dict2;
-	int i;
-
-	if (dict1 == NULL)
-		return NULL;
-
-	if (def) {
-		if (!prop_dictionary_set_cstring_nocopy(dict1, id,
-		default)) {
-			goto err;
-		}
-	} else {
-		if (!prop_dictionary_set_uint32(dict1, id, q2e-q2e_uid)) {
-			goto err;
-		}
-	}
-	for (i = 0; i  N_QL; i++) {
-		dict2 = limits64toprop(q2e-q2e_val[i].q2v_hardlimit,
-		val_names, N_QV);
-		if (dict2 == NULL)
-			goto err;
-		if (!prop_dictionary_set_and_rel(dict1, limnames[i], dict2))
-			goto err;
-	}
-	return dict1;
-
-err:
-	prop_object_release(dict1);
-	return NULL;
-}
-#endif
-
 /*
  * Convert internal representation to FS-independent representation.
  * (Note that while the two types are currently identical, the



CVS commit: src/sys/compat/common

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:19:04 UTC 2012

Modified Files:
src/sys/compat/common: vfs_syscalls_50.c

Log Message:
Remove the proplib goop from the COMPAT_50 code for the old quotactl;
use the new VFS_QUOTACTL instead.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/compat/common/vfs_syscalls_50.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/compat/common/vfs_syscalls_50.c
diff -u src/sys/compat/common/vfs_syscalls_50.c:1.13 src/sys/compat/common/vfs_syscalls_50.c:1.14
--- src/sys/compat/common/vfs_syscalls_50.c:1.13	Sun Jan 29 07:16:00 2012
+++ src/sys/compat/common/vfs_syscalls_50.c	Sun Jan 29 07:19:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_50.c,v 1.13 2012/01/29 07:16:00 dholland Exp $	*/
+/*	$NetBSD: vfs_syscalls_50.c,v 1.14 2012/01/29 07:19:04 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_50.c,v 1.13 2012/01/29 07:16:00 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_50.c,v 1.14 2012/01/29 07:19:04 dholland Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -63,7 +63,7 @@ __KERNEL_RCSID(0, $NetBSD: vfs_syscalls
 #include ufs/lfs/lfs_extern.h
 
 #include sys/quota.h
-#include quota/quotaprop.h
+#include sys/quotactl.h
 #include ufs/ufs/quota1.h
 
 #include compat/common/compat_util.h
@@ -329,222 +329,115 @@ compat_50_sys_quotactl(struct lwp *l, co
 	} */
 	struct mount *mp;
 	int error;
-	uint8_t error8;
 	struct vnode *vp;
 	int q1cmd = SCARG(uap, cmd);
-	prop_dictionary_t dict, data, cmd;
-	prop_array_t cmds, datas;
 	char *bufpath;
 	struct dqblk dqblk;
-	struct quotaval qv[QUOTA_NLIMITS];
-	uint64_t *values[QUOTA_NLIMITS];
+	struct quotakey key;
+	struct quotaval blocks, files;
+	struct quotastat qstat;
+	struct vfs_quotactl_args args;
 	int idtype;
 
-	values[QUOTA_LIMIT_BLOCK] = qv[QUOTA_LIMIT_BLOCK].qv_hardlimit;
-	values[QUOTA_LIMIT_FILE] = qv[QUOTA_LIMIT_FILE].qv_hardlimit;
-
 	error = namei_simple_user(SCARG(uap, path),
 NSM_FOLLOW_TRYEMULROOT, vp);
 	if (error != 0)
 		return (error);   
-	error = ENOMEM;
+
 	mp = vp-v_mount;
-	if ((dict = quota_prop_create()) == NULL)
-		goto out;
-	if ((cmds = prop_array_create()) == NULL)
-		goto out_dict;
-	if ((datas = prop_array_create()) == NULL)
-		goto out_cmds;
+	idtype = quota_idtype_from_ufs(q1cmd  SUBCMDMASK);
 
-	switch((q1cmd  ~SUBCMDMASK)  SUBCMDSHIFT) {
+	switch ((q1cmd  ~SUBCMDMASK)  SUBCMDSHIFT) {
 	case Q_QUOTAON:
-		data = prop_dictionary_create();
-		if (data == NULL)
-			goto out_datas;
 		bufpath = malloc(PATH_MAX * sizeof(char), M_TEMP, M_WAITOK);
-		if (bufpath == NULL)
-			goto out_data;
 		error = copyinstr(SCARG(uap, arg), bufpath, PATH_MAX, NULL);
 		if (error != 0) {
 			free(bufpath, M_TEMP);
-			goto out_data;
+			break;
 		}
-		if (!prop_dictionary_set_cstring(data, quotafile, bufpath))
-			error = ENOMEM;
+
+		args.qc_op = QUOTACTL_QUOTAON;
+		args.u.quotaon.qc_quotafile = bufpath;
+		args.u.quotaon.qc_idtype = idtype;
+		error = VFS_QUOTACTL(mp, args);
+
 		free(bufpath, M_TEMP);
-		if (error)
-			goto out_data;
-		error = ENOMEM;
-		if (!prop_array_add_and_rel(datas, data))
-			goto out_datas;
-		idtype = quota_idtype_from_ufs(q1cmd  SUBCMDMASK);
-		if (!quota_prop_add_command(cmds, quotaon,
-		ufs_quota_class_names[idtype],
-		datas))
-			goto out_cmds;
-		goto do_quotaonoff;
+		break;
 
 	case Q_QUOTAOFF:
-		error = ENOMEM;
-		idtype = quota_idtype_from_ufs(q1cmd  SUBCMDMASK);
-		if (!quota_prop_add_command(cmds, quotaoff,
-		ufs_quota_class_names[idtype],
-		datas))
-			goto out_cmds;
-do_quotaonoff:
-		if (!prop_dictionary_set_and_rel(dict, commands, cmds))
-			goto out_dict;
-		error = vfs_quotactl(mp, dict);
-		if (error)
-			goto out_dict;
-		if ((error = quota_get_cmds(dict, cmds)) != 0)
-			goto out_dict;
-		cmd = prop_array_get(cmds, 0);
-		if (cmd == NULL) {
-			error = EINVAL;
-			goto out_dict;
-		}
-		if (!prop_dictionary_get_int8(cmd, return, error8)) {
-			error = EINVAL;
-			goto out_dict;
-		}
-		error = error8;
-		goto out_dict;
+		args.qc_op = QUOTACTL_QUOTAOFF;
+		args.u.quotaoff.qc_idtype = idtype;
+		error = VFS_QUOTACTL(mp, args);
+		break;
 
 	case Q_GETQUOTA:
-		error = ENOMEM;
-		data = prop_dictionary_create();
-		if (data == NULL)
-			goto out_datas;
-		if (!prop_dictionary_set_uint32(data, id, SCARG(uap, uid)))
-			goto out_data;
-		if (!prop_array_add_and_rel(datas, data))
-			goto out_datas;
-		idtype = quota_idtype_from_ufs(q1cmd  SUBCMDMASK);
-		if (!quota_prop_add_command(cmds, get,
-		ufs_quota_class_names[idtype],
-		datas))
-			goto out_cmds;
-		if (!prop_dictionary_set_and_rel(dict, commands, cmds))
-			goto out_dict;
-		error = vfs_quotactl(mp, dict);
-		if (error)
-			goto out_dict;
-		if ((error = 

CVS commit: src/sys/compat/common

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:19:48 UTC 2012

Modified Files:
src/sys/compat/common: vfs_syscalls_50.c

Log Message:
Some further tidying for the COMPAT_50 quotactl code. Mostly cosmetic,
but also use PNBUF_GET() and PNBUF_PUT() for a path buffer instead of
malloc with M_TEMP.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/compat/common/vfs_syscalls_50.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/compat/common/vfs_syscalls_50.c
diff -u src/sys/compat/common/vfs_syscalls_50.c:1.14 src/sys/compat/common/vfs_syscalls_50.c:1.15
--- src/sys/compat/common/vfs_syscalls_50.c:1.14	Sun Jan 29 07:19:04 2012
+++ src/sys/compat/common/vfs_syscalls_50.c	Sun Jan 29 07:19:48 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_50.c,v 1.14 2012/01/29 07:19:04 dholland Exp $	*/
+/*	$NetBSD: vfs_syscalls_50.c,v 1.15 2012/01/29 07:19:48 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_50.c,v 1.14 2012/01/29 07:19:04 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_50.c,v 1.15 2012/01/29 07:19:48 dholland Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -51,7 +51,6 @@ __KERNEL_RCSID(0, $NetBSD: vfs_syscalls
 #include sys/proc.h
 #include sys/uio.h
 #include sys/dirent.h
-#include sys/malloc.h
 #include sys/kauth.h
 #include sys/time.h
 #include sys/vfs_syscalls.h
@@ -327,17 +326,17 @@ compat_50_sys_quotactl(struct lwp *l, co
 		syscallarg(int) uid;
 		syscallarg(void *) arg; 
 	} */
-	struct mount *mp;
-	int error;
 	struct vnode *vp;
-	int q1cmd = SCARG(uap, cmd);
-	char *bufpath;
+	struct mount *mp;
+	int q1cmd;
+	int idtype;
+	char *qfile;
 	struct dqblk dqblk;
 	struct quotakey key;
 	struct quotaval blocks, files;
 	struct quotastat qstat;
 	struct vfs_quotactl_args args;
-	int idtype;
+	int error;
 
 	error = namei_simple_user(SCARG(uap, path),
 NSM_FOLLOW_TRYEMULROOT, vp);
@@ -345,23 +344,24 @@ compat_50_sys_quotactl(struct lwp *l, co
 		return (error);   
 
 	mp = vp-v_mount;
+	q1cmd = SCARG(uap, cmd);
 	idtype = quota_idtype_from_ufs(q1cmd  SUBCMDMASK);
 
 	switch ((q1cmd  ~SUBCMDMASK)  SUBCMDSHIFT) {
 	case Q_QUOTAON:
-		bufpath = malloc(PATH_MAX * sizeof(char), M_TEMP, M_WAITOK);
-		error = copyinstr(SCARG(uap, arg), bufpath, PATH_MAX, NULL);
+		qfile = PNBUF_GET();
+		error = copyinstr(SCARG(uap, arg), qfile, PATH_MAX, NULL);
 		if (error != 0) {
-			free(bufpath, M_TEMP);
+			PNBUF_PUT(qfile);
 			break;
 		}
 
 		args.qc_op = QUOTACTL_QUOTAON;
-		args.u.quotaon.qc_quotafile = bufpath;
+		args.u.quotaon.qc_quotafile = qfile;
 		args.u.quotaon.qc_idtype = idtype;
 		error = VFS_QUOTACTL(mp, args);
 
-		free(bufpath, M_TEMP);
+		PNBUF_PUT(qfile);
 		break;
 
 	case Q_QUOTAOFF:



CVS commit: src/sys/ufs/ufs

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:20:27 UTC 2012

Modified Files:
src/sys/ufs/ufs: quota2.h ufs_quota2.c

Log Message:
quota2_check_limit() is used in only one place, so don't stuff it in a
header file.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/ufs/ufs/quota2.h
cvs rdiff -u -r1.28 -r1.29 src/sys/ufs/ufs/ufs_quota2.c

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

Modified files:

Index: src/sys/ufs/ufs/quota2.h
diff -u src/sys/ufs/ufs/quota2.h:1.7 src/sys/ufs/ufs/quota2.h:1.8
--- src/sys/ufs/ufs/quota2.h:1.7	Sun Jan 29 07:17:41 2012
+++ src/sys/ufs/ufs/quota2.h	Sun Jan 29 07:20:27 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: quota2.h,v 1.7 2012/01/29 07:17:41 dholland Exp $ */
+/* $NetBSD: quota2.h,v 1.8 2012/01/29 07:20:27 dholland Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -28,7 +28,6 @@
 #ifndef _UFS_UFS_QUOTA2_H_
 #define _UFS_UFS_QUOTA2_H_
 #include ufs/ufs/quota.h
-#include quota/quota.h
 
 
 /* New disk quota implementation. In this implementation, the quota datas
@@ -108,10 +107,4 @@ void quota2_create_blk0(uint64_t, void *
 void quota2_ufs_rwq2v(const struct quota2_val *, struct quota2_val *, int);
 void quota2_ufs_rwq2e(const struct quota2_entry *, struct quota2_entry *, int);
 
-__inline static int __unused
-quota2_check_limit(struct quota2_val *q2v, uint64_t change, time_t now)
-{
-	return quota_check_limit(q2v-q2v_cur, change, q2v-q2v_softlimit,
-	q2v-q2v_hardlimit, q2v-q2v_time, now);
-}
 #endif /*  _UFS_UFS_QUOTA2_H_ */

Index: src/sys/ufs/ufs/ufs_quota2.c
diff -u src/sys/ufs/ufs/ufs_quota2.c:1.28 src/sys/ufs/ufs/ufs_quota2.c:1.29
--- src/sys/ufs/ufs/ufs_quota2.c:1.28	Sun Jan 29 07:18:17 2012
+++ src/sys/ufs/ufs/ufs_quota2.c	Sun Jan 29 07:20:27 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota2.c,v 1.28 2012/01/29 07:18:17 dholland Exp $ */
+/* $NetBSD: ufs_quota2.c,v 1.29 2012/01/29 07:20:27 dholland Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -26,7 +26,7 @@
   */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.28 2012/01/29 07:18:17 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.29 2012/01/29 07:20:27 dholland Exp $);
 
 #include sys/buf.h
 #include sys/param.h
@@ -52,6 +52,8 @@ __KERNEL_RCSID(0, $NetBSD: ufs_quota2.c
 #include ufs/ufs/ufs_quota.h
 #include ufs/ufs/ufs_wapbl.h
 
+#include quota/quota.h	/* XXX for quota_check_limit */
+
 /*
  * LOCKING:
  * Data in the entries are protected by the associated struct dquot's
@@ -433,6 +435,13 @@ getinoquota2(struct inode *ip, bool allo
 	return 0;
 }
 
+__inline static int __unused
+quota2_check_limit(struct quota2_val *q2v, uint64_t change, time_t now)
+{
+	return quota_check_limit(q2v-q2v_cur, change, q2v-q2v_softlimit,
+	q2v-q2v_hardlimit, q2v-q2v_time, now);
+}
+
 static int
 quota2_check(struct inode *ip, int vtype, int64_t change, kauth_cred_t cred,
 int flags)



CVS commit: src/sys/ufs/ufs

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:21:00 UTC 2012

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

Log Message:
Clean up quota2 cursoring, as promised earlier.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/ufs/ufs/ufs_quota2.c

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

Modified files:

Index: src/sys/ufs/ufs/ufs_quota2.c
diff -u src/sys/ufs/ufs/ufs_quota2.c:1.29 src/sys/ufs/ufs/ufs_quota2.c:1.30
--- src/sys/ufs/ufs/ufs_quota2.c:1.29	Sun Jan 29 07:20:27 2012
+++ src/sys/ufs/ufs/ufs_quota2.c	Sun Jan 29 07:21:00 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota2.c,v 1.29 2012/01/29 07:20:27 dholland Exp $ */
+/* $NetBSD: ufs_quota2.c,v 1.30 2012/01/29 07:21:00 dholland Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -26,13 +26,12 @@
   */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.29 2012/01/29 07:20:27 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.30 2012/01/29 07:21:00 dholland Exp $);
 
 #include sys/buf.h
 #include sys/param.h
 #include sys/kernel.h
 #include sys/systm.h
-#include sys/malloc.h
 #include sys/namei.h
 #include sys/file.h
 #include sys/proc.h
@@ -794,17 +793,16 @@ out_dq:
 }
 
 static int
-quota2_result_add_q2e(struct ufsmount *ump, int idtype,
-int id, struct quotakey *keys, struct quotaval *vals, unsigned pos,
-int skipfirst, int skiplast)
+quota2_fetch_q2e(struct ufsmount *ump, const struct quotakey *qk,
+struct quota2_entry *ret)
 {
 	struct dquot *dq;
 	int error;
-	struct quota2_entry *q2ep, q2e;
-	struct buf  *bp;
+	struct quota2_entry *q2ep;
+	struct buf *bp;
 	const int needswap = UFS_MPNEEDSWAP(ump);
 
-	error = dqget(NULLVP, id, ump, idtype, dq);
+	error = dqget(NULLVP, qk-qk_id, ump, qk-qk_idtype, dq);
 	if (error)
 		return error;
 
@@ -814,39 +812,23 @@ quota2_result_add_q2e(struct ufsmount *u
 		dqrele(NULLVP, dq);
 		return ENOENT;
 	}
-	error = getq2e(ump, idtype, dq-dq2_lblkno, dq-dq2_blkoff,
+	error = getq2e(ump, qk-qk_idtype, dq-dq2_lblkno, dq-dq2_blkoff,
 	bp, q2ep, 0);
 	if (error) {
 		mutex_exit(dq-dq_interlock);
 		dqrele(NULLVP, dq);
 		return error;
 	}
-	quota2_ufs_rwq2e(q2ep, q2e, needswap);
+	quota2_ufs_rwq2e(q2ep, ret, needswap);
 	brelse(bp, 0);
 	mutex_exit(dq-dq_interlock);
 	dqrele(NULLVP, dq);
 
-	if (skipfirst == 0) {
-		keys[pos].qk_idtype = idtype;
-		keys[pos].qk_objtype = QUOTA_OBJTYPE_BLOCKS;
-		q2e_to_quotaval(q2e, 0, keys[pos].qk_id,
-QL_BLOCK, vals[pos]);
-		pos++;
-	}
-
-	if (skiplast == 0) {
-		keys[pos].qk_idtype = idtype;
-		keys[pos].qk_objtype = QUOTA_OBJTYPE_FILES;
-		q2e_to_quotaval(q2e, 0, keys[pos].qk_id,
-QL_FILE, vals[pos]);
-		pos++;
-	}
-
 	return 0;
 }
 
 static int
-quota2_fetch_q2e(struct ufsmount *ump, const struct quotakey *qk,
+quota2_fetch_quotaval(struct ufsmount *ump, const struct quotakey *qk,
 struct quotaval *ret)
 {
 	struct dquot *dq;
@@ -923,11 +905,17 @@ quota2_handle_cmd_get(struct ufsmount *u
 qk-qk_objtype, ret);
 		(void)id2;
 	} else
-		error = quota2_fetch_q2e(ump, qk, ret);
+		error = quota2_fetch_quotaval(ump, qk, ret);
 	
 	return error;
 }
 
+/*
+ * Cursor structure we used.
+ *
+ * This will get stored in userland between calls so we must not assume
+ * it isn't arbitrarily corrupted.
+ */
 struct ufsq2_cursor {
 	uint32_t q2c_magic;	/* magic number */
 	int q2c_hashsize;	/* size of hash table at last go */
@@ -940,10 +928,54 @@ struct ufsq2_cursor {
 	int q2c_blocks_done;	/* true if we've returned the blocks value */
 };
 
+/*
+ * State of a single cursorget call, or at least the part of it that
+ * needs to be passed around.
+ */
+struct q2cursor_state {
+	/* data return pointers */
+	struct quotakey *keys;
+	struct quotaval *vals;
+
+	/* key/value counters */
+	unsigned maxkeyvals;
+	unsigned numkeys;	/* number of keys assigned */
+
+	/* ID to key/value conversion state */
+	int skipfirst;		/* if true skip first key/value */
+	int skiplast;		/* if true skip last key/value */
+
+	/* ID counters */
+	unsigned maxids;	/* maximum number of IDs to handle */
+	unsigned numids;	/* number of IDs handled */
+};
+
+/*
+ * Additional structure for getids callback.
+ */
+struct q2cursor_getids {
+	struct q2cursor_state *state;
+	int idtype;
+	unsigned skip;		/* number of ids to skip over */
+	unsigned new_skip;	/* number of ids to skip over next time */
+	unsigned skipped;	/* number skipped so far */
+};
+
+/*
+ * Cursor-related functions
+ */
+
+/* magic number */
 #define Q2C_MAGIC (0xbeebe111)
 
+/* extract cursor from caller form */
 #define Q2CURSOR(qkc) ((struct ufsq2_cursor *)qkc-u.qkc_space[0])
 
+/*
+ * Check that a cursor we're handed is something like valid. If
+ * someone munges it and it still passes these checks, they'll get
+ * partial or odd results back but won't break anything.
+ */
 static int
 q2cursor_check(struct ufsq2_cursor *cursor)
 {
@@ -972,108 

CVS commit: src/sys/kern

2012-01-28 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 29 07:21:59 UTC 2012

Modified Files:
src/sys/kern: vfs_quotactl.c

Log Message:
malloc - kmem_alloc, by request of rmind


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/kern/vfs_quotactl.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/kern/vfs_quotactl.c
diff -u src/sys/kern/vfs_quotactl.c:1.35 src/sys/kern/vfs_quotactl.c:1.36
--- src/sys/kern/vfs_quotactl.c:1.35	Sun Jan 29 07:14:38 2012
+++ src/sys/kern/vfs_quotactl.c	Sun Jan 29 07:21:59 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_quotactl.c,v 1.35 2012/01/29 07:14:38 dholland Exp $	*/
+/*	$NetBSD: vfs_quotactl.c,v 1.36 2012/01/29 07:21:59 dholland Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -80,9 +80,9 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.35 2012/01/29 07:14:38 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_quotactl.c,v 1.36 2012/01/29 07:21:59 dholland Exp $);
 
-#include sys/malloc.h /* XXX: temporary */
+#include sys/kmem.h
 #include sys/mount.h
 #include sys/quota.h
 #include sys/quotactl.h
@@ -579,8 +579,8 @@ vfs_quotactl_getall(struct mount *mp,
 		return error;
 	}
 
-	keys = malloc(loopmax * sizeof(keys[0]), M_TEMP, M_WAITOK);
-	vals = malloc(loopmax * sizeof(vals[0]), M_TEMP, M_WAITOK);
+	keys = kmem_alloc(loopmax * sizeof(keys[0]), KM_SLEEP);
+	vals = kmem_alloc(loopmax * sizeof(vals[0]), KM_SLEEP);
 
 	skipidtype = (q2type == QUOTA_IDTYPE_USER ?
 		  QUOTA_IDTYPE_GROUP : QUOTA_IDTYPE_USER);
@@ -721,8 +721,8 @@ vfs_quotactl_getall(struct mount *mp,
 	error = 0;
 
  err:
-	free(keys, M_TEMP);
-	free(vals, M_TEMP);
+	kmem_free(keys, loopmax * sizeof(keys[0]));
+	kmem_free(vals, loopmax * sizeof(vals[0]));
 
 	if (replies != NULL) {
 		prop_object_release(replies);