drbd: Replaced all p_header80 with a generic p_header
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_main.c b/drivers/block/drbd/drbd_main.c
index 699f639..55ce48e 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -1822,9 +1822,10 @@
/* the appropriate socket mutex must be held already */
int _drbd_send_cmd(struct drbd_conf *mdev, struct socket *sock,
- enum drbd_packets cmd, struct p_header80 *h,
+ enum drbd_packets cmd, struct p_header *hg,
size_t size, unsigned msg_flags)
{
+ struct p_header80 *h = (struct p_header80 *)hg;
int sent, ok;
if (!expect(h))
@@ -1849,7 +1850,7 @@
* when we hold the appropriate socket mutex.
*/
int drbd_send_cmd(struct drbd_conf *mdev, int use_data_socket,
- enum drbd_packets cmd, struct p_header80 *h, size_t size)
+ enum drbd_packets cmd, struct p_header *h, size_t size)
{
int ok = 0;
struct socket *sock;
@@ -1983,8 +1984,7 @@
if (mdev->tconn->agreed_pro_version >= 87)
strcpy(p->integrity_alg, mdev->tconn->net_conf->integrity_alg);
- rv = drbd_send_cmd(mdev, USE_DATA_SOCKET, P_PROTOCOL,
- (struct p_header80 *)p, size);
+ rv = drbd_send_cmd(mdev, USE_DATA_SOCKET, P_PROTOCOL, &p->head, size);
kfree(p);
return rv;
}
@@ -2009,8 +2009,7 @@
put_ldev(mdev);
- return drbd_send_cmd(mdev, USE_DATA_SOCKET, P_UUIDS,
- (struct p_header80 *)&p, sizeof(p));
+ return drbd_send_cmd(mdev, USE_DATA_SOCKET, P_UUIDS, &p.head, sizeof(p));
}
int drbd_send_uuids(struct drbd_conf *mdev)
@@ -2054,8 +2053,7 @@
drbd_md_sync(mdev);
p.uuid = cpu_to_be64(uuid);
- return drbd_send_cmd(mdev, USE_DATA_SOCKET, P_SYNC_UUID,
- (struct p_header80 *)&p, sizeof(p));
+ return drbd_send_cmd(mdev, USE_DATA_SOCKET, P_SYNC_UUID, &p.head, sizeof(p));
}
int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply, enum dds_flags flags)
@@ -2087,8 +2085,7 @@
p.queue_order_type = cpu_to_be16(q_order_type);
p.dds_flags = cpu_to_be16(flags);
- ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, P_SIZES,
- (struct p_header80 *)&p, sizeof(p));
+ ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, P_SIZES, &p.head, sizeof(p));
return ok;
}
@@ -2112,8 +2109,7 @@
sock = mdev->tconn->data.socket;
if (likely(sock != NULL)) {
- ok = _drbd_send_cmd(mdev, sock, P_STATE,
- (struct p_header80 *)&p, sizeof(p), 0);
+ ok = _drbd_send_cmd(mdev, sock, P_STATE, &p.head, sizeof(p), 0);
}
mutex_unlock(&mdev->tconn->data.mutex);
@@ -2130,8 +2126,7 @@
p.mask = cpu_to_be32(mask.i);
p.val = cpu_to_be32(val.i);
- return drbd_send_cmd(mdev, USE_DATA_SOCKET, P_STATE_CHG_REQ,
- (struct p_header80 *)&p, sizeof(p));
+ return drbd_send_cmd(mdev, USE_DATA_SOCKET, P_STATE_CHG_REQ, &p.head, sizeof(p));
}
int drbd_send_sr_reply(struct drbd_conf *mdev, enum drbd_state_rv retcode)
@@ -2140,8 +2135,7 @@
p.retcode = cpu_to_be32(retcode);
- return drbd_send_cmd(mdev, USE_META_SOCKET, P_STATE_CHG_REPLY,
- (struct p_header80 *)&p, sizeof(p));
+ return drbd_send_cmd(mdev, USE_META_SOCKET, P_STATE_CHG_REPLY, &p.head, sizeof(p));
}
int fill_bitmap_rle_bits(struct drbd_conf *mdev,
@@ -2246,7 +2240,7 @@
*/
static int
send_bitmap_rle_or_plain(struct drbd_conf *mdev,
- struct p_header80 *h, struct bm_xfer_ctx *c)
+ struct p_header *h, struct bm_xfer_ctx *c)
{
struct p_compressed_bm *p = (void*)h;
unsigned long num_words;
@@ -2300,7 +2294,7 @@
int _drbd_send_bitmap(struct drbd_conf *mdev)
{
struct bm_xfer_ctx c;
- struct p_header80 *p;
+ struct p_header *p;
int err;
if (!expect(mdev->bitmap))
@@ -2308,7 +2302,7 @@
/* maybe we should use some per thread scratch page,
* and allocate that during initial device creation? */
- p = (struct p_header80 *) __get_free_page(GFP_NOIO);
+ p = (struct p_header *) __get_free_page(GFP_NOIO);
if (!p) {
dev_err(DEV, "failed to allocate one page buffer in %s\n", __func__);
return false;
@@ -2365,8 +2359,7 @@
if (mdev->state.conn < C_CONNECTED)
return false;
- ok = drbd_send_cmd(mdev, USE_META_SOCKET, P_BARRIER_ACK,
- (struct p_header80 *)&p, sizeof(p));
+ ok = drbd_send_cmd(mdev, USE_META_SOCKET, P_BARRIER_ACK, &p.head, sizeof(p));
return ok;
}
@@ -2393,8 +2386,7 @@
if (!mdev->tconn->meta.socket || mdev->state.conn < C_CONNECTED)
return false;
- ok = drbd_send_cmd(mdev, USE_META_SOCKET, cmd,
- (struct p_header80 *)&p, sizeof(p));
+ ok = drbd_send_cmd(mdev, USE_META_SOCKET, cmd, &p.head, sizeof(p));
return ok;
}
@@ -2452,8 +2444,7 @@
p.block_id = block_id;
p.blksize = cpu_to_be32(size);
- ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, cmd,
- (struct p_header80 *)&p, sizeof(p));
+ ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, cmd, &p.head, sizeof(p));
return ok;
}
@@ -2469,9 +2460,9 @@
p.block_id = ID_SYNCER /* unused */;
p.blksize = cpu_to_be32(size);
- p.head.magic = cpu_to_be32(DRBD_MAGIC);
- p.head.command = cpu_to_be16(cmd);
- p.head.length = cpu_to_be16(sizeof(p) - sizeof(struct p_header80) + digest_size);
+ p.head.h80.magic = cpu_to_be32(DRBD_MAGIC);
+ p.head.h80.command = cpu_to_be16(cmd);
+ p.head.h80.length = cpu_to_be16(sizeof(p) - sizeof(struct p_header80) + digest_size);
mutex_lock(&mdev->tconn->data.mutex);
@@ -2492,8 +2483,7 @@
p.block_id = ID_SYNCER /* unused */;
p.blksize = cpu_to_be32(size);
- ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, P_OV_REQUEST,
- (struct p_header80 *)&p, sizeof(p));
+ ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, P_OV_REQUEST, &p.head, sizeof(p));
return ok;
}
@@ -2677,12 +2667,12 @@
p.head.h80.magic = cpu_to_be32(DRBD_MAGIC);
p.head.h80.command = cpu_to_be16(P_DATA);
p.head.h80.length =
- cpu_to_be16(sizeof(p) - sizeof(union p_header) + dgs + req->i.size);
+ cpu_to_be16(sizeof(p) - sizeof(struct p_header) + dgs + req->i.size);
} else {
p.head.h95.magic = cpu_to_be16(DRBD_MAGIC_BIG);
p.head.h95.command = cpu_to_be16(P_DATA);
p.head.h95.length =
- cpu_to_be32(sizeof(p) - sizeof(union p_header) + dgs + req->i.size);
+ cpu_to_be32(sizeof(p) - sizeof(struct p_header) + dgs + req->i.size);
}
p.sector = cpu_to_be64(req->i.sector);