CVS commit: src/sys/dev/rasops

2011-12-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Dec 28 08:36:46 UTC 2011

Modified Files:
src/sys/dev/rasops: rasops.c rasops.h rasops8.c

Log Message:
add a new flag for ri_flg to allow drivers to request an r3g3b2 devcmap
in 8 bit colour. Drivers are still responsible to generate an appropriate
colour map for the actual hardware.
For use with alpha blending which needs some sort of 'true' colour.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/rasops/rasops.h \
src/sys/dev/rasops/rasops8.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/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.67 src/sys/dev/rasops/rasops.c:1.68
--- src/sys/dev/rasops/rasops.c:1.67	Thu Dec 22 04:52:45 2011
+++ src/sys/dev/rasops/rasops.c	Wed Dec 28 08:36:46 2011
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.67 2011/12/22 04:52:45 macallan Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.68 2011/12/28 08:36:46 macallan Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rasops.c,v 1.67 2011/12/22 04:52:45 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: rasops.c,v 1.68 2011/12/28 08:36:46 macallan Exp $);
 
 #include opt_rasops.h
 #include rasops_glue.h
@@ -809,9 +809,12 @@ rasops_init_devcmap(struct rasops_info *
 		return;
 
 	case 8:
-		for (i = 0; i  16; i++)
-			ri-ri_devcmap[i] = i | (i8) | (i16) | (i24);
-		return;
+		if ((ri-ri_flg  RI_8BIT_IS_RGB) == 0) {
+			for (i = 0; i  16; i++)
+ri-ri_devcmap[i] =
+i | (i8) | (i16) | (i24);
+			return;
+		}
 	}
 
 	p = rasops_cmap;

Index: src/sys/dev/rasops/rasops.h
diff -u src/sys/dev/rasops/rasops.h:1.27 src/sys/dev/rasops/rasops.h:1.28
--- src/sys/dev/rasops/rasops.h:1.27	Thu Dec 22 04:52:45 2011
+++ src/sys/dev/rasops/rasops.h	Wed Dec 28 08:36:46 2011
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops.h,v 1.27 2011/12/22 04:52:45 macallan Exp $ */
+/* 	$NetBSD: rasops.h,v 1.28 2011/12/28 08:36:46 macallan Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -61,6 +61,8 @@
  * monochrome bitmap fonts. 
  */
 #define RI_ENABLE_ALPHA	0x1000
