PERFORCE change 118257 for review

Ulf Lilleengen lulf at FreeBSD.org
Mon Apr 16 19:25:17 UTC 2007


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

Change 118257 by lulf at lulf_vimes on 2007/04/16 19:24:27

	- Fix compilation issues.
	- Now we have a working setstate.

Affected files ...

.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum.c#4 edit
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum.h#3 edit
.. //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_state.c#4 edit

Differences ...

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum.c#4 (text+ko) ====

@@ -507,31 +507,31 @@
 			case GV_EVENT_SET_SD_STATE:
 				printf("VINUM: event 'setstate sd'\n");
 				s = ev->arg1;
-				newstate = *ev->arg2;
-				flags = *ev->arg3;
+				newstate = *(int *)ev->arg2;
+				flags = *(int *)ev->arg3;
 				err = gv_set_sd_state(s, newstate, flags);
 				/* XXX: Handle these errors better, provide
 				 * ERROR CODES.*/
 				if (err)
 					printf("VINUM: error setting subdisk "
 					    "state\n");
-				free(ev->arg2);
-				free(ev->arg3);
+				g_free(ev->arg2);
+				g_free(ev->arg3);
 				break;
 
 			case GV_EVENT_SET_DRIVE_STATE:
 				printf("VINUM: event 'setstate drive'\n");
 				d = ev->arg1;
-				newstate = *ev->arg2;
-				flags = *ev->arg3;
+				newstate = *(int *)ev->arg2;
+				flags = *(int *)ev->arg3;
 				err = gv_set_drive_state(d, newstate, flags);
 				/* XXX: Handle these errors better, provide
 				 * ERROR CODES.*/
 				if (err)
 					printf("VINUM: error setting drive "
 					    "state");
-				free(ev->arg2);
-				free(ev->arg3);
+				g_free(ev->arg2);
+				g_free(ev->arg3);
 				break;
 
 			case GV_EVENT_THREAD_EXIT:

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum.h#3 (text+ko) ====

@@ -104,4 +104,6 @@
 void	gv_create_plex(struct gv_softc *, struct gv_plex *);
 void	gv_create_sd(struct gv_softc *, struct gv_sd *);
 
+int	gv_stripe_active(struct gv_plex *, struct bio *);
+
 #endif /* !_GEOM_VINUM_H_ */

==== //depot/projects/soc2007/lulf/gvinum_fixup/sys/geom/vinum/geom_vinum_state.c#4 (text+ko) ====

@@ -44,7 +44,7 @@
 	struct gv_sd *s;
 	struct gv_drive *d;
 	char *obj, *state;
-	int *f, *flags, *newstate, type;
+	int f, *flags, *newstatep, *flagp, type;
 
 	f = 0;
 	obj = gctl_get_param(req, "object", NULL);
@@ -82,9 +82,11 @@
 			break;
 		}
 		s = gv_find_sd(sc, obj);
-		newstatep = malloc(sizeof(int), M_WAITOK | M_ZERO));
+
+		/* XXX: Should try to avoid malloc. */
+		newstatep = g_malloc(sizeof(int), M_WAITOK | M_ZERO);
 		*newstatep = gv_sdstatei(state);
-		flagp = malloc(sizeof(int), M_WAITOK | M_ZERO));
+		flagp = g_malloc(sizeof(int), M_WAITOK | M_ZERO);
 		*flagp = f;
 		gv_post_event(sc, GV_EVENT_SET_SD_STATE, s, newstatep, flagp);
 		break;
@@ -96,9 +98,10 @@
 		}
 		d = gv_find_drive(sc, obj);
 
-		newstatep = malloc(sizeof(int), M_WAITOK | M_ZERO));
+		/* XXX: Should try to avoid malloc. */
+		newstatep = g_malloc(sizeof(int), M_WAITOK | M_ZERO);
 		*newstatep = gv_sdstatei(state);
-		flagp = malloc(sizeof(int), M_WAITOK | M_ZERO));
+		flagp = g_malloc(sizeof(int), M_WAITOK | M_ZERO);
 		*flagp = f;
 		gv_post_event(sc, GV_EVENT_SET_DRIVE_STATE, d, newstatep, flagp);
 		break;


More information about the p4-projects mailing list