CVS commit: src/sys/dev/pci

2015-07-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Jul 25 08:36:44 UTC 2015

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

Log Message:
Memory leak. Same as r1.93. I don't know why Brainy didn't detect it
earlier; or perhaps I forgot to report it.

Found by Brainy.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/pci/if_ti.c

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

Modified files:

Index: src/sys/dev/pci/if_ti.c
diff -u src/sys/dev/pci/if_ti.c:1.94 src/sys/dev/pci/if_ti.c:1.95
--- src/sys/dev/pci/if_ti.c:1.94	Mon Apr 27 17:41:26 2015
+++ src/sys/dev/pci/if_ti.c	Sat Jul 25 08:36:44 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ti.c,v 1.94 2015/04/27 17:41:26 christos Exp $ */
+/* $NetBSD: if_ti.c,v 1.95 2015/07/25 08:36:44 maxv Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999
@@ -81,7 +81,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ti.c,v 1.94 2015/04/27 17:41:26 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ti.c,v 1.95 2015/07/25 08:36:44 maxv Exp $);
 
 #include opt_inet.h
 
@@ -800,6 +800,7 @@ ti_newbuf_mini(struct ti_softc *sc, int 
 BUS_DMA_READ|BUS_DMA_NOWAIT)) != 0) {
 			aprint_error_dev(sc-sc_dev, can't load recv map, error = %d\n,
 			   error);
+			m_freem(m_new);
 			return (ENOMEM);
 		}
 	} else {



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

2015-07-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jul 25 08:43:41 UTC 2015

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_intr.c

Log Message:
IPIs should be IPL_HIGH according to rmind@

Fix bcm2836mp_pic_{un,}block_irqs to handle timer AND mailbox interrupts
if they're both passed.  Thanks to nat@ for finding this.

Sprinkle some KASSERTs


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/broadcom/bcm2835_intr.c

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm2835_intr.c
diff -u src/sys/arch/arm/broadcom/bcm2835_intr.c:1.9 src/sys/arch/arm/broadcom/bcm2835_intr.c:1.10
--- src/sys/arch/arm/broadcom/bcm2835_intr.c:1.9	Sun Apr 12 23:25:57 2015
+++ src/sys/arch/arm/broadcom/bcm2835_intr.c	Sat Jul 25 08:43:41 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_intr.c,v 1.9 2015/04/12 23:25:57 jmcneill Exp $	*/
+/*	$NetBSD: bcm2835_intr.c,v 1.10 2015/07/25 08:43:41 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012, 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bcm2835_intr.c,v 1.9 2015/04/12 23:25:57 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: bcm2835_intr.c,v 1.10 2015/07/25 08:43:41 skrll Exp $);
 
 #define _INTR_PRIVATE
 
@@ -361,7 +361,8 @@ bcm2836mp_pic_unblock_irqs(struct pic_so
 		BCM2836_LOCAL_TIMER_IRQ_CONTROL_BASE,
 		BCM2836_LOCAL_TIMER_IRQ_CONTROL_SIZE,
 		BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE);
-	} else if (irq_mask  BCM2836MP_MAILBOX_IRQS) {
+	}
+	if (irq_mask  BCM2836MP_MAILBOX_IRQS) {
 		uint32_t mask = __SHIFTOUT(irq_mask, BCM2836MP_MAILBOX_IRQS);
 		uint32_t val = bus_space_read_4(al_iot, al_ioh,
 		BCM2836_LOCAL_MAILBOX_IRQ_CONTROLN(cpuid));
@@ -396,7 +397,8 @@ bcm2836mp_pic_block_irqs(struct pic_soft
 		bus_space_write_4(al_iot, al_ioh,
 		BCM2836_LOCAL_TIMER_IRQ_CONTROLN(cpuid),
 		val);
-	} else if (irq_mask  BCM2836MP_MAILBOX_IRQS) {
+	}
+	if (irq_mask  BCM2836MP_MAILBOX_IRQS) {
 		uint32_t mask = __SHIFTOUT(irq_mask, BCM2836MP_MAILBOX_IRQS);
 		uint32_t val = bus_space_read_4(al_iot, al_ioh,
 		BCM2836_LOCAL_MAILBOX_IRQ_CONTROLN(cpuid));
@@ -464,6 +466,10 @@ static void bcm2836mp_cpu_init(struct pi
 static void
 bcm2836mp_send_ipi(struct pic_softc *pic, const kcpuset_t *kcp, u_long ipi)
 {
+	KASSERT(pic != NULL);
+	KASSERT(pic != bcm2835_pic);
+	KASSERT(pic-pic_cpus != NULL);
+
 	const cpuid_t cpuid = pic - bcm2836mp_pic[0];
 
 	bus_space_write_4(al_iot, al_ioh,
@@ -522,7 +528,7 @@ bcm2836mp_intr_init(struct cpu_info *ci)
 	pic-pic_cpus = ci-ci_kcpuset;
 	pic_add(pic, BCM2836_INT_BASECPUN(cpuid));
 
-	intr_establish(BCM2836_INT_MAILBOX0_CPUN(cpuid), IPL_VM,
+	intr_establish(BCM2836_INT_MAILBOX0_CPUN(cpuid), IPL_HIGH,
 	IST_LEVEL | IST_MPSAFE, bcm2836mp_ipi_handler, NULL);
 
 	/* clock interrupt will attach with gtmr */



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

2015-07-25 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jul 25 15:50:42 UTC 2015

Modified Files:
src/sys/arch/arm/nvidia: tegra_car.c tegra_carreg.h tegra_hdmi.c
tegra_hdmireg.h

Log Message:
Add HDMI audio support


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/nvidia/tegra_car.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/nvidia/tegra_carreg.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/nvidia/tegra_hdmi.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/nvidia/tegra_hdmireg.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/arch/arm/nvidia/tegra_car.c
diff -u src/sys/arch/arm/nvidia/tegra_car.c:1.23 src/sys/arch/arm/nvidia/tegra_car.c:1.24
--- src/sys/arch/arm/nvidia/tegra_car.c:1.23	Thu Jul 23 18:22:05 2015
+++ src/sys/arch/arm/nvidia/tegra_car.c	Sat Jul 25 15:50:42 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_car.c,v 1.23 2015/07/23 18:22:05 jmcneill Exp $ */
+/* $NetBSD: tegra_car.c,v 1.24 2015/07/25 15:50:42 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill jmcne...@invisible.ca
@@ -29,7 +29,7 @@
 #include locators.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tegra_car.c,v 1.23 2015/07/23 18:22:05 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: tegra_car.c,v 1.24 2015/07/25 15:50:42 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -535,24 +535,27 @@ tegra_car_periph_hda_enable(void)
 
 	tegra_car_get_bs(bst, bsh);
 
-	/* HDA */
 	bus_space_write_4(bst, bsh, CAR_RST_DEV_V_SET_REG, CAR_DEV_V_HDA);
 	bus_space_write_4(bst, bsh, CAR_CLK_ENB_V_SET_REG, CAR_DEV_V_HDA);
