]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Rename write_nonblock() to xwrite().
authorAndre Noll <maan@systemlinux.org>
Tue, 20 Dec 2011 16:37:28 +0000 (17:37 +0100)
committerAndre Noll <maan@systemlinux.org>
Fri, 20 Jan 2012 21:57:07 +0000 (22:57 +0100)
This function is not only useful for non-blocking file descriptors,
so the name was misleading. Rename it to xwrite() for the lack of
a better name.

12 files changed:
crypt.c
dccp_send.c
fd.c
fd.h
gcrypt.c
grab_client.c
http_send.c
interactive.c
oss_write.c
send_common.c
stdout.c
udp_send.c

diff --git a/crypt.c b/crypt.c
index 85ec091d76cf53e99f5bfc1e40eec9c735328a53..f33f769f6f035c18946c21fea064b37052802583 100644 (file)
--- a/crypt.c
+++ b/crypt.c
@@ -298,7 +298,7 @@ int sc_send_bin_buffer(struct stream_cipher_context *scc, char *buf,
                memcpy(remainder, buf + l1, len - l1);
                RC4(&scc->send->key, len - l1, remainder, tmp + l1);
        }
-       ret = write_nonblock(scc->fd, (char *)tmp, len);
+       ret = xwrite(scc->fd, (char *)tmp, len);
        free(tmp);
        return ret;
 }
