diff options
Diffstat (limited to 'tools/libxl')
-rw-r--r-- | tools/libxl/gentypes.py | 23 | ||||
-rw-r--r-- | tools/libxl/idl.txt | 6 | ||||
-rw-r--r-- | tools/libxl/libxl_types.idl | 166 | ||||
-rw-r--r-- | tools/libxl/libxltypes.py | 22 |
4 files changed, 92 insertions, 125 deletions
diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py index 7ca63755ac..7ecc11d572 100644 --- a/tools/libxl/gentypes.py +++ b/tools/libxl/gentypes.py @@ -5,19 +5,6 @@ import re import libxltypes -def format_comment(level, comment): - indent = reduce(lambda x,y: x + " ", range(level), "") - s = "%s/*\n" % indent - s += "%s * " % indent - comment = comment.replace("\n", "\n%s * " % indent) - x = re.compile(r'^%s \* $' % indent, re.MULTILINE) - comment = x.sub("%s *" % indent, comment) - s += comment - s += "\n" - s += "%s */" % indent - s += "\n" - return s - def libxl_C_instance_of(ty, instancename): if isinstance(ty, libxltypes.Aggregate) and ty.typename is None: if instancename is None: @@ -30,17 +17,12 @@ def libxl_C_instance_of(ty, instancename): def libxl_C_type_define(ty, indent = ""): s = "" if isinstance(ty, libxltypes.Enumeration): - if ty.comment is not None: - s += format_comment(0, ty.comment) - if ty.typename is None: s += "enum {\n" else: s += "typedef enum %s {\n" % ty.typename for v in ty.values: - if v.comment is not None: - s += format_comment(4, v.comment) x = "%s = %d" % (v.name, v.value) x = x.replace("\n", "\n ") s += " " + x + ",\n" @@ -50,17 +32,12 @@ def libxl_C_type_define(ty, indent = ""): s += "} %s" % ty.typename elif isinstance(ty, libxltypes.Aggregate): - if ty.comment is not None: - s += format_comment(0, ty.comment) - if ty.typename is None: s += "%s {\n" % ty.kind else: s += "typedef %s %s {\n" % (ty.kind, ty.typename) for f in ty.fields: - if f.comment is not None: - s += format_comment(4, f.comment) x = libxl_C_instance_of(f.type, f.name) if f.const: x = "const " + x diff --git a/tools/libxl/idl.txt b/tools/libxl/idl.txt index e9c2956b77..6f2d05bf26 100644 --- a/tools/libxl/idl.txt +++ b/tools/libxl/idl.txt @@ -20,10 +20,6 @@ The libxltypes.Type base class has several other properties which apply to all types. The properties are set by passing a named parameter to the constructor. -Type.comment: - - A free text comment which describes the type. - Type.namespace: (default: "libxl_") The namespace in which the type resides. Usually this is "libxl_" but @@ -98,7 +94,6 @@ libxltype.Enumeration name of the containing Enumeration and any namespace (e.g. "VALUE") EnumerationValue.value The integer value associated with this name. - EnumerationValue.comment A free text comment which describes the member. libxltype.Aggregate @@ -115,7 +110,6 @@ libxltype.Aggregate Field.name The name of the member (can be None for anonymous fields). Field.const Boolean, true if the member is const. - Field.comment A free text comment which describes the member. libxltype.Struct diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index 3ba7f6c50b..556f3fca3f 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -28,8 +28,8 @@ libxl_domain_type = Enumeration("domain_type", [ ]) libxl_device_model_version = Enumeration("device_model_version", [ - (1, "QEMU_XEN_TRADITIONAL", "Historical qemu-xen device model (qemu-dm)"), - (2, "QEMU_XEN", "Upstream based qemu-xen device model"), + (1, "QEMU_XEN_TRADITIONAL"), # Historical qemu-xen device model (qemu-dm) + (2, "QEMU_XEN"), # Upstream based qemu-xen device model ]) libxl_console_type = Enumeration("console_type", [ @@ -93,18 +93,18 @@ libxl_tsc_mode = Enumeration("tsc_mode", [ libxl_dominfo = Struct("dominfo",[ ("uuid", libxl_uuid), ("domid", libxl_domid), - ("ssidref", uint32), + ("ssidref", uint32), ("running", bool), ("blocked", bool), ("paused", bool), ("shutdown", bool), ("dying", bool), - ("shutdown_reason", uint8, False, -"""Valid SHUTDOWN_* value from xen/sched.h iff (shutdown||dying). - -Otherwise set to a value guaranteed not to clash with any valid -SHUTDOWN_* constant."""), + # Valid SHUTDOWN_* value from xen/sched.h iff (shutdown||dying). + # + # Otherwise set to a value guaranteed not to clash with any valid + # SHUTDOWN_* constant. + ("shutdown_reason", uint8), ("current_memkb", uint64), ("shared_memkb", uint64), ("max_memkb", uint64), @@ -153,6 +153,11 @@ libxl_domain_create_info = Struct("domain_create_info",[ ("poolid", uint32), ]) +# 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. libxl_domain_build_info = Struct("domain_build_info",[ ("max_vcpus", integer), ("cur_vcpus", integer), @@ -188,84 +193,87 @@ libxl_domain_build_info = Struct("domain_build_info",[ ("cmdline", string), ("ramdisk", libxl_file_reference), ("features", string, True), - ("e820_host", bool, False, "Use host's E820 for PCI passthrough."), + # Use host's E820 for PCI passthrough. + ("e820_host", bool), ])), ])), ], - comment = -"""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.""") +) +# Device Model Information libxl_device_model_info = Struct("device_model_info",[ ("domid", libxl_domid), - ("uuid", libxl_uuid, False, "this is use only with stubdom, and must be different from the domain uuid"), + + # uuid is used only with stubdom, and must be different from the + # domain uuid + ("uuid", libxl_uuid), ("dom_name", string), ("device_model_version", libxl_device_model_version), ("device_model_stubdomain", bool), - ("device_model", string, False, "if you set this you must set device_model_version too"), + # you set device_model you must set device_model_version too + ("device_model", string), ("saved_state", string), ("type", libxl_domain_type), ("target_ram", uint32), - ("videoram", integer, False, "size of the videoram in MB"), - ("stdvga", bool, False, "stdvga enabled or disabled"), - ("vnc", bool, False, "vnc enabled or disabled"), - ("vnclisten", string, False, "address:port that should be listened on for the VNC server if vnc is set"), - ("vncpasswd", string, False, "the VNC password"), - ("vncdisplay", integer, False, "set VNC display number"), - ("vncunused", bool, False, "try to find an unused port for the VNC server"), - ("keymap", string, False, "set keyboard layout, default is en-us keyboard"), - ("sdl", bool, False, "sdl enabled or disabled"), - ("opengl", bool, False, "opengl enabled or disabled (if enabled requires sdl enabled)"), - ("spice", bool, False, - "spice enabled or disabled"), - ("spiceport", integer, False, - "the port that should be listened on for the spice server"), - ("spicetls_port", integer, False, """the tls port -that should be listened on for the spice server, -at least one of the port or tls port must be given"""), - ("spicehost", string, False, """the interface -that should be listened on if given otherwise any interface"""), - ("spicedisable_ticketing", bool, False, - "enable client connection with no password"), - ("spicepasswd", string, False, """set ticket password -witch must be used by a client for connection. -The password never expires"""), - ("spiceagent_mouse", bool, False, - "Whether spice agent is used for client mouse mode(default is on)"), - ("nographic", bool, False, "no graphics, use serial port"), - ("gfx_passthru", bool, False, "graphics passthrough enabled or disabled"), - ("serial", string, False, "serial port re-direct to pty deivce"), - ("boot", string, False, "boot order, for example dca"), - ("usb", bool, False, "usb support enabled or disabled"), - ("usbdevice", string, False, "enable usb mouse: tablet for absolute mouse, mouse for PS/2 protocol relative mouse"), - ("soundhw", string, False, "enable sound hardware"), - ("acpi", bool, False, "acpi enabled or disabled"), - ("vcpus", integer, False, "max number of vcpus"), - ("vcpu_avail", integer, False, "vcpus actually available"), - ("xen_platform_pci", bool, False, "enable/disable the xen platform pci device"), - ("extra", libxl_string_list, False, "extra parameters pass directly to qemu, NULL terminated"), - ("extra_pv", libxl_string_list, False, "extra parameters pass directly to qemu for PV guest, NULL terminated"), - ("extra_hvm", libxl_string_list, False, "extra parameters pass directly to qemu for HVM guest, NULL terminated"), + # size of the videoram in MB + ("videoram", integer), + ("stdvga", bool), + ("vnc", bool), + # "address:port" that should be listened on for the VNC server + ("vnclisten", string), + ("vncpasswd", string), + # VNC display number + ("vncdisplay", integer), + # If set then try to find an unused port for the VNC server + ("vncunused", bool), + # keyboard layout, default is en-us keyboard + ("keymap", string), + ("sdl", bool), + ("opengl", bool), # (requires sdl enabled) + ("spice", bool), + # At least one of spice port or spicetls_post must be given + ("spiceport", integer), + ("spicetls_port", integer), + # Interface to bind to + ("spicehost", string), + # enable client connection with no password + ("spicedisable_ticketing", bool), + ("spicepasswd", string), + ("spiceagent_mouse", bool), + ("nographic", bool), + ("gfx_passthru", bool), + ("serial", string), + ("boot", string), + ("usb", bool), + # usbdevice: "tablet" for absolute mouse, "mouse" for PS/2 protocol relative mouse + ("usbdevice", string), + ("soundhw", string), + ("acpi", bool), + ("vcpus", integer), # max number of vcpus + ("vcpu_avail", integer), # vcpus actually available + ("xen_platform_pci", bool), + # extra parameters pass directly to qemu, NULL terminated + ("extra", libxl_string_list), + # extra parameters pass directly to qemu for PV guest, NULL terminated + ("extra_pv", libxl_string_list), + # extra parameters pass directly to qemu for HVM guest, NULL terminated + ("extra_hvm", libxl_string_list), ], - comment= -"""Device Model information. - -Network is missing""") +) libxl_device_vfb = Struct("device_vfb", [ ("backend_domid", libxl_domid), ("devid", integer), - ("vnc", bool, False, "vnc enabled or disabled"), - ("vnclisten", string, False, "address:port that should be listened on for the VNC server if vnc is set"), - ("vncpasswd", string, False, "the VNC password"), - ("vncdisplay", integer, False, "set VNC display number"), - ("vncunused", bool, False, "try to find an unused port for the VNC server"), - ("keymap", string, False, "set keyboard layout, default is en-us keyboard"), - ("sdl", bool, False, "sdl enabled or disabled"), - ("opengl", bool, False, "opengl enabled or disabled (if enabled requires sdl enabled)"), + ("vnc", bool), + # address:port that should be listened on for the VNC server if vnc is set + ("vnclisten", string), + ("vncpasswd", string), + ("vncdisplay", integer), + ("vncunused", bool), + # set keyboard layout, default is en-us keyboard + ("keymap", string), + ("sdl", bool), + ("opengl", bool), # (if enabled requires sdl enabled) ("display", string), ("xauthority", string), ]) @@ -342,13 +350,13 @@ libxl_nicinfo = Struct("nicinfo", [ ]) libxl_vcpuinfo = Struct("vcpuinfo", [ - ("vcpuid", uint32, False, "vcpu's id"), - ("cpu", uint32, False, "current mapping"), - ("online", bool, False, "currently online (not hotplugged)?"), - ("blocked", bool, False, "blocked waiting for an event?"), - ("running", bool, False, "currently scheduled on its CPU?"), - ("vcpu_time", uint64, False, "total vcpu time ran (ns)"), - ("cpumap", libxl_cpumap, False, "current cpu's affinities"), + ("vcpuid", uint32), + ("cpu", uint32), + ("online", bool), + ("blocked", bool), + ("running", bool), + ("vcpu_time", uint64), # total vcpu time ran (ns) + ("cpumap", libxl_cpumap), # current cpu's affinities ]) libxl_physinfo = Struct("physinfo", [ @@ -371,9 +379,9 @@ libxl_physinfo = Struct("physinfo", [ ], dispose_fn=None, dir=DIR_OUT) libxl_topologyinfo = Struct("topologyinfo", [ - ("coremap", libxl_cpuarray, False, "cpu to core map"), - ("socketmap", libxl_cpuarray, False, "cpu to socket map"), - ("nodemap", libxl_cpuarray, False, "cpu to node map"), + ("coremap", libxl_cpuarray), # cpu to core map + ("socketmap", libxl_cpuarray), # cpu to socket map + ("nodemap", libxl_cpuarray), # cpu to node map ]) libxl_sched_credit = Struct("sched_credit", [ diff --git a/tools/libxl/libxltypes.py b/tools/libxl/libxltypes.py index 450de88f49..338cfdeee9 100644 --- a/tools/libxl/libxltypes.py +++ b/tools/libxl/libxltypes.py @@ -22,7 +22,6 @@ def _get_default_namespace(): class Type(object): def __init__(self, typename, **kwargs): - self.comment = kwargs.setdefault('comment', None) self.namespace = kwargs.setdefault('namespace', _get_default_namespace()) self.dir = kwargs.setdefault('dir', DIR_BOTH) @@ -120,7 +119,6 @@ class EnumerationValue(object): self.rawname = str.upper(enum.rawname) + "_" + self.valuename self.name = str.upper(enum.namespace) + self.rawname self.value = value - self.comment = kwargs.setdefault("comment", None) class Enumeration(Type): def __init__(self, typename, values, **kwargs): @@ -129,16 +127,9 @@ class Enumeration(Type): self.values = [] for v in values: - # (value, name[, comment=None]) - if len(v) == 2: - (num,name) = v - comment = None - elif len(v) == 3: - num,name,comment = v - else: - raise "" + # (value, name) + (num,name) = v self.values.append(EnumerationValue(self, num, name, - comment=comment, typename=self.rawname)) def lookup(self, name): for v in self.values: @@ -152,7 +143,6 @@ class Field(object): self.type = type self.name = name self.const = kwargs.setdefault('const', False) - self.comment = kwargs.setdefault('comment', None) self.enumname = kwargs.setdefault('enumname', None) class Aggregate(Type): @@ -164,19 +154,17 @@ class Aggregate(Type): self.fields = [] for f in fields: - # (name, type[, const=False[, comment=None]]) + # (name, type[, const=False]) if len(f) == 2: n,t = f const = False - comment = None elif len(f) == 3: n,t,const = f - comment = None else: - n,t,const,comment = f + raise ValueError if n is None: raise ValueError - self.fields.append(Field(t,n,const=const,comment=comment)) + self.fields.append(Field(t,n,const=const)) # Returns a tuple (stem, field-expr) # |