From 440914a8bbf4c64c1720b566ce5b3305d19e305d Mon Sep 17 00:00:00 2001 From: le Date: Fri, 27 Aug 2004 21:32:18 +0000 Subject: Move config_new_drive() to the correct place and rename it to gv_config_new_drive(). --- sys/geom/vinum/geom_vinum.c | 33 +-------------------------------- sys/geom/vinum/geom_vinum.h | 1 + sys/geom/vinum/geom_vinum_drive.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 32 deletions(-) (limited to 'sys/geom') diff --git a/sys/geom/vinum/geom_vinum.c b/sys/geom/vinum/geom_vinum.c index 2423202..92b0a4b4 100644 --- a/sys/geom/vinum/geom_vinum.c +++ b/sys/geom/vinum/geom_vinum.c @@ -50,7 +50,6 @@ SYSCTL_UINT(_kern_geom_vinum, OID_AUTO, debug, CTLFLAG_RW, &gv_debug, 0, #endif int gv_create(struct g_geom *, struct gctl_req *); -void config_new_drive(struct gv_drive *); static void gv_orphan(struct g_consumer *cp) @@ -262,36 +261,6 @@ gv_taste(struct g_class *mp, struct g_provider *pp, int flags __unused) } } -/* XXX this really belongs somewhere else */ -void -config_new_drive(struct gv_drive *d) -{ - struct gv_hdr *vhdr; - struct gv_freelist *fl; - - KASSERT(d != NULL, ("config_new_drive: NULL d")); - - vhdr = g_malloc(sizeof(*vhdr), M_WAITOK | M_ZERO); - vhdr->magic = GV_MAGIC; - vhdr->config_length = GV_CFG_LEN; - - bcopy(hostname, vhdr->label.sysname, GV_HOSTNAME_LEN); - strncpy(vhdr->label.name, d->name, GV_MAXDRIVENAME); - microtime(&vhdr->label.date_of_birth); - - d->hdr = vhdr; - - LIST_INIT(&d->subdisks); - LIST_INIT(&d->freelist); - - fl = g_malloc(sizeof(struct gv_freelist), M_WAITOK | M_ZERO); - fl->offset = GV_DATA_START; - fl->size = d->avail; - LIST_INSERT_HEAD(&d->freelist, fl, freelist); - d->freelist_entries = 1; - -} - /* Handle userland requests for creating new objects. */ int gv_create(struct g_geom *gp, struct gctl_req *req) @@ -336,7 +305,7 @@ gv_create(struct g_geom *gp, struct gctl_req *req) d->size = pp->mediasize - GV_DATA_START; d->avail = d->size; - config_new_drive(d); + gv_config_new_drive(d); LIST_INSERT_HEAD(&sc->drives, d, drive); } diff --git a/sys/geom/vinum/geom_vinum.h b/sys/geom/vinum/geom_vinum.h index d69e104..23c15b2 100644 --- a/sys/geom/vinum/geom_vinum.h +++ b/sys/geom/vinum/geom_vinum.h @@ -32,6 +32,7 @@ #define ERRBUFSIZ 1024 /* geom_vinum_drive.c */ +void gv_config_new_drive(struct gv_drive *); void gv_save_config_all(struct gv_softc *); void gv_save_config(struct g_consumer *, struct gv_drive *, struct gv_softc *); diff --git a/sys/geom/vinum/geom_vinum_drive.c b/sys/geom/vinum/geom_vinum_drive.c index 12929fb..62bb6f1 100644 --- a/sys/geom/vinum/geom_vinum_drive.c +++ b/sys/geom/vinum/geom_vinum_drive.c @@ -50,6 +50,34 @@ __FBSDID("$FreeBSD$"); void gv_drive_modify(struct gv_drive *); void +gv_config_new_drive(struct gv_drive *d) +{ + struct gv_hdr *vhdr; + struct gv_freelist *fl; + + KASSERT(d != NULL, ("config_new_drive: NULL d")); + + vhdr = g_malloc(sizeof(*vhdr), M_WAITOK | M_ZERO); + vhdr->magic = GV_MAGIC; + vhdr->config_length = GV_CFG_LEN; + + bcopy(hostname, vhdr->label.sysname, GV_HOSTNAME_LEN); + strncpy(vhdr->label.name, d->name, GV_MAXDRIVENAME); + microtime(&vhdr->label.date_of_birth); + + d->hdr = vhdr; + + LIST_INIT(&d->subdisks); + LIST_INIT(&d->freelist); + + fl = g_malloc(sizeof(struct gv_freelist), M_WAITOK | M_ZERO); + fl->offset = GV_DATA_START; + fl->size = d->avail; + LIST_INSERT_HEAD(&d->freelist, fl, freelist); + d->freelist_entries = 1; +} + +void gv_save_config_all(struct gv_softc *sc) { struct gv_drive *d; -- cgit v1.1