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] Re: [PATCH RESEND V8 2/7] libxl: Add get/set_default_namespa

To: Anthony PERARD <anthony.perard@xxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH RESEND V8 2/7] libxl: Add get/set_default_namespace in libxltypes.py.
From: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>
Date: Wed, 21 Sep 2011 14:31:48 +0100
Cc: Xen Devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Delivery-date: Wed, 21 Sep 2011 06:32:45 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1316609997-26002-3-git-send-email-anthony.perard@xxxxxxxxxx>
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>
Organization: Citrix Systems, Inc.
References: <1316609997-26002-1-git-send-email-anthony.perard@xxxxxxxxxx> <1316609997-26002-3-git-send-email-anthony.perard@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Wed, 2011-09-21 at 13:59 +0100, Anthony PERARD wrote:
> Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>

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

> ---
>  tools/libxl/libxl_types.idl |    2 ++
>  tools/libxl/libxltypes.py   |   18 ++++++++++++++++--
>  2 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
> index 5b7e731..0d28283 100644
> --- a/tools/libxl/libxl_types.idl
> +++ b/tools/libxl/libxl_types.idl
> @@ -3,6 +3,8 @@
>  # Builtin libxl types
>  #
>  
> +namespace("libxl_")
> +
>  libxl_domid = Builtin("domid")
>  libxl_uuid = Builtin("uuid", passby=PASS_BY_REFERENCE)
>  libxl_mac = Builtin("mac", passby=PASS_BY_REFERENCE)
> diff --git a/tools/libxl/libxltypes.py b/tools/libxl/libxltypes.py
> index f1a4dcf..86ab4b9 100644
> --- a/tools/libxl/libxltypes.py
> +++ b/tools/libxl/libxltypes.py
> @@ -8,10 +8,23 @@ DIR_IN   = 1
>  DIR_OUT  = 2
>  DIR_BOTH = 3
>  
> +_default_namespace = ""
> +def namespace(s):
> +    if type(s) != str:
> +        raise TypeError, "Require a string for the default namespace."
> +    global _default_namespace
> +    _default_namespace = s
> +
> +def _get_default_namespace():
> +    global _default_namespace
> +    return _default_namespace
> +
> +
>  class Type(object):
>      def __init__(self, typename, **kwargs):
>          self.comment = kwargs.setdefault('comment', None)
> -        self.namespace = kwargs.setdefault('namespace', "libxl_")
> +        self.namespace = kwargs.setdefault('namespace',
> +                _get_default_namespace())
>          self.dir = kwargs.setdefault('dir', DIR_BOTH)
>          if self.dir not in [DIR_NONE, DIR_IN, DIR_OUT, DIR_BOTH]:
>              raise ValueError
> @@ -256,7 +269,8 @@ def parse(f):
>          elif isinstance(t,type(object)) and issubclass(t, Type):
>              globs[n] = t
>          elif n in ['PASS_BY_REFERENCE', 'PASS_BY_VALUE',
> -                   'DIR_NONE', 'DIR_IN', 'DIR_OUT', 'DIR_BOTH']:
> +                   'DIR_NONE', 'DIR_IN', 'DIR_OUT', 'DIR_BOTH',
> +                   'namespace']:
>              globs[n] = t
>  
>      try:



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

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