1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef DRBD_STATE_CHANGE_H
3 #define DRBD_STATE_CHANGE_H
4 
5 struct drbd_resource_state_change {
6 	struct drbd_resource *resource;
7 	enum drbd_role role[2];
8 	bool susp[2];
9 	bool susp_nod[2];
10 	bool susp_fen[2];
11 };
12 
13 struct drbd_device_state_change {
14 	struct drbd_device *device;
15 	enum drbd_disk_state disk_state[2];
16 };
17 
18 struct drbd_connection_state_change {
19 	struct drbd_connection *connection;
20 	enum drbd_conns cstate[2];  /* drbd9: enum drbd_conn_state */
21 	enum drbd_role peer_role[2];
22 };
23 
24 struct drbd_peer_device_state_change {
25 	struct drbd_peer_device *peer_device;
26 	enum drbd_disk_state disk_state[2];
27 	enum drbd_conns repl_state[2];  /* drbd9: enum drbd_repl_state */
28 	bool resync_susp_user[2];
29 	bool resync_susp_peer[2];
30 	bool resync_susp_dependency[2];
31 };
32 
33 struct drbd_state_change {
34 	struct list_head list;
35 	unsigned int n_devices;
36 	unsigned int n_connections;
37 	struct drbd_resource_state_change resource[1];
38 	struct drbd_device_state_change *devices;
39 	struct drbd_connection_state_change *connections;
40 	struct drbd_peer_device_state_change *peer_devices;
41 };
42 
43 extern struct drbd_state_change *remember_old_state(struct drbd_resource *, gfp_t);
44 extern void copy_old_to_new_state_change(struct drbd_state_change *);
45 extern void forget_state_change(struct drbd_state_change *);
46 
47 extern void notify_resource_state_change(struct sk_buff *,
48 					 unsigned int,
49 					 struct drbd_resource_state_change *,
50 					 enum drbd_notification_type type);
51 extern void notify_connection_state_change(struct sk_buff *,
52 					   unsigned int,
53 					   struct drbd_connection_state_change *,
54 					   enum drbd_notification_type type);
55 extern void notify_device_state_change(struct sk_buff *,
56 				       unsigned int,
57 				       struct drbd_device_state_change *,
58 				       enum drbd_notification_type type);
59 extern void notify_peer_device_state_change(struct sk_buff *,
60 					    unsigned int,
61 					    struct drbd_peer_device_state_change *,
62 					    enum drbd_notification_type type);
63 
64 #endif  /* DRBD_STATE_CHANGE_H */
65