debuggers.hg

view tools/libxl/libxl_utils.h @ 21989:88adea5b4546

libxl, Introduce the command line handler for the new qemu.
From: Anthony PERARD <anthony.perard@citrix.com>

This patch adds a function to check the version of the device model.
Depending on the version of the DM, the command line arguments will be
built differently.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
tools/libxl/libxl.c | 160 ++++++++++++++++++++++++++++++++++++++++++++-
tools/libxl/libxl_utils.c | 78 ++++++++++++++++++++++
tools/libxl/libxl_utils.h | 6 ++
3 files changed, 243 insertions(+), 1 deletions(-)
author Anthony Perard <anthony.perard@citrix.com>
date Mon Aug 09 16:46:01 2010 +0100 (2010-08-09)
parents bf4d0eb3643d
children 063927551e9c
line source
1 /*
2 * Copyright (C) 2009 Citrix Ltd.
3 * Author Stefano Stabellini <stefano.stabellini@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 #ifndef LIBXL_UTILS_H
17 #define LIBXL_UTILS_H
19 #include "libxl.h"
21 unsigned long libxl_get_required_shadow_memory(unsigned long maxmem_kb, unsigned int smp_cpus);
22 int libxl_name_to_domid(libxl_ctx *ctx, const char *name, uint32_t *domid);
23 char *libxl_domid_to_name(libxl_ctx *ctx, uint32_t domid);
24 int libxl_name_to_poolid(libxl_ctx *ctx, const char *name, uint32_t *poolid);
25 char *libxl_poolid_to_name(libxl_ctx *ctx, uint32_t poolid);
26 int libxl_get_stubdom_id(libxl_ctx *ctx, int guest_domid);
27 int libxl_is_stubdom(libxl_ctx *ctx, uint32_t domid, uint32_t *target_domid);
28 int libxl_create_logfile(libxl_ctx *ctx, char *name, char **full_name);
29 int libxl_string_to_phystype(libxl_ctx *ctx, char *s, libxl_disk_phystype *phystype);
31 int libxl_read_file_contents(libxl_ctx *ctx, const char *filename,
32 void **data_r, int *datalen_r);
33 /* Reads the contents of the plain file filename into a mallocd
34 * buffer. Returns 0 or errno. Any errors other than ENOENT are logged.
35 * If the file is empty, *data_r and *datalen_r are set to 0.
36 * On error, *data_r and *datalen_r are undefined.
37 * data_r and/or datalen_r may be 0.
38 */
40 int libxl_read_exactly(libxl_ctx *ctx, int fd, void *data, ssize_t sz,
41 const char *filename, const char *what);
42 int libxl_write_exactly(libxl_ctx *ctx, int fd, const void *data,
43 ssize_t sz, const char *filename, const char *what);
44 /* Returns 0 or errno. If file is truncated on reading, returns
45 * EPROTO and you have no way to tell how much was read. Errors are
46 * logged using filename (which is only used for logging) and what
47 * (which may be 0). */
49 pid_t libxl_fork(libxl_ctx *ctx);
50 int libxl_pipe(libxl_ctx *ctx, int pipes[2]);
51 /* Just like fork(2), pipe(2), but log errors. */
53 void libxl_report_child_exitstatus(libxl_ctx *ctx, xentoollog_level,
54 const char *what, pid_t pid, int status);
55 /* treats all exit statuses as errors; if that's not what you want,
56 * check status yourself first */
58 int libxl_mac_to_device_nic(libxl_ctx *ctx, uint32_t domid,
59 const char *mac, libxl_device_nic *nic);
60 int libxl_devid_to_device_nic(libxl_ctx *ctx, uint32_t domid,
61 const char *devid, libxl_device_nic *nic);
63 int libxl_devid_to_device_disk(libxl_ctx *ctx, uint32_t domid,
64 const char *devid, libxl_device_disk *disk);
66 int libxl_strtomac(const char *mac_s, uint8_t *mac);
68 int libxl_devid_to_device_net2(libxl_ctx *ctx, uint32_t domid,
69 const char *devid, libxl_device_net2 *net2);
71 /* check the version of qemu
72 * return 1 if is the new one
73 * return 0 if is the old one
74 * return -1 if there are an error */
75 int libxl_check_device_model_version(libxl_ctx *ctx, char *path);
77 #endif