diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 2002-11-06 20:05:15 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2002-11-06 20:05:15 +0000 |
commit | e6e142398ffb4efe1a7a28683d0b4413af01b4d7 (patch) | |
tree | 8020852f2d71d6d028e8de130696a3b08a3f9cd9 /sys/geom/geom_ctl.c | |
parent | a7a1238911aad3e3805f78c460478edbaeb27c8f (diff) | |
download | src-e6e142398ffb4efe1a7a28683d0b4413af01b4d7.tar.gz src-e6e142398ffb4efe1a7a28683d0b4413af01b4d7.zip |
Straighten up the geom.ctl config interface definitions.
Sponsored by: DARPA & NAI Labs
Notes
Notes:
svn path=/head/; revision=106518
Diffstat (limited to 'sys/geom/geom_ctl.c')
-rw-r--r-- | sys/geom/geom_ctl.c | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/sys/geom/geom_ctl.c b/sys/geom/geom_ctl.c index 1ae88fb562b3..48bac226f5ad 100644 --- a/sys/geom/geom_ctl.c +++ b/sys/geom/geom_ctl.c @@ -152,31 +152,10 @@ g_ctl_start(struct bio *bp) */ static int -g_ctl_ioctl_getconf(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td) -{ - struct geomgetconf *gcp; - struct sbuf *sb; - int error; - u_int l; - - gcp = (struct geomgetconf *)data; - sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); - sbuf_clear(sb); - g_confxml(sb); - l = sbuf_len(sb) + 1; - if (l > gcp->len) - error = ENOMEM; - else - error = copyout(sbuf_data(sb), gcp->ptr, l); - sbuf_delete(sb); - return(error); -} - -static int g_ctl_ioctl_configgeom(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td) { struct geomconfiggeom *gcp; - struct g_createargs ga; + struct g_configargs ga; int error; error = 0; @@ -185,7 +164,7 @@ g_ctl_ioctl_configgeom(dev_t dev, u_long cmd, caddr_t data, int fflag, struct th ga.class = g_idclass(&gcp->class); if (ga.class == NULL) return (EINVAL); - if (ga.class->create_geom == NULL) + if (ga.class->config == NULL) return (EOPNOTSUPP); ga.geom = g_idgeom(&gcp->geom); ga.provider = g_idprovider(&gcp->provider); @@ -196,10 +175,16 @@ g_ctl_ioctl_configgeom(dev_t dev, u_long cmd, caddr_t data, int fflag, struct th ga.ptr = NULL; } else { ga.ptr = g_malloc(gcp->len, M_WAITOK); - copyin(gcp->ptr, ga.ptr, gcp->len); + error = copyin(gcp->ptr, ga.ptr, gcp->len); + if (error) { + g_free(ga.ptr); + return (error); + } } ga.flag = gcp->flag; - error = ga.class->create_geom(&ga); + error = ga.class->config(&ga); + if (gcp->len != 0) + copyout(ga.ptr, gcp->ptr, gcp->len); /* Ignore error */ gcp->class.u.id = (uintptr_t)ga.class; gcp->class.len = 0; gcp->geom.u.id = (uintptr_t)ga.geom; @@ -217,9 +202,6 @@ g_ctl_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td) DROP_GIANT(); g_topology_lock(); switch(cmd) { - case GEOMGETCONF: - error = g_ctl_ioctl_getconf(dev, cmd, data, fflag, td); - break; case GEOMCONFIGGEOM: error = g_ctl_ioctl_configgeom(dev, cmd, data, fflag, td); break; |