diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2011-01-19 10:58:16 -0500 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2011-08-29 05:30:26 -0400 |
commit | c012949a4084a9f91654121d28f199ef408cb9d7 (patch) | |
tree | 55a8a57d1b68749c55df2f1a9c222f3f5d2c9851 /drivers/block/drbd/drbd_int.h | |
parent | c6d25cfe52a32232e4de0bbe6ddf8219f054f55c (diff) |
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>
Diffstat (limited to 'drivers/block/drbd/drbd_int.h')
-rw-r--r-- | drivers/block/drbd/drbd_int.h | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index 526928c368c9..dc669dfe5b0d 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -338,7 +338,6 @@ struct p_header80 { | |||
338 | u32 magic; | 338 | u32 magic; |
339 | u16 command; | 339 | u16 command; |
340 | u16 length; /* bytes of data after this header */ | 340 | u16 length; /* bytes of data after this header */ |
341 | u8 payload[0]; | ||
342 | } __packed; | 341 | } __packed; |
343 | 342 | ||
344 | /* Header for big packets, Used for data packets exceeding 64kB */ | 343 | /* Header for big packets, Used for data packets exceeding 64kB */ |
@@ -349,9 +348,12 @@ struct p_header95 { | |||
349 | u8 payload[0]; | 348 | u8 payload[0]; |
350 | } __packed; | 349 | } __packed; |
351 | 350 | ||
352 | union p_header { | 351 | struct p_header { |
353 | struct p_header80 h80; | 352 | union { |
354 | struct p_header95 h95; | 353 | struct p_header80 h80; |
354 | struct p_header95 h95; | ||
355 | }; | ||
356 | u8 payload[0]; | ||
355 | }; | 357 | }; |
356 | 358 | ||
357 | /* | 359 | /* |
@@ -380,7 +382,7 @@ union p_header { | |||
380 | #define DP_DISCARD 64 /* equals REQ_DISCARD */ | 382 | #define DP_DISCARD 64 /* equals REQ_DISCARD */ |
381 | 383 | ||
382 | struct p_data { | 384 | struct p_data { |
383 | union p_header head; | 385 | struct p_header head; |
384 | u64 sector; /* 64 bits sector number */ | 386 | u64 sector; /* 64 bits sector number */ |
385 | u64 block_id; /* to identify the request in protocol B&C */ | 387 | u64 block_id; /* to identify the request in protocol B&C */ |
386 | u32 seq_num; | 388 | u32 seq_num; |
@@ -396,7 +398,7 @@ struct p_data { | |||
396 | * P_DATA_REQUEST, P_RS_DATA_REQUEST | 398 | * P_DATA_REQUEST, P_RS_DATA_REQUEST |
397 | */ | 399 | */ |
398 | struct p_block_ack { | 400 | struct p_block_ack { |
399 | struct p_header80 head; | 401 | struct p_header head; |
400 | u64 sector; | 402 | u64 sector; |
401 | u64 block_id; | 403 | u64 block_id; |
402 | u32 blksize; | 404 | u32 blksize; |
@@ -405,7 +407,7 @@ struct p_block_ack { | |||
405 | 407 | ||
406 | 408 | ||
407 | struct p_block_req { | 409 | struct p_block_req { |
408 | struct p_header80 head; | 410 | struct p_header head; |
409 | u64 sector; | 411 | u64 sector; |
410 | u64 block_id; | 412 | u64 block_id; |
411 | u32 blksize; | 413 | u32 blksize; |
@@ -422,7 +424,7 @@ struct p_block_req { | |||
422 | */ | 424 | */ |
423 | 425 | ||
424 | struct p_handshake { | 426 | struct p_handshake { |
425 | struct p_header80 head; /* 8 bytes */ | 427 | struct p_header head; /* Note: You must always use a h80 here */ |
426 | u32 protocol_min; | 428 | u32 protocol_min; |
427 | u32 feature_flags; | 429 | u32 feature_flags; |
428 | u32 protocol_max; | 430 | u32 protocol_max; |
@@ -437,19 +439,19 @@ struct p_handshake { | |||
437 | /* 80 bytes, FIXED for the next century */ | 439 | /* 80 bytes, FIXED for the next century */ |
438 | 440 | ||
439 | struct p_barrier { | 441 | struct p_barrier { |
440 | struct p_header80 head; | 442 | struct p_header head; |
441 | u32 barrier; /* barrier number _handle_ only */ | 443 | u32 barrier; /* barrier number _handle_ only */ |
442 | u32 pad; /* to multiple of 8 Byte */ | 444 | u32 pad; /* to multiple of 8 Byte */ |
443 | } __packed; | 445 | } __packed; |
444 | 446 | ||
445 | struct p_barrier_ack { | 447 | struct p_barrier_ack { |
446 | struct p_header80 head; | 448 | struct p_header head; |
447 | u32 barrier; | 449 | u32 barrier; |
448 | u32 set_size; | 450 | u32 set_size; |
449 | } __packed; | 451 | } __packed; |
450 | 452 | ||
451 | struct p_rs_param { | 453 | struct p_rs_param { |
452 | struct p_header80 head; | 454 | struct p_header head; |
453 | u32 rate; | 455 | u32 rate; |
454 | 456 | ||
455 | /* Since protocol version 88 and higher. */ | 457 | /* Since protocol version 88 and higher. */ |
@@ -457,7 +459,7 @@ struct p_rs_param { | |||
457 | } __packed; | 459 | } __packed; |
458 | 460 | ||
459 | struct p_rs_param_89 { | 461 | struct p_rs_param_89 { |
460 | struct p_header80 head; | 462 | struct p_header head; |
461 | u32 rate; | 463 | u32 rate; |
462 | /* protocol version 89: */ | 464 | /* protocol version 89: */ |
463 | char verify_alg[SHARED_SECRET_MAX]; | 465 | char verify_alg[SHARED_SECRET_MAX]; |
@@ -465,7 +467,7 @@ struct p_rs_param_89 { | |||
465 | } __packed; | 467 | } __packed; |
466 | 468 | ||
467 | struct p_rs_param_95 { | 469 | struct p_rs_param_95 { |
468 | struct p_header80 head; | 470 | struct p_header head; |
469 | u32 rate; | 471 | u32 rate; |
470 | char verify_alg[SHARED_SECRET_MAX]; | 472 | char verify_alg[SHARED_SECRET_MAX]; |
471 | char csums_alg[SHARED_SECRET_MAX]; | 473 | char csums_alg[SHARED_SECRET_MAX]; |
@@ -481,7 +483,7 @@ enum drbd_conn_flags { | |||
481 | }; | 483 | }; |
482 | 484 | ||
483 | struct p_protocol { | 485 | struct p_protocol { |
484 | struct p_header80 head; | 486 | struct p_header head; |
485 | u32 protocol; | 487 | u32 protocol; |
486 | u32 after_sb_0p; | 488 | u32 after_sb_0p; |
487 | u32 after_sb_1p; | 489 | u32 after_sb_1p; |
@@ -495,17 +497,17 @@ struct p_protocol { | |||
495 | } __packed; | 497 | } __packed; |
496 | 498 | ||
497 | struct p_uuids { | 499 | struct p_uuids { |
498 | struct p_header80 head; | 500 | struct p_header head; |
499 | u64 uuid[UI_EXTENDED_SIZE]; | 501 | u64 uuid[UI_EXTENDED_SIZE]; |
500 | } __packed; | 502 | } __packed; |
501 | 503 | ||
502 | struct p_rs_uuid { | 504 | struct p_rs_uuid { |
503 | struct p_header80 head; | 505 | struct p_header head; |
504 | u64 uuid; | 506 | u64 uuid; |
505 | } __packed; | 507 | } __packed; |
506 | 508 | ||
507 | struct p_sizes { | 509 | struct p_sizes { |
508 | struct p_header80 head; | 510 | struct p_header head; |
509 | u64 d_size; /* size of disk */ | 511 | u64 d_size; /* size of disk */ |
510 | u64 u_size; /* user requested size */ | 512 | u64 u_size; /* user requested size */ |
511 | u64 c_size; /* current exported size */ | 513 | u64 c_size; /* current exported size */ |
@@ -515,18 +517,18 @@ struct p_sizes { | |||
515 | } __packed; | 517 | } __packed; |
516 | 518 | ||
517 | struct p_state { | 519 | struct p_state { |
518 | struct p_header80 head; | 520 | struct p_header head; |
519 | u32 state; | 521 | u32 state; |
520 | } __packed; | 522 | } __packed; |
521 | 523 | ||
522 | struct p_req_state { | 524 | struct p_req_state { |
523 | struct p_header80 head; | 525 | struct p_header head; |
524 | u32 mask; | 526 | u32 mask; |
525 | u32 val; | 527 | u32 val; |
526 | } __packed; | 528 | } __packed; |
527 | 529 | ||
528 | struct p_req_state_reply { | 530 | struct p_req_state_reply { |
529 | struct p_header80 head; | 531 | struct p_header head; |
530 | u32 retcode; | 532 | u32 retcode; |
531 | } __packed; | 533 | } __packed; |
532 | 534 | ||
@@ -541,14 +543,14 @@ struct p_drbd06_param { | |||
541 | } __packed; | 543 | } __packed; |
542 | 544 | ||
543 | struct p_discard { | 545 | struct p_discard { |
544 | struct p_header80 head; | 546 | struct p_header head; |
545 | u64 block_id; | 547 | u64 block_id; |
546 | u32 seq_num; | 548 | u32 seq_num; |
547 | u32 pad; | 549 | u32 pad; |
548 | } __packed; | 550 | } __packed; |
549 | 551 | ||
550 | struct p_block_desc { | 552 | struct p_block_desc { |
551 | struct p_header80 head; | 553 | struct p_header head; |
552 | u64 sector; | 554 | u64 sector; |
553 | u32 blksize; | 555 | u32 blksize; |
554 | u32 pad; /* to multiple of 8 Byte */ | 556 | u32 pad; /* to multiple of 8 Byte */ |
@@ -564,7 +566,7 @@ enum drbd_bitmap_code { | |||
564 | }; | 566 | }; |
565 | 567 | ||
566 | struct p_compressed_bm { | 568 | struct p_compressed_bm { |
567 | struct p_header80 head; | 569 | struct p_header head; |
568 | /* (encoding & 0x0f): actual encoding, see enum drbd_bitmap_code | 570 | /* (encoding & 0x0f): actual encoding, see enum drbd_bitmap_code |
569 | * (encoding & 0x80): polarity (set/unset) of first runlength | 571 | * (encoding & 0x80): polarity (set/unset) of first runlength |
570 | * ((encoding >> 4) & 0x07): pad_bits, number of trailing zero bits | 572 | * ((encoding >> 4) & 0x07): pad_bits, number of trailing zero bits |
@@ -576,7 +578,7 @@ struct p_compressed_bm { | |||
576 | } __packed; | 578 | } __packed; |
577 | 579 | ||
578 | struct p_delay_probe93 { | 580 | struct p_delay_probe93 { |
579 | struct p_header80 head; | 581 | struct p_header head; |
580 | u32 seq_num; /* sequence number to match the two probe packets */ | 582 | u32 seq_num; /* sequence number to match the two probe packets */ |
581 | u32 offset; /* usecs the probe got sent after the reference time point */ | 583 | u32 offset; /* usecs the probe got sent after the reference time point */ |
582 | } __packed; | 584 | } __packed; |
@@ -625,7 +627,7 @@ DCBP_set_pad_bits(struct p_compressed_bm *p, int n) | |||
625 | * so we need to use the fixed size 4KiB page size | 627 | * so we need to use the fixed size 4KiB page size |
626 | * most architectures have used for a long time. | 628 | * most architectures have used for a long time. |
627 | */ | 629 | */ |
628 | #define BM_PACKET_PAYLOAD_BYTES (4096 - sizeof(struct p_header80)) | 630 | #define BM_PACKET_PAYLOAD_BYTES (4096 - sizeof(struct p_header)) |
629 | #define BM_PACKET_WORDS (BM_PACKET_PAYLOAD_BYTES/sizeof(long)) | 631 | #define BM_PACKET_WORDS (BM_PACKET_PAYLOAD_BYTES/sizeof(long)) |
630 | #define BM_PACKET_VLI_BYTES_MAX (4096 - sizeof(struct p_compressed_bm)) | 632 | #define BM_PACKET_VLI_BYTES_MAX (4096 - sizeof(struct p_compressed_bm)) |
631 | #if (PAGE_SIZE < 4096) | 633 | #if (PAGE_SIZE < 4096) |
@@ -634,7 +636,7 @@ DCBP_set_pad_bits(struct p_compressed_bm *p, int n) | |||
634 | #endif | 636 | #endif |
635 | 637 | ||
636 | union p_polymorph { | 638 | union p_polymorph { |
637 | union p_header header; | 639 | struct p_header header; |
638 | struct p_handshake handshake; | 640 | struct p_handshake handshake; |
639 | struct p_data data; | 641 | struct p_data data; |
640 | struct p_block_ack block_ack; | 642 | struct p_block_ack block_ack; |
@@ -1245,12 +1247,12 @@ extern int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply, enum dds_f | |||
1245 | extern int _drbd_send_state(struct drbd_conf *mdev); | 1247 | extern int _drbd_send_state(struct drbd_conf *mdev); |
1246 | extern int drbd_send_state(struct drbd_conf *mdev); | 1248 | extern int drbd_send_state(struct drbd_conf *mdev); |
1247 | extern int _drbd_send_cmd(struct drbd_conf *mdev, struct socket *sock, | 1249 | extern int _drbd_send_cmd(struct drbd_conf *mdev, struct socket *sock, |
1248 | enum drbd_packets cmd, struct p_header80 *h, | 1250 | enum drbd_packets cmd, struct p_header *h, |
1249 | size_t size, unsigned msg_flags); | 1251 | size_t size, unsigned msg_flags); |
1250 | #define USE_DATA_SOCKET 1 | 1252 | #define USE_DATA_SOCKET 1 |
1251 | #define USE_META_SOCKET 0 | 1253 | #define USE_META_SOCKET 0 |
1252 | extern int drbd_send_cmd(struct drbd_conf *mdev, int use_data_socket, | 1254 | extern int drbd_send_cmd(struct drbd_conf *mdev, int use_data_socket, |
1253 | enum drbd_packets cmd, struct p_header80 *h, | 1255 | enum drbd_packets cmd, struct p_header *h, |
1254 | size_t size); | 1256 | size_t size); |
1255 | extern int drbd_send_cmd2(struct drbd_conf *mdev, enum drbd_packets cmd, | 1257 | extern int drbd_send_cmd2(struct drbd_conf *mdev, enum drbd_packets cmd, |
1256 | char *data, size_t size); | 1258 | char *data, size_t size); |
@@ -2019,19 +2021,19 @@ static inline void request_ping(struct drbd_conf *mdev) | |||
2019 | static inline int drbd_send_short_cmd(struct drbd_conf *mdev, | 2021 | static inline int drbd_send_short_cmd(struct drbd_conf *mdev, |
2020 | enum drbd_packets cmd) | 2022 | enum drbd_packets cmd) |
2021 | { | 2023 | { |
2022 | struct p_header80 h; | 2024 | struct p_header h; |
2023 | return drbd_send_cmd(mdev, USE_DATA_SOCKET, cmd, &h, sizeof(h)); | 2025 | return drbd_send_cmd(mdev, USE_DATA_SOCKET, cmd, &h, sizeof(h)); |
2024 | } | 2026 | } |
2025 | 2027 | ||
2026 | static inline int drbd_send_ping(struct drbd_conf *mdev) | 2028 | static inline int drbd_send_ping(struct drbd_conf *mdev) |
2027 | { | 2029 | { |
2028 | struct p_header80 h; | 2030 | struct p_header h; |
2029 | return drbd_send_cmd(mdev, USE_META_SOCKET, P_PING, &h, sizeof(h)); | 2031 | return drbd_send_cmd(mdev, USE_META_SOCKET, P_PING, &h, sizeof(h)); |
2030 | } | 2032 | } |
2031 | 2033 | ||
2032 | static inline int drbd_send_ping_ack(struct drbd_conf *mdev) | 2034 | static inline int drbd_send_ping_ack(struct drbd_conf *mdev) |
2033 | { | 2035 | { |
2034 | struct p_header80 h; | 2036 | struct p_header h; |
2035 | return drbd_send_cmd(mdev, USE_META_SOCKET, P_PING_ACK, &h, sizeof(h)); | 2037 | return drbd_send_cmd(mdev, USE_META_SOCKET, P_PING_ACK, &h, sizeof(h)); |
2036 | } | 2038 | } |
2037 | 2039 | ||