diff options
author | phk <phk@FreeBSD.org> | 2003-04-22 21:01:46 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-04-22 21:01:46 +0000 |
commit | c5dae9372be4269fbaa287712666047e8836309b (patch) | |
tree | 68b4c503a9c64e4284f993a660024f65d836aabc /sys/geom/geom_ctl.c | |
parent | 02c40a0b9d19ba3495e147ed827371063e455acd (diff) | |
download | FreeBSD-src-c5dae9372be4269fbaa287712666047e8836309b.zip FreeBSD-src-c5dae9372be4269fbaa287712666047e8836309b.tar.gz |
Implement handling of CONFIG_GEOM OAM request.
Diffstat (limited to 'sys/geom/geom_ctl.c')
-rw-r--r-- | sys/geom/geom_ctl.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/sys/geom/geom_ctl.c b/sys/geom/geom_ctl.c index ab50552..279156e 100644 --- a/sys/geom/geom_ctl.c +++ b/sys/geom/geom_ctl.c @@ -381,6 +381,42 @@ gctl_destroy_geom(struct gctl_req *req) return (error); } +static int +gctl_config_geom(struct gctl_req *req) +{ + struct g_class *mp; + struct g_geom *gp; + char *verb; + int error, vlen; + + g_topology_assert(); + mp = gctl_get_class(req); + if (mp == NULL) + return (gctl_error(req, "Class not found")); + if (mp->config_geom == NULL) + return (gctl_error(req, "Class has no config_geom method")); + gp = gctl_get_geom(req, mp); + if (gp == NULL) + return (gctl_error(req, "Geom not specified")); + if (gp->class != mp) + return (gctl_error(req, "Geom not of specificed class")); + verb = gctl_get_param(req, "verb", &vlen); + if (verb == NULL) + return (gctl_error(req, "Missing verb parameter")); + if (vlen < 2) { + g_free(verb); + return (gctl_error(req, "Too short verb parameter")); + } + if (verb[vlen - 1] != '\0') { + g_free(verb); + return (gctl_error(req, "Unterminated verb parameter")); + } + error = mp->config_geom(req, gp, verb); + g_free(verb); + g_topology_assert(); + return (error); +} + /* * Handle ioctl from libgeom::geom_ctl.c */ @@ -426,6 +462,9 @@ g_ctl_ioctl_ctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *t case GCTL_DESTROY_GEOM: error = gctl_destroy_geom(req); break; + case GCTL_CONFIG_GEOM: + error = gctl_config_geom(req); + break; default: error = gctl_error(req, "XXX: TBD"); break; |