18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef DRBD_STATE_CHANGE_H
38c2ecf20Sopenharmony_ci#define DRBD_STATE_CHANGE_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_cistruct drbd_resource_state_change {
68c2ecf20Sopenharmony_ci	struct drbd_resource *resource;
78c2ecf20Sopenharmony_ci	enum drbd_role role[2];
88c2ecf20Sopenharmony_ci	bool susp[2];
98c2ecf20Sopenharmony_ci	bool susp_nod[2];
108c2ecf20Sopenharmony_ci	bool susp_fen[2];
118c2ecf20Sopenharmony_ci};
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_cistruct drbd_device_state_change {
148c2ecf20Sopenharmony_ci	struct drbd_device *device;
158c2ecf20Sopenharmony_ci	enum drbd_disk_state disk_state[2];
168c2ecf20Sopenharmony_ci};
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_cistruct drbd_connection_state_change {
198c2ecf20Sopenharmony_ci	struct drbd_connection *connection;
208c2ecf20Sopenharmony_ci	enum drbd_conns cstate[2];  /* drbd9: enum drbd_conn_state */
218c2ecf20Sopenharmony_ci	enum drbd_role peer_role[2];
228c2ecf20Sopenharmony_ci};
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_cistruct drbd_peer_device_state_change {
258c2ecf20Sopenharmony_ci	struct drbd_peer_device *peer_device;
268c2ecf20Sopenharmony_ci	enum drbd_disk_state disk_state[2];
278c2ecf20Sopenharmony_ci	enum drbd_conns repl_state[2];  /* drbd9: enum drbd_repl_state */
288c2ecf20Sopenharmony_ci	bool resync_susp_user[2];
298c2ecf20Sopenharmony_ci	bool resync_susp_peer[2];
308c2ecf20Sopenharmony_ci	bool resync_susp_dependency[2];
318c2ecf20Sopenharmony_ci};
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_cistruct drbd_state_change {
348c2ecf20Sopenharmony_ci	struct list_head list;
358c2ecf20Sopenharmony_ci	unsigned int n_devices;
368c2ecf20Sopenharmony_ci	unsigned int n_connections;
378c2ecf20Sopenharmony_ci	struct drbd_resource_state_change resource[1];
388c2ecf20Sopenharmony_ci	struct drbd_device_state_change *devices;
398c2ecf20Sopenharmony_ci	struct drbd_connection_state_change *connections;
408c2ecf20Sopenharmony_ci	struct drbd_peer_device_state_change *peer_devices;
418c2ecf20Sopenharmony_ci};
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ciextern struct drbd_state_change *remember_old_state(struct drbd_resource *, gfp_t);
448c2ecf20Sopenharmony_ciextern void copy_old_to_new_state_change(struct drbd_state_change *);
458c2ecf20Sopenharmony_ciextern void forget_state_change(struct drbd_state_change *);
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ciextern int notify_resource_state_change(struct sk_buff *,
488c2ecf20Sopenharmony_ci					 unsigned int,
498c2ecf20Sopenharmony_ci					 struct drbd_resource_state_change *,
508c2ecf20Sopenharmony_ci					 enum drbd_notification_type type);
518c2ecf20Sopenharmony_ciextern int notify_connection_state_change(struct sk_buff *,
528c2ecf20Sopenharmony_ci					   unsigned int,
538c2ecf20Sopenharmony_ci					   struct drbd_connection_state_change *,
548c2ecf20Sopenharmony_ci					   enum drbd_notification_type type);
558c2ecf20Sopenharmony_ciextern int notify_device_state_change(struct sk_buff *,
568c2ecf20Sopenharmony_ci				       unsigned int,
578c2ecf20Sopenharmony_ci				       struct drbd_device_state_change *,
588c2ecf20Sopenharmony_ci				       enum drbd_notification_type type);
598c2ecf20Sopenharmony_ciextern int notify_peer_device_state_change(struct sk_buff *,
608c2ecf20Sopenharmony_ci					    unsigned int,
618c2ecf20Sopenharmony_ci					    struct drbd_peer_device_state_change *,
628c2ecf20Sopenharmony_ci					    enum drbd_notification_type type);
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci#endif  /* DRBD_STATE_CHANGE_H */
65