18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef DRBD_GENL_STRUCT_H
38c2ecf20Sopenharmony_ci#define DRBD_GENL_STRUCT_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/**
68c2ecf20Sopenharmony_ci * struct drbd_genlmsghdr - DRBD specific header used in NETLINK_GENERIC requests
78c2ecf20Sopenharmony_ci * @minor:
88c2ecf20Sopenharmony_ci *     For admin requests (user -> kernel): which minor device to operate on.
98c2ecf20Sopenharmony_ci *     For (unicast) replies or informational (broadcast) messages
108c2ecf20Sopenharmony_ci *     (kernel -> user): which minor device the information is about.
118c2ecf20Sopenharmony_ci *     If we do not operate on minors, but on connections or resources,
128c2ecf20Sopenharmony_ci *     the minor value shall be (~0), and the attribute DRBD_NLA_CFG_CONTEXT
138c2ecf20Sopenharmony_ci *     is used instead.
148c2ecf20Sopenharmony_ci * @flags: possible operation modifiers (relevant only for user->kernel):
158c2ecf20Sopenharmony_ci *     DRBD_GENL_F_SET_DEFAULTS
168c2ecf20Sopenharmony_ci * @volume:
178c2ecf20Sopenharmony_ci *     When creating a new minor (adding it to a resource), the resource needs
188c2ecf20Sopenharmony_ci *     to know which volume number within the resource this is supposed to be.
198c2ecf20Sopenharmony_ci *     The volume number corresponds to the same volume number on the remote side,
208c2ecf20Sopenharmony_ci *     whereas the minor number on the remote side may be different
218c2ecf20Sopenharmony_ci *     (union with flags).
228c2ecf20Sopenharmony_ci * @ret_code: kernel->userland unicast cfg reply return code (union with flags);
238c2ecf20Sopenharmony_ci */
248c2ecf20Sopenharmony_cistruct drbd_genlmsghdr {
258c2ecf20Sopenharmony_ci	__u32 minor;
268c2ecf20Sopenharmony_ci	union {
278c2ecf20Sopenharmony_ci	__u32 flags;
288c2ecf20Sopenharmony_ci	__s32 ret_code;
298c2ecf20Sopenharmony_ci	};
308c2ecf20Sopenharmony_ci};
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci/* To be used in drbd_genlmsghdr.flags */
338c2ecf20Sopenharmony_cienum {
348c2ecf20Sopenharmony_ci	DRBD_GENL_F_SET_DEFAULTS = 1,
358c2ecf20Sopenharmony_ci};
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_cienum drbd_state_info_bcast_reason {
388c2ecf20Sopenharmony_ci	SIB_GET_STATUS_REPLY = 1,
398c2ecf20Sopenharmony_ci	SIB_STATE_CHANGE = 2,
408c2ecf20Sopenharmony_ci	SIB_HELPER_PRE = 3,
418c2ecf20Sopenharmony_ci	SIB_HELPER_POST = 4,
428c2ecf20Sopenharmony_ci	SIB_SYNC_PROGRESS = 5,
438c2ecf20Sopenharmony_ci};
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/* hack around predefined gcc/cpp "linux=1",
468c2ecf20Sopenharmony_ci * we cannot possibly include <1/drbd_genl.h> */
478c2ecf20Sopenharmony_ci#undef linux
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci#include <linux/drbd.h>
508c2ecf20Sopenharmony_ci#define GENL_MAGIC_VERSION	API_VERSION
518c2ecf20Sopenharmony_ci#define GENL_MAGIC_FAMILY	drbd
528c2ecf20Sopenharmony_ci#define GENL_MAGIC_FAMILY_HDRSZ	sizeof(struct drbd_genlmsghdr)
538c2ecf20Sopenharmony_ci#define GENL_MAGIC_INCLUDE_FILE <linux/drbd_genl.h>
548c2ecf20Sopenharmony_ci#include <linux/genl_magic_struct.h>
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci#endif
57