diff mbox series

[08/10] netfilter: Adjust code style of xt_*.h, ipt_*.h files.

Message ID 20250107024120.98288-9-egyszeregy@freemail.hu (mailing list archive)
State Awaiting Upstream
Headers show
Series netfilter: x_tables: Merge xt_*.h and ipt_*.h files which has same name. | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/build_tools success Errors and warnings before: 0 (+23) this patch: 0 (+23)
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/build_clang success Errors and warnings before: 11 this patch: 11
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 78 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Szőke Benjamin Jan. 7, 2025, 2:41 a.m. UTC
From: Benjamin Szőke <egyszeregy@freemail.hu>

- Adjust tab indents
- Fix format of #define macros

Signed-off-by: Benjamin Szőke <egyszeregy@freemail.hu>
---
 include/uapi/linux/netfilter/xt_dscp.h      | 6 +++---
 include/uapi/linux/netfilter/xt_rateest.h   | 4 ++--
 include/uapi/linux/netfilter/xt_tcpmss.h    | 6 +++---
 include/uapi/linux/netfilter_ipv4/ipt_ecn.h | 8 ++++----
 include/uapi/linux/netfilter_ipv4/ipt_ttl.h | 3 +--
 include/uapi/linux/netfilter_ipv6/ip6t_hl.h | 3 +--
 6 files changed, 14 insertions(+), 16 deletions(-)

Comments

Jozsef Kadlecsik Jan. 7, 2025, 7:39 p.m. UTC | #1
On Tue, 7 Jan 2025, egyszeregy@freemail.hu wrote:

> From: Benjamin Szőke <egyszeregy@freemail.hu>
> 
> - Adjust tab indents
> - Fix format of #define macros

I don't really understand why it'd be important to use parentheses around 
plain constant values in macros. The kernel coding style does not list it 
as a requirement, see 12) 4. in Documentation/process/coding-style.rst.

Best regards,
Jozsef
 
