diff mbox series

[nft,3/4] netlink: don't pass location to netlink_list_*() function

Message ID 20180423230513.21127-3-pablo@netfilter.org
State Accepted
Delegated to: Pablo Neira
Headers show
Series [nft,1/4] netlink: pass cmd object to netlink function calls | expand

Commit Message

Pablo Neira Ayuso April 23, 2018, 11:05 p.m. UTC
Not needed anymore.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 include/netlink.h | 18 ++++++------------
 src/netlink.c     | 23 ++++++++---------------
 src/rule.c        | 18 +++++++-----------
 3 files changed, 21 insertions(+), 38 deletions(-)
diff mbox series

Patch

diff --git a/include/netlink.h b/include/netlink.h
index 81eaaa25cbeb..58b37d3cd572 100644
--- a/include/netlink.h
+++ b/include/netlink.h
@@ -129,8 +129,7 @@  extern int netlink_rename_chain_batch(struct netlink_ctx *ctx,
 				      const struct cmd *cmd);
 extern int netlink_delete_chain_batch(struct netlink_ctx *ctx,
 				      const struct cmd *cmd);
-extern int netlink_list_chains(struct netlink_ctx *ctx, const struct handle *h,
-			       const struct location *loc);
+extern int netlink_list_chains(struct netlink_ctx *ctx, const struct handle *h);
 extern int netlink_flush_chain(struct netlink_ctx *ctx, const struct cmd *cmd);
 extern struct chain *netlink_delinearize_chain(struct netlink_ctx *ctx,
 					       const struct nftnl_chain *nlc);
@@ -139,10 +138,8 @@  extern int netlink_add_table_batch(struct netlink_ctx *ctx,
 				   const struct cmd *cmd, uint32_t flags);
 extern int netlink_delete_table_batch(struct netlink_ctx *ctx,
 				      const struct cmd *cmd);
-extern int netlink_list_tables(struct netlink_ctx *ctx, const struct handle *h,
-			       const struct location *loc);
-extern int netlink_list_table(struct netlink_ctx *ctx, const struct handle *h,
-			      const struct location *loc);
+extern int netlink_list_tables(struct netlink_ctx *ctx, const struct handle *h);
+extern int netlink_list_table(struct netlink_ctx *ctx, const struct handle *h);
 extern int netlink_flush_table(struct netlink_ctx *ctx, const struct cmd *cmd);
 extern struct table *netlink_delinearize_table(struct netlink_ctx *ctx,
 					       const struct nftnl_table *nlt);
@@ -151,8 +148,7 @@  extern int netlink_add_set_batch(struct netlink_ctx *ctx, const struct cmd *cmd,
 				 uint32_t flags);
 extern int netlink_delete_set_batch(struct netlink_ctx *ctx,
 				    const struct cmd *cmd);
-extern int netlink_list_sets(struct netlink_ctx *ctx, const struct handle *h,
-			     const struct location *loc);
+extern int netlink_list_sets(struct netlink_ctx *ctx, const struct handle *h);
 extern struct set *netlink_delinearize_set(struct netlink_ctx *ctx,
 					   const struct nftnl_set *nls);
 
@@ -174,8 +170,7 @@  extern int netlink_delinearize_setelem(struct nftnl_set_elem *nlse,
 				       const struct set *set,
 				       struct nft_cache *cache);
 
-extern int netlink_list_objs(struct netlink_ctx *ctx, const struct handle *h,
-			     const struct location *loc);
+extern int netlink_list_objs(struct netlink_ctx *ctx, const struct handle *h);
 extern int netlink_reset_objs(struct netlink_ctx *ctx, const struct cmd *cmd,
 			      uint32_t type, bool dump);
 extern int netlink_add_obj(struct netlink_ctx *ctx, const struct cmd *cmd,
@@ -186,8 +181,7 @@  extern struct obj *netlink_delinearize_obj(struct netlink_ctx *ctx,
 					   struct nftnl_obj *nlo);
 
 extern int netlink_list_flowtables(struct netlink_ctx *ctx,
-				   const struct handle *h,
-				   const struct location *loc);
+				   const struct handle *h);
 extern int netlink_add_flowtable(struct netlink_ctx *ctx,
 				 const struct cmd *cmd, uint32_t flags);
 extern int netlink_delete_flowtable(struct netlink_ctx *ctx,
diff --git a/src/netlink.c b/src/netlink.c
index 8e34553635d0..9e11af5d026f 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -550,8 +550,7 @@  static int list_rule_cb(struct nftnl_rule *nlr, void *arg)
 	return 0;
 }
 
-static int netlink_list_rules(struct netlink_ctx *ctx, const struct handle *h,
-			      const struct location *loc)
+static int netlink_list_rules(struct netlink_ctx *ctx, const struct handle *h)
 {
 	struct nftnl_rule_list *rule_cache;
 
@@ -707,8 +706,7 @@  static int list_chain_cb(struct nftnl_chain *nlc, void *arg)
 	return 0;
 }
 
-int netlink_list_chains(struct netlink_ctx *ctx, const struct handle *h,
-			const struct location *loc)
+int netlink_list_chains(struct netlink_ctx *ctx, const struct handle *h)
 {
 	struct nftnl_chain_list *chain_cache;
 
@@ -787,8 +785,7 @@  static int list_table_cb(struct nftnl_table *nlt, void *arg)
 	return 0;
 }
 
-int netlink_list_tables(struct netlink_ctx *ctx, const struct handle *h,
-			const struct location *loc)
+int netlink_list_tables(struct netlink_ctx *ctx, const struct handle *h)
 {
 	struct nftnl_table_list *table_cache;
 
@@ -806,10 +803,9 @@  int netlink_list_tables(struct netlink_ctx *ctx, const struct handle *h,
 	return 0;
 }
 
-int netlink_list_table(struct netlink_ctx *ctx, const struct handle *h,
-		       const struct location *loc)
+int netlink_list_table(struct netlink_ctx *ctx, const struct handle *h)
 {
-	return netlink_list_rules(ctx, h, loc);
+	return netlink_list_rules(ctx, h);
 }
 
 int netlink_flush_table(struct netlink_ctx *ctx, const struct cmd *cmd)
@@ -1061,8 +1057,7 @@  static int list_set_cb(struct nftnl_set *nls, void *arg)
 	return 0;
 }
 
-int netlink_list_sets(struct netlink_ctx *ctx, const struct handle *h,
-		      const struct location *loc)
+int netlink_list_sets(struct netlink_ctx *ctx, const struct handle *h)
 {
 	struct nftnl_set_list *set_cache;
 	int err;
@@ -1555,8 +1550,7 @@  static int list_obj_cb(struct nftnl_obj *nls, void *arg)
 	return 0;
 }
 
-int netlink_list_objs(struct netlink_ctx *ctx, const struct handle *h,
-		      const struct location *loc)
+int netlink_list_objs(struct netlink_ctx *ctx, const struct handle *h)
 {
 	struct nftnl_obj_list *obj_cache;
 	int err;
@@ -1643,8 +1637,7 @@  static int list_flowtable_cb(struct nftnl_flowtable *nls, void *arg)
 	return 0;
 }
 
-int netlink_list_flowtables(struct netlink_ctx *ctx, const struct handle *h,
-		      const struct location *loc)
+int netlink_list_flowtables(struct netlink_ctx *ctx, const struct handle *h)
 {
 	struct nftnl_flowtable_list *flowtable_cache;
 	int err;
diff --git a/src/rule.c b/src/rule.c
index 68bc2e68a4d6..2ad7f23ef02d 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -60,7 +60,7 @@  static int cache_init_tables(struct netlink_ctx *ctx, struct handle *h,
 {
 	int ret;
 
-	ret = netlink_list_tables(ctx, h, &internal_location);
+	ret = netlink_list_tables(ctx, h);
 	if (ret < 0)
 		return -1;
 
@@ -77,8 +77,7 @@  static int cache_init_objects(struct netlink_ctx *ctx, enum cmd_ops cmd)
 	int ret;
 
 	list_for_each_entry(table, &ctx->cache->list, list) {
-		ret = netlink_list_sets(ctx, &table->handle,
-					&internal_location);
+		ret = netlink_list_sets(ctx, &table->handle);
 		list_splice_tail_init(&ctx->list, &table->sets);
 
 		if (ret < 0)
@@ -91,19 +90,18 @@  static int cache_init_objects(struct netlink_ctx *ctx, enum cmd_ops cmd)
 				return -1;
 		}
 
-		ret = netlink_list_chains(ctx, &table->handle,
-					  &internal_location);
+		ret = netlink_list_chains(ctx, &table->handle);
 		if (ret < 0)
 			return -1;
 		list_splice_tail_init(&ctx->list, &table->chains);
 
-		ret = netlink_list_flowtables(ctx, &table->handle, &internal_location);
+		ret = netlink_list_flowtables(ctx, &table->handle);
 		if (ret < 0)
 			return -1;
 		list_splice_tail_init(&ctx->list, &table->flowtables);
 
 		if (cmd != CMD_RESET) {
-			ret = netlink_list_objs(ctx, &table->handle, &internal_location);
+			ret = netlink_list_objs(ctx, &table->handle);
 			if (ret < 0)
 				return -1;
 			list_splice_tail_init(&ctx->list, &table->objs);
@@ -115,8 +113,7 @@  static int cache_init_objects(struct netlink_ctx *ctx, enum cmd_ops cmd)
 		if (cmd != CMD_LIST)
 			continue;
 
-		ret = netlink_list_table(ctx, &table->handle,
-					 &internal_location);
+		ret = netlink_list_table(ctx, &table->handle);
 		list_for_each_entry_safe(rule, nrule, &ctx->list, list) {
 			chain = chain_lookup(table, &rule->handle);
 			list_move_tail(&rule->list, &chain->rules);
@@ -2030,8 +2027,7 @@  static int do_command_monitor(struct netlink_ctx *ctx, struct cmd *cmd)
 			 * we receive in the trace messages to the actual rule
 			 * struct to print that out.  Populate rule cache now.
 			 */
-			ret = netlink_list_table(ctx, &t->handle,
-						 &internal_location);
+			ret = netlink_list_table(ctx, &t->handle);
 
 			if (ret != 0)
 				/* Shouldn't happen and doesn't break things