PERFORCE change 122416 for review
Ulf Lilleengen
lulf at FreeBSD.org
Wed Jun 27 17:35:40 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=122416
Change 122416 by lulf at lulf_carrot on 2007/06/27 17:35:18
- Fix bug in renaming code where we missed an 's'
- Enable support for renaming in 'attach' command.
- Enable support for setting subdisk offset when attaching a subdisk to
a plex.
Affected files ...
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum.c#21 edit
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_subr.c#12 edit
Differences ...
==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum.c#21 (text+ko) ====
@@ -216,9 +216,17 @@
gctl_error(req, "no parent given");
return;
}
-
offset = gctl_get_paraml(req, "offset", sizeof(*offset));
+ if (offset == NULL) {
+ gctl_error(req, "no offset given");
+ return;
+ }
rename = gctl_get_paraml(req, "rename", sizeof(*rename));
+ if (rename == NULL) {
+ gctl_error(req, "no rename flag given");
+ return;
+ }
+
type_child = gv_object_type(sc, child);
type_parent = gv_object_type(sc, parent);
@@ -230,8 +238,7 @@
}
v = gv_find_vol(sc, parent);
p = gv_find_plex(sc, child);
- /* XXX: Rename not supported yet. */
- gv_post_event(sc, GV_EVENT_ATTACH_PLEX, p, v, 0, 0);
+ gv_post_event(sc, GV_EVENT_ATTACH_PLEX, p, v, *offset, *rename);
break;
case GV_TYPE_SD:
if (type_parent != GV_TYPE_PLEX) {
@@ -241,7 +248,7 @@
p = gv_find_plex(sc, parent);
s = gv_find_sd(sc, child);
/* XXX: Rename not supported yet. */
- gv_post_event(sc, GV_EVENT_ATTACH_SD, s, p, 0, 0);
+ gv_post_event(sc, GV_EVENT_ATTACH_SD, s, p, *offset, *rename);
break;
default:
gctl_error(req, "invalid child type");
@@ -514,7 +521,8 @@
struct gv_sd *s;
struct gv_drive *d;
struct bio *bp;
- int newstate, flags, err;
+ int newstate, flags, err, rename;
+ off_t offset;
sc = arg;
KASSERT(sc != NULL, ("NULL sc"));
@@ -699,7 +707,8 @@
printf("VINUM: event 'attach'\n");
p = ev->arg1;
v = ev->arg2;
- err = gv_attach_plex(p, v, 0);
+ rename = ev->arg4;
+ err = gv_attach_plex(p, v, rename);
if (err)
printf("VINUM: error attaching %s to "
"%s: error code %d\n", p->name,
@@ -710,7 +719,9 @@
printf("VINUM: event 'attach'\n");
s = ev->arg1;
p = ev->arg2;
- err = gv_attach_sd(s, p, -1, 0);
+ offset = ev->arg3;
+ rename = ev->arg4;
+ err = gv_attach_sd(s, p, offset, rename);
if (err)
printf("VINUM: error attaching %s to "
"%s: error code %d\n", s->name,
==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_subr.c#12 (text+ko) ====
@@ -1105,7 +1105,7 @@
gv_update_plex_config(p);
if (rename) {
- snprintf(s->name, GV_MAXSDNAME, "%s.%d", s->plex,
+ snprintf(s->name, GV_MAXSDNAME, "%s.s%d", s->plex,
p->sdcount - 1);
}
gv_save_config(p->vinumconf);
More information about the p4-projects
mailing list