PERFORCE change 119590 for review
Ulf Lilleengen
lulf at FreeBSD.org
Wed May 9 19:05:11 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=119590
Change 119590 by lulf at lulf_vimes on 2007/05/09 19:04:17
- Modify gv_resetconfig to use the event system in a different way.
Instead of posting lots of events, create a resetconfig event that
will be posted when userland requests it.
Affected files ...
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum.c#8 edit
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum.h#6 edit
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_rm.c#5 edit
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_var.h#6 edit
Differences ...
==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum.c#8 (text+ko) ====
@@ -345,7 +345,7 @@
gv_rename(gp, req);
} else if (!strcmp(verb, "resetconfig")) {
- gv_resetconfig(sc, req);
+ gv_post_event(sc, GV_EVENT_RESET_CONFIG, sc, NULL, NULL);
#if 0
} else if (!strcmp(verb, "start")) {
@@ -560,6 +560,14 @@
g_free(ev->arg3);
break;
+ case GV_EVENT_RESET_CONFIG:
+ printf("VINUM: event 'resetconfig'\n");
+ err = gv_resetconfig(sc);
+ if (err)
+ printf("VINUM: error resetting config: "
+ "%d\n", err);
+ break;
+
case GV_EVENT_THREAD_EXIT:
printf("VINUM: event 'thread exit'\n");
g_free(ev);
==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum.h#6 (text+ko) ====
@@ -51,7 +51,7 @@
/* geom_vinum_rm.c */
void gv_remove(struct g_geom *, struct gctl_req *);
-int gv_resetconfig(struct gv_softc *, struct gctl_req *);
+int gv_resetconfig(struct gv_softc *);
void gv_rm_sd(struct gv_softc *sc, struct gv_sd *s);
void gv_rm_drive(struct gv_softc *, struct gv_drive *);
void gv_rm_plex(struct gv_softc *, struct gv_plex *);
==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_rm.c#5 (text+ko) ====
@@ -154,7 +154,7 @@
/* Resets configuration */
int
-gv_resetconfig(struct gv_softc *sc, struct gctl_req *req)
+gv_resetconfig(struct gv_softc *sc)
{
struct gv_drive *d, *d2;
struct gv_volume *v, *v2;
@@ -164,19 +164,18 @@
/* First make sure nothing is open. */
LIST_FOREACH_SAFE(d, &sc->drives, drive, d2) {
if (gv_consumer_is_open(d->consumer)) {
- gctl_error(req, "drive '%s' is busy", d->name);
return (GV_ERR_ISOPEN);
}
}
/* Then if not, we remove everything. */
+ LIST_FOREACH_SAFE(d, &sc->drives, drive, d2)
+ gv_rm_drive(sc, d);
+ LIST_FOREACH_SAFE(s, &sc->subdisks, sd, s2)
+ gv_rm_sd(sc, s);
+ LIST_FOREACH_SAFE(p, &sc->plexes, plex, p2)
+ gv_rm_plex(sc, p);
LIST_FOREACH_SAFE(v, &sc->volumes, volume, v2)
- gv_post_event(sc, GV_EVENT_RM_VOLUME, v, NULL, NULL);
- LIST_FOREACH_SAFE(p, &sc->plexes, plex, p2)
- gv_post_event(sc, GV_EVENT_RM_PLEX, p, NULL, NULL);
- LIST_FOREACH_SAFE(s, &sc->subdisks, sd, s2)
- gv_post_event(sc, GV_EVENT_RM_SD, s, NULL, NULL);
- LIST_FOREACH_SAFE(d, &sc->drives, drive, d2)
- gv_post_event(sc, GV_EVENT_RM_DRIVE, d, NULL, NULL);
+ gv_rm_vol(sc, v);
gv_post_event(sc, GV_EVENT_SAVE_CONFIG, sc, NULL, NULL);
==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_var.h#6 (text+ko) ====
@@ -189,6 +189,7 @@
#define GV_EVENT_SET_DRIVE_STATE 14
#define GV_EVENT_SET_VOL_STATE 15
#define GV_EVENT_SET_PLEX_STATE 16
+#define GV_EVENT_RESET_CONFIG 17
struct gv_event {
int type;
More information about the p4-projects
mailing list