[dm-devel] [PATCH] multipath-tools: fix a porting bug for random libprio

Kiyoshi Ueda k-ueda at ct.jp.nec.com
Thu Dec 20 18:13:50 UTC 2007


Hi Christophe,

The random prioritizer were not converted to the new scheme.
It should return the priority instead of print it.

--- git-20071214/libprio/random.c	2007-12-14 15:48:28.000000000 -0500
+++ random-prio-fix/libprio/random.c	2007-12-19 18:05:50.000000000 -0500
@@ -7,10 +7,11 @@
 
 int prio_random(struct path * pp)
 {
+	int ret;
 	struct timeval tv;
 	
 	gettimeofday(&tv, NULL);
 	srand((unsigned int)tv.tv_usec);
-	printf("%i\n", 1+(int) (10.0*rand()/(RAND_MAX+1.0)));
-	return 0;
+	ret = 1 + (int)(10.0 * rand() / (RAND_MAX + 1.0));
+	return ret;
 }

Thanks,
Kiyoshi Ueda




More information about the dm-devel mailing list