netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ipvs: clean code for ip_vs_sync.c
@ 2020-07-16  1:57 zhouxudong199
  2020-07-16  2:46 ` Suraj Upadhyay
  0 siblings, 1 reply; 4+ messages in thread
From: zhouxudong199 @ 2020-07-16  1:57 UTC (permalink / raw)
  To: wensong, horms
  Cc: netdev, lvs-devel, kernel-janitors, zhouxudong8, rose.chen, zhaowei23

v1 -> v2:
add missing spaces after Signed-off-by and ipvs: in the subject. 
i=0 changed to i = 0.  

Signed-off-by: zhouxudong199 <zhouxudong8@huawei.com>
---
 net/netfilter/ipvs/ip_vs_sync.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
index 605e0f6..885bab4 100644
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -1077,10 +1077,10 @@ static inline int ip_vs_proc_sync_conn(struct netns_ipvs *ipvs, __u8 *p, __u8 *m
 	struct ip_vs_protocol *pp;
 	struct ip_vs_conn_param param;
 	__u32 flags;
-	unsigned int af, state, pe_data_len=0, pe_name_len=0;
-	__u8 *pe_data=NULL, *pe_name=NULL;
-	__u32 opt_flags=0;
-	int retc=0;
+	unsigned int af, state, pe_data_len = 0, pe_name_len = 0;
+	__u8 *pe_data = NULL, *pe_name = NULL;
+	__u32 opt_flags = 0;
+	int retc = 0;
 
 	s = (union ip_vs_sync_conn *) p;
 
@@ -1089,7 +1089,7 @@ static inline int ip_vs_proc_sync_conn(struct netns_ipvs *ipvs, __u8 *p, __u8 *m
 		af = AF_INET6;
 		p += sizeof(struct ip_vs_sync_v6);
 #else
-		IP_VS_DBG(3,"BACKUP, IPv6 msg received, and IPVS is not compiled for IPv6\n");
+		IP_VS_DBG(3, "BACKUP, IPv6 msg received, and IPVS is not compiled for IPv6\n");
 		retc = 10;
 		goto out;
 #endif
@@ -1129,7 +1129,7 @@ static inline int ip_vs_proc_sync_conn(struct netns_ipvs *ipvs, __u8 *p, __u8 *m
 			break;
 
 		case IPVS_OPT_PE_NAME:
-			if (ip_vs_proc_str(p, plen,&pe_name_len, &pe_name,
+			if (ip_vs_proc_str(p, plen, &pe_name_len, &pe_name,
 					   IP_VS_PENAME_MAXLEN, &opt_flags,
 					   IPVS_OPT_F_PE_NAME))
 				return -70;
@@ -1155,7 +1155,7 @@ static inline int ip_vs_proc_sync_conn(struct netns_ipvs *ipvs, __u8 *p, __u8 *m
 	if (!(flags & IP_VS_CONN_F_TEMPLATE)) {
 		pp = ip_vs_proto_get(s->v4.protocol);
 		if (!pp) {
-			IP_VS_DBG(3,"BACKUP, Unsupported protocol %u\n",
+			IP_VS_DBG(3, "BACKUP, Unsupported protocol %u\n",
 				s->v4.protocol);
 			retc = 30;
 			goto out;
@@ -1232,7 +1232,7 @@ static void ip_vs_process_message(struct netns_ipvs *ipvs, __u8 *buffer,
 		msg_end = buffer + sizeof(struct ip_vs_sync_mesg);
 		nr_conns = m2->nr_conns;
 
-		for (i=0; i<nr_conns; i++) {
+		for (i = 0; i < nr_conns; i++) {
 			union ip_vs_sync_conn *s;
 			unsigned int size;
 			int retc;
@@ -1444,7 +1444,7 @@ static int bind_mcastif_addr(struct socket *sock, struct net_device *dev)
 	sin.sin_addr.s_addr  = addr;
 	sin.sin_port         = 0;
 
-	return sock->ops->bind(sock, (struct sockaddr*)&sin, sizeof(sin));
+	return sock->ops->bind(sock, (struct sockaddr *)&sin, sizeof(sin));
 }
 
 static void get_mcast_sockaddr(union ipvs_sockaddr *sa, int *salen,
-- 
2.6.1.windows.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] ipvs: clean code for ip_vs_sync.c
  2020-07-16  1:57 [PATCH v2] ipvs: clean code for ip_vs_sync.c zhouxudong199
@ 2020-07-16  2:46 ` Suraj Upadhyay
  2020-07-16  2:59   ` 答复: " Zhouxudong (EulerOS)
  0 siblings, 1 reply; 4+ messages in thread
From: Suraj Upadhyay @ 2020-07-16  2:46 UTC (permalink / raw)
  To: zhouxudong199
  Cc: wensong, horms, netdev, lvs-devel, kernel-janitors, rose.chen, zhaowei23

On Thu, Jul 16, 2020 at 01:57:51AM +0000, zhouxudong199 wrote:
> v1 -> v2:
> add missing spaces after Signed-off-by and ipvs: in the subject. 
> i=0 changed to i = 0.  
>

You should write the version changes after "---" and before the first
diff.

Also, looking at your patch I think your commit message should be
something like this :

"Use appropriate spaces around operators."

> Signed-off-by: zhouxudong199 <zhouxudong8@huawei.com>
> ---
>  net/netfilter/ipvs/ip_vs_sync.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
> index 605e0f6..885bab4 100644
> --- a/net/netfilter/ipvs/ip_vs_sync.c
> +++ b/net/netfilter/ipvs/ip_vs_sync.c
> @@ -1077,10 +1077,10 @@ static inline int ip_vs_proc_sync_conn(struct netns_ipvs *ipvs, __u8 *p, __u8 *m
>  	struct ip_vs_protocol *pp;
>  	struct ip_vs_conn_param param;
>  	__u32 flags;
> -	unsigned int af, state, pe_data_len=0, pe_name_len=0;
> -	__u8 *pe_data=NULL, *pe_name=NULL;
> -	__u32 opt_flags=0;
> -	int retc=0;
> +	unsigned int af, state, pe_data_len = 0, pe_name_len = 0;
> +	__u8 *pe_data = NULL, *pe_name = NULL;
> +	__u32 opt_flags = 0;
> +	int retc = 0;
>  
>  	s = (union ip_vs_sync_conn *) p;
>  
> @@ -1089,7 +1089,7 @@ static inline int ip_vs_proc_sync_conn(struct netns_ipvs *ipvs, __u8 *p, __u8 *m
>  		af = AF_INET6;
>  		p += sizeof(struct ip_vs_sync_v6);
>  #else
> -		IP_VS_DBG(3,"BACKUP, IPv6 msg received, and IPVS is not compiled for IPv6\n");
> +		IP_VS_DBG(3, "BACKUP, IPv6 msg received, and IPVS is not compiled for IPv6\n");
>  		retc = 10;
>  		goto out;
>  #endif
> @@ -1129,7 +1129,7 @@ static inline int ip_vs_proc_sync_conn(struct netns_ipvs *ipvs, __u8 *p, __u8 *m
>  			break;
>  
>  		case IPVS_OPT_PE_NAME:
> -			if (ip_vs_proc_str(p, plen,&pe_name_len, &pe_name,
> +			if (ip_vs_proc_str(p, plen, &pe_name_len, &pe_name,
>  					   IP_VS_PENAME_MAXLEN, &opt_flags,
>  					   IPVS_OPT_F_PE_NAME))
>  				return -70;
> @@ -1155,7 +1155,7 @@ static inline int ip_vs_proc_sync_conn(struct netns_ipvs *ipvs, __u8 *p, __u8 *m
>  	if (!(flags & IP_VS_CONN_F_TEMPLATE)) {
>  		pp = ip_vs_proto_get(s->v4.protocol);
>  		if (!pp) {
> -			IP_VS_DBG(3,"BACKUP, Unsupported protocol %u\n",
> +			IP_VS_DBG(3, "BACKUP, Unsupported protocol %u\n",
>  				s->v4.protocol);
>  			retc = 30;
>  			goto out;
> @@ -1232,7 +1232,7 @@ static void ip_vs_process_message(struct netns_ipvs *ipvs, __u8 *buffer,
>  		msg_end = buffer + sizeof(struct ip_vs_sync_mesg);
>  		nr_conns = m2->nr_conns;
>  
> -		for (i=0; i<nr_conns; i++) {
> +		for (i = 0; i < nr_conns; i++) {
>  			union ip_vs_sync_conn *s;
>  			unsigned int size;
>  			int retc;
> @@ -1444,7 +1444,7 @@ static int bind_mcastif_addr(struct socket *sock, struct net_device *dev)
>  	sin.sin_addr.s_addr  = addr;
>  	sin.sin_port         = 0;

I think you missed this one.
should be
-        sin.sin_port         = 0;
+	 sin.sin_port = 0

Thanks and Cheers,
Suraj Upadhyay.

> -	return sock->ops->bind(sock, (struct sockaddr*)&sin, sizeof(sin));
> +	return sock->ops->bind(sock, (struct sockaddr *)&sin, sizeof(sin));
>  }
>  
>  static void get_mcast_sockaddr(union ipvs_sockaddr *sa, int *salen,
> -- 
> 2.6.1.windows.1
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* 答复: [PATCH v2] ipvs: clean code for ip_vs_sync.c
  2020-07-16  2:46 ` Suraj Upadhyay
