ia64/xen-unstable

view tools/libxen/include/xen_user.h @ 14045:7819d9332fba

Split the VBD I/O statistics out into a VBD_metrics class. Document the
VBD.type field, and add it to the C bindings (this was already in Xend).

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Tue Feb 20 21:28:19 2007 +0000 (2007-02-20)
parents 462b945e2f41
children 94943f2e1de9
line source
1 /*
2 * Copyright (c) 2006, XenSource Inc.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
19 #ifndef XEN_USER_H
20 #define XEN_USER_H
22 #include "xen_common.h"
23 #include "xen_user_decl.h"
26 /*
27 * The user class.
28 *
29 * A user of the system.
30 */
33 /**
34 * Free the given xen_user. The given handle must have been allocated
35 * by this library.
36 */
37 extern void
38 xen_user_free(xen_user user);
41 typedef struct xen_user_set
42 {
43 size_t size;
44 xen_user *contents[];
45 } xen_user_set;
47 /**
48 * Allocate a xen_user_set of the given size.
49 */
50 extern xen_user_set *
51 xen_user_set_alloc(size_t size);
53 /**
54 * Free the given xen_user_set. The given set must have been allocated
55 * by this library.
56 */
57 extern void
58 xen_user_set_free(xen_user_set *set);
61 typedef struct xen_user_record
62 {
63 xen_user handle;
64 char *uuid;
65 char *short_name;
66 char *fullname;
67 } xen_user_record;
69 /**
70 * Allocate a xen_user_record.
71 */
72 extern xen_user_record *
73 xen_user_record_alloc(void);
75 /**
76 * Free the given xen_user_record, and all referenced values. The
77 * given record must have been allocated by this library.
78 */
79 extern void
80 xen_user_record_free(xen_user_record *record);
83 typedef struct xen_user_record_opt
84 {
85 bool is_record;
86 union
87 {
88 xen_user handle;
89 xen_user_record *record;
90 } u;
91 } xen_user_record_opt;
93 /**
94 * Allocate a xen_user_record_opt.
95 */
96 extern xen_user_record_opt *
97 xen_user_record_opt_alloc(void);
99 /**
100 * Free the given xen_user_record_opt, and all referenced values. The
101 * given record_opt must have been allocated by this library.
102 */
103 extern void
104 xen_user_record_opt_free(xen_user_record_opt *record_opt);
107 typedef struct xen_user_record_set
108 {
109 size_t size;
110 xen_user_record *contents[];
111 } xen_user_record_set;
113 /**
114 * Allocate a xen_user_record_set of the given size.
115 */
116 extern xen_user_record_set *
117 xen_user_record_set_alloc(size_t size);
119 /**
120 * Free the given xen_user_record_set, and all referenced values. The
121 * given set must have been allocated by this library.
122 */
123 extern void
124 xen_user_record_set_free(xen_user_record_set *set);
128 typedef struct xen_user_record_opt_set
129 {
130 size_t size;
131 xen_user_record_opt *contents[];
132 } xen_user_record_opt_set;
134 /**
135 * Allocate a xen_user_record_opt_set of the given size.
136 */
137 extern xen_user_record_opt_set *
138 xen_user_record_opt_set_alloc(size_t size);
140 /**
141 * Free the given xen_user_record_opt_set, and all referenced values.
142 * The given set must have been allocated by this library.
143 */
144 extern void
145 xen_user_record_opt_set_free(xen_user_record_opt_set *set);
148 /**
149 * Get a record containing the current state of the given user.
150 */
151 extern bool
152 xen_user_get_record(xen_session *session, xen_user_record **result, xen_user user);
155 /**
156 * Get a reference to the user instance with the specified UUID.
157 */
158 extern bool
159 xen_user_get_by_uuid(xen_session *session, xen_user *result, char *uuid);
162 /**
163 * Create a new user instance, and return its handle.
164 */
165 extern bool
166 xen_user_create(xen_session *session, xen_user *result, xen_user_record *record);
169 /**
170 * Destroy the specified user instance.
171 */
172 extern bool
173 xen_user_destroy(xen_session *session, xen_user user);
176 /**
177 * Get the uuid field of the given user.
178 */
179 extern bool
180 xen_user_get_uuid(xen_session *session, char **result, xen_user user);
183 /**
184 * Get the short_name field of the given user.
185 */
186 extern bool
187 xen_user_get_short_name(xen_session *session, char **result, xen_user user);
190 /**
191 * Get the fullname field of the given user.
192 */
193 extern bool
194 xen_user_get_fullname(xen_session *session, char **result, xen_user user);
197 /**
198 * Set the fullname field of the given user.
199 */
200 extern bool
201 xen_user_set_fullname(xen_session *session, xen_user user, char *fullname);
204 #endif