diff options
author | Andreas Gruenbacher <agruen@linbit.com> | 2012-07-11 14:36:03 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-08 10:58:30 -0500 |
commit | 26ec92871be1e6bd48d0be9ab38ee1ebbeea49f1 (patch) | |
tree | b6fa9987833a838778b37209bf21b9a4ee4f76c6 | |
parent | 7e0f096b8d3ffcf04955c239e80993ec451c9a1a (diff) |
drbd: Stop using NLA_PUT*().
These macros no longer exist in kernel version v3.5-rc1.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
-rw-r--r-- | drivers/block/drbd/drbd_nl.c | 54 | ||||
-rw-r--r-- | include/linux/genl_magic_func.h | 8 | ||||
-rw-r--r-- | include/linux/genl_magic_struct.h | 16 |
3 files changed, 45 insertions, 33 deletions
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index cbd45de533cb..dc5bd6bbb280 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c | |||
@@ -2554,13 +2554,17 @@ int nla_put_drbd_cfg_context(struct sk_buff *skb, struct drbd_tconn *tconn, unsi | |||
2554 | nla = nla_nest_start(skb, DRBD_NLA_CFG_CONTEXT); | 2554 | nla = nla_nest_start(skb, DRBD_NLA_CFG_CONTEXT); |
2555 | if (!nla) | 2555 | if (!nla) |
2556 | goto nla_put_failure; | 2556 | goto nla_put_failure; |
2557 | if (vnr != VOLUME_UNSPECIFIED) | 2557 | if (vnr != VOLUME_UNSPECIFIED && |
2558 | NLA_PUT_U32(skb, T_ctx_volume, vnr); | 2558 | nla_put_u32(skb, T_ctx_volume, vnr)) |
2559 | NLA_PUT_STRING(skb, T_ctx_resource_name, tconn->name); | 2559 | goto nla_put_failure; |
2560 | if (tconn->my_addr_len) | 2560 | if (nla_put_string(skb, T_ctx_resource_name, tconn->name)) |
2561 | NLA_PUT(skb, T_ctx_my_addr, tconn->my_addr_len, &tconn->my_addr); | 2561 | goto nla_put_failure; |
2562 | if (tconn->peer_addr_len) | 2562 | if (tconn->my_addr_len && |
2563 | NLA_PUT(skb, T_ctx_peer_addr, tconn->peer_addr_len, &tconn->peer_addr); | 2563 | nla_put(skb, T_ctx_my_addr, tconn->my_addr_len, &tconn->my_addr)) |
2564 | goto nla_put_failure; | ||
2565 | if (tconn->peer_addr_len && | ||
2566 | nla_put(skb, T_ctx_peer_addr, tconn->peer_addr_len, &tconn->peer_addr)) | ||
2567 | goto nla_put_failure; | ||
2564 | nla_nest_end(skb, nla); | 2568 | nla_nest_end(skb, nla); |
2565 | return 0; | 2569 | return 0; |
2566 | 2570 | ||
@@ -2618,20 +2622,23 @@ int nla_put_status_info(struct sk_buff *skb, struct drbd_conf *mdev, | |||
2618 | nla = nla_nest_start(skb, DRBD_NLA_STATE_INFO); | 2622 | nla = nla_nest_start(skb, DRBD_NLA_STATE_INFO); |
2619 | if (!nla) | 2623 | if (!nla) |
2620 | goto nla_put_failure; | 2624 | goto nla_put_failure; |
2621 | NLA_PUT_U32(skb, T_sib_reason, sib ? sib->sib_reason : SIB_GET_STATUS_REPLY); | 2625 | if (nla_put_u32(skb, T_sib_reason, sib ? sib->sib_reason : SIB_GET_STATUS_REPLY) || |
2622 | NLA_PUT_U32(skb, T_current_state, mdev->state.i); | 2626 | nla_put_u32(skb, T_current_state, mdev->state.i) || |
2623 | NLA_PUT_U64(skb, T_ed_uuid, mdev->ed_uuid); | 2627 | nla_put_u64(skb, T_ed_uuid, mdev->ed_uuid) || |
2624 | NLA_PUT_U64(skb, T_capacity, drbd_get_capacity(mdev->this_bdev)); | 2628 | nla_put_u64(skb, T_capacity, drbd_get_capacity(mdev->this_bdev))) |
2629 | goto nla_put_failure; | ||
2625 | 2630 | ||
2626 | if (got_ldev) { | 2631 | if (got_ldev) { |
2627 | NLA_PUT_U32(skb, T_disk_flags, mdev->ldev->md.flags); | 2632 | if (nla_put_u32(skb, T_disk_flags, mdev->ldev->md.flags) || |
2628 | NLA_PUT(skb, T_uuids, sizeof(si->uuids), mdev->ldev->md.uuid); | 2633 | nla_put(skb, T_uuids, sizeof(si->uuids), mdev->ldev->md.uuid) || |
2629 | NLA_PUT_U64(skb, T_bits_total, drbd_bm_bits(mdev)); | 2634 | nla_put_u64(skb, T_bits_total, drbd_bm_bits(mdev)) || |
2630 | NLA_PUT_U64(skb, T_bits_oos, drbd_bm_total_weight(mdev)); | 2635 | nla_put_u64(skb, T_bits_oos, drbd_bm_total_weight(mdev))) |
2636 | goto nla_put_failure; | ||
2631 | if (C_SYNC_SOURCE <= mdev->state.conn && | 2637 | if (C_SYNC_SOURCE <= mdev->state.conn && |
2632 | C_PAUSED_SYNC_T >= mdev->state.conn) { | 2638 | C_PAUSED_SYNC_T >= mdev->state.conn) { |
2633 | NLA_PUT_U64(skb, T_bits_rs_total, mdev->rs_total); | 2639 | if (nla_put_u64(skb, T_bits_rs_total, mdev->rs_total) || |
2634 | NLA_PUT_U64(skb, T_bits_rs_failed, mdev->rs_failed); | 2640 | nla_put_u64(skb, T_bits_rs_failed, mdev->rs_failed)) |
2641 | goto nla_put_failure; | ||
2635 | } | 2642 | } |
2636 | } | 2643 | } |
2637 | 2644 | ||
@@ -2641,15 +2648,18 @@ int nla_put_status_info(struct sk_buff *skb, struct drbd_conf *mdev, | |||
2641 | case SIB_GET_STATUS_REPLY: | 2648 | case SIB_GET_STATUS_REPLY: |
2642 | break; | 2649 | break; |
2643 | case SIB_STATE_CHANGE: | 2650 | case SIB_STATE_CHANGE: |
2644 | NLA_PUT_U32(skb, T_prev_state, sib->os.i); | 2651 | if (nla_put_u32(skb, T_prev_state, sib->os.i) || |
2645 | NLA_PUT_U32(skb, T_new_state, sib->ns.i); | 2652 | nla_put_u32(skb, T_new_state, sib->ns.i)) |
2653 | goto nla_put_failure; | ||
2646 | break; | 2654 | break; |
2647 | case SIB_HELPER_POST: | 2655 | case SIB_HELPER_POST: |
2648 | NLA_PUT_U32(skb, | 2656 | if (nla_put_u32(skb, T_helper_exit_code, |
2649 | T_helper_exit_code, sib->helper_exit_code); | 2657 | sib->helper_exit_code)) |
2658 | goto nla_put_failure; | ||
2650 | /* fall through */ | 2659 | /* fall through */ |
2651 | case SIB_HELPER_PRE: | 2660 | case SIB_HELPER_PRE: |
2652 | NLA_PUT_STRING(skb, T_helper, sib->helper_name); | 2661 | if (nla_put_string(skb, T_helper, sib->helper_name)) |
2662 | goto nla_put_failure; | ||
2653 | break; | 2663 | break; |
2654 | } | 2664 | } |
2655 | } | 2665 | } |
diff --git a/include/linux/genl_magic_func.h b/include/linux/genl_magic_func.h index 0b8a88e2e83e..023bc346b877 100644 --- a/include/linux/genl_magic_func.h +++ b/include/linux/genl_magic_func.h | |||
@@ -367,7 +367,8 @@ static inline int s_name ## _to_unpriv_skb(struct sk_buff *skb, \ | |||
367 | __is_signed) \ | 367 | __is_signed) \ |
368 | if (!exclude_sensitive || !((attr_flag) & DRBD_F_SENSITIVE)) { \ | 368 | if (!exclude_sensitive || !((attr_flag) & DRBD_F_SENSITIVE)) { \ |
369 | DPRINT_FIELD(">>", nla_type, name, s, NULL); \ | 369 | DPRINT_FIELD(">>", nla_type, name, s, NULL); \ |
370 | __put(skb, attr_nr, s->name); \ | 370 | if (__put(skb, attr_nr, s->name)) \ |
371 | goto nla_put_failure; \ | ||
371 | } | 372 | } |
372 | 373 | ||
373 | #undef __array | 374 | #undef __array |
@@ -375,9 +376,10 @@ static inline int s_name ## _to_unpriv_skb(struct sk_buff *skb, \ | |||
375 | __get, __put, __is_signed) \ | 376 | __get, __put, __is_signed) \ |
376 | if (!exclude_sensitive || !((attr_flag) & DRBD_F_SENSITIVE)) { \ | 377 | if (!exclude_sensitive || !((attr_flag) & DRBD_F_SENSITIVE)) { \ |
377 | DPRINT_ARRAY(">>",nla_type, name, s, NULL); \ | 378 | DPRINT_ARRAY(">>",nla_type, name, s, NULL); \ |
378 | __put(skb, attr_nr, min_t(int, maxlen, \ | 379 | if (__put(skb, attr_nr, min_t(int, maxlen, \ |
379 | s->name ## _len + (nla_type == NLA_NUL_STRING)),\ | 380 | s->name ## _len + (nla_type == NLA_NUL_STRING)),\ |
380 | s->name); \ | 381 | s->name)) \ |
382 | goto nla_put_failure; \ | ||
381 | } | 383 | } |
382 | 384 | ||
383 | #include GENL_MAGIC_INCLUDE_FILE | 385 | #include GENL_MAGIC_INCLUDE_FILE |
diff --git a/include/linux/genl_magic_struct.h b/include/linux/genl_magic_struct.h index 1d0bd79e27b3..eecd19b37001 100644 --- a/include/linux/genl_magic_struct.h +++ b/include/linux/genl_magic_struct.h | |||
@@ -65,28 +65,28 @@ extern void CONCAT_(GENL_MAGIC_FAMILY, _genl_unregister)(void); | |||
65 | /* possible field types */ | 65 | /* possible field types */ |
66 | #define __flg_field(attr_nr, attr_flag, name) \ | 66 | #define __flg_field(attr_nr, attr_flag, name) \ |
67 | __field(attr_nr, attr_flag, name, NLA_U8, char, \ | 67 | __field(attr_nr, attr_flag, name, NLA_U8, char, \ |
68 | nla_get_u8, NLA_PUT_U8, false) | 68 | nla_get_u8, nla_put_u8, false) |
69 | #define __u8_field(attr_nr, attr_flag, name) \ | 69 | #define __u8_field(attr_nr, attr_flag, name) \ |
70 | __field(attr_nr, attr_flag, name, NLA_U8, unsigned char, \ | 70 | __field(attr_nr, attr_flag, name, NLA_U8, unsigned char, \ |
71 | nla_get_u8, NLA_PUT_U8, false) | 71 | nla_get_u8, nla_put_u8, false) |
72 | #define __u16_field(attr_nr, attr_flag, name) \ | 72 | #define __u16_field(attr_nr, attr_flag, name) \ |
73 | __field(attr_nr, attr_flag, name, NLA_U16, __u16, \ | 73 | __field(attr_nr, attr_flag, name, NLA_U16, __u16, \ |
74 | nla_get_u16, NLA_PUT_U16, false) | 74 | nla_get_u16, nla_put_u16, false) |
75 | #define __u32_field(attr_nr, attr_flag, name) \ | 75 | #define __u32_field(attr_nr, attr_flag, name) \ |
76 | __field(attr_nr, attr_flag, name, NLA_U32, __u32, \ | 76 | __field(attr_nr, attr_flag, name, NLA_U32, __u32, \ |
77 | nla_get_u32, NLA_PUT_U32, false) | 77 | nla_get_u32, nla_put_u32, false) |
78 | #define __s32_field(attr_nr, attr_flag, name) \ | 78 | #define __s32_field(attr_nr, attr_flag, name) \ |
79 | __field(attr_nr, attr_flag, name, NLA_U32, __s32, \ | 79 | __field(attr_nr, attr_flag, name, NLA_U32, __s32, \ |
80 | nla_get_u32, NLA_PUT_U32, true) | 80 | nla_get_u32, nla_put_u32, true) |
81 | #define __u64_field(attr_nr, attr_flag, name) \ | 81 | #define __u64_field(attr_nr, attr_flag, name) \ |
82 | __field(attr_nr, attr_flag, name, NLA_U64, __u64, \ | 82 | __field(attr_nr, attr_flag, name, NLA_U64, __u64, \ |
83 | nla_get_u64, NLA_PUT_U64, false) | 83 | nla_get_u64, nla_put_u64, false) |
84 | #define __str_field(attr_nr, attr_flag, name, maxlen) \ | 84 | #define __str_field(attr_nr, attr_flag, name, maxlen) \ |
85 | __array(attr_nr, attr_flag, name, NLA_NUL_STRING, char, maxlen, \ | 85 | __array(attr_nr, attr_flag, name, NLA_NUL_STRING, char, maxlen, \ |
86 | nla_strlcpy, NLA_PUT, false) | 86 | nla_strlcpy, nla_put, false) |
87 | #define __bin_field(attr_nr, attr_flag, name, maxlen) \ | 87 | #define __bin_field(attr_nr, attr_flag, name, maxlen) \ |
88 | __array(attr_nr, attr_flag, name, NLA_BINARY, char, maxlen, \ | 88 | __array(attr_nr, attr_flag, name, NLA_BINARY, char, maxlen, \ |
89 | nla_memcpy, NLA_PUT, false) | 89 | nla_memcpy, nla_put, false) |
90 | 90 | ||
91 | /* fields with default values */ | 91 | /* fields with default values */ |
92 | #define __flg_field_def(attr_nr, attr_flag, name, default) \ | 92 | #define __flg_field_def(attr_nr, attr_flag, name, default) \ |