[DRBD-cvs] svn commit by phil - r2469 - in trunk/drbd: . linux - By
enumerating the netlink packets explicit, instead le
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Wed Sep 27 12:53:37 CEST 2006
Author: phil
Date: 2006-09-27 12:53:35 +0200 (Wed, 27 Sep 2006)
New Revision: 2469
Modified:
trunk/drbd/drbd_int.h
trunk/drbd/drbd_nl.c
trunk/drbd/linux/drbd_nl.h
trunk/drbd/linux/drbd_tag_magic.h
Log:
By enumerating the netlink packets explicit, instead leaving this
to the implicit numbering of enum I hope that breaking binary
compatibility becomes less likely.
Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h 2006-09-27 10:40:43 UTC (rev 2468)
+++ trunk/drbd/drbd_int.h 2006-09-27 10:53:35 UTC (rev 2469)
@@ -769,7 +769,7 @@
};
// for sync_conf and other types...
-#define PACKET(name, fields) struct name { fields };
+#define PACKET(name, number, fields) struct name { fields };
#define INTEGER(pn,pr,member) int member;
#define INT64(pn,pr,member) __u64 member;
#define BIT(pn,pr,member) unsigned member : 1;
Modified: trunk/drbd/drbd_nl.c
===================================================================
--- trunk/drbd/drbd_nl.c 2006-09-27 10:40:43 UTC (rev 2468)
+++ trunk/drbd/drbd_nl.c 2006-09-27 10:53:35 UTC (rev 2469)
@@ -45,7 +45,7 @@
// Generate the tag_list to struct functions
-#define PACKET(name, fields) \
+#define PACKET(name, number, fields) \
int name ## _from_tags (drbd_dev *mdev, unsigned short* tags, struct name * arg) \
{ \
int tag; \
@@ -85,7 +85,7 @@
#include "linux/drbd_nl.h"
// Generate the struct to tag_list functions
-#define PACKET(name, fields) \
+#define PACKET(name, number, fields) \
unsigned short* \
name ## _to_tags (drbd_dev *mdev, struct name * arg, unsigned short* tags) \
{ \
Modified: trunk/drbd/linux/drbd_nl.h
===================================================================
--- trunk/drbd/linux/drbd_nl.h 2006-09-27 10:40:43 UTC (rev 2468)
+++ trunk/drbd/linux/drbd_nl.h 2006-09-27 10:53:35 UTC (rev 2469)
@@ -11,13 +11,13 @@
#error "The macros PACKET, STRING, INTEGER, INT64 and BIT needs to be defined"
#endif
-PACKET(primary,
+PACKET(primary, 1,
BIT( 1, T_MAY_IGNORE, overwrite_peer)
)
-PACKET(secondary, )
+PACKET(secondary, 2, )
-PACKET(disk_conf,
+PACKET(disk_conf, 3,
INT64( 2, T_MAY_IGNORE, disk_size)
STRING( 3, T_MANDATORY, backing_dev, 32)
STRING( 4, T_MANDATORY, meta_dev, 32)
@@ -27,9 +27,9 @@
BIT( 37, T_MAY_IGNORE, use_bmbv)
)
-PACKET(detach, )
+PACKET(detach, 4,)
-PACKET(net_conf,
+PACKET(net_conf, 5,
STRING( 8, T_MANDATORY, my_addr, 128)
STRING( 9, T_MANDATORY, peer_addr, 128)
STRING( 10, T_MAY_IGNORE, shared_secret, SHARED_SECRET_MAX)
@@ -50,40 +50,40 @@
BIT( 28, T_MAY_IGNORE, two_primaries)
)
-PACKET(disconnect, )
+PACKET(disconnect, 6, )
-PACKET(resize,
+PACKET(resize, 7,
INT64( 29, T_MAY_IGNORE, resize_size)
)
-PACKET(syncer_conf,
+PACKET(syncer_conf, 8,
INTEGER( 30, T_MAY_IGNORE, rate)
INTEGER( 31, T_MAY_IGNORE, after)
INTEGER( 32, T_MAY_IGNORE, al_extents)
)
-PACKET(invalidate, )
-PACKET(invalidate_peer, )
-PACKET(pause_sync, )
-PACKET(resume_sync, )
-PACKET(suspend_io, )
-PACKET(resume_io, )
-PACKET(outdate, )
-PACKET(get_config, )
-PACKET(get_state,
+PACKET(invalidate, 9, )
+PACKET(invalidate_peer, 10, )
+PACKET(pause_sync, 11, )
+PACKET(resume_sync, 12, )
+PACKET(suspend_io, 13, )
+PACKET(resume_io, 14, )
+PACKET(outdate, 15, )
+PACKET(get_config, 16, )
+PACKET(get_state, 17,
INTEGER( 33, T_MAY_IGNORE, state_i)
)
-PACKET(get_uuids,
+PACKET(get_uuids, 18,
STRING( 34, T_MAY_IGNORE, uuids, (UUID_SIZE*sizeof(__u64)))
INTEGER( 35, T_MAY_IGNORE, uuids_flags)
)
-PACKET(get_timeout_flag,
+PACKET(get_timeout_flag, 19,
BIT( 36, T_MAY_IGNORE, use_degraded)
)
-PACKET(call_helper,
+PACKET(call_helper, 20,
STRING( 38, T_MAY_IGNORE, helper, 32)
)
Modified: trunk/drbd/linux/drbd_tag_magic.h
===================================================================
--- trunk/drbd/linux/drbd_tag_magic.h 2006-09-27 10:40:43 UTC (rev 2468)
+++ trunk/drbd/linux/drbd_tag_magic.h 2006-09-27 10:53:35 UTC (rev 2469)
@@ -6,7 +6,7 @@
// declare packet_type enums
enum packet_types {
-#define PACKET(name, fields) P_ ## name,
+#define PACKET(name, number, fields) P_ ## name = number,
#define INTEGER(pn,pr,member)
#define INT64(pn,pr,member)
#define BIT(pn,pr,member)
@@ -16,7 +16,7 @@
};
// These struct are used to deduce the size of the tag lists:
-#define PACKET(name, fields) struct name ## _tag_len_struct { fields };
+#define PACKET(name, number ,fields) struct name ## _tag_len_struct { fields };
#define INTEGER(pn,pr,member) int member; int tag_and_len ## member;
#define INT64(pn,pr,member) __u64 member; int tag_and_len ## member;
#define BIT(pn,pr,member) unsigned char member : 1; int tag_and_len ## member;
@@ -26,7 +26,7 @@
// declate tag-list-sizes
const int tag_list_sizes[] = {
-#define PACKET(name,fields) 2 fields ,
+#define PACKET(name,number,fields) 2 fields ,
#define INTEGER(pn,pr,member) +4+4
#define INT64(pn,pr,member) +4+8
#define BIT(pn,pr,member) +4+1
@@ -50,7 +50,7 @@
#define tag_number(T) ((T) & TN_MASK)
// declare tag enums
-#define PACKET(name, fields) fields
+#define PACKET(name, number, fields) fields
enum drbd_tags {
#define INTEGER(pn,pr,member) T_ ## member = pn | TT_INTEGER | pr ,
#define INT64(pn,pr,member) T_ ## member = pn | TT_INT64 | pr ,
@@ -65,7 +65,7 @@
};
// declare tag names
-#define PACKET(name, fields) fields
+#define PACKET(name, number, fields) fields
const struct tag tag_descriptions[] = {
#define INTEGER(pn,pr,member) [ pn ] = { #member, TT_INTEGER | pr },
#define INT64(pn,pr,member) [ pn ] = { #member, TT_INT64 | pr },
More information about the drbd-cvs
mailing list