linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] remove nonsense force-casts from ocfs2
@ 2007-12-05  8:46 Al Viro
  2007-12-05 17:55 ` Mark Fasheh
  0 siblings, 1 reply; 2+ messages in thread
From: Al Viro @ 2007-12-05  8:46 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: mark.fasheh, linux-kernel

	endianness annotations in networking code had been in place for
quite a while; in particular, sin_port and s_addr are annotated as
big-endian.  Code in ocfs2 had __force casts added apparently to shut the
sparse warnings up; of course, these days they only serve to *produce*
warnings for no reason whatsoever...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index d84bd15..ee50c96 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -72,14 +72,6 @@
 
 #include "tcp_internal.h"
 
-/* 
- * The linux network stack isn't sparse endian clean.. It has macros like
- * ntohs() which perform the endian checks and structs like sockaddr_in
- * which aren't annotated.  So __force is found here to get the build
- * clean.  When they emerge from the dark ages and annotate the code
- * we can remove these.
- */
-
 #define SC_NODEF_FMT "node %s (num %u) at %u.%u.%u.%u:%u"
 #define SC_NODEF_ARGS(sc) sc->sc_node->nd_name, sc->sc_node->nd_num,	\
 			  NIPQUAD(sc->sc_node->nd_ipv4_address),	\
@@ -1500,7 +1492,7 @@ static void o2net_start_connect(struct work_struct *work)
 
 	myaddr.sin_family = AF_INET;
 	myaddr.sin_addr.s_addr = mynode->nd_ipv4_address;
-	myaddr.sin_port = (__force u16)htons(0); /* any port */
+	myaddr.sin_port = htons(0); /* any port */
 
 	ret = sock->ops->bind(sock, (struct sockaddr *)&myaddr,
 			      sizeof(myaddr));
@@ -1701,11 +1693,11 @@ static int o2net_accept_one(struct socket *sock)
 	if (ret < 0)
 		goto out;
 
-	node = o2nm_get_node_by_ip((__force __be32)sin.sin_addr.s_addr);
+	node = o2nm_get_node_by_ip(sin.sin_addr.s_addr);
 	if (node == NULL) {
 		mlog(ML_NOTICE, "attempt to connect from unknown node at "
 		     "%u.%u.%u.%u:%d\n", NIPQUAD(sin.sin_addr.s_addr),
-		     ntohs((__force __be16)sin.sin_port));
+		     ntohs(sin.sin_port));
 		ret = -EINVAL;
 		goto out;
 	}
@@ -1714,7 +1706,7 @@ static int o2net_accept_one(struct socket *sock)
 		mlog(ML_NOTICE, "unexpected connect attempted from a lower "
 		     "numbered node '%s' at " "%u.%u.%u.%u:%d with num %u\n",
 		     node->nd_name, NIPQUAD(sin.sin_addr.s_addr),
-		     ntohs((__force __be16)sin.sin_port), node->nd_num);
+		     ntohs(sin.sin_port), node->nd_num);
 		ret = -EINVAL;
 		goto out;
 	}
@@ -1725,7 +1717,7 @@ static int o2net_accept_one(struct socket *sock)
 		mlog(ML_CONN, "attempt to connect from node '%s' at "
 		     "%u.%u.%u.%u:%d but it isn't heartbeating\n",
 		     node->nd_name, NIPQUAD(sin.sin_addr.s_addr),
-		     ntohs((__force __be16)sin.sin_port));
+		     ntohs(sin.sin_port));
 		ret = -EINVAL;
 		goto out;
 	}
@@ -1742,7 +1734,7 @@ static int o2net_accept_one(struct socket *sock)
 		mlog(ML_NOTICE, "attempt to connect from node '%s' at "
 		     "%u.%u.%u.%u:%d but it already has an open connection\n",
 		     node->nd_name, NIPQUAD(sin.sin_addr.s_addr),
-		     ntohs((__force __be16)sin.sin_port));
+		     ntohs(sin.sin_port));
 		goto out;
 	}
 

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

* Re: [PATCH] remove nonsense force-casts from ocfs2
  2007-12-05  8:46 [PATCH] remove nonsense force-casts from ocfs2 Al Viro
@ 2007-12-05 17:55 ` Mark Fasheh
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Fasheh @ 2007-12-05 17:55 UTC (permalink / raw)
  To: Al Viro; +Cc: Linus Torvalds, linux-kernel

On Wed, Dec 05, 2007 at 08:46:47AM +0000, Al Viro wrote:
> 	endianness annotations in networking code had been in place for
> quite a while; in particular, sin_port and s_addr are annotated as
> big-endian.  Code in ocfs2 had __force casts added apparently to shut the
> sparse warnings up; of course, these days they only serve to *produce*
> warnings for no reason whatsoever...
> 
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Mark Fasheh <mark.fasheh@oracle.com>

Thanks a lot Al.
	--Mark

--
Mark Fasheh
Senior Software Developer, Oracle
mark.fasheh@oracle.com

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

end of thread, other threads:[~2007-12-05 17:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-05  8:46 [PATCH] remove nonsense force-casts from ocfs2 Al Viro
2007-12-05 17:55 ` Mark Fasheh

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