From: Andre Noll Date: Tue, 6 Dec 2011 19:50:29 +0000 (+0100) Subject: Remove send_bin_buffer(). X-Git-Tag: v0.4.10~11^2~11 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=c59730ef3c559fd79784c55153410db592eebd68;p=paraslash.git Remove send_bin_buffer(). It is just a trivial wrapper for write_all(). This patch changes all callers to use write_all() directly and removes the wrapper. --- diff --git a/afs.c b/afs.c index 263f1818..46ed6913 100644 --- 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: diff --git a/client_common.c b/client_common.c index bb421e3a..5ac1cdb7 100644 --- a/client_common.c +++ b/client_common.c @@ -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; diff --git a/command.c b/command.c index f194a7c1..e344e77a 100644 --- 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 d32cc7ee..9c300c74 100644 --- 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 8eba454c..fb7faa3c 100644 --- 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, ...);