projects
/
fio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0726198
)
[PATCH] ini parser user friendliness
author
Jens Axboe
<axboe@suse.de>
Wed, 7 Jun 2006 09:10:39 +0000
(11:10 +0200)
committer
Jens Axboe
<axboe@suse.de>
Wed, 7 Jun 2006 09:10:39 +0000
(11:10 +0200)
init.c
patch
|
blob
|
blame
|
history
diff --git
a/init.c
b/init.c
index 069253f8cb76a1033883014c4e6d254ce528d7c3..d259c998c39215c3e0914b5aa1a57829bd464f9f 100644
(file)
--- a/
init.c
+++ b/
init.c
@@
-662,6
+662,7
@@
int parse_jobs_ini(char *file)
fpos_t off;
FILE *f;
char *p;
fpos_t off;
FILE *f;
char *p;
+ int ret = 0;
f = fopen(file, "r");
if (!f) {
f = fopen(file, "r");
if (!f) {
@@
-674,6
+675,8
@@
int parse_jobs_ini(char *file)
tmpbuf = malloc(4096);
while ((p = fgets(string, 4096, f)) != NULL) {
tmpbuf = malloc(4096);
while ((p = fgets(string, 4096, f)) != NULL) {
+ if (ret)
+ break;
if (is_empty_or_comment(p))
continue;
if (sscanf(p, "[%s]", name) != 1)
if (is_empty_or_comment(p))
continue;
if (sscanf(p, "[%s]", name) != 1)
@@
-684,8
+687,10
@@
int parse_jobs_ini(char *file)
name[strlen(name) - 1] = '\0';
td = get_new_job(global, &def_thread);
name[strlen(name) - 1] = '\0';
td = get_new_job(global, &def_thread);
- if (!td)
- return 1;
+ if (!td) {
+ ret = 1;
+ break;
+ }
fgetpos(f, &off);
while ((p = fgets(string, 4096, f)) != NULL) {
fgetpos(f, &off);
while ((p = fgets(string, 4096, f)) != NULL) {
@@
-699,7
+704,8
@@
int parse_jobs_ini(char *file)
if (!check_int(p, "prio", &prio)) {
#ifndef FIO_HAVE_IOPRIO
fprintf(stderr, "io priorities not available\n");
if (!check_int(p, "prio", &prio)) {
#ifndef FIO_HAVE_IOPRIO
fprintf(stderr, "io priorities not available\n");
- return 1;
+ ret = 1;
+ break;
#endif
td->ioprio |= prio;
fgetpos(f, &off);
#endif
td->ioprio |= prio;
fgetpos(f, &off);
@@
-708,7
+714,8
@@
int parse_jobs_ini(char *file)
if (!check_int(p, "prioclass", &prioclass)) {
#ifndef FIO_HAVE_IOPRIO
fprintf(stderr, "io priorities not available\n");
if (!check_int(p, "prioclass", &prioclass)) {
#ifndef FIO_HAVE_IOPRIO
fprintf(stderr, "io priorities not available\n");
- return 1;
+ ret = 1;
+ break;
#endif
td->ioprio |= prioclass << IOPRIO_CLASS_SHIFT;
fgetpos(f, &off);
#endif
td->ioprio |= prioclass << IOPRIO_CLASS_SHIFT;
fgetpos(f, &off);
@@
-737,7
+744,8
@@
int parse_jobs_ini(char *file)
if (!check_int(p, "cpumask", &cpu)) {
#ifndef FIO_HAVE_CPU_AFFINITY
fprintf(stderr, "cpu affinity not available\n");
if (!check_int(p, "cpumask", &cpu)) {
#ifndef FIO_HAVE_CPU_AFFINITY
fprintf(stderr, "cpu affinity not available\n");
- return 1;
+ ret = 1;
+ break;
#endif
fill_cpu_mask(td->cpumask, cpu);
fgetpos(f, &off);
#endif
fill_cpu_mask(td->cpumask, cpu);
fgetpos(f, &off);
@@
-930,20
+938,28
@@
int parse_jobs_ini(char *file)
continue;
}
continue;
}
+ /*
+ * Don't break here, continue parsing options so we
+ * dump all the bad ones. Makes trial/error fixups
+ * easier on the user.
+ */
printf("Client%d: bad option %s\n",td->thread_number,p);
printf("Client%d: bad option %s\n",td->thread_number,p);
- ret
urn
1;
+ ret
=
1;
}
}
- fsetpos(f, &off);
- if (add_job(td, name, 0))
- return 1;
+ if (!ret) {
+ fsetpos(f, &off);
+ ret = add_job(td, name, 0);
+ }
+ if (ret)
+ break;
}
free(string);
free(name);
free(tmpbuf);
fclose(f);
}
free(string);
free(name);
free(tmpbuf);
fclose(f);
- return
0
;
+ return
ret
;
}
static int fill_def_thread(void)
}
static int fill_def_thread(void)