Use default method initialization on geoms.

This commit is contained in:
Poul-Henning Kamp 2004-08-08 06:49:07 +00:00
parent 199456973f
commit 650ee351b3
12 changed files with 33 additions and 35 deletions

View File

@ -130,10 +130,6 @@ g_bde_create_geom(struct gctl_req *req, struct g_class *mp, struct g_provider *p
gp = g_new_geomf(mp, "%s.bde", pp->name);
gp->start = g_bde_start;
gp->orphan = g_bde_orphan;
gp->access = g_bde_access;
gp->spoiled = g_std_spoiled;
cp = g_new_consumer(gp);
g_attach(cp, pp);
error = g_access(cp, 1, 1, 1);
@ -278,6 +274,10 @@ static struct g_class g_bde_class = {
.name = BDE_CLASS_NAME,
.destroy_geom = g_bde_destroy_geom,
.ctlreq = g_bde_ctlreq,
.start = g_bde_start,
.orphan = g_bde_orphan,
.access = g_bde_access,
.spoiled = g_std_spoiled,
};
DECLARE_GEOM_CLASS(g_bde_class, g_bde);

View File

@ -283,9 +283,6 @@ g_aes_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
g_trace(G_T_TOPOLOGY, "aes_taste(%s,%s)", mp->name, pp->name);
g_topology_assert();
gp = g_new_geomf(mp, "%s.aes", pp->name);
gp->start = g_aes_start;
gp->orphan = g_aes_orphan;
gp->spoiled = g_std_spoiled;
cp = g_new_consumer(gp);
g_attach(cp, pp);
error = g_access(cp, 1, 0, 0);
@ -321,7 +318,6 @@ g_aes_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
}
g_free(buf);
gp->softc = sc;
gp->access = g_aes_access;
sc->sectorsize = sectorsize;
sc->mediasize = mediasize - sectorsize;
rijndael_cipherInit(&sc->ci, MODE_CBC, NULL);
@ -369,6 +365,10 @@ g_aes_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
static struct g_class g_aes_class = {
.name = AES_CLASS_NAME,
.taste = g_aes_taste,
.start = g_aes_start,
.orphan = g_aes_orphan,
.spoiled = g_std_spoiled,
.access = g_aes_access,
};
DECLARE_GEOM_CLASS(g_aes_class, g_aes);

View File

@ -157,7 +157,6 @@ g_apple_taste(struct g_class *mp, struct g_provider *pp, int insist)
if (gp == NULL)
return (NULL);
g_topology_unlock();
gp->dumpconf = g_apple_dumpconf;
do {
if (gp->rank != 2 && insist == 0)
break;
@ -257,6 +256,7 @@ g_apple_taste(struct g_class *mp, struct g_provider *pp, int insist)
static struct g_class g_apple_class = {
.name = APPLE_CLASS_NAME,
.taste = g_apple_taste,
.dumpconf = g_apple_dumpconf,
};
DECLARE_GEOM_CLASS(g_apple_class, g_apple);

View File

@ -490,13 +490,6 @@ g_bsd_taste(struct g_class *mp, struct g_provider *pp, int flags)
if (gp == NULL)
return (NULL);
/*
* Fill in the optional details, in our case we have a dumpconf
* routine which the "slice" code should call at the right time
*/
gp->dumpconf = g_bsd_dumpconf;
gp->ioctl = g_bsd_ioctl;
/* Get the geom_slicer softc from the geom. */
gsp = gp->softc;
@ -671,6 +664,8 @@ static struct g_class g_bsd_class = {
.name = BSD_CLASS_NAME,
.taste = g_bsd_taste,
.ctlreq = g_bsd_config,
.dumpconf = g_bsd_dumpconf,
.ioctl = g_bsd_ioctl,
};
DECLARE_GEOM_CLASS(g_bsd_class, g_bsd);

View File

@ -718,9 +718,6 @@ g_ccd_create(struct gctl_req *req, struct g_class *mp)
}
gp = g_new_geomf(mp, "ccd%d", *unit);
gp->start = g_ccd_start;
gp->orphan = g_ccd_orphan;
gp->access = g_ccd_access;
sc = g_malloc(sizeof *sc, M_WAITOK | M_ZERO);
gp->softc = sc;
sc->sc_ndisks = *nprovider;
@ -863,6 +860,9 @@ static struct g_class g_ccd_class = {
.name = "CCD",
.ctlreq = g_ccd_config,
.destroy_geom = g_ccd_destroy_geom,
.start = g_ccd_start,
.orphan = g_ccd_orphan,
.access = g_ccd_access,
};
DECLARE_GEOM_CLASS(g_ccd_class, g_ccd);

View File

