]>
Commit | Line | Data |
---|---|---|
f7dd881f DW |
1 | /* |
2 | * Copyright (C) 2008 Intel Corporation | |
3 | * | |
4 | * mdmon socket / message handling | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify it | |
7 | * under the terms and conditions of the GNU General Public License, | |
8 | * version 2, as published by the Free Software Foundation. | |
9 | * | |
10 | * This program is distributed in the hope it will be useful, but WITHOUT | |
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
13 | * more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License along with | |
16 | * this program; if not, write to the Free Software Foundation, Inc., | |
17 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | |
18 | */ | |
19 | ||
20 | struct mdinfo; | |
21 | struct md_message { | |
22 | int seq; | |
23 | int num_bytes; | |
24 | void *buf; | |
25 | }; | |
26 | ||
27 | enum md_message_action { | |
28 | md_action_ping_monitor, | |
29 | md_action_remove_device, | |
30 | }; | |
31 | ||
32 | struct md_generic_cmd { | |
33 | enum md_message_action action; | |
34 | }; | |
35 | ||
36 | struct md_remove_device_cmd { | |
37 | enum md_message_action action; | |
38 | dev_t rdev; | |
39 | }; | |
40 | ||
41 | /* union of all known command types, used to sanity check ->num_bytes | |
42 | * on the receive path | |
43 | */ | |
44 | union md_message_commands { | |
45 | struct md_generic_cmd generic; | |
46 | struct md_remove_device_cmd remove; | |
47 | }; | |
48 | ||
49 | extern const int start_magic; | |
50 | extern const int end_magic; | |
51 | ||
52 | extern int receive_message(int fd, struct md_message *msg, int tmo); | |
53 | extern int send_message(int fd, struct md_message *msg, int tmo); | |
54 | extern int ack(int fd, int seq, int tmo); | |
55 | extern int nack(int fd, int err, int tmo); | |
56 | extern int connect_monitor(char *devname); | |
57 | extern int ping_monitor(char *devname); | |
58 | extern int send_remove_device(int fd, dev_t rdev, int seq, int tmo); | |
59 |