Skip to contentSkip to conversation

staging:lustre: remove tcpip abstraction from libcfs

PATCH Superseded James Simmons 6 participants 18 messages Jun 3, 2015 – Jun 9, 2015

Subsystems (2)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover staging:lustre: remove tcpip abstraction from libcfs

Since libcfs no longer builds for user land we can move the TCPIP abstraction that exist to the LNET layer which is the only place that uses it. Also the migrated code will use native linux kernel APIs directly instead of with wrappers.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
Reviewed-on: http://review.whamcloud.com/13760

James Simmons (7):
staging:lustre: move tcpip abstraction staging:lustre: remove useless libcfs_sock_release staging:lustre: remove useless libcfs_sock_abort_accept staging:lustre: rename tcpip handling functions to lnet_* prefix staging:lustre: use available kernel wrappers in lib-socket.c staging:lustre: style cleanups for lib-socket.c staging:lustre: Update license and copyright for lib-socket.c

 .../staging/lustre/include/linux/libcfs/libcfs.h   |   17 -
 .../staging/lustre/include/linux/lnet/lib-lnet.h   |   16 +
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c    |    2 +-
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c    |   17 +-
 .../staging/lustre/lnet/klnds/socklnd/socklnd.h    |    2 +-
 .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c |    6 +-
 .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c  |   15 +-
 .../lustre/lnet/klnds/socklnd/socklnd_proto.c      |   43 +-
 drivers/staging/lustre/lnet/lnet/Makefile          |    7 +-
 drivers/staging/lustre/lnet/lnet/acceptor.c        |   55 +-
 drivers/staging/lustre/lnet/lnet/config.c          |   21 +-
 drivers/staging/lustre/lnet/lnet/lib-socket.c      |  595 +++++++++++++++++++
 drivers/staging/lustre/lustre/libcfs/Makefile      |    1 -
 .../lustre/lustre/libcfs/linux/linux-tcpip.c       |  623 --------------------
 14 files changed, 688 insertions(+), 732 deletions(-)
 create mode 100644 drivers/staging/lustre/lnet/lnet/lib-socket.c
 delete mode 100644 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c
#1 lore raw

PATCH v4 1/7 staging:lustre: move tcpip abstraction

Rename libcfs/linux/linux-tcpip.c to lnet/lnet/lib-socket.c

---
 drivers/staging/lustre/lnet/lnet/Makefile          |    7 +-
 drivers/staging/lustre/lnet/lnet/lib-socket.c      |  624 ++++++++++++++++++++
 drivers/staging/lustre/lustre/libcfs/Makefile      |    1 -
 .../lustre/lustre/libcfs/linux/linux-tcpip.c       |  623 -------------------
 4 files changed, 628 insertions(+), 627 deletions(-)
 create mode 100644 drivers/staging/lustre/lnet/lnet/lib-socket.c
 delete mode 100644 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c
drivers/staging/lustre/lnet/lnet/Makefile +4 -3
index 336b8ea..52492fb 100644
@@ -1,5 +1,6 @@
 obj-$(CONFIG_LNET) += lnet.o
 
-lnet-y := api-ni.o config.o lib-me.o lib-msg.o lib-eq.o	\
-	  lib-md.o lib-ptl.o lib-move.o module.o lo.o router.o		\
-	  router_proc.o acceptor.o peer.o
+lnet-y := api-ni.o config.o					\
+	  lib-me.o lib-msg.o lib-eq.o lib-md.o lib-ptl.o	\
+	  lib-socket.o lib-move.o module.o lo.o			\
+	  router.o router_proc.o acceptor.o peer.o
drivers/staging/lustre/lnet/lnet/lib-socket.c new file +624 -0

624 lines not on this page · raw message

drivers/staging/lustre/lustre/libcfs/Makefile +0 -1
index fabdd3e..ec98f44 100644
@@ -2,7 +2,6 @@ obj-$(CONFIG_LUSTRE_FS) += libcfs.o
 
 libcfs-linux-objs := linux-tracefile.o linux-debug.o
 libcfs-linux-objs += linux-prim.o linux-cpu.o
-libcfs-linux-objs += linux-tcpip.o
 libcfs-linux-objs += linux-curproc.o
 libcfs-linux-objs += linux-module.o
 libcfs-linux-objs += linux-crypto.o
drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c deleted +0 -623

623 lines not on this page · raw message

Signature · 1 line
1.7.1
#2 lore raw

Re: [PATCH v4 1/7] staging:lustre: move tcpip abstraction

Quoted 1 line · James Simmons

Rename libcfs/linux/linux-tcpip.c to lnet/lnet/lib-socket.c

looks like you have not just renamed the file, but there was also a change in the #include which is not mentioned in the commit message.

staging/lustre/lnet/lnet/lib-socket.c renamed from staging/lustre/lustre/libcfs/linux/linux-tcpip.old +2 -1
@@ -35,7 +35,8 @@
  */
 #define DEBUG_SUBSYSTEM S_LNET
 
-#include "../../../include/linux/libcfs/libcfs.h"
+#include "../../include/linux/libcfs/libcfs.h"
+#include "../../include/linux/lnet/lib-lnet.h"
 
 #include <linux/if.h>
 #include <linux/in.h>

regards
sudip

#3 lore raw

Re: [PATCH v4 1/7] staging:lustre: move tcpip abstraction

Quoted 5 lines · Sudip Mukherjee
Quoted 1 line · James Simmons

Rename libcfs/linux/linux-tcpip.c to lnet/lnet/lib-socket.c

looks like you have not just renamed the file, but there was also a change in the #include which is not mentioned in the commit message.

That's obviously going to be part of moving the file.

regards,
dan carpenter

#4 lore raw

Re: [PATCH v4 1/7] staging:lustre: move tcpip abstraction

Quoted 8 lines · Dan Carpenter
Quoted 5 lines · Sudip Mukherjee
Quoted 1 line · James Simmons

Rename libcfs/linux/linux-tcpip.c to lnet/lnet/lib-socket.c

looks like you have not just renamed the file, but there was also a change in the #include which is not mentioned in the commit message.

That's obviously going to be part of moving the file.

yes. path changed for libcfs.h. so that was updated. but there was also a new line
#include "../../include/linux/lnet/lib-lnet.h"

should that be part of moving the file also?

regards
sudip

Quoted 2 lines
#5 lore raw

RE: [lustre-devel] [PATCH v4 1/7] staging:lustre: move tcpip abstraction

Quoted 8 lines · Dan Carpenter
Quoted 7 lines · Sudip Mukherjee
Quoted 5 lines · James Simmons
Quoted 1 line

Rename libcfs/linux/linux-tcpip.c to lnet/lnet/lib-socket.c

looks like you have not just renamed the file, but there was also a change in the #include which is not mentioned in the commit message.

Quoted 6 lines
Quoted 1 line

That's obviously going to be part of moving the file.

yes. path changed for libcfs.h. so that was updated. but there was also a new line
#include "../../include/linux/lnet/lib-lnet.h"

should that be part of moving the file also?

That is handle the move of some of the LNet function declarations in libcfs.h to lib-lnet.h. That happens in patch number 4 of this series. I was trying to minimize the diff between the tip of the Lustre development branch and the upstream client.

#6 lore raw

Re: [PATCH v4 1/7] staging:lustre: move tcpip abstraction

In reply to James Simmons
Quoted 11 lines · James Simmons

Rename libcfs/linux/linux-tcpip.c to lnet/lnet/lib-socket.c

---
 drivers/staging/lustre/lnet/lnet/Makefile          |    7 +-
 drivers/staging/lustre/lnet/lnet/lib-socket.c      |  624 ++++++++++++++++++++
 drivers/staging/lustre/lustre/libcfs/Makefile      |    1 -
 .../lustre/lustre/libcfs/linux/linux-tcpip.c       |  623 -------------------
 4 files changed, 628 insertions(+), 627 deletions(-)
 create mode 100644 drivers/staging/lustre/lnet/lnet/lib-socket.c
 delete mode 100644 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c

Please generate patches in -M format, so I can see the rename properly, as it is, this is too messy for me to review.

Please fix up and resend.

thanks,

greg k-h

#7 lore raw

Re: [PATCH v4 1/7] staging:lustre: move tcpip abstraction

Quoted 2 lines · Greg Kroah-Hartman

Please generate patches in -M format, so I can see the rename properly, as it is, this is too messy for me to review.

Adding this to the .gitconfig works too

[diff]
renames = true

That should probably be mentioned in SubmittingPatches.

Something like:

---
 Documentation/SubmittingPatches | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/SubmittingPatches +7 -0
index 27e7e5e..d86cf89 100644
@@ -715,6 +715,13 @@ the top of the kernel source tree and don't use too much horizontal
 space (easily fit in 80 columns, maybe with some indentation).  (git
 generates appropriate diffstats by default.)
 
