[dm-devel] [PATCH 2/5] multipath-tools: libmultipath: Removed unused functions.

Gris Ge fge at redhat.com
Fri Jan 20 13:38:59 UTC 2017


 * Removed these unused functions from libmultipath:
    * write_all()
    * read_all()

Signed-off-by: Gris Ge <fge at redhat.com>
---
 libmultipath/uxsock.c | 60 ---------------------------------------------------
 libmultipath/uxsock.h |  2 --
 2 files changed, 62 deletions(-)

diff --git a/libmultipath/uxsock.c b/libmultipath/uxsock.c
index b158a56..0ca9e50 100644
--- a/libmultipath/uxsock.c
+++ b/libmultipath/uxsock.c
@@ -74,66 +74,6 @@ int ux_socket_listen(const char *name)
 }
 
 /*
- * keep writing until it's all sent
- */
-size_t write_all(int fd, const void *buf, size_t len)
-{
-	size_t total = 0;
-
-	while (len) {
-		ssize_t n = send(fd, buf, len, MSG_NOSIGNAL);
-		if (n < 0) {
-			if ((errno == EINTR) || (errno == EAGAIN))
-				continue;
-			return total;
-		}
-		if (!n)
-			return total;
-		buf = n + (char *)buf;
-		len -= n;
-		total += n;
-	}
-	return total;
-}
-
-/*
- * keep reading until its all read
- */
-ssize_t read_all(int fd, void *buf, size_t len, unsigned int timeout)
-{
-	size_t total = 0;
-	ssize_t n;
-	int ret;
-	struct pollfd pfd;
-
-	while (len) {
-		pfd.fd = fd;
-		pfd.events = POLLIN;
-		ret = poll(&pfd, 1, timeout);
-		if (!ret) {
-			return -ETIMEDOUT;
-		} else if (ret < 0) {
-			if (errno == EINTR)
-				continue;
-			return -errno;
-		} else if (!(pfd.revents & POLLIN))
-			continue;
-		n = read(fd, buf, len);
-		if (n < 0) {
-			if ((errno == EINTR) || (errno == EAGAIN))
-				continue;
-			return -errno;
-		}
-		if (!n)
-			return total;
-		buf = n + (char *)buf;
-		len -= n;
-		total += n;
-	}
-	return total;
-}
-
-/*
  * send a packet in length prefix format
  */
 int send_packet(int fd, const char *buf)
diff --git a/libmultipath/uxsock.h b/libmultipath/uxsock.h
index c1cf81f..442b564 100644
--- a/libmultipath/uxsock.h
+++ b/libmultipath/uxsock.h
@@ -2,5 +2,3 @@
 int ux_socket_listen(const char *name);
 int send_packet(int fd, const char *buf);
 int recv_packet(int fd, char **buf, unsigned int timeout);
-size_t write_all(int fd, const void *buf, size_t len);
-ssize_t read_all(int fd, void *buf, size_t len, unsigned int timeout);
-- 
1.8.3.1




More information about the dm-devel mailing list