From: Jacob Keller <jacob.e.keller@intel.com>
To: netdev@vger.kernel.org
Cc: Jacob Keller <jacob.e.keller@intel.com>,
Jonathan Corbet <corbet@lwn.net>, Jiri Pirko <jiri@nvidia.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
David Ahern <dsahern@kernel.org>,
Stephen Hemminger <stephen@networkplumber.org>
Subject: [iproute2-next 1/2] devlink: use dl_no_arg instead of checking dl_argc == 0
Date: Thu, 18 Aug 2022 14:15:20 -0700 [thread overview]
Message-ID: <20220818211521.169569-2-jacob.e.keller@intel.com> (raw)
In-Reply-To: <20220818211521.169569-1-jacob.e.keller@intel.com>
Use the helper dl_no_arg function to check for whether the command has any
arguments.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
devlink/devlink.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index 1ccb669c423b..aa4fdcff14ac 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -3358,7 +3358,7 @@ static int cmd_dev_param_show(struct dl *dl)
struct nlmsghdr *nlh;
int err;
- if (dl_argc(dl) == 0)
+ if (dl_no_arg(dl))
flags |= NLM_F_DUMP;
nlh = mnlu_gen_socket_cmd_prepare(&dl->nlg, DEVLINK_CMD_PARAM_GET, flags);
@@ -3514,7 +3514,7 @@ static int cmd_dev_show(struct dl *dl)
uint16_t flags = NLM_F_REQUEST | NLM_F_ACK;
int err;
- if (dl_argc(dl) == 0)
+ if (dl_no_arg(dl))
flags |= NLM_F_DUMP;
nlh = mnlu_gen_socket_cmd_prepare(&dl->nlg, DEVLINK_CMD_GET, flags);
@@ -3734,7 +3734,7 @@ static int cmd_dev_info(struct dl *dl)
return 0;
}
- if (dl_argc(dl) == 0)
+ if (dl_no_arg(dl))
flags |= NLM_F_DUMP;
nlh = mnlu_gen_socket_cmd_prepare(&dl->nlg, DEVLINK_CMD_INFO_GET, flags);
@@ -4537,7 +4537,7 @@ static int cmd_port_show(struct dl *dl)
uint16_t flags = NLM_F_REQUEST | NLM_F_ACK;
int err;
- if (dl_argc(dl) == 0)
+ if (dl_no_arg(dl))
flags |= NLM_F_DUMP;
nlh = mnlu_gen_socket_cmd_prepare(&dl->nlg, DEVLINK_CMD_PORT_GET, flags);
@@ -4605,7 +4605,7 @@ static int cmd_port_param_show(struct dl *dl)
struct nlmsghdr *nlh;
int err;
- if (dl_argc(dl) == 0)
+ if (dl_no_arg(dl))
flags |= NLM_F_DUMP;
nlh = mnlu_gen_socket_cmd_prepare(&dl->nlg, DEVLINK_CMD_PORT_PARAM_GET,
@@ -4959,7 +4959,7 @@ static int cmd_port_fn_rate_show(struct dl *dl)
uint16_t flags = NLM_F_REQUEST | NLM_F_ACK;
int err;
- if (dl_argc(dl) == 0)
+ if (dl_no_arg(dl))
flags |= NLM_F_DUMP;
nlh = mnlu_gen_socket_cmd_prepare(&dl->nlg, DEVLINK_CMD_RATE_GET, flags);
@@ -5326,7 +5326,7 @@ static int cmd_linecard_show(struct dl *dl)
uint16_t flags = NLM_F_REQUEST | NLM_F_ACK;
int err;
- if (dl_argc(dl) == 0)
+ if (dl_no_arg(dl))
flags |= NLM_F_DUMP;
nlh = mnlu_gen_socket_cmd_prepare(&dl->nlg, DEVLINK_CMD_LINECARD_GET,
@@ -5441,7 +5441,7 @@ static int cmd_sb_show(struct dl *dl)
uint16_t flags = NLM_F_REQUEST | NLM_F_ACK;
int err;
- if (dl_argc(dl) == 0)
+ if (dl_no_arg(dl))
flags |= NLM_F_DUMP;
nlh = mnlu_gen_socket_cmd_prepare(&dl->nlg, DEVLINK_CMD_SB_GET, flags);
@@ -5518,7 +5518,7 @@ static int cmd_sb_pool_show(struct dl *dl)
uint16_t flags = NLM_F_REQUEST | NLM_F_ACK;
int err;
- if (dl_argc(dl) == 0)
+ if (dl_no_arg(dl))
flags |= NLM_F_DUMP;
nlh = mnlu_gen_socket_cmd_prepare(&dl->nlg, DEVLINK_CMD_SB_POOL_GET, flags);
@@ -5603,7 +5603,7 @@ static int cmd_sb_port_pool_show(struct dl *dl)
uint16_t flags = NLM_F_REQUEST | NLM_F_ACK;
int err;
- if (dl_argc(dl) == 0)
+ if (dl_no_arg(dl))
flags |= NLM_F_DUMP;
nlh = mnlu_gen_socket_cmd_prepare(&dl->nlg, DEVLINK_CMD_SB_PORT_POOL_GET, flags);
@@ -5707,7 +5707,7 @@ static int cmd_sb_tc_bind_show(struct dl *dl)
uint16_t flags = NLM_F_REQUEST | NLM_F_ACK;
int err;
- if (dl_argc(dl) == 0)
+ if (dl_no_arg(dl))
flags |= NLM_F_DUMP;
nlh = mnlu_gen_socket_cmd_prepare(&dl->nlg, DEVLINK_CMD_SB_TC_POOL_BIND_GET, flags);
@@ -8377,7 +8377,7 @@ static int cmd_region_show(struct dl *dl)
uint16_t flags = NLM_F_REQUEST | NLM_F_ACK;
int err;
- if (dl_argc(dl) == 0)
+ if (dl_no_arg(dl))
flags |= NLM_F_DUMP;
nlh = mnlu_gen_socket_cmd_prepare(&dl->nlg, DEVLINK_CMD_REGION_GET, flags);
@@ -9047,7 +9047,7 @@ static int __cmd_health_show(struct dl *dl, bool show_device, bool show_port)
uint16_t flags = NLM_F_REQUEST | NLM_F_ACK;
int err;
- if (dl_argc(dl) == 0)
+ if (dl_no_arg(dl))
flags |= NLM_F_DUMP;
nlh = mnlu_gen_socket_cmd_prepare(&dl->nlg, DEVLINK_CMD_HEALTH_REPORTER_GET,
flags);
@@ -9239,7 +9239,7 @@ static int cmd_trap_show(struct dl *dl)
struct nlmsghdr *nlh;
int err;
- if (dl_argc(dl) == 0)
+ if (dl_no_arg(dl))
flags |= NLM_F_DUMP;
nlh = mnlu_gen_socket_cmd_prepare(&dl->nlg, DEVLINK_CMD_TRAP_GET, flags);
@@ -9314,7 +9314,7 @@ static int cmd_trap_group_show(struct dl *dl)
struct nlmsghdr *nlh;
int err;
- if (dl_argc(dl) == 0)
+ if (dl_no_arg(dl))
flags |= NLM_F_DUMP;
nlh = mnlu_gen_socket_cmd_prepare(&dl->nlg, DEVLINK_CMD_TRAP_GROUP_GET, flags);
@@ -9411,7 +9411,7 @@ static int cmd_trap_policer_show(struct dl *dl)
struct nlmsghdr *nlh;
int err;
- if (dl_argc(dl) == 0)
+ if (dl_no_arg(dl))
flags |= NLM_F_DUMP;
nlh = mnlu_gen_socket_cmd_prepare(&dl->nlg, DEVLINK_CMD_TRAP_POLICER_GET, flags);
--
2.37.1.394.gc50926e1f488
next prev parent reply other threads:[~2022-08-18 21:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-18 21:15 [iproute2-next 0/2] devlink: remove dl_argv_parse_put Jacob Keller
2022-08-18 21:15 ` Jacob Keller [this message]
2022-08-19 8:26 ` [iproute2-next 1/2] devlink: use dl_no_arg instead of checking dl_argc == 0 Jiri Pirko
2022-08-18 21:15 ` [iproute2-next 2/2] devlink: remove dl_argv_parse_put Jacob Keller
2022-08-19 8:27 ` Jiri Pirko
2022-08-19 8:27 ` [iproute2-next 0/2] " Jiri Pirko
2022-08-24 16:00 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220818211521.169569-2-jacob.e.keller@intel.com \
--to=jacob.e.keller@intel.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=jiri@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox