1ec2c35acSLars Ellenberg /* 2ec2c35acSLars Ellenberg * General overview: 3ec2c35acSLars Ellenberg * full generic netlink message: 4ec2c35acSLars Ellenberg * |nlmsghdr|genlmsghdr|<payload> 5ec2c35acSLars Ellenberg * 6ec2c35acSLars Ellenberg * payload: 7ec2c35acSLars Ellenberg * |optional fixed size family header|<sequence of netlink attributes> 8ec2c35acSLars Ellenberg * 9ec2c35acSLars Ellenberg * sequence of netlink attributes: 10ec2c35acSLars Ellenberg * I chose to have all "top level" attributes NLA_NESTED, 11ec2c35acSLars Ellenberg * corresponding to some real struct. 12ec2c35acSLars Ellenberg * So we have a sequence of |tla, len|<nested nla sequence> 13ec2c35acSLars Ellenberg * 14ec2c35acSLars Ellenberg * nested nla sequence: 15ec2c35acSLars Ellenberg * may be empty, or contain a sequence of netlink attributes 16ec2c35acSLars Ellenberg * representing the struct fields. 17ec2c35acSLars Ellenberg * 18ec2c35acSLars Ellenberg * The tag number of any field (regardless of containing struct) 19ec2c35acSLars Ellenberg * will be available as T_ ## field_name, 20ec2c35acSLars Ellenberg * so you cannot have the same field name in two differnt structs. 21ec2c35acSLars Ellenberg * 22ec2c35acSLars Ellenberg * The tag numbers themselves are per struct, though, 23ec2c35acSLars Ellenberg * so should always begin at 1 (not 0, that is the special "NLA_UNSPEC" type, 24ec2c35acSLars Ellenberg * which we won't use here). 25ec2c35acSLars Ellenberg * The tag numbers are used as index in the respective nla_policy array. 26ec2c35acSLars Ellenberg * 27ec2c35acSLars Ellenberg * GENL_struct(tag_name, tag_number, struct name, struct fields) - struct and policy 28ec2c35acSLars Ellenberg * genl_magic_struct.h 29ec2c35acSLars Ellenberg * generates the struct declaration, 30ec2c35acSLars Ellenberg * generates an entry in the tla enum, 31ec2c35acSLars Ellenberg * genl_magic_func.h 32ec2c35acSLars Ellenberg * generates an entry in the static tla policy 33ec2c35acSLars Ellenberg * with .type = NLA_NESTED 34ec2c35acSLars Ellenberg * generates the static <struct_name>_nl_policy definition, 35ec2c35acSLars Ellenberg * and static conversion functions 36ec2c35acSLars Ellenberg * 37ec2c35acSLars Ellenberg * genl_magic_func.h 38ec2c35acSLars Ellenberg * 39ec2c35acSLars Ellenberg * GENL_mc_group(group) 40ec2c35acSLars Ellenberg * genl_magic_struct.h 41ec2c35acSLars Ellenberg * does nothing 42ec2c35acSLars Ellenberg * genl_magic_func.h 43ec2c35acSLars Ellenberg * defines and registers the mcast group, 44ec2c35acSLars Ellenberg * and provides a send helper 45ec2c35acSLars Ellenberg * 46ec2c35acSLars Ellenberg * GENL_notification(op_name, op_num, mcast_group, tla list) 47ec2c35acSLars Ellenberg * These are notifications to userspace. 48ec2c35acSLars Ellenberg * 49ec2c35acSLars Ellenberg * genl_magic_struct.h 50ec2c35acSLars Ellenberg * generates an entry in the genl_ops enum, 51ec2c35acSLars Ellenberg * genl_magic_func.h 52ec2c35acSLars Ellenberg * does nothing 53ec2c35acSLars Ellenberg * 54ec2c35acSLars Ellenberg * mcast group: the name of the mcast group this notification should be 55ec2c35acSLars Ellenberg * expected on 56ec2c35acSLars Ellenberg * tla list: the list of expected top level attributes, 57ec2c35acSLars Ellenberg * for documentation and sanity checking. 58ec2c35acSLars Ellenberg * 59ec2c35acSLars Ellenberg * GENL_op(op_name, op_num, flags and handler, tla list) - "genl operations" 60ec2c35acSLars Ellenberg * These are requests from userspace. 61ec2c35acSLars Ellenberg * 62ec2c35acSLars Ellenberg * _op and _notification share the same "number space", 63ec2c35acSLars Ellenberg * op_nr will be assigned to "genlmsghdr->cmd" 64ec2c35acSLars Ellenberg * 65ec2c35acSLars Ellenberg * genl_magic_struct.h 66ec2c35acSLars Ellenberg * generates an entry in the genl_ops enum, 67ec2c35acSLars Ellenberg * genl_magic_func.h 68ec2c35acSLars Ellenberg * generates an entry in the static genl_ops array, 69ec2c35acSLars Ellenberg * and static register/unregister functions to 70ec2c35acSLars Ellenberg * genl_register_family_with_ops(). 71ec2c35acSLars Ellenberg * 72ec2c35acSLars Ellenberg * flags and handler: 73ec2c35acSLars Ellenberg * GENL_op_init( .doit = x, .dumpit = y, .flags = something) 74ec2c35acSLars Ellenberg * GENL_doit(x) => .dumpit = NULL, .flags = GENL_ADMIN_PERM 75ec2c35acSLars Ellenberg * tla list: the list of expected top level attributes, 76ec2c35acSLars Ellenberg * for documentation and sanity checking. 77ec2c35acSLars Ellenberg */ 78ec2c35acSLars Ellenberg 79ec2c35acSLars Ellenberg /* 80ec2c35acSLars Ellenberg * STRUCTS 81ec2c35acSLars Ellenberg */ 82ec2c35acSLars Ellenberg 83ec2c35acSLars Ellenberg /* this is sent kernel -> userland on various error conditions, and contains 84ec2c35acSLars Ellenberg * informational textual info, which is supposedly human readable. 85ec2c35acSLars Ellenberg * The computer relevant return code is in the drbd_genlmsghdr. 86ec2c35acSLars Ellenberg */ 87ec2c35acSLars Ellenberg GENL_struct(DRBD_NLA_CFG_REPLY, 1, drbd_cfg_reply, 88ec2c35acSLars Ellenberg /* "arbitrary" size strings, nla_policy.len = 0 */ 895f935920SAndreas Gruenbacher __str_field(1, DRBD_GENLA_F_MANDATORY, info_text, 0) 90ec2c35acSLars Ellenberg ) 91ec2c35acSLars Ellenberg 92ec2c35acSLars Ellenberg /* Configuration requests typically need a context to operate on. 93ec2c35acSLars Ellenberg * Possible keys are device minor (fits in the drbd_genlmsghdr), 94ec2c35acSLars Ellenberg * the replication link (aka connection) name, 95ec2c35acSLars Ellenberg * and/or the replication group (aka resource) name, 96ec2c35acSLars Ellenberg * and the volume id within the resource. */ 97ec2c35acSLars Ellenberg GENL_struct(DRBD_NLA_CFG_CONTEXT, 2, drbd_cfg_context, 985f935920SAndreas Gruenbacher __u32_field(1, DRBD_GENLA_F_MANDATORY, ctx_volume) 997c3063ccSAndreas Gruenbacher __str_field(2, DRBD_GENLA_F_MANDATORY, ctx_resource_name, 128) 100089c075dSAndreas Gruenbacher __bin_field(3, DRBD_GENLA_F_MANDATORY, ctx_my_addr, 128) 101089c075dSAndreas Gruenbacher __bin_field(4, DRBD_GENLA_F_MANDATORY, ctx_peer_addr, 128) 102ec2c35acSLars Ellenberg ) 103ec2c35acSLars Ellenberg 104ec2c35acSLars Ellenberg GENL_struct(DRBD_NLA_DISK_CONF, 3, disk_conf, 1055f935920SAndreas Gruenbacher __str_field(1, DRBD_F_REQUIRED | DRBD_F_INVARIANT, backing_dev, 128) 1065f935920SAndreas Gruenbacher __str_field(2, DRBD_F_REQUIRED | DRBD_F_INVARIANT, meta_dev, 128) 1075f935920SAndreas Gruenbacher __s32_field(3, DRBD_F_REQUIRED | DRBD_F_INVARIANT, meta_dev_idx) 108f399002eSLars Ellenberg 109f399002eSLars Ellenberg /* use the resize command to try and change the disk_size */ 1105f935920SAndreas Gruenbacher __u64_field(4, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, disk_size) 111f399002eSLars Ellenberg /* we could change the max_bio_bvecs, 112f399002eSLars Ellenberg * but it won't propagate through the stack */ 1135f935920SAndreas Gruenbacher __u32_field(5, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, max_bio_bvecs) 114f399002eSLars Ellenberg 1155f935920SAndreas Gruenbacher __u32_field_def(6, DRBD_GENLA_F_MANDATORY, on_io_error, DRBD_ON_IO_ERROR_DEF) 1165f935920SAndreas Gruenbacher __u32_field_def(7, DRBD_GENLA_F_MANDATORY, fencing, DRBD_FENCING_DEF) 117f399002eSLars Ellenberg 1185f935920SAndreas Gruenbacher __u32_field_def(8, DRBD_GENLA_F_MANDATORY, resync_rate, DRBD_RESYNC_RATE_DEF) 1195f935920SAndreas Gruenbacher __s32_field_def(9, DRBD_GENLA_F_MANDATORY, resync_after, DRBD_MINOR_NUMBER_DEF) 1205f935920SAndreas Gruenbacher __u32_field_def(10, DRBD_GENLA_F_MANDATORY, al_extents, DRBD_AL_EXTENTS_DEF) 1215f935920SAndreas Gruenbacher __u32_field_def(11, DRBD_GENLA_F_MANDATORY, c_plan_ahead, DRBD_C_PLAN_AHEAD_DEF) 1225f935920SAndreas Gruenbacher __u32_field_def(12, DRBD_GENLA_F_MANDATORY, c_delay_target, DRBD_C_DELAY_TARGET_DEF) 1235f935920SAndreas Gruenbacher __u32_field_def(13, DRBD_GENLA_F_MANDATORY, c_fill_target, DRBD_C_FILL_TARGET_DEF) 1245f935920SAndreas Gruenbacher __u32_field_def(14, DRBD_GENLA_F_MANDATORY, c_max_rate, DRBD_C_MAX_RATE_DEF) 1255f935920SAndreas Gruenbacher __u32_field_def(15, DRBD_GENLA_F_MANDATORY, c_min_rate, DRBD_C_MIN_RATE_DEF) 126f399002eSLars Ellenberg 1275f935920SAndreas Gruenbacher __flg_field_def(16, DRBD_GENLA_F_MANDATORY, disk_barrier, DRBD_DISK_BARRIER_DEF) 1285f935920SAndreas Gruenbacher __flg_field_def(17, DRBD_GENLA_F_MANDATORY, disk_flushes, DRBD_DISK_FLUSHES_DEF) 1295f935920SAndreas Gruenbacher __flg_field_def(18, DRBD_GENLA_F_MANDATORY, disk_drain, DRBD_DISK_DRAIN_DEF) 1305f935920SAndreas Gruenbacher __flg_field_def(19, DRBD_GENLA_F_MANDATORY, md_flushes, DRBD_MD_FLUSHES_DEF) 131cdfda633SPhilipp Reisner __u32_field_def(20, DRBD_GENLA_F_MANDATORY, disk_timeout, DRBD_DISK_TIMEOUT_DEF) 132380207d0SPhilipp Reisner __u32_field_def(21, 0 /* OPTIONAL */, read_balancing, DRBD_READ_BALANCING_DEF) 1339a51ab1cSPhilipp Reisner /* 9: __u32_field_def(22, DRBD_GENLA_F_MANDATORY, unplug_watermark, DRBD_UNPLUG_WATERMARK_DEF) */ 1349a51ab1cSPhilipp Reisner __flg_field_def(23, 0 /* OPTIONAL */, al_updates, DRBD_AL_UPDATES_DEF) 135ec2c35acSLars Ellenberg ) 136ec2c35acSLars Ellenberg 137f399002eSLars Ellenberg GENL_struct(DRBD_NLA_RESOURCE_OPTS, 4, res_opts, 1385f935920SAndreas Gruenbacher __str_field_def(1, DRBD_GENLA_F_MANDATORY, cpu_mask, 32) 1395f935920SAndreas Gruenbacher __u32_field_def(2, DRBD_GENLA_F_MANDATORY, on_no_data, DRBD_ON_NO_DATA_DEF) 140ec2c35acSLars Ellenberg ) 141ec2c35acSLars Ellenberg 142ec2c35acSLars Ellenberg GENL_struct(DRBD_NLA_NET_CONF, 5, net_conf, 143089c075dSAndreas Gruenbacher __str_field_def(1, DRBD_GENLA_F_MANDATORY | DRBD_F_SENSITIVE, 144ec2c35acSLars Ellenberg shared_secret, SHARED_SECRET_MAX) 145089c075dSAndreas Gruenbacher __str_field_def(2, DRBD_GENLA_F_MANDATORY, cram_hmac_alg, SHARED_SECRET_MAX) 146089c075dSAndreas Gruenbacher __str_field_def(3, DRBD_GENLA_F_MANDATORY, integrity_alg, SHARED_SECRET_MAX) 147089c075dSAndreas Gruenbacher __str_field_def(4, DRBD_GENLA_F_MANDATORY, verify_alg, SHARED_SECRET_MAX) 148089c075dSAndreas Gruenbacher __str_field_def(5, DRBD_GENLA_F_MANDATORY, csums_alg, SHARED_SECRET_MAX) 149089c075dSAndreas Gruenbacher __u32_field_def(6, DRBD_GENLA_F_MANDATORY, wire_protocol, DRBD_PROTOCOL_DEF) 150089c075dSAndreas Gruenbacher __u32_field_def(7, DRBD_GENLA_F_MANDATORY, connect_int, DRBD_CONNECT_INT_DEF) 151089c075dSAndreas Gruenbacher __u32_field_def(8, DRBD_GENLA_F_MANDATORY, timeout, DRBD_TIMEOUT_DEF) 152089c075dSAndreas Gruenbacher __u32_field_def(9, DRBD_GENLA_F_MANDATORY, ping_int, DRBD_PING_INT_DEF) 153089c075dSAndreas Gruenbacher __u32_field_def(10, DRBD_GENLA_F_MANDATORY, ping_timeo, DRBD_PING_TIMEO_DEF) 154089c075dSAndreas Gruenbacher __u32_field_def(11, DRBD_GENLA_F_MANDATORY, sndbuf_size, DRBD_SNDBUF_SIZE_DEF) 155089c075dSAndreas Gruenbacher __u32_field_def(12, DRBD_GENLA_F_MANDATORY, rcvbuf_size, DRBD_RCVBUF_SIZE_DEF) 156089c075dSAndreas Gruenbacher __u32_field_def(13, DRBD_GENLA_F_MANDATORY, ko_count, DRBD_KO_COUNT_DEF) 157089c075dSAndreas Gruenbacher __u32_field_def(14, DRBD_GENLA_F_MANDATORY, max_buffers, DRBD_MAX_BUFFERS_DEF) 158089c075dSAndreas Gruenbacher __u32_field_def(15, DRBD_GENLA_F_MANDATORY, max_epoch_size, DRBD_MAX_EPOCH_SIZE_DEF) 159089c075dSAndreas Gruenbacher __u32_field_def(16, DRBD_GENLA_F_MANDATORY, unplug_watermark, DRBD_UNPLUG_WATERMARK_DEF) 160089c075dSAndreas Gruenbacher __u32_field_def(17, DRBD_GENLA_F_MANDATORY, after_sb_0p, DRBD_AFTER_SB_0P_DEF) 161089c075dSAndreas Gruenbacher __u32_field_def(18, DRBD_GENLA_F_MANDATORY, after_sb_1p, DRBD_AFTER_SB_1P_DEF) 162089c075dSAndreas Gruenbacher __u32_field_def(19, DRBD_GENLA_F_MANDATORY, after_sb_2p, DRBD_AFTER_SB_2P_DEF) 163089c075dSAndreas Gruenbacher __u32_field_def(20, DRBD_GENLA_F_MANDATORY, rr_conflict, DRBD_RR_CONFLICT_DEF) 164089c075dSAndreas Gruenbacher __u32_field_def(21, DRBD_GENLA_F_MANDATORY, on_congestion, DRBD_ON_CONGESTION_DEF) 165089c075dSAndreas Gruenbacher __u32_field_def(22, DRBD_GENLA_F_MANDATORY, cong_fill, DRBD_CONG_FILL_DEF) 166089c075dSAndreas Gruenbacher __u32_field_def(23, DRBD_GENLA_F_MANDATORY, cong_extents, DRBD_CONG_EXTENTS_DEF) 167089c075dSAndreas Gruenbacher __flg_field_def(24, DRBD_GENLA_F_MANDATORY, two_primaries, DRBD_ALLOW_TWO_PRIMARIES_DEF) 168089c075dSAndreas Gruenbacher __flg_field(25, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, discard_my_data) 169089c075dSAndreas Gruenbacher __flg_field_def(26, DRBD_GENLA_F_MANDATORY, tcp_cork, DRBD_TCP_CORK_DEF) 170089c075dSAndreas Gruenbacher __flg_field_def(27, DRBD_GENLA_F_MANDATORY, always_asbp, DRBD_ALWAYS_ASBP_DEF) 1716dff2902SAndreas Gruenbacher __flg_field(28, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, tentative) 172089c075dSAndreas Gruenbacher __flg_field_def(29, DRBD_GENLA_F_MANDATORY, use_rle, DRBD_USE_RLE_DEF) 1739a51ab1cSPhilipp Reisner /* 9: __u32_field_def(30, DRBD_GENLA_F_MANDATORY, fencing_policy, DRBD_FENCING_DEF) */ 174ec2c35acSLars Ellenberg ) 175ec2c35acSLars Ellenberg 176ec2c35acSLars Ellenberg GENL_struct(DRBD_NLA_SET_ROLE_PARMS, 6, set_role_parms, 1775f935920SAndreas Gruenbacher __flg_field(1, DRBD_GENLA_F_MANDATORY, assume_uptodate) 178ec2c35acSLars Ellenberg ) 179ec2c35acSLars Ellenberg 180ec2c35acSLars Ellenberg GENL_struct(DRBD_NLA_RESIZE_PARMS, 7, resize_parms, 1815f935920SAndreas Gruenbacher __u64_field(1, DRBD_GENLA_F_MANDATORY, resize_size) 1825f935920SAndreas Gruenbacher __flg_field(2, DRBD_GENLA_F_MANDATORY, resize_force) 1835f935920SAndreas Gruenbacher __flg_field(3, DRBD_GENLA_F_MANDATORY, no_resync) 184d752b269SPhilipp Reisner __u32_field_def(4, 0 /* OPTIONAL */, al_stripes, DRBD_AL_STRIPES_DEF) 185d752b269SPhilipp Reisner __u32_field_def(5, 0 /* OPTIONAL */, al_stripe_size, DRBD_AL_STRIPE_SIZE_DEF) 186ec2c35acSLars Ellenberg ) 187ec2c35acSLars Ellenberg 188ec2c35acSLars Ellenberg GENL_struct(DRBD_NLA_STATE_INFO, 8, state_info, 189ec2c35acSLars Ellenberg /* the reason of the broadcast, 190ec2c35acSLars Ellenberg * if this is an event triggered broadcast. */ 1915f935920SAndreas Gruenbacher __u32_field(1, DRBD_GENLA_F_MANDATORY, sib_reason) 1925f935920SAndreas Gruenbacher __u32_field(2, DRBD_F_REQUIRED, current_state) 1935f935920SAndreas Gruenbacher __u64_field(3, DRBD_GENLA_F_MANDATORY, capacity) 1945f935920SAndreas Gruenbacher __u64_field(4, DRBD_GENLA_F_MANDATORY, ed_uuid) 195ec2c35acSLars Ellenberg 196ec2c35acSLars Ellenberg /* These are for broadcast from after state change work. 197ec2c35acSLars Ellenberg * prev_state and new_state are from the moment the state change took 198ec2c35acSLars Ellenberg * place, new_state is not neccessarily the same as current_state, 199ec2c35acSLars Ellenberg * there may have been more state changes since. Which will be 200ec2c35acSLars Ellenberg * broadcasted soon, in their respective after state change work. */ 2015f935920SAndreas Gruenbacher __u32_field(5, DRBD_GENLA_F_MANDATORY, prev_state) 2025f935920SAndreas Gruenbacher __u32_field(6, DRBD_GENLA_F_MANDATORY, new_state) 203ec2c35acSLars Ellenberg 204ec2c35acSLars Ellenberg /* if we have a local disk: */ 2055f935920SAndreas Gruenbacher __bin_field(7, DRBD_GENLA_F_MANDATORY, uuids, (UI_SIZE*sizeof(__u64))) 2065f935920SAndreas Gruenbacher __u32_field(8, DRBD_GENLA_F_MANDATORY, disk_flags) 2075f935920SAndreas Gruenbacher __u64_field(9, DRBD_GENLA_F_MANDATORY, bits_total) 2085f935920SAndreas Gruenbacher __u64_field(10, DRBD_GENLA_F_MANDATORY, bits_oos) 209ec2c35acSLars Ellenberg /* and in case resync or online verify is active */ 2105f935920SAndreas Gruenbacher __u64_field(11, DRBD_GENLA_F_MANDATORY, bits_rs_total) 2115f935920SAndreas Gruenbacher __u64_field(12, DRBD_GENLA_F_MANDATORY, bits_rs_failed) 212ec2c35acSLars Ellenberg 213ec2c35acSLars Ellenberg /* for pre and post notifications of helper execution */ 2145f935920SAndreas Gruenbacher __str_field(13, DRBD_GENLA_F_MANDATORY, helper, 32) 2155f935920SAndreas Gruenbacher __u32_field(14, DRBD_GENLA_F_MANDATORY, helper_exit_code) 2163174f8c5SPhilipp Marek 2173174f8c5SPhilipp Marek __u64_field(15, 0, send_cnt) 2183174f8c5SPhilipp Marek __u64_field(16, 0, recv_cnt) 2193174f8c5SPhilipp Marek __u64_field(17, 0, read_cnt) 2203174f8c5SPhilipp Marek __u64_field(18, 0, writ_cnt) 2213174f8c5SPhilipp Marek __u64_field(19, 0, al_writ_cnt) 2223174f8c5SPhilipp Marek __u64_field(20, 0, bm_writ_cnt) 2233174f8c5SPhilipp Marek __u32_field(21, 0, ap_bio_cnt) 2243174f8c5SPhilipp Marek __u32_field(22, 0, ap_pending_cnt) 2253174f8c5SPhilipp Marek __u32_field(23, 0, rs_pending_cnt) 226ec2c35acSLars Ellenberg ) 227ec2c35acSLars Ellenberg 228ec2c35acSLars Ellenberg GENL_struct(DRBD_NLA_START_OV_PARMS, 9, start_ov_parms, 2295f935920SAndreas Gruenbacher __u64_field(1, DRBD_GENLA_F_MANDATORY, ov_start_sector) 23058ffa580SLars Ellenberg __u64_field(2, DRBD_GENLA_F_MANDATORY, ov_stop_sector) 231ec2c35acSLars Ellenberg ) 232ec2c35acSLars Ellenberg 233ec2c35acSLars Ellenberg GENL_struct(DRBD_NLA_NEW_C_UUID_PARMS, 10, new_c_uuid_parms, 2345f935920SAndreas Gruenbacher __flg_field(1, DRBD_GENLA_F_MANDATORY, clear_bm) 235ec2c35acSLars Ellenberg ) 236ec2c35acSLars Ellenberg 237ec2c35acSLars Ellenberg GENL_struct(DRBD_NLA_TIMEOUT_PARMS, 11, timeout_parms, 2385f935920SAndreas Gruenbacher __u32_field(1, DRBD_F_REQUIRED, timeout_type) 239ec2c35acSLars Ellenberg ) 240ec2c35acSLars Ellenberg 241ec2c35acSLars Ellenberg GENL_struct(DRBD_NLA_DISCONNECT_PARMS, 12, disconnect_parms, 2425f935920SAndreas Gruenbacher __flg_field(1, DRBD_GENLA_F_MANDATORY, force_disconnect) 243ec2c35acSLars Ellenberg ) 244ec2c35acSLars Ellenberg 245cdfda633SPhilipp Reisner GENL_struct(DRBD_NLA_DETACH_PARMS, 13, detach_parms, 246cdfda633SPhilipp Reisner __flg_field(1, DRBD_GENLA_F_MANDATORY, force_detach) 247cdfda633SPhilipp Reisner ) 248cdfda633SPhilipp Reisner 249ec2c35acSLars Ellenberg /* 250ec2c35acSLars Ellenberg * Notifications and commands (genlmsghdr->cmd) 251ec2c35acSLars Ellenberg */ 252ec2c35acSLars Ellenberg GENL_mc_group(events) 253ec2c35acSLars Ellenberg 254ec2c35acSLars Ellenberg /* kernel -> userspace announcement of changes */ 255ec2c35acSLars Ellenberg GENL_notification( 256ec2c35acSLars Ellenberg DRBD_EVENT, 1, events, 2575f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED) 2585f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_STATE_INFO, DRBD_F_REQUIRED) 2595f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_NET_CONF, DRBD_GENLA_F_MANDATORY) 2605f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_DISK_CONF, DRBD_GENLA_F_MANDATORY) 2615f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_SYNCER_CONF, DRBD_GENLA_F_MANDATORY) 262ec2c35acSLars Ellenberg ) 263ec2c35acSLars Ellenberg 264ec2c35acSLars Ellenberg /* query kernel for specific or all info */ 265ec2c35acSLars Ellenberg GENL_op( 266ec2c35acSLars Ellenberg DRBD_ADM_GET_STATUS, 2, 267ec2c35acSLars Ellenberg GENL_op_init( 268ec2c35acSLars Ellenberg .doit = drbd_adm_get_status, 269ec2c35acSLars Ellenberg .dumpit = drbd_adm_get_status_all, 270ec2c35acSLars Ellenberg /* anyone may ask for the status, 271ec2c35acSLars Ellenberg * it is broadcasted anyways */ 272ec2c35acSLars Ellenberg ), 273ec2c35acSLars Ellenberg /* To select the object .doit. 274ec2c35acSLars Ellenberg * Or a subset of objects in .dumpit. */ 2755f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_GENLA_F_MANDATORY) 276ec2c35acSLars Ellenberg ) 277ec2c35acSLars Ellenberg 278ec2c35acSLars Ellenberg /* add DRBD minor devices as volumes to resources */ 279*05a10ec7SAndreas Gruenbacher GENL_op(DRBD_ADM_NEW_MINOR, 5, GENL_doit(drbd_adm_new_minor), 2805f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)) 281*05a10ec7SAndreas Gruenbacher GENL_op(DRBD_ADM_DEL_MINOR, 6, GENL_doit(drbd_adm_del_minor), 2825f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)) 283ec2c35acSLars Ellenberg 284789c1b62SAndreas Gruenbacher /* add or delete resources */ 285789c1b62SAndreas Gruenbacher GENL_op(DRBD_ADM_NEW_RESOURCE, 7, GENL_doit(drbd_adm_new_resource), 2865f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)) 287789c1b62SAndreas Gruenbacher GENL_op(DRBD_ADM_DEL_RESOURCE, 8, GENL_doit(drbd_adm_del_resource), 2885f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)) 289ec2c35acSLars Ellenberg 290f399002eSLars Ellenberg GENL_op(DRBD_ADM_RESOURCE_OPTS, 9, 291f399002eSLars Ellenberg GENL_doit(drbd_adm_resource_opts), 2925f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED) 2935f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_RESOURCE_OPTS, DRBD_GENLA_F_MANDATORY) 294ec2c35acSLars Ellenberg ) 295ec2c35acSLars Ellenberg 296ec2c35acSLars Ellenberg GENL_op( 297ec2c35acSLars Ellenberg DRBD_ADM_CONNECT, 10, 298ec2c35acSLars Ellenberg GENL_doit(drbd_adm_connect), 2995f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED) 3005f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_NET_CONF, DRBD_F_REQUIRED) 301ec2c35acSLars Ellenberg ) 302ec2c35acSLars Ellenberg 303f399002eSLars Ellenberg GENL_op( 304f399002eSLars Ellenberg DRBD_ADM_CHG_NET_OPTS, 29, 305f399002eSLars Ellenberg GENL_doit(drbd_adm_net_opts), 3065f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED) 3075f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_NET_CONF, DRBD_F_REQUIRED) 308f399002eSLars Ellenberg ) 309f399002eSLars Ellenberg 310ec2c35acSLars Ellenberg GENL_op(DRBD_ADM_DISCONNECT, 11, GENL_doit(drbd_adm_disconnect), 3115f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)) 312ec2c35acSLars Ellenberg 313ec2c35acSLars Ellenberg GENL_op(DRBD_ADM_ATTACH, 12, 314ec2c35acSLars Ellenberg GENL_doit(drbd_adm_attach), 3155f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED) 3165f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_DISK_CONF, DRBD_F_REQUIRED) 317ec2c35acSLars Ellenberg ) 318ec2c35acSLars Ellenberg 319f399002eSLars Ellenberg GENL_op(DRBD_ADM_CHG_DISK_OPTS, 28, 320f399002eSLars Ellenberg GENL_doit(drbd_adm_disk_opts), 3215f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED) 3225f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_DISK_OPTS, DRBD_F_REQUIRED) 323f399002eSLars Ellenberg ) 324f399002eSLars Ellenberg 325ec2c35acSLars Ellenberg GENL_op( 326ec2c35acSLars Ellenberg DRBD_ADM_RESIZE, 13, 327ec2c35acSLars Ellenberg GENL_doit(drbd_adm_resize), 3285f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED) 3295f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_RESIZE_PARMS, DRBD_GENLA_F_MANDATORY) 330ec2c35acSLars Ellenberg ) 331ec2c35acSLars Ellenberg 332ec2c35acSLars Ellenberg GENL_op( 333ec2c35acSLars Ellenberg DRBD_ADM_PRIMARY, 14, 334ec2c35acSLars Ellenberg GENL_doit(drbd_adm_set_role), 3355f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED) 3365f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_SET_ROLE_PARMS, DRBD_F_REQUIRED) 337ec2c35acSLars Ellenberg ) 338ec2c35acSLars Ellenberg 339ec2c35acSLars Ellenberg GENL_op( 340ec2c35acSLars Ellenberg DRBD_ADM_SECONDARY, 15, 341ec2c35acSLars Ellenberg GENL_doit(drbd_adm_set_role), 3425f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED) 3435f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_SET_ROLE_PARMS, DRBD_F_REQUIRED) 344ec2c35acSLars Ellenberg ) 345ec2c35acSLars Ellenberg 346ec2c35acSLars Ellenberg GENL_op( 347ec2c35acSLars Ellenberg DRBD_ADM_NEW_C_UUID, 16, 348ec2c35acSLars Ellenberg GENL_doit(drbd_adm_new_c_uuid), 3495f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED) 3505f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_NEW_C_UUID_PARMS, DRBD_GENLA_F_MANDATORY) 351ec2c35acSLars Ellenberg ) 352ec2c35acSLars Ellenberg 353ec2c35acSLars Ellenberg GENL_op( 354ec2c35acSLars Ellenberg DRBD_ADM_START_OV, 17, 355ec2c35acSLars Ellenberg GENL_doit(drbd_adm_start_ov), 3565f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_START_OV_PARMS, DRBD_GENLA_F_MANDATORY) 357ec2c35acSLars Ellenberg ) 358ec2c35acSLars Ellenberg 359ec2c35acSLars Ellenberg GENL_op(DRBD_ADM_DETACH, 18, GENL_doit(drbd_adm_detach), 360cdfda633SPhilipp Reisner GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED) 361cdfda633SPhilipp Reisner GENL_tla_expected(DRBD_NLA_DETACH_PARMS, DRBD_GENLA_F_MANDATORY)) 362cdfda633SPhilipp Reisner 363ec2c35acSLars Ellenberg GENL_op(DRBD_ADM_INVALIDATE, 19, GENL_doit(drbd_adm_invalidate), 3645f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)) 365ec2c35acSLars Ellenberg GENL_op(DRBD_ADM_INVAL_PEER, 20, GENL_doit(drbd_adm_invalidate_peer), 3665f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)) 367ec2c35acSLars Ellenberg GENL_op(DRBD_ADM_PAUSE_SYNC, 21, GENL_doit(drbd_adm_pause_sync), 3685f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)) 369ec2c35acSLars Ellenberg GENL_op(DRBD_ADM_RESUME_SYNC, 22, GENL_doit(drbd_adm_resume_sync), 3705f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)) 371ec2c35acSLars Ellenberg GENL_op(DRBD_ADM_SUSPEND_IO, 23, GENL_doit(drbd_adm_suspend_io), 3725f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)) 373ec2c35acSLars Ellenberg GENL_op(DRBD_ADM_RESUME_IO, 24, GENL_doit(drbd_adm_resume_io), 3745f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)) 375ec2c35acSLars Ellenberg GENL_op(DRBD_ADM_OUTDATE, 25, GENL_doit(drbd_adm_outdate), 3765f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)) 377ec2c35acSLars Ellenberg GENL_op(DRBD_ADM_GET_TIMEOUT_TYPE, 26, GENL_doit(drbd_adm_get_timeout_type), 3785f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)) 37985f75dd7SLars Ellenberg GENL_op(DRBD_ADM_DOWN, 27, GENL_doit(drbd_adm_down), 3805f935920SAndreas Gruenbacher GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)) 381