diff options
author | phk <phk@FreeBSD.org> | 2003-06-02 20:50:59 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-06-02 20:50:59 +0000 |
commit | ca0770e1ddedaca276738c1db0298cc9a6fc9403 (patch) | |
tree | 6f39a51170f051eca5deb213af688d7c335def5a /sbin/ccdconfig | |
parent | 44a9a5c714e3541ab5ceb99e1017d9ad4fa5774c (diff) | |
download | FreeBSD-src-ca0770e1ddedaca276738c1db0298cc9a6fc9403.zip FreeBSD-src-ca0770e1ddedaca276738c1db0298cc9a6fc9403.tar.gz |
Use GEOM OAM api to retrive list of configured ccd devices.
Link against libgeom.
Diffstat (limited to 'sbin/ccdconfig')
-rw-r--r-- | sbin/ccdconfig/Makefile | 3 | ||||
-rw-r--r-- | sbin/ccdconfig/ccdconfig.c | 19 |
2 files changed, 22 insertions, 0 deletions
diff --git a/sbin/ccdconfig/Makefile b/sbin/ccdconfig/Makefile index cb2bc74..6d6e7e0 100644 --- a/sbin/ccdconfig/Makefile +++ b/sbin/ccdconfig/Makefile @@ -4,4 +4,7 @@ PROG= ccdconfig WARNS?= 3 MAN= ccdconfig.8 +DPADD= ${LIBGEOM} +LDADD= -lgeom + .include <bsd.prog.mk> diff --git a/sbin/ccdconfig/ccdconfig.c b/sbin/ccdconfig/ccdconfig.c index 19f5f1a..4c877ff 100644 --- a/sbin/ccdconfig/ccdconfig.c +++ b/sbin/ccdconfig/ccdconfig.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <libgeom.h> #include <sys/devicestat.h> #include <sys/ccdvar.h> @@ -426,9 +427,27 @@ static int dump_ccd(int argc, char **argv) { char *cp; + char const *errstr; int i, error, numccd, numconfiged = 0; struct ccdconf conf; int ccd; + struct gctl_req *grq; + + grq = gctl_get_handle(); + gctl_ro_param(grq, "verb", -1, "list"); + gctl_ro_param(grq, "class", -1, "CCD"); + cp = malloc(65536); + gctl_rw_param(grq, "output", 65536, cp); + if (verbose) + gctl_ro_param(grq, "verbose", -1, "yes"); + errstr = gctl_issue(grq); + if (errstr == NULL) { + printf("%s", cp); + return (0); + } else { + warnx("%s\nor possibly kernel and ccdconfig out of sync", + errstr); + } /* * Read the ccd configuration data from the kernel and dump |