+Another good thing is to generate shorter patches whenever a file rename
+has been done.  Using "git format-patch -M" does this appropriately.
+Adding a [diff] section as below to .gitconfig can also do this:
+
+       [diff]
+              renames = true
+
 See more details on the proper patch format in the following
 references.
 
#8 lore raw

PATCH v4 2/7 staging:lustre: remove useless libcfs_sock_release

In reply to James Simmons

There is no reason to have a one line exported function libcfs_sock_release. Instead we can call sock_release directly.

---
 .../staging/lustre/include/linux/libcfs/libcfs.h   |    1 -
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c    |    2 +-
 .../staging/lustre/lnet/klnds/socklnd/socklnd.h    |    2 +-
 drivers/staging/lustre/lnet/lnet/acceptor.c        |    8 ++++----
 drivers/staging/lustre/lnet/lnet/lib-socket.c      |    8 --------
 5 files changed, 6 insertions(+), 15 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs.h +0 -1
index a789559..f469333 100644
@@ -80,7 +80,6 @@ int libcfs_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize);
 int libcfs_sock_getaddr(struct socket *socket, int remote, __u32 *ip, int *port);
 int libcfs_sock_write(struct socket *sock, void *buffer, int nob, int timeout);
 int libcfs_sock_read(struct socket *sock, void *buffer, int nob, int timeout);
-void libcfs_sock_release(struct socket *sock);
 
 /* need both kernel and user-land acceptor */
 #define LNET_ACCEPTOR_MIN_RESERVED_PORT    512
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +1 -1
index 7b5d407..38e831f 100644
@@ -1386,7 +1386,7 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route,
 	LIBCFS_FREE(conn, sizeof(*conn));
 
  failed_0:
-	libcfs_sock_release(sock);
+	sock_release(sock);
 	return rc;
 }
 
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +1 -1
index c34378c..06531c1 100644
@@ -519,7 +519,7 @@ ksocknal_connsock_decref(ksock_conn_t *conn)
 	LASSERT(atomic_read(&conn->ksnc_sock_refcount) > 0);
 	if (atomic_dec_and_test(&conn->ksnc_sock_refcount)) {
 		LASSERT(conn->ksnc_closing);
-		libcfs_sock_release(conn->ksnc_sock);
+		sock_release(conn->ksnc_sock);
 		conn->ksnc_sock = NULL;
 		ksocknal_finalize_zcreq(conn);
 	}
drivers/staging/lustre/lnet/lnet/acceptor.c +4 -4
index 69d4b19..bc212f5 100644
@@ -197,7 +197,7 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid,
 	goto failed;
 
  failed_sock:
-	libcfs_sock_release(sock);
+	sock_release(sock);
  failed:
 	lnet_connect_console_error(rc, peer_nid, peer_ip, peer_port);
 	return rc;
@@ -379,7 +379,7 @@ lnet_acceptor(void *arg)
 
 		/* maybe we're waken up with libcfs_sock_abort_accept() */
 		if (lnet_acceptor_state.pta_shutdown) {
-			libcfs_sock_release(newsock);
+			sock_release(newsock);
 			break;
 		}
 
@@ -410,10 +410,10 @@ lnet_acceptor(void *arg)
 		continue;
 
 failed:
-		libcfs_sock_release(newsock);
+		sock_release(newsock);
 	}
 
-	libcfs_sock_release(lnet_acceptor_state.pta_sock);
+	sock_release(lnet_acceptor_state.pta_sock);
 	lnet_acceptor_state.pta_sock = NULL;
 
 	CDEBUG(D_NET, "Acceptor stopping\n");
drivers/staging/lustre/lnet/lnet/lib-socket.c +0 -8
index 7f80612..259db61 100644
@@ -614,11 +614,3 @@ libcfs_sock_connect (struct socket **sockp, int *fatal,
 }
 
 EXPORT_SYMBOL(libcfs_sock_connect);
-
-void
-libcfs_sock_release (struct socket *sock)
-{
-	sock_release(sock);
-}
-
-EXPORT_SYMBOL(libcfs_sock_release);
Signature · 1 line
1.7.1
#9 lore raw

PATCH v4 3/7 staging:lustre: remove useless libcfs_sock_abort_accept

In reply to James Simmons

Another one of those silly one line wrappers which is not needed. Replace libcfs_sock_abort_accept wrapper with a direct call to wake_up_all on the lnet_acceptor_state sock.

---
 .../staging/lustre/include/linux/libcfs/libcfs.h   |    1 -
 drivers/staging/lustre/lnet/lnet/acceptor.c        |    4 ++--
 drivers/staging/lustre/lnet/lnet/lib-socket.c      |    8 --------
 3 files changed, 2 insertions(+), 11 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs.h +0 -1
index f469333..457ce9a 100644
@@ -71,7 +71,6 @@ int libcfs_ipif_enumerate(char ***names);
 void libcfs_ipif_free_enumeration(char **names, int n);
 int libcfs_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog);
 int libcfs_sock_accept(struct socket **newsockp, struct socket *sock);
-void libcfs_sock_abort_accept(struct socket *sock);
 int libcfs_sock_connect(struct socket **sockp, int *fatal,
 			__u32 local_ip, int local_port,
 			__u32 peer_ip, int peer_port);
drivers/staging/lustre/lnet/lnet/acceptor.c +2 -2
index bc212f5..5187e65 100644
@@ -377,7 +377,7 @@ lnet_acceptor(void *arg)
 			continue;
 		}
 
-		/* maybe we're waken up with libcfs_sock_abort_accept() */
+		/* maybe the LNet acceptor thread has been waken */
 		if (lnet_acceptor_state.pta_shutdown) {
 			sock_release(newsock);
 			break;
@@ -493,7 +493,7 @@ lnet_acceptor_stop(void)
 		return;
 
 	lnet_acceptor_state.pta_shutdown = 1;
-	libcfs_sock_abort_accept(lnet_acceptor_state.pta_sock);
+	wake_up_all(sk_sleep(lnet_acceptor_state.pta_sock->sk));
 
 	/* block until acceptor signals exit */
 	wait_for_completion(&lnet_acceptor_state.pta_signal);
drivers/staging/lustre/lnet/lnet/lib-socket.c +0 -8
index 259db61..bb8d9c2 100644
@@ -568,14 +568,6 @@ libcfs_sock_accept (struct socket **newsockp, struct socket *sock)
 
 EXPORT_SYMBOL(libcfs_sock_accept);
 
-void
-libcfs_sock_abort_accept (struct socket *sock)
-{
-	wake_up_all(sk_sleep(sock->sk));
-}
-
-EXPORT_SYMBOL(libcfs_sock_abort_accept);
-
 int
 libcfs_sock_connect (struct socket **sockp, int *fatal,
 		     __u32 local_ip, int local_port,
Signature · 1 line
1.7.1
#10 lore raw

PATCH v4 4/7 staging:lustre: rename tcpip handling functions to lnet_* prefix

In reply to James Simmons

With all the TCPIP handling done in the lnet layer we should rename all the functions with the prefix lnet_*. One other change done was changing the remove argument of lnet_sock_getaddr from a int to a bool.

---
 .../staging/lustre/include/linux/libcfs/libcfs.h   |   15 -----
 .../staging/lustre/include/linux/lnet/lib-lnet.h   |   16 +++++
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c    |    2 +-
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c    |   11 ++--
 .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c |    6 +-
 .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c  |   15 ++---
 .../lustre/lnet/klnds/socklnd/socklnd_proto.c      |   43 ++++++-------
 drivers/staging/lustre/lnet/lnet/acceptor.c        |   43 ++++++-------
 drivers/staging/lustre/lnet/lnet/config.c          |   21 +++----
 drivers/staging/lustre/lnet/lnet/lib-socket.c      |   66 +++++++++----------
 10 files changed, 110 insertions(+), 128 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs.h +0 -15
index 457ce9a..5dd9cdf 100644
@@ -65,21 +65,6 @@ static inline int __is_po2(unsigned long long val)
 int libcfs_arch_init(void);
 void libcfs_arch_cleanup(void);
 
-/* libcfs tcpip */
-int libcfs_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask);
-int libcfs_ipif_enumerate(char ***names);
-void libcfs_ipif_free_enumeration(char **names, int n);
-int libcfs_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog);
-int libcfs_sock_accept(struct socket **newsockp, struct socket *sock);
-int libcfs_sock_connect(struct socket **sockp, int *fatal,
-			__u32 local_ip, int local_port,
-			__u32 peer_ip, int peer_port);
-int libcfs_sock_setbuf(struct socket *socket, int txbufsize, int rxbufsize);
-int libcfs_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize);
-int libcfs_sock_getaddr(struct socket *socket, int remote, __u32 *ip, int *port);
-int libcfs_sock_write(struct socket *sock, void *buffer, int nob, int timeout);
-int libcfs_sock_read(struct socket *sock, void *buffer, int nob, int timeout);
-
 /* need both kernel and user-land acceptor */
 #define LNET_ACCEPTOR_MIN_RESERVED_PORT    512
 #define LNET_ACCEPTOR_MAX_RESERVED_PORT    1023
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +16 -0
index d84aa9a..ff07703 100644
@@ -844,6 +844,22 @@ int lnet_acceptor_port(void);
 int lnet_acceptor_start(void);
 void lnet_acceptor_stop(void);
 
