diff --git a/sys/geom/geom.h b/sys/geom/geom.h index 7a84c239996..4eebbdfd200 100644 --- a/sys/geom/geom.h +++ b/sys/geom/geom.h @@ -338,27 +338,25 @@ struct geomgetconf { struct g_createargs { /* Valid on call */ struct g_class *class; + struct g_geom *geom; struct g_provider *provider; u_int flag; u_int len; void *ptr; - /* Valid on return */ - struct g_geom *geom; }; struct geomconfiggeom { /* Valid on call */ struct geomidorname class; + struct geomidorname geom; struct geomidorname provider; u_int flag; u_int len; void *ptr; /* Valid on return */ - uintptr_t geom; }; #define GEOMCONFIGGEOM _IOW('G', 0, struct geomconfiggeom) - /* geom_enc.c */ uint16_t g_dec_be2(const u_char *p); uint32_t g_dec_be4(const u_char *p); diff --git a/sys/geom/geom_ctl.c b/sys/geom/geom_ctl.c index 8e1ce84ec09..3d242960a2e 100644 --- a/sys/geom/geom_ctl.c +++ b/sys/geom/geom_ctl.c @@ -179,15 +179,15 @@ g_ctl_ioctl_configgeom(dev_t dev, u_long cmd, caddr_t data, int fflag, struct th int error; error = 0; + bzero(&ga, sizeof ga); gcp = (struct geomconfiggeom *)data; ga.class = g_idclass(&gcp->class); if (ga.class == NULL) return (EINVAL); if (ga.class->create_geom == NULL) return (EOPNOTSUPP); + ga.geom = g_idgeom(&gcp->geom); ga.provider = g_idprovider(&gcp->provider); - if (ga.provider == NULL) - return (EINVAL); ga.len = gcp->len; if (gcp->len > 64 * 1024) return (EINVAL); @@ -197,8 +197,14 @@ g_ctl_ioctl_configgeom(dev_t dev, u_long cmd, caddr_t data, int fflag, struct th ga.ptr = g_malloc(gcp->len, M_WAITOK); copyin(gcp->ptr, ga.ptr, gcp->len); } + ga.flag = gcp->flag; error = ga.class->create_geom(&ga); - gcp->geom = (uintptr_t)ga.geom; + gcp->class.u.id = (uintptr_t)ga.class; + gcp->class.len = 0; + gcp->geom.u.id = (uintptr_t)ga.geom; + gcp->geom.len = 0; + gcp->provider.u.id = (uintptr_t)ga.provider; + gcp->provider.len = 0; return(error); }