]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Remove send_bin_buffer().
authorAndre Noll <maan@systemlinux.org>
Tue, 6 Dec 2011 19:50:29 +0000 (20:50 +0100)
committerAndre Noll <maan@systemlinux.org>
Fri, 20 Jan 2012 21:57:06 +0000 (22:57 +0100)
It is just a trivial wrapper for write_all(). This patch changes all
callers to use write_all() directly and removes the wrapper.

afs.c
client_common.c
command.c
net.c
net.h

diff --git a/afs.c b/afs.c
index 263f1818a2763522fd04bacbc153ccdaffce1f35..46ed6913626482c07eae50c99b943aaa39e275db 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -233,7 +233,7 @@ int send_callback_request(callback_function *f, struct osl_object *query,
        if (ret < 0)
                goto out;
        fd = ret;
-       ret = send_bin_buffer(fd, buf, sizeof(buf));
+       ret = write_all(fd, buf, sizeof(buf));
        if (ret < 0)
                goto out;
        /*
@@ -495,7 +495,7 @@ destroy:
 no_admissible_files:
        *(uint32_t *)buf = NO_ADMISSIBLE_FILES;
        *(uint32_t *)(buf + 4) = (uint32_t)0;
-       return send_bin_buffer(server_socket, buf, 8);
+       return write_all(server_socket, buf, 8);
 }
 
 /* Never fails if arg == NULL */
@@ -814,7 +814,7 @@ int pass_buffer_as_shm(char *buf, size_t size, void *fd_ptr)
        ret = shm_detach(shm);
        if (ret < 0)
                goto err;
-       ret = send_bin_buffer(fd, (char *)&shmid, sizeof(int));
+       ret = write_all(fd, (char *)&shmid, sizeof(int));
        if (ret >= 0)
                return ret;
 err:
index bb421e3ab81c3a28a724f89c84a8c24f993d86e0..5ac1cdb77ced80efe804c7017d9f4ec7a03bc940 100644 (file)
@@ -218,8 +218,7 @@ static void client_post_select(struct sched *s, struct task *t)
                        SESSION_KEY_LEN);
                hash_to_asc(challenge_hash, buf);
                PARA_INFO_LOG("--> %s\n", buf);
-               ret = send_bin_buffer(ct->scc.fd, (char *)challenge_hash,
-                       HASH_SIZE);
+               ret = write_all(ct->scc.fd, (char *)challenge_hash, HASH_SIZE);
                if (ret < 0)
                        goto out;
                ct->status = CL_SENT_CH_RESPONSE;
index f194a7c137d8982f7ba8dac3edd205f947071a73..e344e77acc6bf3c4867ff8e0f3f5c6f1dafb3f4a 100644 (file)
--- a/command.c
+++ b/command.c
@@ -786,7 +786,7 @@ __noreturn void handle_connect(int fd, const char *peername)
        }
        PARA_DEBUG_LOG("sending %u byte challenge + rc4 keys (%zu bytes)\n",
                CHALLENGE_SIZE, numbytes);
-       ret = send_bin_buffer(fd, buf, numbytes);
+       ret = write_all(fd, buf, numbytes);
        if (ret < 0)
                goto net_err;
        /* recv challenge response */
diff --git a/net.c b/net.c
index d32cc7eeb611279d936ef8cfd98dda644f06d799..9c300c744c11ddbec362eb02433a6a3d60db8163 100644 (file)
--- a/net.c
+++ b/net.c
@@ -689,38 +689,19 @@ struct in_addr extract_v4_addr(const struct sockaddr_storage *ss)
        return ia;
 }
 
-/**
- * Send a binary buffer.
- *
- * \param fd The file descriptor.
- * \param buf The buffer to be sent.
- * \param len The length of \a buf.
- *
- * Send out the buffer and try to resend the remaining part in case of short
- * writes.
- *
- * \return Standard.
- */
-int send_bin_buffer(int fd, const char *buf, size_t len)
-{
-       if (!len)
-               PARA_CRIT_LOG("len == 0\n");
-       return write_all(fd, buf, len);
-}
-
 /**
  * Send a \p NULL-terminated buffer.
  *
  * \param fd The file descriptor.
  * \param buf The null-terminated buffer to be send.
  *
- * This is equivalent to send_bin_buffer(fd, buf, strlen(buf)).
+ * This is equivalent to write_all(fd, buf, strlen(buf)).
  *
  * \return Standard.
  */
 int send_buffer(int fd, const char *buf)
 {
-       return send_bin_buffer(fd, buf, strlen(buf));
+       return write_all(fd, buf, strlen(buf));
 }
 
 /**
diff --git a/net.h b/net.h
index 8eba454c9f4c86dad02871382af55c2dd5a2b3b5..fb7faa3ced21da31e38d904d1fb51d458166bdec 100644 (file)
--- a/net.h
+++ b/net.h
@@ -141,7 +141,6 @@ extern char *remote_name(int sockfd);
  */
 extern int generic_max_transport_msg_size(int sockfd);
 
-int send_bin_buffer(int, const char *, size_t);
 int send_buffer(int, const char *);
 __printf_2_3 int send_va_buffer(int fd, const char *fmt, ...);