From: Andreas Gruenbacher Date: Thu, 17 Mar 2011 16:15:20 +0000 (+0100) Subject: drbd: Add drbd_recv_all(): Receive an entire buffer X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c696774691c9f9ec238fe3b1892f78796a985852;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git drbd: Add drbd_recv_all(): Receive an entire buffer Signed-off-by: Philipp Reisner Signed-off-by: Lars Ellenberg --- diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 28980145b92c..880634264e96 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -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.