IOPRIO_CLASS_NONE with any priority value actually is an alias for
IOPRIO_CLASS_BE with priority value 4 – which is the default ioprio for
all processes.
We got this right at one place, but wrong at three others (where we
assumed the default value was 0, not 4). Let's add a
macro that encodes this properly, and use it everywhere.
}
int ioprio_parse_priority(const char *s, int *ret);
+
+/* IOPRIO_CLASS_NONE with any prio value is another way to say IOPRIO_CLASS_BE with level 4. Encode that in a
+ * proper macro. */
+#define IOPRIO_DEFAULT_CLASS_AND_PRIO ioprio_prio_value(IOPRIO_CLASS_BE, 4)
assert(c);
c->umask = 0022;
- c->ioprio = ioprio_prio_value(IOPRIO_CLASS_BE, 0);
+ c->ioprio = IOPRIO_DEFAULT_CLASS_AND_PRIO;
c->cpu_sched_policy = SCHED_OTHER;
c->syslog_priority = LOG_DAEMON|LOG_INFO;
c->syslog_level_prefix = true;
p = ioprio_get(IOPRIO_WHO_PROCESS, 0);
if (p < 0)
- return ioprio_prio_value(IOPRIO_CLASS_BE, 4);
+ return IOPRIO_DEFAULT_CLASS_AND_PRIO;
return p;
}
if (isempty(rvalue)) {
c->ioprio_set = false;
- c->ioprio = ioprio_prio_value(IOPRIO_CLASS_BE, 0);
+ c->ioprio = IOPRIO_DEFAULT_CLASS_AND_PRIO;
return 0;
}
if (isempty(rvalue)) {
c->ioprio_set = false;
- c->ioprio = ioprio_prio_value(IOPRIO_CLASS_BE, 0);
+ c->ioprio = IOPRIO_DEFAULT_CLASS_AND_PRIO;
return 0;
}