aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ellenberg <lars.ellenberg@linbit.com>2010-11-24 04:11:14 -0500
committerPhilipp Reisner <philipp.reisner@linbit.com>2011-03-10 05:35:15 -0500
commit42ff269d1022a86be4f526cf674998c47b7ab856 (patch)
treed392b05fd0c626093b552232b26b60d21afa4d26
parent3e3a7766c2e6995ac98e7855017abc3544d54e08 (diff)
drbd: add packet_type 27 (return_code_only) to netlink api
In case we ever should add an other packet type, we must not reuse 27, as that currently used for "empty" return code only replies. Document it as such. 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.c6
-rw-r--r--include/linux/drbd_nl.h6
-rw-r--r--include/linux/drbd_tag_magic.h1
3 files changed, 10 insertions, 3 deletions
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 80a389d24cdd..6a6dde6c51c6 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -2195,7 +2195,8 @@ static void drbd_connector_callback(struct cn_msg *req, struct netlink_skb_parms
2195 goto fail; 2195 goto fail;
2196 } 2196 }
2197 2197
2198 if (nlp->packet_type >= P_nl_after_last_packet) { 2198 if (nlp->packet_type >= P_nl_after_last_packet ||
2199 nlp->packet_type == P_return_code_only) {
2199 retcode = ERR_PACKET_NR; 2200 retcode = ERR_PACKET_NR;
2200 goto fail; 2201 goto fail;
2201 } 2202 }
@@ -2219,7 +2220,7 @@ static void drbd_connector_callback(struct cn_msg *req, struct netlink_skb_parms
2219 reply = (struct drbd_nl_cfg_reply *) cn_reply->data; 2220 reply = (struct drbd_nl_cfg_reply *) cn_reply->data;
2220 2221
2221 reply->packet_type = 2222 reply->packet_type =
2222 cm->reply_body_size ? nlp->packet_type : P_nl_after_last_packet; 2223 cm->reply_body_size ? nlp->packet_type : P_return_code_only;
2223 reply->minor = nlp->drbd_minor; 2224 reply->minor = nlp->drbd_minor;
2224 reply->ret_code = NO_ERROR; /* Might by modified by cm->function. */ 2225 reply->ret_code = NO_ERROR; /* Might by modified by cm->function. */
2225 /* reply->tag_list; might be modified by cm->function. */ 2226 /* reply->tag_list; might be modified by cm->function. */
@@ -2525,6 +2526,7 @@ void drbd_nl_send_reply(struct cn_msg *req, int ret_code)
2525 cn_reply->len = sizeof(struct drbd_nl_cfg_reply); 2526 cn_reply->len = sizeof(struct drbd_nl_cfg_reply);
2526 cn_reply->flags = 0; 2527 cn_reply->flags = 0;
2527 2528
2529 reply->packet_type = P_return_code_only;
2528 reply->minor = ((struct drbd_nl_cfg_req *)req->data)->drbd_minor; 2530 reply->minor = ((struct drbd_nl_cfg_req *)req->data)->drbd_minor;
2529 reply->ret_code = ret_code; 2531 reply->ret_code = ret_code;
2530 2532
diff --git a/include/linux/drbd_nl.h b/include/linux/drbd_nl.h
index 8cde3945d1f7..6fc614b06c4d 100644
--- a/include/linux/drbd_nl.h
+++ b/include/linux/drbd_nl.h
@@ -146,9 +146,13 @@ NL_PACKET(new_c_uuid, 26,
146 NL_BIT( 63, T_MANDATORY, clear_bm) 146 NL_BIT( 63, T_MANDATORY, clear_bm)
147) 147)
148 148
149#ifdef NL_RESPONSE
150NL_RESPONSE(return_code_only, 27)
151#endif
152
149#undef NL_PACKET 153#undef NL_PACKET
150#undef NL_INTEGER 154#undef NL_INTEGER
151#undef NL_INT64 155#undef NL_INT64
152#undef NL_BIT 156#undef NL_BIT
153#undef NL_STRING 157#undef NL_STRING
154 158#undef NL_RESPONSE
diff --git a/include/linux/drbd_tag_magic.h b/include/linux/drbd_tag_magic.h
index fcdff8410e99..f14a165e82dc 100644
--- a/include/linux/drbd_tag_magic.h
+++ b/include/linux/drbd_tag_magic.h
@@ -7,6 +7,7 @@
7/* declare packet_type enums */ 7/* declare packet_type enums */
8enum packet_types { 8enum packet_types {
9#define NL_PACKET(name, number, fields) P_ ## name = number, 9#define NL_PACKET(name, number, fields) P_ ## name = number,
10#define NL_RESPONSE(name, number) P_ ## name = number,
10#define NL_INTEGER(pn, pr, member) 11#define NL_INTEGER(pn, pr, member)
11#define NL_INT64(pn, pr, member) 12#define NL_INT64(pn, pr, member)
12#define NL_BIT(pn, pr, member) 13#define NL_BIT(pn, pr, member)