8356b250faae129faa137e2131ba9f5fe5f857f2
[platform/upstream/multipath-tools.git] / multipathd / main.h
1 #ifndef MAIN_H
2 #define MAIN_H
3
4 #define MAPGCINT 5
5
6 enum daemon_status {
7         DAEMON_INIT = 0,
8         DAEMON_START,
9         DAEMON_CONFIGURE,
10         DAEMON_IDLE,
11         DAEMON_RUNNING,
12         DAEMON_SHUTDOWN,
13         DAEMON_STATUS_SIZE,
14 };
15
16 enum remove_path_result {
17         REMOVE_PATH_FAILURE = 0x0, /* path could not be removed. It is still
18                                     * part of the kernel map, but its state
19                                     * is set to INIT_REMOVED, and it will be
20                                     * removed at the next possible occassion */
21         REMOVE_PATH_SUCCESS = 0x1, /* path was removed */
22         REMOVE_PATH_DELAY = 0x2, /* path is set to be removed later. it
23                                   * currently still exists and is part of the
24                                   * kernel map */
25         REMOVE_PATH_MAP_ERROR = 0x5, /* map was removed because of error. value
26                                       * includes REMOVE_PATH_SUCCESS bit
27                                       * because the path was also removed */
28 };
29
30 struct prout_param_descriptor;
31 struct prin_resp;
32
33 extern pid_t daemon_pid;
34 extern int uxsock_timeout;
35
36 void exit_daemon(void);
37 const char * daemon_status(void);
38 enum daemon_status wait_for_state_change_if(enum daemon_status oldstate,
39                                             unsigned long ms);
40 void schedule_reconfigure(enum force_reload_types requested_type);
41 int need_to_delay_reconfig (struct vectors *);
42 int ev_add_path (struct path *, struct vectors *, int);
43 int ev_remove_path (struct path *, struct vectors *, int);
44 int ev_add_map (char *, const char *, struct vectors *);
45 int ev_remove_map (char *, char *, int, struct vectors *);
46 int flush_map(struct multipath *, struct vectors *, int);
47 void * mpath_alloc_prin_response(int prin_sa);
48 int prin_do_scsi_ioctl(char *, int rq_servact, struct prin_resp * resp,
49                        int noisy);
50 void dumpHex(const char * , int len, int no_ascii);
51 int prout_do_scsi_ioctl(char * , int rq_servact, int rq_scope,
52                         unsigned int rq_type,
53                         struct prout_param_descriptor *param, int noisy);
54 int mpath_pr_event_handle(struct path *pp);
55 void * mpath_pr_event_handler_fn (void * );
56 int update_map_pr(struct multipath *mpp);
57 void * mpath_pr_event_handler_fn (void * pathp );
58 void handle_signals(bool);
59 int __setup_multipath (struct vectors * vecs, struct multipath * mpp,
60                        int reset);
61 #define setup_multipath(vecs, mpp) __setup_multipath(vecs, mpp, 1)
62 int update_multipath (struct vectors *vecs, char *mapname, int reset);
63 int reload_and_sync_map(struct multipath *mpp, struct vectors *vecs,
64                         int refresh);
65
66 void handle_path_wwid_change(struct path *pp, struct vectors *vecs);
67 bool check_path_wwid_change(struct path *pp);
68 int finish_path_init(struct path *pp, struct vectors * vecs);
69 #endif /* MAIN_H */