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

[Xen-changelog] [xen-unstable] libxl: autogenerate libxl_FOO_init and libxl_FOO_init_FIELD



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1330604775 0
# Node ID 17bfd4d2ffce56b65e7849a5779471ef4f5e4aea
# Parent  aa30f4cfde89eba61ee43fe3a15c1823d5880cad
libxl: autogenerate libxl_FOO_init and libxl_FOO_init_FIELD

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


diff -r aa30f4cfde89 -r 17bfd4d2ffce tools/libxl/gentypes.py
--- a/tools/libxl/gentypes.py   Thu Mar 01 12:26:15 2012 +0000
+++ b/tools/libxl/gentypes.py   Thu Mar 01 12:26:15 2012 +0000
@@ -78,6 +78,88 @@
         s = indent + s
     return s.replace("\n", "\n%s" % indent).rstrip(indent)
 
+def libxl_init_members(ty, nesting = 0):
+    """Returns a list of members of ty which require a separate init"""
+
+    if isinstance(ty, idl.Aggregate):
+        return [f for f in ty.fields if not f.const and 
isinstance(f.type,idl.KeyedUnion)]
+    else:
+        return []
+    
+def _libxl_C_type_init(ty, v, indent = "    ", parent = None, subinit=False):
+    s = ""
+    if isinstance(ty, idl.KeyedUnion):
+        if parent is None:
+            raise Exception("KeyedUnion type must have a parent")
+        if subinit:
+            s += "switch (%s) {\n" % (parent + ty.keyvar.name)
+            for f in ty.fields:
+                (nparent,fexpr) = ty.member(v, f, parent is None)
+                s += "case %s:\n" % f.enumname
+                s += _libxl_C_type_init(f.type, fexpr, "    ", nparent)
+                s += "    break;\n"
+            s += "}\n"
+        else:
+            if ty.keyvar.init_val:
+                s += "%s = %s;\n" % (parent + ty.keyvar.name, 
ty.keyvar.init_val)
+            elif ty.keyvar.type.init_val:
+                s += "%s = %s;\n" % (parent + ty.keyvar.name, 
ty.keyvar.type.init_val)
+    elif isinstance(ty, idl.Struct) and (parent is None or ty.init_fn is None):
+        for f in [f for f in ty.fields if not f.const]:
+            (nparent,fexpr) = ty.member(v, f, parent is None)
+            if f.init_val is not None:
+                s += "%s = %s;\n" % (fexpr, f.init_val)
+            else:
+                s += _libxl_C_type_init(f.type, fexpr, "", nparent)
+    else:
+        if ty.init_val is not None:
+            s += "%s = %s;\n" % (ty.pass_arg(v, parent is None), ty.init_val)
+        elif ty.init_fn is not None:
+            s += "%s(%s);\n" % (ty.init_fn, ty.pass_arg(v, parent is None))
+
+    if s != "":
+        s = indent + s
+    return s.replace("\n", "\n%s" % indent).rstrip(indent)
+
+def libxl_C_type_init(ty):
+    s = ""
+    s += "void %s(%s)\n" % (ty.init_fn, ty.make_arg("p", 
passby=idl.PASS_BY_REFERENCE))
+    s += "{\n"
+    s += "    memset(p, '\\0', sizeof(*p));\n"
+    s += _libxl_C_type_init(ty, "p")
+    s += "}\n"
+    s += "\n"
+    return s
+
+def libxl_C_type_member_init(ty, field):
+    if not isinstance(field.type, idl.KeyedUnion):
+        raise Exception("Only KeyedUnion is supported for member init")
+
+    ku = field.type
+    
+    s = ""
+    s += "void %s(%s, %s)\n" % (ty.init_fn + "_" + ku.keyvar.name,
+                                ty.make_arg("p", passby=idl.PASS_BY_REFERENCE),
+                                ku.keyvar.type.make_arg(ku.keyvar.name))
+    s += "{\n"
+    
+    if ku.keyvar.init_val:
+        init_val = ku.keyvar.init_val
+    elif ku.keyvar.type.init_val:
+        init_val = ku.keyvar.type.init_val
+    else:
+        init_val = None
+        
+    if init_val is not None:
+        (nparent,fexpr) = ty.member(ty.pass_arg("p"), ku.keyvar, isref=True)
+        s += "    assert(%s == %s);\n" % (fexpr, init_val)
+        s += "    %s = %s;\n" % (fexpr, ku.keyvar.name)
+    (nparent,fexpr) = ty.member(ty.pass_arg("p"), field, isref=True)
+    s += _libxl_C_type_init(ku, fexpr, parent=nparent, subinit=True)
+    s += "}\n"
+    s += "\n"
+    return s
+
 def libxl_C_type_gen_json(ty, v, indent = "    ", parent = None):
     s = ""
     if parent is None:
