ia64/xen-unstable

view tools/blktap2/include/tapdisk-message.h @ 19835:edfdeb150f27

Fix buildsystem to detect udev > version 124

udev removed the udevinfo symlink from versions higher than 123 and
xen's build-system could not detect if udev is in place and has the
required version.

Signed-off-by: Marc-A. Dahlhaus <mad@wol.de>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jun 25 13:02:37 2009 +0100 (2009-06-25)
parents 1c627434605e
children
line source
1 /* Copyright (c) 2008, XenSource Inc.
2 * All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above copyright
9 * notice, this list of conditions and the following disclaimer in the
10 * documentation and/or other materials provided with the distribution.
11 * * Neither the name of XenSource Inc. nor the names of its contributors
12 * may be used to endorse or promote products derived from this software
13 * without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
19 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 #ifndef _TAPDISK_MESSAGE_H_
28 #define _TAPDISK_MESSAGE_H_
30 #include <inttypes.h>
32 #define TAPDISK_MESSAGE_MAX_PATH_LENGTH 256
33 #define TAPDISK_MESSAGE_STRING_LENGTH 256
35 #define TAPDISK_MESSAGE_FLAG_SHARED 0x01
36 #define TAPDISK_MESSAGE_FLAG_RDONLY 0x02
37 #define TAPDISK_MESSAGE_FLAG_ADD_CACHE 0x04
38 #define TAPDISK_MESSAGE_FLAG_VHD_INDEX 0x08
39 #define TAPDISK_MESSAGE_FLAG_LOG_DIRTY 0x10
41 typedef struct tapdisk_message tapdisk_message_t;
42 typedef uint8_t tapdisk_message_flag_t;
43 typedef struct tapdisk_message_image tapdisk_message_image_t;
44 typedef struct tapdisk_message_params tapdisk_message_params_t;
45 typedef struct tapdisk_message_string tapdisk_message_string_t;
47 struct tapdisk_message_params {
48 tapdisk_message_flag_t flags;
50 uint8_t storage;
51 uint32_t devnum;
52 uint32_t domid;
53 uint16_t path_len;
54 char path[TAPDISK_MESSAGE_MAX_PATH_LENGTH];
55 };
57 struct tapdisk_message_image {
58 uint64_t sectors;
59 uint32_t sector_size;
60 uint32_t info;
61 };
63 struct tapdisk_message_string {
64 char text[TAPDISK_MESSAGE_STRING_LENGTH];
65 };
67 struct tapdisk_message {
68 uint16_t type;
69 uint16_t cookie;
70 uint16_t drivertype;
72 union {
73 pid_t tapdisk_pid;
74 tapdisk_message_image_t image;
75 tapdisk_message_params_t params;
76 tapdisk_message_string_t string;
77 } u;
78 };
80 enum tapdisk_message_id {
81 TAPDISK_MESSAGE_ERROR = 1,
82 TAPDISK_MESSAGE_RUNTIME_ERROR,
83 TAPDISK_MESSAGE_PID,
84 TAPDISK_MESSAGE_PID_RSP,
85 TAPDISK_MESSAGE_OPEN,
86 TAPDISK_MESSAGE_OPEN_RSP,
87 TAPDISK_MESSAGE_PAUSE,
88 TAPDISK_MESSAGE_PAUSE_RSP,
89 TAPDISK_MESSAGE_RESUME,
90 TAPDISK_MESSAGE_RESUME_RSP,
91 TAPDISK_MESSAGE_CLOSE,
92 TAPDISK_MESSAGE_CLOSE_RSP,
93 TAPDISK_MESSAGE_EXIT,
94 };
96 static inline char *
97 tapdisk_message_name(enum tapdisk_message_id id)
98 {
99 switch (id) {
100 case TAPDISK_MESSAGE_ERROR:
101 return "error";
103 case TAPDISK_MESSAGE_PID:
104 return "pid";
106 case TAPDISK_MESSAGE_PID_RSP:
107 return "pid response";
109 case TAPDISK_MESSAGE_OPEN:
110 return "open";
112 case TAPDISK_MESSAGE_OPEN_RSP:
113 return "open response";
115 case TAPDISK_MESSAGE_PAUSE:
116 return "pause";
118 case TAPDISK_MESSAGE_PAUSE_RSP:
119 return "pause response";
121 case TAPDISK_MESSAGE_RESUME:
122 return "resume";
124 case TAPDISK_MESSAGE_RESUME_RSP:
125 return "resume response";
127 case TAPDISK_MESSAGE_CLOSE:
128 return "close";
130 case TAPDISK_MESSAGE_CLOSE_RSP:
131 return "close response";
133 case TAPDISK_MESSAGE_EXIT:
134 return "exit";
136 default:
137 return "unknown";
138 }
139 }
141 #endif