netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Serhey Popovych <serhe.popovych@gmail.com>
To: netdev@vger.kernel.org
Subject: [PATCH iproute2-next 1/3] ip: Consolidate ip, xdp and lwtunnel parse/dump prototypes in ip_common.h
Date: Wed, 31 Jan 2018 10:15:06 +0200	[thread overview]
Message-ID: <1517386508-10915-2-git-send-email-serhe.popovych@gmail.com> (raw)
In-Reply-To: <1517386508-10915-1-git-send-email-serhe.popovych@gmail.com>

Having iplink_parse() and @struct iplink_req in include/utils.h does not
reflect it's IP nature: move to ip/ip_common.h.

Move contents of ip/iplink_xdp.h and ip/iproute_lwtunnel.h to
ip/ip_common.h since they are small (i.e. only two function prototypes):
ip/iplink_bridge.c and ip/iplink_vrf.c prototypes already there.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
---
 include/utils.h       |   10 ----------
 ip/ip_common.h        |   21 +++++++++++++++++++++
 ip/ipaddress.c        |    1 -
 ip/iplink.c           |    1 -
 ip/iplink_xdp.c       |    4 ++--
 ip/iproute.c          |    1 -
 ip/iproute_lwtunnel.c |    4 ++--
 ip/iproute_lwtunnel.h |    9 ---------
 ip/xdp.h              |   11 -----------
 9 files changed, 25 insertions(+), 37 deletions(-)
 delete mode 100644 ip/iproute_lwtunnel.h
 delete mode 100644 ip/xdp.h

diff --git a/include/utils.h b/include/utils.h
index 0394268..f81928a 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -272,16 +272,6 @@ extern int cmdlineno;
 ssize_t getcmdline(char **line, size_t *len, FILE *in);
 int makeargs(char *line, char *argv[], int maxargs);
 
-struct iplink_req {
-	struct nlmsghdr		n;
-	struct ifinfomsg	i;
-	char			buf[1024];
-};
-
-int iplink_parse(int argc, char **argv, struct iplink_req *req,
-		char **name, char **type, char **link, char **dev,
-		int *group, int *index);
-
 int do_each_netns(int (*func)(char *nsname, void *arg), void *arg,
 		bool show_label);
 
diff --git a/ip/ip_common.h b/ip/ip_common.h
index 3203f0c..35df364 100644
--- a/ip/ip_common.h
+++ b/ip/ip_common.h
@@ -109,6 +109,12 @@ static inline int rtm_get_table(struct rtmsg *r, struct rtattr **tb)
 
 extern struct rtnl_handle rth;
 
