summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Sumrall <ksumrall@android.com>2012-06-27 16:01:40 -0700
committerKen Sumrall <ksumrall@android.com>2012-06-27 16:06:41 -0700
commit32243fadeab8cf244861e3df89744b78ba3eff92 (patch)
tree2a7c2885312884861def23373f650b78ba2892b0
parent2633ce5ca5024d5565c9068c29ec39a8c3ed10e9 (diff)
downloadextras-jb-release.tar.gz
Fix the code to properly read urandom to init the random number generator. Fix to properly read the arguments if any options are given. Fix to enable it to be built against glibc. Change-Id: I9127a71232e39afa3054fe9f1612def9ae13d9d3
-rw-r--r--tests/ext4/rand_emmc_perf.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/ext4/rand_emmc_perf.c b/tests/ext4/rand_emmc_perf.c
index d55adc93..1f79c753 100644
--- a/tests/ext4/rand_emmc_perf.c
+++ b/tests/ext4/rand_emmc_perf.c
@@ -19,7 +19,8 @@
* out. Without O_SYNC, the close(2) blocks until all the dirty buffers are written
* out, but the numbers tend to be higher.
*/
-
+
+#define _LARGEFILE64_SOURCE
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
@@ -27,6 +28,7 @@
#include <fcntl.h>
#include <sys/time.h>
#include <stdlib.h>
+#include <unistd.h>
#define TST_BLK_SIZE 4096
/* Number of seconds to run the test */
@@ -79,14 +81,14 @@ int main(int argc, char *argv[])
}
/* Size is given in megabytes, so compute the number of TST_BLK_SIZE blocks. */
- max_blocks = atol(argv[2]) * ((1024*1024) / TST_BLK_SIZE);
+ max_blocks = atol(argv[optind]) * ((1024*1024) / TST_BLK_SIZE);
- if ((fd = open(argv[3], O_RDWR | o_sync)) < 0) {
- fprintf(stderr, "Cannot open block device %s\n", argv[2]);
+ if ((fd = open(argv[optind + 1], O_RDWR | o_sync)) < 0) {
+ fprintf(stderr, "Cannot open block device %s\n", argv[optind + 1]);
exit(1);
}
- fd2 = open("/dev/urandom\n", O_RDONLY);
+ fd2 = open("/dev/urandom", O_RDONLY);
if (fd2 < 0) {
fprintf(stderr, "Cannot open /dev/urandom\n");
}