CVS commit: src/sys/arch/i386/pci
Module Name:src Committed By: mbalmer Date: Sun Nov 13 09:17:56 UTC 2011 Modified Files: src/sys/arch/i386/pci: gscpcib.c Log Message: Pickup NGPIO. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/i386/pci/gscpcib.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/i386/pci/gscpcib.c diff -u src/sys/arch/i386/pci/gscpcib.c:1.17 src/sys/arch/i386/pci/gscpcib.c:1.18 --- src/sys/arch/i386/pci/gscpcib.c:1.17 Sun Sep 4 15:05:26 2011 +++ src/sys/arch/i386/pci/gscpcib.c Sun Nov 13 09:17:56 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: gscpcib.c,v 1.17 2011/09/04 15:05:26 sborrill Exp $ */ +/* $NetBSD: gscpcib.c,v 1.18 2011/11/13 09:17:56 mbalmer Exp $ */ /* $OpenBSD: gscpcib.c,v 1.3 2004/10/05 19:02:33 grange Exp $ */ /* * Copyright (c) 2004 Alexander Yurchenko gra...@openbsd.org @@ -23,7 +23,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: gscpcib.c,v 1.17 2011/09/04 15:05:26 sborrill Exp $); +__KERNEL_RCSID(0, $NetBSD: gscpcib.c,v 1.18 2011/11/13 09:17:56 mbalmer Exp $); #include sys/param.h #include sys/systm.h @@ -42,6 +42,8 @@ __KERNEL_RCSID(0, $NetBSD: gscpcib.c,v #include i386/pci/gscpcibreg.h #include arch/x86/pci/pcibvar.h +#include gpio.h + struct gscpcib_softc { struct pcib_softc sc_pcib;
CVS commit: src/sys/arch/i386/conf
Module Name:src Committed By: mbalmer Date: Sun Nov 13 09:41:47 UTC 2011 Modified Files: src/sys/arch/i386/conf: GENERIC Log Message: Enable nsclpcsio and gpio devices. To generate a diff of this commit: cvs rdiff -u -r1.1055 -r1.1056 src/sys/arch/i386/conf/GENERIC Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/conf/GENERIC diff -u src/sys/arch/i386/conf/GENERIC:1.1055 src/sys/arch/i386/conf/GENERIC:1.1056 --- src/sys/arch/i386/conf/GENERIC:1.1055 Sun Oct 30 12:12:21 2011 +++ src/sys/arch/i386/conf/GENERIC Sun Nov 13 09:41:46 2011 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.1055 2011/10/30 12:12:21 hannken Exp $ +# $NetBSD: GENERIC,v 1.1056 2011/11/13 09:41:46 mbalmer Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include arch/i386/conf/std.i386 options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident GENERIC-$Revision: 1.1055 $ +#ident GENERIC-$Revision: 1.1056 $ maxusers 64 # estimated number of users @@ -679,7 +679,7 @@ iic* at piixpm? # SMBus on PIIX4 #smscmon* at iic? addr 0x2d # (alternate address) # PC87366 hardware monitor -#nsclpcsio* at isa? +nsclpcsio* at isa? # Abit uGuru Hardware system monitor #ug0 at isa? port 0xe0 @@ -704,23 +704,23 @@ ld* at iop? tid ? # block devices dpti* at iop? tid 0 # DPT/Adaptec control interface # GPIO devices -#gpio* at gpiobus? +gpio* at gpiobus? # 1-Wire support #gpioow* at gpio? offset ? mask ? # 1-wire bitbanging via gpio -#gpioow* at gpio? -#onewire* at gpioow? +gpioow* at gpio? +onewire* at gpioow? # 1-Wire devices -#owtemp* at onewire? # Temperature sensors +owtemp* at onewire? # Temperature sensors # i2c support -#gpioiic* at gpio? offset ? mask ? flag 0x00 # flag 0x01 reverses +gpioiic* at gpio? offset ? mask ? flag 0x00 # flag 0x01 reverses # SCA and SCL signals -#iic* at gpioiic? +iic* at gpioiic? # Keylock support -#gpiolock* at gpio? +gpiolock* at gpio? # SCSI Controllers and Devices
CVS commit: src/lib/lua/gpio
Module Name:src Committed By: mbalmer Date: Sun Nov 13 09:46:11 UTC 2011 Modified Files: src/lib/lua/gpio: gpio.c Log Message: Start numbering pions with 0, not 1. Ruined a demo, so it was a bad idea. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/lua/gpio/gpio.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/lua/gpio/gpio.c diff -u src/lib/lua/gpio/gpio.c:1.3 src/lib/lua/gpio/gpio.c:1.4 --- src/lib/lua/gpio/gpio.c:1.3 Mon Oct 10 20:41:05 2011 +++ src/lib/lua/gpio/gpio.c Sun Nov 13 09:46:11 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: gpio.c,v 1.3 2011/10/10 20:41:05 christos Exp $ */ +/* $NetBSD: gpio.c,v 1.4 2011/11/13 09:46:11 mbalmer Exp $ */ /* * Copyright (c) 2011 Marc Balmer m...@msys.ch @@ -112,7 +112,7 @@ gpio_get_pin(lua_State *L, int n, struct { switch (lua_type(L, n)) { case LUA_TNUMBER: - req-gp_pin = (int)lua_tointeger(L, n) - 1; /* 1 based! */ + req-gp_pin = (int)lua_tointeger(L, n); /* not 1 based! */ break; case LUA_TSTRING: strlcpy(req-gp_name, lua_tostring(L, n), sizeof(req-gp_name));
CVS commit: src/sys/dev/gpio
Module Name:src Committed By: mbalmer Date: Sun Nov 13 12:33:01 UTC 2011 Modified Files: src/sys/dev/gpio: files.gpio Added Files: src/sys/dev/gpio: gpiopwm.c Log Message: gpiopwm(4) is a driver to pulse GPIO pins in software. This obsoletes the software pulsing facilities in gpio(4) (and gpioctl(8)) which will later be removed. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/gpio/files.gpio cvs rdiff -u -r0 -r1.1 src/sys/dev/gpio/gpiopwm.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/gpio/files.gpio diff -u src/sys/dev/gpio/files.gpio:1.9 src/sys/dev/gpio/files.gpio:1.10 --- src/sys/dev/gpio/files.gpio:1.9 Sun Oct 2 10:01:25 2011 +++ src/sys/dev/gpio/files.gpio Sun Nov 13 12:33:00 2011 @@ -1,4 +1,4 @@ -# $NetBSD: files.gpio,v 1.9 2011/10/02 10:01:25 mbalmer Exp $ +# $NetBSD: files.gpio,v 1.10 2011/11/13 12:33:00 mbalmer Exp $ define gpio {[offset = -1], [mask = 0], [flag = 0]} @@ -24,3 +24,8 @@ file dev/gpio/gpioow.c gpioow device gpiolock: gpiobus attach gpiolock at gpio file dev/gpio/gpiolock.c gpiolock + +# PWM +device gpiopwm: gpiobus +attach gpiopwm at gpio +file dev/gpio/gpiopwm.c gpiopwm Added files: Index: src/sys/dev/gpio/gpiopwm.c diff -u /dev/null src/sys/dev/gpio/gpiopwm.c:1.1 --- /dev/null Sun Nov 13 12:33:01 2011 +++ src/sys/dev/gpio/gpiopwm.c Sun Nov 13 12:33:01 2011 @@ -0,0 +1,246 @@ +/* $NetBSD: gpiopwm.c,v 1.1 2011/11/13 12:33:01 mbalmer Exp $ */ + +/* + * Copyright (c) 2011 Marc Balmer m...@msys.ch + * 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. + */ + +/* + * Driver for pulsing GPIO pins in software + */ + +#include sys/param.h +#include sys/device.h +#include sys/gpio.h +#include sys/sysctl.h + +#include dev/gpio/gpiovar.h + +#define GPIOPWM_NPINS 1 + +struct gpiopwm_softc { + device_t sc_dev; + void *sc_gpio; + struct gpio_pinmap sc_map; + int _map[GPIOPWM_NPINS]; + + callout_t sc_pulse; + int sc_ticks_on; + int sc_ticks_off; + + struct sysctllog *sc_log; + int sc_dying; +}; + +int gpiopwm_match(device_t, cfdata_t, void *); +void gpiopwm_attach(device_t, device_t, void *); +int gpiopwm_detach(device_t, int); +int gpiopwm_activate(device_t, enum devact); +static int gpiopwm_set_on(SYSCTLFN_ARGS); +static int gpiopwm_set_off(SYSCTLFN_ARGS); +static void gpiopwm_pulse(void *); + +CFATTACH_DECL_NEW(gpiopwm, sizeof(struct gpiopwm_softc), + gpiopwm_match, gpiopwm_attach, gpiopwm_detach, gpiopwm_activate); + +extern struct cfdriver gpiopwm_cd; + +int +gpiopwm_match(device_t parent, cfdata_t cf, +void *aux) +{ + struct gpio_attach_args *ga = aux; + + if (strcmp(ga-ga_dvname, cf-cf_name)) + return 0; + + if (ga-ga_offset == -1) + return 0; + + /* Check number of pins, must be 1 */ + if (gpio_npins(ga-ga_mask) != GPIOPWM_NPINS) { + aprint_debug(%s: invalid pin mask 0x%02x\n, cf-cf_name, + ga-ga_mask); + return 0; + } + return 1; +} + +void +gpiopwm_attach(device_t parent, device_t self, void *aux) +{ + struct gpiopwm_softc *sc = device_private(self); + struct gpio_attach_args *ga = aux; + const struct sysctlnode *node; + + sc-sc_dev = self; + + /* Map pin */ + sc-sc_gpio = ga-ga_gpio; + sc-sc_map.pm_map = sc-_map; + if (gpio_pin_map(sc-sc_gpio, ga-ga_offset, ga-ga_mask, + sc-sc_map)) { + aprint_error(: can't map pin\n); + return; + } + aprint_normal( [%d], sc-sc_map.pm_map[0]); + pmf_device_register(self, NULL, NULL); + + callout_init(sc-sc_pulse, CALLOUT_MPSAFE); + callout_setfunc(sc-sc_pulse, gpiopwm_pulse, sc); + + sysctl_createv(NULL, 0, NULL, NULL, +CTLFLAG_PERMANENT, +CTLTYPE_NODE, hw, NULL, +NULL, 0, NULL, 0, +
CVS commit: src
Module Name:src Committed By: mbalmer Date: Sun Nov 13 12:35:40 UTC 2011 Modified Files: src/distrib/sets/lists/man: mi src/share/man/man4: Makefile Added Files: src/share/man/man4: gpiopwm.4 Log Message: Add documentation for gpiopwm(4). To generate a diff of this commit: cvs rdiff -u -r1.1353 -r1.1354 src/distrib/sets/lists/man/mi cvs rdiff -u -r1.573 -r1.574 src/share/man/man4/Makefile cvs rdiff -u -r0 -r1.1 src/share/man/man4/gpiopwm.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/man/mi diff -u src/distrib/sets/lists/man/mi:1.1353 src/distrib/sets/lists/man/mi:1.1354 --- src/distrib/sets/lists/man/mi:1.1353 Sat Nov 5 22:55:23 2011 +++ src/distrib/sets/lists/man/mi Sun Nov 13 12:35:40 2011 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1353 2011/11/05 22:55:23 christos Exp $ +# $NetBSD: mi,v 1.1354 2011/11/13 12:35:40 mbalmer Exp $ # # Note: don't delete entries from here - mark them as obsolete instead. # @@ -1019,6 +1019,7 @@ ./usr/share/man/cat4/gpioiic.0 man-sys-catman .cat ./usr/share/man/cat4/gpiolock.0 man-sys-catman .cat ./usr/share/man/cat4/gpioow.0 man-sys-catman .cat +./usr/share/man/cat4/gpiopwm.0 man-sys-catman .cat ./usr/share/man/cat4/gpiosim.0 man-sys-catman .cat ./usr/share/man/cat4/gre.0 man-sys-catman .cat ./usr/share/man/cat4/gsip.0 man-sys-catman .cat @@ -3858,6 +3859,7 @@ ./usr/share/man/html4/gpioiic.html man-sys-htmlman html ./usr/share/man/html4/gpiolock.html man-sys-htmlman html ./usr/share/man/html4/gpioow.html man-sys-htmlman html +./usr/share/man/html4/gpiopwm.html man-sys-htmlman html ./usr/share/man/html4/gpiosim.html man-sys-htmlman html ./usr/share/man/html4/gre.html man-sys-htmlman html ./usr/share/man/html4/gsip.html man-sys-htmlman html @@ -6474,6 +6476,7 @@ ./usr/share/man/man4/gpioiic.4 man-sys-man .man ./usr/share/man/man4/gpiolock.4 man-sys-man .man ./usr/share/man/man4/gpioow.4 man-sys-man .man +./usr/share/man/man4/gpiopwm.4 man-sys-man .man ./usr/share/man/man4/gpiosim.4 man-sys-man .man ./usr/share/man/man4/gre.4 man-sys-man .man ./usr/share/man/man4/gsip.4 man-sys-man .man Index: src/share/man/man4/Makefile diff -u src/share/man/man4/Makefile:1.573 src/share/man/man4/Makefile:1.574 --- src/share/man/man4/Makefile:1.573 Sat Nov 5 09:22:44 2011 +++ src/share/man/man4/Makefile Sun Nov 13 12:35:40 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.573 2011/11/05 09:22:44 hannken Exp $ +# $NetBSD: Makefile,v 1.574 2011/11/13 12:35:40 mbalmer Exp $ # @(#)Makefile 8.1 (Berkeley) 6/18/93 MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \ @@ -26,7 +26,8 @@ MAN= aac.4 ac97.4 acardide.4 aceride.4 a esa.4 esiop.4 esm.4 eso.4 et.4 etherip.4 etphy.4 exphy.4 \ fast_ipsec.4 fd.4 filemon.4 finsio.4 flash.4 fpa.4 fms.4 fss.4 fujbp.4 fxp.4 \ gcscaudio.4 gem.4 genfb.4 gentbi.4 geodeide.4 \ - glxtphy.4 gpib.4 gpio.4 gpiolock.4 gpiosim.4 gre.4 gphyter.4 gsip.4 \ + glxtphy.4 gpib.4 gpio.4 gpiolock.4 gpiopwm.4 gpiosim.4 gre.4 \ + gphyter.4 gsip.4 \ hdaudio.4 hifn.4 hme.4 hpacel.4 hpqlb.4 hptide.4 \ ibmhawk.4 ichsmb.4 icmp.4 icp.4 icsphy.4 iee.4 ieee80211.4 \ ifmedia.4 igphy.4 igsfb.4 iha.4 ihphy.4 iic.4 inet.4 ikphy.4 inphy.4 \ Added files: Index: src/share/man/man4/gpiopwm.4 diff -u /dev/null src/share/man/man4/gpiopwm.4:1.1 --- /dev/null Sun Nov 13 12:35:41 2011 +++ src/share/man/man4/gpiopwm.4 Sun Nov 13 12:35:40 2011 @@ -0,0 +1,79 @@ +.\ $NetBSD: gpiopwm.4,v 1.1 2011/11/13 12:35:40 mbalmer Exp $ +.\ +.\ Copyright (c) 2011 Marc Balmer m...@msys.ch +.\ +.\ Permission to use, copy, modify, and distribute this software for any +.\ purpose with or without fee is hereby granted, provided that the above +.\ copyright notice and this permission notice appear in all copies. +.\ +.\ THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\ +.Dd Novemner 13, 2011 +.Dt GPIOPWM 4 +.Os +.Sh NAME +.Nm gpiopwm +.Nd support for pulsing GPIO pins in software +.Sh SYNOPSIS +.Cd gpiopwm* at gpio? offset ? mask 1 +.Cd gpiopwm* at gpio? +.Sh DESCRIPTION +The +.Nm +driver allows for pulsing GPIO pins in software using the +.Xr callout 9 +facility. +The pulse frequency and duty cycle are specified indirectly by setting an 'on' +and 'off' period, in ticks. +Both values are accessible as +.Xr sysctl 2 +variables. +.Sh SYSCTL VARIABLES +The following +.Xr sysctl 2 +variables are used to define the pulsing: +.Bl -tag width
CVS commit: src/doc
Module Name:src Committed By: mbalmer Date: Sun Nov 13 12:44:18 UTC 2011 Modified Files: src/doc: CHANGES Log Message: Note gpiopwm(4) addition. To generate a diff of this commit: cvs rdiff -u -r1.1624 -r1.1625 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.1624 src/doc/CHANGES:1.1625 --- src/doc/CHANGES:1.1624 Sat Nov 12 01:22:07 2011 +++ src/doc/CHANGES Sun Nov 13 12:44:18 2011 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: $Revision: 1.1624 $ +# LIST OF CHANGES FROM LAST RELEASE: $Revision: 1.1625 $ # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -1166,3 +1166,5 @@ Changes from NetBSD 5.0 to NetBSD 6.0: These provide the end user with some ready-to-use sample code for a variety of platforms, showcasing how to interact with NetBSD system calls, APIs and binaries. [jmmv 2011] + gpiopwm(4): A new driver to pulse GPIO pins in software. + [mbalmer 2013]
CVS commit: src/sys/arch/amd64/conf
Module Name:src Committed By: mbalmer Date: Sun Nov 13 12:46:40 UTC 2011 Modified Files: src/sys/arch/amd64/conf: GENERIC Log Message: Add commented out entry for gpiopwm(4). To generate a diff of this commit: cvs rdiff -u -r1.338 -r1.339 src/sys/arch/amd64/conf/GENERIC Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/conf/GENERIC diff -u src/sys/arch/amd64/conf/GENERIC:1.338 src/sys/arch/amd64/conf/GENERIC:1.339 --- src/sys/arch/amd64/conf/GENERIC:1.338 Sun Oct 30 12:12:21 2011 +++ src/sys/arch/amd64/conf/GENERIC Sun Nov 13 12:46:40 2011 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.338 2011/10/30 12:12:21 hannken Exp $ +# $NetBSD: GENERIC,v 1.339 2011/11/13 12:46:40 mbalmer Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include arch/amd64/conf/std.amd64 options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident GENERIC-$Revision: 1.338 $ +#ident GENERIC-$Revision: 1.339 $ maxusers 64 # estimated number of users @@ -517,6 +517,9 @@ ld* at iop? tid ? # block devices # Keylock support #gpiolock* at gpio? +# Pulsing GPIO pins in software +#gpiopwm* at gpio? + # SCSI Controllers and Devices # PCI SCSI controllers
CVS commit: src/sys/arch/i386/conf
Module Name:src Committed By: mbalmer Date: Sun Nov 13 12:47:55 UTC 2011 Modified Files: src/sys/arch/i386/conf: GENERIC Log Message: Add gpiopwm(4). To generate a diff of this commit: cvs rdiff -u -r1.1056 -r1.1057 src/sys/arch/i386/conf/GENERIC Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/conf/GENERIC diff -u src/sys/arch/i386/conf/GENERIC:1.1056 src/sys/arch/i386/conf/GENERIC:1.1057 --- src/sys/arch/i386/conf/GENERIC:1.1056 Sun Nov 13 09:41:46 2011 +++ src/sys/arch/i386/conf/GENERIC Sun Nov 13 12:47:54 2011 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.1056 2011/11/13 09:41:46 mbalmer Exp $ +# $NetBSD: GENERIC,v 1.1057 2011/11/13 12:47:54 mbalmer Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include arch/i386/conf/std.i386 options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident GENERIC-$Revision: 1.1056 $ +#ident GENERIC-$Revision: 1.1057 $ maxusers 64 # estimated number of users @@ -722,6 +722,9 @@ iic* at gpioiic? # Keylock support gpiolock* at gpio? +# Software pulsing GPIO pins +gpiopwm* at gpio? + # SCSI Controllers and Devices # PCI SCSI controllers
CVS commit: src/sys/dev/gpio
Module Name:src Committed By: mbalmer Date: Sun Nov 13 13:16:33 UTC 2011 Modified Files: src/sys/dev/gpio: gpiopwm.c Log Message: On detach, set the pin to low state. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/gpio/gpiopwm.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/gpio/gpiopwm.c diff -u src/sys/dev/gpio/gpiopwm.c:1.1 src/sys/dev/gpio/gpiopwm.c:1.2 --- src/sys/dev/gpio/gpiopwm.c:1.1 Sun Nov 13 12:33:01 2011 +++ src/sys/dev/gpio/gpiopwm.c Sun Nov 13 13:16:33 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: gpiopwm.c,v 1.1 2011/11/13 12:33:01 mbalmer Exp $ */ +/* $NetBSD: gpiopwm.c,v 1.2 2011/11/13 13:16:33 mbalmer Exp $ */ /* * Copyright (c) 2011 Marc Balmer m...@msys.ch @@ -150,6 +150,7 @@ gpiopwm_detach(device_t self, int flags) callout_halt(sc-sc_pulse, NULL); callout_destroy(sc-sc_pulse); + gpio_pin_write(sc-sc_gpio, sc-sc_map, 0, GPIO_PIN_LOW); pmf_device_deregister(self); gpio_pin_unmap(sc-sc_gpio, sc-sc_map);
CVS commit: src
Module Name:src Committed By: mbalmer Date: Sun Nov 13 13:20:02 UTC 2011 Modified Files: src/sys/dev/gpio: gpio.c gpiovar.h src/sys/sys: gpio.h src/usr.sbin/gpioctl: gpioctl.8 gpioctl.c Log Message: Remove software pulsing in gpio(4), this functionality is now provided by the gpiopwm(4) driver. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/dev/gpio/gpio.c cvs rdiff -u -r1.14 -r1.15 src/sys/dev/gpio/gpiovar.h cvs rdiff -u -r1.11 -r1.12 src/sys/sys/gpio.h cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/gpioctl/gpioctl.8 cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/gpioctl/gpioctl.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/gpio/gpio.c diff -u src/sys/dev/gpio/gpio.c:1.46 src/sys/dev/gpio/gpio.c:1.47 --- src/sys/dev/gpio/gpio.c:1.46 Mon Oct 3 11:31:56 2011 +++ src/sys/dev/gpio/gpio.c Sun Nov 13 13:20:02 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: gpio.c,v 1.46 2011/10/03 11:31:56 mbalmer Exp $ */ +/* $NetBSD: gpio.c,v 1.47 2011/11/13 13:20:02 mbalmer Exp $ */ /* $OpenBSD: gpio.c,v 1.6 2006/01/14 12:33:49 grange Exp $ */ /* @@ -19,7 +19,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: gpio.c,v 1.46 2011/10/03 11:31:56 mbalmer Exp $); +__KERNEL_RCSID(0, $NetBSD: gpio.c,v 1.47 2011/11/13 13:20:02 mbalmer Exp $); /* * General Purpose Input/Output framework. @@ -81,7 +81,6 @@ static int gpio_detach(device_t, int); static int gpio_search(device_t, cfdata_t, const int *, void *); static int gpio_print(void *, const char *); static int gpio_pinbyname(struct gpio_softc *, char *); -static void gpio_pulse(void *); static int gpio_ioctl(struct gpio_softc *, u_long, void *, int, struct lwp *); @@ -193,7 +192,7 @@ gpio_attach(device_t parent, device_t se { struct gpio_softc *sc = device_private(self); struct gpiobus_attach_args *gba = aux; - int pin; + sc-sc_dev = self; sc-sc_gc = gba-gba_gc; sc-sc_pins = gba-gba_pins; @@ -201,11 +200,6 @@ gpio_attach(device_t parent, device_t se printf(: %d pins\n, sc-sc_npins); - for (pin = 0; pin sc-sc_npins; pin++) { - callout_init(sc-sc_pins[pin].pin_pulse, CALLOUT_MPSAFE); - callout_setfunc(sc-sc_pins[pin].pin_pulse, gpio_pulse, - sc-sc_pins[pin]); - } if (!pmf_device_register(self, NULL, gpio_resume)) aprint_error_dev(self, couldn't establish power handler\n); mutex_init(sc-sc_mtx, MUTEX_DEFAULT, IPL_VM); @@ -222,18 +216,10 @@ static int gpio_detach(device_t self, int flags) { struct gpio_softc *sc; - int pin, rc; + int rc; sc = device_private(self); - for (pin = 0; pin sc-sc_npins; pin++) { - if (sc-sc_pins[pin].pin_state GPIO_PIN_PULSE) { - callout_halt(sc-sc_pins[pin].pin_pulse, NULL); - callout_destroy(sc-sc_pins[pin].pin_pulse); - sc-sc_pins[pin].pin_state = ~GPIO_PIN_PULSE; - } - } - if ((rc = config_detach_children(self, flags)) != 0) return rc; mutex_destroy(sc-sc_mtx); @@ -465,26 +451,6 @@ gpio_pinbyname(struct gpio_softc *sc, ch return -1; } -static void -gpio_pulse(void *arg) -{ - struct gpio_pin *pin; - - pin = arg; - if ((pin-pin_state GPIO_PIN_PULSE) == 0) - return; - - if (pin-pin_state GPIO_PIN_HIGH) { - gpiobus_pin_write(pin-pin_gc, pin-pin_num, GPIO_PIN_LOW); - pin-pin_state = ~GPIO_PIN_HIGH; - callout_schedule(pin-pin_pulse, pin-pin_ticks_off); - } else { - gpiobus_pin_write(pin-pin_gc, pin-pin_num, GPIO_PIN_HIGH); - pin-pin_state |= GPIO_PIN_HIGH; - callout_schedule(pin-pin_pulse, pin-pin_ticks_on); - } -} - int gpioioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l) { @@ -511,7 +477,6 @@ gpio_ioctl(struct gpio_softc *sc, u_long struct gpio_attach *attach; struct gpio_attach_args ga; struct gpio_req *req; - struct gpio_pulse *pulse; struct gpio_name *nm; struct gpio_set *set; struct gpio_pin *gpin; @@ -593,59 +558,12 @@ gpio_ioctl(struct gpio_softc *sc, u_long if (value != GPIO_PIN_LOW value != GPIO_PIN_HIGH) return EINVAL; - if (sc-sc_pins[pin].pin_state GPIO_PIN_PULSE) { - callout_halt(sc-sc_pins[pin].pin_pulse, NULL); - sc-sc_pins[pin].pin_state = ~GPIO_PIN_PULSE; - } gpiobus_pin_write(gc, pin, value); /* return old value */ req-gp_value = sc-sc_pins[pin].pin_state; /* update current value */ sc-sc_pins[pin].pin_state = value; break; - case GPIOPULSE: - if ((flag FWRITE) == 0) - return EBADF; - - pulse = data; - if (pulse-gp_name[0] != '\0') - pin = gpio_pinbyname(sc, pulse-gp_name); - else - pin = pulse-gp_pin; - - if (pin 0 || pin = sc-sc_npins) - return EINVAL; - - gpin = sc-sc_pins[pin]; - if (gpin-pin_mapped) - return EBUSY; - - if (!(gpin-pin_flags GPIO_PIN_SET) - kauth_authorize_device(cred, KAUTH_DEVICE_GPIO_PINSET, - NULL, NULL, NULL, NULL)) - return EPERM; - - if (gpin-pin_flags GPIO_PIN_PULSATE) { - gpiobus_pin_write(gc, pin, GPIO_PIN_HIGH); - gpin-pin_state = GPIO_PIN_PULSE; -
CVS commit: src/lib/lua/gpio
Module Name:src Committed By: mbalmer Date: Sun Nov 13 13:37:25 UTC 2011 Modified Files: src/lib/lua/gpio: gpio.c Log Message: Remove software pulsing. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/lua/gpio/gpio.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/lua/gpio/gpio.c diff -u src/lib/lua/gpio/gpio.c:1.4 src/lib/lua/gpio/gpio.c:1.5 --- src/lib/lua/gpio/gpio.c:1.4 Sun Nov 13 09:46:11 2011 +++ src/lib/lua/gpio/gpio.c Sun Nov 13 13:37:24 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: gpio.c,v 1.4 2011/11/13 09:46:11 mbalmer Exp $ */ +/* $NetBSD: gpio.c,v 1.5 2011/11/13 13:37:24 mbalmer Exp $ */ /* * Copyright (c) 2011 Marc Balmer m...@msys.ch @@ -224,56 +224,6 @@ gpio_attach(lua_State *L) return 0; } -static int -gpio_pulse(lua_State *L) -{ - struct gpio_pulse pulse; - suseconds_t period, on, off, sec; - double freq, dc; - int *fd; - - fd = luaL_checkudata(L, 1, GPIO_METATABLE); - freq = luaL_checknumber(L, 3); - dc = luaL_checknumber(L, 4); - - if (freq 0.0 || (dc 0.0 || dc = 100.0)) - gpio_error(L, %.f Hz, %.f%% duty cycle: invalid value, - freq, dc); - - memset(pulse, 0, sizeof(pulse)); - gpio_get_pin(L, 2, (void *)pulse); - - if (freq 0.0 dc 0.0) { - period = 100 / freq; - on = period * dc / 100; - off = period - on; - - if (on = 100) { - pulse.gp_pulse_on.tv_sec = sec = on / 100; - on -= sec * 100; - pulse.gp_pulse_on.tv_usec = on; - } else { - pulse.gp_pulse_on.tv_sec = 0; - pulse.gp_pulse_on.tv_usec = on; - } - if (off = 100) { - pulse.gp_pulse_off.tv_sec = sec = off / 100; - off -= sec * 100; - pulse.gp_pulse_off.tv_usec = off; - } else { - pulse.gp_pulse_off.tv_sec = 0; - pulse.gp_pulse_off.tv_usec = off; - } - } else { /* gpio(4) defaults */ - freq = 1.0; - dc = 50.0; - } - - if (ioctl(*fd, GPIOPULSE, pulse) == -1) - gpio_error(L, GPIOPULSE); - return 0; -} - struct constant { const char *name; int value; @@ -283,7 +233,6 @@ static const struct constant gpio_consta /* GPIO pin states */ { PIN_LOW, GPIO_PIN_LOW }, { PIN_HIGH, GPIO_PIN_HIGH }, - { PIN_PULSE, GPIO_PIN_PULSE }, /* GPIO pin configuration flags */ { PIN_INPUT, GPIO_PIN_INPUT }, @@ -314,7 +263,7 @@ gpio_set_info(lua_State *L) lua_pushliteral(L, GPIO interface for Lua); lua_settable(L, -3); lua_pushliteral(L, _VERSION); - lua_pushliteral(L, gpio 1.0.0); + lua_pushliteral(L, gpio 1.0.1); lua_settable(L, -3); } @@ -336,7 +285,6 @@ luaopen_gpio(lua_State* L) { write, gpio_write }, { toggle, gpio_toggle }, { attach, gpio_attach }, - { pulse, gpio_pulse }, { NULL, NULL } }; int n;
CVS commit: src/sys/dev/gpio
Module Name:src Committed By: mbalmer Date: Sun Nov 13 14:02:01 UTC 2011 Modified Files: src/sys/dev/gpio: gpio.c Log Message: Remove an unused variable. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/sys/dev/gpio/gpio.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/gpio/gpio.c diff -u src/sys/dev/gpio/gpio.c:1.47 src/sys/dev/gpio/gpio.c:1.48 --- src/sys/dev/gpio/gpio.c:1.47 Sun Nov 13 13:20:02 2011 +++ src/sys/dev/gpio/gpio.c Sun Nov 13 14:02:01 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: gpio.c,v 1.47 2011/11/13 13:20:02 mbalmer Exp $ */ +/* $NetBSD: gpio.c,v 1.48 2011/11/13 14:02:01 mbalmer Exp $ */ /* $OpenBSD: gpio.c,v 1.6 2006/01/14 12:33:49 grange Exp $ */ /* @@ -19,7 +19,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: gpio.c,v 1.47 2011/11/13 13:20:02 mbalmer Exp $); +__KERNEL_RCSID(0, $NetBSD: gpio.c,v 1.48 2011/11/13 14:02:01 mbalmer Exp $); /* * General Purpose Input/Output framework. @@ -479,7 +479,6 @@ gpio_ioctl(struct gpio_softc *sc, u_long struct gpio_req *req; struct gpio_name *nm; struct gpio_set *set; - struct gpio_pin *gpin; #ifdef COMPAT_50 struct gpio_dev *gdev; #endif
CVS commit: src/doc
Module Name:src Committed By: tsutsui Date: Sun Nov 13 14:39:03 UTC 2011 Modified Files: src/doc: CHANGES Log Message: Note NetBSD/luna68k LUNA-II support. To generate a diff of this commit: cvs rdiff -u -r1.1625 -r1.1626 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.1625 src/doc/CHANGES:1.1626 --- src/doc/CHANGES:1.1625 Sun Nov 13 12:44:18 2011 +++ src/doc/CHANGES Sun Nov 13 14:39:02 2011 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: $Revision: 1.1625 $ +# LIST OF CHANGES FROM LAST RELEASE: $Revision: 1.1626 $ # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -1166,5 +1166,6 @@ Changes from NetBSD 5.0 to NetBSD 6.0: These provide the end user with some ready-to-use sample code for a variety of platforms, showcasing how to interact with NetBSD system calls, APIs and binaries. [jmmv 2011] + luna68k: Finally complete LUNA-II support. [tsutsui 2012] gpiopwm(4): A new driver to pulse GPIO pins in software. [mbalmer 2013]
CVS commit: src/usr.sbin/gpioctl
Module Name:src Committed By: mbalmer Date: Sun Nov 13 14:39:42 UTC 2011 Modified Files: src/usr.sbin/gpioctl: gpioctl.8 Log Message: Fix a lonely name. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/gpioctl/gpioctl.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/gpioctl/gpioctl.8 diff -u src/usr.sbin/gpioctl/gpioctl.8:1.15 src/usr.sbin/gpioctl/gpioctl.8:1.16 --- src/usr.sbin/gpioctl/gpioctl.8:1.15 Sun Nov 13 13:20:02 2011 +++ src/usr.sbin/gpioctl/gpioctl.8 Sun Nov 13 14:39:42 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: gpioctl.8,v 1.15 2011/11/13 13:20:02 mbalmer Exp $ +.\ $NetBSD: gpioctl.8,v 1.16 2011/11/13 14:39:42 mbalmer Exp $ .\ .\ Copyright (c) 2009, 2010, 2011 Marc Balmer m...@msys.ch .\ Copyright (c) 2004 Alexander Yurchenko gra...@openbsd.org @@ -41,7 +41,6 @@ .Ar pin .Op Ar on | off | toggle .Nm gpioctl -.Nm gpioctl .Op Fl q .Ar device .Ar pin
CVS commit: src/lib/libterminfo
Module Name:src Committed By: christos Date: Sun Nov 13 15:24:04 UTC 2011 Modified Files: src/lib/libterminfo: termcap.c Log Message: make use we don't touch memory past the end of the buffer. Pointed out by tnozaki. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/lib/libterminfo/termcap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libterminfo/termcap.c diff -u src/lib/libterminfo/termcap.c:1.16 src/lib/libterminfo/termcap.c:1.17 --- src/lib/libterminfo/termcap.c:1.16 Mon Oct 3 08:31:51 2011 +++ src/lib/libterminfo/termcap.c Sun Nov 13 10:24:04 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: termcap.c,v 1.16 2011/10/03 12:31:51 roy Exp $ */ +/* $NetBSD: termcap.c,v 1.17 2011/11/13 15:24:04 christos Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: termcap.c,v 1.16 2011/10/03 12:31:51 roy Exp $); +__RCSID($NetBSD: termcap.c,v 1.17 2011/11/13 15:24:04 christos Exp $); #include assert.h #include ctype.h @@ -79,7 +79,7 @@ tgetflag(const char *id2) uint32_t ind; size_t i; TERMUSERDEF *ud; - const char id[] = { id2[0], id2[1], '\0' }; + const char id[] = { id2[0], id2[0] ? id2[1] : '\0', '\0' }; if (cur_term == NULL) return 0; @@ -104,7 +104,7 @@ tgetnum(const char *id2) size_t i; TERMUSERDEF *ud; const TENTRY *te; - const char id[] = { id2[0], id2[1], '\0' }; + const char id[] = { id2[0], id2[0] ? id2[1] : '\0', '\0' }; if (cur_term == NULL) return -1; @@ -136,7 +136,7 @@ tgetstr(const char *id2, char **area) size_t i; TERMUSERDEF *ud; const char *str; - const char id[] = { id2[0], id2[1], '\0' }; + const char id[] = { id2[0], id2[0] ? id2[1] : '\0', '\0' }; if (cur_term == NULL) return NULL;
CVS commit: src/usr.sbin/edquota
Module Name:src Committed By: dholland Date: Sun Nov 13 15:41:34 UTC 2011 Modified Files: src/usr.sbin/edquota: edquota.c Log Message: Cleanup for edquota. Factor out common malloc and linked list code. Distinguish lists of quota info from single records. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/edquota/edquota.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/edquota/edquota.c diff -u src/usr.sbin/edquota/edquota.c:1.36 src/usr.sbin/edquota/edquota.c:1.37 --- src/usr.sbin/edquota/edquota.c:1.36 Fri Sep 30 22:08:19 2011 +++ src/usr.sbin/edquota/edquota.c Sun Nov 13 15:41:34 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: edquota.c,v 1.36 2011/09/30 22:08:19 jym Exp $ */ +/* $NetBSD: edquota.c,v 1.37 2011/11/13 15:41:34 dholland Exp $ */ /* * Copyright (c) 1980, 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -41,7 +41,7 @@ __COPYRIGHT(@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = from: @(#)edquota.c 8.3 (Berkeley) 4/27/95; #else -__RCSID($NetBSD: edquota.c,v 1.36 2011/09/30 22:08:19 jym Exp $); +__RCSID($NetBSD: edquota.c,v 1.37 2011/11/13 15:41:34 dholland Exp $); #endif #endif /* not lint */ @@ -69,6 +69,7 @@ __RCSID($NetBSD: edquota.c,v 1.36 2011/ #include grp.h #include ctype.h #include signal.h +#include stdbool.h #include stdio.h #include stdlib.h #include string.h @@ -83,6 +84,13 @@ __RCSID($NetBSD: edquota.c,v 1.36 2011/ static const char *quotagroup = QUOTAGROUP; static char tmpfil[] = _PATH_TMPFILE; +#define MAX_TMPSTR (100+MAXPATHLEN) + +/* flags for quotause */ +#define FOUND 0x01 +#define QUOTA2 0x02 +#define DEFAULT 0x04 + struct quotause { struct quotause *next; long flags; @@ -90,24 +98,13 @@ struct quotause { char fsname[MAXPATHLEN + 1]; char *qfname; }; -#define FOUND 0x01 -#define QUOTA2 0x02 -#define DEFAULT 0x04 -#define MAX_TMPSTR (100+MAXPATHLEN) +struct quotalist { + struct quotause *head; + struct quotause *tail; +}; static void usage(void) __dead; -static struct quotause * getprivs(long, int, const char *, int); -static struct quotause * getprivs2(long, int, const char *, int); -static struct quotause * getprivs1(long, int, const char *); -static void putprivs(uint32_t, int, struct quotause *); -static void putprivs2(uint32_t, int, struct quotause *); -static void putprivs1(uint32_t, int, struct quotause *); -static int editit(const char *); -static int writeprivs(struct quotause *, int, const char *, int); -static int readprivs(struct quotause *, int); -static void freeprivs(struct quotause *); -static void clearpriv(int, char **, const char *, int); static int Hflag = 0; static int Dflag = 0; @@ -156,6 +153,28 @@ getidbyname(const char *name, int quotac // quotause operations /* + * Create an empty quotause structure. + */ +static struct quotause * +quotause_create(void) +{ + struct quotause *qup; + + qup = malloc(sizeof(*qup)); + if (qup == NULL) { + err(1, malloc); + } + + qup-next = NULL; + qup-flags = 0; + memset(qup-qe, 0, sizeof(qup-qe)); + qup-fsname[0] = '\0'; + qup-qfname = NULL; + + return qup; +} + +/* * Free a quotause structure. */ static void @@ -165,18 +184,61 @@ quotause_destroy(struct quotause *qup) free(qup); } + +// quotalist operations + +/* + * Create a quotause list. + */ +static struct quotalist * +quotalist_create(void) +{ + struct quotalist *qlist; + + qlist = malloc(sizeof(*qlist)); + if (qlist == NULL) { + err(1, malloc); + } + + qlist-head = NULL; + qlist-tail = NULL; + + return qlist; +} + /* * Free a list of quotause structures. */ static void -freeprivs(struct quotause *quplist) +quotalist_destroy(struct quotalist *qlist) { struct quotause *qup, *nextqup; - for (qup = quplist; qup; qup = nextqup) { + for (qup = qlist-head; qup; qup = nextqup) { nextqup = qup-next; quotause_destroy(qup); } + free(qlist); +} + +static bool +quotalist_empty(struct quotalist *qlist) +{ + return qlist-head == NULL; +} + +static void +quotalist_append(struct quotalist *qlist, struct quotause *qup) +{ + /* should not already be on a list */ + assert(qup-next == NULL); + + if (qlist-head == NULL) { + qlist-head = qup; + } else { + qlist-tail-next = qup; + } + qlist-tail = qup; } @@ -227,8 +289,8 @@ getprivs1(long id, int quotaclass, const if (!hasquota(qfpathname, sizeof(qfpathname), fs, ufsclass2qtype(quotaclass))) return NULL; - if ((qup = malloc(sizeof(*qup))) == NULL) - err(1, out of memory); + + qup = quotause_create(); strcpy(qup-fsname, fs-fs_file); if ((fd = open(qfpathname, O_RDONLY)) 0) { fd = open(qfpathname, O_RDWR|O_CREAT, 0640); @@ -279,9 +341,7 @@ getprivs2(long id, int quotaclass, const struct quotause *qup; int8_t version; - if
CVS commit: src/usr.sbin/edquota
Module Name:src Committed By: dholland Date: Sun Nov 13 15:42:35 UTC 2011 Modified Files: src/usr.sbin/edquota: edquota.c Log Message: Split up excessively large main(). Fix -d behavior to match documentation. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/edquota/edquota.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/edquota/edquota.c diff -u src/usr.sbin/edquota/edquota.c:1.37 src/usr.sbin/edquota/edquota.c:1.38 --- src/usr.sbin/edquota/edquota.c:1.37 Sun Nov 13 15:41:34 2011 +++ src/usr.sbin/edquota/edquota.c Sun Nov 13 15:42:35 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: edquota.c,v 1.37 2011/11/13 15:41:34 dholland Exp $ */ +/* $NetBSD: edquota.c,v 1.38 2011/11/13 15:42:35 dholland Exp $ */ /* * Copyright (c) 1980, 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -41,7 +41,7 @@ __COPYRIGHT(@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = from: @(#)edquota.c 8.3 (Berkeley) 4/27/95; #else -__RCSID($NetBSD: edquota.c,v 1.37 2011/11/13 15:41:34 dholland Exp $); +__RCSID($NetBSD: edquota.c,v 1.38 2011/11/13 15:42:35 dholland Exp $); #endif #endif /* not lint */ @@ -82,7 +82,6 @@ __RCSID($NetBSD: edquota.c,v 1.37 2011/ #include pathnames.h static const char *quotagroup = QUOTAGROUP; -static char tmpfil[] = _PATH_TMPFILE; #define MAX_TMPSTR (100+MAXPATHLEN) @@ -108,7 +107,6 @@ static void usage(void) __dead; static int Hflag = 0; static int Dflag = 0; -static int dflag = 0; /* more compact form of constants */ #define QL_BLK QUOTA_LIMIT_BLOCK @@ -446,7 +444,7 @@ putprivs2(uint32_t id, int quotaclass, s * Collect the requested quota information. */ static struct quotalist * -getprivs(long id, int quotaclass, const char *filesys, int defaultq) +getprivs(long id, int defaultq, int quotaclass, const char *filesys) { struct statvfs *fst; int nfst, i; @@ -682,8 +680,8 @@ writeprivs(struct quotalist *qlist, int (void)ftruncate(outfd, 0); (void)lseek(outfd, (off_t)0, SEEK_SET); if ((fd = fdopen(dup(outfd), w)) == NULL) - errx(1, fdopen `%s', tmpfil); - if (dflag) { + errx(1, fdopen); + if (name == NULL) { fprintf(fd, Default %s quotas:\n, ufs_quota_class_names[quotaclass]); } else { @@ -741,7 +739,7 @@ writeprivs(struct quotalist *qlist, int * Merge changes to an ASCII file into a quotause list. */ static int -readprivs(struct quotalist *qlist, int infd) +readprivs(struct quotalist *qlist, int infd, int dflag) { struct quotause *qup; FILE *fd; @@ -979,6 +977,179 @@ out: } +// actions + +static void +replicate(const char *fs, int quotaclass, const char *protoname, + char **names, int numnames) +{ + long protoid, id; + struct quotalist *protoprivs; + struct quotause *qup; + int i; + + if ((protoid = getidbyname(protoname, quotaclass)) == -1) + exit(1); + protoprivs = getprivs(protoid, 0, quotaclass, fs); + for (qup = protoprivs-head; qup; qup = qup-next) { + qup-qe[QL_BLK].ufsqe_time = 0; + qup-qe[QL_FL].ufsqe_time = 0; + } + for (i=0; inumnames; i++) { + id = getidbyname(names[i], quotaclass); + if (id 0) + continue; + putprivs(id, quotaclass, protoprivs); + } + /* XXX */ + /* quotalist_destroy(protoprivs); */ +} + +static void +assign(const char *fs, int quotaclass, + char *soft, char *hard, char *grace, + char **names, int numnames) +{ + struct quotalist *curprivs; + struct quotause *lqup; + u_int64_t softb, hardb, softi, hardi; + time_t graceb, gracei; + char *str; + long id; + int dflag; + int i; + + if (soft) { + str = strsep(soft, /); + if (str[0] == '\0' || soft == NULL || soft[0] == '\0') + usage(); + + if (intrd(str, softb, HN_B) != 0) + errx(1, %s: bad number, str); + if (intrd(soft, softi, 0) != 0) + errx(1, %s: bad number, soft); + } + if (hard) { + str = strsep(hard, /); + if (str[0] == '\0' || hard == NULL || hard[0] == '\0') + usage(); + + if (intrd(str, hardb, HN_B) != 0) + errx(1, %s: bad number, str); + if (intrd(hard, hardi, 0) != 0) + errx(1, %s: bad number, hard); + } + if (grace) { + str = strsep(grace, /); + if (str[0] == '\0' || grace == NULL || grace[0] == '\0') + usage(); + + if (timeprd(str, graceb) != 0) + errx(1, %s: bad number, str); + if (timeprd(grace, gracei) != 0) + errx(1, %s: bad number, grace); + } + for (i=0; inumnames; i++) { + if (names[i] == NULL) { + id = 0; + dflag = 1; + } else { + id = getidbyname(names[i], quotaclass); + if (id == -1) +continue; + dflag = 0; + } + + curprivs = getprivs(id, dflag, quotaclass, fs); + for (lqup = curprivs-head; lqup; lqup = lqup-next) { + struct ufs_quota_entry *q = lqup-qe; + if (soft) { +if (!dflag softb +q[QL_BLK].ufsqe_cur = softb +(q[QL_BLK].ufsqe_softlimit == 0 || + q[QL_BLK].ufsqe_cur +
CVS commit: src/sys/arch/mips/mips
Module Name:src Committed By: tsutsui Date: Sun Nov 13 15:57:57 UTC 2011 Modified Files: src/sys/arch/mips/mips: locore.S Log Message: Read-modify-write instead of read-modify-read. (not sure if this was fatal) To generate a diff of this commit: cvs rdiff -u -r1.188 -r1.189 src/sys/arch/mips/mips/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/mips/mips/locore.S diff -u src/sys/arch/mips/mips/locore.S:1.188 src/sys/arch/mips/mips/locore.S:1.189 --- src/sys/arch/mips/mips/locore.S:1.188 Tue Aug 16 06:55:12 2011 +++ src/sys/arch/mips/mips/locore.S Sun Nov 13 15:57:57 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.188 2011/08/16 06:55:12 matt Exp $ */ +/* $NetBSD: locore.S,v 1.189 2011/11/13 15:57:57 tsutsui Exp $ */ /* * Copyright (c) 1992, 1993 @@ -165,7 +165,7 @@ _C_LABEL(kernel_text): */ mfc0 v0, MIPS_COP_0_STATUS or v0, MIPS_SR_INT_IE - mfc0 v0, MIPS_COP_0_STATUS + mtc0 v0, MIPS_COP_0_STATUS COP0_SYNC jal _C_LABEL(main) # main(void)
CVS commit: src/sys/arch/sandpoint/stand/altboot
Module Name:src Committed By: phx Date: Sun Nov 13 16:22:18 UTC 2011 Modified Files: src/sys/arch/sandpoint/stand/altboot: README.altboot Log Message: Add DS-106j. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sandpoint/stand/altboot/README.altboot 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/stand/altboot/README.altboot diff -u src/sys/arch/sandpoint/stand/altboot/README.altboot:1.5 src/sys/arch/sandpoint/stand/altboot/README.altboot:1.6 --- src/sys/arch/sandpoint/stand/altboot/README.altboot:1.5 Thu Jun 2 16:41:32 2011 +++ src/sys/arch/sandpoint/stand/altboot/README.altboot Sun Nov 13 16:22:18 2011 @@ -1,6 +1,6 @@ /// notes about altboot /// -$NetBSD: README.altboot,v 1.5 2011/06/02 16:41:32 phx Exp $ +$NetBSD: README.altboot,v 1.6 2011/11/13 16:22:18 phx Exp $ Altboot is a functional bridge to fill the gap between a NAS product custom bootloader and the NetBSD kernel startup environment. Altboot @@ -28,7 +28,7 @@ Altboot is known working on at least the PPCBoot 2.0.0 (Mar 1 2005 - 15:31:41) -- Synology 207, 407e with vendor custom PPCboot +- Synology 106j, 207, 407e with vendor custom PPCboot PPCBoot 2.0.0 (Jan 30 2007 - xx:xx:xx)
CVS commit: src
Module Name:src Committed By: mbalmer Date: Sun Nov 13 16:56:15 UTC 2011 Modified Files: src/lib/lua/gpio: gpio.c src/sys/sys: gpio.h Log Message: Remove an unused constant. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/lib/lua/gpio/gpio.c cvs rdiff -u -r1.12 -r1.13 src/sys/sys/gpio.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/lua/gpio/gpio.c diff -u src/lib/lua/gpio/gpio.c:1.5 src/lib/lua/gpio/gpio.c:1.6 --- src/lib/lua/gpio/gpio.c:1.5 Sun Nov 13 13:37:24 2011 +++ src/lib/lua/gpio/gpio.c Sun Nov 13 16:56:15 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: gpio.c,v 1.5 2011/11/13 13:37:24 mbalmer Exp $ */ +/* $NetBSD: gpio.c,v 1.6 2011/11/13 16:56:15 mbalmer Exp $ */ /* * Copyright (c) 2011 Marc Balmer m...@msys.ch @@ -247,8 +247,6 @@ static const struct constant gpio_consta { PIN_INVOUT, GPIO_PIN_INVOUT }, { PIN_USER, GPIO_PIN_USER }, { PIN_PULSATE, GPIO_PIN_PULSATE }, - { PIN_INTR, GPIO_PIN_INTR }, - { PIN_INTR_HIGH, GPIO_PIN_INTR_HIGH }, { PIN_SET, GPIO_PIN_SET }, { NULL, 0 } }; Index: src/sys/sys/gpio.h diff -u src/sys/sys/gpio.h:1.12 src/sys/sys/gpio.h:1.13 --- src/sys/sys/gpio.h:1.12 Sun Nov 13 13:20:02 2011 +++ src/sys/sys/gpio.h Sun Nov 13 16:56:15 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: gpio.h,v 1.12 2011/11/13 13:20:02 mbalmer Exp $ */ +/* $NetBSD: gpio.h,v 1.13 2011/11/13 16:56:15 mbalmer Exp $ */ /* $OpenBSD: gpio.h,v 1.7 2008/11/26 14:51:20 mbalmer Exp $ */ /* * Copyright (c) 2009, 2011 Marc Balmer m...@msys.ch @@ -42,8 +42,6 @@ #define GPIO_PIN_INVOUT 0x0200 /* invert output */ #define GPIO_PIN_USER 0x0400 /* user != 0 can access */ #define GPIO_PIN_PULSATE 0x0800 /* pulsate in hardware */ -#define GPIO_PIN_INTR 0x1000 /* can be as an interrupt */ -#define GPIO_PIN_INTR_HIGH 0x2000 /* interrupt leading edge high */ #define GPIO_PIN_SET 0x8000 /* set for securelevel access */ /* GPIO controller description */
CVS commit: src/share/man/man4
Module Name:src Committed By: mbalmer Date: Sun Nov 13 17:00:04 UTC 2011 Modified Files: src/share/man/man4: gpio.4 Log Message: Bring up to reality. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/share/man/man4/gpio.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/gpio.4 diff -u src/share/man/man4/gpio.4:1.22 src/share/man/man4/gpio.4:1.23 --- src/share/man/man4/gpio.4:1.22 Thu Oct 6 11:05:42 2011 +++ src/share/man/man4/gpio.4 Sun Nov 13 17:00:04 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: gpio.4,v 1.22 2011/10/06 11:05:42 wiz Exp $ +.\ $NetBSD: gpio.4,v 1.23 2011/11/13 17:00:04 mbalmer Exp $ .\ $OpenBSD: gpio.4,v 1.5 2004/11/23 09:39:29 reyk Exp $ .\ .\ Copyright (c) 2004 Alexander Yurchenko gra...@openbsd.org @@ -15,7 +15,7 @@ .\ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\ -.Dd October 3, 2011 +.Dd November 13, 2011 .Dt GPIO 4 .Os .Sh NAME @@ -123,31 +123,6 @@ Toggles the pin output value, i.e. chang .Fa gp_value field is ignored and on return contains the old pin state. .Pp -.It Dv GPIOPULSE (struct gpio_pulse) -Starts pulsing the pin: -.Bd -literal -/* GPIO pulse request */ -struct gpio_pulse { - char gp_name[GPIOMAXNAME]; /* pin name */ - int gp_pin; /* pin number */ - struct timeval gp_pulse_on; /* on period */ - struct timeval gp_pulse_off; /* off period */ -}; -.Ed -.Pp -The -.Fa gp_name -or -.Fa gp_pin -field must be set before calling. -If -.Fa gp_pulse_on -or -.Fa gp_pulse_off -is set to zero, a default of -.Xr hz 9 / 2 -is assumed for both periods. -.Pp .It Dv GPIOSET (struct gpio_set) Changes pin configuration flags with the new ones provided in the .Fa gpio_set @@ -189,8 +164,8 @@ internal pull-down enabled invert input .It Dv GPIO_PIN_INVOUT invert output -.It Dv GPIO_PIN_PULSE -pulse output +.It Dv GPIO_PIN_PULSATE +pulsate output .El .Pp Note that the GPIO controller
CVS commit: src/sys/fs/nilfs
Module Name:src Committed By: dholland Date: Sun Nov 13 17:22:51 UTC 2011 Modified Files: src/sys/fs/nilfs: nilfs_vfsops.c Log Message: Avoid panic on error path, from PR 45607. The error path is exercised because this is using DIOCGPART to get the volume size, which doesn't work on wedges. It should be calling getdisksize() instead. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/fs/nilfs/nilfs_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/nilfs/nilfs_vfsops.c diff -u src/sys/fs/nilfs/nilfs_vfsops.c:1.5 src/sys/fs/nilfs/nilfs_vfsops.c:1.6 --- src/sys/fs/nilfs/nilfs_vfsops.c:1.5 Wed Aug 11 13:26:25 2010 +++ src/sys/fs/nilfs/nilfs_vfsops.c Sun Nov 13 17:22:51 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: nilfs_vfsops.c,v 1.5 2010/08/11 13:26:25 pgoyette Exp $ */ +/* $NetBSD: nilfs_vfsops.c,v 1.6 2011/11/13 17:22:51 dholland Exp $ */ /* * Copyright (c) 2008, 2009 Reinoud Zandijk @@ -28,7 +28,7 @@ #include sys/cdefs.h #ifndef lint -__KERNEL_RCSID(0, $NetBSD: nilfs_vfsops.c,v 1.5 2010/08/11 13:26:25 pgoyette Exp $); +__KERNEL_RCSID(0, $NetBSD: nilfs_vfsops.c,v 1.6 2011/11/13 17:22:51 dholland Exp $); #endif /* not lint */ @@ -635,6 +635,9 @@ nilfs_mount_device(struct vnode *devvp, cv_init(nilfsdev-sync_cv, nilfssyn); STAILQ_INIT(nilfsdev-mounts); + /* register nilfs_device in list */ + SLIST_INSERT_HEAD(nilfs_devices, nilfsdev, next_device); + /* get our device's size */ error = VOP_IOCTL(devvp, DIOCGPART, dpart, FREAD, NOCRED); if (error) { @@ -644,9 +647,6 @@ nilfs_mount_device(struct vnode *devvp, } nilfsdev-devsize = dpart.part-p_size * dpart.disklab-d_secsize; - /* register nilfs_device in list */ - SLIST_INSERT_HEAD(nilfs_devices, nilfsdev, next_device); - /* connect to the head for most recent files XXX really pass mp and args? */ error = nilfs_mount_base(nilfsdev, mp, args); if (error) {
CVS commit: src/usr.bin/make
Module Name:src Committed By: dholland Date: Sun Nov 13 18:18:35 UTC 2011 Modified Files: src/usr.bin/make: make.1 Log Message: Fix xref to the PSD; PR 45568 from Petri Laakso. To generate a diff of this commit: cvs rdiff -u -r1.196 -r1.197 src/usr.bin/make/make.1 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/make/make.1 diff -u src/usr.bin/make/make.1:1.196 src/usr.bin/make/make.1:1.197 --- src/usr.bin/make/make.1:1.196 Sun Nov 6 19:50:46 2011 +++ src/usr.bin/make/make.1 Sun Nov 13 18:18:35 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: make.1,v 1.196 2011/11/06 19:50:46 christos Exp $ +.\ $NetBSD: make.1,v 1.197 2011/11/13 18:18:35 dholland Exp $ .\ .\ Copyright (c) 1990, 1993 .\ The Regents of the University of California. All rights reserved. @@ -95,7 +95,7 @@ This manual page is intended as a refere For a more thorough description of .Nm and makefiles, please refer to -.%T Make \- A Tutorial . +.%T PMake \- A Tutorial . .Pp .Nm will prepend the contents of the
CVS commit: src/sys/fs/nilfs
Module Name:src Committed By: christos Date: Sun Nov 13 18:29:08 UTC 2011 Modified Files: src/sys/fs/nilfs: nilfs_vfsops.c Log Message: use getdisksize, M_ZERO, and malloc M_WAITOK doesn't fai. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/fs/nilfs/nilfs_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/nilfs/nilfs_vfsops.c diff -u src/sys/fs/nilfs/nilfs_vfsops.c:1.6 src/sys/fs/nilfs/nilfs_vfsops.c:1.7 --- src/sys/fs/nilfs/nilfs_vfsops.c:1.6 Sun Nov 13 12:22:51 2011 +++ src/sys/fs/nilfs/nilfs_vfsops.c Sun Nov 13 13:29:08 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: nilfs_vfsops.c,v 1.6 2011/11/13 17:22:51 dholland Exp $ */ +/* $NetBSD: nilfs_vfsops.c,v 1.7 2011/11/13 18:29:08 christos Exp $ */ /* * Copyright (c) 2008, 2009 Reinoud Zandijk @@ -28,7 +28,7 @@ #include sys/cdefs.h #ifndef lint -__KERNEL_RCSID(0, $NetBSD: nilfs_vfsops.c,v 1.6 2011/11/13 17:22:51 dholland Exp $); +__KERNEL_RCSID(0, $NetBSD: nilfs_vfsops.c,v 1.7 2011/11/13 18:29:08 christos Exp $); #endif /* not lint */ @@ -563,7 +563,8 @@ static int nilfs_mount_device(struct vnode *devvp, struct mount *mp, struct nilfs_args *args, struct nilfs_device **nilfsdev_p) { - struct partinfo dpart; + uint64_t psize; + unsigned secsize; struct nilfs_device *nilfsdev; struct lwp *l = curlwp; int openflags, accessmode, error; @@ -624,11 +625,9 @@ nilfs_mount_device(struct vnode *devvp, } /* opened ok, try mounting */ - nilfsdev = malloc(sizeof(struct nilfs_device), M_NILFSMNT, M_WAITOK); - KASSERT(nilfsdev); + nilfsdev = malloc(sizeof(*nilfsdev), M_NILFSMNT, M_WAITOK | M_ZERO); /* initialise */ - memset(nilfsdev, 0, sizeof(struct nilfs_device)); nilfsdev-refcnt= 1; nilfsdev-devvp = devvp; nilfsdev-uncomitted_bl = 0; @@ -639,13 +638,14 @@ nilfs_mount_device(struct vnode *devvp, SLIST_INSERT_HEAD(nilfs_devices, nilfsdev, next_device); /* get our device's size */ - error = VOP_IOCTL(devvp, DIOCGPART, dpart, FREAD, NOCRED); + error = getdisksize(devvp, psize, secsize); if (error) { /* remove all our information */ nilfs_unmount_device(nilfsdev); return EINVAL; } - nilfsdev-devsize = dpart.part-p_size * dpart.disklab-d_secsize; + + nilfsdev-devsize = psize * secsize; /* connect to the head for most recent files XXX really pass mp and args? */ error = nilfs_mount_base(nilfsdev, mp, args);
CVS commit: src/share/man/man4
Module Name:src Committed By: wiz Date: Sun Nov 13 19:31:05 UTC 2011 Modified Files: src/share/man/man4: gpiopwm.4 Log Message: Fix a few typos and Xrefs, use Dq, comment out Xr to non-existent gpioattach(4), sort SEE ALSO. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/gpiopwm.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/gpiopwm.4 diff -u src/share/man/man4/gpiopwm.4:1.1 src/share/man/man4/gpiopwm.4:1.2 --- src/share/man/man4/gpiopwm.4:1.1 Sun Nov 13 12:35:40 2011 +++ src/share/man/man4/gpiopwm.4 Sun Nov 13 19:31:05 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: gpiopwm.4,v 1.1 2011/11/13 12:35:40 mbalmer Exp $ +.\ $NetBSD: gpiopwm.4,v 1.2 2011/11/13 19:31:05 wiz Exp $ .\ .\ Copyright (c) 2011 Marc Balmer m...@msys.ch .\ @@ -14,7 +14,7 @@ .\ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\ -.Dd Novemner 13, 2011 +.Dd November 13, 2011 .Dt GPIOPWM 4 .Os .Sh NAME @@ -29,29 +29,42 @@ The driver allows for pulsing GPIO pins in software using the .Xr callout 9 facility. -The pulse frequency and duty cycle are specified indirectly by setting an 'on' -and 'off' period, in ticks. +The pulse frequency and duty cycle are specified indirectly by setting an +.Dq on +and +.Dq off +period, in ticks. Both values are accessible as -.Xr sysctl 2 +.Xr sysctl 3 variables. .Sh SYSCTL VARIABLES The following -.Xr sysctl 2 +.Xr sysctl 3 variables are used to define the pulsing: .Bl -tag width .It hw.gpiopwmN.off -Define the 'off' period in ticks. +Define the +.Dq off +period in ticks. .It hw.gpiopwmN.on -Define the 'on' period in ticks. +Define the +.Dq on +period in ticks. .El .Pp -Only when both the 'on' and the 'off' period are set to values higher than -zero pulsing will start. +Only when both the +.Dq on +and the +.Dq off +period are set to values higher than zero pulsing will start. To stop the pulsing, set either value to zero. .Sh EXAMPLES To pulse a pin on a machine with 100 ticks/second with a frequency of 1Hz and a -duty cycle of 20%, the 'on' period must be set to 20 and the 'off' perdiod -must be set to 80. +duty cycle of 20%, the +.Dq on +period must be set to 20 and the +.Dq off +period must be set to 80. The following example will pulse the error LED of a Soekris net4801 with a frequency of 1 Hz and a duty cycle of 20%: .Bd -literal @@ -62,10 +75,10 @@ with a frequency of 1 Hz and a duty cycl .Ed .Sh SEE ALSO .Xr gpio 4 , -.Xr gpioattach 4 , +.\ .Xr gpioattach 4 , +.Xr intro 4 , .Xr gpioctl 8 , -.Xr sysctl 8 , -.Xr intro 4 +.Xr sysctl 8 .Sh HISTORY The .Nm
CVS commit: src/dist/nvi/docs/vi.ref
Module Name:src Committed By: wiz Date: Sun Nov 13 19:53:53 UTC 2011 Modified Files: src/dist/nvi/docs/vi.ref: vi.texi Log Message: add dircategory/direntry for vi, so texinfo stops complaining To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/dist/nvi/docs/vi.ref/vi.texi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/dist/nvi/docs/vi.ref/vi.texi diff -u src/dist/nvi/docs/vi.ref/vi.texi:1.2 src/dist/nvi/docs/vi.ref/vi.texi:1.3 --- src/dist/nvi/docs/vi.ref/vi.texi:1.2 Mon Sep 1 17:51:49 2008 +++ src/dist/nvi/docs/vi.ref/vi.texi Sun Nov 13 19:53:53 2011 @@ -1,5 +1,5 @@ \input texinfo -@c $NetBSD: vi.texi,v 1.2 2008/09/01 17:51:49 christos Exp $ +@c $NetBSD: vi.texi,v 1.3 2011/11/13 19:53:53 wiz Exp $ @setfilename vi.ref.info @setchapternewpage off @@ -18,6 +18,12 @@ @comment Id: vi.texi,v 8.1 2001/08/18 20:43:50 skimo Exp (Berkeley) Date: 2001/08/18 20:43:50 @comment @comment + +@dircategory Editors +@direntry +* vi: (vi.info).The vi editor. +@end direntry + @node Top,(dir),(dir),(dir) @menu * Vi Commands::
CVS commit: src/common/lib/libutil
Module Name:src Committed By: christos Date: Sun Nov 13 21:56:53 UTC 2011 Modified Files: src/common/lib/libutil: Makefile.inc Added Files: src/common/lib/libutil: getfstypename.c Log Message: Add a function to convert from a disklabel p_fstype integer to a dkw_ptype name. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/common/lib/libutil/Makefile.inc cvs rdiff -u -r0 -r1.1 src/common/lib/libutil/getfstypename.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libutil/Makefile.inc diff -u src/common/lib/libutil/Makefile.inc:1.3 src/common/lib/libutil/Makefile.inc:1.4 --- src/common/lib/libutil/Makefile.inc:1.3 Thu Oct 20 22:09:00 2011 +++ src/common/lib/libutil/Makefile.inc Sun Nov 13 16:56:53 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.3 2011/10/21 02:09:00 christos Exp $ +# $NetBSD: Makefile.inc,v 1.4 2011/11/13 21:56:53 christos Exp $ .PATH.c: ${.PARSEDIR} -SRCS+= snprintb.c proc_compare.c +SRCS+= snprintb.c proc_compare.c getfstypename.c COPTS.snprintb.c = -Wno-format-nonliteral Added files: Index: src/common/lib/libutil/getfstypename.c diff -u /dev/null src/common/lib/libutil/getfstypename.c:1.1 --- /dev/null Sun Nov 13 16:56:53 2011 +++ src/common/lib/libutil/getfstypename.c Sun Nov 13 16:56:53 2011 @@ -0,0 +1,118 @@ +/*- + * Copyright (c) 2011 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + *must display the following acknowledgement: + *This product includes software developed by the NetBSD + *Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + *contributors may be used to endorse or promote products derived + *from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include sys/cdefs.h +#ifndef _KERNEL +# if !defined(lint) +__RCSID($NetBSD: getfstypename.c,v 1.1 2011/11/13 21:56:53 christos Exp $); +# endif +#else +__KERNEL_RCSID(0, $NetBSD: getfstypename.c,v 1.1 2011/11/13 21:56:53 christos Exp $); +#endif + +#define FSTYPE_ENUMNAME fstype_enum +#include sys/types.h +#include sys/disk.h +#include sys/disklabel.h +#include util.h + +const char * +getfstypename(int fstype) +{ + switch ((enum fstype_enum)fstype) { + case FS_UNUSED: + return DKW_PTYPE_UNUSED; + case FS_SWAP: + return DKW_PTYPE_SWAP; + case FS_V6: + return DKW_PTYPE_V6; + case FS_V7: + return DKW_PTYPE_V7; + case FS_SYSV: + return DKW_PTYPE_SYSV; + case FS_V71K: + return DKW_PTYPE_V71K; + case FS_V8: + return DKW_PTYPE_V8; + case FS_BSDFFS: + return DKW_PTYPE_FFS; + case FS_MSDOS: + return DKW_PTYPE_FAT; + case FS_BSDLFS: + return DKW_PTYPE_LFS; + case FS_OTHER: + return DKW_PTYPE_OTHER; + case FS_HPFS: + return DKW_PTYPE_HPFS; + case FS_ISO9660: + return DKW_PTYPE_ISO9660; + case FS_BOOT: + return DKW_PTYPE_BOOT; + case FS_ADOS: + return DKW_PTYPE_AMIGADOS; + case FS_HFS: + return DKW_PTYPE_APPLEHFS; + case FS_FILECORE: + return DKW_PTYPE_FILECORE; + case FS_EX2FS: + return DKW_PTYPE_EXT2FS; + case FS_NTFS: + return DKW_PTYPE_NTFS; + case FS_RAID: + return DKW_PTYPE_RAIDFRAME; + case FS_CCD: + return DKW_PTYPE_CCD; + case FS_JFS2: + return DKW_PTYPE_JFS2; + case FS_APPLEUFS: + return DKW_PTYPE_APPLEUFS; + case FS_VINUM: + return DKW_PTYPE_VINUM; + case FS_UDF: + return DKW_PTYPE_UDF; + case FS_SYSVBFS: + return DKW_PTYPE_SYSVBFS; + case FS_EFS: + return
CVS commit: src/include
Module Name:src Committed By: christos Date: Sun Nov 13 21:57:15 UTC 2011 Modified Files: src/include: util.h Log Message: getfstypename addition To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/include/util.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/include/util.h diff -u src/include/util.h:1.59 src/include/util.h:1.60 --- src/include/util.h:1.59 Tue Aug 30 08:39:52 2011 +++ src/include/util.h Sun Nov 13 16:57:14 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: util.h,v 1.59 2011/08/30 12:39:52 bouyer Exp $ */ +/* $NetBSD: util.h,v 1.60 2011/11/13 21:57:14 christos Exp $ */ /*- * Copyright (c) 1995 @@ -73,6 +73,7 @@ int getlabelsector(void); int getlabelusesmbr(void); int getmaxpartitions(void); int getrawpartition(void); +const char *getfstypename(int); #ifndef __LIBC12_SOURCE__ void login(const struct utmp *) __RENAME(__login50); void loginx(const struct utmpx *) __RENAME(__loginx50);
CVS commit: src/lib/libutil
Module Name:src Committed By: christos Date: Sun Nov 13 22:03:34 UTC 2011 Modified Files: src/lib/libutil: Makefile Added Files: src/lib/libutil: getfstypename.3 Log Message: add manual page To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/lib/libutil/Makefile cvs rdiff -u -r0 -r1.1 src/lib/libutil/getfstypename.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/libutil/Makefile diff -u src/lib/libutil/Makefile:1.68 src/lib/libutil/Makefile:1.69 --- src/lib/libutil/Makefile:1.68 Thu Oct 20 22:05:36 2011 +++ src/lib/libutil/Makefile Sun Nov 13 17:03:34 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.68 2011/10/21 02:05:36 christos Exp $ +# $NetBSD: Makefile,v 1.69 2011/11/13 22:03:34 christos Exp $ # @(#)Makefile 8.1 (Berkeley) 6/4/93 USE_SHLIBDIR= yes @@ -21,9 +21,8 @@ SRCS+= efun.c getbootfile.c getlabelsect secure_path.c sockaddr_snprintf.c stat_flags.c \ strpct.c ttyaction.c ttymsg.c -MAN= efun.3 getbootfile.3 getlabelsector.3 getmaxpartitions.3 \ - getmntopts.3 \ - getrawpartition.3 \ +MAN= efun.3 getbootfile.3 getfstypename.3 getlabelsector.3 \ + getmaxpartitions.3 getmntopts.3 getrawpartition.3 \ login.3 login_cap.3 loginx.3 \ disklabel_dkcksum.3 disklabel_scan.3 \ opendisk.3 openpty.3 parsedate.3 pidfile.3 pidlock.3 \ Added files: Index: src/lib/libutil/getfstypename.3 diff -u /dev/null src/lib/libutil/getfstypename.3:1.1 --- /dev/null Sun Nov 13 17:03:34 2011 +++ src/lib/libutil/getfstypename.3 Sun Nov 13 17:03:34 2011 @@ -0,0 +1,63 @@ +.\ $NetBSD: getfstypename.3,v 1.1 2011/11/13 22:03:34 christos Exp $ +.\ +.\ +.\ Copyright (c) 2011 The NetBSD Foundation, Inc. +.\ All rights reserved. +.\ +.\ This code is derived from software contributed to The NetBSD Foundation +.\ by Christos Zoulas. +.\ +.\ Redistribution and use in source and binary forms, with or without +.\ modification, are permitted provided that the following conditions +.\ are met: +.\ 1. Redistributions of source code must retain the above copyright +.\notice, this list of conditions and the following disclaimer. +.\ 2. Redistributions in binary form must reproduce the above copyright +.\notice, this list of conditions and the following disclaimer in the +.\documentation and/or other materials provided with the distribution. +.\ 3. All advertising materials mentioning features or use of this software +.\must display the following acknowledgement: +.\This product includes software developed by the NetBSD +.\Foundation, Inc. and its contributors. +.\ 4. Neither the name of The NetBSD Foundation nor the names of its +.\contributors may be used to endorse or promote products derived +.\from this software without specific prior written permission. +.\ +.\ THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\ POSSIBILITY OF SUCH DAMAGE. +.\ +.Dd November 13, 2011 +.Dt GETFSTYPENAME 3 +.Os +.Sh NAME +.Nm getfstypename +.Nd convert a partition file system type integer to a wedge partition type name. +.Sh LIBRARY +.Lb libutil +.Sh SYNOPSIS +.In util.h +.Ft const char * +.Fn getfstypename int fstype +.Sh DESCRIPTION +.Fn getfstypename +returns the disk wedge partitition type name corresponding to the +.Ar fstype +argument as specified in +.In sys/disk.h +or +.Dv DKW_PTYPE_UNKNOWN +if one is not found. +.Sh HISTORY +The +.Fn getfstypename +function call appeared in +.Nx 6.0 .
CVS commit: src/sbin/fsck
Module Name:src Committed By: christos Date: Sun Nov 13 22:04:51 UTC 2011 Modified Files: src/sbin/fsck: partutil.c Log Message: use getfstypename To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sbin/fsck/partutil.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck/partutil.c diff -u src/sbin/fsck/partutil.c:1.10 src/sbin/fsck/partutil.c:1.11 --- src/sbin/fsck/partutil.c:1.10 Fri Mar 5 19:30:54 2010 +++ src/sbin/fsck/partutil.c Sun Nov 13 17:04:51 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: partutil.c,v 1.10 2010/03/06 00:30:54 christos Exp $ */ +/* $NetBSD: partutil.c,v 1.11 2011/11/13 22:04:51 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: partutil.c,v 1.10 2010/03/06 00:30:54 christos Exp $); +__RCSID($NetBSD: partutil.c,v 1.11 2011/11/13 22:04:51 christos Exp $); #include sys/types.h #include sys/disklabel.h @@ -109,47 +109,8 @@ part2wedge(struct dkwedge_info *dkw, con dkw-dkw_offset = pp-p_offset; dkw-dkw_size = pp-p_size; dkw-dkw_parent[0] = '*'; - switch (pp-p_fstype) { - default: - (void)strcpy(dkw-dkw_ptype, DKW_PTYPE_UNKNOWN); - break; - case FS_UNUSED: - (void)strcpy(dkw-dkw_ptype, DKW_PTYPE_UNUSED); - break; - case FS_SWAP: - (void)strcpy(dkw-dkw_ptype, DKW_PTYPE_SWAP); - break; - case FS_BSDFFS: - (void)strcpy(dkw-dkw_ptype, DKW_PTYPE_FFS); - break; - case FS_BSDLFS: - (void)strcpy(dkw-dkw_ptype, DKW_PTYPE_LFS); - break; - case FS_EX2FS: - (void)strcpy(dkw-dkw_ptype, DKW_PTYPE_EXT2FS); - break; - case FS_ISO9660: - (void)strcpy(dkw-dkw_ptype, DKW_PTYPE_ISO9660); - break; - case FS_ADOS: - (void)strcpy(dkw-dkw_ptype, DKW_PTYPE_AMIGADOS); - break; - case FS_HFS: - (void)strcpy(dkw-dkw_ptype, DKW_PTYPE_APPLEHFS); - break; - case FS_MSDOS: - (void)strcpy(dkw-dkw_ptype, DKW_PTYPE_FAT); - break; - case FS_FILECORE: - (void)strcpy(dkw-dkw_ptype, DKW_PTYPE_FILECORE); - break; - case FS_APPLEUFS: - (void)strcpy(dkw-dkw_ptype, DKW_PTYPE_APPLEUFS); - break; - case FS_NTFS: - (void)strcpy(dkw-dkw_ptype, DKW_PTYPE_NTFS); - break; - } + strlcpy(dkw-dkw_ptype, getfstypename(pp-p_fstype), + sizeof(dkw-dkw_ptype)); } int
CVS commit: src/sys/sys
Module Name:src Committed By: christos Date: Sun Nov 13 22:05:58 UTC 2011 Modified Files: src/sys/sys: device.h Log Message: add getdiskinfo a companion utility to getdisksize. To generate a diff of this commit: cvs rdiff -u -r1.139 -r1.140 src/sys/sys/device.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/device.h diff -u src/sys/sys/device.h:1.139 src/sys/sys/device.h:1.140 --- src/sys/sys/device.h:1.139 Sun Apr 24 14:46:24 2011 +++ src/sys/sys/device.h Sun Nov 13 17:05:58 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: device.h,v 1.139 2011/04/24 18:46:24 rmind Exp $ */ +/* $NetBSD: device.h,v 1.140 2011/11/13 22:05:58 christos Exp $ */ /* * Copyright (c) 1996, 2000 Christopher G. Demetriou @@ -428,6 +428,8 @@ extern int booted_partition; /* or the struct vnode *opendisk(struct device *); int getdisksize(struct vnode *, uint64_t *, unsigned *); +struct dkwedge_info; +int getdiskinfo(struct vnode *, struct dkwedge_info *); int config_handle_wedges(struct device *, int); void config_init(void);
CVS commit: src/sys/sys
Module Name:src Committed By: christos Date: Sun Nov 13 22:07:00 UTC 2011 Modified Files: src/sys/sys: disk.h disklabel.h Log Message: Sync the disklabel fstype info with the wedge partition info. From now on these will stay synchronized because if they don't getfstypeinfo will not compile. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/sys/disk.h cvs rdiff -u -r1.109 -r1.110 src/sys/sys/disklabel.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/disk.h diff -u src/sys/sys/disk.h:1.54 src/sys/sys/disk.h:1.55 --- src/sys/sys/disk.h:1.54 Tue May 19 23:26:21 2009 +++ src/sys/sys/disk.h Sun Nov 13 17:07:00 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: disk.h,v 1.54 2009/05/20 03:26:21 dyoung Exp $ */ +/* $NetBSD: disk.h,v 1.55 2011/11/13 22:07:00 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 2004 The NetBSD Foundation, Inc. @@ -217,18 +217,33 @@ __link_set_add_data(dkwedge_methods, nam #define DKW_PTYPE_UNKNOWN #define DKW_PTYPE_UNUSED unused #define DKW_PTYPE_SWAP swap +#define DKW_PTYPE_V6 v6 +#define DKW_PTYPE_V7 v7 +#define DKW_PTYPE_SYSV sysv +#define DKW_PTYPE_V71K v71k +#define DKW_PTYPE_V8 v8 #define DKW_PTYPE_FFS ffs +#define DKW_PTYPE_FAT msdos #define DKW_PTYPE_LFS lfs -#define DKW_PTYPE_EXT2FS ext2fs +#define DKW_PTYPE_OTHER other +#define DKW_PTYPE_HPFS hpfs #define DKW_PTYPE_ISO9660 cd9660 +#define DKW_PTYPE_BOOT boot #define DKW_PTYPE_AMIGADOS ados -#define DKW_PTYPE_APPLEHFS hfs -#define DKW_PTYPE_FAT msdos +#define DKW_PTYPE_HFS hfs #define DKW_PTYPE_FILECORE filecore +#define DKW_PTYPE_EXT2FS ext2fs +#define DKW_PTYPE_NTFS ntfs #define DKW_PTYPE_RAIDFRAME raidframe #define DKW_PTYPE_CCD ccd +#define DKW_PTYPE_JFS2 jfs2 #define DKW_PTYPE_APPLEUFS appleufs -#define DKW_PTYPE_NTFS ntfs +#define DKW_PTYPE_VINUM vinum +#define DKW_PTYPE_UDF udf +#define DKW_PTYPE_APPLEHFS hfs +#define DKW_PTYPE_SYSVBFS sysvbfs +#define DKW_PTYPE_EFS efs +#define DKW_PTYPE_NILFS nilfs #define DKW_PTYPE_CGD cgd /* Index: src/sys/sys/disklabel.h diff -u src/sys/sys/disklabel.h:1.109 src/sys/sys/disklabel.h:1.110 --- src/sys/sys/disklabel.h:1.109 Mon Jun 27 07:52:24 2011 +++ src/sys/sys/disklabel.h Sun Nov 13 17:07:00 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: disklabel.h,v 1.109 2011/06/27 11:52:24 uch Exp $ */ +/* $NetBSD: disklabel.h,v 1.110 2011/11/13 22:07:00 christos Exp $ */ /* * Copyright (c) 1987, 1988, 1993 @@ -311,7 +311,10 @@ x(RUMPD, 21, rumpd) /* rump virtua #ifndef _LOCORE #define DKTYPE_NUMS(tag, number, name) __CONCAT(DTYPE_,tag=number), -enum { DKTYPE_DEFN(DKTYPE_NUMS) DKMAXTYPES }; +#ifndef DKTYPE_ENUMNAME +#define DKTYPE_ENUMNAME +#endif +enum DKTYPE_ENUMNAME { DKTYPE_DEFN(DKTYPE_NUMS) DKMAXTYPES }; #undef DKTYPE_NUMS #endif @@ -353,12 +356,16 @@ x(VINUM, 23, vinum, NULL,NU x(UDF, 24, UDF,NULL, udf) /* UDF */ \ x(SYSVBFS, 25, SysVBFS,NULL, sysvbfs)/* System V boot file system */ \ x(EFS, 26, EFS,NULL, efs) /* SGI's Extent Filesystem */ \ -x(NILFS, 27, NiLFS, NULL, nilfs) /* NTT's NiLFS(2) */ +x(NILFS, 27, NiLFS, NULL, nilfs) /* NTT's NiLFS(2) */ \ +x(CGD, 28, cgd, NULL, NULL)/* Cryptographic disk */ #ifndef _LOCORE #define FS_TYPENUMS(tag, number, name, fsck, mount) __CONCAT(FS_,tag=number), -enum { FSTYPE_DEFN(FS_TYPENUMS) FSMAXTYPES }; +#ifndef FSTYPE_ENUMNAME +#define FSTYPE_ENUMNAME +#endif +enum FSTYPE_ENUMNAME { FSTYPE_DEFN(FS_TYPENUMS) FSMAXTYPES }; #undef FS_TYPENUMS #endif @@ -455,6 +462,7 @@ const char *convertdisklabel(struct disk struct buf *, uint32_t); int bounds_check_with_label(struct disk *, struct buf *, int); int bounds_check_with_mediasize(struct buf *, int, uint64_t); +const char *getfstypeinfo(int); #endif #endif /* _LOCORE */
CVS commit: src/sys/sys
Module Name:src Committed By: christos Date: Sun Nov 13 22:19:09 UTC 2011 Modified Files: src/sys/sys: disklabel.h Log Message: s/info/name To generate a diff of this commit: cvs rdiff -u -r1.110 -r1.111 src/sys/sys/disklabel.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/disklabel.h diff -u src/sys/sys/disklabel.h:1.110 src/sys/sys/disklabel.h:1.111 --- src/sys/sys/disklabel.h:1.110 Sun Nov 13 17:07:00 2011 +++ src/sys/sys/disklabel.h Sun Nov 13 17:19:09 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: disklabel.h,v 1.110 2011/11/13 22:07:00 christos Exp $ */ +/* $NetBSD: disklabel.h,v 1.111 2011/11/13 22:19:09 christos Exp $ */ /* * Copyright (c) 1987, 1988, 1993 @@ -462,7 +462,7 @@ const char *convertdisklabel(struct disk struct buf *, uint32_t); int bounds_check_with_label(struct disk *, struct buf *, int); int bounds_check_with_mediasize(struct buf *, int, uint64_t); -const char *getfstypeinfo(int); +const char *getfstypename(int); #endif #endif /* _LOCORE */
CVS commit: src/common/lib/libutil
Module Name:src Committed By: christos Date: Sun Nov 13 22:21:29 UTC 2011 Modified Files: src/common/lib/libutil: getfstypename.c Log Message: the kernel does not have util.h To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/common/lib/libutil/getfstypename.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libutil/getfstypename.c diff -u src/common/lib/libutil/getfstypename.c:1.1 src/common/lib/libutil/getfstypename.c:1.2 --- src/common/lib/libutil/getfstypename.c:1.1 Sun Nov 13 16:56:53 2011 +++ src/common/lib/libutil/getfstypename.c Sun Nov 13 17:21:29 2011 @@ -36,17 +36,19 @@ #include sys/cdefs.h #ifndef _KERNEL # if !defined(lint) -__RCSID($NetBSD: getfstypename.c,v 1.1 2011/11/13 21:56:53 christos Exp $); +__RCSID($NetBSD: getfstypename.c,v 1.2 2011/11/13 22:21:29 christos Exp $); # endif #else -__KERNEL_RCSID(0, $NetBSD: getfstypename.c,v 1.1 2011/11/13 21:56:53 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: getfstypename.c,v 1.2 2011/11/13 22:21:29 christos Exp $); #endif #define FSTYPE_ENUMNAME fstype_enum #include sys/types.h #include sys/disk.h #include sys/disklabel.h +#ifndef _KERNEL #include util.h +#endif const char * getfstypename(int fstype)
CVS commit: src/distrib/sets/lists/comp
Module Name:src Committed By: christos Date: Sun Nov 13 22:25:23 UTC 2011 Modified Files: src/distrib/sets/lists/comp: mi Log Message: add getfstypename To generate a diff of this commit: cvs rdiff -u -r1.1706 -r1.1707 src/distrib/sets/lists/comp/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.1706 src/distrib/sets/lists/comp/mi:1.1707 --- src/distrib/sets/lists/comp/mi:1.1706 Thu Nov 10 09:03:02 2011 +++ src/distrib/sets/lists/comp/mi Sun Nov 13 17:25:21 2011 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1706 2011/11/10 14:03:02 yamt Exp $ +# $NetBSD: mi,v 1.1707 2011/11/13 22:25:21 christos Exp $ # # Note: don't delete entries from here - mark them as obsolete instead. # @@ -6657,6 +6657,7 @@ ./usr/share/man/cat3/getfsfile.0 comp-c-catman .cat ./usr/share/man/cat3/getfsspec.0 comp-c-catman .cat ./usr/share/man/cat3/getfstype.0 comp-obsolete obsolete +./usr/share/man/cat3/getfstypename.0 comp-c-catman .cat ./usr/share/man/cat3/getgrent.0 comp-c-catman .cat ./usr/share/man/cat3/getgrent_r.0 comp-c-catman .cat ./usr/share/man/cat3/getgrgid.0 comp-c-catman .cat @@ -12883,6 +12884,7 @@ ./usr/share/man/html3/getfsent.html comp-c-htmlman html ./usr/share/man/html3/getfsfile.html comp-c-htmlman html ./usr/share/man/html3/getfsspec.html comp-c-htmlman html +./usr/share/man/html3/getfstypename.html comp-c-htmlman html ./usr/share/man/html3/getgrent.html comp-c-htmlman html ./usr/share/man/html3/getgrent_r.html comp-c-htmlman html ./usr/share/man/html3/getgrgid.html comp-c-htmlman html @@ -19025,6 +19027,7 @@ ./usr/share/man/man3/getfsfile.3 comp-c-man .man ./usr/share/man/man3/getfsspec.3 comp-c-man .man ./usr/share/man/man3/getfstype.3 comp-obsolete obsolete +./usr/share/man/man3/getfstypename.3 comp-c-man .man ./usr/share/man/man3/getgrent.3 comp-c-man .man ./usr/share/man/man3/getgrent_r.3 comp-c-man .man ./usr/share/man/man3/getgrgid.3 comp-c-man .man
CVS commit: src/sys/kern
Module Name:src Committed By: christos Date: Sun Nov 13 22:54:05 UTC 2011 Modified Files: src/sys/kern: subr_disk_open.c Log Message: Add getdiskinfo() to centralize the DIOCGPART mess in one place. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/kern/subr_disk_open.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/subr_disk_open.c diff -u src/sys/kern/subr_disk_open.c:1.3 src/sys/kern/subr_disk_open.c:1.4 --- src/sys/kern/subr_disk_open.c:1.3 Sat Jul 30 08:08:36 2011 +++ src/sys/kern/subr_disk_open.c Sun Nov 13 17:54:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_disk_open.c,v 1.3 2011/07/30 12:08:36 jmcneill Exp $ */ +/* $NetBSD: subr_disk_open.c,v 1.4 2011/11/13 22:54:05 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: subr_disk_open.c,v 1.3 2011/07/30 12:08:36 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: subr_disk_open.c,v 1.4 2011/11/13 22:54:05 christos Exp $); #include sys/param.h #include sys/conf.h @@ -37,6 +37,7 @@ __KERNEL_RCSID(0, $NetBSD: subr_disk_op #include sys/fcntl.h #include sys/kauth.h #include sys/vnode.h +#include miscfs/specfs/specdev.h struct vnode * opendisk(struct device *dv) @@ -108,3 +109,33 @@ getdisksize(struct vnode *vp, uint64_t * return error; } + +int +getdiskinfo(struct vnode *vp, struct dkwedge_info *dkw) +{ + struct partinfo dpart; + int error; + dev_t dev = vp-v_specnode-sn_rdev; + + if (VOP_IOCTL(vp, DIOCGWEDGEINFO, dkw, FREAD, NOCRED) == 0) + return 0; + + if ((error = VOP_IOCTL(vp, DIOCGPART, dpart, FREAD, NOCRED)) != 0) + return error; + + snprintf(dkw-dkw_devname, sizeof(dkw-dkw_devname), %s% PRId32 %c, + devsw_blk2name(major(dev)), DISKUNIT(dev), (char)DISKPART(dev) + + 'a'); + + dkw-dkw_wname[0] = '\0'; + + strlcpy(dkw-dkw_parent, dkw-dkw_devname, sizeof(dkw-dkw_parent)); + + dkw-dkw_size = dpart.part-p_size; + dkw-dkw_offset = dpart.part-p_offset; + + strlcpy(dkw-dkw_ptype, getfstypename(dpart.part-p_fstype), + sizeof(dkw-dkw_ptype)); + + return 0; +}
CVS commit: src/sys/arch/xen/xen
Module Name:src Committed By: christos Date: Sun Nov 13 23:02:06 UTC 2011 Modified Files: src/sys/arch/xen/xen: xbdback_xenbus.c Log Message: use getdiskinfo() To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/arch/xen/xen/xbdback_xenbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/xen/xbdback_xenbus.c diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.48 src/sys/arch/xen/xen/xbdback_xenbus.c:1.49 --- src/sys/arch/xen/xen/xbdback_xenbus.c:1.48 Tue Oct 25 13:25:47 2011 +++ src/sys/arch/xen/xen/xbdback_xenbus.c Sun Nov 13 18:02:06 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: xbdback_xenbus.c,v 1.48 2011/10/25 17:25:47 bouyer Exp $ */ +/* $NetBSD: xbdback_xenbus.c,v 1.49 2011/11/13 23:02:06 christos Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: xbdback_xenbus.c,v 1.48 2011/10/25 17:25:47 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: xbdback_xenbus.c,v 1.49 2011/11/13 23:02:06 christos Exp $); #include sys/types.h #include sys/param.h @@ -37,7 +37,7 @@ __KERNEL_RCSID(0, $NetBSD: xbdback_xenb #include sys/atomic.h #include sys/conf.h #include sys/disk.h -#include sys/disklabel.h +#include sys/device.h #include sys/fcntl.h #include sys/vnode.h #include sys/kauth.h @@ -760,27 +760,12 @@ xbdback_backend_changed(struct xenbus_wa /* dk device; get wedge data */ struct dkwedge_info wi; - if ((err = VOP_IOCTL(xbdi-xbdi_vp, DIOCGWEDGEINFO, wi, - FREAD, NOCRED)) == 0) { + if ((err = getdiskinfo(xbdi-xbdi_vp, wi)) == 0) { xbdi-xbdi_size = wi.dkw_size; printf(xbd backend: attach device %s (size % PRIu64 ) for domain %d\n, wi.dkw_devname, xbdi-xbdi_size, xbdi-xbdi_domid); - } else { - /* disk device, get partition data */ - struct partinfo dpart; - if ((err = VOP_IOCTL(xbdi-xbdi_vp, DIOCGPART, dpart, - FREAD, 0)) == 0) { - xbdi-xbdi_size = dpart.part-p_size; - printf(xbd backend: attach device %s%PRId32 - %c (size % PRIu64 ) for domain %d\n, - devname, DISKUNIT(xbdi-xbdi_dev), - (char)DISKPART(xbdi-xbdi_dev) + 'a', xbdi-xbdi_size, - xbdi-xbdi_domid); - } - } - - if (err != 0) { + } else { /* If both Ioctls failed set device size to 0 and return */ printf(xbdback %s: can't DIOCGWEDGEINFO device 0x%PRIx64: %d\n, xbusd-xbusd_path,
CVS commit: src/sys/dev
Module Name:src Committed By: christos Date: Sun Nov 13 23:02:46 UTC 2011 Modified Files: src/sys/dev: ccd.c Log Message: use getdisksize To generate a diff of this commit: cvs rdiff -u -r1.142 -r1.143 src/sys/dev/ccd.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/ccd.c diff -u src/sys/dev/ccd.c:1.142 src/sys/dev/ccd.c:1.143 --- src/sys/dev/ccd.c:1.142 Fri Oct 14 05:23:29 2011 +++ src/sys/dev/ccd.c Sun Nov 13 18:02:46 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ccd.c,v 1.142 2011/10/14 09:23:29 hannken Exp $ */ +/* $NetBSD: ccd.c,v 1.143 2011/11/13 23:02:46 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc. @@ -88,7 +88,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ccd.c,v 1.142 2011/10/14 09:23:29 hannken Exp $); +__KERNEL_RCSID(0, $NetBSD: ccd.c,v 1.143 2011/11/13 23:02:46 christos Exp $); #include sys/param.h #include sys/systm.h @@ -255,15 +255,13 @@ ccdinit(struct ccd_softc *cs, char **cpa struct lwp *l) { struct ccdcinfo *ci = NULL; - size_t size; int ix; struct vattr va; - size_t minsize; - int maxsecsize; - struct partinfo dpart; struct ccdgeom *ccg = cs-sc_geom; char *tmppath; int error, path_alloced; + uint64_t psize, minsize; + unsigned secsize, maxsecsize; #ifdef DEBUG if (ccddebug (CCDB_FOLLOW|CCDB_INIT)) @@ -327,40 +325,25 @@ ccdinit(struct ccd_softc *cs, char **cpa /* * Get partition information for the component. */ - error = VOP_IOCTL(vpp[ix], DIOCGPART, dpart, - FREAD, l-l_cred); + error = getdisksize(vpp[ix], psize, secsize); if (error) { #ifdef DEBUG if (ccddebug (CCDB_FOLLOW|CCDB_INIT)) - printf(%s: %s: ioctl failed, error = %d\n, + printf(%s: %s: disksize failed, error = %d\n, cs-sc_xname, ci-ci_path, error); #endif goto out; } -/* - * This diagnostic test is disabled (for now?) since not all port supports - * on-disk BSD disklabel. - */ -#if 0 /* def DIAGNOSTIC */ - /* Check fstype field of component. */ - if (dpart.part-p_fstype != FS_CCD) - printf(%s: WARNING: %s: fstype %d != FS_CCD\n, - cs-sc_xname, ci-ci_path, dpart.part-p_fstype); -#endif - /* * Calculate the size, truncating to an interleave * boundary if necessary. */ - maxsecsize = - ((dpart.disklab-d_secsize maxsecsize) ? - dpart.disklab-d_secsize : maxsecsize); - size = dpart.part-p_size; + maxsecsize = secsize maxsecsize ? secsize : maxsecsize; if (cs-sc_ileave 1) - size -= size % cs-sc_ileave; + psize -= psize % cs-sc_ileave; - if (size == 0) { + if (psize == 0) { #ifdef DEBUG if (ccddebug (CCDB_FOLLOW|CCDB_INIT)) printf(%s: %s: size == 0\n, @@ -370,10 +353,10 @@ ccdinit(struct ccd_softc *cs, char **cpa goto out; } - if (minsize == 0 || size minsize) - minsize = size; - ci-ci_size = size; - cs-sc_size += size; + if (minsize == 0 || psize minsize) + minsize = psize; + ci-ci_size = psize; + cs-sc_size += psize; } /*
CVS commit: src/sys/dev
Module Name:src Committed By: christos Date: Sun Nov 13 23:03:24 UTC 2011 Modified Files: src/sys/dev: cgd.c Log Message: use getdisksize() instead of homebrew() To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/sys/dev/cgd.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/cgd.c diff -u src/sys/dev/cgd.c:1.75 src/sys/dev/cgd.c:1.76 --- src/sys/dev/cgd.c:1.75 Fri Oct 14 05:23:30 2011 +++ src/sys/dev/cgd.c Sun Nov 13 18:03:24 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cgd.c,v 1.75 2011/10/14 09:23:30 hannken Exp $ */ +/* $NetBSD: cgd.c,v 1.76 2011/11/13 23:03:24 christos Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cgd.c,v 1.75 2011/10/14 09:23:30 hannken Exp $); +__KERNEL_RCSID(0, $NetBSD: cgd.c,v 1.76 2011/11/13 23:03:24 christos Exp $); #include sys/types.h #include sys/param.h @@ -731,36 +731,15 @@ cgd_ioctl_clr(struct cgd_softc *cs, stru } static int -getsize(struct lwp *l, struct vnode *vp, size_t *size) -{ - struct partinfo dpart; - struct dkwedge_info dkw; - int ret; - - if ((ret = VOP_IOCTL(vp, DIOCGWEDGEINFO, dkw, FREAD, - l-l_cred)) == 0) { - *size = dkw.dkw_size; - return 0; - } - - if ((ret = VOP_IOCTL(vp, DIOCGPART, dpart, FREAD, l-l_cred)) == 0) { - *size = dpart.part-p_size; - return 0; - } - - return ret; -} - - -static int cgdinit(struct cgd_softc *cs, const char *cpath, struct vnode *vp, struct lwp *l) { struct dk_geom *pdg; struct vattr va; - size_t size; int ret; char *tmppath; + uint64_t psize; + unsigned secsize; cs-sc_dksc.sc_size = 0; cs-sc_tvn = vp; @@ -781,15 +760,15 @@ cgdinit(struct cgd_softc *cs, const char cs-sc_tdev = va.va_rdev; - if ((ret = getsize(l, vp, size)) != 0) + if ((ret = getdisksize(vp, psize, secsize)) != 0) goto bail; - if (!size) { + if (psize == 0) { ret = ENODEV; goto bail; } - cs-sc_dksc.sc_size = size; + cs-sc_dksc.sc_size = psize; /* * XXX here we should probe the underlying device. If we
CVS commit: src/sys/fs/hfs
Module Name:src Committed By: christos Date: Sun Nov 13 23:03:55 UTC 2011 Modified Files: src/sys/fs/hfs: hfs_subr.c Log Message: use getdisksize() To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/fs/hfs/hfs_subr.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/fs/hfs/hfs_subr.c diff -u src/sys/fs/hfs/hfs_subr.c:1.15 src/sys/fs/hfs/hfs_subr.c:1.16 --- src/sys/fs/hfs/hfs_subr.c:1.15 Thu Feb 24 18:48:59 2011 +++ src/sys/fs/hfs/hfs_subr.c Sun Nov 13 18:03:55 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hfs_subr.c,v 1.15 2011/02/24 23:48:59 christos Exp $ */ +/* $NetBSD: hfs_subr.c,v 1.16 2011/11/13 23:03:55 christos Exp $ */ /*- * Copyright (c) 2005, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: hfs_subr.c,v 1.15 2011/02/24 23:48:59 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: hfs_subr.c,v 1.16 2011/11/13 23:03:55 christos Exp $); #include sys/param.h #include sys/systm.h @@ -43,7 +43,7 @@ __KERNEL_RCSID(0, $NetBSD: hfs_subr.c,v #include sys/file.h #include sys/filedesc.h #include sys/mount.h -#include sys/disklabel.h +#include sys/device.h #include sys/conf.h #include sys/kauth.h #include sys/buf.h @@ -155,8 +155,9 @@ hfs_libcb_opendev( { hfs_libcb_data* cbdata = NULL; hfs_libcb_argsopen* args; - struct partinfo dpart; int result, mode; + uint64_t psize; + unsigned secsize; result = 0; args = (hfs_libcb_argsopen*)(cbargs-openvol); @@ -193,11 +194,10 @@ hfs_libcb_opendev( cbdata-devvp = args-devvp; /* Determine the device's block size. Default to DEV_BSIZE if unavailable.*/ - if (VOP_IOCTL(args-devvp, DIOCGPART, dpart, FREAD, args-cred) - != 0) + if (getdisksize(args-devvp, psize, secsize) != 0) cbdata-devblksz = DEV_BSIZE; else - cbdata-devblksz = dpart.disklab-d_secsize; + cbdata-devblksz = secsize; return 0;
CVS commit: src/sys/fs/sysvbfs
Module Name:src Committed By: christos Date: Sun Nov 13 23:07:11 UTC 2011 Modified Files: src/sys/fs/sysvbfs: sysvbfs_vfsops.c Log Message: remove unused call to DIOCGPART that was only used for debugging. malloc M_WAITOK, does not fail. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/fs/sysvbfs/sysvbfs_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/sysvbfs/sysvbfs_vfsops.c diff -u src/sys/fs/sysvbfs/sysvbfs_vfsops.c:1.37 src/sys/fs/sysvbfs/sysvbfs_vfsops.c:1.38 --- src/sys/fs/sysvbfs/sysvbfs_vfsops.c:1.37 Wed Jul 13 15:51:29 2011 +++ src/sys/fs/sysvbfs/sysvbfs_vfsops.c Sun Nov 13 18:07:11 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sysvbfs_vfsops.c,v 1.37 2011/07/13 19:51:29 njoly Exp $ */ +/* $NetBSD: sysvbfs_vfsops.c,v 1.38 2011/11/13 23:07:11 christos Exp $ */ /*- * Copyright (c) 2004 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sysvbfs_vfsops.c,v 1.37 2011/07/13 19:51:29 njoly Exp $); +__KERNEL_RCSID(0, $NetBSD: sysvbfs_vfsops.c,v 1.38 2011/11/13 23:07:11 christos Exp $); #include sys/types.h #include sys/param.h @@ -39,7 +39,6 @@ __KERNEL_RCSID(0, $NetBSD: sysvbfs_vfso #include sys/time.h #include sys/ucred.h #include sys/mount.h -#include sys/disklabel.h #include sys/fcntl.h #include sys/malloc.h #include sys/kauth.h @@ -163,7 +162,6 @@ sysvbfs_mountfs(struct vnode *devvp, str { kauth_cred_t cred = l-l_cred; struct sysvbfs_mount *bmp; - struct partinfo dpart; int error, oflags; bool devopen = false; @@ -180,16 +178,7 @@ sysvbfs_mountfs(struct vnode *devvp, str goto out; devopen = true; - /* Get partition information */ - if ((error = VOP_IOCTL(devvp, DIOCGPART, dpart, FREAD, cred)) != 0) { - goto out; - } - - bmp = malloc(sizeof(struct sysvbfs_mount), M_SYSVBFS_VFS, M_WAITOK); - if (bmp == NULL) { - error = ENOMEM; - goto out; - } + bmp = malloc(sizeof(*bmp), M_SYSVBFS_VFS, M_WAITOK | M_ZERO); bmp-devvp = devvp; bmp-mountp = mp; if ((error = sysvbfs_bfs_init(bmp-bfs, devvp)) != 0) { @@ -207,10 +196,6 @@ sysvbfs_mountfs(struct vnode *devvp, str mp-mnt_dev_bshift = BFS_BSHIFT; mp-mnt_fs_bshift = BFS_BSHIFT; - DPRINTF(%s: fstype=%d dtype=%d bsize=%d\n, __func__, - dpart.part-p_fstype, dpart.disklab-d_type, - dpart.disklab-d_secsize); - out: if (devopen error) VOP_CLOSE(devvp, oflags, NOCRED);
CVS commit: src/sys/fs/udf
Module Name:src Committed By: christos Date: Sun Nov 13 23:08:47 UTC 2011 Modified Files: src/sys/fs/udf: udf_subr.c Log Message: use getdisksize() To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.118 src/sys/fs/udf/udf_subr.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/fs/udf/udf_subr.c diff -u src/sys/fs/udf/udf_subr.c:1.117 src/sys/fs/udf/udf_subr.c:1.118 --- src/sys/fs/udf/udf_subr.c:1.117 Mon Sep 26 21:13:16 2011 +++ src/sys/fs/udf/udf_subr.c Sun Nov 13 18:08:47 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: udf_subr.c,v 1.117 2011/09/27 01:13:16 christos Exp $ */ +/* $NetBSD: udf_subr.c,v 1.118 2011/11/13 23:08:47 christos Exp $ */ /* * Copyright (c) 2006, 2008 Reinoud Zandijk @@ -29,7 +29,7 @@ #include sys/cdefs.h #ifndef lint -__KERNEL_RCSID(0, $NetBSD: udf_subr.c,v 1.117 2011/09/27 01:13:16 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: udf_subr.c,v 1.118 2011/11/13 23:08:47 christos Exp $); #endif /* not lint */ @@ -188,7 +188,8 @@ int udf_update_discinfo(struct udf_mount *ump) { struct vnode *devvp = ump-devvp; - struct partinfo dpart; + uint64_t psize; + unsigned secsize; struct mmc_discinfo *di; int error; @@ -204,9 +205,9 @@ udf_update_discinfo(struct udf_mount *um } /* disc partition support */ - error = VOP_IOCTL(devvp, DIOCGPART, dpart, FREAD, NOCRED); + error = getdisksize(devvp, psize, secsize); if (error) - return ENODEV; + return error; /* set up a disc info profile for partitions */ di-mmc_profile = 0x01; /* disc type */ @@ -222,8 +223,8 @@ udf_update_discinfo(struct udf_mount *um di-disc_flags = MMC_DFLAGS_UNRESTRICTED; /* TODO problem with last_possible_lba on resizable VND; request */ - di-last_possible_lba = dpart.part-p_size; - di-sector_size = dpart.disklab-d_secsize; + di-last_possible_lba = psize; + di-sector_size = secsize; di-num_sessions = 1; di-num_tracks = 1;
CVS commit: src/sys/fs/v7fs
Module Name:src Committed By: christos Date: Sun Nov 13 23:09:58 UTC 2011 Modified Files: src/sys/fs/v7fs: v7fs_vfsops.c Log Message: use getdisksize() To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/fs/v7fs/v7fs_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/v7fs/v7fs_vfsops.c diff -u src/sys/fs/v7fs/v7fs_vfsops.c:1.4 src/sys/fs/v7fs/v7fs_vfsops.c:1.5 --- src/sys/fs/v7fs/v7fs_vfsops.c:1.4 Fri Jul 29 23:53:18 2011 +++ src/sys/fs/v7fs/v7fs_vfsops.c Sun Nov 13 18:09:58 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_vfsops.c,v 1.4 2011/07/30 03:53:18 uch Exp $ */ +/* $NetBSD: v7fs_vfsops.c,v 1.5 2011/11/13 23:09:58 christos Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.4 2011/07/30 03:53:18 uch Exp $); +__KERNEL_RCSID(0, $NetBSD: v7fs_vfsops.c,v 1.5 2011/11/13 23:09:58 christos Exp $); #if defined _KERNEL_OPT #include opt_v7fs.h #endif @@ -42,7 +42,8 @@ __KERNEL_RCSID(0, $NetBSD: v7fs_vfsops. #include sys/time.h #include sys/ucred.h #include sys/mount.h -#include sys/disklabel.h +#include sys/disk.h +#include sys/device.h #include sys/fcntl.h #include sys/malloc.h #include sys/kauth.h @@ -189,17 +190,16 @@ v7fs_mount(struct mount *mp, const char static int is_v7fs_partition(struct vnode *devvp) { - struct partinfo dpart; + struct dkwedge_info dkw; int error; - if ((error = VOP_IOCTL(devvp, DIOCGPART, dpart, FREAD, NOCRED)) != 0) { - DPRINTF(VOP_IOCTL=%d\n, error); + if ((error = getdiskinfo(devvp, dkw)) != 0) { + DPRINTF(getdiskinfo=%d\n, error); return error; } - DPRINTF(fstype=%d dtype=%d bsize=%d\n, dpart.part-p_fstype, - dpart.disklab-d_type, dpart.disklab-d_secsize); + DPRINTF(ptype=%s size=% PRIu64 \n, dkw.dkw_ptype, dkw-dkw_size); - return (dpart.part-p_fstype == FS_V7) ? 0 : EINVAL; + return strcmp(dkw.dkw_ptype, DKW_PTYPE_V7) == 0 ? 0 : EINVAL; } static int
CVS commit: src/sys/ufs/ffs
Module Name:src Committed By: christos Date: Sun Nov 13 23:10:40 UTC 2011 Modified Files: src/sys/ufs/ffs: ffs_vfsops.c Log Message: use getdiskinfo() To generate a diff of this commit: cvs rdiff -u -r1.269 -r1.270 src/sys/ufs/ffs/ffs_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ffs/ffs_vfsops.c diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.269 src/sys/ufs/ffs/ffs_vfsops.c:1.270 --- src/sys/ufs/ffs/ffs_vfsops.c:1.269 Fri Oct 7 05:35:07 2011 +++ src/sys/ufs/ffs/ffs_vfsops.c Sun Nov 13 18:10:34 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_vfsops.c,v 1.269 2011/10/07 09:35:07 hannken Exp $ */ +/* $NetBSD: ffs_vfsops.c,v 1.270 2011/11/13 23:10:34 christos Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ffs_vfsops.c,v 1.269 2011/10/07 09:35:07 hannken Exp $); +__KERNEL_RCSID(0, $NetBSD: ffs_vfsops.c,v 1.270 2011/11/13 23:10:34 christos Exp $); #if defined(_KERNEL_OPT) #include opt_ffs.h @@ -79,6 +79,7 @@ __KERNEL_RCSID(0, $NetBSD: ffs_vfsops.c #include sys/mount.h #include sys/buf.h #include sys/device.h +#include sys/disk.h #include sys/mbuf.h #include sys/file.h #include sys/disklabel.h @@ -614,7 +615,7 @@ ffs_reload(struct mount *mp, kauth_cred_ void *space; struct buf *bp; struct fs *fs, *newfs; - struct partinfo dpart; + struct dkwedge_info dkw; int i, bsize, blks, error; int32_t *lp; struct ufsmount *ump; @@ -683,10 +684,9 @@ ffs_reload(struct mount *mp, kauth_cred_ /* First check to see if this is tagged as an Apple UFS filesystem * in the disklabel */ - if ((VOP_IOCTL(devvp, DIOCGPART, dpart, FREAD, cred) == 0) - (dpart.part-p_fstype == FS_APPLEUFS)) { + if (getdiskinfo(devvp, dkw) == 0 + strcmp(dkw.dkw_ptype, DKW_PTYPE_APPLEUFS) == 0) ump-um_flags |= UFS_ISAPPLEUFS; - } #ifdef APPLE_UFS else { /* Manually look for an apple ufs label, and if a valid one @@ -852,7 +852,7 @@ ffs_mountfs(struct vnode *devvp, struct struct buf *bp; struct fs *fs; dev_t dev; - struct partinfo dpart; + struct dkwedge_info dkw; void *space; daddr_t sblockloc, fsblockloc; int blks, fstype; @@ -1061,10 +1061,9 @@ ffs_mountfs(struct vnode *devvp, struct /* First check to see if this is tagged as an Apple UFS filesystem * in the disklabel */ - if ((VOP_IOCTL(devvp, DIOCGPART, dpart, FREAD, cred) == 0) - (dpart.part-p_fstype == FS_APPLEUFS)) { + if (getdiskinfo(devvp, dkw) == 0 + strcmp(dkw.dkw_ptype, DKW_PTYPE_APPLEUFS) == 0) ump-um_flags |= UFS_ISAPPLEUFS; - } #ifdef APPLE_UFS else { /* Manually look for an apple ufs label, and if a valid one
CVS commit: src/lib/libutil
Module Name:src Committed By: wiz Date: Sun Nov 13 23:49:39 UTC 2011 Modified Files: src/lib/libutil: getfstypename.3 Log Message: Remove trailing dot; slightly improve wording. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libutil/getfstypename.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/libutil/getfstypename.3 diff -u src/lib/libutil/getfstypename.3:1.1 src/lib/libutil/getfstypename.3:1.2 --- src/lib/libutil/getfstypename.3:1.1 Sun Nov 13 22:03:34 2011 +++ src/lib/libutil/getfstypename.3 Sun Nov 13 23:49:39 2011 @@ -1,5 +1,4 @@ -.\ $NetBSD: getfstypename.3,v 1.1 2011/11/13 22:03:34 christos Exp $ -.\ +.\ $NetBSD: getfstypename.3,v 1.2 2011/11/13 23:49:39 wiz Exp $ .\ .\ Copyright (c) 2011 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -40,7 +39,7 @@ .Os .Sh NAME .Nm getfstypename -.Nd convert a partition file system type integer to a wedge partition type name. +.Nd convert a partition file system type integer to a wedge partition type name .Sh LIBRARY .Lb libutil .Sh SYNOPSIS @@ -55,7 +54,7 @@ argument as specified in .In sys/disk.h or .Dv DKW_PTYPE_UNKNOWN -if one is not found. +if none is found. .Sh HISTORY The .Fn getfstypename
CVS commit: src/sys/arch/evbarm/conf
Module Name:src Committed By: sekiya Date: Mon Nov 14 00:12:37 UTC 2011 Modified Files: src/sys/arch/evbarm/conf: SHEEVAPLUG Log Message: Increase SYMTAB_SPACE. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/conf/SHEEVAPLUG 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/evbarm/conf/SHEEVAPLUG diff -u src/sys/arch/evbarm/conf/SHEEVAPLUG:1.9 src/sys/arch/evbarm/conf/SHEEVAPLUG:1.10 --- src/sys/arch/evbarm/conf/SHEEVAPLUG:1.9 Sat Jul 23 21:12:57 2011 +++ src/sys/arch/evbarm/conf/SHEEVAPLUG Mon Nov 14 00:12:37 2011 @@ -1,4 +1,4 @@ -# $NetBSD: SHEEVAPLUG,v 1.9 2011/07/23 21:12:57 jakllsch Exp $ +# $NetBSD: SHEEVAPLUG,v 1.10 2011/11/14 00:12:37 sekiya Exp $ # # This configuration supports for generically Marvell SheevaPlug # @@ -163,7 +163,7 @@ options DDB # in-kernel debugger #options KGDB #options DEBUG_KGDB makeoptions DEBUG=-g -O2 # compile full symbol table -options SYMTAB_SPACE=70 +options SYMTAB_SPACE=80 #options AUDIO_DEBUG=2 config netbsd root on ? type ?
CVS commit: src/lib/libpuffs
Module Name:src Committed By: chs Date: Mon Nov 14 01:27:42 UTC 2011 Modified Files: src/lib/libpuffs: puffs.c Log Message: fix crashes caused by using the results of getcontext() after the caller returns. To generate a diff of this commit: cvs rdiff -u -r1.116 -r1.117 src/lib/libpuffs/puffs.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/libpuffs/puffs.c diff -u src/lib/libpuffs/puffs.c:1.116 src/lib/libpuffs/puffs.c:1.117 --- src/lib/libpuffs/puffs.c:1.116 Tue May 3 13:16:47 2011 +++ src/lib/libpuffs/puffs.c Mon Nov 14 01:27:42 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: puffs.c,v 1.116 2011/05/03 13:16:47 manu Exp $ */ +/* $NetBSD: puffs.c,v 1.117 2011/11/14 01:27:42 chs Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved. @@ -31,7 +31,7 @@ #include sys/cdefs.h #if !defined(lint) -__RCSID($NetBSD: puffs.c,v 1.116 2011/05/03 13:16:47 manu Exp $); +__RCSID($NetBSD: puffs.c,v 1.117 2011/11/14 01:27:42 chs Exp $); #endif /* !lint */ #include sys/param.h @@ -993,9 +993,30 @@ puffs_mainloop(struct puffs_usermount *p if (puffs__cc_create(pu, puffs__theloop, pcc) == -1) { goto out; } + +#if 0 if (puffs__cc_savemain(pu) == -1) { goto out; } +#else + /* + * XXX + * puffs__cc_savemain() uses getcontext() and then returns. + * the caller (this function) may overwrite the stack frame + * of puffs__cc_savemain(), so when we call setcontext() later and + * return from puffs__cc_savemain() again, the return address or + * saved stack pointer can be garbage. + * avoid this by calling getcontext() directly here. + */ + extern int puffs_fakecc; + if (!puffs_fakecc) { + PU_CLRSFLAG(pu, PU_MAINRESTORE); + if (getcontext(pu-pu_mainctx) == -1) { + goto out; + } + } +#endif + if ((pu-pu_state PU_MAINRESTORE) == 0) puffs_cc_continue(pcc);
CVS commit: src/share/man/man9
Module Name:src Committed By: jym Date: Mon Nov 14 02:38:06 UTC 2011 Modified Files: src/share/man/man9: pool.9 Log Message: Document pool_sethardlimit. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/share/man/man9/pool.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/pool.9 diff -u src/share/man/man9/pool.9:1.43 src/share/man/man9/pool.9:1.44 --- src/share/man/man9/pool.9:1.43 Wed Apr 30 13:10:58 2008 +++ src/share/man/man9/pool.9 Mon Nov 14 02:38:05 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: pool.9,v 1.43 2008/04/30 13:10:58 martin Exp $ +.\ $NetBSD: pool.9,v 1.44 2011/11/14 02:38:05 jym Exp $ .\ .\ Copyright (c) 1997, 1998, 2007 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -27,7 +27,7 @@ .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\ POSSIBILITY OF SUCH DAMAGE. .\ -.Dd July 25, 2007 +.Dd November 14, 2011 .Dt POOL 9 .Os .Sh NAME @@ -37,7 +37,8 @@ .Nm pool_put , .Nm pool_prime , .Nm pool_sethiwat , -.Nm pool_setlowat +.Nm pool_setlowat , +.Nm pool_sethardlimit .Nd resource-pool manager .Sh SYNOPSIS .In sys/pool.h @@ -64,6 +65,9 @@ .Fn pool_sethiwat struct pool *pp int n .Ft void .Fn pool_setlowat struct pool *pp int n +.Ft void +.Fn pool_sethardlimit struct pool *pp int n \ +const char *warnmess int ratecap .Sh DESCRIPTION These utility routines provide management of pools of fixed-sized areas of memory. @@ -218,12 +222,13 @@ This function may return in case the requested number of items could not be allocated. Otherwise, the return value is 0. -.Ss SETTING POOL RESOURCE WATERMARKS +.Ss SETTING POOL RESOURCE WATERMARKS AND LIMITS A pool will attempt to increase its resource usage to keep up with the demand for its items. Conversely, it will return unused memory to the system should the number of accumulated unused items in the pool exceed a programmable limit. +.Pp The limits for the minimum and maximum number of items which a pool should keep at hand are known as the high and low .Sy watermarks . @@ -233,6 +238,13 @@ and .Fn pool_setlowat set a pool's high and low watermarks, respectively. .Pp +The hard limit represents the maximum number of items a pool is allowed +to allocate at any given time. +Unless modified via +.Fn pool_sethardlimit , +the hard limit defaults to +.Dv UINT_MAX . +.Pp .Fn pool_sethiwat .Bl -tag -offset indent -width flags .It Fa pp @@ -260,6 +272,20 @@ Unlike .Fn pool_prime , this function does not allocate the necessary memory up-front. .El +.Pp +.Fn pool_sethardlimit +.Bl -tag -offset indent -width flags +.It Fa pp +The handle identifying the pool resource instance. +.It Fa n +The maximum number of items to be allocated from the pool (i.e. the +hard limit). +.It Fa warnmess +The warning message that will be logged when the hard limit is reached. +.It Fa ratecap +The minimal interval (in seconds) after which another warning message +is issued when the pool hits its hard limit again. +.El .Ss POTENTIAL PITFALLS Note that undefined behaviour results when mixing the storage providing methods supported by the pool resource routines.
CVS commit: src/sys
Module Name:src Committed By: jmcneill Date: Mon Nov 14 02:44:59 UTC 2011 Modified Files: src/sys/arch/x86/x86: platform.c src/sys/dev/acpi: acpi.c acpi_cpu.c acpi_quirks.c Log Message: add a machdep.dmi sysctl tree with the following read-only keys: system-vendor, system-product, system-version, system-serial, system-uuid bios-vendor, bios-version board-vendor, board-product, board-version, board-serial the *-serial and *-uuid keys are marked with CTLFLAG_PRIVATE a few of the pmf platform key names changed so update callers to match To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/x86/x86/platform.c cvs rdiff -u -r1.251 -r1.252 src/sys/dev/acpi/acpi.c cvs rdiff -u -r1.47 -r1.48 src/sys/dev/acpi/acpi_cpu.c cvs rdiff -u -r1.19 -r1.20 src/sys/dev/acpi/acpi_quirks.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/x86/platform.c diff -u src/sys/arch/x86/x86/platform.c:1.11 src/sys/arch/x86/x86/platform.c:1.12 --- src/sys/arch/x86/x86/platform.c:1.11 Tue Jan 18 07:47:16 2011 +++ src/sys/arch/x86/x86/platform.c Mon Nov 14 02:44:59 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: platform.c,v 1.11 2011/01/18 07:47:16 jmmv Exp $ */ +/* $NetBSD: platform.c,v 1.12 2011/11/14 02:44:59 jmcneill Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -29,28 +29,44 @@ #include isa.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: platform.c,v 1.11 2011/01/18 07:47:16 jmmv Exp $); +__KERNEL_RCSID(0, $NetBSD: platform.c,v 1.12 2011/11/14 02:44:59 jmcneill Exp $); #include sys/types.h #include sys/param.h #include sys/kernel.h +#include sys/sysctl.h +#include sys/uuid.h #include sys/pmf.h #include dev/isa/isavar.h #include arch/x86/include/smbiosvar.h +static int platform_dminode = CTL_EOL; + void platform_init(void); /* XXX */ static void platform_add(struct smbtable *, const char *, int); static void platform_add_date(struct smbtable *, const char *, int); +static void platform_add_uuid(struct smbtable *, const char *, + const uint8_t *); +static int platform_dmi_sysctl(SYSCTLFN_PROTO); static void platform_print(void); +/* list of private DMI sysctl nodes */ +static const char *platform_private_nodes[] = { + board-serial, + system-serial, + system-uuid, + NULL +}; + void platform_init(void) { struct smbtable smbios; struct smbios_sys *psys; struct smbios_struct_bios *pbios; + struct smbios_board *pboard; struct smbios_slot *pslot; int nisa, nother; @@ -58,19 +74,31 @@ platform_init(void) if (smbios_find_table(SMBIOS_TYPE_SYSTEM, smbios)) { psys = smbios.tblhdr; - platform_add(smbios, system-manufacturer, psys-vendor); - platform_add(smbios, system-product-name, psys-product); + platform_add(smbios, system-vendor, psys-vendor); + platform_add(smbios, system-product, psys-product); platform_add(smbios, system-version, psys-version); - platform_add(smbios, system-serial-number, psys-serial); + platform_add(smbios, system-serial, psys-serial); + platform_add_uuid(smbios, system-uuid, psys-uuid); } smbios.cookie = 0; if (smbios_find_table(SMBIOS_TYPE_BIOS, smbios)) { pbios = smbios.tblhdr; - platform_add(smbios, firmware-vendor, pbios-vendor); - platform_add(smbios, firmware-version, pbios-version); - platform_add_date(smbios, firmware-date, pbios-release); + platform_add(smbios, bios-vendor, pbios-vendor); + platform_add(smbios, bios-version, pbios-version); + platform_add_date(smbios, bios-date, pbios-release); + } + + smbios.cookie = 0; + if (smbios_find_table(SMBIOS_TYPE_BASEBOARD, smbios)) { + pboard = smbios.tblhdr; + + platform_add(smbios, board-vendor, pboard-vendor); + platform_add(smbios, board-product, pboard-product); + platform_add(smbios, board-version, pboard-version); + platform_add(smbios, board-serial, pboard-serial); + platform_add(smbios, board-asset-tag, pboard-asset); } smbios.cookie = 0; @@ -102,16 +130,16 @@ platform_init(void) static void platform_print(void) { - const char *manuf, *prod, *ver; + const char *vend, *prod, *ver; - manuf = pmf_get_platform(system-manufacturer); - prod = pmf_get_platform(system-product-name); + vend = pmf_get_platform(system-vendor); + prod = pmf_get_platform(system-product); ver = pmf_get_platform(system-version); - if (manuf == NULL) + if (vend == NULL) aprint_verbose(Generic); else - aprint_verbose(%s, manuf); + aprint_verbose(%s, vend); if (prod == NULL) aprint_verbose( PC); else @@ -121,13 +149,54 @@ platform_print(void) aprint_verbose(\n); } +static bool +platform_sysctl_is_private(const char *key) +{ + unsigned int n; + + for (n = 0; platform_private_nodes[n] != NULL; n++) { + if (strcmp(key, platform_private_nodes[n]) == 0) { + return true; + } + } + + return false; +} + +static void +platform_create_sysctl(const char *key) +{ + int flags = 0, err; + + if