[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 02 of 16] libxl: move type definitions into _libxl_types.h



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1282143677 -3600
# Node ID f9ed451bcf9e247d99040918034403b649ccb021
# Parent  fabe8b10fdc20dc68738a6921ef1b0f66b761cc6
libxl: move type definitions into _libxl_types.h

The intention is to autogenerate this file in a future patch. This
pure code motion patch allows for easier before and after comparison
of that patch.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r fabe8b10fdc2 -r f9ed451bcf9e tools/libxl/Makefile
--- a/tools/libxl/Makefile      Wed Aug 18 16:01:16 2010 +0100
+++ b/tools/libxl/Makefile      Wed Aug 18 16:01:17 2010 +0100
@@ -102,12 +102,15 @@ install: all
        ln -sf libxlutil.so.$(XLUMAJOR).$(XLUMINOR) 
$(DESTDIR)$(LIBDIR)/libxlutil.so.$(XLUMAJOR)
        ln -sf libxlutil.so.$(XLUMAJOR) $(DESTDIR)$(LIBDIR)/libxlutil.so
        $(INSTALL_DATA) libxlutil.a $(DESTDIR)$(LIBDIR)
-       $(INSTALL_DATA) libxl.h $(DESTDIR)$(INCLUDEDIR)
+       $(INSTALL_DATA) libxl.h _libxl_types.h $(DESTDIR)$(INCLUDEDIR)
        $(INSTALL_DATA) bash-completion $(DESTDIR)$(BASH_COMPLETION_DIR)/xl.sh
 
 .PHONY: clean
 clean:
+       # XXX Preserve during transition to autogeneration
+       cp _libxl_types.h SAVED__libxl_types.h
        $(RM) -f _*.h *.o *.so* *.a $(CLIENTS) $(DEPS)
+       mv SAVED__libxl_types.h _libxl_types.h 
 #      $(RM) -f $(AUTOSRCS) $(AUTOINCS)
 
 distclean: clean
