drbd: Introduce drbd_header_size()
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 61104db..e52a929 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -995,7 +995,7 @@
struct p_header *h = tconn->data.rbuf;
int err;
- err = drbd_recv_all_warn(tconn, h, sizeof(*h));
+ err = drbd_recv_all_warn(tconn, h, drbd_header_size(tconn));
if (err)
return err;
@@ -4842,7 +4842,8 @@
int rv;
void *buf = h;
int received = 0;
- int expect = sizeof(struct p_header);
+ unsigned int header_size = drbd_header_size(tconn);
+ int expect = header_size;
int ping_timeout_active = 0;
current->policy = SCHED_RR; /* Make this a realtime task! */
@@ -4926,7 +4927,7 @@
goto disconnect;
}
expect = cmd->pkt_size;
- if (pi.size != expect - sizeof(struct p_header)) {
+ if (pi.size != expect - header_size) {
conn_err(tconn, "Wrong packet size on meta (c: %d, l: %d)\n",
pi.cmd, pi.size);
goto reconnect;
@@ -4950,7 +4951,7 @@
buf = h;
received = 0;
- expect = sizeof(struct p_header);
+ expect = header_size;
cmd = NULL;
}
}