debuggers.hg

view tools/libxl/libxl.h @ 22855:1d1eec7e1fb4

xl: Perform minimal validation of virtual disk file while parsing config file

This patch performs some very basic validation on the virtual disk
file passed through the config file. This validation ensures that we
don't go too far with the initialization like spawn qemu and more
while there could be some potentially fundamental issues.

[ Patch fixed up to work with PHYSTYPE_EMPTY 22808:6ec61438713a -iwj ]

Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Kamala Narasimhan <kamala.narasimhan@gmail.com>
date Tue Jan 25 18:09:49 2011 +0000 (2011-01-25)
parents 6ec61438713a
children 67d5b8004947
line source
1 /*
2 * Copyright (C) 2009 Citrix Ltd.
3 * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published
7 * by the Free Software Foundation; version 2.1 only. with the special
8 * exception on linking described in file LICENSE.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 */
16 /*
17 * libxl memory management
18 *
19 * From the point of view of the application (ie, libxl's caller),
20 * struct libxl_ctx* is threadsafe, and all returned allocated
21 * structures are obtained from malloc(), and must be freed by the
22 * caller either directly or by calling an appropriate free function
23 * provided by libxl. Ie the application does not get automatic
24 * assistance from libxl in managing these allocations.
25 *
26 * Specific details are in the header comments which should be found
27 * in libxl.h or libxlutil.h, next to the relevant function
28 * declarations.
29 *
30 * Internally, libxl has a garbage collection scheme which allows much libxl
31 * code to allocate strings etc. for internal use without needing to
32 * free them. These are called "temporary allocations".
33 *
34 * The pool for these temporary allocations, along with any other
35 * thread-specific data which is private to libxl but shared between
36 * libxl functions (such as the current xenstore transaction), is
37 * stored in the "gc context" which is a special enhanced context
38 * structure allocated automatically by convenience macros at every
39 * entry to libxl.
40 *
41 * Every libxl function falls into one of these categories:
42 *
43 * 1. Public functions (declared in libxl.h, libxlutil.h), which may
44 * be called by libxl applications. If a public function returns
45 * any allocated object to its caller, that object must have come
46 * from malloc.
47 *
48 * The definitions of public functions MUST use the gc context
49 * initialisation macros (or do the equivalent work themselves).
50 * These macros will ensure that all temporary allocations will be
51 * automatically freed before the function returns to its caller.
52 *
53 * A public function may be called from within libxl; the call
54 * context initialisation macros will make sure that the internal
55 * caller's context is reused (eg, so that the same xenstore
56 * transaction is used).
57 *
58 * Public functions have names like libxl_foobar.
59 *
60 * 2. Private functions, which may not be called by libxl
61 * applications; they are not declared in libxl.h or libxlutil.h
62 * and they may not be called other than by other libxl functions.
63 *
64 * Private functions should not use the gc context initialisation
65 * macros.
66 *
67 * Private functions have names like libxl__foobar (NB, two underscores).
68 * Also the declaration of such functions must be preceeded by the _hidden
69 * macro.
70 *
71 * Allocations made by a libxl function fall into one of the following
72 * categories (where "object" includes any memory allocation):
73 *
74 * (a) Objects which are not returned to the function's caller.
75 * These should be allocated from the temporary pool.
76 *
77 * (b) Objects which are intended for return to the calling
78 * application. This includes all allocated objects returned by
79 * any public function.
80 *
81 * It may also include objects allocated by an internal function
82 * specifically for eventual return by the function's external
83 * callers, but this situation should be clearly documented in
84 * comments.
85 *
86 * These should be allocated from malloc() et al. and comments
87 * near the function declaration should explain the memory
88 * ownership. If a simple free() by the application is not
89 * sufficient, a suitable public freeing function should be
90 * provided.
91 *
92 * (c) Internal objects whose size and/or lifetime dictate explicit
93 * memory management within libxl. This includes objects which
94 * will be embedded in opaque structures which will be returned to
95 * the libxl caller (more generally, any internal object whose
96 * lifetime exceeds the libxl entrypoint which creates it) and
97 * objects which are so large or numerous that explicit memory
98 * management is required.
99 *
100 * These should be allocated from malloc() et al., and freed
101 * explicitly at the appropriate point. The situation should be
102 * documented in comments.
103 *
104 * (d) Objects which are allocated by internal-only functions and
105 * returned to the function's (therefore, internal) caller but are
106 * strictly for internal use by other parts of libxl. These
107 * should be allocated from the temporary pool.
108 *
109 * Where a function's primary purpose is to return such an object,
110 * it should have a libxl__gc * as it's first argument.
111 *
112 * Note that there are two ways to change an allocation from this
113 * category to the "public" category. Either the implementation
114 * is kept internal and a wrapper function duplicates all memory
115 * allocations so that they are suitable for return to external
116 * callers or the implementation uses plain malloc() et al calls
117 * and an internal wrapper adds the relevant pointers to the gc.
118 * The latter method is preferred for obvious performance reasons.
119 *
120 * No temporary objects allocated from the pool may be explicitly freed.
121 * Therefore public functions which initialize a libxl__gc MUST call
122 * libxl__free_all() before returning.
123 */
124 #ifndef LIBXL_H
125 #define LIBXL_H
127 #include <stdint.h>
128 #include <stdarg.h>
129 #include <netinet/in.h>
130 #include <xenctrl.h>
131 #include <xs.h>
132 #include <sys/wait.h> /* for pid_t */
134 #include "libxl_uuid.h"
136 typedef uint8_t libxl_mac[6];
138 typedef char **libxl_string_list;
139 void libxl_string_list_destroy(libxl_string_list *sl);
141 typedef char **libxl_key_value_list;
142 void libxl_key_value_list_destroy(libxl_key_value_list *kvl);
144 typedef uint32_t libxl_hwcap[8];
146 typedef struct {
147 uint32_t size; /* number of bytes in map */
148 uint8_t *map;
149 } libxl_cpumap;
150 void libxl_cpumap_destroy(libxl_cpumap *map);
152 typedef struct {
153 uint32_t entries;
154 uint32_t *array;
155 } libxl_cpuarray;
156 #define LIBXL_CPUARRAY_INVALID_ENTRY ~0
157 void libxl_cpuarray_destroy(libxl_cpuarray *array);
159 typedef enum {
160 XENFV = 1,
161 XENPV,
162 } libxl_qemu_machine_type;
164 typedef enum {
165 LIBXL_CONSTYPE_SERIAL = 1,
166 LIBXL_CONSTYPE_PV,
167 } libxl_console_constype;
169 typedef enum {
170 LIBXL_CONSBACK_XENCONSOLED,
171 LIBXL_CONSBACK_IOEMU,
172 } libxl_console_consback;
174 typedef enum {
175 PHYSTYPE_QCOW = 1,
176 PHYSTYPE_QCOW2,
177 PHYSTYPE_VHD,
178 PHYSTYPE_AIO,
179 PHYSTYPE_FILE,
180 PHYSTYPE_PHY,
181 PHYSTYPE_EMPTY,
182 } libxl_disk_phystype;
184 typedef enum {
185 NICTYPE_IOEMU = 1,
186 NICTYPE_VIF,
187 } libxl_nic_type;
189 typedef struct {
190 /*
191 * Path is always set if the file reference is valid. However if
192 * mapped is true then the actual file may already be unlinked.
193 */
194 char * path;
195 int mapped;
196 void * data;
197 size_t size;
198 } libxl_file_reference;
199 void libxl_file_reference_destroy(libxl_file_reference *p);
201 /* libxl_cpuid_policy_list is a dynamic array storing CPUID policies
202 * for multiple leafs. It is terminated with an entry holding
203 * XEN_CPUID_INPUT_UNUSED in input[0]
204 */
205 typedef struct libxl__cpuid_policy libxl_cpuid_policy;
206 typedef libxl_cpuid_policy * libxl_cpuid_policy_list;
207 void libxl_cpuid_destroy(libxl_cpuid_policy_list *cpuid_list);
209 #define LIBXL_PCI_FUNC_ALL (~0U)
211 #include "_libxl_types.h"
213 typedef struct {
214 xentoollog_logger *lg;
215 xc_interface *xch;
216 struct xs_handle *xsh;
218 /* for callers who reap children willy-nilly; caller must only
219 * set this after libxl_init and before any other call - or
220 * may leave them untouched */
221 int (*waitpid_instead)(pid_t pid, int *status, int flags);
222 libxl_version_info version_info;
223 } libxl_ctx;
225 const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx);
227 typedef struct {
228 #define XL_SUSPEND_DEBUG 1
229 #define XL_SUSPEND_LIVE 2
230 int flags;
231 int (*suspend_callback)(void *, int);
232 } libxl_domain_suspend_info;
234 enum {
235 ERROR_VERSION = -1,
236 ERROR_FAIL = -2,
237 ERROR_NI = -3,
238 ERROR_NOMEM = -4,
239 ERROR_INVAL = -5,
240 ERROR_BADFAIL = -6,
241 };
243 #define LIBXL_VERSION 0
245 enum libxl_action_on_shutdown {
246 LIBXL_ACTION_DESTROY,
248 LIBXL_ACTION_RESTART,
249 LIBXL_ACTION_RESTART_RENAME,
251 LIBXL_ACTION_PRESERVE,
253 LIBXL_ACTION_COREDUMP_DESTROY,
254 LIBXL_ACTION_COREDUMP_RESTART,
255 };
257 typedef struct {
258 libxl_domain_create_info c_info;
259 libxl_domain_build_info b_info;
260 libxl_device_model_info dm_info;
262 int num_disks, num_vifs, num_vif2s, num_pcidevs, num_vfbs, num_vkbs;
264 libxl_device_disk *disks;
265 libxl_device_nic *vifs;
266 libxl_device_net2 *vif2s;
267 libxl_device_pci *pcidevs;
268 libxl_device_vfb *vfbs;
269 libxl_device_vkb *vkbs;
271 enum libxl_action_on_shutdown on_poweroff;
272 enum libxl_action_on_shutdown on_reboot;
273 enum libxl_action_on_shutdown on_watchdog;
274 enum libxl_action_on_shutdown on_crash;
275 } libxl_domain_config;
277 /* context functions */
278 int libxl_ctx_init(libxl_ctx *ctx, int version, xentoollog_logger*);
279 int libxl_ctx_free(libxl_ctx *ctx);
280 int libxl_ctx_set_log(libxl_ctx *ctx, xentoollog_logger*);
281 int libxl_ctx_postfork(libxl_ctx *ctx);
283 /* domain related functions */
284 void libxl_init_create_info(libxl_domain_create_info *c_info);
285 void libxl_init_build_info(libxl_domain_build_info *b_info, libxl_domain_create_info *c_info);
286 void libxl_init_dm_info(libxl_device_model_info *dm_info, libxl_domain_create_info *c_info, libxl_domain_build_info *b_info);
287 typedef int (*libxl_console_ready)(libxl_ctx *ctx, uint32_t domid, void *priv);
288 int libxl_domain_create_new(libxl_ctx *ctx, libxl_domain_config *d_config, libxl_console_ready cb, void *priv, uint32_t *domid);
289 int libxl_domain_create_restore(libxl_ctx *ctx, libxl_domain_config *d_config, libxl_console_ready cb, void *priv, uint32_t *domid, int restore_fd);
290 void libxl_domain_config_destroy(libxl_domain_config *d_config);
291 int libxl_domain_suspend(libxl_ctx *ctx, libxl_domain_suspend_info *info,
292 uint32_t domid, int fd);
293 int libxl_domain_resume(libxl_ctx *ctx, uint32_t domid);
294 int libxl_domain_shutdown(libxl_ctx *ctx, uint32_t domid, int req);
295 int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid, int force);
296 int libxl_domain_preserve(libxl_ctx *ctx, uint32_t domid, libxl_domain_create_info *info, const char *name_suffix, libxl_uuid new_uuid);
298 /* get max. number of cpus supported by hypervisor */
299 int libxl_get_max_cpus(libxl_ctx *ctx);
301 /*
302 * Run the configured bootloader for a PV domain and update
303 * info->kernel, info->u.pv.ramdisk and info->u.pv.cmdline as
304 * appropriate (any initial values present in these fields must have
305 * been allocated with malloc).
306 *
307 * Is a NOP on non-PV domains or those with no bootloader configured.
308 *
309 * Users should call libxl_file_reference_unmap on the kernel and
310 * ramdisk to cleanup or rely on libxl_domain_{build,restore} to do
311 * it.
312 */
313 int libxl_run_bootloader(libxl_ctx *ctx,
314 libxl_domain_build_info *info,
315 libxl_device_disk *disk,
316 uint32_t domid);
318 /* 0 means ERROR_ENOMEM, which we have logged */
320 /* events handling */
322 typedef enum {
323 LIBXL_EVENT_DOMAIN_DEATH,
324 LIBXL_EVENT_DISK_EJECT,
325 } libxl_event_type;
327 typedef struct {
328 /* event type */
329 libxl_event_type type;
330 /* data for internal use of the library */
331 char *path;
332 char *token;
333 } libxl_event;
335 typedef struct {
336 char *path;
337 char *token;
338 } libxl_waiter;
341 int libxl_get_wait_fd(libxl_ctx *ctx, int *fd);
342 /* waiter is allocated by the caller */
343 int libxl_wait_for_domain_death(libxl_ctx *ctx, uint32_t domid, libxl_waiter *waiter);
344 /* waiter is a preallocated array of num_disks libxl_waiter elements */
345 int libxl_wait_for_disk_ejects(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disks, int num_disks, libxl_waiter *waiter);
346 int libxl_get_event(libxl_ctx *ctx, libxl_event *event);
347 int libxl_stop_waiting(libxl_ctx *ctx, libxl_waiter *waiter);
348 int libxl_free_event(libxl_event *event);
349 int libxl_free_waiter(libxl_waiter *waiter);
351 /*
352 * Returns:
353 * - 0 if the domain is dead but there is no cleanup to be done. e.g
354 * because someone else has already done it.
355 * - 1 if the domain is dead and there is cleanup to be done.
356 *
357 * Can return error if the domain exists and is still running.
358 *
359 * *info will contain valid domain state iff 1 is returned. In
360 * particular if 1 is returned then info->shutdown_reason is
361 * guaranteed to be valid since by definition the domain is
362 * (shutdown||dying))
363 */
364 int libxl_event_get_domain_death_info(libxl_ctx *ctx, uint32_t domid, libxl_event *event, libxl_dominfo *info);
366 /*
367 * Returns true and fills *disk if the caller should eject the disk
368 */
369 int libxl_event_get_disk_eject_info(libxl_ctx *ctx, uint32_t domid, libxl_event *event, libxl_device_disk *disk);
371 int libxl_domain_rename(libxl_ctx *ctx, uint32_t domid,
372 const char *old_name, const char *new_name,
373 xs_transaction_t trans);
374 /* if old_name is NULL, any old name is OK; otherwise we check
375 * transactionally that the domain has the old old name; if
376 * trans is not 0 we use caller's transaction and caller must do retries */
378 int libxl_domain_pause(libxl_ctx *ctx, uint32_t domid);
379 int libxl_domain_unpause(libxl_ctx *ctx, uint32_t domid);
381 int libxl_domain_core_dump(libxl_ctx *ctx, uint32_t domid, const char *filename);
383 int libxl_domain_setmaxmem(libxl_ctx *ctx, uint32_t domid, uint32_t target_memkb);
384 int libxl_set_memory_target(libxl_ctx *ctx, uint32_t domid, int32_t target_memkb, int relative, int enforce);
385 int libxl_get_memory_target(libxl_ctx *ctx, uint32_t domid, uint32_t *out_target);
386 /* how much free memory in the system a domain needs to be built */
387 int libxl_domain_need_memory(libxl_ctx *ctx, libxl_domain_build_info *b_info,
388 libxl_device_model_info *dm_info, uint32_t *need_memkb);
389 /* how much free memory is available in the system */
390 int libxl_get_free_memory(libxl_ctx *ctx, uint32_t *memkb);
391 /* wait for a given amount of memory to be free in the system */
392 int libxl_wait_for_free_memory(libxl_ctx *ctx, uint32_t domid, uint32_t memory_kb, int wait_secs);
393 /* wait for the memory target of a domain to be reached */
394 int libxl_wait_for_memory_target(libxl_ctx *ctx, uint32_t domid, int wait_secs);
396 int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, int autopass);
397 int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, libxl_console_constype type);
398 /* libxl_primary_console_exec finds the domid and console number
399 * corresponding to the primary console of the given vm, then calls
400 * libxl_console_exec with the right arguments (domid might be different
401 * if the guest is using stubdoms).
402 * This function can be called after creating the device model, in
403 * case of HVM guests, and before libxl_run_bootloader in case of PV
404 * guests using pygrub. */
405 int libxl_primary_console_exec(libxl_ctx *ctx, uint32_t domid_vm);
407 int libxl_domain_info(libxl_ctx*, libxl_dominfo *info_r,
408 uint32_t domid);
409 libxl_dominfo * libxl_list_domain(libxl_ctx*, int *nb_domain);
410 libxl_cpupoolinfo * libxl_list_cpupool(libxl_ctx*, int *nb_pool);
411 libxl_vminfo * libxl_list_vm(libxl_ctx *ctx, int *nb_vm);
413 int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk);
414 int libxl_device_disk_del(libxl_ctx *ctx, libxl_device_disk *disk, int wait);
415 libxl_device_disk *libxl_device_disk_list(libxl_ctx *ctx, uint32_t domid, int *num);
416 int libxl_device_disk_getinfo(libxl_ctx *ctx, uint32_t domid,
417 libxl_device_disk *disk, libxl_diskinfo *diskinfo);
418 int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk);
420 /*
421 * Make a disk available in this domain. Returns path to a device.
422 */
423 char * libxl_device_disk_local_attach(libxl_ctx *ctx, libxl_device_disk *disk);
424 int libxl_device_disk_local_detach(libxl_ctx *ctx, libxl_device_disk *disk);
426 int libxl_device_nic_init(libxl_device_nic *nic, int dev_num);
427 int libxl_device_nic_add(libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic);
428 int libxl_device_nic_del(libxl_ctx *ctx, libxl_device_nic *nic, int wait);
429 libxl_nicinfo *libxl_list_nics(libxl_ctx *ctx, uint32_t domid, unsigned int *nb);
431 int libxl_device_console_add(libxl_ctx *ctx, uint32_t domid, libxl_device_console *console);
433 void libxl_device_vkb_init(libxl_device_vkb *vkb, int dev_num);
434 int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb);
435 int libxl_device_vkb_clean_shutdown(libxl_ctx *ctx, uint32_t domid);
436 int libxl_device_vkb_hard_shutdown(libxl_ctx *ctx, uint32_t domid);
438 void libxl_device_vfb_init(libxl_device_vfb *vfb, int dev_num);
439 int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb);
440 int libxl_device_vfb_clean_shutdown(libxl_ctx *ctx, uint32_t domid);
441 int libxl_device_vfb_hard_shutdown(libxl_ctx *ctx, uint32_t domid);
443 int libxl_device_pci_add(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev);
444 int libxl_device_pci_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev, int force);
445 int libxl_device_pci_shutdown(libxl_ctx *ctx, uint32_t domid);
446 int libxl_device_pci_list_assigned(libxl_ctx *ctx, libxl_device_pci **list, uint32_t domid, int *num);
447 int libxl_device_pci_list_assignable(libxl_ctx *ctx, libxl_device_pci **list, int *num);
448 int libxl_device_pci_parse_bdf(libxl_ctx *ctx, libxl_device_pci *pcidev, const char *str);
449 int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str);
450 int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *cpuid,
451 const char* str);
452 void libxl_cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid);
453 void libxl_cpuid_set(libxl_ctx *ctx, uint32_t domid,
454 libxl_cpuid_policy_list cpuid);
456 /*
457 * Functions for allowing users of libxl to store private data
458 * relating to a domain. The data is an opaque sequence of bytes and
459 * is not interpreted or used by libxl.
460 *
461 * Data is indexed by the userdata userid, which is a short printable
462 * ASCII string. The following list is a registry of userdata userids
463 * (the registry may be updated by posting a patch to xen-devel):
464 *
465 * userid Data contents
466 * "xl" domain config file in xl format, Unix line endings
467 *
468 * libxl does not enforce the registration of userdata userids or the
469 * semantics of the data. For specifications of the data formats
470 * see the code or documentation for the libxl caller in question.
471 */
472 int libxl_userdata_store(libxl_ctx *ctx, uint32_t domid,
473 const char *userdata_userid,
474 const uint8_t *data, int datalen);
475 /* If datalen==0, data is not used and the user data for
476 * that domain and userdata_userid is deleted. */
477 int libxl_userdata_retrieve(libxl_ctx *ctx, uint32_t domid,
478 const char *userdata_userid,
479 uint8_t **data_r, int *datalen_r);
480 /* On successful return, *data_r is from malloc.
481 * If there is no data for that domain and userdata_userid,
482 * *data_r and *datalen_r will be set to 0.
483 * data_r and datalen_r may be 0.
484 * On error return, *data_r and *datalen_r are undefined.
485 */
487 typedef enum {
488 POWER_BUTTON,
489 SLEEP_BUTTON
490 } libxl_button;
492 int libxl_button_press(libxl_ctx *ctx, uint32_t domid, libxl_button button);
494 int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo);
495 int libxl_get_topologyinfo(libxl_ctx *ctx, libxl_topologyinfo *info);
496 libxl_vcpuinfo *libxl_list_vcpu(libxl_ctx *ctx, uint32_t domid,
497 int *nb_vcpu, int *nrcpus);
498 int libxl_set_vcpuaffinity(libxl_ctx *ctx, uint32_t domid, uint32_t vcpuid,
499 libxl_cpumap *cpumap);
500 int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, uint32_t bitmask);
502 int libxl_get_sched_id(libxl_ctx *ctx);
505 int libxl_sched_credit_domain_get(libxl_ctx *ctx, uint32_t domid,
506 libxl_sched_credit *scinfo);
507 int libxl_sched_credit_domain_set(libxl_ctx *ctx, uint32_t domid,
508 libxl_sched_credit *scinfo);
509 int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid,
510 char *trigger_name, uint32_t vcpuid);
511 int libxl_send_sysrq(libxl_ctx *ctx, uint32_t domid, char sysrq);
512 int libxl_send_debug_keys(libxl_ctx *ctx, char *keys);
514 typedef struct libxl__xen_console_reader libxl_xen_console_reader;
516 libxl_xen_console_reader *
517 libxl_xen_console_read_start(libxl_ctx *ctx, int clear);
518 int libxl_xen_console_read_line(libxl_ctx *ctx,
519 libxl_xen_console_reader *cr,
520 char **line_r);
521 void libxl_xen_console_read_finish(libxl_ctx *ctx,
522 libxl_xen_console_reader *cr);
524 uint32_t libxl_vm_get_start_time(libxl_ctx *ctx, uint32_t domid);
526 char *libxl_tmem_list(libxl_ctx *ctx, uint32_t domid, int use_long);
527 int libxl_tmem_freeze(libxl_ctx *ctx, uint32_t domid);
528 int libxl_tmem_destroy(libxl_ctx *ctx, uint32_t domid);
529 int libxl_tmem_thaw(libxl_ctx *ctx, uint32_t domid);
530 int libxl_tmem_set(libxl_ctx *ctx, uint32_t domid, char* name,
531 uint32_t set);
532 int libxl_tmem_shared_auth(libxl_ctx *ctx, uint32_t domid, char* uuid,
533 int auth);
534 int libxl_tmem_freeable(libxl_ctx *ctx);
536 void libxl_device_net2_init(libxl_device_net2 *net2, int dev_num);
537 int libxl_device_net2_add(libxl_ctx *ctx, uint32_t domid,
538 libxl_device_net2 *net2);
539 libxl_net2info *libxl_device_net2_list(libxl_ctx *ctx, uint32_t domid,
540 unsigned int *nb);
541 int libxl_device_net2_del(libxl_ctx *ctx, libxl_device_net2 *net2,
542 int wait);
544 int libxl_get_freecpus(libxl_ctx *ctx, libxl_cpumap *cpumap);
545 int libxl_create_cpupool(libxl_ctx *ctx, const char *name, int schedid,
546 libxl_cpumap cpumap, libxl_uuid *uuid,
547 uint32_t *poolid);
548 int libxl_destroy_cpupool(libxl_ctx *ctx, uint32_t poolid);
549 int libxl_cpupool_rename(libxl_ctx *ctx, const char *name, uint32_t poolid);
550 int libxl_cpupool_cpuadd(libxl_ctx *ctx, uint32_t poolid, int cpu);
551 int libxl_cpupool_cpuadd_node(libxl_ctx *ctx, uint32_t poolid, int node, int *cpus);
552 int libxl_cpupool_cpuremove(libxl_ctx *ctx, uint32_t poolid, int cpu);
553 int libxl_cpupool_cpuremove_node(libxl_ctx *ctx, uint32_t poolid, int node, int *cpus);
554 int libxl_cpupool_movedomain(libxl_ctx *ctx, uint32_t poolid, uint32_t domid);
556 /* common paths */
557 const char *libxl_sbindir_path(void);
558 const char *libxl_bindir_path(void);
559 const char *libxl_libexec_path(void);
560 const char *libxl_libdir_path(void);
561 const char *libxl_sharedir_path(void);
562 const char *libxl_private_bindir_path(void);
563 const char *libxl_xenfirmwaredir_path(void);
564 const char *libxl_xen_config_dir_path(void);
565 const char *libxl_xen_script_dir_path(void);
566 const char *libxl_lock_dir_path(void);
568 #endif /* LIBXL_H */