18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci  drbd.h
48c2ecf20Sopenharmony_ci  Kernel module for 2.6.x Kernels
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci  This file is part of DRBD by Philipp Reisner and Lars Ellenberg.
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci  Copyright (C) 2001-2008, LINBIT Information Technologies GmbH.
98c2ecf20Sopenharmony_ci  Copyright (C) 2001-2008, Philipp Reisner <philipp.reisner@linbit.com>.
108c2ecf20Sopenharmony_ci  Copyright (C) 2001-2008, Lars Ellenberg <lars.ellenberg@linbit.com>.
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci*/
148c2ecf20Sopenharmony_ci#ifndef DRBD_H
158c2ecf20Sopenharmony_ci#define DRBD_H
168c2ecf20Sopenharmony_ci#include <asm/types.h>
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#ifdef __KERNEL__
198c2ecf20Sopenharmony_ci#include <linux/types.h>
208c2ecf20Sopenharmony_ci#include <asm/byteorder.h>
218c2ecf20Sopenharmony_ci#else
228c2ecf20Sopenharmony_ci#include <sys/types.h>
238c2ecf20Sopenharmony_ci#include <sys/wait.h>
248c2ecf20Sopenharmony_ci#include <limits.h>
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/* Although the Linux source code makes a difference between
278c2ecf20Sopenharmony_ci   generic endianness and the bitfields' endianness, there is no
288c2ecf20Sopenharmony_ci   architecture as of Linux-2.6.24-rc4 where the bitfields' endianness
298c2ecf20Sopenharmony_ci   does not match the generic endianness. */
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#if __BYTE_ORDER == __LITTLE_ENDIAN
328c2ecf20Sopenharmony_ci#define __LITTLE_ENDIAN_BITFIELD
338c2ecf20Sopenharmony_ci#elif __BYTE_ORDER == __BIG_ENDIAN
348c2ecf20Sopenharmony_ci#define __BIG_ENDIAN_BITFIELD
358c2ecf20Sopenharmony_ci#else
368c2ecf20Sopenharmony_ci# error "sorry, weird endianness on this box"
378c2ecf20Sopenharmony_ci#endif
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#endif
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciextern const char *drbd_buildtag(void);
428c2ecf20Sopenharmony_ci#define REL_VERSION "8.4.11"
438c2ecf20Sopenharmony_ci#define API_VERSION 1
448c2ecf20Sopenharmony_ci#define PRO_VERSION_MIN 86
458c2ecf20Sopenharmony_ci#define PRO_VERSION_MAX 101
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_cienum drbd_io_error_p {
498c2ecf20Sopenharmony_ci	EP_PASS_ON, /* FIXME should the better be named "Ignore"? */
508c2ecf20Sopenharmony_ci	EP_CALL_HELPER,
518c2ecf20Sopenharmony_ci	EP_DETACH
528c2ecf20Sopenharmony_ci};
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_cienum drbd_fencing_p {
558c2ecf20Sopenharmony_ci	FP_NOT_AVAIL = -1, /* Not a policy */
568c2ecf20Sopenharmony_ci	FP_DONT_CARE = 0,
578c2ecf20Sopenharmony_ci	FP_RESOURCE,
588c2ecf20Sopenharmony_ci	FP_STONITH
598c2ecf20Sopenharmony_ci};
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_cienum drbd_disconnect_p {
628c2ecf20Sopenharmony_ci	DP_RECONNECT,
638c2ecf20Sopenharmony_ci	DP_DROP_NET_CONF,
648c2ecf20Sopenharmony_ci	DP_FREEZE_IO
658c2ecf20Sopenharmony_ci};
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_cienum drbd_after_sb_p {
688c2ecf20Sopenharmony_ci	ASB_DISCONNECT,
698c2ecf20Sopenharmony_ci	ASB_DISCARD_YOUNGER_PRI,
708c2ecf20Sopenharmony_ci	ASB_DISCARD_OLDER_PRI,
718c2ecf20Sopenharmony_ci	ASB_DISCARD_ZERO_CHG,
728c2ecf20Sopenharmony_ci	ASB_DISCARD_LEAST_CHG,
738c2ecf20Sopenharmony_ci	ASB_DISCARD_LOCAL,
748c2ecf20Sopenharmony_ci	ASB_DISCARD_REMOTE,
758c2ecf20Sopenharmony_ci	ASB_CONSENSUS,
768c2ecf20Sopenharmony_ci	ASB_DISCARD_SECONDARY,
778c2ecf20Sopenharmony_ci	ASB_CALL_HELPER,
788c2ecf20Sopenharmony_ci	ASB_VIOLENTLY
798c2ecf20Sopenharmony_ci};
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_cienum drbd_on_no_data {
828c2ecf20Sopenharmony_ci	OND_IO_ERROR,
838c2ecf20Sopenharmony_ci	OND_SUSPEND_IO
848c2ecf20Sopenharmony_ci};
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_cienum drbd_on_congestion {
878c2ecf20Sopenharmony_ci	OC_BLOCK,
888c2ecf20Sopenharmony_ci	OC_PULL_AHEAD,
898c2ecf20Sopenharmony_ci	OC_DISCONNECT,
908c2ecf20Sopenharmony_ci};
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_cienum drbd_read_balancing {
938c2ecf20Sopenharmony_ci	RB_PREFER_LOCAL,
948c2ecf20Sopenharmony_ci	RB_PREFER_REMOTE,
958c2ecf20Sopenharmony_ci	RB_ROUND_ROBIN,
968c2ecf20Sopenharmony_ci	RB_LEAST_PENDING,
978c2ecf20Sopenharmony_ci	RB_CONGESTED_REMOTE,
988c2ecf20Sopenharmony_ci	RB_32K_STRIPING,
998c2ecf20Sopenharmony_ci	RB_64K_STRIPING,
1008c2ecf20Sopenharmony_ci	RB_128K_STRIPING,
1018c2ecf20Sopenharmony_ci	RB_256K_STRIPING,
1028c2ecf20Sopenharmony_ci	RB_512K_STRIPING,
1038c2ecf20Sopenharmony_ci	RB_1M_STRIPING,
1048c2ecf20Sopenharmony_ci};
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci/* KEEP the order, do not delete or insert. Only append. */
1078c2ecf20Sopenharmony_cienum drbd_ret_code {
1088c2ecf20Sopenharmony_ci	ERR_CODE_BASE		= 100,
1098c2ecf20Sopenharmony_ci	NO_ERROR		= 101,
1108c2ecf20Sopenharmony_ci	ERR_LOCAL_ADDR		= 102,
1118c2ecf20Sopenharmony_ci	ERR_PEER_ADDR		= 103,
1128c2ecf20Sopenharmony_ci	ERR_OPEN_DISK		= 104,
1138c2ecf20Sopenharmony_ci	ERR_OPEN_MD_DISK	= 105,
1148c2ecf20Sopenharmony_ci	ERR_DISK_NOT_BDEV	= 107,
1158c2ecf20Sopenharmony_ci	ERR_MD_NOT_BDEV		= 108,
1168c2ecf20Sopenharmony_ci	ERR_DISK_TOO_SMALL	= 111,
1178c2ecf20Sopenharmony_ci	ERR_MD_DISK_TOO_SMALL	= 112,
1188c2ecf20Sopenharmony_ci	ERR_BDCLAIM_DISK	= 114,
1198c2ecf20Sopenharmony_ci	ERR_BDCLAIM_MD_DISK	= 115,
1208c2ecf20Sopenharmony_ci	ERR_MD_IDX_INVALID	= 116,
1218c2ecf20Sopenharmony_ci	ERR_IO_MD_DISK		= 118,
1228c2ecf20Sopenharmony_ci	ERR_MD_INVALID          = 119,
1238c2ecf20Sopenharmony_ci	ERR_AUTH_ALG		= 120,
1248c2ecf20Sopenharmony_ci	ERR_AUTH_ALG_ND		= 121,
1258c2ecf20Sopenharmony_ci	ERR_NOMEM		= 122,
1268c2ecf20Sopenharmony_ci	ERR_DISCARD_IMPOSSIBLE	= 123,
1278c2ecf20Sopenharmony_ci	ERR_DISK_CONFIGURED	= 124,
1288c2ecf20Sopenharmony_ci	ERR_NET_CONFIGURED	= 125,
1298c2ecf20Sopenharmony_ci	ERR_MANDATORY_TAG	= 126,
1308c2ecf20Sopenharmony_ci	ERR_MINOR_INVALID	= 127,
1318c2ecf20Sopenharmony_ci	ERR_INTR		= 129, /* EINTR */
1328c2ecf20Sopenharmony_ci	ERR_RESIZE_RESYNC	= 130,
1338c2ecf20Sopenharmony_ci	ERR_NO_PRIMARY		= 131,
1348c2ecf20Sopenharmony_ci	ERR_RESYNC_AFTER	= 132,
1358c2ecf20Sopenharmony_ci	ERR_RESYNC_AFTER_CYCLE	= 133,
1368c2ecf20Sopenharmony_ci	ERR_PAUSE_IS_SET	= 134,
1378c2ecf20Sopenharmony_ci	ERR_PAUSE_IS_CLEAR	= 135,
1388c2ecf20Sopenharmony_ci	ERR_PACKET_NR		= 137,
1398c2ecf20Sopenharmony_ci	ERR_NO_DISK		= 138,
1408c2ecf20Sopenharmony_ci	ERR_NOT_PROTO_C		= 139,
1418c2ecf20Sopenharmony_ci	ERR_NOMEM_BITMAP	= 140,
1428c2ecf20Sopenharmony_ci	ERR_INTEGRITY_ALG	= 141, /* DRBD 8.2 only */
1438c2ecf20Sopenharmony_ci	ERR_INTEGRITY_ALG_ND	= 142, /* DRBD 8.2 only */
1448c2ecf20Sopenharmony_ci	ERR_CPU_MASK_PARSE	= 143, /* DRBD 8.2 only */
1458c2ecf20Sopenharmony_ci	ERR_CSUMS_ALG		= 144, /* DRBD 8.2 only */
1468c2ecf20Sopenharmony_ci	ERR_CSUMS_ALG_ND	= 145, /* DRBD 8.2 only */
1478c2ecf20Sopenharmony_ci	ERR_VERIFY_ALG		= 146, /* DRBD 8.2 only */
1488c2ecf20Sopenharmony_ci	ERR_VERIFY_ALG_ND	= 147, /* DRBD 8.2 only */
1498c2ecf20Sopenharmony_ci	ERR_CSUMS_RESYNC_RUNNING= 148, /* DRBD 8.2 only */
1508c2ecf20Sopenharmony_ci	ERR_VERIFY_RUNNING	= 149, /* DRBD 8.2 only */
1518c2ecf20Sopenharmony_ci	ERR_DATA_NOT_CURRENT	= 150,
1528c2ecf20Sopenharmony_ci	ERR_CONNECTED		= 151, /* DRBD 8.3 only */
1538c2ecf20Sopenharmony_ci	ERR_PERM		= 152,
1548c2ecf20Sopenharmony_ci	ERR_NEED_APV_93		= 153,
1558c2ecf20Sopenharmony_ci	ERR_STONITH_AND_PROT_A  = 154,
1568c2ecf20Sopenharmony_ci	ERR_CONG_NOT_PROTO_A	= 155,
1578c2ecf20Sopenharmony_ci	ERR_PIC_AFTER_DEP	= 156,
1588c2ecf20Sopenharmony_ci	ERR_PIC_PEER_DEP	= 157,
1598c2ecf20Sopenharmony_ci	ERR_RES_NOT_KNOWN	= 158,
1608c2ecf20Sopenharmony_ci	ERR_RES_IN_USE		= 159,
1618c2ecf20Sopenharmony_ci	ERR_MINOR_CONFIGURED    = 160,
1628c2ecf20Sopenharmony_ci	ERR_MINOR_OR_VOLUME_EXISTS = 161,
1638c2ecf20Sopenharmony_ci	ERR_INVALID_REQUEST	= 162,
1648c2ecf20Sopenharmony_ci	ERR_NEED_APV_100	= 163,
1658c2ecf20Sopenharmony_ci	ERR_NEED_ALLOW_TWO_PRI  = 164,
1668c2ecf20Sopenharmony_ci	ERR_MD_UNCLEAN          = 165,
1678c2ecf20Sopenharmony_ci	ERR_MD_LAYOUT_CONNECTED = 166,
1688c2ecf20Sopenharmony_ci	ERR_MD_LAYOUT_TOO_BIG   = 167,
1698c2ecf20Sopenharmony_ci	ERR_MD_LAYOUT_TOO_SMALL = 168,
1708c2ecf20Sopenharmony_ci	ERR_MD_LAYOUT_NO_FIT    = 169,
1718c2ecf20Sopenharmony_ci	ERR_IMPLICIT_SHRINK     = 170,
1728c2ecf20Sopenharmony_ci	/* insert new ones above this line */
1738c2ecf20Sopenharmony_ci	AFTER_LAST_ERR_CODE
1748c2ecf20Sopenharmony_ci};
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ci#define DRBD_PROT_A   1
1778c2ecf20Sopenharmony_ci#define DRBD_PROT_B   2
1788c2ecf20Sopenharmony_ci#define DRBD_PROT_C   3
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_cienum drbd_role {
1818c2ecf20Sopenharmony_ci	R_UNKNOWN = 0,
1828c2ecf20Sopenharmony_ci	R_PRIMARY = 1,     /* role */
1838c2ecf20Sopenharmony_ci	R_SECONDARY = 2,   /* role */
1848c2ecf20Sopenharmony_ci	R_MASK = 3,
1858c2ecf20Sopenharmony_ci};
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ci/* The order of these constants is important.
1888c2ecf20Sopenharmony_ci * The lower ones (<C_WF_REPORT_PARAMS) indicate
1898c2ecf20Sopenharmony_ci * that there is no socket!
1908c2ecf20Sopenharmony_ci * >=C_WF_REPORT_PARAMS ==> There is a socket
1918c2ecf20Sopenharmony_ci */
1928c2ecf20Sopenharmony_cienum drbd_conns {
1938c2ecf20Sopenharmony_ci	C_STANDALONE,
1948c2ecf20Sopenharmony_ci	C_DISCONNECTING,  /* Temporal state on the way to StandAlone. */
1958c2ecf20Sopenharmony_ci	C_UNCONNECTED,    /* >= C_UNCONNECTED -> inc_net() succeeds */
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ci	/* These temporal states are all used on the way
1988c2ecf20Sopenharmony_ci	 * from >= C_CONNECTED to Unconnected.
1998c2ecf20Sopenharmony_ci	 * The 'disconnect reason' states
2008c2ecf20Sopenharmony_ci	 * I do not allow to change between them. */
2018c2ecf20Sopenharmony_ci	C_TIMEOUT,
2028c2ecf20Sopenharmony_ci	C_BROKEN_PIPE,
2038c2ecf20Sopenharmony_ci	C_NETWORK_FAILURE,
2048c2ecf20Sopenharmony_ci	C_PROTOCOL_ERROR,
2058c2ecf20Sopenharmony_ci	C_TEAR_DOWN,
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_ci	C_WF_CONNECTION,
2088c2ecf20Sopenharmony_ci	C_WF_REPORT_PARAMS, /* we have a socket */
2098c2ecf20Sopenharmony_ci	C_CONNECTED,      /* we have introduced each other */
2108c2ecf20Sopenharmony_ci	C_STARTING_SYNC_S,  /* starting full sync by admin request. */
2118c2ecf20Sopenharmony_ci	C_STARTING_SYNC_T,  /* starting full sync by admin request. */
2128c2ecf20Sopenharmony_ci	C_WF_BITMAP_S,
2138c2ecf20Sopenharmony_ci	C_WF_BITMAP_T,
2148c2ecf20Sopenharmony_ci	C_WF_SYNC_UUID,
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ci	/* All SyncStates are tested with this comparison
2178c2ecf20Sopenharmony_ci	 * xx >= C_SYNC_SOURCE && xx <= C_PAUSED_SYNC_T */
2188c2ecf20Sopenharmony_ci	C_SYNC_SOURCE,
2198c2ecf20Sopenharmony_ci	C_SYNC_TARGET,
2208c2ecf20Sopenharmony_ci	C_VERIFY_S,
2218c2ecf20Sopenharmony_ci	C_VERIFY_T,
2228c2ecf20Sopenharmony_ci	C_PAUSED_SYNC_S,
2238c2ecf20Sopenharmony_ci	C_PAUSED_SYNC_T,
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci	C_AHEAD,
2268c2ecf20Sopenharmony_ci	C_BEHIND,
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci	C_MASK = 31
2298c2ecf20Sopenharmony_ci};
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_cienum drbd_disk_state {
2328c2ecf20Sopenharmony_ci	D_DISKLESS,
2338c2ecf20Sopenharmony_ci	D_ATTACHING,      /* In the process of reading the meta-data */
2348c2ecf20Sopenharmony_ci	D_FAILED,         /* Becomes D_DISKLESS as soon as we told it the peer */
2358c2ecf20Sopenharmony_ci			  /* when >= D_FAILED it is legal to access mdev->ldev */
2368c2ecf20Sopenharmony_ci	D_NEGOTIATING,    /* Late attaching state, we need to talk to the peer */
2378c2ecf20Sopenharmony_ci	D_INCONSISTENT,
2388c2ecf20Sopenharmony_ci	D_OUTDATED,
2398c2ecf20Sopenharmony_ci	D_UNKNOWN,       /* Only used for the peer, never for myself */
2408c2ecf20Sopenharmony_ci	D_CONSISTENT,     /* Might be D_OUTDATED, might be D_UP_TO_DATE ... */
2418c2ecf20Sopenharmony_ci	D_UP_TO_DATE,       /* Only this disk state allows applications' IO ! */
2428c2ecf20Sopenharmony_ci	D_MASK = 15
2438c2ecf20Sopenharmony_ci};
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_ciunion drbd_state {
2468c2ecf20Sopenharmony_ci/* According to gcc's docs is the ...
2478c2ecf20Sopenharmony_ci * The order of allocation of bit-fields within a unit (C90 6.5.2.1, C99 6.7.2.1).
2488c2ecf20Sopenharmony_ci * Determined by ABI.
2498c2ecf20Sopenharmony_ci * pointed out by Maxim Uvarov q<muvarov@ru.mvista.com>
2508c2ecf20Sopenharmony_ci * even though we transmit as "cpu_to_be32(state)",
2518c2ecf20Sopenharmony_ci * the offsets of the bitfields still need to be swapped
2528c2ecf20Sopenharmony_ci * on different endianness.
2538c2ecf20Sopenharmony_ci */
2548c2ecf20Sopenharmony_ci	struct {
2558c2ecf20Sopenharmony_ci#if defined(__LITTLE_ENDIAN_BITFIELD)
2568c2ecf20Sopenharmony_ci		unsigned role:2 ;   /* 3/4	 primary/secondary/unknown */
2578c2ecf20Sopenharmony_ci		unsigned peer:2 ;   /* 3/4	 primary/secondary/unknown */
2588c2ecf20Sopenharmony_ci		unsigned conn:5 ;   /* 17/32	 cstates */
2598c2ecf20Sopenharmony_ci		unsigned disk:4 ;   /* 8/16	 from D_DISKLESS to D_UP_TO_DATE */
2608c2ecf20Sopenharmony_ci		unsigned pdsk:4 ;   /* 8/16	 from D_DISKLESS to D_UP_TO_DATE */
2618c2ecf20Sopenharmony_ci		unsigned susp:1 ;   /* 2/2	 IO suspended no/yes (by user) */
2628c2ecf20Sopenharmony_ci		unsigned aftr_isp:1 ; /* isp .. imposed sync pause */
2638c2ecf20Sopenharmony_ci		unsigned peer_isp:1 ;
2648c2ecf20Sopenharmony_ci		unsigned user_isp:1 ;
2658c2ecf20Sopenharmony_ci		unsigned susp_nod:1 ; /* IO suspended because no data */
2668c2ecf20Sopenharmony_ci		unsigned susp_fen:1 ; /* IO suspended because fence peer handler runs*/
2678c2ecf20Sopenharmony_ci		unsigned _pad:9;   /* 0	 unused */
2688c2ecf20Sopenharmony_ci#elif defined(__BIG_ENDIAN_BITFIELD)
2698c2ecf20Sopenharmony_ci		unsigned _pad:9;
2708c2ecf20Sopenharmony_ci		unsigned susp_fen:1 ;
2718c2ecf20Sopenharmony_ci		unsigned susp_nod:1 ;
2728c2ecf20Sopenharmony_ci		unsigned user_isp:1 ;
2738c2ecf20Sopenharmony_ci		unsigned peer_isp:1 ;
2748c2ecf20Sopenharmony_ci		unsigned aftr_isp:1 ; /* isp .. imposed sync pause */
2758c2ecf20Sopenharmony_ci		unsigned susp:1 ;   /* 2/2	 IO suspended  no/yes */
2768c2ecf20Sopenharmony_ci		unsigned pdsk:4 ;   /* 8/16	 from D_DISKLESS to D_UP_TO_DATE */
2778c2ecf20Sopenharmony_ci		unsigned disk:4 ;   /* 8/16	 from D_DISKLESS to D_UP_TO_DATE */
2788c2ecf20Sopenharmony_ci		unsigned conn:5 ;   /* 17/32	 cstates */
2798c2ecf20Sopenharmony_ci		unsigned peer:2 ;   /* 3/4	 primary/secondary/unknown */
2808c2ecf20Sopenharmony_ci		unsigned role:2 ;   /* 3/4	 primary/secondary/unknown */
2818c2ecf20Sopenharmony_ci#else
2828c2ecf20Sopenharmony_ci# error "this endianness is not supported"
2838c2ecf20Sopenharmony_ci#endif
2848c2ecf20Sopenharmony_ci	};
2858c2ecf20Sopenharmony_ci	unsigned int i;
2868c2ecf20Sopenharmony_ci};
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_cienum drbd_state_rv {
2898c2ecf20Sopenharmony_ci	SS_CW_NO_NEED = 4,
2908c2ecf20Sopenharmony_ci	SS_CW_SUCCESS = 3,
2918c2ecf20Sopenharmony_ci	SS_NOTHING_TO_DO = 2,
2928c2ecf20Sopenharmony_ci	SS_SUCCESS = 1,
2938c2ecf20Sopenharmony_ci	SS_UNKNOWN_ERROR = 0, /* Used to sleep longer in _drbd_request_state */
2948c2ecf20Sopenharmony_ci	SS_TWO_PRIMARIES = -1,
2958c2ecf20Sopenharmony_ci	SS_NO_UP_TO_DATE_DISK = -2,
2968c2ecf20Sopenharmony_ci	SS_NO_LOCAL_DISK = -4,
2978c2ecf20Sopenharmony_ci	SS_NO_REMOTE_DISK = -5,
2988c2ecf20Sopenharmony_ci	SS_CONNECTED_OUTDATES = -6,
2998c2ecf20Sopenharmony_ci	SS_PRIMARY_NOP = -7,
3008c2ecf20Sopenharmony_ci	SS_RESYNC_RUNNING = -8,
3018c2ecf20Sopenharmony_ci	SS_ALREADY_STANDALONE = -9,
3028c2ecf20Sopenharmony_ci	SS_CW_FAILED_BY_PEER = -10,
3038c2ecf20Sopenharmony_ci	SS_IS_DISKLESS = -11,
3048c2ecf20Sopenharmony_ci	SS_DEVICE_IN_USE = -12,
3058c2ecf20Sopenharmony_ci	SS_NO_NET_CONFIG = -13,
3068c2ecf20Sopenharmony_ci	SS_NO_VERIFY_ALG = -14,       /* drbd-8.2 only */
3078c2ecf20Sopenharmony_ci	SS_NEED_CONNECTION = -15,    /* drbd-8.2 only */
3088c2ecf20Sopenharmony_ci	SS_LOWER_THAN_OUTDATED = -16,
3098c2ecf20Sopenharmony_ci	SS_NOT_SUPPORTED = -17,      /* drbd-8.2 only */
3108c2ecf20Sopenharmony_ci	SS_IN_TRANSIENT_STATE = -18,  /* Retry after the next state change */
3118c2ecf20Sopenharmony_ci	SS_CONCURRENT_ST_CHG = -19,   /* Concurrent cluster side state change! */
3128c2ecf20Sopenharmony_ci	SS_O_VOL_PEER_PRI = -20,
3138c2ecf20Sopenharmony_ci	SS_OUTDATE_WO_CONN = -21,
3148c2ecf20Sopenharmony_ci	SS_AFTER_LAST_ERROR = -22,    /* Keep this at bottom */
3158c2ecf20Sopenharmony_ci};
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci#define SHARED_SECRET_MAX 64
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci#define MDF_CONSISTENT		(1 << 0)
3208c2ecf20Sopenharmony_ci#define MDF_PRIMARY_IND		(1 << 1)
3218c2ecf20Sopenharmony_ci#define MDF_CONNECTED_IND	(1 << 2)
3228c2ecf20Sopenharmony_ci#define MDF_FULL_SYNC		(1 << 3)
3238c2ecf20Sopenharmony_ci#define MDF_WAS_UP_TO_DATE	(1 << 4)
3248c2ecf20Sopenharmony_ci#define MDF_PEER_OUT_DATED	(1 << 5)
3258c2ecf20Sopenharmony_ci#define MDF_CRASHED_PRIMARY	(1 << 6)
3268c2ecf20Sopenharmony_ci#define MDF_AL_CLEAN		(1 << 7)
3278c2ecf20Sopenharmony_ci#define MDF_AL_DISABLED		(1 << 8)
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci#define MAX_PEERS 32
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_cienum drbd_uuid_index {
3328c2ecf20Sopenharmony_ci	UI_CURRENT,
3338c2ecf20Sopenharmony_ci	UI_BITMAP,
3348c2ecf20Sopenharmony_ci	UI_HISTORY_START,
3358c2ecf20Sopenharmony_ci	UI_HISTORY_END,
3368c2ecf20Sopenharmony_ci	UI_SIZE,      /* nl-packet: number of dirty bits */
3378c2ecf20Sopenharmony_ci	UI_FLAGS,     /* nl-packet: flags */
3388c2ecf20Sopenharmony_ci	UI_EXTENDED_SIZE   /* Everything. */
3398c2ecf20Sopenharmony_ci};
3408c2ecf20Sopenharmony_ci
3418c2ecf20Sopenharmony_ci#define HISTORY_UUIDS MAX_PEERS
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_cienum drbd_timeout_flag {
3448c2ecf20Sopenharmony_ci	UT_DEFAULT      = 0,
3458c2ecf20Sopenharmony_ci	UT_DEGRADED     = 1,
3468c2ecf20Sopenharmony_ci	UT_PEER_OUTDATED = 2,
3478c2ecf20Sopenharmony_ci};
3488c2ecf20Sopenharmony_ci
3498c2ecf20Sopenharmony_cienum drbd_notification_type {
3508c2ecf20Sopenharmony_ci	NOTIFY_EXISTS,
3518c2ecf20Sopenharmony_ci	NOTIFY_CREATE,
3528c2ecf20Sopenharmony_ci	NOTIFY_CHANGE,
3538c2ecf20Sopenharmony_ci	NOTIFY_DESTROY,
3548c2ecf20Sopenharmony_ci	NOTIFY_CALL,
3558c2ecf20Sopenharmony_ci	NOTIFY_RESPONSE,
3568c2ecf20Sopenharmony_ci
3578c2ecf20Sopenharmony_ci	NOTIFY_CONTINUES = 0x8000,
3588c2ecf20Sopenharmony_ci	NOTIFY_FLAGS = NOTIFY_CONTINUES,
3598c2ecf20Sopenharmony_ci};
3608c2ecf20Sopenharmony_ci
3618c2ecf20Sopenharmony_cienum drbd_peer_state {
3628c2ecf20Sopenharmony_ci	P_INCONSISTENT = 3,
3638c2ecf20Sopenharmony_ci	P_OUTDATED = 4,
3648c2ecf20Sopenharmony_ci	P_DOWN = 5,
3658c2ecf20Sopenharmony_ci	P_PRIMARY = 6,
3668c2ecf20Sopenharmony_ci	P_FENCING = 7,
3678c2ecf20Sopenharmony_ci};
3688c2ecf20Sopenharmony_ci
3698c2ecf20Sopenharmony_ci#define UUID_JUST_CREATED ((__u64)4)
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_cienum write_ordering_e {
3728c2ecf20Sopenharmony_ci	WO_NONE,
3738c2ecf20Sopenharmony_ci	WO_DRAIN_IO,
3748c2ecf20Sopenharmony_ci	WO_BDEV_FLUSH,
3758c2ecf20Sopenharmony_ci	WO_BIO_BARRIER
3768c2ecf20Sopenharmony_ci};
3778c2ecf20Sopenharmony_ci
3788c2ecf20Sopenharmony_ci/* magic numbers used in meta data and network packets */
3798c2ecf20Sopenharmony_ci#define DRBD_MAGIC 0x83740267
3808c2ecf20Sopenharmony_ci#define DRBD_MAGIC_BIG 0x835a
3818c2ecf20Sopenharmony_ci#define DRBD_MAGIC_100 0x8620ec20
3828c2ecf20Sopenharmony_ci
3838c2ecf20Sopenharmony_ci#define DRBD_MD_MAGIC_07   (DRBD_MAGIC+3)
3848c2ecf20Sopenharmony_ci#define DRBD_MD_MAGIC_08   (DRBD_MAGIC+4)
3858c2ecf20Sopenharmony_ci#define DRBD_MD_MAGIC_84_UNCLEAN	(DRBD_MAGIC+5)
3868c2ecf20Sopenharmony_ci
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ci/* how I came up with this magic?
3898c2ecf20Sopenharmony_ci * base64 decode "actlog==" ;) */
3908c2ecf20Sopenharmony_ci#define DRBD_AL_MAGIC 0x69cb65a2
3918c2ecf20Sopenharmony_ci
3928c2ecf20Sopenharmony_ci/* these are of type "int" */
3938c2ecf20Sopenharmony_ci#define DRBD_MD_INDEX_INTERNAL -1
3948c2ecf20Sopenharmony_ci#define DRBD_MD_INDEX_FLEX_EXT -2
3958c2ecf20Sopenharmony_ci#define DRBD_MD_INDEX_FLEX_INT -3
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_ci#define DRBD_CPU_MASK_SIZE 32
3988c2ecf20Sopenharmony_ci
3998c2ecf20Sopenharmony_ci#endif
400