+/* set this in order to use r3g3b2 'true' colour in 8 bit */ 
+#define RI_8BIT_IS_RGB	0x2000
 
 struct rasops_info {
 	/* These must be filled in by the caller */
Index: src/sys/dev/rasops/rasops8.c
diff -u src/sys/dev/rasops/rasops8.c:1.27 src/sys/dev/rasops/rasops8.c:1.28
--- src/sys/dev/rasops/rasops8.c:1.27	Tue May  4 04:57:34 2010
+++ src/sys/dev/rasops/rasops8.c	Wed Dec 28 08:36:46 2011
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops8.c,v 1.27 2010/05/04 04:57:34 macallan Exp $	*/
+/* 	$NetBSD: rasops8.c,v 1.28 2011/12/28 08:36:46 macallan Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rasops8.c,v 1.27 2010/05/04 04:57:34 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: rasops8.c,v 1.28 2011/12/28 08:36:46 macallan Exp $);
 
 #include opt_rasops.h
 
@@ -91,6 +91,14 @@ rasops8_init(struct rasops_info *ri)
 		ri-ri_ops.putchar = rasops8_putchar;
 		break;
 	}
+	if (ri-ri_flg  RI_8BIT_IS_RGB) {
+		ri-ri_rnum = 3;
+		ri-ri_rpos = 5;
+		ri-ri_gnum = 3;
+		ri-ri_gpos = 2;
+		ri-ri_bnum = 2;
+		ri-ri_bpos = 0;
+	}
 }
 
 /*



CVS commit: src/sys/dev/pci

2011-12-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Dec 28 09:27:18 UTC 2011

Modified Files:
src/sys/dev/pci: r128fbreg.h

Log Message:
add a bunch of register definitions


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/r128fbreg.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/pci/r128fbreg.h
diff -u src/sys/dev/pci/r128fbreg.h:1.3 src/sys/dev/pci/r128fbreg.h:1.4
--- src/sys/dev/pci/r128fbreg.h:1.3	Thu Sep 30 03:14:39 2010
+++ src/sys/dev/pci/r128fbreg.h	Wed Dec 28 09:27:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: r128fbreg.h,v 1.3 2010/09/30 03:14:39 macallan Exp $	*/
+/*	$NetBSD: r128fbreg.h,v 1.4 2011/12/28 09:27:18 macallan Exp $	*/
 
 /*
  * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
@@ -248,4 +248,164 @@
 #define R128_HOST_DATA6   0x17d8
 #define R128_HOST_DATA7   0x17dc
 
+/* Information the firmware is supposed to leave for us */
+#define R128_BIOS_5_SCRATCH   0x0024
+#   define R128_BIOS_DISPLAY_FP   (1  0)
+#   define R128_BIOS_DISPLAY_CRT  (2  0)
+#   define R128_BIOS_DISPLAY_FP_CRT   (3  0)
+
+/* Clock stuff */
+#define R128_CLOCK_CNTL_INDEX 0x0008
+#   define R128_PLL_WR_EN (1  7)
+#   define R128_PLL_DIV_SEL   (3  8)
+#   define R128_PLL2_DIV_SEL_MASK ~(3  8)
+#define R128_CLOCK_CNTL_DATA  0x000c
+
+#define R128_CLK_PIN_CNTL 0x0001 /* PLL */
+#define R128_PPLL_CNTL0x0002 /* PLL */
+#   define R128_PPLL_RESET(1   0)
+#   define R128_PPLL_SLEEP(1   1)
+#   define R128_PPLL_ATOMIC_UPDATE_EN (1  16)
+#   define R128_PPLL_VGA_ATOMIC_UPDATE_EN (1  17)
+#define R128_PPLL_REF_DIV 0x0003 /* PLL */
+#   define R128_PPLL_REF_DIV_MASK 0x03ff
+#   define R128_PPLL_ATOMIC_UPDATE_R  (1  15) /* same as _W */
+#   define R128_PPLL_ATOMIC_UPDATE_W  (1  15) /* same as _R */
+#define R128_PPLL_DIV_0   0x0004 /* PLL */
+#define R128_PPLL_DIV_1   0x0005 /* PLL */
+#define R128_PPLL_DIV_2   0x0006 /* PLL */
+#define R128_PPLL_DIV_3   0x0007 /* PLL */
+#   define R128_PPLL_FB3_DIV_MASK 0x07ff
+#   define R128_PPLL_POST3_DIV_MASK   0x0007
+#define R128_VCLK_ECP_CNTL0x0008 /* PLL */
+#   define R128_VCLK_SRC_SEL_MASK 0x03
+#   define R128_VCLK_SRC_SEL_CPUCLK   0x00
+#   define R128_VCLK_SRC_SEL_PPLLCLK  0x03
+#   define R128_ECP_DIV_MASK  (3  8)
+#define R128_HTOTAL_CNTL  0x0009 /* PLL */
+#define R128_X_MPLL_REF_FB_DIV0x000a /* PLL */
+#define R128_XPLL_CNTL0x000b /* PLL */
+#define R128_XDLL_CNTL0x000c /* PLL */
+#define R128_XCLK_CNTL0x000d /* PLL */
+#define R128_FCP_CNTL 0x0012 /* PLL */
+
+#define R128_P2PLL_CNTL0x002a /* P2PLL */
+#   define R128_P2PLL_RESET   (1   0)
+#   define R128_P2PLL_SLEEP   (1   1)
+#   define R128_P2PLL_ATOMIC_UPDATE_EN(1  16)
+#   define R128_P2PLL_VGA_ATOMIC_UPDATE_EN (1  17)
+#   define R128_P2PLL_ATOMIC_UPDATE_VSYNC  (1  18)
+#define R128_P2PLL_REF_DIV 0x002B /* PLL */
+#   define R128_P2PLL_REF_DIV_MASK 0x03ff
+#   define R128_P2PLL_ATOMIC_UPDATE_R  (1  15) /* same as _W */
+#   define R128_P2PLL_ATOMIC_UPDATE_W  (1  15) /* same as _R */
+#define R128_P2PLL_DIV_0   0x002c
+#   define R128_P2PLL_FB0_DIV_MASK 0x07ff
+#   define R128_P2PLL_POST0_DIV_MASK   0x0007
+#define R128_V2CLK_VCLKTV_CNTL0x002d /* PLL */
+#   define R128_V2CLK_SRC_SEL_MASK0x03
+#   define R128_V2CLK_SRC_SEL_CPUCLK  0x00
+#   define R128_V2CLK_SRC_SEL_P2PLLCLK 0x03
+#define R128_HTOTAL2_CNTL 0x002e /* PLL */
+
+/* CTRCs */
+#define R128_CRTC_GEN_CNTL0x0050
+#   define R128_CRTC_DBL_SCAN_EN  (1   0)
+#   define R128_CRTC_INTERLACE_EN (1   1)
+#   define R128_CRTC_CSYNC_EN (1   4)
+#   define R128_CRTC_CUR_EN   (1  16)
+#   define R128_CRTC_CUR_MODE_MASK(7  17)
+#   define R128_CRTC_ICON_EN  (1  20)
+#   define R128_CRTC_EXT_DISP_EN  (1  24)
+#   define R128_CRTC_EN   (1  25)
+#   define R128_CRTC_DISP_REQ_EN_B(1  26)
+#define R128_CRTC_EXT_CNTL0x0054
+#   define R128_CRTC_VGA_XOVERSCAN(1   0)
+#   define R128_VGA_ATI_LINEAR(1   3)
+#   define R128_XCRT_CNT_EN   (1   6)
+#   define R128_CRTC_HSYNC_DIS(1   8)
+#   define R128_CRTC_VSYNC_DIS(1   9)
+#   define R128_CRTC_DISPLAY_DIS  (1  10)
+#   define R128_CRTC_CRT_ON  

CVS commit: src/sys/dev/pci

2011-12-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Dec 28 09:29:04 UTC 2011

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

Log Message:
support anti-aliased fonts in 8 bit r3g3b2 colour


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/r128fb.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/r128fb.c
diff -u src/sys/dev/pci/r128fb.c:1.22 src/sys/dev/pci/r128fb.c:1.23
--- src/sys/dev/pci/r128fb.c:1.22	Wed Jun 29 03:14:36 2011
+++ src/sys/dev/pci/r128fb.c	Wed Dec 28 09:29:03 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: r128fb.c,v 1.22 2011/06/29 03:14:36 macallan Exp $	*/
+/*	$NetBSD: r128fb.c,v 1.23 2011/12/28 09:29:03 macallan Exp $	*/
 
 /*
  * Copyright (c) 2007 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: r128fb.c,v 1.22 2011/06/29 03:14:36 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: r128fb.c,v 1.23 2011/12/28 09:29:03 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -274,14 +274,26 @@ r128fb_attach(device_t parent, device_t 
 	ri = sc-sc_console_screen.scr_ri;
 
 	j = 0;
-	for (i = 0; i  (1  sc-sc_depth); i++) {
-
-		sc-sc_cmap_red[i] = rasops_cmap[j];
-		sc-sc_cmap_green[i] = rasops_cmap[j + 1];
-		sc-sc_cmap_blue[i] = rasops_cmap[j + 2];
-		r128fb_putpalreg(sc, i, rasops_cmap[j], rasops_cmap[j + 1],
-		rasops_cmap[j + 2]);
-		j += 3;
+	if (sc-sc_depth == 8) {
+		/* generate an r3g3b2 colour map */
+		for (i = 0; i  256; i++) {
+			sc-sc_cmap_red[i] = i  0xe0;
+			sc-sc_cmap_green[i] = (i  0x1c)  3;
+			sc-sc_cmap_blue[i] = (i  0x03)  6;
+			r128fb_putpalreg(sc, i, sc-sc_cmap_red[i],
+   sc-sc_cmap_green[i],
+   sc-sc_cmap_blue[i]);
+		}
+	} else {
+		/* steal rasops' ANSI cmap */
+		for (i = 0; i  256; i++) {
+			sc-sc_cmap_red[i] = rasops_cmap[j];
+			sc-sc_cmap_green[i] = rasops_cmap[j + 1];
+			sc-sc_cmap_blue[i] = rasops_cmap[j + 2];
+			r128fb_putpalreg(sc, i, rasops_cmap[j], rasops_cmap[j + 1],
+			rasops_cmap[j + 2]);
+			j += 3;
+		}
 	}
 
 	if (is_console) {
@@ -504,6 +516,8 @@ r128fb_init_screen(void *cookie, struct 
 	ri-ri_height = sc-sc_height;
 	ri-ri_stride = sc-sc_stride;
 	ri-ri_flg = RI_CENTER;
+	if (sc-sc_depth == 8)
+		ri-ri_flg |= RI_8BIT_IS_RGB | RI_ENABLE_ALPHA;
 
 	rasops_init(ri, sc-sc_height / 8, sc-sc_width / 8);
 	ri-ri_caps = WSSCREEN_WSCOLORS;
@@ -779,72 +793,77 @@ r128fb_putchar(void *cookie, int row, in
 	struct wsdisplay_font *font = PICK_FONT(ri, c);
 	struct vcons_screen *scr = ri-ri_hw;
 	struct r128fb_softc *sc = scr-scr_cookie;
+	void *data;
+	uint32_t fg, bg;
+	int uc, i;
+	int x, y, wi, he, offset;
 
-	if (sc-sc_mode == WSDISPLAYIO_MODE_EMUL) {
-		void *data;
-		uint32_t fg, bg;
-		int uc, i;
-		int x, y, wi, he, offset;
+	if (sc-sc_mode != WSDISPLAYIO_MODE_EMUL) 
+		return;
 
-		wi = font-fontwidth;
-		he = font-fontheight;
+	if (!CHAR_IN_FONT(c, font))
+		return;
 
-		if (!CHAR_IN_FONT(c, font))
-			return;
-		bg = ri-ri_devcmap[(attr  16)  0xf];
-		fg = ri-ri_devcmap[(attr  24)  0xf];
-		x = ri-ri_xorigin + col * wi;
-		y = ri-ri_yorigin + row * he;
-		if (c == 0x20) {
-			r128fb_rectfill(sc, x, y, wi, he, bg);
-		} else {
-			uc = c - font-firstchar;
-			data = (uint8_t *)font-data + uc * ri-ri_fontscale;
-
-			r128fb_wait(sc, 8);
-
-			bus_space_write_4(sc-sc_memt, sc-sc_regh, 
-			R128_DP_GUI_MASTER_CNTL,
-			R128_GMC_BRUSH_SOLID_COLOR |
-			R128_GMC_SRC_DATATYPE_MONO_FG_BG |
-			R128_ROP3_S |
-			R128_DP_SRC_SOURCE_HOST_DATA |
-			R128_GMC_DST_CLIPPING |
-			sc-sc_master_cntl);
-
-			bus_space_write_4(sc-sc_memt, sc-sc_regh, 
-			R128_DP_CNTL, 
-			R128_DST_Y_TOP_TO_BOTTOM | 
-			R128_DST_X_LEFT_TO_RIGHT);
-
-			bus_space_write_4(sc-sc_memt, sc-sc_regh, 
-			R128_DP_SRC_FRGD_CLR, fg);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh, 
-			R128_DP_SRC_BKGD_CLR, bg);
-
-			/*
-			 * The Rage 128 doesn't have anything to skip pixels
-			 * when colour expanding but all coordinates
-			 * are signed so we just clip the leading bytes and 
-			 * trailing bits away
-			 */
-			bus_space_write_4(sc-sc_memt, sc-sc_regh, 
-			R128_SC_RIGHT, x + wi - 1);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh, 
-			R128_SC_LEFT, x);
-
-			/* needed? */
-			bus_space_write_4(sc-sc_memt, sc-sc_regh, 
-			R128_SRC_X_Y, 0);
-
-			offset = 32 - (ri-ri_font-stride  3);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh, 
-			R128_DST_X_Y, ((x - offset)  16) | y);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh, 
-			R128_DST_WIDTH_HEIGHT, (32  16) | he);
+	wi = font-fontwidth;
+	he = font-fontheight;
+
+	bg = ri-ri_devcmap[(attr  16)  0xf];
+	fg = ri-ri_devcmap[(attr  24)  0xf];
+	x = ri-ri_xorigin + col * wi;
+	y = ri-ri_yorigin + row * he;
+	if (c == 0x20) {
+		r128fb_rectfill(sc, x, y, wi, he, bg);
+		return;
+	}
+
+	uc = c - font-firstchar;
+	data = (uint8_t *)font-data + uc * ri-ri_fontscale;
+	

CVS commit: [yamt-pagecache] src/sys/uvm

2011-12-28 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Wed Dec 28 13:20:20 UTC 2011

Modified Files:
src/sys/uvm [yamt-pagecache]: uvm_loan.c

Log Message:
missing include sys/atomic.h


To generate a diff of this commit:
cvs rdiff -u -r1.81.2.5 -r1.81.2.6 src/sys/uvm/uvm_loan.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_loan.c
diff -u src/sys/uvm/uvm_loan.c:1.81.2.5 src/sys/uvm/uvm_loan.c:1.81.2.6
--- src/sys/uvm/uvm_loan.c:1.81.2.5	Mon Dec 26 16:03:11 2011
+++ src/sys/uvm/uvm_loan.c	Wed Dec 28 13:20:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_loan.c,v 1.81.2.5 2011/12/26 16:03:11 yamt Exp $	*/
+/*	$NetBSD: uvm_loan.c,v 1.81.2.6 2011/12/28 13:20:19 yamt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,11 +32,12 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_loan.c,v 1.81.2.5 2011/12/26 16:03:11 yamt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_loan.c,v 1.81.2.6 2011/12/28 13:20:19 yamt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/kernel.h
+#include sys/atomic.h
 #include sys/mman.h
 
 #include uvm/uvm.h



CVS commit: [yamt-pagecache] src/sys/uvm

2011-12-28 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Wed Dec 28 13:21:28 UTC 2011

Modified Files:
src/sys/uvm [yamt-pagecache]: uvm_loan.c

Log Message:
O-A loan fix


To generate a diff of this commit:
cvs rdiff -u -r1.81.2.6 -r1.81.2.7 src/sys/uvm/uvm_loan.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_loan.c
diff -u src/sys/uvm/uvm_loan.c:1.81.2.6 src/sys/uvm/uvm_loan.c:1.81.2.7
--- src/sys/uvm/uvm_loan.c:1.81.2.6	Wed Dec 28 13:20:19 2011
+++ src/sys/uvm/uvm_loan.c	Wed Dec 28 13:21:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_loan.c,v 1.81.2.6 2011/12/28 13:20:19 yamt Exp $	*/
+/*	$NetBSD: uvm_loan.c,v 1.81.2.7 2011/12/28 13:21:27 yamt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_loan.c,v 1.81.2.6 2011/12/28 13:20:19 yamt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_loan.c,v 1.81.2.7 2011/12/28 13:21:27 yamt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -431,10 +431,6 @@ uvm_loananon(struct uvm_faultinfo *ufi, 
 	**output = pg;
 	(*output)++;
 
-	/* unlock and return success */
-	if (pg-uobject != NULL)
-		mutex_exit(pg-uobject-vmobjlock);
-
 	ucpu = uvm_cpu_get();
 	if (pg-uobject != NULL) {
 		ucpu-loan_oa++;



CVS commit: [yamt-pagecache] src/sys/uvm

2011-12-28 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Wed Dec 28 13:22:47 UTC 2011

Modified Files:
src/sys/uvm [yamt-pagecache]: uvm_fault.c

Log Message:
- assertions
- __unused


To generate a diff of this commit:
cvs rdiff -u -r1.190.2.3 -r1.190.2.4 src/sys/uvm/uvm_fault.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_fault.c
diff -u src/sys/uvm/uvm_fault.c:1.190.2.3 src/sys/uvm/uvm_fault.c:1.190.2.4
--- src/sys/uvm/uvm_fault.c:1.190.2.3	Mon Dec 26 16:03:10 2011
+++ src/sys/uvm/uvm_fault.c	Wed Dec 28 13:22:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_fault.c,v 1.190.2.3 2011/12/26 16:03:10 yamt Exp $	*/
+/*	$NetBSD: uvm_fault.c,v 1.190.2.4 2011/12/28 13:22:47 yamt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_fault.c,v 1.190.2.3 2011/12/26 16:03:10 yamt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_fault.c,v 1.190.2.4 2011/12/28 13:22:47 yamt Exp $);
 
 #include opt_uvmhist.h
 
@@ -276,6 +276,7 @@ uvmfault_anonget(struct uvm_faultinfo *u
 	UVMHIST_FUNC(uvmfault_anonget); UVMHIST_CALLED(maphist);
 	KASSERT(mutex_owned(anon-an_lock));
 	KASSERT(anon-an_lock == amap-am_lock);
+	KASSERT(amap-am_obj_lock == NULL || mutex_owned(amap-am_obj_lock));
 
 	/* Increment the counters.*/
 	uvmexp.fltanget++;
@@ -297,6 +298,9 @@ uvmfault_anonget(struct uvm_faultinfo *u
 		 */
 		we_own = false;
 		pg = anon-an_page;
+		KASSERT(pg == NULL || pg-uanon == anon);
+		KASSERT(pg == NULL || pg-uobject == NULL ||
+		pg-uobject-vmobjlock == amap-am_obj_lock);
 
 		/*
 		 * If there is a resident page and it is loaned, then anon
@@ -1374,7 +1378,8 @@ uvm_fault_upper_loan(
 
 		/* 1 case is already ok */
 		if (anon-an_ref == 1) {
-			struct uvm_object *uobj = anon-an_page-uobject;
+			struct uvm_object * const uobj __unused =
+			anon-an_page-uobject;
 
 			KASSERT(uobj == NULL ||
 			uobj-vmobjlock == amap-am_obj_lock);



CVS commit: [yamt-pagecache] src/sys/uvm

2011-12-28 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Wed Dec 28 13:24:19 UTC 2011

Modified Files:
src/sys/uvm [yamt-pagecache]: uvm_loan.c

Log Message:
uvm_loanobj_read: try to avoid creating VAC aliases if PMAP_PREFER is available


To generate a diff of this commit:
cvs rdiff -u -r1.81.2.7 -r1.81.2.8 src/sys/uvm/uvm_loan.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_loan.c
diff -u src/sys/uvm/uvm_loan.c:1.81.2.7 src/sys/uvm/uvm_loan.c:1.81.2.8
--- src/sys/uvm/uvm_loan.c:1.81.2.7	Wed Dec 28 13:21:27 2011
+++ src/sys/uvm/uvm_loan.c	Wed Dec 28 13:24:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_loan.c,v 1.81.2.7 2011/12/28 13:21:27 yamt Exp $	*/
+/*	$NetBSD: uvm_loan.c,v 1.81.2.8 2011/12/28 13:24:19 yamt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_loan.c,v 1.81.2.7 2011/12/28 13:21:27 yamt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_loan.c,v 1.81.2.8 2011/12/28 13:24:19 yamt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1394,6 +1394,23 @@ uvm_loanobj_read(struct vm_map *map, vad
 	if (npages  MAXPAGES) {
 		return EINVAL;
 	}
+#if defined(PMAP_PREFER)
+	/*
+	 * avoid creating VAC aliases.
+	 */
+	{
+		const vaddr_t origva = va;
+
+		PMAP_PREFER(off, va, len, 0);
+		if (va != origva) {
+			/*
+			 * pmap's suggestion was different from the requested
+			 * address.  punt.
+			 */
+			return EINVAL;
+		}
+	}
+#endif /* defined(PMAP_PREFER) */
 retry:
 	vm_map_lock_read(map);
 	if (!uvm_map_lookup_entry(map, va, entry)) {



CVS commit: [yamt-pagecache] src/usr.bin/vmstat

2011-12-28 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Wed Dec 28 13:28:03 UTC 2011

Modified Files:
src/usr.bin/vmstat [yamt-pagecache]: vmstat.c

Log Message:
page loaning related statistics

6 O-K loan
   433958 O-K unloan
0 O-K loan resolved on write to O
0 O-K loan resolved on free of O
  1562110 A-K loan
  1450785 A-K unloan
   108147 A-K loan resolved on write to A
 3178 A-K loan resolved on free of A
   506926 O-A-K loan
72974 O-A-K unloan
0 O-K loan (zero)
0 O-K unloan (zero)
0 O-A-K loan turned into A-K loan due to write to O
0 O-A-K loan turned into A-K loan due to free of O
   50 O-A-K loan turned into O-K loan due to write to A
   435568 O-A-K loan turned into O-K loan due to free of A
22761 O-A loan resolved on write to O
  602 O-A loan resolved on free of O
  1015322 O-A loan resolved on write to A
 11431602 O-A loan resolved on free of A
23363 O-A loaned page taken over by anon
 12470316 O-A loan for read(2)


To generate a diff of this commit:
cvs rdiff -u -r1.186.2.2 -r1.186.2.3 src/usr.bin/vmstat/vmstat.c

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

Modified files:

Index: src/usr.bin/vmstat/vmstat.c
diff -u src/usr.bin/vmstat/vmstat.c:1.186.2.2 src/usr.bin/vmstat/vmstat.c:1.186.2.3
--- src/usr.bin/vmstat/vmstat.c:1.186.2.2	Mon Nov 14 14:27:53 2011
+++ src/usr.bin/vmstat/vmstat.c	Wed Dec 28 13:28:03 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.186.2.2 2011/11/14 14:27:53 yamt Exp $ */
+/* $NetBSD: vmstat.c,v 1.186.2.3 2011/12/28 13:28:03 yamt Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@ __COPYRIGHT(@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = @(#)vmstat.c	8.2 (Berkeley) 3/1/95;
 #else
-__RCSID($NetBSD: vmstat.c,v 1.186.2.2 2011/11/14 14:27:53 yamt Exp $);
+__RCSID($NetBSD: vmstat.c,v 1.186.2.3 2011/12/28 13:28:03 yamt Exp $);
 #endif
 #endif /* not lint */
 
@@ -892,6 +892,7 @@ dosum(void)
 	if (active_kernel) {
 		(void)printf(%9 PRIu64  pages active\n, uvmexp2.active);
 		(void)printf(%9 PRIu64  pages inactive\n, uvmexp2.inactive);
+
 		(void)printf(%9 PRIu64  file pages known clean\n,
 		uvmexp2.cleanpages);
 		(void)printf(%9 PRIu64  file pages possibly dirty\n,
@@ -904,6 +905,56 @@ dosum(void)
 		uvmexp2.possiblydirtyanonpages);
 		(void)printf(%9 PRIu64  anonymous pages known dirty\n,
 		uvmexp2.dirtyanonpages);
+
+		(void)printf(%9 PRIu64  O-K loan\n,
+		uvmexp2.loan_obj);
+		(void)printf(%9 PRIu64  O-K unloan\n,
+		uvmexp2.unloan_obj);
+		(void)printf(%9 PRIu64  O-K loan resolved on write to O\n,
+		uvmexp2.loanbreak_obj);
+		(void)printf(%9 PRIu64  O-K loan resolved on free of O\n,
+		uvmexp2.loanfree_obj);
+
+		(void)printf(%9 PRIu64  A-K loan\n,
+		uvmexp2.loan_anon);
+		(void)printf(%9 PRIu64  A-K unloan\n,
+		uvmexp2.unloan_anon);
+		(void)printf(%9 PRIu64  A-K loan resolved on write to A\n,
+		uvmexp2.loanbreak_anon);
+		(void)printf(%9 PRIu64  A-K loan resolved on free of A\n,
+		uvmexp2.loanfree_anon);
+
+		(void)printf(%9 PRIu64  O-A-K loan\n,
+		uvmexp2.loan_oa);
+		(void)printf(%9 PRIu64  O-A-K unloan\n,
+		uvmexp2.unloan_oa);
+
+		(void)printf(%9 PRIu64  O-K loan (zero)\n,
+		uvmexp2.loan_zero);
+		(void)printf(%9 PRIu64  O-K unloan (zero)\n,
+		uvmexp2.unloan_zero);
+
+		(void)printf(%9 PRIu64  O-A-K loan turned into A-K loan due to write to O\n,
+		uvmexp2.loanbreak_orphaned);
+		(void)printf(%9 PRIu64  O-A-K loan turned into A-K loan due to free of O\n,
+		uvmexp2.loanfree_orphaned);
+		(void)printf(%9 PRIu64  O-A-K loan turned into O-K loan due to write to A\n,
+		uvmexp2.loanbreak_orphaned_anon);
+		(void)printf(%9 PRIu64  O-A-K loan turned into O-K loan due to free of A\n,
+		uvmexp2.loanfree_orphaned_anon);
+
+		(void)printf(%9 PRIu64  O-A loan resolved on write to O\n,
+		uvmexp2.loanbreak_oa_obj);
+		(void)printf(%9 PRIu64  O-A loan resolved on free of O\n,
+		uvmexp2.loanfree_oa_obj);
+		(void)printf(%9 PRIu64  O-A loan resolved on write to A\n,
+		uvmexp2.loanbreak_oa_anon);
+		(void)printf(%9 PRIu64  O-A loan resolved on free of A\n,
+		uvmexp2.loanfree_oa_anon);
+		(void)printf(%9 PRIu64  O-A loaned page taken over by anon\n,
+		uvmexp2.loan_resolve_orphan);
+		(void)printf(%9 PRIu64  O-A loan for read(2)\n,
+		uvmexp2.loan_obj_read);
 	}
 	(void)printf(%9u pages paging\n, uvmexp.paging);
 	(void)printf(%9u pages wired\n, uvmexp.wired);



CVS commit: src/lib/libpam

2011-12-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 28 14:52:57 UTC 2011

Modified Files:
src/lib/libpam/libpam: pam_debug_log.c
src/lib/libpam/libpam/security: pam_mod_misc.h
src/lib/libpam/modules/pam_login_access: pam_login_access.c

Log Message:
- reverse the order of printf formatting to make it easier for compilers to
  check printf arguments
- add compiler checking for printf formats and fix broken ones.
From joerg@


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libpam/libpam/pam_debug_log.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libpam/libpam/security/pam_mod_misc.h
cvs rdiff -u -r1.3 -r1.4 \
src/lib/libpam/modules/pam_login_access/pam_login_access.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/libpam/libpam/pam_debug_log.c
diff -u src/lib/libpam/libpam/pam_debug_log.c:1.3 src/lib/libpam/libpam/pam_debug_log.c:1.4
--- src/lib/libpam/libpam/pam_debug_log.c:1.3	Fri Mar  9 18:44:50 2007
+++ src/lib/libpam/libpam/pam_debug_log.c	Wed Dec 28 09:52:56 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pam_debug_log.c,v 1.3 2007/03/09 23:44:50 hubertf Exp $	*/
+/*	$NetBSD: pam_debug_log.c,v 1.4 2011/12/28 14:52:56 christos Exp $	*/
 
 /*-
  * Copyright 2001 Mark R V Murray
@@ -30,7 +30,7 @@
 #ifdef __FreeBSD__
 __FBSDID($FreeBSD: src/lib/libpam/libpam/pam_debug_log.c,v 1.8 2002/04/14 16:44:04 des Exp $);
 #else
-__RCSID($NetBSD: pam_debug_log.c,v 1.3 2007/03/09 23:44:50 hubertf Exp $);
+__RCSID($NetBSD: pam_debug_log.c,v 1.4 2011/12/28 14:52:56 christos Exp $);
 #endif
 
 #include stdarg.h
@@ -50,22 +50,24 @@ _pam_verbose_error(pam_handle_t *pamh, i
 const char *file, const char *function, const char *format, ...)
 {
 	va_list ap;
-	char *fmtbuf;
+	char *msg;
+	int rv;
 	const char *modname, *period;
 
-	if (!(flags  PAM_SILENT)  !openpam_get_option(pamh, no_warn)) {
-		modname = strrchr(file, '/');
-		if (modname == NULL)
-			modname = file;
-		period = strchr(modname, '.');
-		if (period == NULL)
-			period = strchr(modname, '\0');
-		va_start(ap, format);
-		asprintf(fmtbuf, %.*s: %s: %s\n,
-		(int)(ssize_t)(period - modname), modname, function,
-		format);
-		pam_verror(pamh, fmtbuf, ap);
-		free(fmtbuf);
-		va_end(ap);
-	}
+	if ((flags  PAM_SILENT) || openpam_get_option(pamh, no_warn))
+		return;
+	modname = strrchr(file, '/');
+	if (modname == NULL)
+		modname = file;
+	period = strchr(modname, '.');
+	if (period == NULL)
+		period = strchr(modname, '\0');
+	va_start(ap, format);
+	rv = vasprintf(msg, format, ap);
+	va_end(ap);
+	if (rv  0)
+		return;
+	pam_error(pamh, %.*s: %s: %s\n, (int)(ssize_t)(period - modname),
+	modname, function, msg);
+	free(msg);
 }

Index: src/lib/libpam/libpam/security/pam_mod_misc.h
diff -u src/lib/libpam/libpam/security/pam_mod_misc.h:1.3 src/lib/libpam/libpam/security/pam_mod_misc.h:1.4
--- src/lib/libpam/libpam/security/pam_mod_misc.h:1.3	Sun Dec 12 03:30:26 2004
+++ src/lib/libpam/libpam/security/pam_mod_misc.h	Wed Dec 28 09:52:56 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pam_mod_misc.h,v 1.3 2004/12/12 08:30:26 christos Exp $	*/
+/*	$NetBSD: pam_mod_misc.h,v 1.4 2011/12/28 14:52:56 christos Exp $	*/
 
 /*-
  * Copyright 1998 Juniper Networks, Inc.
@@ -43,7 +43,7 @@
 
 __BEGIN_DECLS
 void	_pam_verbose_error(pam_handle_t *, int, const char *,
-		const char *, const char *, ...);
+		const char *, const char *, ...) __printflike(5, 6);
 __END_DECLS
 
 #define	PAM_LOG(...) \

Index: src/lib/libpam/modules/pam_login_access/pam_login_access.c
diff -u src/lib/libpam/modules/pam_login_access/pam_login_access.c:1.3 src/lib/libpam/modules/pam_login_access/pam_login_access.c:1.4
--- src/lib/libpam/modules/pam_login_access/pam_login_access.c:1.3	Fri Nov  3 13:03:23 2006
+++ src/lib/libpam/modules/pam_login_access/pam_login_access.c	Wed Dec 28 09:52:56 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pam_login_access.c,v 1.3 2006/11/03 18:03:23 christos Exp $	*/
+/*	$NetBSD: pam_login_access.c,v 1.4 2011/12/28 14:52:56 christos Exp $	*/
 
 /*-
  * Copyright (c) 2001 Mark R V Murray
@@ -40,7 +40,7 @@
 #ifdef __FreeBSD__
 __FBSDID($FreeBSD: src/lib/libpam/modules/pam_login_access/pam_login_access.c,v 1.11 2004/02/10 10:13:21 des Exp $);
 #else
-__RCSID($NetBSD: pam_login_access.c,v 1.3 2006/11/03 18:03:23 christos Exp $);
+__RCSID($NetBSD: pam_login_access.c,v 1.4 2011/12/28 14:52:56 christos Exp $);
 #endif
 
 #define _BSD_SOURCE
@@ -90,14 +90,14 @@ pam_sm_acct_mgmt(pam_handle_t *pamh, int
 		if (login_access(user, tty) != 0)
 			return (PAM_SUCCESS);
 		PAM_VERBOSE_ERROR(%s is not allowed to log in on %s,
-		user, tty);
+		(const char *)user, (const char *)tty);
 	} else {
 		PAM_LOG(Checking login.access for user %s from host %s,
 		(const char *)user, (const char *)rhost);
 		if (login_access(user, rhost) != 0)
 			return (PAM_SUCCESS);
 		PAM_VERBOSE_ERROR(%s is not allowed to log in from %s,
-		user, rhost);
+		(const 

CVS commit: src/external/bsd/openpam/dist/lib

2011-12-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 28 14:53:38 UTC 2011

Modified Files:
src/external/bsd/openpam/dist/lib: openpam_log.c

Log Message:
Reverse the order of printf formatting to make it easier for compilers to
check printf arguments.
From joerg@


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/openpam/dist/lib/openpam_log.c

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

Modified files:

Index: src/external/bsd/openpam/dist/lib/openpam_log.c
diff -u src/external/bsd/openpam/dist/lib/openpam_log.c:1.2 src/external/bsd/openpam/dist/lib/openpam_log.c:1.3
--- src/external/bsd/openpam/dist/lib/openpam_log.c:1.2	Sun Dec 25 17:27:55 2011
+++ src/external/bsd/openpam/dist/lib/openpam_log.c	Wed Dec 28 09:53:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: openpam_log.c,v 1.2 2011/12/25 22:27:55 christos Exp $	*/
+/*	$NetBSD: openpam_log.c,v 1.3 2011/12/28 14:53:38 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002-2003 Networks Associates Technology, Inc.
@@ -100,8 +100,8 @@ void
 _openpam_log(int level, const char *func, const char *fmt, ...)
 {
 	va_list ap;
-	char *format;
-	int priority;
+	char *msg;
+	int priority, rv;
 
 	switch (level) {
 	case PAM_LOG_DEBUG:
@@ -120,14 +120,18 @@ _openpam_log(int level, const char *func
 		priority = LOG_ERR;
 		break;
 	}
+
 	va_start(ap, fmt);
-	if (asprintf(format, in %s(): %s, func, fmt)  0) {
-		vsyslog(priority, format, ap);
-		FREE(format);
-	} else {
-		vsyslog(priority, fmt, ap);
-	}
+	rv = vasprintf(msg, fmt, ap);
 	va_end(ap);
+
+	if (rv  0) {
+		syslog(priority, Can't format message from %s: %s (%m),
+		func, fmt);
+		return;
+	}
+	syslog(priority, in %s(): %s, func, msg);
+	FREE(msg);
 }
 
 #endif



CVS commit: xsrc/local/programs/ttf2wsfont

2011-12-28 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Wed Dec 28 16:53:30 UTC 2011

Added Files:
xsrc/local/programs/ttf2wsfont: Makefile main.c

Log Message:
tool to generate anti-aliased fonts for wscons from TTF files


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 xsrc/local/programs/ttf2wsfont/Makefile \
xsrc/local/programs/ttf2wsfont/main.c

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

Added files:

Index: xsrc/local/programs/ttf2wsfont/Makefile
diff -u /dev/null xsrc/local/programs/ttf2wsfont/Makefile:1.1
--- /dev/null	Wed Dec 28 16:53:30 2011
+++ xsrc/local/programs/ttf2wsfont/Makefile	Wed Dec 28 16:53:30 2011
@@ -0,0 +1,14 @@
+#	$NetBSD: Makefile,v 1.1 2011/12/28 16:53:30 macallan Exp $
+#	@(#)Makefile	8.1 (Berkeley) 5/31/93
+
+PROG=	ttf2wsfont
+
+SRCS=	main.c
+WARNS=	3
+
+CPPFLAGS+=	-DXFREE86_FT2 -I${DESTDIR}${X11INCDIR}/freetype2
+
+LDADD+=	-lfreetype
+
+.include bsd.x11.mk
+.include bsd.prog.mk
Index: xsrc/local/programs/ttf2wsfont/main.c
diff -u /dev/null xsrc/local/programs/ttf2wsfont/main.c:1.1
--- /dev/null	Wed Dec 28 16:53:30 2011
+++ xsrc/local/programs/ttf2wsfont/main.c	Wed Dec 28 16:53:30 2011
@@ -0,0 +1,159 @@
+#include stdio.h
+#include ctype.h
+
+#include ft2build.h
+#include FT_FREETYPE_H
+
+char cvr[] =  .-+oaOX;
+FT_Library library;
+FT_Face face;
+int baseline, above = 0, below = 0, advance = 0;
+
+int push_size(int);
+
+int
+push_size(int letter)
+{
+	int glyph_index, error;
+	int new_above, new_below, new_advance;
+
+	glyph_index = FT_Get_Char_Index(face, letter);
+	printf(idx: %d\n, glyph_index);
+	error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
+	if (error) {
+		printf(wtf?!\n);
+		return -1;
+	}
+	FT_Render_Glyph(face-glyph, FT_RENDER_MODE_NORMAL);
+	printf(%d x %d\n, face-glyph-bitmap.width, face-glyph-bitmap.rows);
+	printf(offset: %d %d\n, face-glyph-bitmap_left, face-glyph-bitmap_top);
+	new_advance = (int)(face-glyph-advance.x  6);
+	printf(advance: %d\n, new_advance);
+	new_above = face-glyph-bitmap_top;
+	new_below = face-glyph-bitmap.rows - face-glyph-bitmap_top;
+	if (new_above  above) above = new_above;
+	if (new_below  below) below = new_below;
+	if (new_advance  advance) advance = new_advance;
+	return 0;
+}
+
+int
+main(int argc, char *argv[])
+{
+	int error, glyph_index;
+	int x, y, idx, width_in_bytes, height = 22, cell_height;
+	int width, datalen, didx, i, start, end;
+	FILE *output;
+	uint8_t *fontdata;
+	char fontname[128], filename[128];
+
+	if (argc != 3) {
+		printf(usage: ttf2wsfont some_font.ttf height\n);
+		return 0;
+	}
+
+	sscanf(argv[2], %d, height);
+
+	error = FT_Init_FreeType( library );
+	if (error) {
+		printf(Failed to initialize freefont2\n);
+		return -1;
+	}
+	error = FT_New_Face(library, argv[1], 0, face );
+	if ( error == FT_Err_Unknown_File_Format ) {
+		printf(unsupported font format\n);
+		return -1;
+	} 
+	error = FT_Set_Pixel_Sizes(face, /* handle to face object */
+   0,/* pixel_width */
+   height - (height / 10) ); /* pixel_height */ 
+	if (error) {
+		printf(couldn't set character cell size\n);
+	}
+
+	push_size('W');
+	push_size('g');
+	push_size(192);
+	printf(above: %d below: %d advance: %d\n, above, below, advance);
+	width = advance;
+	baseline = above;
+	cell_height = above + below;
+	datalen = 256 * width * cell_height;
+	fontdata = malloc(datalen);
+
+
+	for (i = 0; i  256; i++) {
+		glyph_index = FT_Get_Char_Index(face, i);
+		FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
+		FT_Render_Glyph(face-glyph, FT_RENDER_MODE_NORMAL);
+		width_in_bytes =  face-glyph-bitmap.width;
+		start = baseline - face-glyph-bitmap_top;
+		end = start + face-glyph-bitmap.rows;
+		if (end  cell_height)
+			end = cell_height;
+		idx = 0;
+		if (start  0) {
+			idx += (0 - start) * width_in_bytes;
+			start = 0;
+		}
+		didx = i * width * cell_height + /* character cell */
+		   start * width + /* pixels above baseline */ 
+		   face-glyph-bitmap_left; /* pixels left from border */
+		memset(fontdata[i * width * cell_height], 0, width * cell_height);
+		for (y = start; y  end; y++) {
+			for (x = 0; x  width_in_bytes; x++) {
+fontdata[didx + x] = face-glyph-bitmap.buffer[idx + x];
+			}
+			idx += width_in_bytes;
+			didx += width;
+		}
+	}
+
+	/* now output as a header file */
+	snprintf(fontname, 128, %s_%dx%d, face-family_name, width, cell_height);
+	for (i = 0; i  strlen(fontname); i++) {
+		if (isblank(fontname[i]))
+			fontname[i]='_';
+	}
+	snprintf(filename, 128, %s.h, fontname);
+	if ((output = fopen(filename, w)) == NULL) {
+		fprintf(stderr, Can't open output file %s\n, filename);
+		return -1;
+	}
+	fprintf(output, static u_char %s_data[];\n, fontname);
+	fprintf(output, \n);
+	fprintf(output, static struct wsdisplay_font %s = {\n, fontname);
+	fprintf(output, \t\%s\,\t\t\t/* typeface name */\n, face-family_name);
+	fprintf(output, \t0,\t\t\t\t/* firstchar */\n);
+	fprintf(output, \t255 - 0 + 

CVS commit: xsrc/local/programs/ttf2wsfont

2011-12-28 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Wed Dec 28 16:55:27 UTC 2011

Modified Files:
xsrc/local/programs/ttf2wsfont: main.c

Log Message:
add 2 clause BSD license


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 xsrc/local/programs/ttf2wsfont/main.c

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

Modified files:

Index: xsrc/local/programs/ttf2wsfont/main.c
diff -u xsrc/local/programs/ttf2wsfont/main.c:1.1 xsrc/local/programs/ttf2wsfont/main.c:1.2
--- xsrc/local/programs/ttf2wsfont/main.c:1.1	Wed Dec 28 16:53:30 2011
+++ xsrc/local/programs/ttf2wsfont/main.c	Wed Dec 28 16:55:27 2011
@@ -1,3 +1,30 @@
+/*	$NetBSD: main.c,v 1.2 2011/12/28 16:55:27 macallan Exp $	*/
+
+/*
+ * Copyright (c) 2011 Michael Lorenz
+ * 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 AUTHOR ``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 AUTHOR 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 stdio.h
 #include ctype.h
 



CVS commit: src

2011-12-28 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Wed Dec 28 17:33:53 UTC 2011

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

Log Message:
Add a FUSE trace facility, with statistics collection. This should help
tracking bugs and performance issues


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libperfuse/debug.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libperfuse/fuse.h
cvs rdiff -u -r1.48 -r1.49 src/lib/libperfuse/ops.c
cvs rdiff -u -r1.23 -r1.24 src/lib/libperfuse/perfuse.c \
src/lib/libperfuse/perfuse_priv.h
cvs rdiff -u -r1.17 -r1.18 src/lib/libperfuse/perfuse_if.h
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/perfused/perfused.8
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/perfused/perfused.c
cvs rdiff -u -r1.5 -r1.6 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.5 src/lib/libperfuse/debug.c:1.6
--- src/lib/libperfuse/debug.c:1.5	Sun Oct  3 05:46:47 2010
+++ src/lib/libperfuse/debug.c	Wed Dec 28 17:33:52 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: debug.c,v 1.5 2010/10/03 05:46:47 manu Exp $ */
+/*  $NetBSD: debug.c,v 1.6 2011/12/28 17:33:52 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -26,9 +26,11 @@
  */ 
 
 #include puffs.h
+#include stdio.h
 #include sys/types.h
 
 #include perfuse_if.h
+#include perfuse_priv.h
 #include fuse.h
 
 struct perfuse_opcode {
@@ -101,3 +103,116 @@ perfuse_opname(opcode)
 
 	return po-opname; /* UNKNOWN */
 }
+
+char *
+perfuse_opdump_in(ps, pm)
+	struct perfuse_state *ps;
+	perfuse_msg_t *pm;
+{
+	struct fuse_in_header *fih;
+	static char buf[BUFSIZ] = ;
+
+	fih = GET_INHDR(ps, pm);
+
+	switch(fih-opcode) {
+	case FUSE_LOOKUP: 
+		(void)snprintf(buf, sizeof(buf), path = \%s\, 
+			   _GET_INPAYLOAD(ps, pm, const char *));
+		break;
+	default:
+		buf[0] = '\0';
+		break;
+	}
+
+	return buf;
+}
+
+void
+perfuse_trace_dump(pu, fp)
+	struct puffs_usermount *pu;
+	FILE *fp;
+{
+	struct perfuse_state *ps;
+	struct perfuse_trace *pt;
+	struct timespec ts_min[FUSE_OPCODE_MAX];
+	struct timespec ts_max[FUSE_OPCODE_MAX];
+	struct timespec ts_total[FUSE_OPCODE_MAX];
+	int count[FUSE_OPCODE_MAX];
+	uint64_t avg;
+	int i;
+
+	if (!(perfuse_diagflags  PDF_TRACE))
+		return;
+
+	ps = puffs_getspecific(pu);
+
+	(void)ftruncate(fileno(fp), 0);
+	(void)fseek(fp, 0, SEEK_SET);
+
+	(void)memset(ts_min, 0, sizeof(ts_min));
+	(void)memset(ts_max, 0, sizeof(ts_max));
+	(void)memset(ts_total, 0, sizeof(ts_total));
+	(void)memset(count, 0, sizeof(count));
+
+	fprintf(fp, Last %PRId64 operations\n, ps-ps_tracecount);
+
+	TAILQ_FOREACH(pt, ps-ps_trace, pt_list) {
+		const char *quote = pt-pt_path[0] != '\0' ? \ : ;
+
+		fprintf(fp, %lu.%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,
+			pt-pt_extra);
+
+		if (pt-pt_status == done) {
+			struct timespec ts;
+
+			ts.tv_sec = 0;	/* delint */
+			ts.tv_nsec = 0;	/* delint */
+			timespecsub(pt-pt_end, pt-pt_start, ts);
+
+			fprintf(fp, error = %d elapsed = %lu.%09lu ,
+pt-pt_error, ts.tv_sec, ts.tv_nsec);
+
+			count[pt-pt_opcode]++;
+			timespecadd(ts_total[pt-pt_opcode],
+ts,
+ts_total[pt-pt_opcode]);
+
+			if (timespeccmp(ts, ts_min[pt-pt_opcode], ) ||
+			(count[pt-pt_opcode] == 1))
+ts_min[pt-pt_opcode] = ts;
+
+			if (timespeccmp(ts, ts_max[pt-pt_opcode], ))
+ts_max[pt-pt_opcode] = ts;
+		} else {
+			fprintf(fp, ongoing );
+		}
+
+		fprintf(fp, \n);
+	}
+
+	fprintf(fp, \nStatistics by operation\n);
+	fprintf(fp, operation\tcount\tmin\tavg\tmax\n);
+	for (i = 0; i  FUSE_OPCODE_MAX; i++) {
+		time_t min;
+
+		if (count[i] != 0) {
+			avg = timespec2ns(ts_total[i]) / count[i];
+			min = ts_min[i].tv_sec;
+		} else {
+			avg = 0;
+			min = 0;
+		}
+			
+		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),
+			ts_max[i].tv_sec, ts_max[i].tv_nsec);
+	}	
+	
+	(void)fflush(fp);
+	return;
+}

Index: src/lib/libperfuse/fuse.h
diff -u src/lib/libperfuse/fuse.h:1.4 src/lib/libperfuse/fuse.h:1.5
--- src/lib/libperfuse/fuse.h:1.4	Tue Jun 28 16:19:16 2011
+++ src/lib/libperfuse/fuse.h	Wed Dec 28 17:33:53 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: fuse.h,v 1.4 2011/06/28 16:19:16 manu Exp $ */
+/*  $NetBSD: fuse.h,v 1.5 2011/12/28 17:33:53 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -169,6 +169,7 @@ enum fuse_opcode {
 	FUSE_DESTROY   = 38,
 	FUSE_IOCTL = 39,
 	FUSE_POLL  = 40,
+	FUSE_OPCODE_MAX,
 
 	FUSE_CUSE_INIT = 4096
 };

Index: src/lib/libperfuse/ops.c
diff -u src/lib/libperfuse/ops.c:1.48 

CVS commit: src/sys/dev/pci/voyager

2011-12-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Dec 28 18:23:01 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
make anti-aliased fonts with odd widths work
The drawing engine needs lines padded to 64bit when doing colour host blits
which is of course not mentioned anywhere in the manual.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/voyager/voyagerfb.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/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.14 src/sys/dev/pci/voyager/voyagerfb.c:1.15
--- src/sys/dev/pci/voyager/voyagerfb.c:1.14	Tue Dec 27 07:05:53 2011
+++ src/sys/dev/pci/voyager/voyagerfb.c	Wed Dec 28 18:23:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.14 2011/12/27 07:05:53 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.15 2011/12/28 18:23:01 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.14 2011/12/27 07:05:53 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.15 2011/12/28 18:23:01 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -838,49 +838,51 @@ voyagerfb_putchar(void *cookie, int row,
 	struct vcons_screen *scr = ri-ri_hw;
 	struct voyagerfb_softc *sc = scr-scr_cookie;
 	uint32_t cmd;
+	int fg, bg, uc;
+	uint8_t *data;
+	int x, y, wi, he;
 
-	if (sc-sc_mode == WSDISPLAYIO_MODE_EMUL) {
-		int fg, bg, uc;
-		uint8_t *data;
-		int x, y, wi, he;
-		wi = font-fontwidth;
-		he = font-fontheight;
-
-		if (!CHAR_IN_FONT(c, font))
-			return;
-		bg = ri-ri_devcmap[(attr  16)  0x0f];
-		fg = ri-ri_devcmap[(attr  24)  0x0f];
-		x = ri-ri_xorigin + col * wi;
-		y = ri-ri_yorigin + row * he;
-		if (c == 0x20) {
-			voyagerfb_rectfill(sc, x, y, wi, he, bg);
-			return;
-		}
-		uc = c - font-firstchar;
-		data = (uint8_t *)font-data + uc * ri-ri_fontscale;
-		if (font-stride  font-fontwidth) {
-			/* this is a mono font */
-			cmd = ROP_COPY |
-			  SM502_CTRL_USE_ROP2 |
-			  SM502_CTRL_CMD_HOSTWRT |
-			  SM502_CTRL_HOSTBLT_MONO |
-			  SM502_CTRL_QUICKSTART_E | 
-			  SM502_CTRL_MONO_PACK_32BIT;
-			voyagerfb_ready(sc);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh,
-			SM502_CONTROL, cmd);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh, 
-			SM502_FOREGROUND, fg);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh, 
-			SM502_BACKGROUND, bg);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh,
-			SM502_SRC, 0);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh,
-			SM502_DST, (x  16) | y);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh,
-			SM502_DIMENSION, (wi  16) | he);
-			/* now feed the data, padded to 32bit */
-			switch (ri-ri_font-stride) {
+	if (sc-sc_mode != WSDISPLAYIO_MODE_EMUL)
+		return;
+		
+	if (!CHAR_IN_FONT(c, font))
+		return;
+
+	wi = font-fontwidth;
+	he = font-fontheight;
+
+	bg = ri-ri_devcmap[(attr  16)  0x0f];
+	fg = ri-ri_devcmap[(attr  24)  0x0f];
+	x = ri-ri_xorigin + col * wi;
+	y = ri-ri_yorigin + row * he;
+	if (c == 0x20) {
+		voyagerfb_rectfill(sc, x, y, wi, he, bg);
+		return;
+	}
+	uc = c - font-firstchar;
+	data = (uint8_t *)font-data + uc * ri-ri_fontscale;
+	if (font-stride  font-fontwidth) {
+		/* this is a mono font */
+		cmd = ROP_COPY |
+		  SM502_CTRL_USE_ROP2 |
+		  SM502_CTRL_CMD_HOSTWRT |
+		  SM502_CTRL_HOSTBLT_MONO |
+		  SM502_CTRL_QUICKSTART_E | 
+		  SM502_CTRL_MONO_PACK_32BIT;
+		voyagerfb_ready(sc);
+		bus_space_write_4(sc-sc_memt, sc-sc_regh,
+		SM502_CONTROL, cmd);
+		bus_space_write_4(sc-sc_memt, sc-sc_regh, 
+		SM502_FOREGROUND, fg);
+		bus_space_write_4(sc-sc_memt, sc-sc_regh, 
+		SM502_BACKGROUND, bg);
+		bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_SRC, 0);
+		bus_space_write_4(sc-sc_memt, sc-sc_regh,
+		SM502_DST, (x  16) | y);
+		bus_space_write_4(sc-sc_memt, sc-sc_regh,
+		SM502_DIMENSION, (wi  16) | he);
+		/* now feed the data, padded to 32bit */
+		switch (ri-ri_font-stride) {
 			case 1:
 voyagerfb_feed8(sc, data, ri-ri_fontscale);
 break;
@@ -889,38 +891,40 @@ voyagerfb_putchar(void *cookie, int row,
 ri-ri_fontscale);
 break;
 			
-			}	
-		} else {
-			/*
-			 * alpha font
-			 * we can't accelerate the actual alpha blending but
-			 * we can at least use a host blit to go through the
-			 * pipeline instead of having to sync the engine
-			 */
-			int i, r, g, b, aval;
-			int rf, gf, bf, rb, gb, bb;
-			uint32_t pixel;
-
-			cmd = ROP_COPY |
-			  SM502_CTRL_USE_ROP2 |
-			  SM502_CTRL_CMD_HOSTWRT |
-			  SM502_CTRL_QUICKSTART_E;
-			voyagerfb_ready(sc);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh,
-			SM502_CONTROL, cmd);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh,
-			SM502_SRC, 0);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh,
-			SM502_DST, (x  16) | y);
-			

