Skip to contentSkip to conversation

netfilter: xt_repldata.h should be at a reasonable path

PATCH New Xin Long 1 participant 1 message Feb 24, 2014

Subsystems (3)
lore
Share & tools
lore

Xin Long

author
#0 lore raw

PATCH 1/1 netfilter: xt_repldata.h should be at a reasonable path

Now the file xt_repldata.h is in path net/netfilter, but in net/ipv6(ipv4)/netfilter, several files include it, which leads that separately building the ipv6(ipv4) module needs the net/netfilter source code. perhaps 'include /net/netfilter' is a good location for it.

---
 include/net/netfilter/xt_repldata.h | 35 +++++++++++++++++++++++++++++++++++
 net/ipv4/netfilter/arp_tables.c     |  2 +-
 net/ipv4/netfilter/ip_tables.c      |  2 +-
 net/ipv6/netfilter/ip6_tables.c     |  2 +-
 net/netfilter/xt_repldata.h         | 35 -----------------------------------
 5 files changed, 38 insertions(+), 38 deletions(-)
 create mode 100644 include/net/netfilter/xt_repldata.h
 delete mode 100644 net/netfilter/xt_repldata.h
include/net/netfilter/xt_repldata.h new file +35 -0
new file mode 100644
index 0000000..6efe4e5
@@ -0,0 +1,35 @@
+/*
+ * Today's hack: quantum tunneling in structs
+ *
+ * 'entries' and 'term' are never anywhere referenced by word in code. In fact,
+ * they serve as the hanging-off data accessed through repl.data[].
+ */
+
+#define xt_alloc_initial_table(type, typ2) ({ \
+	unsigned int hook_mask = info->valid_hooks; \
+	unsigned int nhooks = hweight32(hook_mask); \
+	unsigned int bytes = 0, hooknum = 0, i = 0; \
+	struct { \
+		struct type##_replace repl; \
+		struct type##_standard entries[nhooks]; \
+		struct type##_error term; \
+	} *tbl = kzalloc(sizeof(*tbl), GFP_KERNEL); \
+	if (tbl == NULL) \
+		return NULL; \
+	strncpy(tbl->repl.name, info->name, sizeof(tbl->repl.name)); \
+	tbl->term = (struct type##_error)typ2##_ERROR_INIT;  \
+	tbl->repl.valid_hooks = hook_mask; \
+	tbl->repl.num_entries = nhooks + 1; \
+	tbl->repl.size = nhooks * sizeof(struct type##_standard) + \
+	                 sizeof(struct type##_error); \
+	for (; hook_mask != 0; hook_mask >>= 1, ++hooknum) { \
+		if (!(hook_mask & 1)) \
+			continue; \
+		tbl->repl.hook_entry[hooknum] = bytes; \
+		tbl->repl.underflow[hooknum]  = bytes; \
+		tbl->entries[i++] = (struct type##_standard) \
+			typ2##_STANDARD_INIT(NF_ACCEPT); \
+		bytes += sizeof(struct type##_standard); \
+	} \
+	tbl; \
+})
net/ipv4/netfilter/arp_tables.c +1 -1
index 59da7cd..7269607 100644
@@ -28,7 +28,7 @@
 
 #include <linux/netfilter/x_tables.h>
 #include <linux/netfilter_arp/arp_tables.h>
-#include "../../netfilter/xt_repldata.h"
+#include <net/netfilter/xt_repldata.h>
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("David S. Miller <[email protected]>");
net/ipv4/netfilter/ip_tables.c +1 -1
index 718dfbd..cb85f74 100644
@@ -29,7 +29,7 @@
 #include <linux/netfilter/x_tables.h>
 #include <linux/netfilter_ipv4/ip_tables.h>
 #include <net/netfilter/nf_log.h>
-#include "../../netfilter/xt_repldata.h"
+#include <net/netfilter/xt_repldata.h>
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Netfilter Core Team <[email protected]>");
net/ipv6/netfilter/ip6_tables.c +1 -1
index 710238f..b11abad 100644
@@ -30,7 +30,7 @@
 #include <linux/netfilter_ipv6/ip6_tables.h>
 #include <linux/netfilter/x_tables.h>
 #include <net/netfilter/nf_log.h>
-#include "../../netfilter/xt_repldata.h"
+#include <net/netfilter/xt_repldata.h>
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Netfilter Core Team <[email protected]>");
net/netfilter/xt_repldata.h deleted +0 -35
deleted file mode 100644
index 6efe4e5..0000000
@@ -1,35 +0,0 @@
-/*
- * Today's hack: quantum tunneling in structs
- *
- * 'entries' and 'term' are never anywhere referenced by word in code. In fact,
- * they serve as the hanging-off data accessed through repl.data[].
- */
-
-#define xt_alloc_initial_table(type, typ2) ({ \
-	unsigned int hook_mask = info->valid_hooks; \
-	unsigned int nhooks = hweight32(hook_mask); \
-	unsigned int bytes = 0, hooknum = 0, i = 0; \
-	struct { \
-		struct type##_replace repl; \
-		struct type##_standard entries[nhooks]; \
-		struct type##_error term; \
-	} *tbl = kzalloc(sizeof(*tbl), GFP_KERNEL); \
-	if (tbl == NULL) \
-		return NULL; \
-	strncpy(tbl->repl.name, info->name, sizeof(tbl->repl.name)); \
-	tbl->term = (struct type##_error)typ2##_ERROR_INIT;  \
-	tbl->repl.valid_hooks = hook_mask; \
-	tbl->repl.num_entries = nhooks + 1; \
-	tbl->repl.size = nhooks * sizeof(struct type##_standard) + \
-	                 sizeof(struct type##_error); \
-	for (; hook_mask != 0; hook_mask >>= 1, ++hooknum) { \
-		if (!(hook_mask & 1)) \
-			continue; \
-		tbl->repl.hook_entry[hooknum] = bytes; \
-		tbl->repl.underflow[hooknum]  = bytes; \
-		tbl->entries[i++] = (struct type##_standard) \
-			typ2##_STANDARD_INIT(NF_ACCEPT); \
-		bytes += sizeof(struct type##_standard); \
-	} \
-	tbl; \
-})
Signature · 1 line
1.8.3.1