162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci#ifndef DRBD_STATE_CHANGE_H
362306a36Sopenharmony_ci#define DRBD_STATE_CHANGE_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_cistruct drbd_resource_state_change {
662306a36Sopenharmony_ci	struct drbd_resource *resource;
762306a36Sopenharmony_ci	enum drbd_role role[2];
862306a36Sopenharmony_ci	bool susp[2];
962306a36Sopenharmony_ci	bool susp_nod[2];
1062306a36Sopenharmony_ci	bool susp_fen[2];
1162306a36Sopenharmony_ci};
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_cistruct drbd_device_state_change {
1462306a36Sopenharmony_ci	struct drbd_device *device;
1562306a36Sopenharmony_ci	enum drbd_disk_state disk_state[2];
1662306a36Sopenharmony_ci};
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_cistruct drbd_connection_state_change {
1962306a36Sopenharmony_ci	struct drbd_connection *connection;
2062306a36Sopenharmony_ci	enum drbd_conns cstate[2];  /* drbd9: enum drbd_conn_state */
2162306a36Sopenharmony_ci	enum drbd_role peer_role[2];
2262306a36Sopenharmony_ci};
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_cistruct drbd_peer_device_state_change {
2562306a36Sopenharmony_ci	struct drbd_peer_device *peer_device;
2662306a36Sopenharmony_ci	enum drbd_disk_state disk_state[2];
2762306a36Sopenharmony_ci	enum drbd_conns repl_state[2];  /* drbd9: enum drbd_repl_state */
2862306a36Sopenharmony_ci	bool resync_susp_user[2];
2962306a36Sopenharmony_ci	bool resync_susp_peer[2];
3062306a36Sopenharmony_ci	bool resync_susp_dependency[2];
3162306a36Sopenharmony_ci};
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_cistruct drbd_state_change {
3462306a36Sopenharmony_ci	struct list_head list;
3562306a36Sopenharmony_ci	unsigned int n_devices;
3662306a36Sopenharmony_ci	unsigned int n_connections;
3762306a36Sopenharmony_ci	struct drbd_resource_state_change resource[1];
3862306a36Sopenharmony_ci	struct drbd_device_state_change *devices;
3962306a36Sopenharmony_ci	struct drbd_connection_state_change *connections;
4062306a36Sopenharmony_ci	struct drbd_peer_device_state_change *peer_devices;
4162306a36Sopenharmony_ci};
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ciextern struct drbd_state_change *remember_old_state(struct drbd_resource *, gfp_t);
4462306a36Sopenharmony_ciextern void copy_old_to_new_state_change(struct drbd_state_change *);
4562306a36Sopenharmony_ciextern void forget_state_change(struct drbd_state_change *);
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ciextern int notify_resource_state_change(struct sk_buff *,
4862306a36Sopenharmony_ci					 unsigned int,
4962306a36Sopenharmony_ci					 struct drbd_resource_state_change *,
5062306a36Sopenharmony_ci					 enum drbd_notification_type type);
5162306a36Sopenharmony_ciextern int notify_connection_state_change(struct sk_buff *,
5262306a36Sopenharmony_ci					   unsigned int,
5362306a36Sopenharmony_ci					   struct drbd_connection_state_change *,
5462306a36Sopenharmony_ci					   enum drbd_notification_type type);
5562306a36Sopenharmony_ciextern int notify_device_state_change(struct sk_buff *,
5662306a36Sopenharmony_ci				       unsigned int,
5762306a36Sopenharmony_ci				       struct drbd_device_state_change *,
5862306a36Sopenharmony_ci				       enum drbd_notification_type type);
5962306a36Sopenharmony_ciextern int notify_peer_device_state_change(struct sk_buff *,
6062306a36Sopenharmony_ci					    unsigned int,
6162306a36Sopenharmony_ci					    struct drbd_peer_device_state_change *,
6262306a36Sopenharmony_ci					    enum drbd_notification_type type);
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci#endif  /* DRBD_STATE_CHANGE_H */
65