@ -77,6 +77,7 @@ static g_orphan_t g_dev_orphan;
static struct g_class g_dev_class = {
.name = "DEV",
.taste = g_dev_taste,
.orphan = g_dev_orphan,
};
void
@ -121,7 +122,6 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, int insist __unused)
if (cp->geom->class == mp)
return (NULL);
gp = g_new_geomf(mp, pp->name);
gp->orphan = g_dev_orphan;
cp = g_new_consumer(gp);
error = g_attach(cp, pp);
KASSERT(error == 0,

View File

@ -61,11 +61,18 @@ static struct mtx g_disk_done_mtx;
static g_access_t g_disk_access;
static g_init_t g_disk_init;
static g_fini_t g_disk_fini;
static g_start_t g_disk_start;
static g_ioctl_t g_disk_ioctl;
static g_dumpconf_t g_disk_dumpconf;
struct g_class g_disk_class = {
.name = "DISK",
.init = g_disk_init,
.fini = g_disk_fini,
.start = g_disk_start,
.access = g_disk_access,
.ioctl = g_disk_ioctl,
.dumpconf = g_disk_dumpconf,
};
static void
@ -334,11 +341,7 @@ g_disk_create(void *arg, int flag)
g_topology_assert();
dp = arg;
gp = g_new_geomf(&g_disk_class, "%s%d", dp->d_name, dp->d_unit);
gp->start = g_disk_start;
gp->access = g_disk_access;
gp->ioctl = g_disk_ioctl;
gp->softc = dp;
gp->dumpconf = g_disk_dumpconf;
pp = g_new_providerf(gp, "%s", gp->name);
pp->mediasize = dp->d_mediasize;
pp->sectorsize = dp->d_sectorsize;

View File

@ -357,10 +357,6 @@ g_fox_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
gp->softc = g_malloc(sizeof(struct g_fox_softc), M_WAITOK | M_ZERO);
sc = gp->softc;
gp->start = g_fox_start;
gp->spoiled = g_fox_orphan;
gp->orphan = g_fox_orphan;
gp->access= g_fox_access;
cp = g_new_consumer(gp);
g_attach(cp, pp);
error = g_access(cp, 1, 0, 0);
@ -466,6 +462,10 @@ static struct g_class g_fox_class = {
.name = FOX_CLASS_NAME,
.taste = g_fox_taste,
.destroy_geom = g_fox_destroy_geom,
.start = g_fox_start,
.spoiled = g_fox_orphan,
.orphan = g_fox_orphan,
.access= g_fox_access,
};
DECLARE_GEOM_CLASS(g_fox_class, g_fox);

View File

@ -134,7 +134,6 @@ g_gpt_taste(struct g_class *mp, struct g_provider *pp, int insist)
return (NULL);
g_topology_unlock();
gp->dumpconf = g_gpt_dumpconf;
do {
mbr = NULL;
@ -231,6 +230,7 @@ g_gpt_taste(struct g_class *mp, struct g_provider *pp, int insist)
static struct g_class g_gpt_class = {
.name = "GPT",
.taste = g_gpt_taste,
.dumpconf = g_gpt_dumpconf,
};
DECLARE_GEOM_CLASS(g_gpt_class, g_gpt);

View File

@ -241,8 +241,6 @@ g_mbr_taste(struct g_class *mp, struct g_provider *pp, int insist)
if (gp == NULL)
return (NULL);
g_topology_unlock();
gp->dumpconf = g_mbr_dumpconf;
gp->ioctl = g_mbr_ioctl;
do {
/* XXX: phk think about this! */
if (gp->rank != 2 &&
@ -279,6 +277,8 @@ g_mbr_taste(struct g_class *mp, struct g_provider *pp, int insist)
static struct g_class g_mbr_class = {
.name = MBR_CLASS_NAME,
.taste = g_mbr_taste,
.dumpconf = g_mbr_dumpconf,
.ioctl = g_mbr_ioctl,
};
DECLARE_GEOM_CLASS(g_mbr_class, g_mbr);
@ -348,7 +348,6 @@ g_mbrext_taste(struct g_class *mp, struct g_provider *pp, int insist __unused)
if (gp == NULL)
return (NULL);
g_topology_unlock();
gp->dumpconf = g_mbrext_dumpconf;
off = 0;
slice = 0;
do {
@ -420,6 +419,7 @@ g_mbrext_taste(struct g_class *mp, struct g_provider *pp, int insist __unused)
static struct g_class g_mbrext_class = {
.name = MBREXT_CLASS_NAME,
.taste = g_mbrext_taste,
.dumpconf = g_mbrext_dumpconf,
};
DECLARE_GEOM_CLASS(g_mbrext_class, g_mbrext);

View File

@ -238,8 +238,6 @@ g_pc98_taste(struct g_class *mp, struct g_provider *pp, int flags)
if (gp == NULL)
return (NULL);
g_topology_unlock();
gp->dumpconf = g_pc98_dumpconf;
gp->ioctl = g_pc98_ioctl;
do {
if (gp->rank != 2 && flags == G_TF_NORMAL)
break;
@ -284,6 +282,8 @@ g_pc98_taste(struct g_class *mp, struct g_provider *pp, int flags)
static struct g_class g_pc98_class = {
.name = PC98_CLASS_NAME,
.taste = g_pc98_taste,
.dumpconf = g_pc98_dumpconf,
.ioctl = g_pc98_ioctl,
};
DECLARE_GEOM_CLASS(g_pc98_class, g_pc98);

View File

@ -243,7 +243,6 @@ g_sunlabel_taste(struct g_class *mp, struct g_provider *pp, int flags)
if (gp == NULL)
return (NULL);
gsp = gp->softc;
gp->dumpconf = g_sunlabel_dumpconf;
do {
if (gp->rank != 2 && flags == G_TF_NORMAL)
break;
@ -276,6 +275,7 @@ static struct g_class g_sunlabel_class = {
.name = SUNLABEL_CLASS_NAME,
.taste = g_sunlabel_taste,
.ctlreq = g_sunlabel_config,
.dumpconf = g_sunlabel_dumpconf,
};
DECLARE_GEOM_CLASS(g_sunlabel_class, g_sunlabel);