+int lnet_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask);
+int lnet_ipif_enumerate(char ***names);
+void lnet_ipif_free_enumeration(char **names, int n);
+int lnet_sock_setbuf(struct socket *socket, int txbufsize, int rxbufsize);
+int lnet_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize);
+int lnet_sock_getaddr(struct socket *socket, bool remote, __u32 *ip, int *port);
+int lnet_sock_write(struct socket *sock, void *buffer, int nob, int timeout);
+int lnet_sock_read(struct socket *sock, void *buffer, int nob, int timeout);
+
+int lnet_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog);
+int lnet_sock_accept(struct socket **newsockp, struct socket *sock);
+int lnet_sock_connect(struct socket **sockp, int *fatal,
+		      __u32 local_ip, int local_port,
+		      __u32 peer_ip, int peer_port);
+void libcfs_sock_release(struct socket *sock);
+
 void lnet_get_tunables(void);
 int lnet_peers_start_down(void);
 int lnet_peer_buffer_credits(lnet_ni_t *ni);
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +1 -1
index a57c5c3..060b739 100644
@@ -2617,7 +2617,7 @@ static kib_dev_t *kiblnd_create_dev(char *ifname)
 	int up;
 	int rc;
 
-	rc = libcfs_ipif_query(ifname, &up, &ip, &netmask);
+	rc = lnet_ipif_query(ifname, &up, &ip, &netmask);
 	if (rc != 0) {
 		CERROR("Can't query IPoIB interface %s: %d\n",
 		       ifname, rc);
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +5 -6
index 38e831f..ee5cf35 100644
@@ -968,7 +968,7 @@ ksocknal_accept(lnet_ni_t *ni, struct socket *sock)
 	__u32 peer_ip;
 	int peer_port;
 
-	rc = libcfs_sock_getaddr(sock, 1, &peer_ip, &peer_port);
+	rc = lnet_sock_getaddr(sock, 1, &peer_ip, &peer_port);
 	LASSERT(rc == 0);		      /* we succeeded before */
 
 	LIBCFS_ALLOC(cr, sizeof(*cr));
@@ -2594,7 +2594,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net)
 	int rc;
 	int n;
 
-	n = libcfs_ipif_enumerate(&names);
+	n = lnet_ipif_enumerate(&names);
 	if (n <= 0) {
 		CERROR("Can't enumerate interfaces: %d\n", n);
 		return n;
@@ -2608,7 +2608,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net)
 		if (!strcmp(names[i], "lo")) /* skip the loopback IF */
 			continue;
 
-		rc = libcfs_ipif_query(names[i], &up, &ip, &mask);
+		rc = lnet_ipif_query(names[i], &up, &ip, &mask);
 		if (rc != 0) {
 			CWARN("Can't get interface %s info: %d\n",
 			      names[i], rc);
@@ -2634,7 +2634,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net)
 		j++;
 	}
 
-	libcfs_ipif_free_enumeration(names, n);
+	lnet_ipif_free_enumeration(names, n);
 
 	if (j == 0)
 		CERROR("Can't find any usable interfaces\n");
@@ -2796,8 +2796,7 @@ ksocknal_startup(lnet_ni_t *ni)
 			if (ni->ni_interfaces[i] == NULL)
 				break;
 
-			rc = libcfs_ipif_query(
-				ni->ni_interfaces[i], &up,
+			rc = lnet_ipif_query(ni->ni_interfaces[i], &up,
 				&net->ksnn_interfaces[i].ksni_ipaddr,
 				&net->ksnn_interfaces[i].ksni_netmask);
 
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +3 -3
index a1a4ac0..fe2a83a 100644
@@ -1707,7 +1707,7 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn,
 	timeout = active ? *ksocknal_tunables.ksnd_timeout :
 			    lnet_acceptor_timeout();
 
-	rc = libcfs_sock_read(sock, &hello->kshm_magic, sizeof (hello->kshm_magic), timeout);
+	rc = lnet_sock_read(sock, &hello->kshm_magic, sizeof (hello->kshm_magic), timeout);
 	if (rc != 0) {
 		CERROR("Error %d reading HELLO from %pI4h\n",
 			rc, &conn->ksnc_ipaddr);
@@ -1726,8 +1726,8 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn,
 		return -EPROTO;
 	}
 
-	rc = libcfs_sock_read(sock, &hello->kshm_version,
-			      sizeof(hello->kshm_version), timeout);
+	rc = lnet_sock_read(sock, &hello->kshm_version,
+			    sizeof(hello->kshm_version), timeout);
 	if (rc != 0) {
 		CERROR("Error %d reading HELLO from %pI4h\n",
 			rc, &conn->ksnc_ipaddr);
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +6 -9
index caeb347..34c6a72 100644
@@ -39,9 +39,8 @@
 int
 ksocknal_lib_get_conn_addrs(ksock_conn_t *conn)
 {
-	int rc = libcfs_sock_getaddr(conn->ksnc_sock, 1,
-				     &conn->ksnc_ipaddr,
-				     &conn->ksnc_port);
+	int rc = lnet_sock_getaddr(conn->ksnc_sock, 1, &conn->ksnc_ipaddr,
+				   &conn->ksnc_port);
 
 	/* Didn't need the {get,put}connsock dance to deref ksnc_sock... */
 	LASSERT(!conn->ksnc_closing);
@@ -51,8 +50,7 @@ ksocknal_lib_get_conn_addrs(ksock_conn_t *conn)
 		return rc;
 	}
 
-	rc = libcfs_sock_getaddr(conn->ksnc_sock, 0,
-				 &conn->ksnc_myipaddr, NULL);
+	rc = lnet_sock_getaddr(conn->ksnc_sock, 0, &conn->ksnc_myipaddr, NULL);
 	if (rc != 0) {
 		CERROR("Error %d getting sock local IP\n", rc);
 		return rc;
@@ -436,7 +434,7 @@ ksocknal_lib_get_conn_tunables(ksock_conn_t *conn, int *txmem, int *rxmem, int *
 		return -ESHUTDOWN;
 	}
 
-	rc = libcfs_sock_getbuf(sock, txmem, rxmem);
+	rc = lnet_sock_getbuf(sock, txmem, rxmem);
 	if (rc == 0) {
 		len = sizeof(*nagle);
 		rc = kernel_getsockopt(sock, SOL_TCP, TCP_NODELAY,
@@ -498,9 +496,8 @@ ksocknal_lib_setup_sock(struct socket *sock)
 		}
 	}
 
-	rc = libcfs_sock_setbuf(sock,
-				*ksocknal_tunables.ksnd_tx_buffer_size,
-				*ksocknal_tunables.ksnd_rx_buffer_size);
+	rc = lnet_sock_setbuf(sock, *ksocknal_tunables.ksnd_tx_buffer_size,
+			      *ksocknal_tunables.ksnd_rx_buffer_size);
 	if (rc != 0) {
 		CERROR("Can't set buffer tx %d, rx %d buffers: %d\n",
 			*ksocknal_tunables.ksnd_tx_buffer_size,
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +20 -23

91 lines not on this page · raw message

drivers/staging/lustre/lnet/lnet/acceptor.c +19 -24

109 lines not on this page · raw message

drivers/staging/lustre/lnet/lnet/config.c +9 -12
index 70bc809..efbb74a 100644
@@ -1118,7 +1118,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)
 	__u32 *ipaddrs2;
 	int nip;
 	char **ifnames;
-	int nif = libcfs_ipif_enumerate(&ifnames);
+	int nif = lnet_ipif_enumerate(&ifnames);
 	int i;
 	int rc;
 
@@ -1128,7 +1128,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)
 	LIBCFS_ALLOC(ipaddrs, nif * sizeof(*ipaddrs));
 	if (ipaddrs == NULL) {
 		CERROR("Can't allocate ipaddrs[%d]\n", nif);
-		libcfs_ipif_free_enumeration(ifnames, nif);
+		lnet_ipif_free_enumeration(ifnames, nif);
 		return -ENOMEM;
 	}
 
@@ -1136,8 +1136,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)
 		if (!strcmp(ifnames[i], "lo"))
 			continue;
 
-		rc = libcfs_ipif_query(ifnames[i], &up,
-				       &ipaddrs[nip], &netmask);
+		rc = lnet_ipif_query(ifnames[i], &up, &ipaddrs[nip], &netmask);
 		if (rc != 0) {
 			CWARN("Can't query interface %s: %d\n",
 			      ifnames[i], rc);
@@ -1153,7 +1152,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)
 		nip++;
 	}
 
-	libcfs_ipif_free_enumeration(ifnames, nif);
+	lnet_ipif_free_enumeration(ifnames, nif);
 
 	if (nip == nif) {
 		*ipaddrsp = ipaddrs;
@@ -1237,8 +1236,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni)
 			return -EPERM;
 		}
 
