multipath-tools: libmultipath: Removed unused functions.
authorGris Ge <fge@redhat.com>
Fri, 20 Jan 2017 13:38:59 +0000 (21:38 +0800)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Fri, 10 Feb 2017 11:34:52 +0000 (12:34 +0100)
 * Removed these unused functions from libmultipath:
    * write_all()
    * read_all()

Signed-off-by: Gris Ge <fge@redhat.com>
libmultipath/uxsock.c
libmultipath/uxsock.h

index b158a56..0ca9e50 100644 (file)
@@ -73,66 +73,6 @@ int ux_socket_listen(const char *name)
        return fd;
 }
 
-/*
- * 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
  */
index c1cf81f..442b564 100644 (file)
@@ -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);