CVS commit: src/sys/dev/wsfb

2011-12-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Dec 28 18:37:58 UTC 2011

Modified Files:
src/sys/dev/wsfb: genfb.c

Log Message:
if the cursor row passed in a device property doesn't fit on the screen just
ignore it and clear the screen


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/wsfb/genfb.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/wsfb/genfb.c
diff -u src/sys/dev/wsfb/genfb.c:1.43 src/sys/dev/wsfb/genfb.c:1.44
--- src/sys/dev/wsfb/genfb.c:1.43	Thu Dec 22 04:53:43 2011
+++ src/sys/dev/wsfb/genfb.c	Wed Dec 28 18:37:58 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfb.c,v 1.43 2011/12/22 04:53:43 macallan Exp $ */
+/*	$NetBSD: genfb.c,v 1.44 2011/12/28 18:37:58 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.43 2011/12/22 04:53:43 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.44 2011/12/28 18:37:58 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -267,6 +267,11 @@ genfb_attach(struct genfb_softc *sc, str
 	sc-sc_defaultscreen_descr.nrows = ri-ri_rows;
 	sc-sc_defaultscreen_descr.ncols = ri-ri_cols;
 
+	if (crow = ri-ri_rows) {
+		crow = 0;
+		sc-sc_want_clear = 1;
+	}
+
 	if (console)
 		wsdisplay_cnattach(sc-sc_defaultscreen_descr, ri, 0, crow,
 		defattr);



CVS commit: src/usr.sbin/perfused

2011-12-28 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Dec 28 18:56:39 UTC 2011

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

Log Message:
Improve markup, remove tailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/perfused/perfused.8

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

Modified files:

Index: src/usr.sbin/perfused/perfused.8
diff -u src/usr.sbin/perfused/perfused.8:1.8 src/usr.sbin/perfused/perfused.8:1.9
--- src/usr.sbin/perfused/perfused.8:1.8	Wed Dec 28 17:33:53 2011
+++ src/usr.sbin/perfused/perfused.8	Wed Dec 28 18:56:38 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: perfused.8,v 1.8 2011/12/28 17:33:53 manu Exp $
+.\ $NetBSD: perfused.8,v 1.9 2011/12/28 18:56:38 wiz Exp $
 .\
 .\ Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
 .\
@@ -120,11 +120,12 @@ Enable debug output only when receiving
 .El
 .Sh SIGNALS
 .Bl -tag -width indent
-.It SIGINFO
-If the 
+.It Dv SIGINFO
+If the
 .Fl s
-flag was used, toggle debug output. Do nothing otherwise. 
-.It SIGUSR1
+flag was used, toggle debug output.
+Do nothing otherwise.
+.It Dv SIGUSR1
 Dump FUSE operation trace to
 .Pa /var/run/perfuse.trace .
 .El
@@ -134,14 +135,6 @@ The program logs to the syslog daemon as
 For detailed debugging use the
 .Fl d
 (debug) option.
-.Sh BUGS
-When 
-.Nm
-runs in the foreground (using the
-.Fl f
-flag), some processes using the FUSE filesystem will 
-sometime hang on 
-.Sq uvn_fp2 .
 .Sh SEE ALSO
 .Xr mount 2 ,
 .Xr perfuse_mount 3 ,
@@ -155,6 +148,6 @@ When
 .Nm
 runs in the foreground (using the
 .Fl f
-flag), some processes using the FUSE filesystem will
+flag), some processes using the FUSE file system will
 sometime hang on
 .Sq uvn_fp2 .



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

2011-12-28 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Dec 28 18:59:21 UTC 2011

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

Log Message:
Remove temporary variable definition that is unused in non DIAGNOSTIC builds.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/xen/x86/xen_ipi.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/xen_ipi.c
diff -u src/sys/arch/xen/x86/xen_ipi.c:1.7 src/sys/arch/xen/x86/xen_ipi.c:1.8
--- src/sys/arch/xen/x86/xen_ipi.c:1.7	Wed Dec  7 15:47:43 2011
+++ src/sys/arch/xen/x86/xen_ipi.c	Wed Dec 28 18:59:21 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: xen_ipi.c,v 1.7 2011/12/07 15:47:43 cegger Exp $ */
+/* $NetBSD: xen_ipi.c,v 1.8 2011/12/28 18:59:21 cherry Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -33,10 +33,10 @@
 
 /* 
  * Based on: x86/ipi.c
- * __KERNEL_RCSID(0, $NetBSD: xen_ipi.c,v 1.7 2011/12/07 15:47:43 cegger Exp $); 
+ * __KERNEL_RCSID(0, $NetBSD: xen_ipi.c,v 1.8 2011/12/28 18:59:21 cherry Exp $); 
  */
 