@ 2020-07-16  2:59   ` Zhouxudong (EulerOS)
  2020-07-16 10:23     ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Zhouxudong (EulerOS) @ 2020-07-16  2:59 UTC (permalink / raw)
  To: Suraj Upadhyay
  Cc: wensong, horms, netdev, lvs-devel, kernel-janitors,
	Chenxiang (EulerOS), Zhaowei (EulerOS)

Thank you for suggestion.
I will send v3 patch.

-----邮件原件-----
发件人: Suraj Upadhyay [mailto:usuraj35@gmail.com] 
发送时间: 2020年7月16日 10:46
收件人: Zhouxudong (EulerOS) <zhouxudong8@huawei.com>
抄送: wensong@linux-vs.org; horms@verge.net.au; netdev@vger.kernel.org; lvs-devel@vger.kernel.org; kernel-janitors@vger.kernel.org; Chenxiang (EulerOS) <rose.chen@huawei.com>; Zhaowei (EulerOS) <zhaowei23@huawei.com>
主题: Re: [PATCH v2] ipvs: clean code for ip_vs_sync.c

On Thu, Jul 16, 2020 at 01:57:51AM +0000, zhouxudong199 wrote:
> v1 -> v2:
> add missing spaces after Signed-off-by and ipvs: in the subject. 
> i=0 changed to i = 0.  
>

You should write the version changes after "---" and before the first diff.

Also, looking at your patch I think your commit message should be something like this :

"Use appropriate spaces around operators."

> Signed-off-by: zhouxudong199 <zhouxudong8@huawei.com>
> ---
>  net/netfilter/ipvs/ip_vs_sync.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/net/netfilter/ipvs/ip_vs_sync.c 
> b/net/netfilter/ipvs/ip_vs_sync.c index 605e0f6..885bab4 100644
> --- a/net/netfilter/ipvs/ip_vs_sync.c
> +++ b/net/netfilter/ipvs/ip_vs_sync.c
> @@ -1077,10 +1077,10 @@ static inline int ip_vs_proc_sync_conn(struct netns_ipvs *ipvs, __u8 *p, __u8 *m
>  	struct ip_vs_protocol *pp;
>  	struct ip_vs_conn_param param;
>  	__u32 flags;
> -	unsigned int af, state, pe_data_len=0, pe_name_len=0;
> -	__u8 *pe_data=NULL, *pe_name=NULL;
> -	__u32 opt_flags=0;
> -	int retc=0;
> +	unsigned int af, state, pe_data_len = 0, pe_name_len = 0;
> +	__u8 *pe_data = NULL, *pe_name = NULL;
> +	__u32 opt_flags = 0;
> +	int retc = 0;
>  
>  	s = (union ip_vs_sync_conn *) p;
>  
> @@ -1089,7 +1089,7 @@ static inline int ip_vs_proc_sync_conn(struct netns_ipvs *ipvs, __u8 *p, __u8 *m
>  		af = AF_INET6;
>  		p += sizeof(struct ip_vs_sync_v6);
>  #else
> -		IP_VS_DBG(3,"BACKUP, IPv6 msg received, and IPVS is not compiled for IPv6\n");
> +		IP_VS_DBG(3, "BACKUP, IPv6 msg received, and IPVS is not compiled 
> +for IPv6\n");
>  		retc = 10;
>  		goto out;
>  #endif
> @@ -1129,7 +1129,7 @@ static inline int ip_vs_proc_sync_conn(struct netns_ipvs *ipvs, __u8 *p, __u8 *m
>  			break;
>  
>  		case IPVS_OPT_PE_NAME:
> -			if (ip_vs_proc_str(p, plen,&pe_name_len, &pe_name,
> +			if (ip_vs_proc_str(p, plen, &pe_name_len, &pe_name,
>  					   IP_VS_PENAME_MAXLEN, &opt_flags,
>  					   IPVS_OPT_F_PE_NAME))
>  				return -70;
> @@ -1155,7 +1155,7 @@ static inline int ip_vs_proc_sync_conn(struct netns_ipvs *ipvs, __u8 *p, __u8 *m
>  	if (!(flags & IP_VS_CONN_F_TEMPLATE)) {
>  		pp = ip_vs_proto_get(s->v4.protocol);
>  		if (!pp) {
> -			IP_VS_DBG(3,"BACKUP, Unsupported protocol %u\n",
> +			IP_VS_DBG(3, "BACKUP, Unsupported protocol %u\n",
>  				s->v4.protocol);
>  			retc = 30;
>  			goto out;
> @@ -1232,7 +1232,7 @@ static void ip_vs_process_message(struct netns_ipvs *ipvs, __u8 *buffer,
>  		msg_end = buffer + sizeof(struct ip_vs_sync_mesg);
>  		nr_conns = m2->nr_conns;
>  
> -		for (i=0; i<nr_conns; i++) {
> +		for (i = 0; i < nr_conns; i++) {
>  			union ip_vs_sync_conn *s;
>  			unsigned int size;
>  			int retc;
> @@ -1444,7 +1444,7 @@ static int bind_mcastif_addr(struct socket *sock, struct net_device *dev)
>  	sin.sin_addr.s_addr  = addr;
>  	sin.sin_port         = 0;

I think you missed this one.
should be
-        sin.sin_port         = 0;
+	 sin.sin_port = 0

Thanks and Cheers,
Suraj Upadhyay.

> -	return sock->ops->bind(sock, (struct sockaddr*)&sin, sizeof(sin));
> +	return sock->ops->bind(sock, (struct sockaddr *)&sin, sizeof(sin));
>  }
>  
>  static void get_mcast_sockaddr(union ipvs_sockaddr *sa, int *salen,
> --
> 2.6.1.windows.1
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 答复: [PATCH v2] ipvs: clean code for ip_vs_sync.c
  2020-07-16  2:59   ` 答复: " Zhouxudong (EulerOS)
@ 2020-07-16 10:23     ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2020-07-16 10:23 UTC (permalink / raw)
  To: Zhouxudong (EulerOS)
  Cc: Suraj Upadhyay, wensong, horms, netdev, lvs-devel,
	kernel-janitors, Chenxiang (EulerOS), Zhaowei (EulerOS)

It's probably better to start somewhere like drivers/staging for clean
up work.  Networking people are pretty busy with their own things but
staging is happy to take clean up patches.

You need to use a proper legal name (like you would for signing
documents for your From and Signed-off-by.

> > @@ -1444,7 +1444,7 @@ static int bind_mcastif_addr(struct socket *sock, struct net_device *dev)
> >  	sin.sin_addr.s_addr  = addr;
> >  	sin.sin_port         = 0;
> 
> I think you missed this one.
> should be
> -        sin.sin_port         = 0;
> +	 sin.sin_port = 0

That was done deliberately.  Just leave that one as-is, please.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-16 10:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16  1:57 [PATCH v2] ipvs: clean code for ip_vs_sync.c zhouxudong199
2020-07-16  2:46 ` Suraj Upadhyay
2020-07-16  2:59   ` 答复: " Zhouxudong (EulerOS)
2020-07-16 10:23     ` Dan Carpenter

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).