PERFORCE change 81585 for review

soc-cjones soc-cjones at FreeBSD.org
Sun Aug 7 02:22:44 GMT 2005


http://perforce.freebsd.org/chv.cgi?CH=81585

Change 81585 by soc-cjones at soc-cjones_ishtar on 2005/08/07 02:22:16

	It compiles.  Whee.

Affected files ...

.. //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_rename.c#2 edit

Differences ...

==== //depot/projects/soc2005/gvinum/src/sys/geom/vinum/geom_vinum_rename.c#2 (text+ko) ====

@@ -45,10 +45,10 @@
 static int	gv_rename_sd(struct gv_softc *, struct gctl_req *,
 				struct gv_sd *, char *, int);
 static int	gv_rename_vol(struct gv_softc *, struct gctl_req *,
-				struct gv_vol *, char *, int);
+				struct gv_volume *, char *, int);
 
 void
-gv_rename(struct g_geom *, struct gctl_req *)
+gv_rename(struct g_geom *gp, struct gctl_req *req)
 {
 	struct gv_softc *sc;
 	struct gv_volume *v;
@@ -66,14 +66,20 @@
 	argc = gctl_get_paraml(req, "argc", sizeof(*argc));
 	flags = gctl_get_paraml(req, "flags", sizeof(*flags));
 
-	newname = gctl_get_paraml(req, "newname", sizeof(*newname));
-	if (NULL == newname || 0 == *newname) {
+	newname = gctl_get_param(req, "newname", NULL);
+	if (NULL == newname) {
 		gctl_error(req, "no new name given");
 		return;
 	}
+	type = gv_object_type(sc, newname);
+	printf("gv_object_type(sc, \"%s\") = %d\n", newname, type);
+	if (-1 != type) {
+		gctl_error(req, "new name is already in use");
+		return;
+	}
 
-	object = gctl_get_paraml(req, "object", sizeof(*object));
-	if (NULL == object || 0 == *object) {
+	object = gctl_get_param(req, "object", NULL);
+	if (NULL == object) {
 		gctl_error(req, "no object given");
 		return;
 	}
@@ -96,6 +102,8 @@
 			gctl_error(req, "unknown plex '%s'", object);
 			return;
 		}
+		gctl_error(req, "calling gv_rename_plex(,, %s, %s,)", p, newname);
+		return;
 		err = gv_rename_plex(sc, req, p, newname, *flags);
 		if (err)
 			return;
@@ -106,6 +114,8 @@
 			gctl_error(req, "unknown subdisk '%s'", object);
 			return;
 		}
+		gctl_error(req, "calling gv_rename_sd(,, %s, %s,)", s, newname);
+		return;
 		err = gv_rename_sd(sc, req, s, newname, *flags);
 		if (err)
 			return;
@@ -116,6 +126,8 @@
 			gctl_error(req, "unknown drive '%s'", object);
 			return;
 		}
+		gctl_error(req, "calling gv_rename_drive(,, %s, %s,)", d, newname);
+		return;
 		err = gv_rename_drive(sc, req, d, newname, *flags);
 		if (err)
 			return;
@@ -136,6 +148,8 @@
 	g_topology_assert();
 	KASSERT(d != NULL, ("gv_rename_drive: NULL d"));
 
+	return (0);
+
 }
 
 static int	
@@ -146,6 +160,7 @@
 	g_topology_assert();
 	KASSERT(d != NULL, ("gv_rename_plex: NULL p"));
 
+	return (0);
 }
 
 static int 
@@ -156,14 +171,45 @@
 	g_topology_assert();
 	KASSERT(d != NULL, ("gv_rename_sd: NULL s"));
 
+	return (0);
 }
 
 static int 
-gv_rename_vol(struct gv_softc *sc, struct gctl_req *req, struct gv_vol *v, char *newname, int flags)
+gv_rename_vol(struct gv_softc *sc, struct gctl_req *req, struct gv_volume *v, char *newname, int flags)
 {
 	int err;
+	struct gv_plex *p;
+	struct gv_sd *s;
 
 	g_topology_assert();
 	KASSERT(d != NULL, ("gv_rename_vol: NULL v"));
 
+	printf("gv_rename_vol:\n");
+	printf("\tsc = %p\n", sc);
+	printf("\treq = %p\n", req);
+	printf("\tv = %p\n", v);
+	printf("\t\tv->name = %s\n", v->name);
+	printf("\t\tv->size = %d\n", (int) v->size);
+	printf("\t\tv->plexcount = %d\n", v->plexcount);
+	printf("\tnewname = \"%s\"\n", newname);
+	printf("\tflags = %x\n", flags);
+
+	printf("iterating across plexes list...\n");
+	LIST_FOREACH(p, &v->plexes, plex) {
+	  if (strcmp(p->volume, v->name)) {
+		continue; /* Not a plex we're looking for. */
+	  }
+	  printf("\tp->name = %s\n", p->name);
+	  printf("\tp->size = %d\n", (int) p->size);
+	  printf("\tp->volume = %s\n", p->volume);
+/*	  LIST_FOREACH(s, &p->subdisks, sd) {
+	    printf("\t\ts->name = %s\n", s->name);
+	    printf("\t\ts->size = %d\n", (int) s->size);
+	    printf("\t\ts->drive = %s\n", s->drive);
+	    printf("\t\ts->plex = %s\n", s->plex);
+	  } */
+	}
+
+	return (0);
+
 }


More information about the p4-projects mailing list