-__KERNEL_RCSID(0, $NetBSD: xen_ipi.c,v 1.7 2011/12/07 15:47:43 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: xen_ipi.c,v 1.8 2011/12/28 18:59:21 cherry Exp $);
 
 #include sys/types.h
 
@@ -304,10 +304,8 @@ xen_ipi_hvcb(struct cpu_info *ci, struct
 {
 	KASSERT(ci != NULL);
 	KASSERT(intrf != NULL);
-
-	volatile struct vcpu_info *vci = ci-ci_vcpu;
-
 	KASSERT(ci == curcpu());
-	KASSERT(!vci-evtchn_upcall_mask);
+	KASSERT(!ci-ci_vcpu-evtchn_upcall_mask);
+
 	hypervisor_force_callback();
 }



CVS commit: src/sys/dev/pci

2011-12-28 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Wed Dec 28 20:28:04 UTC 2011

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

Log Message:
Add VT6410 support, heavily based on a patch by Takahiro Kambe:
  http://mail-index.netbsd.org/port-i386/2007/03/30/.html
The VT6410 is special, because it may exist without a VIA PCI-ISA bridge.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/pci/viaide.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/viaide.c
diff -u src/sys/dev/pci/viaide.c:1.76 src/sys/dev/pci/viaide.c:1.77
--- src/sys/dev/pci/viaide.c:1.76	Sun Jul 10 20:01:37 2011
+++ src/sys/dev/pci/viaide.c	Wed Dec 28 20:28:04 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: viaide.c,v 1.76 2011/07/10 20:01:37 jakllsch Exp $	*/
+/*	$NetBSD: viaide.c,v 1.77 2011/12/28 20:28:04 phx Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: viaide.c,v 1.76 2011/07/10 20:01:37 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: viaide.c,v 1.77 2011/12/28 20:28:04 phx Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -310,6 +310,11 @@ static const struct pciide_product_desc 
 	  NULL,
 	  via_chip_map,
 	},
+	{ PCI_PRODUCT_VIATECH_VT6410_RAID,
+	  0,
+	  NULL,
+	  via_chip_map,
+	},
 	{ PCI_PRODUCT_VIATECH_VT6421_RAID,
 	  0,
 	  VIA Technologies VT6421 Serial ATA RAID Controller,
@@ -451,82 +456,93 @@ via_chip_map(struct pciide_softc *sc, co
 
 	switch (vendor) {
 	case PCI_VENDOR_VIATECH:
-		/*
-		 * get a PCI tag for the ISA bridge.
-		 */
-		if (pci_find_device(pcib_pa, via_pcib_match) == 0)
-			goto unknown;
-		pcib_id = pcib_pa.pa_id;
-		pcib_class = pcib_pa.pa_class;
-		aprint_normal_dev(sc-sc_wdcdev.sc_atac.atac_dev,
-		VIA Technologies );
-		switch (PCI_PRODUCT(pcib_id)) {
-		case PCI_PRODUCT_VIATECH_VT82C586_ISA:
-			aprint_normal(VT82C586 (Apollo VP) );
-			if(PCI_REVISION(pcib_class) = 0x02) {
-aprint_normal(ATA33 controller\n);
-sc-sc_wdcdev.sc_atac.atac_udma_cap = 2;
-			} else {
-aprint_normal(controller\n);
-sc-sc_wdcdev.sc_atac.atac_udma_cap = 0;
-			}
-			break;
-		case PCI_PRODUCT_VIATECH_VT82C596A:
-			aprint_normal(VT82C596A (Apollo Pro) );
-			if (PCI_REVISION(pcib_class) = 0x12) {
-aprint_normal(ATA66 controller\n);
-sc-sc_wdcdev.sc_atac.atac_udma_cap = 4;
-			} else {
-aprint_normal(ATA33 controller\n);
-sc-sc_wdcdev.sc_atac.atac_udma_cap = 2;
-			}
+		switch (PCI_PRODUCT(pa-pa_id)) {
+		case PCI_PRODUCT_VIATECH_VT6410_RAID:
+			aprint_normal_dev(sc-sc_wdcdev.sc_atac.atac_dev,
+			VIA Technologies VT6410 IDE controller\n);
+			sc-sc_wdcdev.sc_atac.atac_udma_cap = 6;
+			interface = PCIIDE_INTERFACE_BUS_MASTER_DMA |
+			PCIIDE_INTERFACE_PCI(0) | PCIIDE_INTERFACE_PCI(1);
 			break;
-		case PCI_PRODUCT_VIATECH_VT82C686A_ISA:
-			aprint_normal(VT82C686A (Apollo KX133) );
-			if (PCI_REVISION(pcib_class) = 0x40) {
-aprint_normal(ATA100 controller\n);
+		default:
+			/*
+			 * get a PCI tag for the ISA bridge.
+			 */
+			if (pci_find_device(pcib_pa, via_pcib_match) == 0)
+goto unknown;
+			pcib_id = pcib_pa.pa_id;
+			pcib_class = pcib_pa.pa_class;
+			aprint_normal_dev(sc-sc_wdcdev.sc_atac.atac_dev,
+			VIA Technologies );
+			switch (PCI_PRODUCT(pcib_id)) {
+			case PCI_PRODUCT_VIATECH_VT82C586_ISA:
+aprint_normal(VT82C586 (Apollo VP) );
+if(PCI_REVISION(pcib_class) = 0x02) {
+	aprint_normal(ATA33 controller\n);
+	sc-sc_wdcdev.sc_atac.atac_udma_cap = 2;
+} else {
+	aprint_normal(controller\n);
+	sc-sc_wdcdev.sc_atac.atac_udma_cap = 0;
+}
+break;
+			case PCI_PRODUCT_VIATECH_VT82C596A:
+aprint_normal(VT82C596A (Apollo Pro) );
+if (PCI_REVISION(pcib_class) = 0x12) {
+	aprint_normal(ATA66 controller\n);
+	sc-sc_wdcdev.sc_atac.atac_udma_cap = 4;
+} else {
+	aprint_normal(ATA33 controller\n);
+	sc-sc_wdcdev.sc_atac.atac_udma_cap = 2;
+}
+break;
+			case PCI_PRODUCT_VIATECH_VT82C686A_ISA:
+aprint_normal(VT82C686A (Apollo KX133) );
+if (PCI_REVISION(pcib_class) = 0x40) {
+	aprint_normal(ATA100 controller\n);
+	sc-sc_wdcdev.sc_atac.atac_udma_cap = 5;
+} else {
+	aprint_normal(ATA66 controller\n);
+	sc-sc_wdcdev.sc_atac.atac_udma_cap = 4;
+}
+break;
+			case PCI_PRODUCT_VIATECH_VT8231:
+aprint_normal(VT8231 ATA100 controller\n);
+sc-sc_wdcdev.sc_atac.atac_udma_cap = 5;
+break;
+			case PCI_PRODUCT_VIATECH_VT8233:
+aprint_normal(VT8233 ATA100 controller\n);
 sc-sc_wdcdev.sc_atac.atac_udma_cap = 5;
-			} else {
-aprint_normal(ATA66 controller\n);
-sc-sc_wdcdev.sc_atac.atac_udma_cap = 4;
+break;
+			case PCI_PRODUCT_VIATECH_VT8233A:
+aprint_normal(VT8233A ATA133 controller\n);
+sc-sc_wdcdev.sc_atac.atac_udma_cap = 6;
+break;
+			case PCI_PRODUCT_VIATECH_VT8235:
+aprint_normal(VT8235 ATA133 

CVS commit: src/sys/arch/sandpoint

2011-12-28 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Wed Dec 28 20:33:20 UTC 2011

Modified Files:
src/sys/arch/sandpoint/conf: GENERIC
src/sys/arch/sandpoint/pci: pci_machdep.c

Log Message:
Add a workaround for the VT6410 IDE controller on the Iomega Storcenter.
Its interrupt cannot be disabled and remains asserted during the whole
device probing procedure, causing an interrupt storm.
This was fixed by establishing an edge-triggered interrupt for it, so it
will trigger only once during probing.
This workaround makes the WDC_NO_IDS option obsolete, which was removed
from the GENERIC config.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/sandpoint/conf/GENERIC
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sandpoint/pci/pci_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/sandpoint/conf/GENERIC
diff -u src/sys/arch/sandpoint/conf/GENERIC:1.63 src/sys/arch/sandpoint/conf/GENERIC:1.64
--- src/sys/arch/sandpoint/conf/GENERIC:1.63	Sun Dec 18 05:49:31 2011
+++ src/sys/arch/sandpoint/conf/GENERIC	Wed Dec 28 20:33:20 2011
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.63 2011/12/18 05:49:31 dholland Exp $
+# $NetBSD: GENERIC,v 1.64 2011/12/28 20:33:20 phx Exp $
 #
 # machine description file for GENERIC NAS
 # 
@@ -22,7 +22,7 @@ include 	arch/sandpoint/conf/std.sandpo
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.63 $
+#ident 		GENERIC-$Revision: 1.64 $
 
 maxusers	32
 
@@ -201,7 +201,6 @@ cmdide* 	at pci? dev ? function ?	# CMD 
 iteide* 	at pci? dev ? function ?	# IT Express IDE controllers
 satalink*	at pci? dev ? function ?	# SiI SATALink controllers
 viaide*		at pci? dev ? function ?	# VIA IDE controllers
-#options 	WDC_NO_IDS			# fix Iomega viaide VT6410
 
 # ATA (IDE) bus support
 atabus* at ata?

Index: src/sys/arch/sandpoint/pci/pci_machdep.c
diff -u src/sys/arch/sandpoint/pci/pci_machdep.c:1.30 src/sys/arch/sandpoint/pci/pci_machdep.c:1.31
--- src/sys/arch/sandpoint/pci/pci_machdep.c:1.30	Sun Nov  6 00:28:12 2011
+++ src/sys/arch/sandpoint/pci/pci_machdep.c	Wed Dec 28 20:33:20 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.30 2011/11/06 00:28:12 phx Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.31 2011/12/28 20:33:20 phx Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -43,7 +43,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_machdep.c,v 1.30 2011/11/06 00:28:12 phx Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_machdep.c,v 1.31 2011/12/28 20:33:20 phx Exp $);
 
 #include opt_pci.h
 
@@ -364,13 +364,16 @@ pci_intr_map(const struct pci_attach_arg
 		break;
 	case BRD_STORCENTER:
 		/* map line 13,14A,14B,14C,15 to EPIC IRQ 1,2,3,4,0 */
-		*ihp =	(line == 15) ? 0 : 1;
-		if (line == 14)
-			*ihp += pin;
+		*ihp =	(line == 15) ? 0 :
+			(line == 13) ? 1 : 1 + pin;
 		break;
 	default:
 		/* simply map line 12-15 to EPIC IRQ0-3 */
 		*ihp = line - 12;
+#if defined(DIAGNOSTIC) || defined(DEBUG)
+		printf(pci_intr_map: line %d, pin %c for unknown board
+		 mapped to irq %d\n, line, pin + '@', *ihp);
+#endif
 		break;
 	}
 #ifdef EPIC_DEBUGIRQ
@@ -391,7 +394,7 @@ pci_intr_string(pci_chipset_tag_t pc, pc
 		panic(pci_intr_string: bogus handle 0x%x, ih);
 
 	sprintf(irqstr, irq %d, ih + I8259_ICU);
-	return (irqstr);
+	return irqstr;
 	
 }
 
@@ -420,11 +423,26 @@ void *
 pci_intr_establish(void *v, pci_intr_handle_t ih, int level,
 int (*func)(void *), void *arg)
 {
+	int type;
+
+	if (brdtype == BRD_STORCENTER  ih == 1) {
+		/*
+		 * XXX This is a workaround for the VT6410 IDE controller!
+		 * Apparently its interrupt cannot be disabled and remains
+		 * asserted during the whole device probing procedure,
+		 * causing an interrupt storm.
+		 * Using an edge-trigger fixes that and triggers the
+		 * interrupt only once during probing.
+		 */
+		 type = IST_EDGE;
+	} else
+		type = IST_LEVEL;
+	
 	/*
 	 * ih is the value assigned in pci_intr_map(), above.
 	 * It's the EPIC IRQ #.
 	 */
-	return intr_establish(ih + I8259_ICU, IST_LEVEL, level, func, arg);
+	return intr_establish(ih + I8259_ICU, type, level, func, arg);
 }
 
 void



CVS commit: src/doc

2011-12-28 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Wed Dec 28 20:40:25 UTC 2011

Modified Files:
src/doc: CHANGES

Log Message:
Note viaide(4) VT6410 and sandpoint Iomega Storcenter support.


To generate a diff of this commit:
cvs rdiff -u -r1.1639 -r1.1640 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.1639 src/doc/CHANGES:1.1640
--- src/doc/CHANGES:1.1639	Sun Dec 25 23:29:35 2011
+++ src/doc/CHANGES	Wed Dec 28 20:40:25 2011
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1639 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1640 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -1189,3 +1189,6 @@ Changes from NetBSD 5.0 to NetBSD 6.0:
 		add ls command support for ext2fs.  From Evgeniy Ivanov.
 		[tsutsui 20111225]
 	openpam: Import lycopsida-20111218 [christos 20111225]
+	viaide(4): VT6410 PATA RAID controller support (without RAID).
+		[phx 20111228]
+	sandpoint: Iomega Storcenter support. [phx 20111228]



CVS commit: src/tests/lib/libcrypt

2011-12-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 28 22:07:40 UTC 2011

Modified Files:
src/tests/lib/libcrypt: t_crypt.c

Log Message:
crypt does not return NULL anymore.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libcrypt/t_crypt.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/lib/libcrypt/t_crypt.c
diff -u src/tests/lib/libcrypt/t_crypt.c:1.2 src/tests/lib/libcrypt/t_crypt.c:1.3
--- src/tests/lib/libcrypt/t_crypt.c:1.2	Mon Dec 26 20:24:27 2011
+++ src/tests/lib/libcrypt/t_crypt.c	Wed Dec 28 17:07:40 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_crypt.c,v 1.2 2011/12/27 01:24:27 christos Exp $ */
+/* $NetBSD: t_crypt.c,v 1.3 2011/12/28 22:07:40 christos Exp $ */
 
 /*
  * This version is derived from the original implementation of FreeSec
@@ -61,7 +61,7 @@
  *	by now.	 The code requires a 32-bit integer type, though.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_crypt.c,v 1.2 2011/12/27 01:24:27 christos Exp $);
+__RCSID($NetBSD: t_crypt.c,v 1.3 2011/12/28 22:07:40 christos Exp $);
 
 #include atf-c.h
 #include stdio.h
@@ -125,9 +125,13 @@ ATF_TC_BODY(crypt_salts, tc)
 {
 	for (size_t i = 0; tests[i].hash; i++) {
 		char *hash = crypt(tests[i].pw, tests[i].hash);
-		if (!hash  strlen(tests[i].hash)  13)
+		if (!hash) {
+			ATF_CHECK_MSG(0, Test %zu NULL\n, i);
+			continue;
+		}
+		if (strcmp(hash, *0) == 0  strlen(tests[i].hash)  13)
 			continue; /* expected failure */
-		if (!hash || strcmp(hash, tests[i].hash))
+		if (strcmp(hash, tests[i].hash))
 			ATF_CHECK_MSG(0, Test %zu %s != %s\n,
 			i, hash, tests[i].hash);
 	}



CVS commit: src/lib/libcrypt

2011-12-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 28 22:15:23 UTC 2011

Modified Files:
src/lib/libcrypt: crypt.3

Log Message:
reflect current reality about return values.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libcrypt/crypt.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/libcrypt/crypt.3
diff -u src/lib/libcrypt/crypt.3:1.20 src/lib/libcrypt/crypt.3:1.21
--- src/lib/libcrypt/crypt.3:1.20	Sun Sep  4 23:37:15 2005
+++ src/lib/libcrypt/crypt.3	Wed Dec 28 17:15:23 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: crypt.3,v 1.20 2005/09/05 03:37:15 hubertf Exp $
+.\	$NetBSD: crypt.3,v 1.21 2011/12/28 22:15:23 christos Exp $
 .\
 .\ Copyright (c) 1989, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\ @(#)crypt.3	8.2 (Berkeley) 12/11/93
 .\
-.Dd September 4, 2005
+.Dd December 28, 2011
 .Dt CRYPT 3
 .Os
 .Sh NAME
@@ -43,8 +43,8 @@
 .Lb libcrypt
 .Sh SYNOPSIS
 .In unistd.h
-.Ft char
-.Fn *crypt const char *key const char *setting
+.Ft char *
+.Fn crypt const char *key const char *setting
 .Ft int
 .Fn encrypt char *block int flag
 .Ft int
@@ -281,7 +281,14 @@ for interpretation.
 .Sh RETURN VALUES
 The function
 .Fn crypt
-returns a pointer to the encrypted value on success and NULL on failure.
+returns a pointer to the encrypted value on success and 
+.Dv *0
+on failure, or
+.Dv *1
+if the
+.Ar setting
+argument was already
+.Dv *0 .
 The functions
 .Fn setkey ,
 .Fn encrypt ,
@@ -352,3 +359,12 @@ a pointer to that object.
 Subsequent calls to
 .Fn crypt
 will modify the same object.
+.Pp
+Before
+.Nx 6
+.Fn crypt
+returned either
+.Dv NULL
+or
+.Dv :
+on error.



CVS commit: src/lib/libcrypt

2011-12-28 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Dec 28 22:41:34 UTC 2011

Modified Files:
src/lib/libcrypt: crypt.3

Log Message:
Remove trailing whitespace. Avoid xr to itself.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libcrypt/crypt.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/libcrypt/crypt.3
diff -u src/lib/libcrypt/crypt.3:1.21 src/lib/libcrypt/crypt.3:1.22
--- src/lib/libcrypt/crypt.3:1.21	Wed Dec 28 22:15:23 2011
+++ src/lib/libcrypt/crypt.3	Wed Dec 28 22:41:34 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: crypt.3,v 1.21 2011/12/28 22:15:23 christos Exp $
+.\	$NetBSD: crypt.3,v 1.22 2011/12/28 22:41:34 wiz Exp $
 .\
 .\ Copyright (c) 1989, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -137,7 +137,7 @@ of the
 followed by the encoded 64-bit encryption.
 .Pp
 For compatibility with historical versions of
-.Xr crypt 3 ,
+.Fn crypt ,
 the
 .Ar setting
 may consist of 2 bytes of salt, encoded as above, in which case an
@@ -281,7 +281,7 @@ for interpretation.
 .Sh RETURN VALUES
 The function
 .Fn crypt
-returns a pointer to the encrypted value on success and 
+returns a pointer to the encrypted value on success and
 .Dv *0
 on failure, or
 .Dv *1



CVS commit: src/lib/libperfuse

2011-12-28 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Dec 29 01:40:32 UTC 2011

Modified Files:
src/lib/libperfuse: debug.c

Log Message:
Cast time_t to intmax_t for printf purposes, and format with %j.  Fixes
build on amd64 and probably i386 as well.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libperfuse/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/lib/libperfuse/debug.c
diff -u src/lib/libperfuse/debug.c:1.6 src/lib/libperfuse/debug.c:1.7
--- src/lib/libperfuse/debug.c:1.6	Wed Dec 28 17:33:52 2011
+++ src/lib/libperfuse/debug.c	Thu Dec 29 01:40:32 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: debug.c,v 1.6 2011/12/28 17:33:52 manu Exp $ */
+/*  $NetBSD: debug.c,v 1.7 2011/12/29 01:40:32 riz Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -159,8 +159,9 @@ perfuse_trace_dump(pu, fp)
 	TAILQ_FOREACH(pt, ps-ps_trace, pt_list) {
 		const char *quote = pt-pt_path[0] != '\0' ? \ : ;
 
-		fprintf(fp, %lu.%09ld %s %s%s%s %s ,  
-			pt-pt_start.tv_sec, pt-pt_start.tv_nsec,
+		fprintf(fp, %ju.%09jd %s %s%s%s %s ,  
+			(intmax_t)pt-pt_start.tv_sec,
+			(intmax_t)pt-pt_start.tv_nsec,
 			perfuse_opname(pt-pt_opcode),
 			quote, pt-pt_path, quote,
 			pt-pt_extra);
@@ -172,8 +173,8 @@ perfuse_trace_dump(pu, fp)
 			ts.tv_nsec = 0;	/* delint */
 			timespecsub(pt-pt_end, pt-pt_start, ts);
 
-			fprintf(fp, error = %d elapsed = %lu.%09lu ,
-pt-pt_error, ts.tv_sec, ts.tv_nsec);
+			fprintf(fp, error = %d elapsed = %ju.%09lu ,
+pt-pt_error, (intmax_t)ts.tv_sec, ts.tv_nsec);
 
 			count[pt-pt_opcode]++;
 			timespecadd(ts_total[pt-pt_opcode],
@@ -206,11 +207,12 @@ perfuse_trace_dump(pu, fp)
 			min = 0;
 		}
 			
-		fprintf(fp, %s\t%d\t%ld.%09ld\t%ld.%09ld\t%ld.%09ld\t\n,
+		fprintf(fp, %s\t%d\t%jd.%09ld\t%jd.%09ld\t%jd.%09ld\t\n,
 			perfuse_opname(i), count[i],
-			min, ts_min[i].tv_nsec,
-			(time_t)(avg / 10L), (long)(avg % 10L),
-			ts_max[i].tv_sec, ts_max[i].tv_nsec);
+			(intmax_t)min, ts_min[i].tv_nsec,
+			(intmax_t)(avg / 10L),
+			(long)(avg % 10L),
+			(intmax_t)ts_max[i].tv_sec, ts_max[i].tv_nsec);
 	}	
 	
 	(void)fflush(fp);



CVS commit: src/lib/libperfuse

2011-12-28 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Dec 29 04:25:49 UTC 2011

Modified Files:
src/lib/libperfuse: debug.c

Log Message:
Redo previous;  remove all the casts I added, and use PRI* macros instead.
(by popular demand - makes sense, too)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libperfuse/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/lib/libperfuse/debug.c
diff -u src/lib/libperfuse/debug.c:1.7 src/lib/libperfuse/debug.c:1.8
--- src/lib/libperfuse/debug.c:1.7	Thu Dec 29 01:40:32 2011
+++ src/lib/libperfuse/debug.c	Thu Dec 29 04:25:49 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: debug.c,v 1.7 2011/12/29 01:40:32 riz Exp $ */
+/*  $NetBSD: debug.c,v 1.8 2011/12/29 04:25:49 riz Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -159,9 +159,8 @@ perfuse_trace_dump(pu, fp)
 	TAILQ_FOREACH(pt, ps-ps_trace, pt_list) {
 		const char *quote = pt-pt_path[0] != '\0' ? \ : ;
 
-		fprintf(fp, %ju.%09jd %s %s%s%s %s ,  
-			(intmax_t)pt-pt_start.tv_sec,
-			(intmax_t)pt-pt_start.tv_nsec,
+		fprintf(fp, % PRIu64 .%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,
 			pt-pt_extra);
@@ -173,8 +172,8 @@ perfuse_trace_dump(pu, fp)
 			ts.tv_nsec = 0;	/* delint */
 			timespecsub(pt-pt_end, pt-pt_start, ts);
 
-			fprintf(fp, error = %d elapsed = %ju.%09lu ,
-pt-pt_error, (intmax_t)ts.tv_sec, ts.tv_nsec);
+			fprintf(fp, error = %d elapsed = % PRIu64 .%09lu ,
+pt-pt_error, ts.tv_sec, ts.tv_nsec);
 
 			count[pt-pt_opcode]++;
 			timespecadd(ts_total[pt-pt_opcode],
@@ -207,12 +206,12 @@ perfuse_trace_dump(pu, fp)
 			min = 0;
 		}
 			
-		fprintf(fp, %s\t%d\t%jd.%09ld\t%jd.%09ld\t%jd.%09ld\t\n,
+		fprintf(fp, %s\t%d\t% PRId64 .%09ld\t% PRId64 
+		.%09ld\t% PRId64 .%09ld\t\n,
 			perfuse_opname(i), count[i],
-			(intmax_t)min, ts_min[i].tv_nsec,
-			(intmax_t)(avg / 10L),
-			(long)(avg % 10L),
-			(intmax_t)ts_max[i].tv_sec, ts_max[i].tv_nsec);
+			min, ts_min[i].tv_nsec,
+			(time_t)(avg / 10L), (long)(avg % 10L),
+			ts_max[i].tv_sec, ts_max[i].tv_nsec);
 	}	
 	
 	(void)fflush(fp);