[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180104070150.15625-5-leon@kernel.org>
Date: Thu, 4 Jan 2018 09:01:45 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Doug Ledford <dledford@...hat.com>,
Jason Gunthorpe <jgg@...lanox.com>,
David Ahern <dsahern@...il.com>
Cc: RDMA mailing list <linux-rdma@...r.kernel.org>,
Leon Romanovsky <leon@...nel.org>,
netdev <netdev@...r.kernel.org>,
Stephen Hemminger <stephen@...workplumber.org>,
Leon Romanovsky <leonro@...lanox.com>
Subject: [PATCH iproute2-next v1 4/9] rdma: Set pointer to device name position
From: Leon Romanovsky <leonro@...lanox.com>
The dev and link execution callbacks expects that next
command line argument is device or port name.
Set pointer to device or port name position prior calls to
rd_exec_dev()/rd_exec_link().
Signed-off-by: Leon Romanovsky <leonro@...lanox.com>
---
rdma/rdma.h | 1 +
rdma/utils.c | 19 +++++++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/rdma/rdma.h b/rdma/rdma.h
index cd415670..e842d076 100644
--- a/rdma/rdma.h
+++ b/rdma/rdma.h
@@ -81,6 +81,7 @@ int rd_exec_cmd(struct rd *rd, const struct rd_cmd *c, const char *str);
int rd_exec_dev(struct rd *rd, int (*cb)(struct rd *rd));
int rd_exec_link(struct rd *rd, int (*cb)(struct rd *rd), bool strict_port);
void rd_free(struct rd *rd);
+int rd_set_arg_to_devname(struct rd *rd);
int rd_argc(struct rd *rd);
/*
diff --git a/rdma/utils.c b/rdma/utils.c
index 446c23da..73f0d04e 100644
--- a/rdma/utils.c
+++ b/rdma/utils.c
@@ -403,6 +403,25 @@ void rd_free(struct rd *rd)
filters_cleanup(rd);
}
+int rd_set_arg_to_devname(struct rd *rd)
+{
+ int ret = 0;
+
+ while (!rd_no_arg(rd)) {
+ if (rd_argv_match(rd, "dev") || rd_argv_match(rd, "link")) {
+ rd_arg_inc(rd);
+ if (rd_no_arg(rd)) {
+ pr_err("No device name was supplied\n");
+ ret = -EINVAL;
+ }
+ goto out;
+ }
+ rd_arg_inc(rd);
+ }
+out:
+ return ret;
+}
+
int rd_exec_link(struct rd *rd, int (*cb)(struct rd *rd), bool strict_port)
{
struct dev_map *dev_map;
--
2.15.1
Powered by blists - more mailing lists