> Signed-off-by: Benjamin Szőke <egyszeregy@freemail.hu>
> ---
>  include/uapi/linux/netfilter/xt_dscp.h      | 6 +++---
>  include/uapi/linux/netfilter/xt_rateest.h   | 4 ++--
>  include/uapi/linux/netfilter/xt_tcpmss.h    | 6 +++---
>  include/uapi/linux/netfilter_ipv4/ipt_ecn.h | 8 ++++----
>  include/uapi/linux/netfilter_ipv4/ipt_ttl.h | 3 +--
>  include/uapi/linux/netfilter_ipv6/ip6t_hl.h | 3 +--
>  6 files changed, 14 insertions(+), 16 deletions(-)
> 
> diff --git a/include/uapi/linux/netfilter/xt_dscp.h b/include/uapi/linux/netfilter/xt_dscp.h
> index bcfe4afa6351..22b6488ef2e7 100644
> --- a/include/uapi/linux/netfilter/xt_dscp.h
> +++ b/include/uapi/linux/netfilter/xt_dscp.h
> @@ -15,9 +15,9 @@
>  
>  #include <linux/types.h>
>  
> -#define XT_DSCP_MASK	0xfc	/* 11111100 */
> -#define XT_DSCP_SHIFT	2
> -#define XT_DSCP_MAX	0x3f	/* 00111111 */
> +#define XT_DSCP_MASK	(0xfc)	/* 11111100 */
> +#define XT_DSCP_SHIFT	(2)
> +#define XT_DSCP_MAX		(0x3f)	/* 00111111 */
>  
>  /* match info */
>  struct xt_dscp_info {
> diff --git a/include/uapi/linux/netfilter/xt_rateest.h b/include/uapi/linux/netfilter/xt_rateest.h
> index da9727fa527b..f719bd501d1a 100644
> --- a/include/uapi/linux/netfilter/xt_rateest.h
> +++ b/include/uapi/linux/netfilter/xt_rateest.h
> @@ -22,8 +22,8 @@ enum xt_rateest_match_mode {
>  };
>  
>  struct xt_rateest_match_info {
> -	char			name1[IFNAMSIZ];
> -	char			name2[IFNAMSIZ];
> +	char		name1[IFNAMSIZ];
> +	char		name2[IFNAMSIZ];
>  	__u16		flags;
>  	__u16		mode;
>  	__u32		bps1;
> diff --git a/include/uapi/linux/netfilter/xt_tcpmss.h b/include/uapi/linux/netfilter/xt_tcpmss.h
> index 3ee4acaa6e03..ad858ae93e6a 100644
> --- a/include/uapi/linux/netfilter/xt_tcpmss.h
> +++ b/include/uapi/linux/netfilter/xt_tcpmss.h
> @@ -4,11 +4,11 @@
>  
>  #include <linux/types.h>
>  
> -#define XT_TCPMSS_CLAMP_PMTU	0xffff
> +#define XT_TCPMSS_CLAMP_PMTU	(0xffff)
>  
>  struct xt_tcpmss_match_info {
> -    __u16 mss_min, mss_max;
> -    __u8 invert;
> +	__u16 mss_min, mss_max;
> +	__u8 invert;
>  };
>  
>  struct xt_tcpmss_info {
> diff --git a/include/uapi/linux/netfilter_ipv4/ipt_ecn.h b/include/uapi/linux/netfilter_ipv4/ipt_ecn.h
> index a6d479aece21..0594dd49d13f 100644
> --- a/include/uapi/linux/netfilter_ipv4/ipt_ecn.h
> +++ b/include/uapi/linux/netfilter_ipv4/ipt_ecn.h
> @@ -16,10 +16,10 @@
>  
>  #define ipt_ecn_info xt_ecn_info
>  
> -#define IPT_ECN_OP_SET_IP	0x01	/* set ECN bits of IPv4 header */
> -#define IPT_ECN_OP_SET_ECE	0x10	/* set ECE bit of TCP header */
> -#define IPT_ECN_OP_SET_CWR	0x20	/* set CWR bit of TCP header */
> -#define IPT_ECN_OP_MASK		0xce
> +#define IPT_ECN_OP_SET_IP	(0x01)	/* set ECN bits of IPv4 header */
> +#define IPT_ECN_OP_SET_ECE	(0x10)	/* set ECE bit of TCP header */
> +#define IPT_ECN_OP_SET_CWR	(0x20)	/* set CWR bit of TCP header */
> +#define IPT_ECN_OP_MASK		(0xce)
>  
>  enum {
>  	IPT_ECN_IP_MASK       = XT_ECN_IP_MASK,
> diff --git a/include/uapi/linux/netfilter_ipv4/ipt_ttl.h b/include/uapi/linux/netfilter_ipv4/ipt_ttl.h
> index c21eb6651353..15c75a4ba355 100644
> --- a/include/uapi/linux/netfilter_ipv4/ipt_ttl.h
> +++ b/include/uapi/linux/netfilter_ipv4/ipt_ttl.h
> @@ -9,13 +9,12 @@
>  #include <linux/types.h>
>  
>  enum {
> -	IPT_TTL_EQ = 0,		/* equals */
> +	IPT_TTL_EQ = 0,	/* equals */
>  	IPT_TTL_NE,		/* not equals */
>  	IPT_TTL_LT,		/* less than */
>  	IPT_TTL_GT,		/* greater than */
>  };
>  
> -
>  struct ipt_ttl_info {
>  	__u8	mode;
>  	__u8	ttl;
> diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_hl.h b/include/uapi/linux/netfilter_ipv6/ip6t_hl.h
> index caef38a63b8f..4af05c86dcd5 100644
> --- a/include/uapi/linux/netfilter_ipv6/ip6t_hl.h
> +++ b/include/uapi/linux/netfilter_ipv6/ip6t_hl.h
> @@ -9,13 +9,12 @@
>  #include <linux/types.h>
>  
>  enum {
> -	IP6T_HL_EQ = 0,		/* equals */
> +	IP6T_HL_EQ = 0,	/* equals */
>  	IP6T_HL_NE,		/* not equals */
>  	IP6T_HL_LT,		/* less than */
>  	IP6T_HL_GT,		/* greater than */
>  };
>  
> -
>  struct ip6t_hl_info {
>  	__u8	mode;
>  	__u8	hop_limit;
> -- 
> 2.43.5
> 
>
Szőke Benjamin Jan. 7, 2025, 9:59 p.m. UTC | #2
2025. 01. 07. 20:39 keltezéssel, Jozsef Kadlecsik írta:
> On Tue, 7 Jan 2025, egyszeregy@freemail.hu wrote:
> 
>> From: Benjamin Szőke <egyszeregy@freemail.hu>
>>
>> - Adjust tab indents
>> - Fix format of #define macros
> 
> I don't really understand why it'd be important to use parentheses around
> plain constant values in macros. The kernel coding style does not list it
> as a requirement, see 12) 4. in Documentation/process/coding-style.rst.
> 

If it would be more than just a const value, parentheses is a must have thing 
for it (now for it, it is not critical to have it but better to get used to 
this). This is how my hand automatically do it, to avoid the syntax problem in 
this coding.

> Best regards,
> Jozsef
>   
>> Signed-off-by: Benjamin Szőke <egyszeregy@freemail.hu>
>> ---
>>   include/uapi/linux/netfilter/xt_dscp.h      | 6 +++---
>>   include/uapi/linux/netfilter/xt_rateest.h   | 4 ++--
>>   include/uapi/linux/netfilter/xt_tcpmss.h    | 6 +++---
>>   include/uapi/linux/netfilter_ipv4/ipt_ecn.h | 8 ++++----
>>   include/uapi/linux/netfilter_ipv4/ipt_ttl.h | 3 +--
>>   include/uapi/linux/netfilter_ipv6/ip6t_hl.h | 3 +--
>>   6 files changed, 14 insertions(+), 16 deletions(-)
>>
>> diff --git a/include/uapi/linux/netfilter/xt_dscp.h b/include/uapi/linux/netfilter/xt_dscp.h
>> index bcfe4afa6351..22b6488ef2e7 100644
>> --- a/include/uapi/linux/netfilter/xt_dscp.h
>> +++ b/include/uapi/linux/netfilter/xt_dscp.h
>> @@ -15,9 +15,9 @@
>>   
>>   #include <linux/types.h>
>>   
>> -#define XT_DSCP_MASK	0xfc	/* 11111100 */
>> -#define XT_DSCP_SHIFT	2
>> -#define XT_DSCP_MAX	0x3f	/* 00111111 */
>> +#define XT_DSCP_MASK	(0xfc)	/* 11111100 */
>> +#define XT_DSCP_SHIFT	(2)
>> +#define XT_DSCP_MAX		(0x3f)	/* 00111111 */
>>   
>>   /* match info */
>>   struct xt_dscp_info {
>> diff --git a/include/uapi/linux/netfilter/xt_rateest.h b/include/uapi/linux/netfilter/xt_rateest.h
>> index da9727fa527b..f719bd501d1a 100644
>> --- a/include/uapi/linux/netfilter/xt_rateest.h
>> +++ b/include/uapi/linux/netfilter/xt_rateest.h
>> @@ -22,8 +22,8 @@ enum xt_rateest_match_mode {
>>   };
>>   
>>   struct xt_rateest_match_info {
>> -	char			name1[IFNAMSIZ];
>> -	char			name2[IFNAMSIZ];
>> +	char		name1[IFNAMSIZ];
>> +	char		name2[IFNAMSIZ];
>>   	__u16		flags;
>>   	__u16		mode;
>>   	__u32		bps1;
>> diff --git a/include/uapi/linux/netfilter/xt_tcpmss.h b/include/uapi/linux/netfilter/xt_tcpmss.h
>> index 3ee4acaa6e03..ad858ae93e6a 100644
>> --- a/include/uapi/linux/netfilter/xt_tcpmss.h
>> +++ b/include/uapi/linux/netfilter/xt_tcpmss.h
>> @@ -4,11 +4,11 @@
>>   
>>   #include <linux/types.h>
>>   
>> -#define XT_TCPMSS_CLAMP_PMTU	0xffff
>> +#define XT_TCPMSS_CLAMP_PMTU	(0xffff)
>>   
>>   struct xt_tcpmss_match_info {
>> -    __u16 mss_min, mss_max;
>> -    __u8 invert;
>> +	__u16 mss_min, mss_max;
>> +	__u8 invert;
>>   };
>>   
>>   struct xt_tcpmss_info {
>> diff --git a/include/uapi/linux/netfilter_ipv4/ipt_ecn.h b/include/uapi/linux/netfilter_ipv4/ipt_ecn.h
>> index a6d479aece21..0594dd49d13f 100644
>> --- a/include/uapi/linux/netfilter_ipv4/ipt_ecn.h
>> +++ b/include/uapi/linux/netfilter_ipv4/ipt_ecn.h
>> @@ -16,10 +16,10 @@
>>   
>>   #define ipt_ecn_info xt_ecn_info
>>   
>> -#define IPT_ECN_OP_SET_IP	0x01	/* set ECN bits of IPv4 header */
>> -#define IPT_ECN_OP_SET_ECE	0x10	/* set ECE bit of TCP header */
>> -#define IPT_ECN_OP_SET_CWR	0x20	/* set CWR bit of TCP header */
>> -#define IPT_ECN_OP_MASK		0xce
>> +#define IPT_ECN_OP_SET_IP	(0x01)	/* set ECN bits of IPv4 header */
>> +#define IPT_ECN_OP_SET_ECE	(0x10)	/* set ECE bit of TCP header */
>> +#define IPT_ECN_OP_SET_CWR	(0x20)	/* set CWR bit of TCP header */
>> +#define IPT_ECN_OP_MASK		(0xce)
>>   
>>   enum {
>>   	IPT_ECN_IP_MASK       = XT_ECN_IP_MASK,
>> diff --git a/include/uapi/linux/netfilter_ipv4/ipt_ttl.h b/include/uapi/linux/netfilter_ipv4/ipt_ttl.h
>> index c21eb6651353..15c75a4ba355 100644
>> --- a/include/uapi/linux/netfilter_ipv4/ipt_ttl.h
>> +++ b/include/uapi/linux/netfilter_ipv4/ipt_ttl.h
>> @@ -9,13 +9,12 @@
>>   #include <linux/types.h>
>>   
>>   enum {
>> -	IPT_TTL_EQ = 0,		/* equals */
>> +	IPT_TTL_EQ = 0,	/* equals */
>>   	IPT_TTL_NE,		/* not equals */
>>   	IPT_TTL_LT,		/* less than */
>>   	IPT_TTL_GT,		/* greater than */
>>   };
>>   
>> -
>>   struct ipt_ttl_info {
>>   	__u8	mode;
>>   	__u8	ttl;
>> diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_hl.h b/include/uapi/linux/netfilter_ipv6/ip6t_hl.h
>> index caef38a63b8f..4af05c86dcd5 100644
>> --- a/include/uapi/linux/netfilter_ipv6/ip6t_hl.h
>> +++ b/include/uapi/linux/netfilter_ipv6/ip6t_hl.h
>> @@ -9,13 +9,12 @@
>>   #include <linux/types.h>
>>   
>>   enum {
>> -	IP6T_HL_EQ = 0,		/* equals */
>> +	IP6T_HL_EQ = 0,	/* equals */
>>   	IP6T_HL_NE,		/* not equals */
>>   	IP6T_HL_LT,		/* less than */
>>   	IP6T_HL_GT,		/* greater than */
>>   };
>>   
>> -
>>   struct ip6t_hl_info {
>>   	__u8	mode;
>>   	__u8	hop_limit;
>> -- 
>> 2.43.5
>>
>>
>
diff mbox series

Patch

diff --git a/include/uapi/linux/netfilter/xt_dscp.h b/include/uapi/linux/netfilter/xt_dscp.h
index bcfe4afa6351..22b6488ef2e7 100644
--- a/include/uapi/linux/netfilter/xt_dscp.h
+++ b/include/uapi/linux/netfilter/xt_dscp.h
@@ -15,9 +15,9 @@ 
 
 #include <linux/types.h>
 
-#define XT_DSCP_MASK	0xfc	/* 11111100 */
-#define XT_DSCP_SHIFT	2
-#define XT_DSCP_MAX	0x3f	/* 00111111 */
+#define XT_DSCP_MASK	(0xfc)	/* 11111100 */
+#define XT_DSCP_SHIFT	(2)
+#define XT_DSCP_MAX		(0x3f)	/* 00111111 */
 
 /* match info */
 struct xt_dscp_info {
diff --git a/include/uapi/linux/netfilter/xt_rateest.h b/include/uapi/linux/netfilter/xt_rateest.h
index da9727fa527b..f719bd501d1a 100644
--- a/include/uapi/linux/netfilter/xt_rateest.h
+++ b/include/uapi/linux/netfilter/xt_rateest.h
@@ -22,8 +22,8 @@  enum xt_rateest_match_mode {
 };
 
 struct xt_rateest_match_info {
-	char			name1[IFNAMSIZ];
-	char			name2[IFNAMSIZ];
+	char		name1[IFNAMSIZ];
+	char		name2[IFNAMSIZ];
 	__u16		flags;
 	__u16		mode;
 	__u32		bps1;
diff --git a/include/uapi/linux/netfilter/xt_tcpmss.h b/include/uapi/linux/netfilter/xt_tcpmss.h
index 3ee4acaa6e03..ad858ae93e6a 100644
--- a/include/uapi/linux/netfilter/xt_tcpmss.h
+++ b/include/uapi/linux/netfilter/xt_tcpmss.h
@@ -4,11 +4,11 @@ 
 
 #include <linux/types.h>
 
-#define XT_TCPMSS_CLAMP_PMTU	0xffff
+#define XT_TCPMSS_CLAMP_PMTU	(0xffff)
 
 struct xt_tcpmss_match_info {
-    __u16 mss_min, mss_max;
-    __u8 invert;
+	__u16 mss_min, mss_max;
+	__u8 invert;
 };
 
 struct xt_tcpmss_info {
diff --git a/include/uapi/linux/netfilter_ipv4/ipt_ecn.h b/include/uapi/linux/netfilter_ipv4/ipt_ecn.h
index a6d479aece21..0594dd49d13f 100644
--- a/include/uapi/linux/netfilter_ipv4/ipt_ecn.h
+++ b/include/uapi/linux/netfilter_ipv4/ipt_ecn.h
@@ -16,10 +16,10 @@ 
 
 #define ipt_ecn_info xt_ecn_info
 
-#define IPT_ECN_OP_SET_IP	0x01	/* set ECN bits of IPv4 header */
-#define IPT_ECN_OP_SET_ECE	0x10	/* set ECE bit of TCP header */
-#define IPT_ECN_OP_SET_CWR	0x20	/* set CWR bit of TCP header */
-#define IPT_ECN_OP_MASK		0xce
+#define IPT_ECN_OP_SET_IP	(0x01)	/* set ECN bits of IPv4 header */
+#define IPT_ECN_OP_SET_ECE	(0x10)	/* set ECE bit of TCP header */
+#define IPT_ECN_OP_SET_CWR	(0x20)	/* set CWR bit of TCP header */
+#define IPT_ECN_OP_MASK		(0xce)
 
 enum {
 	IPT_ECN_IP_MASK       = XT_ECN_IP_MASK,
diff --git a/include/uapi/linux/netfilter_ipv4/ipt_ttl.h b/include/uapi/linux/netfilter_ipv4/ipt_ttl.h
index c21eb6651353..15c75a4ba355 100644
--- a/include/uapi/linux/netfilter_ipv4/ipt_ttl.h
+++ b/include/uapi/linux/netfilter_ipv4/ipt_ttl.h
@@ -9,13 +9,12 @@ 
 #include <linux/types.h>
 
 enum {
-	IPT_TTL_EQ = 0,		/* equals */
+	IPT_TTL_EQ = 0,	/* equals */
 	IPT_TTL_NE,		/* not equals */
 	IPT_TTL_LT,		/* less than */
 	IPT_TTL_GT,		/* greater than */
 };
 
-
 struct ipt_ttl_info {
 	__u8	mode;
 	__u8	ttl;
diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_hl.h b/include/uapi/linux/netfilter_ipv6/ip6t_hl.h
index caef38a63b8f..4af05c86dcd5 100644
--- a/include/uapi/linux/netfilter_ipv6/ip6t_hl.h
+++ b/include/uapi/linux/netfilter_ipv6/ip6t_hl.h
@@ -9,13 +9,12 @@ 
 #include <linux/types.h>
 
 enum {
-	IP6T_HL_EQ = 0,		/* equals */
+	IP6T_HL_EQ = 0,	/* equals */
 	IP6T_HL_NE,		/* not equals */
 	IP6T_HL_LT,		/* less than */
 	IP6T_HL_GT,		/* greater than */
 };
 
-
 struct ip6t_hl_info {
 	__u8	mode;
 	__u8	hop_limit;