CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: mlelstv Date: Tue Oct 6 18:47:08 UTC 2020 Modified Files: src/sbin/ccdconfig: ccdconfig.c Log Message: Use raw device for configuring units. This is necessary as having a block device opened prevents autodiscovery of wedges. To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sbin/ccdconfig/ccdconfig.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/ccdconfig/ccdconfig.c diff -u src/sbin/ccdconfig/ccdconfig.c:1.57 src/sbin/ccdconfig/ccdconfig.c:1.58 --- src/sbin/ccdconfig/ccdconfig.c:1.57 Sun Sep 6 02:34:30 2020 +++ src/sbin/ccdconfig/ccdconfig.c Tue Oct 6 18:47:07 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ccdconfig.c,v 1.57 2020/09/06 02:34:30 mrg Exp $ */ +/* $NetBSD: ccdconfig.c,v 1.58 2020/10/06 18:47:07 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #ifndef lint __COPYRIGHT("@(#) Copyright (c) 1996, 1997\ The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: ccdconfig.c,v 1.57 2020/09/06 02:34:30 mrg Exp $"); +__RCSID("$NetBSD: ccdconfig.c,v 1.58 2020/10/06 18:47:07 mlelstv Exp $"); #endif #include @@ -391,24 +391,38 @@ pathtounit(char *path, int *unitp) static char * resolve_ccdname(char *name) { - char c, *path; + char *path, *buf; + const char *p; + char c; size_t len; int rawpart; if (name[0] == '/' || name[0] == '.') { /* Assume they gave the correct pathname. */ - return estrdup(name); - } + path = estrdup(name); + } else { - len = strlen(name); - c = name[len - 1]; + len = strlen(name); + c = name[len - 1]; - if (isdigit((unsigned char)c)) { - if ((rawpart = getrawpartition()) < 0) - return NULL; - easprintf(, "/dev/%s%c", name, 'a' + rawpart); - } else - easprintf(, "/dev/%s", name); + if (isdigit((unsigned char)c)) { + if ((rawpart = getrawpartition()) < 0) +return NULL; + easprintf(, "/dev/%s%c", name, 'a' + rawpart); + } else + easprintf(, "/dev/%s", name); + } + + /* + * Convert to raw device if possible. + */ + buf = emalloc(MAXPATHLEN); + p = getdiskrawname(buf, MAXPATHLEN, path); + if (p) { + free(path); + path = estrdup(p); + } + free(buf); return path; } @@ -562,6 +576,7 @@ dump_ccd(int argc, char **argv, int acti continue; } errs += printccdinfo(i); + free(ccd); } return errs; }
CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: mlelstv Date: Tue Oct 6 18:47:08 UTC 2020 Modified Files: src/sbin/ccdconfig: ccdconfig.c Log Message: Use raw device for configuring units. This is necessary as having a block device opened prevents autodiscovery of wedges. To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sbin/ccdconfig/ccdconfig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: mrg Date: Sun Sep 6 02:34:30 UTC 2020 Modified Files: src/sbin/ccdconfig: ccdconfig.c Log Message: rework error message to never call printf() %s with NULL. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sbin/ccdconfig/ccdconfig.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/ccdconfig/ccdconfig.c diff -u src/sbin/ccdconfig/ccdconfig.c:1.56 src/sbin/ccdconfig/ccdconfig.c:1.57 --- src/sbin/ccdconfig/ccdconfig.c:1.56 Sun Dec 7 10:44:34 2014 +++ src/sbin/ccdconfig/ccdconfig.c Sun Sep 6 02:34:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ccdconfig.c,v 1.56 2014/12/07 10:44:34 mlelstv Exp $ */ +/* $NetBSD: ccdconfig.c,v 1.57 2020/09/06 02:34:30 mrg Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #ifndef lint __COPYRIGHT("@(#) Copyright (c) 1996, 1997\ The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: ccdconfig.c,v 1.56 2014/12/07 10:44:34 mlelstv Exp $"); +__RCSID("$NetBSD: ccdconfig.c,v 1.57 2020/09/06 02:34:30 mrg Exp $"); #endif #include @@ -245,7 +245,7 @@ do_single(int argc, char **argv, int act cp = strdup(buf); if (cp == NULL) { - warn("%s", cp); + warn("strdup failed"); goto error; }
CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: mrg Date: Sun Sep 6 02:34:30 UTC 2020 Modified Files: src/sbin/ccdconfig: ccdconfig.c Log Message: rework error message to never call printf() %s with NULL. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sbin/ccdconfig/ccdconfig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: mlelstv Date: Sun Dec 7 10:44:34 UTC 2014 Modified Files: src/sbin/ccdconfig: ccdconfig.c Log Message: Make ccdconfig resolve wedge names. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sbin/ccdconfig/ccdconfig.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/ccdconfig/ccdconfig.c diff -u src/sbin/ccdconfig/ccdconfig.c:1.55 src/sbin/ccdconfig/ccdconfig.c:1.56 --- src/sbin/ccdconfig/ccdconfig.c:1.55 Sun Aug 17 07:05:44 2014 +++ src/sbin/ccdconfig/ccdconfig.c Sun Dec 7 10:44:34 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ccdconfig.c,v 1.55 2014/08/17 07:05:44 apb Exp $ */ +/* $NetBSD: ccdconfig.c,v 1.56 2014/12/07 10:44:34 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #ifndef lint __COPYRIGHT(@(#) Copyright (c) 1996, 1997\ The NetBSD Foundation, Inc. All rights reserved.); -__RCSID($NetBSD: ccdconfig.c,v 1.55 2014/08/17 07:05:44 apb Exp $); +__RCSID($NetBSD: ccdconfig.c,v 1.56 2014/12/07 10:44:34 mlelstv Exp $); #endif #include sys/param.h @@ -164,8 +164,10 @@ do_single(int argc, char **argv, int act { struct ccd_ioctl ccio; char *ccd, *cp, *cp2, **disks; + char buf[MAXPATHLEN]; int noflags = 0, i, ileave, flags, j; - unsigned int ui; + unsigned int ndisks, ui; + int ret = 1; flags = 0; memset(ccio, 0, sizeof(ccio)); @@ -235,29 +237,34 @@ do_single(int argc, char **argv, int act /* Next is the list of disks to make the ccd from. */ disks = emalloc(argc * sizeof(char *)); - for (ui = 0; argc != 0; ) { - cp = *argv++; --argc; + for (ndisks = 0; argc != 0; ++argv, --argc) { + if (getfsspecname(buf, sizeof(buf), *argv) == NULL) { + warn(%s, *argv); + goto error; + } + + cp = strdup(buf); + if (cp == NULL) { + warn(%s, cp); + goto error; + } + if ((j = checkdev(cp)) == 0) - disks[ui++] = cp; + disks[ndisks++] = cp; else { warnx(%s: %s, cp, strerror(j)); - free(ccd); - free(disks); - return (1); + goto error; } } /* Fill in the ccio. */ ccio.ccio_disks = disks; - ccio.ccio_ndisks = ui; + ccio.ccio_ndisks = ndisks; ccio.ccio_ileave = ileave; ccio.ccio_flags = flags; - if (do_io(ccd, CCDIOCSET, ccio)) { - free(ccd); - free(disks); - return (1); - } + if (do_io(ccd, CCDIOCSET, ccio)) + goto error; if (verbose) { printf(ccd%d: %d components , ccio.ccio_unit, @@ -278,9 +285,14 @@ do_single(int argc, char **argv, int act printf(concatenated\n); } + ret = 0; + +error: free(ccd); + while (ndisks 0) + free(disks[--ndisks]); free(disks); - return (0); + return (ret); } static int
CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: mlelstv Date: Sun Dec 7 10:44:34 UTC 2014 Modified Files: src/sbin/ccdconfig: ccdconfig.c Log Message: Make ccdconfig resolve wedge names. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sbin/ccdconfig/ccdconfig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: apb Date: Sun Aug 17 07:05:44 UTC 2014 Modified Files: src/sbin/ccdconfig: ccdconfig.c Log Message: Don't print ccd_size with %zu; it no longer has type size_t. Instead, cast to uintmax_t and print with %ju. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sbin/ccdconfig/ccdconfig.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/ccdconfig/ccdconfig.c diff -u src/sbin/ccdconfig/ccdconfig.c:1.54 src/sbin/ccdconfig/ccdconfig.c:1.55 --- src/sbin/ccdconfig/ccdconfig.c:1.54 Sat Aug 16 19:27:27 2014 +++ src/sbin/ccdconfig/ccdconfig.c Sun Aug 17 07:05:44 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ccdconfig.c,v 1.54 2014/08/16 19:27:27 sborrill Exp $ */ +/* $NetBSD: ccdconfig.c,v 1.55 2014/08/17 07:05:44 apb Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #ifndef lint __COPYRIGHT(@(#) Copyright (c) 1996, 1997\ The NetBSD Foundation, Inc. All rights reserved.); -__RCSID($NetBSD: ccdconfig.c,v 1.54 2014/08/16 19:27:27 sborrill Exp $); +__RCSID($NetBSD: ccdconfig.c,v 1.55 2014/08/17 07:05:44 apb Exp $); #endif #include sys/param.h @@ -445,8 +445,9 @@ print_ccd_info(int u, struct ccddiskinfo } /* Dump out softc information. */ - printf(ccd%d\t\t%d\t0x%x\t%zu\t, u, ccd-ccd_ileave, - ccd-ccd_flags CCDF_USERMASK, ccd-ccd_size * DEV_BSIZE); + printf(ccd%d\t\t%d\t0x%x\t%ju\t, u, ccd-ccd_ileave, + ccd-ccd_flags CCDF_USERMASK, + (uintmax_t)ccd-ccd_size * DEV_BSIZE); /* Read component pathname and display component info. */ for (size_t i = 0; i ccd-ccd_ndisks; ++i) {
CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: apb Date: Sun Aug 17 07:05:44 UTC 2014 Modified Files: src/sbin/ccdconfig: ccdconfig.c Log Message: Don't print ccd_size with %zu; it no longer has type size_t. Instead, cast to uintmax_t and print with %ju. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sbin/ccdconfig/ccdconfig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: apb Date: Wed Aug 13 13:14:35 UTC 2014 Modified Files: src/sbin/ccdconfig: ccdconfig.8 Log Message: Interleave 0 means concatenate serially, do not interleave. This information was in the ccd(4) man page, but not in ccdconfig(8) or ccd.conf(5). To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sbin/ccdconfig/ccdconfig.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/ccdconfig/ccdconfig.8 diff -u src/sbin/ccdconfig/ccdconfig.8:1.26 src/sbin/ccdconfig/ccdconfig.8:1.27 --- src/sbin/ccdconfig/ccdconfig.8:1.26 Sat Apr 27 17:12:36 2013 +++ src/sbin/ccdconfig/ccdconfig.8 Wed Aug 13 13:14:35 2014 @@ -1,4 +1,4 @@ -.\ $NetBSD: ccdconfig.8,v 1.26 2013/04/27 17:12:36 christos Exp $ +.\ $NetBSD: ccdconfig.8,v 1.27 2014/08/13 13:14:35 apb Exp $ .\ .\ Copyright (c) 1996, 1997 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 October 17, 2003 +.Dd August 13, 2014 .Dt CCDCONFIG 8 .Os .Sh NAME @@ -98,6 +98,8 @@ to be verbose. A ccd is described on the command line and in the ccd configuration file by the name of the ccd, the interleave factor, the ccd configuration flags, and a list of one or more devices. +An interleave factor of 0 means that the devices are +concatenated serially, not interleaved. The flags may be represented as a decimal number, a hexadecimal number, a comma-separated list of strings, or the word .Dq none .
CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: apb Date: Wed Aug 13 14:13:04 UTC 2014 Modified Files: src/sbin/ccdconfig: ccd.conf.5 Log Message: Interleave 0 means concatenate serially, do not interleave. This information was in the ccd(4) man page, but not in ccdconfig(8) or ccd.conf(5). To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sbin/ccdconfig/ccd.conf.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/ccdconfig/ccd.conf.5 diff -u src/sbin/ccdconfig/ccd.conf.5:1.4 src/sbin/ccdconfig/ccd.conf.5:1.5 --- src/sbin/ccdconfig/ccd.conf.5:1.4 Tue May 17 11:46:15 2005 +++ src/sbin/ccdconfig/ccd.conf.5 Wed Aug 13 14:13:04 2014 @@ -1,4 +1,4 @@ -.\ $NetBSD: ccd.conf.5,v 1.4 2005/05/17 11:46:15 grant Exp $ +.\ $NetBSD: ccd.conf.5,v 1.5 2014/08/13 14:13:04 apb Exp $ .\ .\ Copyright (c) 2002 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -29,7 +29,7 @@ .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\ POSSIBILITY OF SUCH DAMAGE. .\ -.Dd June 11, 2002 +.Dd August 13, 2014 .Dt CCD.CONF 5 .Os .Sh NAME @@ -68,6 +68,8 @@ The name of the ccd. .It Ar ileave The interleave, expressed in units of .Dv DEV_BSIZE . +For serial concatenation, specify +.Ql 0 . .It Ar flags The flags for the device, which may be represented as a decimal number, a hexadecimal number, a comma-separated list of strings, or the word
CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: apb Date: Wed Aug 13 13:14:35 UTC 2014 Modified Files: src/sbin/ccdconfig: ccdconfig.8 Log Message: Interleave 0 means concatenate serially, do not interleave. This information was in the ccd(4) man page, but not in ccdconfig(8) or ccd.conf(5). To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sbin/ccdconfig/ccdconfig.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: apb Date: Wed Aug 13 14:13:04 UTC 2014 Modified Files: src/sbin/ccdconfig: ccd.conf.5 Log Message: Interleave 0 means concatenate serially, do not interleave. This information was in the ccd(4) man page, but not in ccdconfig(8) or ccd.conf(5). To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sbin/ccdconfig/ccd.conf.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
re: CVS commit: src/sbin/ccdconfig
Module Name: src Committed By: christos Date: Fri May 3 00:01:15 UTC 2013 Modified Files: src/sbin/ccdconfig: ccdconfig.c Log Message: Hi broken vax gcc! please use commit messages to describe the change along with any underhand comments ;) .mrg.
re: CVS commit: src/sbin/ccdconfig
On May 5, 10:37pm, m...@eterna.com.au (matthew green) wrote: -- Subject: re: CVS commit: src/sbin/ccdconfig | Module Name:src | Committed By: christos | Date: Fri May 3 00:01:15 UTC 2013 | | Modified Files: | src/sbin/ccdconfig: ccdconfig.c | | Log Message: | Hi broken vax gcc! | | please use commit messages to describe the change | along with any underhand comments ;) Fixed. christos
CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: christos Date: Fri May 3 00:01:15 UTC 2013 Modified Files: src/sbin/ccdconfig: ccdconfig.c Log Message: Hi broken vax gcc! To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sbin/ccdconfig/ccdconfig.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/ccdconfig/ccdconfig.c diff -u src/sbin/ccdconfig/ccdconfig.c:1.52 src/sbin/ccdconfig/ccdconfig.c:1.53 --- src/sbin/ccdconfig/ccdconfig.c:1.52 Sat Apr 27 13:12:36 2013 +++ src/sbin/ccdconfig/ccdconfig.c Thu May 2 20:01:15 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ccdconfig.c,v 1.52 2013/04/27 17:12:36 christos Exp $ */ +/* $NetBSD: ccdconfig.c,v 1.53 2013/05/03 00:01:15 christos Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #ifndef lint __COPYRIGHT(@(#) Copyright (c) 1996, 1997\ The NetBSD Foundation, Inc. All rights reserved.); -__RCSID($NetBSD: ccdconfig.c,v 1.52 2013/04/27 17:12:36 christos Exp $); +__RCSID($NetBSD: ccdconfig.c,v 1.53 2013/05/03 00:01:15 christos Exp $); #endif #include sys/param.h @@ -532,7 +532,7 @@ dump_ccd(int argc, char **argv, int acti /* Dump ccd configuration to stdout. */ while (argc) { - int i; + int i = 0; /* XXX: vax gcc */ int error; char *cp = *argv++; --argc; char *ccd;
CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: christos Date: Fri May 3 00:01:15 UTC 2013 Modified Files: src/sbin/ccdconfig: ccdconfig.c Log Message: Hi broken vax gcc! To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sbin/ccdconfig/ccdconfig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: christos Date: Sat Apr 27 17:12:37 UTC 2013 Modified Files: src/sbin/ccdconfig: Makefile ccdconfig.8 ccdconfig.c Log Message: one less kvm groveller. Use sysctl to get ccd info. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sbin/ccdconfig/Makefile cvs rdiff -u -r1.25 -r1.26 src/sbin/ccdconfig/ccdconfig.8 cvs rdiff -u -r1.51 -r1.52 src/sbin/ccdconfig/ccdconfig.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/ccdconfig/Makefile diff -u src/sbin/ccdconfig/Makefile:1.8 src/sbin/ccdconfig/Makefile:1.9 --- src/sbin/ccdconfig/Makefile:1.8 Mon May 28 08:06:22 2007 +++ src/sbin/ccdconfig/Makefile Sat Apr 27 13:12:36 2013 @@ -1,14 +1,11 @@ -# $NetBSD: Makefile,v 1.8 2007/05/28 12:06:22 tls Exp $ +# $NetBSD: Makefile,v 1.9 2013/04/27 17:12:36 christos Exp $ USE_FORT?=yes # setgid PROG= ccdconfig MAN= ccdconfig.8 ccd.conf.5 -BINGRP= kmem -BINMODE=2555 - -DPADD= ${LIBKVM} ${LIBUTIL} -LDADD= -lkvm -lutil +DPADD= ${LIBUTIL} +LDADD= -lutil .include bsd.prog.mk Index: src/sbin/ccdconfig/ccdconfig.8 diff -u src/sbin/ccdconfig/ccdconfig.8:1.25 src/sbin/ccdconfig/ccdconfig.8:1.26 --- src/sbin/ccdconfig/ccdconfig.8:1.25 Fri Aug 21 20:14:21 2009 +++ src/sbin/ccdconfig/ccdconfig.8 Sat Apr 27 13:12:36 2013 @@ -1,4 +1,4 @@ -.\ $NetBSD: ccdconfig.8,v 1.25 2009/08/22 00:14:21 joerg Exp $ +.\ $NetBSD: ccdconfig.8,v 1.26 2013/04/27 17:12:36 christos Exp $ .\ .\ Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -56,8 +56,6 @@ .Op Fl f Ar config_file .Nm .Fl g -.Op Fl M Ar core -.Op Fl N Ar system .Oo .Ar ccd Oo ... .Oc @@ -87,16 +85,6 @@ Dump the current ccd configuration in a for use as the ccd configuration file. If no arguments are specified, every configured ccd is dumped. Otherwise, the configuration of each listed ccd is dumped. -.It Fl M Ar core -Extract values associated with the name list from -.Pa core -instead of the default -.Pa /dev/mem . -.It Fl N Ar system -Extract the name list from -.Pa system -instead of the default -.Pa /netbsd . .It Fl u Unconfigure a ccd. .It Fl U Index: src/sbin/ccdconfig/ccdconfig.c diff -u src/sbin/ccdconfig/ccdconfig.c:1.51 src/sbin/ccdconfig/ccdconfig.c:1.52 --- src/sbin/ccdconfig/ccdconfig.c:1.51 Sat Aug 27 12:29:51 2011 +++ src/sbin/ccdconfig/ccdconfig.c Sat Apr 27 13:12:36 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ccdconfig.c,v 1.51 2011/08/27 16:29:51 joerg Exp $ */ +/* $NetBSD: ccdconfig.c,v 1.52 2013/04/27 17:12:36 christos Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #ifndef lint __COPYRIGHT(@(#) Copyright (c) 1996, 1997\ The NetBSD Foundation, Inc. All rights reserved.); -__RCSID($NetBSD: ccdconfig.c,v 1.51 2011/08/27 16:29:51 joerg Exp $); +__RCSID($NetBSD: ccdconfig.c,v 1.52 2013/04/27 17:12:36 christos Exp $); #endif #include sys/param.h @@ -46,7 +46,6 @@ __RCSID($NetBSD: ccdconfig.c,v 1.51 201 #include err.h #include errno.h #include fcntl.h -#include kvm.h #include limits.h #include nlist.h #include stdio.h @@ -65,9 +64,6 @@ static gid_t egid; static int verbose; static const char *ccdconf = _PATH_CCDCONF; -static char *core; -static char *kernel; - static struct flagval { const char *fv_flag; int fv_val; @@ -77,16 +73,6 @@ static struct flagval { { NULL, 0 }, }; -static struct nlist nl[] = { - { .n_name = _ccd_softc }, -#define SYM_CCDSOFTC 0 - { .n_name = _numccd }, -#define SYM_NUMCCD 1 - { .n_name = _ccd_softc_elemsize }, -#define SYM_CCDSOFTCELEMSIZE 2 - { .n_name = NULL }, -}; - #define CCD_CONFIG 0 /* configure a device */ #define CCD_CONFIGALL 1 /* configure all devices */ #define CCD_UNCONFIG 2 /* unconfigure a device */ @@ -100,7 +86,6 @@ static int do_all(int); static int dump_ccd(int, char **, int); static int flags_to_val(char *); static int pathtounit(char *, int *); -static void print_ccd_info(struct ccd_softc *, kvm_t *); static char *resolve_ccdname(char *); __dead static void usage(void); @@ -111,7 +96,7 @@ main(int argc, char *argv[]) egid = getegid(); setegid(getgid()); - while ((ch = getopt(argc, argv, cCf:gM:N:uUv)) != -1) { + while ((ch = getopt(argc, argv, cCf:guUv)) != -1) { switch (ch) { case 'c': action = CCD_CONFIG; @@ -131,14 +116,6 @@ main(int argc, char *argv[]) action = CCD_DUMP; break; - case 'M': - core = optarg; - break; - - case 'N': - kernel = optarg; - break; - case 'u': action = CCD_UNCONFIG; ++options; @@ -163,17 +140,6 @@ main(int argc, char *argv[]) if (options 1) usage(); - /* - * Discard setgid privileges. If not the running kernel, we toss - * them away totally so that bad guys can't print interesting stuff - * from kernel memory, otherwise switch back to kmem for the - * duration of the kvm_openfiles() call. - * - * We also do this if we aren't just looking...
CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: christos Date: Sat Apr 27 17:12:37 UTC 2013 Modified Files: src/sbin/ccdconfig: Makefile ccdconfig.8 ccdconfig.c Log Message: one less kvm groveller. Use sysctl to get ccd info. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sbin/ccdconfig/Makefile cvs rdiff -u -r1.25 -r1.26 src/sbin/ccdconfig/ccdconfig.8 cvs rdiff -u -r1.51 -r1.52 src/sbin/ccdconfig/ccdconfig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: joerg Date: Sat Aug 27 16:29:51 UTC 2011 Modified Files: src/sbin/ccdconfig: ccdconfig.c Log Message: static. __dead. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sbin/ccdconfig/ccdconfig.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/ccdconfig/ccdconfig.c diff -u src/sbin/ccdconfig/ccdconfig.c:1.50 src/sbin/ccdconfig/ccdconfig.c:1.51 --- src/sbin/ccdconfig/ccdconfig.c:1.50 Tue Jan 4 23:31:29 2011 +++ src/sbin/ccdconfig/ccdconfig.c Sat Aug 27 16:29:51 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ccdconfig.c,v 1.50 2011/01/04 23:31:29 wiz Exp $ */ +/* $NetBSD: ccdconfig.c,v 1.51 2011/08/27 16:29:51 joerg Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #ifndef lint __COPYRIGHT(@(#) Copyright (c) 1996, 1997\ The NetBSD Foundation, Inc. All rights reserved.); -__RCSID($NetBSD: ccdconfig.c,v 1.50 2011/01/04 23:31:29 wiz Exp $); +__RCSID($NetBSD: ccdconfig.c,v 1.51 2011/08/27 16:29:51 joerg Exp $); #endif #include sys/param.h @@ -68,7 +68,7 @@ static char *core; static char *kernel; -struct flagval { +static struct flagval { const char *fv_flag; int fv_val; } flagvaltab[] = { @@ -102,7 +102,7 @@ static int pathtounit(char *, int *); static void print_ccd_info(struct ccd_softc *, kvm_t *); static char *resolve_ccdname(char *); -static void usage(void); +__dead static void usage(void); int main(int argc, char *argv[])
CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: joerg Date: Sat Aug 27 16:29:51 UTC 2011 Modified Files: src/sbin/ccdconfig: ccdconfig.c Log Message: static. __dead. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sbin/ccdconfig/ccdconfig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: wiz Date: Tue Jan 4 23:31:30 UTC 2011 Modified Files: src/sbin/ccdconfig: ccdconfig.c Log Message: Fix file descriptor leak. Found by cppcheck. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sbin/ccdconfig/ccdconfig.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/ccdconfig/ccdconfig.c diff -u src/sbin/ccdconfig/ccdconfig.c:1.49 src/sbin/ccdconfig/ccdconfig.c:1.50 --- src/sbin/ccdconfig/ccdconfig.c:1.49 Mon Mar 16 12:52:07 2009 +++ src/sbin/ccdconfig/ccdconfig.c Tue Jan 4 23:31:29 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ccdconfig.c,v 1.49 2009/03/16 12:52:07 lukem Exp $ */ +/* $NetBSD: ccdconfig.c,v 1.50 2011/01/04 23:31:29 wiz Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #ifndef lint __COPYRIGHT(@(#) Copyright (c) 1996, 1997\ The NetBSD Foundation, Inc. All rights reserved.); -__RCSID($NetBSD: ccdconfig.c,v 1.49 2009/03/16 12:52:07 lukem Exp $); +__RCSID($NetBSD: ccdconfig.c,v 1.50 2011/01/04 23:31:29 wiz Exp $); #endif #include sys/param.h @@ -471,9 +471,11 @@ cp = unknown; } warn(ioctl (%s): %s, cp, path); + (void)close(fd); return (1); } + (void)close(fd); return (0); }
CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: wiz Date: Tue Jan 4 23:31:30 UTC 2011 Modified Files: src/sbin/ccdconfig: ccdconfig.c Log Message: Fix file descriptor leak. Found by cppcheck. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sbin/ccdconfig/ccdconfig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/ccdconfig
Module Name:src Committed By: joerg Date: Sat Aug 22 00:14:21 UTC 2009 Modified Files: src/sbin/ccdconfig: ccdconfig.8 Log Message: Fix markup To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sbin/ccdconfig/ccdconfig.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/ccdconfig/ccdconfig.8 diff -u src/sbin/ccdconfig/ccdconfig.8:1.24 src/sbin/ccdconfig/ccdconfig.8:1.25 --- src/sbin/ccdconfig/ccdconfig.8:1.24 Wed Apr 30 13:10:52 2008 +++ src/sbin/ccdconfig/ccdconfig.8 Sat Aug 22 00:14:21 2009 @@ -1,4 +1,4 @@ -.\ $NetBSD: ccdconfig.8,v 1.24 2008/04/30 13:10:52 martin Exp $ +.\ $NetBSD: ccdconfig.8,v 1.25 2009/08/22 00:14:21 joerg Exp $ .\ .\ Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -115,7 +115,7 @@ .Dq none . The flags are as follows: .Bl -column -offset indent CCDF_UNIFORM 0x02 -.Em Symbolic Numeric Comment +.It Em Symbolic Numeric Comment .It CCDF_UNIFORM 0x02 Use uniform interleave. The size of all components is clamped to that of the smallest component. .It CCDF_NOLABEL 0x04 Ignore raw disklabel.