index fa2a163c5afdb1f9721b274f02bafc5402422800..cfbc4de7e7a6a8db98e224c927a9b46d9b9b9223 100644 (file)
@@ -104,7 +104,7 @@ static int dccp_init_fec(struct sender_client *sc)
 
 static void dccp_send_fec(struct sender_client *sc, char *buf, size_t len)
 {
-       int ret = write_nonblock(sc->fd, buf, len);
+       int ret = xwrite(sc->fd, buf, len);
 
        if (ret < 0)
                dccp_shutdown_client(sc);
diff --git a/fd.c b/fd.c
index 01c7ed8e83552734b1077d444fc055f89f7695c9..a73325ba5af60adb712213aa789243dc02f74d90 100644 (file)
--- a/fd.c
+++ b/fd.c
@@ -37,7 +37,7 @@
  * len indicates that some bytes have been written but the next write would
  * block.
  */
-int write_nonblock(int fd, const char *buf, size_t len)
+int xwrite(int fd, const char *buf, size_t len)
 {
        size_t written = 0;
 
@@ -73,14 +73,14 @@ int write_nonblock(int fd, const char *buf, size_t len)
  * \param buf The buffer to be sent.
  * \param len The length of \a buf.
  *
- * This is like \ref write_nonblock() but returns \p -E_SHORT_WRITE if not
+ * This is like \ref xwrite() but returns \p -E_SHORT_WRITE if not
  * all data could be written.
  *
  * \return Number of bytes written on success, negative error code else.
  */
 int write_all(int fd, const char *buf, size_t len)
 {
-       int ret = write_nonblock(fd, buf, len);
+       int ret = xwrite(fd, buf, len);
 
        if (ret < 0)
                return ret;
@@ -120,7 +120,7 @@ __printf_2_3 int write_va_buffer(int fd, const char *fmt, ...)
  * If \a rfds is not \p NULL and the (non-blocking) file descriptor \a fd is
  * not set in \a rfds, this function returns early without doing anything.
  * Otherwise The function tries to read up to \a sz bytes from \a fd. As for
- * write_nonblock(), EAGAIN is not considered an error condition. However, EOF
+ * xwrite(), EAGAIN is not considered an error condition. However, EOF
  * is.
  *
  * \return Zero or a negative error code. If the underlying call to readv(2)
@@ -133,7 +133,7 @@ __printf_2_3 int write_va_buffer(int fd, const char *fmt, ...)
  * have been read before the error occurred. In this case \a num_bytes is
  * positive.
  *
- * \sa \ref write_nonblock(), read(2), readv(2).
+ * \sa \ref xwrite(), read(2), readv(2).
  */
 int readv_nonblock(int fd, struct iovec *iov, int iovcnt, fd_set *rfds,
                size_t *num_bytes)
diff --git a/fd.h b/fd.h
index ed4c85a59480b97f6c15876b8b5f5de96c88a614..b8356edd86c218e0df05d1751bcf3a9a413bbf87 100644 (file)
--- a/fd.h
+++ b/fd.h
@@ -29,7 +29,7 @@ int readv_nonblock(int fd, struct iovec *iov, int iovcnt, fd_set *rfds,
                size_t *num_bytes);
 int read_nonblock(int fd, void *buf, size_t sz, fd_set *rfds, size_t *num_bytes);
 int read_pattern(int fd, const char *pattern, size_t bufsize, fd_set *rfds);
-int write_nonblock(int fd, const char *buf, size_t len);
+int xwrite(int fd, const char *buf, size_t len);
 int for_each_file_in_dir(const char *dirname,
                int (*func)(const char *, void *), void *private_data);
 /**
index 1ce4587f3d2e165a64e3d40991bfadf5264b47c6..d11e94c7a902462e1aacbb407d98be66d8938772 100644 (file)
--- a/gcrypt.c
+++ b/gcrypt.c
@@ -951,7 +951,7 @@ int sc_send_bin_buffer(struct stream_cipher_context *scc, char *buf,
        gret = gcry_cipher_encrypt(scc->send->handle, tmp, size,
                (unsigned char *)buf, size);
        assert(gret == 0);
-       ret = write_nonblock(scc->fd, (char *)tmp, size);
+       ret = xwrite(scc->fd, (char *)tmp, size);
        free(tmp);
        return ret;
 }
index 5b0688fc90aa078632f1e9633c641a28bb5ad9d6..729c8193a90d7f21edefa6b83b4f35db169bbbc6 100644 (file)
@@ -76,7 +76,7 @@ static int gc_write(struct grab_client *gc, char *buf, size_t len)
                if (gc->mode == GM_SLOPPY)
                        return len;
        }
-       ret = write_nonblock(gc->fd, buf, len);
+       ret = xwrite(gc->fd, buf, len);
        if (ret < 0)
                goto err;
        if (ret > 0)
index c26572f024557fc4f206835a7e93f24cf59d0231..eddc0295f229a26c4e826d8656712c4609a35989 100644 (file)
@@ -125,7 +125,7 @@ static void http_send_chunk(struct sender_client *sc, struct sender_status *ss,
                ret = queue_chunk_or_shutdown(sc, ss, buf, len);
                goto out;
        }
-       ret = write_nonblock(sc->fd, buf, len);
+       ret = xwrite(sc->fd, buf, len);
        if (ret < 0) {
                shutdown_client(sc, ss);
                goto out;
index e17a7a106b7e6c813455251082cb59d650d36d1b..6a29bffae5a68e783d4a4d788239b24455c4cb1e 100644 (file)
@@ -292,7 +292,7 @@ static void i9e_post_select(struct sched *s, struct task *t)
        sz = btr_next_buffer(btrn, &buf);
        if (sz == 0)
                goto out;
-       ret = write_nonblock(ici->fds[1], buf, sz);
+       ret = xwrite(ici->fds[1], buf, sz);
        if (ret < 0)
                goto rm_btrn;
        btr_consume(btrn, ret);
index 85357f9379f01c70244754f3c717f23d78864231..f075ce502900e03e3fb743229e9f6ca7c735725e 100644 (file)
@@ -189,7 +189,7 @@ static void oss_post_select(__a_unused struct sched *s,
        ret = 0;
        if (!FD_ISSET(powd->fd, &s->wfds))
                goto out;
-       ret = write_nonblock(powd->fd, data, frames * powd->bytes_per_frame);
+       ret = xwrite(powd->fd, data, frames * powd->bytes_per_frame);
        if (ret < 0)
                goto out;
        btr_consume(btrn, ret);
index 71e0852a665d2222cf0ae8fa3b05856d1ab5db2e..354c9ed509deddc14f4528ce318e0d1ad90a8b7e 100644 (file)
@@ -113,7 +113,7 @@ int send_queued_chunks(int fd, struct chunk_queue *cq)
                int ret;
 
                cq_get(qc, &buf, &len);
-               ret = write_nonblock(fd, buf, len);
+               ret = xwrite(fd, buf, len);
                if (ret < 0)
                        return ret;
                cq_update(cq, ret);
index 0f0c0e539a06f584f4a26ed88c4beb8d1d7551ba..abe7abc98df759af034872be4d65ed9a30133207 100644 (file)
--- a/stdout.c
+++ b/stdout.c
@@ -68,7 +68,7 @@ static void stdout_post_select(struct sched *s, struct task *t)
                sz = btr_next_buffer(btrn, &buf);
                if (sz == 0)
                        break;
-               ret = write_nonblock(STDOUT_FILENO, buf, sz);
+               ret = xwrite(STDOUT_FILENO, buf, sz);
                if (ret <= 0)
                        break;
                btr_consume(btrn, ret);
index 1155bcb4f107da7a71ce869d5f381644b231a626..3e3950f90d232794df915e45c39d2e8ad031d44f 100644 (file)
@@ -288,7 +288,7 @@ static void udp_send_fec(struct sender_client *sc, char *buf, size_t len)
        ret = udp_check_socket_state(sc);
        if (ret < 0)
                goto fail;
-       ret = write_nonblock(sc->fd, buf, len);
+       ret = xwrite(sc->fd, buf, len);
        if (ret == -ERRNO_TO_PARA_ERROR(ECONNREFUSED)) {
                /*
                 * Happens if meanwhile an ICMP Destination / Port Unreachable