diff options
author | Andreas Gruenbacher <agruen@linbit.com> | 2010-12-15 11:04:36 -0500 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-08 10:44:30 -0500 |
commit | fb708e408f0d75953114be66bdbeb9065ca09a33 (patch) | |
tree | fe2fca0495a231f3658a5dc0eac19b6541479b8c /drivers/block/drbd | |
parent | 11b0be28e57fabeb75edfe81a17eddfc484cd9df (diff) |
drbd: Add drbd_send_all(): Send 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')
-rw-r--r-- | drivers/block/drbd/drbd_int.h | 3 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 18 |
2 files changed, 21 insertions, 0 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index daa4a74da102..0bd8c2a800c2 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -1161,6 +1161,9 @@ extern void _tl_add_barrier(struct drbd_tconn *, struct drbd_tl_epoch *); | |||
1161 | extern void drbd_free_sock(struct drbd_tconn *tconn); | 1161 | extern void drbd_free_sock(struct drbd_tconn *tconn); |
1162 | extern int drbd_send(struct drbd_tconn *tconn, struct socket *sock, | 1162 | extern int drbd_send(struct drbd_tconn *tconn, struct socket *sock, |
1163 | void *buf, size_t size, unsigned msg_flags); | 1163 | void *buf, size_t size, unsigned msg_flags); |
1164 | extern int drbd_send_all(struct drbd_tconn *, struct socket *, void *, size_t, | ||
1165 | unsigned); | ||
1166 | |||
1164 | extern int drbd_send_protocol(struct drbd_tconn *tconn); | 1167 | extern int drbd_send_protocol(struct drbd_tconn *tconn); |
1165 | extern int drbd_send_uuids(struct drbd_conf *mdev); | 1168 | extern int drbd_send_uuids(struct drbd_conf *mdev); |
1166 | extern int drbd_send_uuids_skip_initial_sync(struct drbd_conf *mdev); | 1169 | extern int drbd_send_uuids_skip_initial_sync(struct drbd_conf *mdev); |
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index d4546d038246..7f2afb8115ce 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -1764,6 +1764,24 @@ int drbd_send(struct drbd_tconn *tconn, struct socket *sock, | |||
1764 | return sent; | 1764 | return sent; |
1765 | } | 1765 | } |
1766 | 1766 | ||
1767 | /** | ||
1768 | * drbd_send_all - Send an entire buffer | ||
1769 | * | ||
1770 | * Returns 0 upon success and a negative error value otherwise. | ||
1771 | */ | ||
1772 | int drbd_send_all(struct drbd_tconn *tconn, struct socket *sock, void *buffer, | ||
1773 | size_t size, unsigned msg_flags) | ||
1774 | { | ||
1775 | int err; | ||
1776 | |||
1777 | err = drbd_send(tconn, sock, buffer, size, msg_flags); | ||
1778 | if (err < 0) | ||
1779 | return err; | ||
1780 | if (err != size) | ||
1781 | return -EIO; | ||
1782 | return 0; | ||
1783 | } | ||
1784 | |||
1767 | static int drbd_open(struct block_device *bdev, fmode_t mode) | 1785 | static int drbd_open(struct block_device *bdev, fmode_t mode) |
1768 | { | 1786 | { |
1769 | struct drbd_conf *mdev = bdev->bd_disk->private_data; | 1787 | struct drbd_conf *mdev = bdev->bd_disk->private_data; |