Commit fb708e40 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Philipp Reisner

drbd: Add drbd_send_all(): Send an entire buffer

Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent 11b0be28
...@@ -1161,6 +1161,9 @@ extern void _tl_add_barrier(struct drbd_tconn *, struct drbd_tl_epoch *); ...@@ -1161,6 +1161,9 @@ extern void _tl_add_barrier(struct drbd_tconn *, struct drbd_tl_epoch *);
extern void drbd_free_sock(struct drbd_tconn *tconn); extern void drbd_free_sock(struct drbd_tconn *tconn);
extern int drbd_send(struct drbd_tconn *tconn, struct socket *sock, extern int drbd_send(struct drbd_tconn *tconn, struct socket *sock,
void *buf, size_t size, unsigned msg_flags); void *buf, size_t size, unsigned msg_flags);
extern int drbd_send_all(struct drbd_tconn *, struct socket *, void *, size_t,
unsigned);
extern int drbd_send_protocol(struct drbd_tconn *tconn); extern int drbd_send_protocol(struct drbd_tconn *tconn);
extern int drbd_send_uuids(struct drbd_conf *mdev); extern int drbd_send_uuids(struct drbd_conf *mdev);
extern int drbd_send_uuids_skip_initial_sync(struct drbd_conf *mdev); extern int drbd_send_uuids_skip_initial_sync(struct drbd_conf *mdev);
......
...@@ -1764,6 +1764,24 @@ int drbd_send(struct drbd_tconn *tconn, struct socket *sock, ...@@ -1764,6 +1764,24 @@ int drbd_send(struct drbd_tconn *tconn, struct socket *sock,
return sent; return sent;
} }
/**
* drbd_send_all - Send an entire buffer
*
* Returns 0 upon success and a negative error value otherwise.
*/
int drbd_send_all(struct drbd_tconn *tconn, struct socket *sock, void *buffer,
size_t size, unsigned msg_flags)
{
int err;
err = drbd_send(tconn, sock, buffer, size, msg_flags);
if (err < 0)
return err;
if (err != size)
return -EIO;
return 0;
}
static int drbd_open(struct block_device *bdev, fmode_t mode) static int drbd_open(struct block_device *bdev, fmode_t mode)
{ {
struct drbd_conf *mdev = bdev->bd_disk->private_data; struct drbd_conf *mdev = bdev->bd_disk->private_data;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment