Buffer usage condition do not support having both ratio and bytes
threshold set.
Using `!usage->threshold_ratio.set && !usage->threshold_bytes.set` does
not error out for `threshold_ratio.set == 1` and
`usage->threshold_bytes.set == 1`
0 0 : 1
0 1 : 0
1 0 : 0
1 1 : 0
We want to check for a xnor (`usage->threshold_ratio.set == usage->threshold_bytes.set`)
0 0 : 1
0 1 : 0
1 0 : 0
1 1 : 1
We could also do 2 error check one for not set and one validating that
both are not set.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I5bfcf43bcaf9687ddf9fdebe5ace4f15bda28261
ERR("Invalid buffer condition: a target channel name must be set.");
goto end;
}
- if (!usage->threshold_ratio.set && !usage->threshold_bytes.set) {
- ERR("Invalid buffer condition: a threshold must be set.");
+ if (usage->threshold_ratio.set == usage->threshold_bytes.set) {
+ ERR("Invalid buffer condition: a threshold must be set or both type cannot be used simultaneously.");
goto end;
}
if (!usage->domain.set) {