blkdebug: Refactor error injection
commitd157ed5f7235f3d2d5596a514ad7507b18e24b88
authorEric Blake <eblake@redhat.com>
Sat, 29 Apr 2017 19:14:15 +0000 (29 14:14 -0500)
committerMax Reitz <mreitz@redhat.com>
Thu, 11 May 2017 12:28:06 +0000 (11 14:28 +0200)
treeaf84490cac6f2a9e34a597b0e0a067e9b873c0b5
parente0ef439588ce1ede747f82b77d893190c1cc9f4d
blkdebug: Refactor error injection

Rather than repeat the logic at each caller of checking if a Rule
exists that warrants an error injection, fold that logic into
inject_error(); and rename it to rule_check() for legibility.
This will help the next patch, which adds two more callers that
need to check rules for the potential of injecting errors.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-id: 20170429191419.30051-6-eblake@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/blkdebug.c