Lars Ellenberg | ec2c35a | 2011-03-07 10:20:08 +0100 | [diff] [blame] | 1 | #ifndef DRBD_GENL_STRUCT_H |
| 2 | #define DRBD_GENL_STRUCT_H |
| 3 | |
| 4 | /** |
| 5 | * struct drbd_genlmsghdr - DRBD specific header used in NETLINK_GENERIC requests |
| 6 | * @minor: |
| 7 | * For admin requests (user -> kernel): which minor device to operate on. |
| 8 | * For (unicast) replies or informational (broadcast) messages |
| 9 | * (kernel -> user): which minor device the information is about. |
| 10 | * If we do not operate on minors, but on connections or resources, |
| 11 | * the minor value shall be (~0), and the attribute DRBD_NLA_CFG_CONTEXT |
| 12 | * is used instead. |
| 13 | * @flags: possible operation modifiers (relevant only for user->kernel): |
| 14 | * DRBD_GENL_F_SET_DEFAULTS |
| 15 | * @volume: |
| 16 | * When creating a new minor (adding it to a resource), the resource needs |
| 17 | * to know which volume number within the resource this is supposed to be. |
| 18 | * The volume number corresponds to the same volume number on the remote side, |
| 19 | * whereas the minor number on the remote side may be different |
| 20 | * (union with flags). |
| 21 | * @ret_code: kernel->userland unicast cfg reply return code (union with flags); |
| 22 | */ |
| 23 | struct drbd_genlmsghdr { |
| 24 | __u32 minor; |
| 25 | union { |
| 26 | __u32 flags; |
| 27 | __s32 ret_code; |
| 28 | }; |
| 29 | }; |
| 30 | |
| 31 | /* To be used in drbd_genlmsghdr.flags */ |
| 32 | enum { |
| 33 | DRBD_GENL_F_SET_DEFAULTS = 1, |
| 34 | }; |
| 35 | |
| 36 | enum drbd_state_info_bcast_reason { |
| 37 | SIB_GET_STATUS_REPLY = 1, |
| 38 | SIB_STATE_CHANGE = 2, |
| 39 | SIB_HELPER_PRE = 3, |
| 40 | SIB_HELPER_POST = 4, |
| 41 | SIB_SYNC_PROGRESS = 5, |
| 42 | }; |
| 43 | |
| 44 | /* hack around predefined gcc/cpp "linux=1", |
| 45 | * we cannot possibly include <1/drbd_genl.h> */ |
| 46 | #undef linux |
| 47 | |
| 48 | #include <linux/drbd.h> |
| 49 | #define GENL_MAGIC_VERSION API_VERSION |
| 50 | #define GENL_MAGIC_FAMILY drbd |
| 51 | #define GENL_MAGIC_FAMILY_HDRSZ sizeof(struct drbd_genlmsghdr) |
| 52 | #define GENL_MAGIC_INCLUDE_FILE <linux/drbd_genl.h> |
| 53 | #include <linux/genl_magic_struct.h> |
| 54 | |
| 55 | #endif |