@@ -199,6 +281,15 @@
         f.write(libxl_C_type_define(ty) + ";\n")
         if ty.dispose_fn is not None:
             f.write("void %s(%s);\n" % (ty.dispose_fn, ty.make_arg("p")))
+        if ty.init_fn is not None:
+            f.write("void %s(%s);\n" % (ty.init_fn, ty.make_arg("p")))
+            for field in libxl_init_members(ty):
+                if not isinstance(field.type, idl.KeyedUnion):
+                    raise Exception("Only KeyedUnion is supported for member 
init")
+                ku = field.type
+                f.write("void %s(%s, %s);\n" % (ty.init_fn + "_" + 
ku.keyvar.name,
+                                               ty.make_arg("p"),
+                                               
ku.keyvar.type.make_arg(ku.keyvar.name)))
         if ty.json_fn is not None:
             f.write("char *%s_to_json(libxl_ctx *ctx, %s);\n" % (ty.typename, 
ty.make_arg("p")))
         if isinstance(ty, idl.Enumeration):
@@ -227,7 +318,7 @@
 
 """ % (header_json_define, header_json_define, " ".join(sys.argv)))
 
-    for ty in [ty for ty in types+builtins if ty.json_fn is not None]:
+    for ty in [ty for ty in types if ty.json_fn is not None]:
         f.write("yajl_gen_status %s_gen_json(yajl_gen hand, %s);\n" % 
(ty.typename, ty.make_arg("p", passby=idl.PASS_BY_REFERENCE)))
 
     f.write("\n")
@@ -264,6 +355,11 @@
         f.write("    memset(p, LIBXL_DTOR_POISON, sizeof(*p));\n")
         f.write("}\n")
         f.write("\n")
+        
+    for ty in [t for t in types if t.init_fn is not None and 
t.autogenerate_init_fn]:
+        f.write(libxl_C_type_init(ty))
+        for field in libxl_init_members(ty):
+            f.write(libxl_C_type_member_init(ty, field))
 
     for ty in [t for t in types if isinstance(t,idl.Enumeration)]:
         f.write("const char *%s_to_string(%s e)\n" % (ty.typename, 
ty.typename))
diff -r aa30f4cfde89 -r 17bfd4d2ffce tools/libxl/idl.py
--- a/tools/libxl/idl.py        Thu Mar 01 12:26:15 2012 +0000
+++ b/tools/libxl/idl.py        Thu Mar 01 12:26:15 2012 +0000
@@ -51,6 +51,10 @@
 
         self.autogenerate_dispose_fn = 
kwargs.setdefault('autogenerate_dispose_fn', True)
 
+        self.init_fn = kwargs.setdefault('init_fn', None)
+        self.init_val = kwargs.setdefault('init_val', None)
+        self.autogenerate_init_fn = kwargs.setdefault('autogenerate_init_fn', 
False)
+
         if self.typename is not None and not self.private:
             self.json_fn = kwargs.setdefault('json_fn', self.typename + 
"_gen_json")
         else:
@@ -144,12 +148,20 @@
         self.name = name
         self.const = kwargs.setdefault('const', False)
         self.enumname = kwargs.setdefault('enumname', None)
+        self.init_val = kwargs.setdefault('init_val', None)
 
 class Aggregate(Type):
     """A type containing a collection of other types"""
     def __init__(self, kind, typename, fields, **kwargs):
         Type.__init__(self, typename, **kwargs)
 
+        if self.typename is not None:
+            self.init_fn = kwargs.setdefault('init_fn', self.typename + 
"_init")
+        else:
+            self.init_fn = kwargs.setdefault('init_fn', None)
+
+        self.autogenerate_init_fn = kwargs.setdefault('autogenerate_init_fn', 
True)
+
         self.kind = kind
 
         self.fields = []
diff -r aa30f4cfde89 -r 17bfd4d2ffce tools/libxl/idl.txt
--- a/tools/libxl/idl.txt       Thu Mar 01 12:26:15 2012 +0000
+++ b/tools/libxl/idl.txt       Thu Mar 01 12:26:15 2012 +0000
@@ -44,6 +44,22 @@
  Indicates if the above named Type.dispose_fn should be
  autogenerated.
 
+Type.init_val: (default: None)
+
+ C expression for the value to initialise instances of this type to.
+
+ If present takes precendence over init_fn (see below).
+
+Type.init_fn: (default: typename + "_init" if dir in [IN, BOTH] and
+                        type != None)
+
+ The name of the C function which will initialist Type.
+
+Type.autogenerate_init_fn: (default: True if dir in [IN, BOTH])
+
+ Indicates if the above named Type.init_fn should be
+ autogenerated.
+
 Type.json_fn: (default: typename + "_gen_json" or None if type == None)
 
  The name of the C function which will generate a YAJL data structure
@@ -105,10 +121,13 @@
 
  Each field has the following properties:
 
-  Field.type    The type of the member (a idl.Type).
-  Field.name    The name of the member (can be None for anonymous
-                fields).
-  Field.const   Boolean, true if the member is const.
+  Field.type     The type of the member (a idl.Type).
+  Field.name     The name of the member (can be None for anonymous
+                 fields).
+  Field.const    Boolean, true if the member is const.
+  Field.init_val The initialisation value for this field. Takes
+                 precendence over both Field.type.init_val and
+                 Field.type.init_fn.
 
 idl.Struct
 
diff -r aa30f4cfde89 -r 17bfd4d2ffce tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Thu Mar 01 12:26:15 2012 +0000
+++ b/tools/libxl/libxl.c       Thu Mar 01 12:26:15 2012 +0000
@@ -1227,11 +1227,6 @@
 
 
/******************************************************************************/
 
-void libxl_device_disk_init(libxl_device_disk *disk)
-{
-    memset(disk, 0x00, sizeof(libxl_device_disk));
-}
-
 int libxl__device_disk_setdefault(libxl__gc *gc, libxl_device_disk *disk)
 {
     int rc;
@@ -1718,10 +1713,6 @@
 }
 
 
/******************************************************************************/
-void libxl_device_nic_init(libxl_device_nic *nic)
-{
-    memset(nic, '\0', sizeof(*nic));
-}
 
 int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic)
 {
@@ -2142,10 +2133,6 @@
 }
 
 
/******************************************************************************/
-void libxl_device_vkb_init(libxl_device_vkb *vkb)
-{
-    memset(vkb, 0x00, sizeof(libxl_device_vkb));
-}
 
 int libxl__device_vkb_setdefault(libxl__gc *gc, libxl_device_vkb *vkb)
 {
@@ -2254,10 +2241,6 @@
 }
 
 
/******************************************************************************/
-void libxl_device_vfb_init(libxl_device_vfb *vfb)
-{
-    memset(vfb, 0x00, sizeof(libxl_device_vfb));
-}
 
 int libxl__device_vfb_setdefault(libxl__gc *gc, libxl_device_vfb *vfb)
 {
@@ -3067,6 +3050,8 @@
     struct xen_domctl_sched_credit sdom;
     int rc;
 
+    libxl_sched_credit_domain_init(scinfo);
+
     rc = xc_sched_credit_domain_get(ctx->xch, domid, &sdom);
     if (rc != 0) {
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain sched credit");
@@ -3126,6 +3111,8 @@
     struct xen_domctl_sched_credit2 sdom;
     int rc;
 
+    libxl_sched_credit2_domain_init(scinfo);
+
     rc = xc_sched_credit2_domain_get(ctx->xch, domid, &sdom);
     if (rc != 0) {
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
@@ -3183,6 +3170,8 @@
     uint16_t weight;
     int rc;
 
+    libxl_sched_sedf_domain_init(scinfo);
+
     rc = xc_sedf_domain_get(ctx->xch, domid, &period, &slice, &latency,
                             &extratime, &weight);
     if (rc != 0) {
diff -r aa30f4cfde89 -r 17bfd4d2ffce tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Thu Mar 01 12:26:15 2012 +0000
+++ b/tools/libxl/libxl.h       Thu Mar 01 12:26:15 2012 +0000
@@ -381,10 +381,6 @@
 int libxl_ctx_postfork(libxl_ctx *ctx);
 
 /* domain related functions */
-void libxl_domain_create_info_init(libxl_domain_create_info *c_info);
-void libxl_domain_build_info_init(libxl_domain_build_info *b_info);
-void libxl_domain_build_info_init_type(libxl_domain_build_info *b_info,
-                                       libxl_domain_type type);
 typedef int (*libxl_console_ready)(libxl_ctx *ctx, uint32_t domid, void *priv);
 int libxl_domain_create_new(libxl_ctx *ctx, libxl_domain_config *d_config, 
libxl_console_ready cb, void *priv, uint32_t *domid);
 int libxl_domain_create_restore(libxl_ctx *ctx, libxl_domain_config *d_config, 
libxl_console_ready cb, void *priv, uint32_t *domid, int restore_fd);
@@ -523,7 +519,6 @@
  */
 
 /* Disks */
-void libxl_device_disk_init(libxl_device_disk *disk);
 int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk 
*disk);
 int libxl_device_disk_remove(libxl_ctx *ctx, uint32_t domid,
                              libxl_device_disk *disk,
@@ -549,7 +544,6 @@
 int libxl_device_disk_local_detach(libxl_ctx *ctx, libxl_device_disk *disk);
 
 /* Network Interfaces */
-void libxl_device_nic_init(libxl_device_nic *nic);
 int libxl_device_nic_add(libxl_ctx *ctx, uint32_t domid, libxl_device_nic 
*nic);
 int libxl_device_nic_remove(libxl_ctx *ctx, uint32_t domid,
                             libxl_device_nic *nic,
@@ -561,7 +555,6 @@
                               libxl_device_nic *nic, libxl_nicinfo *nicinfo);
 
 /* Keyboard */
-void libxl_device_vkb_init(libxl_device_vkb *vkb);
 int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb 
*vkb);
 int libxl_device_vkb_remove(libxl_ctx *ctx, uint32_t domid,
                             libxl_device_vkb *vkb,
@@ -569,7 +562,6 @@
 int libxl_device_vkb_destroy(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb 
*vkb);
 
 /* Framebuffer */
-void libxl_device_vfb_init(libxl_device_vfb *vfb);
 int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb 
*vfb);
 int libxl_device_vfb_remove(libxl_ctx *ctx, uint32_t domid,
                             libxl_device_vfb *vfb,
@@ -577,7 +569,6 @@
 int libxl_device_vfb_destroy(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb 
*vfb);
 
 /* PCI Passthrough */
-void libxl_device_pci_init(libxl_device_pci *pci);
 int libxl_device_pci_add(libxl_ctx *ctx, uint32_t domid, libxl_device_pci 
*pcidev);
 int libxl_device_pci_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_pci 
*pcidev);
 int libxl_device_pci_destroy(libxl_ctx *ctx, uint32_t domid, libxl_device_pci 
*pcidev);
diff -r aa30f4cfde89 -r 17bfd4d2ffce tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Thu Mar 01 12:26:15 2012 +0000
+++ b/tools/libxl/libxl_create.c        Thu Mar 01 12:26:15 2012 +0000
@@ -50,11 +50,6 @@
     libxl_domain_build_info_dispose(&d_config->b_info);
 }
 
-void libxl_domain_create_info_init(libxl_domain_create_info *c_info)
-{
-    memset(c_info, '\0', sizeof(*c_info));
-}
-
 int libxl__domain_create_info_setdefault(libxl__gc *gc,
                                          libxl_domain_create_info *c_info)
 {
@@ -69,35 +64,6 @@
     return 0;
 }
 
-void libxl_domain_build_info_init(libxl_domain_build_info *b_info)
-{
-    memset(b_info, '\0', sizeof(*b_info));
-    b_info->type = -1;
-
-    b_info->max_memkb = LIBXL_MEMKB_DEFAULT;
-    b_info->target_memkb = LIBXL_MEMKB_DEFAULT;
-    b_info->shadow_memkb = LIBXL_MEMKB_DEFAULT;
-    b_info->video_memkb =  LIBXL_MEMKB_DEFAULT;
-
-}
-
-void libxl_domain_build_info_init_type(libxl_domain_build_info *b_info,
-                                       libxl_domain_type type)
-{
-    assert(b_info->type == -1);
-    b_info->type = type;
-    switch (b_info->type) {
-    case LIBXL_DOMAIN_TYPE_HVM:
-        b_info->u.hvm.timer_mode = LIBXL_TIMER_MODE_DEFAULT;
-        break;
-    case LIBXL_DOMAIN_TYPE_PV:
-        b_info->u.pv.slack_memkb = LIBXL_MEMKB_DEFAULT;
-        break;
-    default:
-        abort();
-    }
-}
-
 int libxl__domain_build_info_setdefault(libxl__gc *gc,
                                         libxl_domain_build_info *b_info)
 {
diff -r aa30f4cfde89 -r 17bfd4d2ffce tools/libxl/libxl_json.h
--- a/tools/libxl/libxl_json.h  Thu Mar 01 12:26:15 2012 +0000
+++ b/tools/libxl/libxl_json.h  Thu Mar 01 12:26:15 2012 +0000
@@ -22,6 +22,20 @@
 #  include <yajl/yajl_version.h>
 #endif
 
+yajl_gen_status libxl_defbool_gen_json(yajl_gen hand, libxl_defbool *p);
+yajl_gen_status libxl_domid_gen_json(yajl_gen hand, libxl_domid *p);
+yajl_gen_status libxl_uuid_gen_json(yajl_gen hand, libxl_uuid *p);
+yajl_gen_status libxl_mac_gen_json(yajl_gen hand, libxl_mac *p);
+yajl_gen_status libxl_cpumap_gen_json(yajl_gen hand, libxl_cpumap *p);
+yajl_gen_status libxl_cpuid_policy_list_gen_json(yajl_gen hand,
+                                                 libxl_cpuid_policy_list *p);
+yajl_gen_status libxl_string_list_gen_json(yajl_gen hand, libxl_string_list 
*p);
+yajl_gen_status libxl_key_value_list_gen_json(yajl_gen hand,
+                                              libxl_key_value_list *p);
+yajl_gen_status libxl_file_reference_gen_json(yajl_gen hand,
+                                              libxl_file_reference *p);
+yajl_gen_status libxl_hwcap_gen_json(yajl_gen hand, libxl_hwcap *p);
+
 #include <_libxl_types_json.h>
 
 /* YAJL version check */
diff -r aa30f4cfde89 -r 17bfd4d2ffce tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c   Thu Mar 01 12:26:15 2012 +0000
+++ b/tools/libxl/libxl_pci.c   Thu Mar 01 12:26:15 2012 +0000
@@ -765,11 +765,6 @@
     return -1;
 }
 
-void libxl_device_pci_init(libxl_device_pci *pci)
-{
-    memset(pci, '\0', sizeof(*pci));
-}
-
 int libxl__device_pci_setdefault(libxl__gc *gc, libxl_device_pci *pci)
 {
     return 0;
diff -r aa30f4cfde89 -r 17bfd4d2ffce tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl       Thu Mar 01 12:26:15 2012 +0000
+++ b/tools/libxl/libxl_types.idl       Thu Mar 01 12:26:15 2012 +0000
@@ -100,7 +100,7 @@
     (1, "no_delay_for_missed_ticks"),
     (2, "no_missed_ticks_pending"),
     (3, "one_missed_tick_pending"),
-    ])
+    ], init_val = "LIBXL_TIMER_MODE_DEFAULT")
 
 libxl_bios_type = Enumeration("bios_type", [
     (1, "rombios"),
@@ -180,19 +180,19 @@
     ("vcpu_max_id", uint32),
     ("vcpu_online", uint32),
     ("cpupool",     uint32),
-    ])
+    ], dir=DIR_OUT)
 
 libxl_cpupoolinfo = Struct("cpupoolinfo", [
     ("poolid",      uint32),
     ("sched",       libxl_scheduler),
     ("n_dom",       uint32),
     ("cpumap",      libxl_cpumap)
-    ])
+    ], dir=DIR_OUT)
 
 libxl_vminfo = Struct("vminfo", [
     ("uuid", libxl_uuid),
     ("domid", libxl_domid),
-    ])
+    ], dir=DIR_OUT)
 
 libxl_version_info = Struct("version_info", [
     ("xen_version_major", integer),
@@ -207,7 +207,7 @@
     ("virt_start",        uint64),
     ("pagesize",          integer),
     ("commandline",       string),
-    ])
+    ], dir=DIR_OUT)
 
 libxl_domain_create_info = Struct("domain_create_info",[
     ("type",         libxl_domain_type),
@@ -219,7 +219,9 @@
     ("xsdata",       libxl_key_value_list),
     ("platformdata", libxl_key_value_list),
     ("poolid",       uint32),
-    ])
+    ], dir=DIR_IN)
+
+MemKB = UInt(64, init_val = "LIBXL_MEMKB_DEFAULT")
 
 # Instances of libxl_file_reference contained in this struct which
 # have been mapped (with libxl_file_reference_map) will be unmapped
@@ -297,8 +299,8 @@
                                       # Use host's E820 for PCI passthrough.
                                       ("e820_host", libxl_defbool),
                                       ])),
-                 ])),
-    ],
+                 ], keyvar_init_val = "-1")),
+    ], dir=DIR_IN
 )
 
 libxl_device_vfb = Struct("device_vfb", [
@@ -360,7 +362,7 @@
     ("state", integer),
     ("evtch", integer),
     ("rref", integer),
-    ])
+    ], dir=DIR_OUT)
 
 libxl_nicinfo = Struct("nicinfo", [
     ("backend", string),
@@ -372,7 +374,7 @@
     ("evtch", integer),
     ("rref_tx", integer),
     ("rref_rx", integer),
-    ])
+    ], dir=DIR_OUT)
 
 libxl_vcpuinfo = Struct("vcpuinfo", [
     ("vcpuid", uint32),
@@ -382,7 +384,7 @@
     ("running", bool),
     ("vcpu_time", uint64), # total vcpu time ran (ns)
     ("cpumap", libxl_cpumap), # current cpu's affinities
-    ])
+    ], dir=DIR_OUT)
 
 libxl_physinfo = Struct("physinfo", [
     ("threads_per_core", uint32),
@@ -409,7 +411,7 @@
     ("core", uint32),
     ("socket", uint32),
     ("node", uint32),
-    ])
+    ], dir=DIR_OUT)
 
 libxl_sched_credit_domain = Struct("sched_credit_domain", [
     ("weight", integer),
diff -r aa30f4cfde89 -r 17bfd4d2ffce tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Thu Mar 01 12:26:15 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Thu Mar 01 12:26:15 2012 +0000
@@ -3922,6 +3922,7 @@
 {
     int rc;
 
+    
     rc = libxl_sched_credit_domain_set(ctx, domid, scinfo);
     if (rc)
         fprintf(stderr, "libxl_sched_credit_domain_set failed.\n");
@@ -3950,6 +3951,7 @@
         scinfo.weight,
         scinfo.cap);
     free(domname);
+    libxl_sched_credit_domain_dispose(&scinfo);
     return 0;
 }
 
@@ -3997,6 +3999,7 @@
         domid,
         scinfo.weight);
     free(domname);
+    libxl_sched_credit2_domain_dispose(&scinfo);
     return 0;
 }
 
@@ -4020,7 +4023,6 @@
     rc = libxl_sched_sedf_domain_set(ctx, domid, scinfo);
     if (rc)
         fprintf(stderr, "libxl_sched_sedf_domain_set failed.\n");
-
     return rc;
 }
 
@@ -4049,6 +4051,7 @@
         scinfo.extratime,
         scinfo.weight);
     free(domname);
+    libxl_sched_sedf_domain_dispose(&scinfo);
     return 0;
 }
 
@@ -4181,6 +4184,7 @@
             if (opt_c)
                 scinfo.cap = cap;
             rc = sched_credit_domain_set(domid, &scinfo);
+            libxl_sched_credit_domain_dispose(&scinfo);
             if (rc)
                 return -rc;
         }
@@ -4255,6 +4259,7 @@
             if (opt_w)
                 scinfo.weight = weight;
             rc = sched_credit2_domain_set(domid, &scinfo);
+            libxl_sched_credit2_domain_dispose(&scinfo);
             if (rc)
                 return -rc;
         }
@@ -4373,6 +4378,7 @@
                 scinfo.slice = 0;
             }
             rc = sched_sedf_domain_set(domid, &scinfo);
+            libxl_sched_sedf_domain_dispose(&scinfo);
             if (rc)
                 return -rc;
         }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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