condition: buffer usage: validation does not check for ratio and bytes threshold
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Thu, 4 Feb 2021 20:46:27 +0000 (15:46 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 11 Jun 2021 20:51:57 +0000 (16:51 -0400)
commit0879b5fefc747e458f1529b99895ef2a47428393
treeb07e6c44a1a93668a772604d21930a81aed78d4d
parent1b8894d079813c9e8a29e2da64f6427e62514a0e
condition: buffer usage: validation does not check for ratio and bytes threshold

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
src/common/conditions/buffer-usage.c
This page took 0.037114 seconds and 5 git commands to generate.