tools/xl:Call init and dispose function for libxl_dominfo
PATCH 4/4 tools/xl:Call init and dispose function for libxl_dominfo
This patch calls init and dispose function for libxl_dominfo type in function main_list in tools/libxl/xl_cmdimpl.c
IDL generated libxl types should be used only after calling the init function.
--
tools/libxl/xl_cmdimpl.c +2 -0
@@ -4330,6 +4330,7 @@ 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 +4382,7 @@ int main_list(int argc, char **argv)else libxl_dominfo_dispose (info); +libxl_dominfo_dispose (&info_buf);return 0 ; }
Quoted 20 lines · Uma Sharma
This patch calls init and dispose function for
libxl_dominfotype in functionmain_listintools/libxl/xl_cmdimpl.c
IDL generated libxl types should be used only after calling the init function.Signed-off-by Uma Sharma <[email protected]>--
tools/libxl/xl_cmdimpl.c +1
-0@@ -4330,6 +4330,7 @@ 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 ;
tools/libxl/xl_cmdimpl.c int main_list(int argc, char **argv) · line 4385
Quoted 4 lines
tools/libxl/xl_cmdimpl.c +1
-0@@ -4381,6 +4382,7 @@ int main_list(int argc, char **argv)else libxl_dominfo_dispose (info); +libxl_dominfo_dispose (&info_buf);
I'm sorry that main_list is a bit entangled. But I don't think the patch proposed here is right. There's one branch that makes info point to &info_buf.
Though we intend to make _dispose idempotent, but it's not idempotent for libxl_dominfo_dispose. Calling it on the same object twice yields no good result.
Wei.
Quoted 3 lines
tools/libxl/xl_cmdimpl.c +0
-0return 0 ; }
Quoted 30 lines · Wei Liu
Quoted 20 lines · Uma Sharma
This patch calls init and dispose function for
libxl_dominfotype in functionmain_listintools/libxl/xl_cmdimpl.c
IDL generated libxl types should be used only after calling the init function.Signed-off-by Uma Sharma <[email protected]>--
tools/libxl/xl_cmdimpl.c +1
-0@@ -4330,6 +4330,7 @@ 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 ;tools/libxl/xl_cmdimpl.c int main_list(int argc, char **argv) · line 4385
Quoted 4 lines
tools/libxl/xl_cmdimpl.c +1
-0@@ -4381,6 +4382,7 @@ int main_list(int argc, char **argv)else libxl_dominfo_dispose (info); +libxl_dominfo_dispose (&info_buf);I'm sorry that
main_listis a bit entangled. But I don't think the patch proposed here is right. There's one branch that makes info point to&info_buf.
Quoted 6 lines
Though we intend to make
_disposeidempotent, but it's not idempotent forlibxl_dominfo_dispose. Calling it on the same object twice yields no good result.Wei.
BTW I think main_sharing suffers from the same problem. If you figure out a way to improve main_list, you can take main_sharing as extra bonus. :-)
Wei.
Quoted 3 lines
Quoted 3 lines
tools/libxl/xl_cmdimpl.c +0
-0return 0 ; }
I was thinking to call _dispose at all the relevant exit sections of main_list instead calling at the end so that I can avoid calling _dispose twice on info_buf.
Will that work?
Regards,
Uma
Quoted 47 lines · Wei Liu
Quoted 30 lines · Wei Liu
Quoted 20 lines · Uma Sharma
This patch calls init and dispose function for
libxl_dominfotype in functionmain_listintools/libxl/xl_cmdimpl.c
IDL generated libxl types should be used only after calling the init function.Signed-off-by Uma Sharma <[email protected]>--
tools/libxl/xl_cmdimpl.c +1
-0@@ -4330,6 +4330,7 @@ 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 ;tools/libxl/xl_cmdimpl.c int main_list(int argc, char **argv) · line 4385
Quoted 4 lines
tools/libxl/xl_cmdimpl.c +1
-0@@ -4381,6 +4382,7 @@ int main_list(int argc, char **argv)else libxl_dominfo_dispose (info); +libxl_dominfo_dispose (&info_buf);I'm sorry that
main_listis a bit entangled. But I don't think the patch proposed here is right. There's one branch that makes info point to&info_buf.Quoted 6 lines
Though we intend to make
_disposeidempotent, but it's not idempotent forlibxl_dominfo_dispose. Calling it on the same object twice yields no good result.Wei.
BTW I think
main_sharingsuffers from the same problem. If you figure out a way to improvemain_list, you can takemain_sharingas extra bonus. :-)Wei.
Quoted 3 lines
Quoted 3 lines
tools/libxl/xl_cmdimpl.c +0
-0return 0 ; }
Quoted 5 lines · Uma Sharma
I was thinking to call
_disposeat all the relevant exit sections ofmain_listinstead calling at the end so that I can avoid calling_disposetwice oninfo_buf.
Will that work?
Not sure what you mean by "exit sections", but keep in mind that info is used by list_domains / list_domains_details, the way you described doesn't look right either.
You might need to spend some time disentangle that function first.
Wei.