drbd: Add drbd_recv_all(): Receive an entire buffer

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
This commit is contained in:
Andreas Gruenbacher 2011-03-17 17:15:20 +01:00 committed by Philipp Reisner
parent a982dd579c
commit c696774691
1 changed files with 13 additions and 0 deletions

View File

@ -565,6 +565,19 @@ static int drbd_recv(struct drbd_tconn *tconn, void *buf, size_t size)
return rv;
}
static int drbd_recv_all(struct drbd_tconn *tconn, void *buf, size_t size)
{
int err;
err = drbd_recv(tconn, buf, size);
if (err != size) {
if (err >= 0)
err = -EIO;
} else
err = 0;
return err;
}
/* quoting tcp(7):
* On individual connections, the socket buffer size must be set prior to the
* listen(2) or connect(2) calls in order to have it take effect.