]> git.ipfire.org Git - thirdparty/mdadm.git/blob - mdmon.h
Remove mgr_pipe for communicating from manage to monitor.
[thirdparty/mdadm.git] / mdmon.h
1 #ifdef DEBUG
2 #define dprintf(fmt, arg...) \
3 fprintf(stderr, fmt, ##arg)
4 #else
5 #define dprintf(fmt, arg...) \
6 ({ if (0) fprintf(stderr, fmt, ##arg); 0; })
7 #endif
8
9 enum array_state { clear, inactive, suspended, readonly, read_auto,
10 clean, active, write_pending, active_idle, bad_word};
11
12 enum sync_action { idle, reshape, resync, recover, check, repair, bad_action };
13
14
15 struct active_array {
16 struct mdinfo info;
17 struct supertype *container;
18 struct active_array *next, *replaces;
19
20 int action_fd;
21 int resync_start_fd;
22
23 enum array_state prev_state, curr_state, next_state;
24 enum sync_action prev_action, curr_action, next_action;
25
26 int check_degraded; /* flag set by mon, read by manage */
27
28 int devnum;
29
30 unsigned long long resync_start;
31 };
32
33 /*
34 * Metadata updates are handled by the monitor thread,
35 * as it has exclusive access to the metadata.
36 * When the manager want to updates metadata, either
37 * for it's own reason (e.g. committing a spare) or
38 * on behalf of mdadm, it creates a metadata_update
39 * structure and queues it to the monitor.
40 * Updates are created and processed by code under the
41 * superswitch. All common code sees them as opaque
42 * blobs.
43 */
44 struct metadata_update {
45 int len;
46 char *buf;
47 void *space; /* allocated space that monitor will use */
48 struct metadata_update *next;
49 };
50 extern struct metadata_update *update_queue, *update_queue_handled;
51
52 #define MD_MAJOR 9
53
54 extern struct active_array *container;
55 extern struct active_array *discard_this;
56 extern struct active_array *pending_discard;
57 extern struct md_generic_cmd *active_cmd;
58
59
60 void remove_pidfile(char *devname);
61 void do_monitor(struct supertype *container);
62 void do_manager(struct supertype *container);
63
64 int read_dev_state(int fd);
65
66 struct mdstat_ent *mdstat_read(int hold, int start);
67
68 extern int exit_now, manager_ready;
69 extern int mon_tid, mgr_tid;