git.annexia.org
/
rhbz1184405.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ab8cea0
)
init: Repeat the test several times.
author
Richard W.M. Jones
<rjones@redhat.com>
Fri, 30 Jan 2015 11:25:02 +0000
(11:25 +0000)
committer
Richard W.M. Jones
<rjones@redhat.com>
Fri, 30 Jan 2015 11:25:02 +0000
(11:25 +0000)
init.c
patch
|
blob
|
history
diff --git
a/init.c
b/init.c
index
4694818
..
0757539
100644
(file)
--- a/
init.c
+++ b/
init.c
@@
-78,35
+78,39
@@
static char buffer[BUFSIZ];
static void
run_test (const char *dev)
{
static void
run_test (const char *dev)
{
- int fd;
+ int fd
, passno
;
uint64_t size;
ssize_t r;
printf ("init: testing %s\n", dev);
uint64_t size;
ssize_t r;
printf ("init: testing %s\n", dev);
- fflush (stdout);
- fd = open (dev, O_RDONLY);
- if (fd == -1) {
- perror (dev);
- _exit (EXIT_FAILURE);
- }
- if (ioctl (fd, BLKGETSIZE64, &size) == -1) {
- perror ("ioctl: BLKGETSIZE64");
- _exit (EXIT_FAILURE);
- }
+ for (passno = 0; passno < 5; ++passno) {
+ printf ("init: %s: pass %d\n", dev, passno);
+ fflush (stdout);
- while (size > 0) {
- r = read (fd, buffer, MIN (BUFSIZ, size));
- if (r == -1) {
- perror ("read");
+ fd = open (dev, O_RDONLY);
+ if (fd == -1) {
+ perror (dev);
+ _exit (EXIT_FAILURE);
+ }
+ if (ioctl (fd, BLKGETSIZE64, &size) == -1) {
+ perror ("ioctl: BLKGETSIZE64");
_exit (EXIT_FAILURE);
}
_exit (EXIT_FAILURE);
}
- size -= r;
- }
- if (close (fd) == -1) {
- perror ("close");
- _exit (EXIT_FAILURE);
+ while (size > 0) {
+ r = read (fd, buffer, MIN (BUFSIZ, size));
+ if (r == -1) {
+ perror ("read");
+ _exit (EXIT_FAILURE);
+ }
+ size -= r;
+ }
+
+ if (close (fd) == -1) {
+ perror ("close");
+ _exit (EXIT_FAILURE);
+ }
}
printf ("init: test of %s finished successfully\n", dev);
}
printf ("init: test of %s finished successfully\n", dev);