diff options
author | Andreas Gruenbacher <agruen@linbit.com> | 2011-03-17 17:15:20 +0100 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-08 16:44:47 +0100 |
commit | c696774691c9f9ec238fe3b1892f78796a985852 (patch) | |
tree | 4ea24652feeecdb4019d0a445c81cb8ae80db6b7 /drivers/block/drbd/drbd_receiver.c | |
parent | a982dd579cbc99f7c4b81e68b9c99f7a6481f45b (diff) | |
download | lwn-c696774691c9f9ec238fe3b1892f78796a985852.tar.gz lwn-c696774691c9f9ec238fe3b1892f78796a985852.zip |
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>
Diffstat (limited to 'drivers/block/drbd/drbd_receiver.c')
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 13 |
1 files changed, 13 insertions, 0 deletions
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. |