summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-06-01 13:47:51 +0000
committerphk <phk@FreeBSD.org>2003-06-01 13:47:51 +0000
commit069191fcbf030ae2966ebec47a4080756e9cd7f2 (patch)
treeb5cc7f300d62bf1910b246c6ef717532135ce150 /sbin
parent5a2388f470b87f347bd60da1d099299e1a3ed609 (diff)
downloadFreeBSD-src-069191fcbf030ae2966ebec47a4080756e9cd7f2.zip
FreeBSD-src-069191fcbf030ae2966ebec47a4080756e9cd7f2.tar.gz
Simplify the GEOM OAM api: Drop the request type, and let everything
hinge on the "verb" parameter which the class gets to interpret as it sees fit. Move the entire request into the kernel and move changed parameters back when done.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/bsdlabel/bsdlabel.c12
-rw-r--r--sbin/gbde/gbde.c6
-rw-r--r--sbin/sunlabel/sunlabel.c8
3 files changed, 14 insertions, 12 deletions
diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c
index a0e3cdb..31e57b7 100644
--- a/sbin/bsdlabel/bsdlabel.c
+++ b/sbin/bsdlabel/bsdlabel.c
@@ -359,10 +359,10 @@ writelabel(void)
fd = open(specname, O_RDWR);
if (fd < 0) {
- grq = gctl_get_handle(GCTL_CONFIG_GEOM);
+ grq = gctl_get_handle();
+ gctl_ro_param(grq, "verb", -1, "write label");
gctl_ro_param(grq, "class", -1, "BSD");
gctl_ro_param(grq, "geom", -1, dkname);
- gctl_ro_param(grq, "verb", -1, "write label");
gctl_ro_param(grq, "label", 148+16*8, bootarea + labeloffset);
errstr = gctl_issue(grq);
if (errstr != NULL) {
@@ -372,10 +372,10 @@ writelabel(void)
}
gctl_free(grq);
if (installboot) {
- grq = gctl_get_handle(GCTL_CONFIG_GEOM);
+ grq = gctl_get_handle();
+ gctl_ro_param(grq, "verb", -1, "write bootcode");
gctl_ro_param(grq, "class", -1, "BSD");
gctl_ro_param(grq, "geom", -1, dkname);
- gctl_ro_param(grq, "verb", -1, "write bootcode");
gctl_ro_param(grq, "bootcode", BBSIZE, bootarea);
errstr = gctl_issue(grq);
if (errstr != NULL) {
@@ -419,10 +419,10 @@ readlabel(int flag)
if (flag && error)
errx(1, "%s: no valid label found", specname);
- grq = gctl_get_handle(GCTL_CONFIG_GEOM);
+ grq = gctl_get_handle();
+ gctl_ro_param(grq, "verb", -1, "read mbroffset");
gctl_ro_param(grq, "class", -1, "BSD");
gctl_ro_param(grq, "geom", -1, dkname);
- gctl_ro_param(grq, "verb", -1, "read mbroffset");
gctl_rw_param(grq, "mbroffset", sizeof(mbroffset), &mbroffset);
errstr = gctl_issue(grq);
if (errstr != NULL) {
diff --git a/sbin/gbde/gbde.c b/sbin/gbde/gbde.c
index f36df05..1b1c2c3 100644
--- a/sbin/gbde/gbde.c
+++ b/sbin/gbde/gbde.c
@@ -225,7 +225,8 @@ cmd_attach(const struct g_bde_softc *sc, const char *dest, const char *lfile)
struct gctl_req *r;
const char *errstr;
- r = gctl_get_handle(GCTL_CREATE_GEOM);
+ r = gctl_get_handle();
+ gctl_ro_param(r, "verb", -1, "create geom");
gctl_ro_param(r, "class", -1, "BDE");
gctl_ro_param(r, "provider", -1, dest);
gctl_ro_param(r, "pass", SHA512_DIGEST_LENGTH, sc->sha2);
@@ -252,7 +253,8 @@ cmd_detach(const char *dest)
const char *errstr;
char buf[BUFSIZ];
- r = gctl_get_handle(GCTL_DESTROY_GEOM);
+ r = gctl_get_handle();
+ gctl_ro_param(r, "verb", -1, "destroy geom");
gctl_ro_param(r, "class", -1, "BDE");
sprintf(buf, "%s.bde", dest);
gctl_ro_param(r, "geom", -1, buf);
diff --git a/sbin/sunlabel/sunlabel.c b/sbin/sunlabel/sunlabel.c
index 08e6745..1de2562 100644
--- a/sbin/sunlabel/sunlabel.c
+++ b/sbin/sunlabel/sunlabel.c
@@ -352,20 +352,20 @@ write_label(struct sun_disklabel *sl, const char *disk, const char *bootpath)
snprintf(path, sizeof(path), "%s%s", _PATH_DEV, disk);
fd = open(path, O_RDWR);
if (fd < 0) {
- grq = gctl_get_handle(GCTL_CONFIG_GEOM);
+ grq = gctl_get_handle();
+ gctl_ro_param(grq, "verb", -1, "write label");
gctl_ro_param(grq, "class", -1, "SUN");
gctl_ro_param(grq, "geom", -1, disk);
- gctl_ro_param(grq, "verb", -1, "write label");
gctl_ro_param(grq, "label", sizeof buf, buf);
errstr = gctl_issue(grq);
if (errstr != NULL)
errx(1, "%s", errstr);
gctl_free(grq);
if (Bflag) {
- grq = gctl_get_handle(GCTL_CONFIG_GEOM);
+ grq = gctl_get_handle();
+ gctl_ro_param(grq, "verb", -1, "write bootcode");
gctl_ro_param(grq, "class", -1, "SUN");
gctl_ro_param(grq, "geom", -1, disk);
- gctl_ro_param(grq, "verb", -1, "write bootcode");
gctl_ro_param(grq, "bootcode", sizeof boot, boot);
errstr = gctl_issue(grq);
if (errstr != NULL)
OpenPOWER on IntegriCloud