Skip to contentSkip to conversation

tools/xl: Call init function for libxl defined datatypes

PATCH RESEND Superseded Uma Sharma 1 participant 1 message Oct 18, 2014

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Uma Sharma

author
#0 lore raw

PATCH RESEND v2 1/1 tools/xl: Call init function for libxl defined datatypes

This patch calls init function for libxl_domain_sched_params before passing it as reference to sched_domain_get() function in tools/libxl/xl_cmdimpl.c
IDL generated libxl types should be used only after calling the init function even if the variable is simply being passed by reference as an output parameter to a libxl function

--
Changed since v1:
-Calling _init before using libxl_dominfo type and _dispose after using in function main_list

--

tools/libxl/xl_cmdimpl.c +9 -0
index c734f79..8067415 100644
@@ -4330,6 +4330,8 @@ int main_list(int argc, char **argv)
     libxl_dominfo *info, *info_free=0;
     int nb_domain, rc;
 
+    libxl_dominfo_init(&info_buf);
+    
     SWITCH_FOREACH_OPT(opt, "lvhZn", opts, "list", 0) {
     case 'l':
         details = 1;
@@ -4381,6 +4383,7 @@ int main_list(int argc, char **argv)
     else
         libxl_dominfo_dispose(info);
 
+    libxl_dominfo_dispose(&info_buf);
     return 0;
 }
 
@@ -5215,6 +5218,8 @@ static int sched_credit_domain_output(int domid)
         printf("%-33s %4s %6s %4s\n", "Name", "ID", "Weight", "Cap");
         return 0;
     }
+    
+    libxl_domain_sched_params_init(&scinfo);
     rc = sched_domain_get(LIBXL_SCHEDULER_CREDIT, domid, &scinfo);
     if (rc)
         return rc;
@@ -5261,6 +5266,8 @@ static int sched_credit2_domain_output(
         printf("%-33s %4s %6s\n", "Name", "ID", "Weight");
         return 0;
     }
+    
+    libxl_domain_sched_params_init(&scinfo);
     rc = sched_domain_get(LIBXL_SCHEDULER_CREDIT2, domid, &scinfo);
     if (rc)
         return rc;
@@ -5286,6 +5293,8 @@ static int sched_sedf_domain_output(
                "Slice", "Latency", "Extra", "Weight");
         return 0;
     }
+    
+    libxl_domain_sched_params_init(&scinfo);
     rc = sched_domain_get(LIBXL_SCHEDULER_SEDF, domid, &scinfo);
     if (rc)
         return rc;