diff -r fabe8b10fdc2 -r f9ed451bcf9e tools/libxl/_libxl_types.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/_libxl_types.h        Wed Aug 18 16:01:17 2010 +0100
@@ -0,0 +1,315 @@
+#ifndef __LIBXL_TYPES_H
+#define __LIBXL_TYPES_H
+
+typedef struct {
+    libxl_uuid uuid;
+    uint32_t domid;
+    uint8_t running:1;
+    uint8_t blocked:1;
+    uint8_t paused:1;
+    uint8_t shutdown:1;
+    uint8_t dying:1;
+
+    /*
+     * Valid SHUTDOWN_* value from xen/sched.h iff (shutdown||dying).
+     *
+     * Otherwise set to a value guaranteed not to clash with any valid
+     * SHUTDOWN_* constant.
+     */
+    unsigned int shutdown_reason;
+
+    uint64_t max_memkb;
+    uint64_t cpu_time;
+    uint32_t vcpu_max_id;
+    uint32_t vcpu_online;
+} libxl_dominfo;
+
+typedef struct {
+    uint32_t poolid;
+} libxl_poolinfo;
+
+typedef struct {
+    libxl_uuid uuid;
+    uint32_t domid;
+} libxl_vminfo;
+
+typedef struct {
+    int xen_version_major;
+    int xen_version_minor;
+    char *xen_version_extra;
+    char *compiler;
+    char *compile_by;
+    char *compile_domain;
+    char *compile_date;
+    char *capabilities;
+    char *changeset;
+    unsigned long virt_start;
+    unsigned long pagesize;
+    char *commandline;
+} libxl_version_info;
+
+typedef struct {
+    bool hvm;
+    bool hap;
+    bool oos;
+    int ssidref;
+    char *name;
+    libxl_uuid uuid;
+    libxl_key_value_list xsdata;
+    libxl_key_value_list platformdata;
+    uint32_t poolid;
+    char *poolname;
+} libxl_domain_create_info;
+
+typedef struct {
+    /*
+     * Path is always set if the file refernece is valid. However if
+     * mapped is true then the actual file may already be unlinked.
+     */
+    char *path;
+    int mapped;
+    void *data;
+    size_t size;
+} libxl_file_reference;
+
+/*
+ * Instances of libxl_file_reference contained in this struct which
+ * have been mapped (with libxl_file_reference_map) will be unmapped
+ * by libxl_domain_build/restore. If either of these are never called
+ * then the user is responsible for calling
+ * libxl_file_reference_unmap.
+ */
+typedef struct {
+    int max_vcpus;
+    int cur_vcpus;
+    int tsc_mode;
+    uint32_t max_memkb;
+    uint32_t target_memkb;
+    uint32_t video_memkb;
+    uint32_t shadow_memkb;
+    bool disable_migrate;
+    libxl_file_reference kernel;
+    int hvm;
+    union {
+        struct {
+            bool pae;
+            bool apic;
+            bool acpi;
+            bool nx;
+            bool viridian;
+            char *timeoffset;
+            bool hpet;
+            bool vpt_align;
+            int timer_mode;
+        } hvm;
+        struct {
+            uint32_t   slack_memkb;
+            const char *bootloader;
+            const char *bootloader_args;
+            char *cmdline;
+            libxl_file_reference ramdisk;
+            const char *features;
+        } pv;
+    } u;
+} libxl_domain_build_info;
+
+typedef struct {
+    uint32_t store_port;
+    unsigned long store_mfn;
+    uint32_t console_port;
+    unsigned long console_mfn;
+} libxl_domain_build_state;
+
+typedef struct {
+    int domid;
+    libxl_uuid uuid; /* this is use only with stubdom, and must be different 
from the domain uuid */
+    char *dom_name;
+    char *device_model;
+    char *saved_state;
+    libxl_qemu_machine_type type;
+    int videoram; /* size of the videoram in MB */
+    bool stdvga; /* stdvga enabled or disabled */
+    bool vnc; /* vnc enabled or disabled */
+    char *vnclisten; /* address:port that should be listened on for the VNC 
server if vnc is set */
+    char *vncpasswd; /* the VNC password */
+    int vncdisplay; /* set VNC display number */
+    bool vncunused; /* try to find an unused port for the VNC server */
+    char *keymap; /* set keyboard layout, default is en-us keyboard */
+    bool sdl; /* sdl enabled or disabled */
+    bool opengl; /* opengl enabled or disabled (if enabled requires sdl 
enabled) */
+    bool nographic; /* no graphics, use serial port */
+    char *serial; /* serial port re-direct to pty deivce */
+    char *boot; /* boot order, for example dca */
+    bool usb; /* usb support enabled or disabled */
+    char *usbdevice; /* enable usb mouse: tablet for absolute mouse, mouse for 
PS/2 protocol relative mouse */
+    char *soundhw; /* enable sound hardware */
+    bool apic; /* apic enabled or disabled */
+    int vcpus; /* max number of vcpus */
+    int vcpu_avail; /* vcpus actually available */
+    int xen_platform_pci; /* enable/disable the xen platform pci device */
+    libxl_string_list extra; /* extra parameters pass directly to qemu, NULL 
terminated */
+    /* Network is missing */
+} libxl_device_model_info;
+
+typedef struct {
+    uint32_t backend_domid;
+    uint32_t domid;
+    int devid;
+    bool vnc; /* vnc enabled or disabled */
+    char *vnclisten; /* address:port that should be listened on for the VNC 
server if vnc is set */
+    char *vncpasswd; /* the VNC password */
+    int vncdisplay; /* set VNC display number */
+    bool vncunused; /* try to find an unused port for the VNC server */
+    char *keymap; /* set keyboard layout, default is en-us keyboard */
+    bool sdl; /* sdl enabled or disabled */
+    bool opengl; /* opengl enabled or disabled (if enabled requires sdl 
enabled) */
+    char *display;
+    char *xauthority;
+} libxl_device_vfb;
+
+typedef struct {
+    uint32_t backend_domid;
+    uint32_t domid;
+    int devid;
+} libxl_device_vkb;
+
+typedef struct {
+    uint32_t backend_domid;
+    uint32_t domid;
+    int devid;
+    libxl_console_consback consback;
+    libxl_domain_build_state *build_state;
+    char *output;
+} libxl_device_console;
+
+typedef struct {
+    uint32_t backend_domid;
+    uint32_t domid;
+    char *physpath;
+    libxl_disk_phystype phystype;
+    char *virtpath;
+    int unpluggable;
+    int readwrite;
+    int is_cdrom;
+} libxl_device_disk;
+
+typedef struct {
+    uint32_t backend_domid;
+    uint32_t domid;
+    int devid;
+    int mtu;
+    char *model;
+    libxl_mac mac;
+    struct in_addr ip;
+    char *bridge;
+    char *ifname;
+    char *script;
+    libxl_nic_type nictype;
+} libxl_device_nic;
+
+typedef struct {
+    int devid;
+    libxl_mac front_mac;
+    libxl_mac back_mac;
+    uint32_t backend_domid;
+    uint32_t domid;
+    uint32_t trusted:1;
+    uint32_t back_trusted:1;
+    uint32_t filter_mac:1;
+    uint32_t front_filter_mac:1;
+    uint32_t pdev;
+    uint32_t max_bypasses;
+    char *bridge;
+} libxl_device_net2;
+
+typedef struct {
+    union {
+        unsigned int value;
+        struct {
+            unsigned int reserved1:2;
+            unsigned int reg:6;
+            unsigned int func:3;
+            unsigned int dev:5;
+            unsigned int bus:8;
+            unsigned int reserved2:7;
+            unsigned int enable:1;
+        };
+    };
+    unsigned int domain;
+    unsigned int vdevfn;
+    unsigned int vfunc_mask;
+    bool msitranslate;
+    bool power_mgmt;
+} libxl_device_pci;
+
+typedef struct {
+    char *backend;
+    uint32_t backend_id;
+    char *frontend;
+    uint32_t frontend_id;
+    int devid;
+    int state;
+    int evtch;
+    int rref;
+} libxl_diskinfo;
+
+typedef struct {
+    char *backend;
+    uint32_t backend_id;
+    char *frontend;
+    uint32_t frontend_id;
+    int devid;
+    int state;
+    char *script;
+    libxl_mac mac;
+    int evtch;
+    int rref_tx;
+    int rref_rx;
+} libxl_nicinfo;
+
+typedef struct {
+    uint32_t vcpuid; /* vcpu's id */
+    uint32_t cpu; /* current mapping */
+    uint8_t online:1; /* currently online (not hotplugged)? */
+    uint8_t blocked:1; /* blocked waiting for an event? */
+    uint8_t running:1; /* currently scheduled on its CPU? */
+    uint64_t vcpu_time; /* total vcpu time ran (ns) */
+    libxl_cpumap cpumap; /* current cpu's affinities */
+} libxl_vcpuinfo;
+
+typedef struct {
+    uint32_t threads_per_core;
+    uint32_t cores_per_socket;
+
+    uint32_t max_cpu_id;
+    uint32_t nr_cpus;
+    uint32_t cpu_khz;
+
+    uint64_t total_pages;
+    uint64_t free_pages;
+    uint64_t scrub_pages;
+
+    uint32_t nr_nodes;
+    libxl_hwcap hw_cap;
+    uint32_t phys_cap;
+}  libxl_physinfo;
+
+typedef struct {
+    int weight;
+    int cap;
+} libxl_sched_credit;
+
+typedef struct {
+    char *backend;
+    uint32_t backend_id;
+    char *frontend;
+    uint32_t frontend_id;
+    int devid;
+    int state;
+    libxl_mac mac;
+    int trusted;
+    libxl_mac back_mac;
+    int filter_mac;
+} libxl_net2info;
+
+#endif /* __LIBXL_TYPES_H */
diff -r fabe8b10fdc2 -r f9ed451bcf9e tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Wed Aug 18 16:01:16 2010 +0100
+++ b/tools/libxl/libxl.h       Wed Aug 18 16:01:17 2010 +0100
@@ -180,52 +180,7 @@ typedef enum {
 
 #define LIBXL_PCI_FUNC_ALL (~0U)
 
-typedef struct {
-    libxl_uuid uuid;
-    uint32_t domid;
-    uint8_t running:1;
-    uint8_t blocked:1;
-    uint8_t paused:1;
-    uint8_t shutdown:1;
-    uint8_t dying:1;
-
-    /*
-     * Valid SHUTDOWN_* value from xen/sched.h iff (shutdown||dying).
-     *
-     * Otherwise set to a value guaranteed not to clash with any valid
-     * SHUTDOWN_* constant.
-     */
-    unsigned int shutdown_reason;
-
-    uint64_t max_memkb;
-    uint64_t cpu_time;
-    uint32_t vcpu_max_id;
-    uint32_t vcpu_online;
-} libxl_dominfo;
-
-typedef struct {
-    uint32_t poolid;
-} libxl_poolinfo;
-
-typedef struct {
-    libxl_uuid uuid;
-    uint32_t domid;
-} libxl_vminfo;
-
-typedef struct {
-    int xen_version_major;
-    int xen_version_minor;
-    char *xen_version_extra;
-    char *compiler;
-    char *compile_by;
-    char *compile_domain;
-    char *compile_date;
-    char *capabilities;
-    char *changeset;
-    unsigned long virt_start;
-    unsigned long pagesize;
-    char *commandline;
-} libxl_version_info;
+#include "_libxl_types.h"
 
 typedef struct {
     xentoollog_logger *lg;
@@ -242,205 +197,11 @@ const libxl_version_info* libxl_get_vers
 const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx);
 
 typedef struct {
-    bool hvm;
-    bool hap;
-    bool oos;
-    int ssidref;
-    char *name;
-    libxl_uuid uuid;
-    libxl_key_value_list xsdata;
-    libxl_key_value_list platformdata;
-    uint32_t poolid;
-    char *poolname;
-} libxl_domain_create_info;
-
-typedef struct {
-    /*
-     * Path is always set if the file refernece is valid. However if
-     * mapped is true then the actual file may already be unlinked.
-     */
-    char *path;
-    int mapped;
-    void *data;
-    size_t size;
-} libxl_file_reference;
-
-/*
- * Instances of libxl_file_reference contained in this struct which
- * have been mapped (with libxl_file_reference_map) will be unmapped
- * by libxl_domain_build/restore. If either of these are never called
- * then the user is responsible for calling
- * libxl_file_reference_unmap.
- */
-typedef struct {
-    int max_vcpus;
-    int cur_vcpus;
-    int tsc_mode;
-    uint32_t max_memkb;
-    uint32_t target_memkb;
-    uint32_t video_memkb;
-    uint32_t shadow_memkb;
-    bool disable_migrate;
-    libxl_file_reference kernel;
-    int hvm;
-    union {
-        struct {
-            bool pae;
-            bool apic;
-            bool acpi;
-            bool nx;
-            bool viridian;
-            char *timeoffset;
-            bool hpet;
-            bool vpt_align;
-            int timer_mode;
-        } hvm;
-        struct {
-            uint32_t   slack_memkb;
-            const char *bootloader;
-            const char *bootloader_args;
-            char *cmdline;
-            libxl_file_reference ramdisk;
-            const char *features;
-        } pv;
-    } u;
-} libxl_domain_build_info;
-
-typedef struct {
-    uint32_t store_port;
-    unsigned long store_mfn;
-    uint32_t console_port;
-    unsigned long console_mfn;
-} libxl_domain_build_state;
-
-typedef struct {
 #define XL_SUSPEND_DEBUG 1
 #define XL_SUSPEND_LIVE 2
     int flags;
     int (*suspend_callback)(void *, int);
 } libxl_domain_suspend_info;
-
-typedef struct {
-    int domid;
-    libxl_uuid uuid; /* this is use only with stubdom, and must be different 
from the domain uuid */
-    char *dom_name;
-    char *device_model;
-    char *saved_state;
-    libxl_qemu_machine_type type;
-    int videoram; /* size of the videoram in MB */
-    bool stdvga; /* stdvga enabled or disabled */
-    bool vnc; /* vnc enabled or disabled */
-    char *vnclisten; /* address:port that should be listened on for the VNC 
server if vnc is set */
-    char *vncpasswd; /* the VNC password */
-    int vncdisplay; /* set VNC display number */
-    bool vncunused; /* try to find an unused port for the VNC server */
-    char *keymap; /* set keyboard layout, default is en-us keyboard */
-    bool sdl; /* sdl enabled or disabled */
-    bool opengl; /* opengl enabled or disabled (if enabled requires sdl 
enabled) */
-    bool nographic; /* no graphics, use serial port */
-    char *serial; /* serial port re-direct to pty deivce */
-    char *boot; /* boot order, for example dca */
-    bool usb; /* usb support enabled or disabled */
-    char *usbdevice; /* enable usb mouse: tablet for absolute mouse, mouse for 
PS/2 protocol relative mouse */
-    char *soundhw; /* enable sound hardware */
-    bool apic; /* apic enabled or disabled */
-    int vcpus; /* max number of vcpus */
-    int vcpu_avail; /* vcpus actually available */
-    int xen_platform_pci; /* enable/disable the xen platform pci device */
-    libxl_string_list extra; /* extra parameters pass directly to qemu, NULL 
terminated */
-    /* Network is missing */
-} libxl_device_model_info;
-
-typedef struct {
-    uint32_t backend_domid;
-    uint32_t domid;
-    int devid;
-    bool vnc; /* vnc enabled or disabled */
-    char *vnclisten; /* address:port that should be listened on for the VNC 
server if vnc is set */
-    char *vncpasswd; /* the VNC password */
-    int vncdisplay; /* set VNC display number */
-    bool vncunused; /* try to find an unused port for the VNC server */
-    char *keymap; /* set keyboard layout, default is en-us keyboard */
-    bool sdl; /* sdl enabled or disabled */
-    bool opengl; /* opengl enabled or disabled (if enabled requires sdl 
enabled) */
-    char *display;
-    char *xauthority;
-} libxl_device_vfb;
-
-typedef struct {
-    uint32_t backend_domid;
-    uint32_t domid;
-    int devid;
-} libxl_device_vkb;
-
-typedef struct {
-    uint32_t backend_domid;
-    uint32_t domid;
-    int devid;
-    libxl_console_consback consback;
-    libxl_domain_build_state *build_state;
-    char *output;
-} libxl_device_console;
-
-typedef struct {
-    uint32_t backend_domid;
-    uint32_t domid;
-    char *physpath;
-    libxl_disk_phystype phystype;
-    char *virtpath;
-    int unpluggable;
-    int readwrite;
-    int is_cdrom;
-} libxl_device_disk;
-
-typedef struct {
-    uint32_t backend_domid;
-    uint32_t domid;
-    int devid;
-    int mtu;
-    char *model;
-    libxl_mac mac;
-    struct in_addr ip;
-    char *bridge;
-    char *ifname;
-    char *script;
-    libxl_nic_type nictype;
-} libxl_device_nic;
-
-typedef struct {
-    int devid;
-    libxl_mac front_mac;
-    libxl_mac back_mac;
-    uint32_t backend_domid;
-    uint32_t domid;
-    uint32_t trusted:1;
-    uint32_t back_trusted:1;
-    uint32_t filter_mac:1;
-    uint32_t front_filter_mac:1;
-    uint32_t pdev;
-    uint32_t max_bypasses;
-    char *bridge;
-} libxl_device_net2;
-
-typedef struct {
-    union {
-        unsigned int value;
-        struct {
-            unsigned int reserved1:2;
-            unsigned int reg:6;
-            unsigned int func:3;
-            unsigned int dev:5;
-            unsigned int bus:8;
-            unsigned int reserved2:7;
-            unsigned int enable:1;
-        };
-    };
-    unsigned int domain;
-    unsigned int vdevfn;
-    unsigned int vfunc_mask;
-    bool msitranslate;
-    bool power_mgmt;
-} libxl_device_pci;
 
 enum {
     ERROR_VERSION = -1,
@@ -594,17 +355,6 @@ int libxl_detach_device_model(libxl_ctx 
                               libxl_device_model_starting *starting);
   /* DM is detached even if error is returned */
 
-typedef struct {
-    char *backend;
-    uint32_t backend_id;
-    char *frontend;
-    uint32_t frontend_id;
-    int devid;
-    int state;
-    int evtch;
-    int rref;
-} libxl_diskinfo;
-
 int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk 
*disk);
 int libxl_device_disk_del(libxl_ctx *ctx, libxl_device_disk *disk, int wait);
 libxl_device_disk *libxl_device_disk_list(libxl_ctx *ctx, uint32_t domid, int 
*num);
@@ -617,20 +367,6 @@ int libxl_cdrom_insert(libxl_ctx *ctx, u
  */
 char * libxl_device_disk_local_attach(libxl_ctx *ctx, libxl_device_disk *disk);
 int libxl_device_disk_local_detach(libxl_ctx *ctx, libxl_device_disk *disk);
-
-typedef struct {
-    char *backend;
-    uint32_t backend_id;
-    char *frontend;
-    uint32_t frontend_id;
-    int devid;
-    int state;
-    char *script;
-    libxl_mac mac;
-    int evtch;
-    int rref_tx;
-    int rref_rx;
-} libxl_nicinfo;
 
 int libxl_device_nic_add(libxl_ctx *ctx, uint32_t domid, libxl_device_nic 
*nic);
 int libxl_device_nic_del(libxl_ctx *ctx, libxl_device_nic *nic, int wait);
@@ -692,33 +428,6 @@ typedef enum {
 
 int libxl_button_press(libxl_ctx *ctx, uint32_t domid, libxl_button button);
 
-typedef struct {
-    uint32_t vcpuid; /* vcpu's id */
-    uint32_t cpu; /* current mapping */
-    uint8_t online:1; /* currently online (not hotplugged)? */
-    uint8_t blocked:1; /* blocked waiting for an event? */
-    uint8_t running:1; /* currently scheduled on its CPU? */
-    uint64_t vcpu_time; /* total vcpu time ran (ns) */
-    libxl_cpumap cpumap; /* current cpu's affinities */
-} libxl_vcpuinfo;
-
-typedef struct {
-    uint32_t threads_per_core;
-    uint32_t cores_per_socket;
-
-    uint32_t max_cpu_id;
-    uint32_t nr_cpus;
-    uint32_t cpu_khz;
-
-    uint64_t total_pages;
-    uint64_t free_pages;
-    uint64_t scrub_pages;
-
-    uint32_t nr_nodes;
-    libxl_hwcap hw_cap;
-    uint32_t phys_cap;
-}  libxl_physinfo;
-
 int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo);
 libxl_vcpuinfo *libxl_list_vcpu(libxl_ctx *ctx, uint32_t domid,
                                        int *nb_vcpu, int *nrcpus);
@@ -729,11 +438,6 @@ int libxl_set_vcpucount(libxl_ctx *ctx, 
 
 int libxl_get_sched_id(libxl_ctx *ctx);
 
-
-typedef struct {
-    int weight;
-    int cap;
-} libxl_sched_credit;
 
 int libxl_sched_credit_domain_get(libxl_ctx *ctx, uint32_t domid,
                                   libxl_sched_credit *scinfo);
@@ -766,19 +470,6 @@ int libxl_tmem_shared_auth(libxl_ctx *ct
                            int auth);
 int libxl_tmem_freeable(libxl_ctx *ctx);
 
-typedef struct {
-    char *backend;
-    uint32_t backend_id;
-    char *frontend;
-    uint32_t frontend_id;
-    int devid;
-    int state;
-    libxl_mac mac;
-    int trusted;
-    libxl_mac back_mac;
-    int filter_mac;
-} libxl_net2info;
-
 int libxl_device_net2_add(libxl_ctx *ctx, uint32_t domid,
                           libxl_device_net2 *net2);
 libxl_net2info *libxl_device_net2_list(libxl_ctx *ctx, uint32_t domid,

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.