WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 06 of 24] tools: libxl: remove BitField type class fr

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 06 of 24] tools: libxl: remove BitField type class from IDL
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Wed, 13 Apr 2011 15:36:47 +0100
Cc: Vincent Hanquez <Vincent.Hanquez@xxxxxxxxxxxxx>, Dave Scott <Dave.Scott@xxxxxxxxxxxxx>
Delivery-date: Wed, 13 Apr 2011 07:44:50 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1302705401@xxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1302705401@xxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.6.4
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1302698151 -3600
# Node ID 10262be99780f9bdb7922c9475bd91020e86449b
# Parent  174d1c23adc24747d03415b808b30dbb22cf1c07
tools: libxl: remove BitField type class from IDL

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@xxxxxxxxxx>

diff -r 174d1c23adc2 -r 10262be99780 tools/libxl/gentypes.py
--- a/tools/libxl/gentypes.py   Wed Apr 13 13:35:51 2011 +0100
+++ b/tools/libxl/gentypes.py   Wed Apr 13 13:35:51 2011 +0100
@@ -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:
diff -r 174d1c23adc2 -r 10262be99780 tools/libxl/idl.txt
--- a/tools/libxl/idl.txt       Wed Apr 13 13:35:51 2011 +0100
+++ b/tools/libxl/idl.txt       Wed Apr 13 13:35:51 2011 +0100
@@ -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
diff -r 174d1c23adc2 -r 10262be99780 tools/libxl/libxl.idl
--- a/tools/libxl/libxl.idl     Wed Apr 13 13:35:51 2011 +0100
+++ b/tools/libxl/libxl.idl     Wed Apr 13 13:35:51 2011 +0100
@@ -84,11 +84,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).
@@ -320,9 +320,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"),
     ])
diff -r 174d1c23adc2 -r 10262be99780 tools/libxl/libxltypes.py
--- a/tools/libxl/libxltypes.py Wed Apr 13 13:35:51 2011 +0100
+++ b/tools/libxl/libxltypes.py Wed Apr 13 13:35:51 2011 +0100
@@ -83,14 +83,6 @@ class Enumeration(Type):
                                                 namespace=self.namespace,
                                                 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):
diff -r 174d1c23adc2 -r 10262be99780 tools/python/genwrap.py
--- a/tools/python/genwrap.py   Wed Apr 13 13:35:51 2011 +0100
+++ b/tools/python/genwrap.py   Wed Apr 13 13:35:51 2011 +0100
@@ -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

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

<Prev in Thread] Current Thread [Next in Thread>