-	bus_space_write_4(bst, bsh, CAR_RST_DEV_V_CLR_REG, CAR_DEV_V_HDA);
-
-	/* HDA2CODEC_2X */
 	bus_space_write_4(bst, bsh, CAR_RST_DEV_V_SET_REG,
 	CAR_DEV_V_HDA2CODEC_2X);
 	bus_space_write_4(bst, bsh, CAR_CLK_ENB_V_SET_REG,
 	CAR_DEV_V_HDA2CODEC_2X);
-	bus_space_write_4(bst, bsh, CAR_RST_DEV_V_CLR_REG,
-	CAR_DEV_V_HDA2CODEC_2X);
-
-	/* HDA2HDMICODEC */
 	bus_space_write_4(bst, bsh, CAR_RST_DEV_W_SET_REG,
 	CAR_DEV_W_HDA2HDMICODEC);
 	bus_space_write_4(bst, bsh, CAR_CLK_ENB_W_SET_REG,
 	CAR_DEV_W_HDA2HDMICODEC);
+
+	/* configure HDA2CODEC_2X for 48 MHz */
+	const u_int div = howmany(tegra_car_pllp0_rate() * 2, 4800) - 2;
+	bus_space_write_4(bst, bsh, CAR_CLKSRC_HDA2CODEC_2X_REG,
+	__SHIFTIN(CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLP_OUT0,
+		  CAR_CLKSRC_HDA2CODEC_2X_SRC) |
+	__SHIFTIN(div, CAR_CLKSRC_HDA2CODEC_2X_DIV));
+
+	bus_space_write_4(bst, bsh, CAR_RST_DEV_V_CLR_REG, CAR_DEV_V_HDA);
+	bus_space_write_4(bst, bsh, CAR_RST_DEV_V_CLR_REG,
+	CAR_DEV_V_HDA2CODEC_2X);
 	bus_space_write_4(bst, bsh, CAR_RST_DEV_W_CLR_REG,
 	CAR_DEV_W_HDA2HDMICODEC);
 }

Index: src/sys/arch/arm/nvidia/tegra_carreg.h
diff -u src/sys/arch/arm/nvidia/tegra_carreg.h:1.19 src/sys/arch/arm/nvidia/tegra_carreg.h:1.20
--- src/sys/arch/arm/nvidia/tegra_carreg.h:1.19	Thu Jul 23 15:07:31 2015
+++ src/sys/arch/arm/nvidia/tegra_carreg.h	Sat Jul 25 15:50:42 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_carreg.h,v 1.19 2015/07/23 15:07:31 skrll Exp $ */
+/* $NetBSD: tegra_carreg.h,v 1.20 2015/07/25 15:50:42 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill jmcne...@invisible.ca
@@ -390,6 +390,16 @@
 #define CAR_CCLKG_BURST_POLICY_CWAKEUP_SOURCE_CLKM		0
 #define CAR_CCLKG_BURST_POLICY_CWAKEUP_SOURCE_PLLX_OUT0_LJ	8
 
+#define CAR_CLKSRC_HDA2CODEC_2X_REG	0x3e4
+#define CAR_CLKSRC_HDA2CODEC_2X_SRC	__BITS(31,29)
+#define CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLP_OUT0	0
+#define CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLC2_OUT0	1
+#define CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLC_OUT0	2
+#define CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLC3_OUT0	3
+#define CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLM_OUT0	4
+#define CAR_CLKSRC_HDA2CODEC_2X_SRC_CLKM	6
+#define CAR_CLKSRC_HDA2CODEC_2X_DIV	__BITS(7,0)
+
 #define CAR_CLKSRC_SATA_OOB_REG		0x420
 #define CAR_CLKSRC_SATA_OOB_SRC		__BITS(31,29)
 #define CAR_CLKSRC_SATA_OOB_SRC_PLLP_OUT0	0
@@ -462,4 +472,12 @@
 #define CAR_SATA_PLL_CFG1_PADPLL_PU_POST_DLY	__BITS(15,8)
 #define CAR_SATA_PLL_CFG1_LANE_IDDQ2_PADPLL_IDDQ_DLY __BITS(7,0)
 
+#define CAR_CLKSRC_HDMI_AUDIO_REG	0x668
+#define CAR_CLKSRC_HDMI_AUDIO_SRC	__BITS(31,29)
+#define CAR_CLKSRC_HDMI_AUDIO_SRC_PLLP_OUT0	0
+#define CAR_CLKSRC_HDMI_AUDIO_SRC_PLLC_OUT0	1
+#define CAR_CLKSRC_HDMI_AUDIO_SRC_PLLC2_OUT0	2
+#define CAR_CLKSRC_HDMI_AUDIO_SRC_CLKM		3
+#define CAR_CLKSRC_HDMI_AUDIO_DIV	__BITS(7,0)
+
 #endif /* _ARM_TEGRA_CARREG_H */

Index: src/sys/arch/arm/nvidia/tegra_hdmi.c
diff -u src/sys/arch/arm/nvidia/tegra_hdmi.c:1.5 src/sys/arch/arm/nvidia/tegra_hdmi.c:1.6
--- src/sys/arch/arm/nvidia/tegra_hdmi.c:1.5	Thu Jul 23 15:43:06 2015
+++ src/sys/arch/arm/nvidia/tegra_hdmi.c	Sat Jul 25 15:50:42 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_hdmi.c,v 1.5 2015/07/23 15:43:06 jmcneill Exp $ */
+/* $NetBSD: tegra_hdmi.c,v 1.6 2015/07/25 15:50:42 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 

CVS commit: src/bin/cat

2015-07-25 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Jul 25 16:17:01 UTC 2015

Modified Files:
src/bin/cat: cat.c

Log Message:
Drop the case '?' which is defined after case 'default'.
case 'default' statement introduced in the last commit to cat.c in the CSRG 
archive.
Obtained from OpenBSD bin/cat/cat.c r1.3.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/bin/cat/cat.c

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

Modified files:

Index: src/bin/cat/cat.c
diff -u src/bin/cat/cat.c:1.54 src/bin/cat/cat.c:1.55
--- src/bin/cat/cat.c:1.54	Sun Dec  8 08:32:13 2013
+++ src/bin/cat/cat.c	Sat Jul 25 16:17:01 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: cat.c,v 1.54 2013/12/08 08:32:13 spz Exp $	*/
+/* $NetBSD: cat.c,v 1.55 2015/07/25 16:17:01 sevan Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -44,7 +44,7 @@ __COPYRIGHT(
 #if 0
 static char sccsid[] = @(#)cat.c	8.2 (Berkeley) 4/27/95;
 #else
-__RCSID($NetBSD: cat.c,v 1.54 2013/12/08 08:32:13 spz Exp $);
+__RCSID($NetBSD: cat.c,v 1.55 2015/07/25 16:17:01 sevan Exp $);
 #endif
 #endif /* not lint */
 
@@ -113,7 +113,6 @@ main(int argc, char *argv[])
 			vflag = 1;
 			break;
 		default:
-		case '?':
 			(void)fprintf(stderr,
 			Usage: %s [-beflnstuv] [-B bsize] [-] 
 			[file ...]\n, getprogname());



CVS commit: src/sys/arch/x68k/x68k

2015-07-25 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Jul 25 06:24:53 UTC 2015

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

Log Message:
Add a comment on mnemonic that assembler cannot recognize.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/x68k/x68k/locore.s

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

Modified files:

Index: src/sys/arch/x68k/x68k/locore.s
diff -u src/sys/arch/x68k/x68k/locore.s:1.118 src/sys/arch/x68k/x68k/locore.s:1.119
--- src/sys/arch/x68k/x68k/locore.s:1.118	Thu Jul 31 14:41:19 2014
+++ src/sys/arch/x68k/x68k/locore.s	Sat Jul 25 06:24:53 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.118 2014/07/31 14:41:19 isaki Exp $	*/
+/*	$NetBSD: locore.s,v 1.119 2015/07/25 06:24:53 isaki Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -362,7 +362,7 @@ Lenab2:
 	movc	%d0,%cacr		| clear cache(s)
 	jra	Lenab3
 Ltbia040:
-	.word	0xf518
+	.word	0xf518			| pflusha
 Lenab3:
 /* final setup for C code */
 	movl	%d7,_C_LABEL(boothowto)	| save reboot flags



CVS commit: src/sys/arch/x68k/stand/libsa

2015-07-25 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Jul 25 06:58:37 UTC 2015

Modified Files:
src/sys/arch/x68k/stand/libsa: Makefile

Log Message:
sysinst is 15*2 sect/cyl (fdXc), not 8*2 sect/cyl (it's fdXa,
DOS compatible).  It makes the loading of sysinst a bit faster.
Pointed out by Yosuke Sugahara.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/x68k/stand/libsa/Makefile

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/x68k/stand/libsa/Makefile
diff -u src/sys/arch/x68k/stand/libsa/Makefile:1.29 src/sys/arch/x68k/stand/libsa/Makefile:1.30
--- src/sys/arch/x68k/stand/libsa/Makefile:1.29	Fri Oct 12 20:15:52 2012
+++ src/sys/arch/x68k/stand/libsa/Makefile	Sat Jul 25 06:58:37 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.29 2012/10/12 20:15:52 tsutsui Exp $
+#	$NetBSD: Makefile,v 1.30 2015/07/25 06:58:37 isaki Exp $
 
 S=		${.CURDIR}/../../../..
 
@@ -9,7 +9,7 @@ CPPFLAGS+=	-I${.CURDIR}/../libiocs -I${.
 CPPFLAGS+=	-D_STANDALONE
 CPPFLAGS+=	-DHEAP_VARIABLE
 CPPFLAGS+=	-DHAVE_CHANGEDISK_HOOK
-CPPFLAGS+=	-DUSTAR_SECT_PER_CYL=16
+CPPFLAGS+=	-DUSTAR_SECT_PER_CYL=30
 CPPFLAGS+=	-DLIBSA_ENABLE_LS_OP
 CPPFLAGS+=	-DSUPPORT_BOOTP -DSUPPORT_DHCP
 #CPPFLAGS+=	-DDEBUG



CVS commit: src/sys/lib/libsa

2015-07-25 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Jul 25 07:06:12 UTC 2015

Modified Files:
src/sys/lib/libsa: bootp.c cread.c loadfile_elf32.c

Log Message:
white space - tab.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/lib/libsa/bootp.c
cvs rdiff -u -r1.26 -r1.27 src/sys/lib/libsa/cread.c
cvs rdiff -u -r1.30 -r1.31 src/sys/lib/libsa/loadfile_elf32.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/lib/libsa/bootp.c
diff -u src/sys/lib/libsa/bootp.c:1.39 src/sys/lib/libsa/bootp.c:1.40
--- src/sys/lib/libsa/bootp.c:1.39	Thu Mar 20 20:42:37 2014
+++ src/sys/lib/libsa/bootp.c	Sat Jul 25 07:06:11 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootp.c,v 1.39 2014/03/20 20:42:37 christos Exp $	*/
+/*	$NetBSD: bootp.c,v 1.40 2015/07/25 07:06:11 isaki Exp $	*/
 
 /*
  * Copyright (c) 1992 Regents of the University of California.
@@ -393,7 +393,7 @@ vend_rfc1048(u_char *cp, u_int len)
 			/* let it override bp_siaddr */
 			(void)memcpy(rootip.s_addr, cp, sizeof(rootip.s_addr));
 		}
