]> xenbits.xensource.com Git - xen.git/commitdiff
tools: libxl: remove BitField type class from IDL
authorIan Campbell <ian.campbell@citrix.com>
Wed, 20 Apr 2011 16:13:07 +0000 (17:13 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 20 Apr 2011 16:13:07 +0000 (17:13 +0100)
All usages are single bit BitFields, AKA booleans.

In general we prefer to use simple structures (e.g. without packing or
specific layouts) in the libxl API and take care of any require
structure by marshalling within the library instead of expecting users
to do so (e.g. the PCI device BDF is unpacked in the libxl API).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
tools/libxl/gentypes.py
tools/libxl/idl.txt
tools/libxl/libxl.idl
tools/libxl/libxltypes.py
tools/python/genwrap.py

index 099a3919f2c49afd64236f89d2df8c41d8723975..b64ec0ccb242883838240341ccdd623f7e696b36 100644 (file)
@@ -22,9 +22,7 @@ def libxl_C_type_of(ty):
     return ty.typename
 
 def libxl_C_instance_of(ty, instancename):
-    if isinstance(ty, libxltypes.BitField):
-        return libxl_C_type_of(ty) + " " + instancename + ":%d" % ty.width
-    elif isinstance(ty, libxltypes.Aggregate) and ty.typename is None:
+    if isinstance(ty, libxltypes.Aggregate) and ty.typename is None:
         if instancename is None:
             return libxl_C_type_define(ty)
         else:
index 9048828e7724448ff6c1d5790fbaa25492792164..be835cd8f664480b802dc3d02b0d16c8179cd484 100644 (file)
@@ -64,14 +64,6 @@ libxltype.UInt
  The <N> for a given instance must be passed to the constructor and is
  then available in UInt.width
 
-libxltype.BitField
-
- Instances of this class represent bitfield type classes.
-
- The base type and desired width for a given instance must be passed
- to the contructor. The base type becomes the type of the instance and
- width is contained in BitField.width
-
 libxltype.Reference
 
  Instances of this type represent a reference to another type
index ca5ae5e0b7fc2b762e62589d2ab0f3e9f72798af..bb85f61ad2e9c799dec559b331627451d8512885 100644 (file)
@@ -89,11 +89,11 @@ libxl_button = Enumeration("button", [
 libxl_dominfo = Struct("dominfo",[
     ("uuid",        libxl_uuid),
     ("domid",       libxl_domid),
-    ("running",     BitField(uint8, 1)),
-    ("blocked",     BitField(uint8, 1)),
-    ("paused",      BitField(uint8, 1)),
-    ("shutdown",    BitField(uint8, 1)),
-    ("dying",       BitField(uint8, 1)),
+    ("running",     bool),
+    ("blocked",     bool),
+    ("paused",      bool),
+    ("shutdown",    bool),
+    ("dying",       bool),
     
     ("shutdown_reason", unsigned, False, 
 """Valid SHUTDOWN_* value from xen/sched.h iff (shutdown||dying).
@@ -326,9 +326,9 @@ libxl_nicinfo = Struct("nicinfo", [
 libxl_vcpuinfo = Struct("vcpuinfo", [
     ("vcpuid", uint32,              False, "vcpu's id"),
     ("cpu", uint32,                 False, "current mapping"),
-    ("online", BitField(uint8, 1),  False, "currently online (not hotplugged)?"),
-    ("blocked", BitField(uint8, 1), False, "blocked waiting for an event?"),
-    ("running", BitField(uint8, 1), False, "currently scheduled on its CPU?"),
+    ("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"),
     ])
index 608de4388afcd89001d16c3b1fda966246809d79..8f0b516889b9b2539c647653557fd7836268cc94 100644 (file)
@@ -81,14 +81,6 @@ class Enumeration(Type):
                                                 comment=comment,
                                                 typename=self.rawname))
         
-class BitField(Type):
-    def __init__(self, ty, w, **kwargs):
-        kwargs.setdefault('namespace', None)
-        kwargs.setdefault('destructor_fn', None)
-        Type.__init__(self, ty.typename, **kwargs)
-
-        self.width = w
-
 class Field(object):
     """An element of an Aggregate type"""
     def __init__(self, type, name, **kwargs):
index d707d4f011e6edb99fdf351c5868db5b917f472e..ed92b35b7bc1081acdaaa834fc797407e42305af 100644 (file)
@@ -7,7 +7,7 @@ import libxltypes
 (TYPE_BOOL, TYPE_INT, TYPE_UINT, TYPE_STRING) = range(4)
 
 def py_type(ty):
-    if ty == libxltypes.bool or isinstance(ty, libxltypes.BitField) and ty.width == 1:
+    if ty == libxltypes.bool:
         return TYPE_BOOL
     if isinstance(ty, libxltypes.Enumeration):
         return TYPE_UINT