Patchwork [v2,3/7] net: enlarge connect_to_addr() scope

login
register
mail settings
Submitter namei.unix@gmail.com
Date March 29, 2013, 5:42 a.m.
Message ID <1364535744-8707-4-git-send-email-namei.unix@gmail.com>
Download mbox | patch
Permalink /patch/232290/
State New
Headers show

Comments

namei.unix@gmail.com - March 29, 2013, 5:42 a.m.
From: Liu Yuan <tailai.ly@taobao.com>

This is a prepare patch.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
---
 include/net.h        |    8 ++++++++
 sheep/sockfd_cache.c |    8 --------
 2 files changed, 8 insertions(+), 8 deletions(-)

Patch

diff --git a/include/net.h b/include/net.h
index a68c880..75ac197 100644
--- a/include/net.h
+++ b/include/net.h
@@ -72,4 +72,12 @@  int set_rcv_timeout(int fd);
 int get_local_addr(uint8_t *bytes);
 bool inetaddr_is_valid(char *addr);
 
+static inline int connect_to_addr(const uint8_t *addr, int port)
+{
+	char name[INET6_ADDRSTRLEN];
+
+	addr_to_str(name, sizeof(name), addr, 0);
+	return connect_to(name, port);
+}
+
 #endif
diff --git a/sheep/sockfd_cache.c b/sheep/sockfd_cache.c
index ddefbf2..1e0d6cf 100644
--- a/sheep/sockfd_cache.c
+++ b/sheep/sockfd_cache.c
@@ -337,14 +337,6 @@  static inline void check_idx(int idx)
 	queue_work(sys->sockfd_wqueue, w);
 }
 
-static inline int connect_to_addr(const uint8_t *addr, int port)
-{
-	char name[INET6_ADDRSTRLEN];
-
-	addr_to_str(name, sizeof(name), addr, 0);
-	return connect_to(name, port);
-}
-
 /* Add the node back if it is still alive */
 static inline int revalidate_node(const struct node_id *nid)
 {