+struct iplink_req {
+	struct nlmsghdr		n;
+	struct ifinfomsg	i;
+	char			buf[1024];
+};
+
 struct link_util {
 	struct link_util	*next;
 	const char		*id;
@@ -129,11 +135,26 @@ struct link_util {
 
 struct link_util *get_link_kind(const char *kind);
 
+int iplink_parse(int argc, char **argv, struct iplink_req *req,
+		 char **name, char **type, char **link, char **dev,
+		 int *group, int *index);
+
+/* iplink_bridge.c */
 void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, size_t len);
 int bridge_parse_xstats(struct link_util *lu, int argc, char **argv);
 int bridge_print_xstats(const struct sockaddr_nl *who,
 			struct nlmsghdr *n, void *arg);
 
+/* iproute_lwtunnel.c */
+int lwt_parse_encap(struct rtattr *rta, size_t len, int *argcp, char ***argvp);
+void lwt_print_encap(FILE *fp, struct rtattr *encap_type, struct rtattr *encap);
+
+/* iplink_xdp.c */
+int xdp_parse(int *argc, char ***argv, struct iplink_req *req, __u32 ifindex,
+	      bool generic, bool drv, bool offload);
+void xdp_dump(FILE *fp, struct rtattr *tb, bool link, bool details);
+
+/* iplink_vrf.c */
 __u32 ipvrf_get_table(const char *name);
 int name_is_vrf(const char *name);
 
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 051a05f..acb9936 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -34,7 +34,6 @@
 #include "utils.h"
 #include "ll_map.h"
 #include "ip_common.h"
-#include "xdp.h"
 #include "color.h"
 
 enum {
diff --git a/ip/iplink.c b/ip/iplink.c
index 230f4c5..6cbd04f 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -31,7 +31,6 @@
 #include "rt_names.h"
 #include "utils.h"
 #include "ip_common.h"
-#include "xdp.h"
 #include "namespace.h"
 
 #define IPLINK_IOCTL_COMPAT	1
diff --git a/ip/iplink_xdp.c b/ip/iplink_xdp.c
index 6eeb820..8382635 100644
--- a/ip/iplink_xdp.c
+++ b/ip/iplink_xdp.c
@@ -14,9 +14,9 @@
 
 #include <linux/bpf.h>
 
-#include "json_print.h"
-#include "xdp.h"
 #include "bpf_util.h"
+#include "utils.h"
+#include "ip_common.h"
 
 extern int force;
 
diff --git a/ip/iproute.c b/ip/iproute.c
index bf886fd..7616c0d 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -28,7 +28,6 @@
 #include "rt_names.h"
 #include "utils.h"
 #include "ip_common.h"
-#include "iproute_lwtunnel.h"
 
 #ifndef RTAX_RTTVAR
 #define RTAX_RTTVAR RTAX_HOPS
diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c
index ffa897a..f7fbc62 100644
--- a/ip/iproute_lwtunnel.c
+++ b/ip/iproute_lwtunnel.c
@@ -22,9 +22,9 @@
 #include <errno.h>
 
 #include "rt_names.h"
-#include "utils.h"
-#include "iproute_lwtunnel.h"
 #include "bpf_util.h"
+#include "utils.h"
+#include "ip_common.h"
 #include "ila_common.h"
 
 #include <linux/seg6.h>
diff --git a/ip/iproute_lwtunnel.h b/ip/iproute_lwtunnel.h
deleted file mode 100644
index be003ce..0000000
--- a/ip/iproute_lwtunnel.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __LWTUNNEL_H__
-#define __LETUNNEL_H__ 1
-
-int lwt_parse_encap(struct rtattr *rta, size_t len, int *argcp, char ***argvp);
-void lwt_print_encap(FILE *fp, struct rtattr *encap_type,
-		     struct rtattr *encap);
-
-#endif
diff --git a/ip/xdp.h b/ip/xdp.h
deleted file mode 100644
index 7e10696..0000000
--- a/ip/xdp.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __XDP__
-#define __XDP__
-
-#include "utils.h"
-
-int xdp_parse(int *argc, char ***argv, struct iplink_req *req, __u32 ifindex,
-	      bool generic, bool drv, bool offload);
-void xdp_dump(FILE *fp, struct rtattr *tb, bool link, bool details);
-
-#endif /* __XDP__ */
-- 
1.7.10.4

  reply	other threads:[~2018-01-31  8:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-31  8:15 [PATCH iproute2-next 0/3] ip: Minor code cleanups and improvements Serhey Popovych
2018-01-31  8:15 ` Serhey Popovych [this message]
2018-01-31  8:15 ` [PATCH iproute2-next 2/3] ip: Minor cleanups Serhey Popovych
2018-01-31  8:15 ` [PATCH iproute2-next 3/3] treewide: Use addattr_nest()/addattr_nest_end() to handle nested attributes Serhey Popovych
2018-04-13 22:57   ` Vinicius Costa Gomes
2018-04-14 16:25     ` Stephen Hemminger
2018-02-02 23:06 ` [PATCH iproute2-next 0/3] ip: Minor code cleanups and improvements David Ahern

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=1517386508-10915-2-git-send-email-serhe.popovych@gmail.com \
    --to=serhe.popovych@gmail.com \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).