-		rc = libcfs_ipif_query(ni->ni_interfaces[0],
-				       &up, &ip, &netmask);
+		rc = lnet_ipif_query(ni->ni_interfaces[0], &up, &ip, &netmask);
 		if (rc != 0) {
 			CERROR("Net %s can't query interface %s: %d\n",
 			       libcfs_net2str(net), ni->ni_interfaces[0], rc);
@@ -1255,7 +1253,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni)
 		return 0;
 	}
 
-	n = libcfs_ipif_enumerate(&names);
+	n = lnet_ipif_enumerate(&names);
 	if (n <= 0) {
 		CERROR("Net %s can't enumerate interfaces: %d\n",
 		       libcfs_net2str(net), n);
@@ -1266,8 +1264,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni)
 		if (!strcmp(names[i], "lo")) /* skip the loopback IF */
 			continue;
 
-		rc = libcfs_ipif_query(names[i], &up, &ip, &netmask);
-
+		rc = lnet_ipif_query(names[i], &up, &ip, &netmask);
 		if (rc != 0) {
 			CWARN("Net %s can't query interface %s: %d\n",
 			      libcfs_net2str(net), names[i], rc);
@@ -1280,13 +1277,13 @@ lnet_set_ip_niaddr(lnet_ni_t *ni)
 			continue;
 		}
 
-		libcfs_ipif_free_enumeration(names, n);
+		lnet_ipif_free_enumeration(names, n);
 		ni->ni_nid = LNET_MKNID(net, ip);
 		return 0;
 	}
 
 	CERROR("Net %s can't find any interfaces\n", libcfs_net2str(net));
-	libcfs_ipif_free_enumeration(names, n);
+	lnet_ipif_free_enumeration(names, n);
 	return -ENOENT;
 }
 EXPORT_SYMBOL(lnet_set_ip_niaddr);
drivers/staging/lustre/lnet/lnet/lib-socket.c +31 -35

208 lines not on this page · raw message

Signature · 1 line
1.7.1
#11 lore raw

Re: [PATCH v4 4/7] staging:lustre: rename tcpip handling functions to lnet_* prefix

Quoted 4 lines · James Simmons

With all the TCPIP handling done in the lnet layer we should rename all the functions with the prefix lnet_*. One other change done was changing the remove argument of lnet_sock_getaddr from a int to a bool.

thats two different change.
and apart from this:
1) the function declarations were renamed and moved from lustre/include/linux/libcfs/libcfs.h to drivers/staging/lustre/include/linux/lnet/lib-lnet.h

2) some functions you have changed the coding style. like:
- rc = libcfs_sock_getaddr(conn->ksnc_sock, 0,
- &conn->ksnc_myipaddr, NULL);
+ rc = lnet_sock_getaddr(conn->ksnc_sock, 0, &conn->ksnc_myipaddr, NULL);

regards
sudip

Quoted 751 lines
---
 .../staging/lustre/include/linux/libcfs/libcfs.h   |   15 -----
 .../staging/lustre/include/linux/lnet/lib-lnet.h   |   16 +++++
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c    |    2 +-
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c    |   11 ++--
 .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c |    6 +-
 .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c  |   15 ++---
 .../lustre/lnet/klnds/socklnd/socklnd_proto.c      |   43 ++++++-------
 drivers/staging/lustre/lnet/lnet/acceptor.c        |   43 ++++++-------
 drivers/staging/lustre/lnet/lnet/config.c          |   21 +++----
 drivers/staging/lustre/lnet/lnet/lib-socket.c      |   66 +++++++++----------
 10 files changed, 110 insertions(+), 128 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs.h +0 -15
index 457ce9a..5dd9cdf 100644
@@ -65,21 +65,6 @@ static inline int __is_po2(unsigned long long val)
 int libcfs_arch_init(void);
 void libcfs_arch_cleanup(void);
 
-/* libcfs tcpip */
-int libcfs_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask);
-int libcfs_ipif_enumerate(char ***names);
-void libcfs_ipif_free_enumeration(char **names, int n);
-int libcfs_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog);
-int libcfs_sock_accept(struct socket **newsockp, struct socket *sock);
-int libcfs_sock_connect(struct socket **sockp, int *fatal,
-			__u32 local_ip, int local_port,
-			__u32 peer_ip, int peer_port);
-int libcfs_sock_setbuf(struct socket *socket, int txbufsize, int rxbufsize);
-int libcfs_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize);
-int libcfs_sock_getaddr(struct socket *socket, int remote, __u32 *ip, int *port);
-int libcfs_sock_write(struct socket *sock, void *buffer, int nob, int timeout);
-int libcfs_sock_read(struct socket *sock, void *buffer, int nob, int timeout);
-
 /* need both kernel and user-land acceptor */
 #define LNET_ACCEPTOR_MIN_RESERVED_PORT    512
 #define LNET_ACCEPTOR_MAX_RESERVED_PORT    1023
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +16 -0
index d84aa9a..ff07703 100644
@@ -844,6 +844,22 @@ int lnet_acceptor_port(void);
 int lnet_acceptor_start(void);
 void lnet_acceptor_stop(void);
 
+int lnet_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask);
+int lnet_ipif_enumerate(char ***names);
+void lnet_ipif_free_enumeration(char **names, int n);
+int lnet_sock_setbuf(struct socket *socket, int txbufsize, int rxbufsize);
+int lnet_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize);
+int lnet_sock_getaddr(struct socket *socket, bool remote, __u32 *ip, int *port);
+int lnet_sock_write(struct socket *sock, void *buffer, int nob, int timeout);
+int lnet_sock_read(struct socket *sock, void *buffer, int nob, int timeout);
+
+int lnet_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog);
+int lnet_sock_accept(struct socket **newsockp, struct socket *sock);
+int lnet_sock_connect(struct socket **sockp, int *fatal,
+		      __u32 local_ip, int local_port,
+		      __u32 peer_ip, int peer_port);
+void libcfs_sock_release(struct socket *sock);
+
 void lnet_get_tunables(void);
 int lnet_peers_start_down(void);
 int lnet_peer_buffer_credits(lnet_ni_t *ni);
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +1 -1
index a57c5c3..060b739 100644
@@ -2617,7 +2617,7 @@ static kib_dev_t *kiblnd_create_dev(char *ifname)
 	int up;
 	int rc;
 
-	rc = libcfs_ipif_query(ifname, &up, &ip, &netmask);
+	rc = lnet_ipif_query(ifname, &up, &ip, &netmask);
 	if (rc != 0) {
 		CERROR("Can't query IPoIB interface %s: %d\n",
 		       ifname, rc);
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +5 -6
index 38e831f..ee5cf35 100644
@@ -968,7 +968,7 @@ ksocknal_accept(lnet_ni_t *ni, struct socket *sock)
 	__u32 peer_ip;
 	int peer_port;
 
-	rc = libcfs_sock_getaddr(sock, 1, &peer_ip, &peer_port);
+	rc = lnet_sock_getaddr(sock, 1, &peer_ip, &peer_port);
 	LASSERT(rc == 0);		      /* we succeeded before */
 
 	LIBCFS_ALLOC(cr, sizeof(*cr));
@@ -2594,7 +2594,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net)
 	int rc;
 	int n;
 
-	n = libcfs_ipif_enumerate(&names);
+	n = lnet_ipif_enumerate(&names);
 	if (n <= 0) {
 		CERROR("Can't enumerate interfaces: %d\n", n);
 		return n;
@@ -2608,7 +2608,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net)
 		if (!strcmp(names[i], "lo")) /* skip the loopback IF */
 			continue;
 
-		rc = libcfs_ipif_query(names[i], &up, &ip, &mask);
+		rc = lnet_ipif_query(names[i], &up, &ip, &mask);
 		if (rc != 0) {
 			CWARN("Can't get interface %s info: %d\n",
 			      names[i], rc);
@@ -2634,7 +2634,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net)
 		j++;
 	}
 
-	libcfs_ipif_free_enumeration(names, n);
+	lnet_ipif_free_enumeration(names, n);
 
 	if (j == 0)
 		CERROR("Can't find any usable interfaces\n");
@@ -2796,8 +2796,7 @@ ksocknal_startup(lnet_ni_t *ni)
 			if (ni->ni_interfaces[i] == NULL)
 				break;
 
