summaryrefslogtreecommitdiffstats
path: root/sbin/ccdconfig/ccdconfig.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-06-02 20:50:59 +0000
committerphk <phk@FreeBSD.org>2003-06-02 20:50:59 +0000
commitca0770e1ddedaca276738c1db0298cc9a6fc9403 (patch)
tree6f39a51170f051eca5deb213af688d7c335def5a /sbin/ccdconfig/ccdconfig.c
parent44a9a5c714e3541ab5ceb99e1017d9ad4fa5774c (diff)
downloadFreeBSD-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/ccdconfig.c')
-rw-r--r--sbin/ccdconfig/ccdconfig.c19
1 files changed, 19 insertions, 0 deletions
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
OpenPOWER on IntegriCloud