Re: [PATCH iproute2-next v2] devlink: Add health command support
From: David Ahern <hidden>
Date: 2019-01-24 00:27:50
On 1/23/19 4:27 AM, Aya Levin wrote:
quoted
quoted
@@ -1298,6 +1322,12 @@ static int dl_argv_parse(struct dl *dl, uint32_t o_required, return -EINVAL; } + if ((o_required & DL_OPT_HEALTH_REPORTER_NAME) && + !(o_found & DL_OPT_HEALTH_REPORTER_NAME)) { + pr_err("Reporter name expected.\n"); + return -EINVAL; + }I realize your are following suit with this change, but these checks for 'required and not found' are getting really long. There is a better way to do this.Do you mean somthing like: #define requiered_not_found(o_found, o_required, flag, msg) \ ({ \ if ((o_required & flag) && !(o_found & flag)) { \ pr_err("%s \n", msg); \ return -EINVAL; \ } \ })
That's one way. I was also thinking a helper that does a single loop with an array of bits and messages to print if required and not found. That parse function is currently 355 lines long with a lot of repetition.