-			rc = libcfs_ipif_query(
-				ni->ni_interfaces[i], &up,
+			rc = lnet_ipif_query(ni->ni_interfaces[i], &up,
 				&net->ksnn_interfaces[i].ksni_ipaddr,
 				&net->ksnn_interfaces[i].ksni_netmask);
 
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +3 -3
index a1a4ac0..fe2a83a 100644
@@ -1707,7 +1707,7 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn,
 	timeout = active ? *ksocknal_tunables.ksnd_timeout :
 			    lnet_acceptor_timeout();
 
-	rc = libcfs_sock_read(sock, &hello->kshm_magic, sizeof (hello->kshm_magic), timeout);
+	rc = lnet_sock_read(sock, &hello->kshm_magic, sizeof (hello->kshm_magic), timeout);
 	if (rc != 0) {
 		CERROR("Error %d reading HELLO from %pI4h\n",
 			rc, &conn->ksnc_ipaddr);
@@ -1726,8 +1726,8 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn,
 		return -EPROTO;
 	}
 
-	rc = libcfs_sock_read(sock, &hello->kshm_version,
-			      sizeof(hello->kshm_version), timeout);
+	rc = lnet_sock_read(sock, &hello->kshm_version,
+			    sizeof(hello->kshm_version), timeout);
 	if (rc != 0) {
 		CERROR("Error %d reading HELLO from %pI4h\n",
 			rc, &conn->ksnc_ipaddr);
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +6 -9
index caeb347..34c6a72 100644
@@ -39,9 +39,8 @@
 int
 ksocknal_lib_get_conn_addrs(ksock_conn_t *conn)
 {
-	int rc = libcfs_sock_getaddr(conn->ksnc_sock, 1,
-				     &conn->ksnc_ipaddr,
-				     &conn->ksnc_port);
+	int rc = lnet_sock_getaddr(conn->ksnc_sock, 1, &conn->ksnc_ipaddr,
+				   &conn->ksnc_port);
 
 	/* Didn't need the {get,put}connsock dance to deref ksnc_sock... */
 	LASSERT(!conn->ksnc_closing);
@@ -51,8 +50,7 @@ ksocknal_lib_get_conn_addrs(ksock_conn_t *conn)
 		return rc;
 	}
 
-	rc = libcfs_sock_getaddr(conn->ksnc_sock, 0,
-				 &conn->ksnc_myipaddr, NULL);
+	rc = lnet_sock_getaddr(conn->ksnc_sock, 0, &conn->ksnc_myipaddr, NULL);
 	if (rc != 0) {
 		CERROR("Error %d getting sock local IP\n", rc);
 		return rc;
@@ -436,7 +434,7 @@ ksocknal_lib_get_conn_tunables(ksock_conn_t *conn, int *txmem, int *rxmem, int *
 		return -ESHUTDOWN;
 	}
 
-	rc = libcfs_sock_getbuf(sock, txmem, rxmem);
+	rc = lnet_sock_getbuf(sock, txmem, rxmem);
 	if (rc == 0) {
 		len = sizeof(*nagle);
 		rc = kernel_getsockopt(sock, SOL_TCP, TCP_NODELAY,
@@ -498,9 +496,8 @@ ksocknal_lib_setup_sock(struct socket *sock)
 		}
 	}
 
-	rc = libcfs_sock_setbuf(sock,
-				*ksocknal_tunables.ksnd_tx_buffer_size,
-				*ksocknal_tunables.ksnd_rx_buffer_size);
+	rc = lnet_sock_setbuf(sock, *ksocknal_tunables.ksnd_tx_buffer_size,
+			      *ksocknal_tunables.ksnd_rx_buffer_size);
 	if (rc != 0) {
 		CERROR("Can't set buffer tx %d, rx %d buffers: %d\n",
 			*ksocknal_tunables.ksnd_tx_buffer_size,
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +20 -23
index 1938d6a..986bce4 100644
@@ -495,9 +495,7 @@ ksocknal_send_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello)
 	hdr->msg.hello.type = cpu_to_le32 (hello->kshm_ctype);
 	hdr->msg.hello.incarnation = cpu_to_le64 (hello->kshm_src_incarnation);
 
-	rc = libcfs_sock_write(sock, hdr, sizeof(*hdr),
-			       lnet_acceptor_timeout());
-
+	rc = lnet_sock_write(sock, hdr, sizeof(*hdr), lnet_acceptor_timeout());
 	if (rc != 0) {
 		CNETERR("Error %d sending HELLO hdr to %pI4h/%d\n",
 			rc, &conn->ksnc_ipaddr, conn->ksnc_port);
@@ -511,9 +509,9 @@ ksocknal_send_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello)
 		hello->kshm_ips[i] = __cpu_to_le32 (hello->kshm_ips[i]);
 	}
 
-	rc = libcfs_sock_write(sock, hello->kshm_ips,
-			       hello->kshm_nips * sizeof(__u32),
-			       lnet_acceptor_timeout());
+	rc = lnet_sock_write(sock, hello->kshm_ips,
+			     hello->kshm_nips * sizeof(__u32),
+			     lnet_acceptor_timeout());
 	if (rc != 0) {
 		CNETERR("Error %d sending HELLO payload (%d) to %pI4h/%d\n",
 			rc, hello->kshm_nips,
@@ -544,9 +542,8 @@ ksocknal_send_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello)
 		LNET_UNLOCK();
 	}
 
-	rc = libcfs_sock_write(sock, hello, offsetof(ksock_hello_msg_t, kshm_ips),
-			       lnet_acceptor_timeout());
-
+	rc = lnet_sock_write(sock, hello, offsetof(ksock_hello_msg_t, kshm_ips),
+			     lnet_acceptor_timeout());
 	if (rc != 0) {
 		CNETERR("Error %d sending HELLO hdr to %pI4h/%d\n",
 			rc, &conn->ksnc_ipaddr, conn->ksnc_port);
@@ -556,9 +553,9 @@ ksocknal_send_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello)
 	if (hello->kshm_nips == 0)
 		return 0;
 
-	rc = libcfs_sock_write(sock, hello->kshm_ips,
-			       hello->kshm_nips * sizeof(__u32),
-			       lnet_acceptor_timeout());
+	rc = lnet_sock_write(sock, hello->kshm_ips,
+			     hello->kshm_nips * sizeof(__u32),
+			     lnet_acceptor_timeout());
 	if (rc != 0) {
 		CNETERR("Error %d sending HELLO payload (%d) to %pI4h/%d\n",
 			rc, hello->kshm_nips,
@@ -583,9 +580,9 @@ ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello,
 		return -ENOMEM;
 	}
 
-	rc = libcfs_sock_read(sock, &hdr->src_nid,
-			      sizeof(*hdr) - offsetof(lnet_hdr_t, src_nid),
-			      timeout);
+	rc = lnet_sock_read(sock, &hdr->src_nid,
+			    sizeof(*hdr) - offsetof(lnet_hdr_t, src_nid),
+			    timeout);
 	if (rc != 0) {
 		CERROR("Error %d reading rest of HELLO hdr from %pI4h\n",
 			rc, &conn->ksnc_ipaddr);
@@ -619,8 +616,8 @@ ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello,
 	if (hello->kshm_nips == 0)
 		goto out;
 
-	rc = libcfs_sock_read(sock, hello->kshm_ips,
-			      hello->kshm_nips * sizeof(__u32), timeout);
+	rc = lnet_sock_read(sock, hello->kshm_ips,
+			    hello->kshm_nips * sizeof(__u32), timeout);
 	if (rc != 0) {
 		CERROR("Error %d reading IPs from ip %pI4h\n",
 			rc, &conn->ksnc_ipaddr);
@@ -656,10 +653,10 @@ ksocknal_recv_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello, int timeout
 	else
 		conn->ksnc_flip = 1;
 
-	rc = libcfs_sock_read(sock, &hello->kshm_src_nid,
-			      offsetof(ksock_hello_msg_t, kshm_ips) -
-				       offsetof(ksock_hello_msg_t, kshm_src_nid),
-			      timeout);
+	rc = lnet_sock_read(sock, &hello->kshm_src_nid,
+			    offsetof(ksock_hello_msg_t, kshm_ips) -
+				     offsetof(ksock_hello_msg_t, kshm_src_nid),
+			    timeout);
 	if (rc != 0) {
 		CERROR("Error %d reading HELLO from %pI4h\n",
 			rc, &conn->ksnc_ipaddr);
@@ -687,8 +684,8 @@ ksocknal_recv_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello, int timeout
 	if (hello->kshm_nips == 0)
 		return 0;
 
-	rc = libcfs_sock_read(sock, hello->kshm_ips,
-			      hello->kshm_nips * sizeof(__u32), timeout);
+	rc = lnet_sock_read(sock, hello->kshm_ips,
+			    hello->kshm_nips * sizeof(__u32), timeout);
 	if (rc != 0) {
 		CERROR("Error %d reading IPs from ip %pI4h\n",
 			rc, &conn->ksnc_ipaddr);
drivers/staging/lustre/lnet/lnet/acceptor.c +19 -24
index 5187e65..1dc7c8a 100644
@@ -155,9 +155,8 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid,
 	     --port) {
 		/* Iterate through reserved ports. */
 
-		rc = libcfs_sock_connect(&sock, &fatal,
-					 local_ip, port,
-					 peer_ip, peer_port);
+		rc = lnet_sock_connect(&sock, &fatal, local_ip, port, peer_ip,
+				       peer_port);
 		if (rc != 0) {
 			if (fatal)
 				goto failed;
@@ -184,8 +183,7 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid,
 			lnet_net_unlock(LNET_LOCK_EX);
 		}
 
-		rc = libcfs_sock_write(sock, &cr, sizeof(cr),
-				       accept_timeout);
+		rc = lnet_sock_write(sock, &cr, sizeof(cr), accept_timeout);
 		if (rc != 0)
 			goto failed_sock;
 
@@ -220,7 +218,7 @@ lnet_accept(struct socket *sock, __u32 magic)
 
 	LASSERT(sizeof(cr) <= 16);	     /* not too big for the stack */
 
-	rc = libcfs_sock_getaddr(sock, 1, &peer_ip, &peer_port);
+	rc = lnet_sock_getaddr(sock, 1, &peer_ip, &peer_port);
 	LASSERT(rc == 0);		      /* we succeeded before */
 
 	if (!lnet_accept_magic(magic, LNET_PROTO_ACCEPTOR_MAGIC)) {
@@ -234,8 +232,8 @@ lnet_accept(struct socket *sock, __u32 magic)
 			memset(&cr, 0, sizeof(cr));
 			cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC;
 			cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION;
-			rc = libcfs_sock_write(sock, &cr, sizeof(cr),
-					       accept_timeout);
+			rc = lnet_sock_write(sock, &cr, sizeof(cr),
+					     accept_timeout);
 
 			if (rc != 0)
 				CERROR("Error sending magic+version in response to LNET magic from %pI4h: %d\n",
@@ -257,9 +255,8 @@ lnet_accept(struct socket *sock, __u32 magic)
 
 	flip = (magic != LNET_PROTO_ACCEPTOR_MAGIC);
 
-	rc = libcfs_sock_read(sock, &cr.acr_version,
-			      sizeof(cr.acr_version),
-			      accept_timeout);
+	rc = lnet_sock_read(sock, &cr.acr_version, sizeof(cr.acr_version),
+			    accept_timeout);
 	if (rc != 0) {
 		CERROR("Error %d reading connection request version from %pI4h\n",
 			rc, &peer_ip);
@@ -280,19 +277,17 @@ lnet_accept(struct socket *sock, __u32 magic)
 		cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC;
 		cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION;
 
-		rc = libcfs_sock_write(sock, &cr, sizeof(cr),
-				       accept_timeout);
-
+		rc = lnet_sock_write(sock, &cr, sizeof(cr), accept_timeout);
 		if (rc != 0)
 			CERROR("Error sending magic+version in response to version %d from %pI4h: %d\n",
 			       peer_version, &peer_ip, rc);
 		return -EPROTO;
 	}
 
-	rc = libcfs_sock_read(sock, &cr.acr_nid,
-			      sizeof(cr) -
-			      offsetof(lnet_acceptor_connreq_t, acr_nid),
-			      accept_timeout);
+	rc = lnet_sock_read(sock, &cr.acr_nid,
+			    sizeof(cr) -
+			    offsetof(lnet_acceptor_connreq_t, acr_nid),
+			    accept_timeout);
 	if (rc != 0) {
 		CERROR("Error %d reading connection request from %pI4h\n",
 			rc, &peer_ip);
@@ -343,8 +338,8 @@ lnet_acceptor(void *arg)
 
 	cfs_block_allsigs();
 
-	rc = libcfs_sock_listen(&lnet_acceptor_state.pta_sock,
-				0, accept_port, accept_backlog);
+	rc = lnet_sock_listen(&lnet_acceptor_state.pta_sock, 0, accept_port,
+			      accept_backlog);
 	if (rc != 0) {
 		if (rc == -EADDRINUSE)
 			LCONSOLE_ERROR_MSG(0x122, "Can't start acceptor on port %d: port already in use\n",
@@ -367,7 +362,7 @@ lnet_acceptor(void *arg)
 
 	while (!lnet_acceptor_state.pta_shutdown) {
 
-		rc = libcfs_sock_accept(&newsock, lnet_acceptor_state.pta_sock);
+		rc = lnet_sock_accept(&newsock, lnet_acceptor_state.pta_sock);
 		if (rc != 0) {
 			if (rc != -EAGAIN) {
 				CWARN("Accept error %d: pausing...\n", rc);
@@ -383,7 +378,7 @@ lnet_acceptor(void *arg)
 			break;
 		}
 
-		rc = libcfs_sock_getaddr(newsock, 1, &peer_ip, &peer_port);
+		rc = lnet_sock_getaddr(newsock, 1, &peer_ip, &peer_port);
 		if (rc != 0) {
 			CERROR("Can't determine new connection's address\n");
 			goto failed;
@@ -395,8 +390,8 @@ lnet_acceptor(void *arg)
 			goto failed;
 		}
 
-		rc = libcfs_sock_read(newsock, &magic, sizeof(magic),
-				      accept_timeout);
+		rc = lnet_sock_read(newsock, &magic, sizeof(magic),
+				    accept_timeout);
 		if (rc != 0) {
 			CERROR("Error %d reading connection request from %pI4h\n",
 				rc, &peer_ip);
drivers/staging/lustre/lnet/lnet/config.c +9 -12
index 70bc809..efbb74a 100644
@@ -1118,7 +1118,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)
 	__u32 *ipaddrs2;
 	int nip;
 	char **ifnames;
-	int nif = libcfs_ipif_enumerate(&ifnames);
+	int nif = lnet_ipif_enumerate(&ifnames);
 	int i;
 	int rc;
 
@@ -1128,7 +1128,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)
 	LIBCFS_ALLOC(ipaddrs, nif * sizeof(*ipaddrs));
 	if (ipaddrs == NULL) {
 		CERROR("Can't allocate ipaddrs[%d]\n", nif);
-		libcfs_ipif_free_enumeration(ifnames, nif);
+		lnet_ipif_free_enumeration(ifnames, nif);
 		return -ENOMEM;
 	}
 
@@ -1136,8 +1136,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)
 		if (!strcmp(ifnames[i], "lo"))
 			continue;
 
-		rc = libcfs_ipif_query(ifnames[i], &up,
-				       &ipaddrs[nip], &netmask);
+		rc = lnet_ipif_query(ifnames[i], &up, &ipaddrs[nip], &netmask);
 		if (rc != 0) {
 			CWARN("Can't query interface %s: %d\n",
 			      ifnames[i], rc);
@@ -1153,7 +1152,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)
 		nip++;
 	}
 
-	libcfs_ipif_free_enumeration(ifnames, nif);
+	lnet_ipif_free_enumeration(ifnames, nif);
 
 	if (nip == nif) {
 		*ipaddrsp = ipaddrs;
@@ -1237,8 +1236,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni)
 			return -EPERM;
 		}
 
-		rc = libcfs_ipif_query(ni->ni_interfaces[0],
-				       &up, &ip, &netmask);
+		rc = lnet_ipif_query(ni->ni_interfaces[0], &up, &ip, &netmask);
 		if (rc != 0) {
 			CERROR("Net %s can't query interface %s: %d\n",
 			       libcfs_net2str(net), ni->ni_interfaces[0], rc);
@@ -1255,7 +1253,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni)
 		return 0;
 	}
 
-	n = libcfs_ipif_enumerate(&names);
+	n = lnet_ipif_enumerate(&names);
 	if (n <= 0) {
 		CERROR("Net %s can't enumerate interfaces: %d\n",
 		       libcfs_net2str(net), n);
@@ -1266,8 +1264,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni)
 		if (!strcmp(names[i], "lo")) /* skip the loopback IF */
 			continue;
 
-		rc = libcfs_ipif_query(names[i], &up, &ip, &netmask);
-
+		rc = lnet_ipif_query(names[i], &up, &ip, &netmask);
 		if (rc != 0) {
 			CWARN("Net %s can't query interface %s: %d\n",
 			      libcfs_net2str(net), names[i], rc);
@@ -1280,13 +1277,13 @@ lnet_set_ip_niaddr(lnet_ni_t *ni)
 			continue;
 		}
 
-		libcfs_ipif_free_enumeration(names, n);
+		lnet_ipif_free_enumeration(names, n);
 		ni->ni_nid = LNET_MKNID(net, ip);
 		return 0;
 	}
 
 	CERROR("Net %s can't find any interfaces\n", libcfs_net2str(net));
-	libcfs_ipif_free_enumeration(names, n);
+	lnet_ipif_free_enumeration(names, n);
 	return -ENOENT;
 }
 EXPORT_SYMBOL(lnet_set_ip_niaddr);
drivers/staging/lustre/lnet/lnet/lib-socket.c +31 -35
index bb8d9c2..2e87168 100644
@@ -45,7 +45,7 @@
 #include <linux/syscalls.h>
 
 static int
-libcfs_sock_ioctl(int cmd, unsigned long arg)
+lnet_sock_ioctl(int cmd, unsigned long arg)
 {
 	mm_segment_t	oldmm = get_fs();
 	struct socket  *sock;
@@ -76,7 +76,7 @@ out:
 }
 
 int
-libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask)
+lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask)
 {
 	struct ifreq   ifr;
 	int	    nob;
@@ -92,8 +92,7 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask)
 	CLASSERT (sizeof(ifr.ifr_name) >= IFNAMSIZ);
 
 	strcpy(ifr.ifr_name, name);
-	rc = libcfs_sock_ioctl(SIOCGIFFLAGS, (unsigned long)&ifr);
-
+	rc = lnet_sock_ioctl(SIOCGIFFLAGS, (unsigned long)&ifr);
 	if (rc != 0) {
 		CERROR("Can't get flags for interface %s\n", name);
 		return rc;
@@ -110,8 +109,7 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask)
 
 	strcpy(ifr.ifr_name, name);
 	ifr.ifr_addr.sa_family = AF_INET;
-	rc = libcfs_sock_ioctl(SIOCGIFADDR, (unsigned long)&ifr);
-
+	rc = lnet_sock_ioctl(SIOCGIFADDR, (unsigned long)&ifr);
 	if (rc != 0) {
 		CERROR("Can't get IP address for interface %s\n", name);
 		return rc;
@@ -122,8 +120,7 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask)
 
 	strcpy(ifr.ifr_name, name);
 	ifr.ifr_addr.sa_family = AF_INET;
-	rc = libcfs_sock_ioctl(SIOCGIFNETMASK, (unsigned long)&ifr);
-
+	rc = lnet_sock_ioctl(SIOCGIFNETMASK, (unsigned long)&ifr);
 	if (rc != 0) {
 		CERROR("Can't get netmask for interface %s\n", name);
 		return rc;
@@ -135,10 +132,10 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask)
 	return 0;
 }
 
-EXPORT_SYMBOL(libcfs_ipif_query);
+EXPORT_SYMBOL(lnet_ipif_query);
 
 int
-libcfs_ipif_enumerate (char ***namesp)
+lnet_ipif_enumerate (char ***namesp)
 {
 	/* Allocate and fill in 'names', returning # interfaces/error */
 	char	   **names;
@@ -172,8 +169,7 @@ libcfs_ipif_enumerate (char ***namesp)
 		ifc.ifc_buf = (char *)ifr;
 		ifc.ifc_len = nalloc * sizeof(*ifr);
 
-		rc = libcfs_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc);
-
+		rc = lnet_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc);
 		if (rc < 0) {
 			CERROR ("Error %d enumerating interfaces\n", rc);
 			goto out1;
@@ -226,17 +222,17 @@ libcfs_ipif_enumerate (char ***namesp)
 
  out2:
 	if (rc < 0)
-		libcfs_ipif_free_enumeration(names, nfound);
+		lnet_ipif_free_enumeration(names, nfound);
  out1:
 	LIBCFS_FREE(ifr, nalloc * sizeof(*ifr));
  out0:
 	return rc;
 }
 
-EXPORT_SYMBOL(libcfs_ipif_enumerate);
+EXPORT_SYMBOL(lnet_ipif_enumerate);
 
 void
-libcfs_ipif_free_enumeration (char **names, int n)
+lnet_ipif_free_enumeration (char **names, int n)
 {
 	int      i;
 
@@ -248,10 +244,10 @@ libcfs_ipif_free_enumeration (char **names, int n)
 	LIBCFS_FREE(names, n * sizeof(*names));
 }
 
-EXPORT_SYMBOL(libcfs_ipif_free_enumeration);
+EXPORT_SYMBOL(lnet_ipif_free_enumeration);
 
 int
-libcfs_sock_write (struct socket *sock, void *buffer, int nob, int timeout)
+lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout)
 {
 	int	    rc;
 	long	   ticks = timeout * HZ;
@@ -310,10 +306,10 @@ libcfs_sock_write (struct socket *sock, void *buffer, int nob, int timeout)
 
 	return 0;
 }
-EXPORT_SYMBOL(libcfs_sock_write);
+EXPORT_SYMBOL(lnet_sock_write);
 
 int
-libcfs_sock_read (struct socket *sock, void *buffer, int nob, int timeout)
+lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout)
 {
 	int	    rc;
 	long	   ticks = timeout * HZ;
@@ -366,10 +362,10 @@ libcfs_sock_read (struct socket *sock, void *buffer, int nob, int timeout)
 	}
 }
 
-EXPORT_SYMBOL(libcfs_sock_read);
+EXPORT_SYMBOL(lnet_sock_read);
 
 static int
-libcfs_sock_create (struct socket **sockp, int *fatal,
+lnet_sock_create (struct socket **sockp, int *fatal,
 		    __u32 local_ip, int local_port)
 {
 	struct sockaddr_in  locaddr;
@@ -424,7 +420,7 @@ libcfs_sock_create (struct socket **sockp, int *fatal,
 }
 
 int
-libcfs_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize)
+lnet_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize)
 {
 	int		 option;
 	int		 rc;
@@ -454,10 +450,10 @@ libcfs_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize)
 	return 0;
 }
 
