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