-	if (tag == TAG_ROOTPATH  size  sizeof(rootpath)) {
+		if (tag == TAG_ROOTPATH  size  sizeof(rootpath)) {
 			strncpy(rootpath, (char *)cp, sizeof(rootpath));
 			rootpath[size] = '\0';
 		}

Index: src/sys/lib/libsa/cread.c
diff -u src/sys/lib/libsa/cread.c:1.26 src/sys/lib/libsa/cread.c:1.27
--- src/sys/lib/libsa/cread.c:1.26	Sun Oct 13 20:09:02 2013
+++ src/sys/lib/libsa/cread.c	Sat Jul 25 07:06:11 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cread.c,v 1.26 2013/10/13 20:09:02 joerg Exp $	*/
+/*	$NetBSD: cread.c,v 1.27 2015/07/25 07:06:11 isaki Exp $	*/
 
 /*
  * Copyright (c) 1996
@@ -103,15 +103,15 @@ crc32(uint32_t crc, const uint8_t *const
 
 	crc = 0xU ^ crc;
 	for (i = 0; i  len; i++) {
-	c = buf[i];
-	for (j = 0; j  8; j++) {
-		carry = ((crc  0x01) ? 1 : 0) ^ (c  0x01);
-		crc = 1;
-		c = 1;
-		if (carry) {
-			crc = (crc ^ ETHER_CRC_POLY_LE);
+		c = buf[i];
+		for (j = 0; j  8; j++) {
+			carry = ((crc  0x01) ? 1 : 0) ^ (c  0x01);
+			crc = 1;
+			c = 1;
+			if (carry) {
+crc = (crc ^ ETHER_CRC_POLY_LE);
+			}
 		}
-	}
 	}
 	return (crc ^ 0xU);
 }

Index: src/sys/lib/libsa/loadfile_elf32.c
diff -u src/sys/lib/libsa/loadfile_elf32.c:1.30 src/sys/lib/libsa/loadfile_elf32.c:1.31
--- src/sys/lib/libsa/loadfile_elf32.c:1.30	Wed Nov 27 17:33:03 2013
+++ src/sys/lib/libsa/loadfile_elf32.c	Sat Jul 25 07:06:11 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_elf32.c,v 1.30 2013/11/27 17:33:03 jakllsch Exp $ */
+/* $NetBSD: loadfile_elf32.c,v 1.31 2015/07/25 07:06:11 isaki Exp $ */
 
 /*-
  * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -457,24 +457,24 @@ ELFNAMEEND(loadfile)(int fd, Elf_Ehdr *e
 		 * table.
 		 */
 		for (first = 1, i = 0; i  elf-e_shnum; i++) {
-			if (i == elf-e_shstrndx) {
-			/* already loaded this section */
-			continue;
+			if (i == elf-e_shstrndx) {
+/* already loaded this section */
+continue;
 			}
 			switch (shp[i].sh_type) {
 			case SHT_PROGBITS:
-				if (boot_load_ctf  shstr) {
+if (boot_load_ctf  shstr) {
 	/* got a CTF section? */
 	if (strncmp(.SUNW_ctf,
-		shstr[shp[i].sh_name],
-		10) == 0) {
-		goto havesym;
+	shstr[shp[i].sh_name],
+	10) == 0) {
+		goto havesym;
 	}
 }
 
 /* Not loading this, so zero out the offset. */
 shp[i].sh_offset = 0;
-				break;
+break;
 			case SHT_STRTAB:
 for (j = 0; j  elf-e_shnum; j++)
 	if (shp[j].sh_type == SHT_SYMTAB 
@@ -535,8 +535,8 @@ ELFNAMEEND(loadfile)(int fd, Elf_Ehdr *e
 ELF_NOTE_TYPE_NETBSD_TAG 
 memcmp(note.name, ELF_NOTE_NETBSD_NAME,
 sizeof(note.name)) == 0) {
-	memcpy(netbsd_version, note.desc,
-	sizeof(netbsd_version));
+	memcpy(netbsd_version, note.desc,
+	sizeof(netbsd_version));
 }
 shp[i].sh_offset = 0;
 break;



CVS commit: src/usr.sbin/sysinst

2015-07-25 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Jul 25 07:12:30 UTC 2015

Modified Files:
src/usr.sbin/sysinst: disks.c upgrade.c

Log Message:
indent and some KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/sysinst/disks.c
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/sysinst/upgrade.c

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

Modified files:

Index: src/usr.sbin/sysinst/disks.c
diff -u src/usr.sbin/sysinst/disks.c:1.9 src/usr.sbin/sysinst/disks.c:1.10
--- src/usr.sbin/sysinst/disks.c:1.9	Sun May 10 10:14:02 2015
+++ src/usr.sbin/sysinst/disks.c	Sat Jul 25 07:12:30 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: disks.c,v 1.9 2015/05/10 10:14:02 martin Exp $ */
+/*	$NetBSD: disks.c,v 1.10 2015/07/25 07:12:30 isaki Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -308,9 +308,9 @@ get_descr_ata(struct disk_desc *dd, int 
 	if (!(inqbuf-atap_config != WDC_CFG_CFA_MAGIC 
 	  (inqbuf-atap_config  WDC_CFG_ATAPI) 
 	  ((inqbuf-atap_model[0] == 'N' 
-		  inqbuf-atap_model[1] == 'E') ||
+	inqbuf-atap_model[1] == 'E') ||
 	   (inqbuf-atap_model[0] == 'F' 
-		  inqbuf-atap_model[1] == 'X' {
+	inqbuf-atap_model[1] == 'X' {
 		needswap = 1;
 	}
 #endif
@@ -378,7 +378,7 @@ get_default_cdrom(void)
 		return cdrom_devices[0];
 
 	(void)sysctlbyname(mib_name, disknames, len, NULL, 0);
-for ((name = strtok_r(disknames,  , last)); name;
+	for ((name = strtok_r(disknames,  , last)); name;
 	(name = strtok_r(NULL,  , last))) {
 		for (arg = cdrom_devices; *arg; ++arg) {
 			cd_dev = *arg;
@@ -468,9 +468,12 @@ find_disks(const char *doingwhat)
 	/* Kill typeahead, it won't be what the user had in mind */
 	fpurge(stdin);
 
-	/* partman_go: 0 - we want to see menu with extended partitioning
-  ==0 - we want to see simple select disk menu
-   0 - we do not want to see any menus, just detect all disks */
+	/*
+	 * partman_go: 0 - we want to see menu with extended partitioning
+	 *==0 - we want to see simple select disk menu
+	 * 0 - we do not want to see any menus, just detect
+	 *  all disks
+	 */
 	if (partman_go = 0) {
 		if (numdisks == 0) {
 			/* No disks found! */
@@ -503,11 +506,11 @@ find_disks(const char *doingwhat)
 		}
 		if (partman_go  0  selected_disk == numdisks) {
 			partman_go = 1;
-		return -2;
+			return -2;
 		} else
 			partman_go = 0;
 		if (selected_disk  0 || selected_disk = numdisks)
-		return -1;
+			return -1;
 	}
 
 	/* Fill pm struct with device(s) info */
@@ -519,8 +522,8 @@ find_disks(const char *doingwhat)
 			already_found = 0;
 			SLIST_FOREACH(pm_i, pm_head, l) {
 pm_last = pm_i;
-if (!already_found  
-		strcmp(pm_i-diskdev, disk-dd_name) == 0) {
+if (!already_found 
+strcmp(pm_i-diskdev, disk-dd_name) == 0) {
 	pm_i-found = 1;
 	break;
 }
@@ -784,7 +787,7 @@ make_filesystems(void)
 	%s /dev/r%s,
 	newfs, dev);
 else {
-			run_program(RUN_SILENT | RUN_ERROR_OK,
+	run_program(RUN_SILENT | RUN_ERROR_OK,
 	umount /mnt2);
 	error = 0;
 }
@@ -839,7 +842,7 @@ make_fstab(void)
 	if (logfp)
 		(void)fprintf(logfp,
 		Making %s/etc/fstab (%s).\n, target_prefix(), pm-diskdev);
-	
+
 	if (f == NULL) {
 		msg_display(MSG_createfstab);
 		if (logfp)
@@ -866,7 +869,7 @@ make_fstab(void)
 			const char *mp = pm_i-bsdlabel[i].pi_mount;
 			const char *fstype = ffs;
 			int fsck_pass = 0, dump_freq = 0;
-			
+
 			if (dev != NULL)
 free(dev);
 			if (pm_i-isspecial)
@@ -1201,10 +1204,11 @@ mount_disks(void)
 }
 
 int
-set_swap_if_low_ram(const char *disk, partinfo *pp) {
-if (get_ramsize() = 32) 
-return set_swap(disk, pp);
-return 0;
+set_swap_if_low_ram(const char *disk, partinfo *pp)
+{
+	if (get_ramsize() = 32)
+		return set_swap(disk, pp);
+	return 0;
 }
 
 int

Index: src/usr.sbin/sysinst/upgrade.c
diff -u src/usr.sbin/sysinst/upgrade.c:1.4 src/usr.sbin/sysinst/upgrade.c:1.5
--- src/usr.sbin/sysinst/upgrade.c:1.4	Sun May 10 10:14:02 2015
+++ src/usr.sbin/sysinst/upgrade.c	Sat Jul 25 07:12:30 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: upgrade.c,v 1.4 2015/05/10 10:14:02 martin Exp $	*/
+/*	$NetBSD: upgrade.c,v 1.5 2015/07/25 07:12:30 isaki Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -66,7 +66,7 @@ do_upgrade(void)
 	if (find_disks(msg_string(MSG_upgrade))  0)
 		return;
 
-if (set_swap_if_low_ram(pm-diskdev, NULL)  0)
+	if (set_swap_if_low_ram(pm-diskdev, NULL)  0)
 		return;
 
 	if (md_pre_update()  0)



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

2015-07-25 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jul 25 15:19:54 UTC 2015

Modified Files:
src/sys/arch/arm/allwinner: awin_hdmi.c files.awin

Log Message:
For DDC, we don't have a real I2C bus, but instead read an EDID block at
a time. Read the blocks ourselves instead of pulling in ddc_read_edid.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/allwinner/awin_hdmi.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/arm/allwinner/files.awin

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/allwinner/awin_hdmi.c
diff -u src/sys/arch/arm/allwinner/awin_hdmi.c:1.15 src/sys/arch/arm/allwinner/awin_hdmi.c:1.16
--- src/sys/arch/arm/allwinner/awin_hdmi.c:1.15	Mon Nov 17 10:00:14 2014
+++ src/sys/arch/arm/allwinner/awin_hdmi.c	Sat Jul 25 15:19:54 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_hdmi.c,v 1.15 2014/11/17 10:00:14 jmcneill Exp $ */
+/* $NetBSD: awin_hdmi.c,v 1.16 2015/07/25 15:19:54 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill jmcne...@invisible.ca
@@ -32,7 +32,7 @@
 #define AWIN_HDMI_PLL	3	/* PLL7 or PLL3 */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: awin_hdmi.c,v 1.15 2014/11/17 10:00:14 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: awin_hdmi.c,v 1.16 2015/07/25 15:19:54 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -99,6 +99,8 @@ static int	awin_hdmi_i2c_reset(struct aw
 
 static void	awin_hdmi_enable(struct awin_hdmi_softc *);
 static void	awin_hdmi_read_edid(struct awin_hdmi_softc *);
+static int	awin_hdmi_read_edid_block(struct awin_hdmi_softc *, uint8_t *,
+	  uint8_t);
 static u_int	awin_hdmi_get_display_mode(struct awin_hdmi_softc *,
 	   const struct edid_info *);
 static void	awin_hdmi_video_enable(struct awin_hdmi_softc *, bool);
@@ -486,6 +488,29 @@ awin_hdmi_enable(struct awin_hdmi_softc 
 	delay(1000);
 }
 
+static int
+awin_hdmi_read_edid_block(struct awin_hdmi_softc *sc, uint8_t *data,
+uint8_t block)
+{
+	i2c_tag_t tag = sc-sc_ic;
+	uint8_t wbuf[2];
+	int error;
+
+	if ((error = iic_acquire_bus(tag, I2C_F_POLL)) != 0)
+		return error;
+
+	wbuf[0] = block;	/* start address */
+
+	if ((error = iic_exec(tag, I2C_OP_READ_WITH_STOP, DDC_ADDR, wbuf, 1,
+	data, 128, I2C_F_POLL)) != 0) {
+		iic_release_bus(tag, I2C_F_POLL);
+		return error;
+	}
+	iic_release_bus(tag, I2C_F_POLL);
+
+	return 0;
+}
+
 static void
 awin_hdmi_read_edid(struct awin_hdmi_softc *sc)
 {
@@ -499,7 +524,7 @@ awin_hdmi_read_edid(struct awin_hdmi_sof
 	memset(ei, 0, sizeof(ei));
 
 	while (--retry  0) {
-		if (!ddc_read_edid_block(sc-sc_ic, edid, sizeof(edid), 0))
+		if (!awin_hdmi_read_edid_block(sc, edid, 0))
 			break;
 	}
 	if (retry == 0) {
@@ -566,7 +591,7 @@ awin_hdmi_get_display_mode(struct awin_h
 	 * found in that, assume HDMI mode.
 	 */
 	for (n = 1; n = MIN(ei-edid_ext_block_count, 4); n++) {
-		if (ddc_read_edid_block(sc-sc_ic, edid, sizeof(edid), n)) {
+		if (awin_hdmi_read_edid_block(sc, edid, n)) {
 #ifdef AWIN_HDMI_DEBUG
 			device_printf(sc-sc_dev,
 			Failed to read EDID block %d\n, n);

Index: src/sys/arch/arm/allwinner/files.awin
diff -u src/sys/arch/arm/allwinner/files.awin:1.31 src/sys/arch/arm/allwinner/files.awin:1.32
--- src/sys/arch/arm/allwinner/files.awin:1.31	Mon Apr 20 01:33:22 2015
+++ src/sys/arch/arm/allwinner/files.awin	Sat Jul 25 15:19:54 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: files.awin,v 1.31 2015/04/20 01:33:22 matt Exp $
+#	$NetBSD: files.awin,v 1.32 2015/07/25 15:19:54 jmcneill Exp $
 #
 # Configuration info for Allwinner ARM Peripherals
 #
@@ -140,7 +140,7 @@ attach	awinac at awinio with awin_ac
 file	arch/arm/allwinner/awin_ac.c		awin_ac
 
 # A20/A31 HDMI
-device	awinhdmi: edid, ddc_read_edid, videomode
+device	awinhdmi: edid, videomode
 attach	awinhdmi at awinio with awin_hdmi
 file	arch/arm/allwinner/awin_hdmi.c		awin_hdmi
 



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

2015-07-25 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jul 25 15:55:31 UTC 2015

Modified Files:
src/sys/arch/arm/nvidia: tegra_hdmi.c

Log Message:
remove debug printfs, dont force hdmi mode


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/nvidia/tegra_hdmi.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/nvidia/tegra_hdmi.c
diff -u src/sys/arch/arm/nvidia/tegra_hdmi.c:1.6 src/sys/arch/arm/nvidia/tegra_hdmi.c:1.7
--- src/sys/arch/arm/nvidia/tegra_hdmi.c:1.6	Sat Jul 25 15:50:42 2015
+++ src/sys/arch/arm/nvidia/tegra_hdmi.c	Sat Jul 25 15:55:31 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_hdmi.c,v 1.6 2015/07/25 15:50:42 jmcneill Exp $ */
+/* $NetBSD: tegra_hdmi.c,v 1.7 2015/07/25 15:55:31 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill jmcne...@invisible.ca
@@ -29,7 +29,7 @@
 #include locators.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tegra_hdmi.c,v 1.6 2015/07/25 15:50:42 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: tegra_hdmi.c,v 1.7 2015/07/25 15:55:31 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -236,11 +236,6 @@ tegra_hdmi_connect(struct tegra_hdmi_sof
 
 	sc-sc_curmode = mode;
 	sc-sc_hdmimode = tegra_hdmi_is_hdmi(sc, ei);
-device_printf(sc-sc_dev, connected to %s display\n, sc-sc_hdmimode ? HDMI : DVI);
-	if (sc-sc_hdmimode == false) {
-		device_printf(sc-sc_dev, forcing HDMI mode\n);
-		sc-sc_hdmimode = true;
-	}
 
 	tegra_hdmi_enable(sc, pedid);
 }



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

2015-07-25 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jul 26 00:15:53 UTC 2015

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

Log Message:
KASSERT-KASSERTMSG


To generate a diff of this commit:
cvs rdiff -u -r1.325 -r1.326 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.325 src/sys/arch/arm/arm32/pmap.c:1.326
--- src/sys/arch/arm/arm32/pmap.c:1.325	Tue Jun  9 10:44:55 2015
+++ src/sys/arch/arm/arm32/pmap.c	Sun Jul 26 00:15:53 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.325 2015/06/09 10:44:55 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.326 2015/07/26 00:15:53 matt Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -216,7 +216,7 @@
 
 #include arm/locore.h
 
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.325 2015/06/09 10:44:55 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.326 2015/07/26 00:15:53 matt Exp $);
 
 //#define PMAP_DEBUG
 #ifdef PMAP_DEBUG
@@ -7875,7 +7875,7 @@ pmap_map_poolpage(paddr_t pa)
 {
 	bool ok __diagused;
 	vaddr_t va = pmap_direct_mapped_phys(pa, ok, 0);
-	KASSERT(ok);
+	KASSERTMSG(ok, pa %#lx not direct mappable, pa);
 #if defined(PMAP_CACHE_VIPT)  !defined(ARM_MMU_EXTENDED)
 	if (arm_cache_prefer_mask != 0) {
 		struct vm_page * const pg = PHYS_TO_VM_PAGE(pa);



CVS commit: src

2015-07-25 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Jul 26 02:20:30 UTC 2015

Modified Files:
src/distrib/sets/lists/comp: mi
src/include: util.h
src/lib/libutil: Makefile efun.3 efun.c

Log Message:
Add ereallocarr(3) to libutil

ereallocarr(3) wraps reallocarr(3) and embeds return status validation.

Older version reviewed by riastradh and christos


To generate a diff of this commit:
cvs rdiff -u -r1.1971 -r1.1972 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.66 -r1.67 src/include/util.h
cvs rdiff -u -r1.76 -r1.77 src/lib/libutil/Makefile
cvs rdiff -u -r1.11 -r1.12 src/lib/libutil/efun.3
cvs rdiff -u -r1.9 -r1.10 src/lib/libutil/efun.c

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1971 src/distrib/sets/lists/comp/mi:1.1972
--- src/distrib/sets/lists/comp/mi:1.1971	Tue Jul 21 03:12:50 2015
+++ src/distrib/sets/lists/comp/mi	Sun Jul 26 02:20:30 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1971 2015/07/21 03:12:50 knakahara Exp $
+#	$NetBSD: mi,v 1.1972 2015/07/26 02:20:30 kamil Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -6422,6 +6422,7 @@
 ./usr/share/man/cat3/erase.0			comp-c-catman		.cat
 ./usr/share/man/cat3/erasechar.0		comp-c-catman		.cat
 ./usr/share/man/cat3/erealloc.0			comp-c-catman		.cat
+./usr/share/man/cat3/ereallocarr.0		comp-c-catman		.cat
 ./usr/share/man/cat3/erf.0			comp-c-catman		.cat
 ./usr/share/man/cat3/erfc.0			comp-c-catman		.cat
 ./usr/share/man/cat3/erfcf.0			comp-c-catman		.cat
@@ -13358,6 +13359,7 @@
 ./usr/share/man/html3/erase.html		comp-c-htmlman		html
 ./usr/share/man/html3/erasechar.html		comp-c-htmlman		html
 ./usr/share/man/html3/erealloc.html		comp-c-htmlman		html
+./usr/share/man/html3/ereallocarr.html		comp-c-htmlman		html
 ./usr/share/man/html3/erf.html			comp-c-htmlman		html
 ./usr/share/man/html3/erfc.html			comp-c-htmlman		html
 ./usr/share/man/html3/erfcf.html		comp-c-htmlman		html
@@ -20206,6 +20208,7 @@
 ./usr/share/man/man3/erase.3			comp-c-man		.man
 ./usr/share/man/man3/erasechar.3		comp-c-man		.man
 ./usr/share/man/man3/erealloc.3			comp-c-man		.man
+./usr/share/man/man3/ereallocarr.3		comp-c-man		.man
 ./usr/share/man/man3/erf.3			comp-c-man		.man
 ./usr/share/man/man3/erfc.3			comp-c-man		.man
 ./usr/share/man/man3/erfcf.3			comp-c-man		.man

Index: src/include/util.h
diff -u src/include/util.h:1.66 src/include/util.h:1.67
--- src/include/util.h:1.66	Sun Jan 18 18:10:01 2015
+++ src/include/util.h	Sun Jul 26 02:20:30 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.h,v 1.66 2015/01/18 18:10:01 christos Exp $	*/
+/*	$NetBSD: util.h,v 1.67 2015/07/26 02:20:30 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1995
@@ -152,6 +152,7 @@ uintmax_t	estrtou(const char *, int, uin
 void 		*ecalloc(size_t, size_t);
 void 		*emalloc(size_t);
 void 		*erealloc(void *, size_t);
+void 		ereallocarr(void *, size_t, size_t);
 struct __sFILE	*efopen(const char *, const char *);
 int	 	easprintf(char ** __restrict, const char * __restrict, ...)
 			__printflike(2, 3);

Index: src/lib/libutil/Makefile
diff -u src/lib/libutil/Makefile:1.76 src/lib/libutil/Makefile:1.77
--- src/lib/libutil/Makefile:1.76	Sun Jan 18 18:09:36 2015
+++ src/lib/libutil/Makefile	Sun Jul 26 02:20:30 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.76 2015/01/18 18:09:36 christos Exp $
+#	$NetBSD: Makefile,v 1.77 2015/07/26 02:20:30 kamil Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/4/93
 
 USE_SHLIBDIR=	yes
@@ -82,6 +82,7 @@ MLINKS+=efun.3 estrtou.3
 MLINKS+=efun.3 emalloc.3
 MLINKS+=efun.3 ecalloc.3
 MLINKS+=efun.3 erealloc.3
+MLINKS+=efun.3 ereallocarr.3
 MLINKS+=efun.3 efopen.3
 MLINKS+=efun.3 evasprintf.3
 MLINKS+=stat_flags.3 string_to_flags.3

Index: src/lib/libutil/efun.3
diff -u src/lib/libutil/efun.3:1.11 src/lib/libutil/efun.3:1.12
--- src/lib/libutil/efun.3:1.11	Sun Jan 18 18:09:36 2015
+++ src/lib/libutil/efun.3	Sun Jul 26 02:20:30 2015
@@ -1,4 +1,4 @@
-.\ $NetBSD: efun.3,v 1.11 2015/01/18 18:09:36 christos Exp $
+.\ $NetBSD: efun.3,v 1.12 2015/07/26 02:20:30 kamil Exp $
 .\
 .\ Copyright (c) 2006 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -37,6 +37,7 @@
 .Nm emalloc ,
 .Nm ecalloc ,
 .Nm erealloc ,
+.Nm ereallocarr ,
 .Nm estrdup ,
 .Nm estrndup ,
 .Nm estrlcat ,
@@ -61,6 +62,8 @@
 .Fn emalloc size_t n
 .Ft void *
 .Fn erealloc void *p size_t n
+.Ft void
+.Fn ereallocarr void *p size_t n size_t s
 .Ft char *
 .Fn estrdup const char *s
 .Ft char *
@@ -82,6 +85,7 @@ The
 .Fn ecalloc ,
 .Fn emalloc ,
 .Fn erealloc ,
+.Fn ereallocarr ,
 .Fn estrdup ,
 .Fn estrndup ,
 .Fn estrlcat ,
@@ -118,6 +122,7 @@ error handler will just call
 .Xr fopen 3 ,
 .Xr malloc 3 ,
 .Xr realloc 3 ,
+.Xr reallocarr 3 ,
 .Xr strdup 3 ,
 .Xr strlcat 3 ,
 .Xr strlcpy 3 ,
@@ -127,8 +132,9 @@ error handler will just call
 .Xr vasprintf 3
 .Sh HISTORY
 The
-.Fn estrtoi
-and
+.Fn estrtoi ,
 .Fn 

CVS commit: src/lib/libc/stdlib

2015-07-25 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Jul 26 02:22:33 UTC 2015

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

Log Message:
reallocarray(3) cleanup

Add missing NetBSD CVS Id
Don't define twice _OPENBSD_SOURCE


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/stdlib/reallocarray.c

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

Modified files:

Index: src/lib/libc/stdlib/reallocarray.c
diff -u src/lib/libc/stdlib/reallocarray.c:1.4 src/lib/libc/stdlib/reallocarray.c:1.5
--- src/lib/libc/stdlib/reallocarray.c:1.4	Tue Mar 10 13:05:13 2015
+++ src/lib/libc/stdlib/reallocarray.c	Sun Jul 26 02:22:33 2015
@@ -1,3 +1,4 @@
+/*	$NetBSD: reallocarray.c,v 1.5 2015/07/26 02:22:33 kamil Exp $	*/
 /*	$OpenBSD: reallocarray.c,v 1.1 2014/05/08 21:43:49 deraadt Exp $	*/
 
 /*-
@@ -28,9 +29,9 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
-#define _OPENBSD_SOURCE
+
 #include sys/cdefs.h
-__RCSID($NetBSD: reallocarray.c,v 1.4 2015/03/10 13:05:13 christos Exp $);
+__RCSID($NetBSD: reallocarray.c,v 1.5 2015/07/26 02:22:33 kamil Exp $);
 
 #define _OPENBSD_SOURCE
 #include errno.h



CVS commit: src/lib/libc/stdlib

2015-07-25 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Jul 26 02:29:44 UTC 2015

Modified Files:
src/lib/libc/stdlib: reallocarray.3

Log Message:
Add license header (the NetBSD 2-clause version) with (C) TNF


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/stdlib/reallocarray.3

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

Modified files:

Index: src/lib/libc/stdlib/reallocarray.3
diff -u src/lib/libc/stdlib/reallocarray.3:1.3 src/lib/libc/stdlib/reallocarray.3:1.4
--- src/lib/libc/stdlib/reallocarray.3:1.3	Fri Feb  6 08:37:39 2015
+++ src/lib/libc/stdlib/reallocarray.3	Sun Jul 26 02:29:44 2015
@@ -1,4 +1,31 @@
-.\ $NetBSD: reallocarray.3,v 1.3 2015/02/06 08:37:39 wiz Exp $
+.\ $NetBSD: reallocarray.3,v 1.4 2015/07/26 02:29:44 kamil Exp $
+.\
+.\ Copyright (c) 2015 The NetBSD Foundation, Inc.
+.\ 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.
 .\
 .Dd February 5, 2015
 .Dt REALLOCARRAY 3



CVS commit: src

2015-07-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jul 25 10:37:22 UTC 2015

Modified Files:
src/sbin/newfs: newfs.c
src/usr.sbin/installboot: installboot.c

Log Message:
Handle getfsspecname errors.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sbin/newfs/newfs.c
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/installboot/installboot.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/newfs/newfs.c
diff -u src/sbin/newfs/newfs.c:1.112 src/sbin/newfs/newfs.c:1.113
--- src/sbin/newfs/newfs.c:1.112	Sat Oct 25 16:47:23 2014
+++ src/sbin/newfs/newfs.c	Sat Jul 25 10:37:22 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: newfs.c,v 1.112 2014/10/25 16:47:23 mlelstv Exp $	*/
+/*	$NetBSD: newfs.c,v 1.113 2015/07/25 10:37:22 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1983, 1989, 1993, 1994
@@ -78,7 +78,7 @@ __COPYRIGHT(@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = @(#)newfs.c	8.13 (Berkeley) 5/1/95;
 #else
-__RCSID($NetBSD: newfs.c,v 1.112 2014/10/25 16:47:23 mlelstv Exp $);
+__RCSID($NetBSD: newfs.c,v 1.113 2015/07/25 10:37:22 mlelstv Exp $);
 #endif
 #endif /* not lint */
 
@@ -493,9 +493,11 @@ main(int argc, char *argv[])
 fso = fsi;
 		}
 	} else {	/* !Fflag  !mfs */
-		special = getfsspecname(specname, sizeof(specname), special);
-		raw = getdiskrawname(rawname, sizeof(rawname), special);
-		if (raw != NULL)
+		raw = getfsspecname(specname, sizeof(specname), special);
+		if (raw == NULL)
+			err(1, %s: %s, special, specname);
+		special = getdiskrawname(rawname, sizeof(rawname), raw);
+		if (special == NULL)
 			special = raw;
 
 		fsi = opendisk(special, O_RDONLY, device, sizeof(device), 0);

Index: src/usr.sbin/installboot/installboot.c
diff -u src/usr.sbin/installboot/installboot.c:1.38 src/usr.sbin/installboot/installboot.c:1.39
--- src/usr.sbin/installboot/installboot.c:1.38	Fri Jun  5 07:44:39 2015
+++ src/usr.sbin/installboot/installboot.c	Sat Jul 25 10:37:22 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: installboot.c,v 1.38 2015/06/05 07:44:39 mlelstv Exp $	*/
+/*	$NetBSD: installboot.c,v 1.39 2015/07/25 10:37:22 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include sys/cdefs.h
 #if !defined(__lint)
-__RCSID($NetBSD: installboot.c,v 1.38 2015/06/05 07:44:39 mlelstv Exp $);
+__RCSID($NetBSD: installboot.c,v 1.39 2015/07/25 10:37:22 mlelstv Exp $);
 #endif	/* !__lint */
 
 #include sys/param.h
@@ -240,6 +240,8 @@ main(int argc, char *argv[])
 
 #if !HAVE_NBTOOL_CONFIG_H
 	special = getfsspecname(specname, sizeof(specname), argv[0]);
+	if (special == NULL)
+		err(1, %s: %s, argv[0], specname);
 	raw = getdiskrawname(rawname, sizeof(rawname), special);
 	if (raw != NULL)
 		special = raw;



CVS commit: src/sys/ufs/lfs

2015-07-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 25 10:40:35 UTC 2015

Modified Files:
src/sys/ufs/lfs: lfs_bio.c lfs_debug.c lfs_pages.c lfs_segment.c
lfs_vnops.c

Log Message:
Use accessors in DEBUG and DIAGNOSTIC code as well


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/ufs/lfs/lfs_bio.c
cvs rdiff -u -r1.43 -r1.44 src/sys/ufs/lfs/lfs_debug.c
cvs rdiff -u -r1.3 -r1.4 src/sys/ufs/lfs/lfs_pages.c
cvs rdiff -u -r1.243 -r1.244 src/sys/ufs/lfs/lfs_segment.c
cvs rdiff -u -r1.275 -r1.276 src/sys/ufs/lfs/lfs_vnops.c

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

Modified files:

Index: src/sys/ufs/lfs/lfs_bio.c
diff -u src/sys/ufs/lfs/lfs_bio.c:1.130 src/sys/ufs/lfs/lfs_bio.c:1.131
--- src/sys/ufs/lfs/lfs_bio.c:1.130	Fri Jul 24 06:59:32 2015
+++ src/sys/ufs/lfs/lfs_bio.c	Sat Jul 25 10:40:35 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_bio.c,v 1.130 2015/07/24 06:59:32 dholland Exp $	*/
+/*	$NetBSD: lfs_bio.c,v 1.131 2015/07/25 10:40:35 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2008 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lfs_bio.c,v 1.130 2015/07/24 06:59:32 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: lfs_bio.c,v 1.131 2015/07/25 10:40:35 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -231,7 +231,7 @@ lfs_reserveavail(struct lfs *fs, struct 
 			DLOG((DLOG_AVAIL, lfs_reserve: waiting for %ld (bfree = %d,
 			   est_bfree = %d)\n,
 			  fsb + fs-lfs_ravail + fs-lfs_favail,
-			  fs-lfs_bfree, LFS_EST_BFREE(fs)));
+			  lfs_sb_getbfree(fs), LFS_EST_BFREE(fs)));
 		}
 		++slept;
 
@@ -367,7 +367,7 @@ lfs_fits(struct lfs *fs, int fsb)
 #ifdef DEBUG
 		DLOG((DLOG_AVAIL, lfs_fits: no fit: fsb = %ld, uinodes = %ld, 
 		  needed = %jd, avail = %jd\n,
-		  (long)fsb, (long)fs-lfs_uinodes, (intmax_t)needed,
+		  (long)fsb, (long)lfs_sb_getuinodes(fs), (intmax_t)needed,
 		  (intmax_t)lfs_sb_getavail(fs)));
 #endif
 		return 0;

Index: src/sys/ufs/lfs/lfs_debug.c
diff -u src/sys/ufs/lfs/lfs_debug.c:1.43 src/sys/ufs/lfs/lfs_debug.c:1.44
--- src/sys/ufs/lfs/lfs_debug.c:1.43	Tue Jun 18 18:18:58 2013
+++ src/sys/ufs/lfs/lfs_debug.c	Sat Jul 25 10:40:35 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_debug.c,v 1.43 2013/06/18 18:18:58 christos Exp $	*/
+/*	$NetBSD: lfs_debug.c,v 1.44 2015/07/25 10:40:35 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lfs_debug.c,v 1.43 2013/06/18 18:18:58 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: lfs_debug.c,v 1.44 2015/07/25 10:40:35 martin Exp $);
 
 #ifdef DEBUG
 
@@ -129,62 +129,62 @@ lfs_dump_super(struct lfs *lfsp)
 	printf(%s%x\t%s%x\t%s%d\t%s%d\n,
 	   magic	 , lfsp-lfs_magic,
 	   version	 , lfsp-lfs_version,
-	   size	 , lfsp-lfs_size,
-	   ssize	 , lfsp-lfs_ssize);
+	   size	 , lfs_sb_getsize(lfsp),
+	   ssize	 , lfs_sb_getssize(lfsp));
 	printf(%s%d\t%s%d\t%s%d\t%s%d\n,
-	   dsize	 , lfsp-lfs_dsize,
-	   bsize	 , lfsp-lfs_bsize,
-	   fsize	 , lfsp-lfs_fsize,
-	   frag	 , lfsp-lfs_frag);
+	   dsize	 , lfs_sb_getdsize(lfsp),
+	   bsize	 , lfs_sb_getbsize(lfsp),
+	   fsize	 , lfs_sb_getfsize(lfsp),
+	   frag	 , lfs_sb_getfrag(lfsp));
 
 	printf(%s%d\t%s%d\t%s%d\t%s%d\n,
-	   minfree	 , lfsp-lfs_minfree,
-	   inopb	 , lfsp-lfs_inopb,
-	   ifpb	 , lfsp-lfs_ifpb,
-	   nindir	 , lfsp-lfs_nindir);
+	   minfree	 , lfs_sb_getminfree(lfsp),
+	   inopb	 , lfs_sb_getinopb(lfsp),
+	   ifpb	 , lfs_sb_getifpb(lfsp),
+	   nindir	 , lfs_sb_getnindir(lfsp));
 
 	printf(%s%d\t%s%d\t%s%d\t%s%d\n,
-	   nseg	 , lfsp-lfs_nseg,
-	   nspf	 , lfsp-lfs_nspf,
-	   cleansz	 , lfsp-lfs_cleansz,
-	   segtabsz , lfsp-lfs_segtabsz);
+	   nseg	 , lfs_sb_getnseg(lfsp),
+	   nspf	 , lfs_sb_getnspf(lfsp),
+	   cleansz	 , lfs_sb_getcleansz(lfsp),
+	   segtabsz , lfs_sb_getsegtabsz(lfsp));
 
 	printf(%s%x\t%s%d\t%s%lx\t%s%d\n,
-	   segmask	 , lfsp-lfs_segmask,
-	   segshift , lfsp-lfs_segshift,
-	   bmask	 , (unsigned long)lfsp-lfs_bmask,
-	   bshift	 , lfsp-lfs_bshift);
+	   segmask	 , lfs_sb_getsegmask(lfsp),
+	   segshift , lfs_sb_getsegshift(lfsp),
+	   bmask	 , (unsigned long)lfs_sb_getbmask(lfsp),
+	   bshift	 , lfs_sb_getbshift(lfsp));
 
 	printf(%s%lu\t%s%d\t%s%lx\t%s%u\n,
-	   ffmask	 , (unsigned long)lfsp-lfs_ffmask,
-	   ffshift	 , lfsp-lfs_ffshift,
-	   fbmask	 , (unsigned long)lfsp-lfs_fbmask,
-	   fbshift	 , lfsp-lfs_fbshift);
+	   ffmask	 , (unsigned long)lfs_sb_getffmask(lfsp),
+	   ffshift	 , lfs_sb_getffshift(lfsp),
+	   fbmask	 , (unsigned long)lfs_sb_getfbmask(lfsp),
+	   fbshift	 , lfs_sb_getfbshift(lfsp));
 
 	

CVS commit: src/sys/ufs/lfs

2015-07-25 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Jul 25 13:01:06 UTC 2015

Modified Files:
src/sys/ufs/lfs: lfs_debug.c

Log Message:
Another lfs superblock accessor (inside #ifdef 0).


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/ufs/lfs/lfs_debug.c

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

Modified files:

Index: src/sys/ufs/lfs/lfs_debug.c
diff -u src/sys/ufs/lfs/lfs_debug.c:1.44 src/sys/ufs/lfs/lfs_debug.c:1.45
--- src/sys/ufs/lfs/lfs_debug.c:1.44	Sat Jul 25 10:40:35 2015
+++ src/sys/ufs/lfs/lfs_debug.c	Sat Jul 25 13:01:06 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_debug.c,v 1.44 2015/07/25 10:40:35 martin Exp $	*/
+/*	$NetBSD: lfs_debug.c,v 1.45 2015/07/25 13:01:06 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lfs_debug.c,v 1.44 2015/07/25 10:40:35 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: lfs_debug.c,v 1.45 2015/07/25 13:01:06 hannken Exp $);
 
 #ifdef DEBUG
 
@@ -254,7 +254,7 @@ lfs_check_segsum(struct lfs *fs, struct 
 	if (actual != sp-sum_bytes_left)
 		printf(%s:%d: warning: segsum miscalc at %d (-%d = %d)\n,
 		   file, line, sp-sum_bytes_left,
-		   fs-lfs_sumsize-sp-sum_bytes_left,
+		   lfs_sb_getsumsize(fs)-sp-sum_bytes_left,
 		   actual);
 #endif
 	if (sp-sum_bytes_left  0