-EXPORT_SYMBOL(libcfs_sock_setbuf);
+EXPORT_SYMBOL(lnet_sock_setbuf);
 
 int
-libcfs_sock_getaddr (struct socket *sock, int remote, __u32 *ip, int *port)
+lnet_sock_getaddr (struct socket *sock, bool remote, __u32 *ip, int *port)
 {
 	struct sockaddr_in sin;
 	int		len = sizeof (sin);
@@ -480,10 +476,10 @@ libcfs_sock_getaddr (struct socket *sock, int remote, __u32 *ip, int *port)
 	return 0;
 }
 
-EXPORT_SYMBOL(libcfs_sock_getaddr);
+EXPORT_SYMBOL(lnet_sock_getaddr);
 
 int
-libcfs_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize)
+lnet_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize)
 {
 
 	if (txbufsize != NULL) {
@@ -497,16 +493,16 @@ libcfs_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize)
 	return 0;
 }
 
-EXPORT_SYMBOL(libcfs_sock_getbuf);
+EXPORT_SYMBOL(lnet_sock_getbuf);
 
 int
-libcfs_sock_listen (struct socket **sockp,
+lnet_sock_listen (struct socket **sockp,
 		    __u32 local_ip, int local_port, int backlog)
 {
 	int      fatal;
 	int      rc;
 
-	rc = libcfs_sock_create(sockp, &fatal, local_ip, local_port);
+	rc = lnet_sock_create(sockp, &fatal, local_ip, local_port);
 	if (rc != 0) {
 		if (!fatal)
 			CERROR("Can't create socket: port %d already in use\n",
@@ -523,10 +519,10 @@ libcfs_sock_listen (struct socket **sockp,
 	return rc;
 }
 
-EXPORT_SYMBOL(libcfs_sock_listen);
+EXPORT_SYMBOL(lnet_sock_listen);
 
 int
-libcfs_sock_accept (struct socket **newsockp, struct socket *sock)
+lnet_sock_accept (struct socket **newsockp, struct socket *sock)
 {
 	wait_queue_t   wait;
 	struct socket *newsock;
@@ -566,17 +562,17 @@ libcfs_sock_accept (struct socket **newsockp, struct socket *sock)
 	return rc;
 }
 
-EXPORT_SYMBOL(libcfs_sock_accept);
+EXPORT_SYMBOL(lnet_sock_accept);
 
 int
-libcfs_sock_connect (struct socket **sockp, int *fatal,
+lnet_sock_connect (struct socket **sockp, int *fatal,
 		     __u32 local_ip, int local_port,
 		     __u32 peer_ip, int peer_port)
 {
 	struct sockaddr_in  srvaddr;
 	int		 rc;
 
-	rc = libcfs_sock_create(sockp, fatal, local_ip, local_port);
+	rc = lnet_sock_create(sockp, fatal, local_ip, local_port);
 	if (rc != 0)
 		return rc;
 
@@ -605,4 +601,4 @@ libcfs_sock_connect (struct socket **sockp, int *fatal,
 	return rc;
 }
 
-EXPORT_SYMBOL(libcfs_sock_connect);
+EXPORT_SYMBOL(lnet_sock_connect);
Signature · 6 lines
1.7.1

_______________________________________________
devel mailing list
devel at linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
#12 lore raw

Re: [PATCH v4 4/7] staging:lustre: rename tcpip handling functions to lnet_* prefix

Quoted 12 lines · Sudip Mukherjee
Quoted 4 lines · James Simmons

With all the TCPIP handling done in the lnet layer we should rename all the functions with the prefix lnet_*. One other change done was changing the remove argument of lnet_sock_getaddr from a int to a bool.

thats two different change.
and apart from this:
1) the function declarations were renamed and moved from lustre/include/linux/libcfs/libcfs.h to drivers/staging/lustre/include/linux/lnet/lib-lnet.h

2) some functions you have changed the coding style. like:

drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c ksocknal_lib_get_conn_addrs(ksock_conn_t *conn) · line 53

Quoted 3 lines
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +1 -2
-     rc = libcfs_sock_getaddr(conn->ksnc_sock, 0,
-                              &conn->ksnc_myipaddr, NULL);
+     rc = lnet_sock_getaddr(conn->ksnc_sock, 0, &conn->ksnc_myipaddr, NULL);

Those are tiny related changes. They're fine. When you rename functions you normally have to change the indenting as well.

regards,
dan carpenter

#13 lore raw

PATCH v4 5/7 staging:lustre: use available kernel wrappers in lib-socket.c

In reply to James Simmons

Instead of handling calls to struct proto ourselves we can use equivalent kernel wrappers. No wrapper exist for unlocked ioctl handling so we create one here for our use. I expect some day that function will be integrated into sock.c.

---
 drivers/staging/lustre/lnet/lnet/lib-socket.c |   47 ++++++++++++++++---------
 1 files changed, 30 insertions(+), 17 deletions(-)
drivers/staging/lustre/lnet/lnet/lib-socket.c +30 -17
index 2e87168..2d46a69 100644
@@ -35,22 +35,37 @@
  */
 #define DEBUG_SUBSYSTEM S_LNET
 
-#include "../../include/linux/libcfs/libcfs.h"
-#include "../../include/linux/lnet/lib-lnet.h"
-
 #include <linux/if.h>
 #include <linux/in.h>
+#include <linux/net.h>
 #include <linux/file.h>
+#include <linux/pagemap.h>
 /* For sys_open & sys_close */
 #include <linux/syscalls.h>
+#include <net/sock.h>
+
+#include "../../include/linux/libcfs/libcfs.h"
+#include "../../include/linux/lnet/lib-lnet.h"
+
+static int
+kernel_sock_unlocked_ioctl(struct file *filp, int cmd, unsigned long arg)
+{
+	mm_segment_t oldfs = get_fs();
+	int err;
+
+	set_fs(KERNEL_DS);
+	err = filp->f_op->unlocked_ioctl(filp, cmd, arg);
+	set_fs(oldfs);
+
+	return err;
+}
 
 static int
 lnet_sock_ioctl(int cmd, unsigned long arg)
 {
-	mm_segment_t	oldmm = get_fs();
+	struct file    *sock_filp;
 	struct socket  *sock;
 	int		rc;
-	struct file    *sock_filp;
 
 	rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock);
 	if (rc != 0) {
@@ -65,10 +80,7 @@ lnet_sock_ioctl(int cmd, unsigned long arg)
 		goto out;
 	}
 
-	set_fs(KERNEL_DS);
-	if (sock_filp->f_op->unlocked_ioctl)
-		rc = sock_filp->f_op->unlocked_ioctl(sock_filp, cmd, arg);
-	set_fs(oldmm);
+	rc = kernel_sock_unlocked_ioctl(sock_filp, cmd, arg);
 
 	fput(sock_filp);
 out:
@@ -398,8 +410,8 @@ lnet_sock_create (struct socket **sockp, int *fatal,
 		locaddr.sin_addr.s_addr = (local_ip == 0) ?
 					  INADDR_ANY : htonl(local_ip);
 
-		rc = sock->ops->bind(sock, (struct sockaddr *)&locaddr,
-				     sizeof(locaddr));
+		rc = kernel_bind(sock, (struct sockaddr *)&locaddr,
+				 sizeof(locaddr));
 		if (rc == -EADDRINUSE) {
 			CDEBUG(D_NET, "Port %d already in use\n", local_port);
 			*fatal = 0;
@@ -459,8 +471,10 @@ lnet_sock_getaddr (struct socket *sock, bool remote, __u32 *ip, int *port)
 	int		len = sizeof (sin);
 	int		rc;
 
-	rc = sock->ops->getname (sock, (struct sockaddr *)&sin, &len,
-				 remote ? 2 : 0);
+	if (remote)
+		rc = kernel_getpeername(sock, (struct sockaddr *)&sin, &len);
+	else
+		rc = kernel_getsockname(sock, (struct sockaddr *)&sin, &len);
 	if (rc != 0) {
 		CERROR ("Error %d getting sock %s IP/port\n",
 			rc, remote ? "peer" : "local");
@@ -510,7 +524,7 @@ lnet_sock_listen (struct socket **sockp,
 		return rc;
 	}
 
-	rc = (*sockp)->ops->listen(*sockp, backlog);
+	rc = kernel_listen(*sockp, backlog);
 	if (rc == 0)
 		return 0;
 
@@ -581,9 +595,8 @@ lnet_sock_connect (struct socket **sockp, int *fatal,
 	srvaddr.sin_port = htons(peer_port);
 	srvaddr.sin_addr.s_addr = htonl(peer_ip);
 
-	rc = (*sockp)->ops->connect(*sockp,
-				    (struct sockaddr *)&srvaddr, sizeof(srvaddr),
-				    0);
+	rc = kernel_connect(*sockp, (struct sockaddr *)&srvaddr,
+			    sizeof(srvaddr), 0);
 	if (rc == 0)
 		return 0;
 
Signature · 1 line
1.7.1
#14 lore raw

PATCH v4 6/7 staging:lustre: style cleanups for lib-socket.c

In reply to James Simmons

Handle all the style issues reported by checkpatch.pl. Remove general white spaces, spaces in function calls, etc.

---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c    |    4 +-
 drivers/staging/lustre/lnet/lnet/lib-socket.c      |  207 +++++++++-----------
 2 files changed, 96 insertions(+), 115 deletions(-)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +2 -2
index ee5cf35..4128a92 100644
@@ -1378,14 +1378,14 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route,
 	ksocknal_txlist_done(ni, &zombies, 1);
 	ksocknal_peer_decref(peer);
 
- failed_1:
+failed_1:
 	if (hello != NULL)
 		LIBCFS_FREE(hello, offsetof(ksock_hello_msg_t,
 					    kshm_ips[LNET_MAX_INTERFACES]));
 
 	LIBCFS_FREE(conn, sizeof(*conn));
 
- failed_0:
+failed_0:
 	sock_release(sock);
 	return rc;
 }
drivers/staging/lustre/lnet/lnet/lib-socket.c +94 -113

461 lines not on this page · raw message

Signature · 1 line
1.7.1
#15 lore raw

Re: [PATCH v4 6/7] staging:lustre: style cleanups for lib-socket.c

Quoted 6 lines · James Simmons

Handle all the style issues reported by checkpatch.pl. Remove general white spaces, spaces in function calls, etc.

---

<snip>

drivers/staging/lustre/lnet/lnet/lib-socket.c lnet_ipif_enumerate (char ***namesp) · line 168

Quoted 8 lines
drivers/staging/lustre/lnet/lnet/lib-socket.c +2 -2
@@ -167,13 +164,14 @@ lnet_ipif_enumerate (char ***namesp)
 		if (nalloc * sizeof(*ifr) > PAGE_CACHE_SIZE) {
 			toobig = 1;
 			nalloc = PAGE_CACHE_SIZE/sizeof(*ifr);
-			CWARN("Too many interfaces: only enumerating first %d\n",
-			      nalloc);
+			CWARN("Too many interfaces: only enumerating "
+			      "first %d\n", nalloc);

oops. Joe told you not to break the user visible strings.

The CodingStyle says: "However, never break user-visible strings such as printk messages, because that breaks the ability to grep for them."

regards
sudip

#16 lore raw

Re: [PATCH v4 6/7] staging:lustre: style cleanups for lib-socket.c

In reply to James Simmons
Quoted 4 lines · James Simmons

Handle all the style issues reported by checkpatch.pl. Remove general white spaces, spaces in function calls, etc.

What Sudip said but mostly "all the style" issues is a taboo phrase which pretty much gaurantees the change will be rejected. :(

regards,
dan carpenter

#17 lore raw

PATCH v4 7/7 staging:lustre: Update license and copyright for lib-socket.c

In reply to James Simmons

Point to the right place for GNU license. Update Intel copyright.

---
 drivers/staging/lustre/lnet/lnet/lib-socket.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
drivers/staging/lustre/lnet/lnet/lib-socket.c +3 -7
index f0b187d..2f8443c 100644
@@ -15,11 +15,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -27,11 +23,11 @@
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2015 Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
+ * Lustre is a trademark of Seagate, Inc.
  */
 #define DEBUG_SUBSYSTEM S_LNET
 
Signature · 1 line
1.7.1