Make it possible to specify also via geom_t ID in the geom.ctl config ioctl.
Sponsored by: DARPA & NAI Labs.
This commit is contained in:
parent
f9d186edc8
commit
9b232f1493
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user