make use of libxl path functions
PATCH 1/1 make use of libxl path functions
Make use of the new libxl_*_path functions to specify the correct absolute path of qemu-dm, hvmloader and ioemu-stubdom.gz.
Signed-off-by Stefano Stabellini <[email protected]>
---
tools/libxl/libxl.c +4 -3
@@ -981,7 +981,7 @@ b_info.max_vcpus =1 ; b_info.max_memkb =32 *1024 ; b_info.target_memkb = b_info.max_memkb; - b_info.kernel ="/usr/lib/xen/boot/ioemu-stubdom.gz" ; + b_info.kernel =libxl_abs_path (ctx,"ioemu-stubdom.gz" ,libxl_xenfirmwaredir_path ()); b_info.u.pv.cmdline =libxl_sprintf (ctx," -d %d" , info->domid); b_info.u.pv.ramdisk ="" ; b_info.u.pv.features ="" ;
@@ -1122,7 +1122,8 @@if (rc <0 ) goto xit;if (!rc) {/* inner child */ libxl_exec (null, logfile_w, logfile_w, - info->device_model, args); +libxl_abs_path (ctx, info->device_model,libxl_private_bindir_path ()), + args); } rc =0 ;
@@ -1702,7 +1703,7 @@ } info->domid = vfb->domid; info->dom_name =libxl_domid_to_name (ctx, vfb->domid); - info->device_model ="/usr/lib/xen/bin/qemu-dm" ; + info->device_model =libxl_abs_path (ctx,"qemu-dm" ,libxl_private_bindir_path ()); info->type =XENPV ;return 0 ; }
tools/libxl/libxl_dom.c +1 -1
@@ -171,7 +171,7 @@ {int ret; - ret =xc_hvm_build_target_mem (ctx->xch, domid, (info->max_memkb - info->video_memkb) /1024 , (info->target_memkb - info->video_memkb) /1024 , info->kernel); + ret =xc_hvm_build_target_mem (ctx->xch, domid, (info->max_memkb - info->video_memkb) /1024 , (info->target_memkb - info->video_memkb) /1024 ,libxl_abs_path (ctx, (char *)info->kernel,libxl_xenfirmwaredir_path ()));if (ret) {XL_LOG_ERRNOVAL (ctx,XL_LOG_ERROR , ret,"hvm building failed" );return ERROR_FAIL ;
tools/libxl/libxl_internal.c +10 -0
@@ -194,3 +194,13 @@xl_logv (ctx, loglevel, errnoval, file, line, func, fmt, ap);va_end (ap); } + +char *libxl_abs_path (struct libxl_ctx *ctx,char *s,const char *path) +{ +if (s && s[0 ] !='/' ) { +return libxl_sprintf (ctx,"%s/%s" , path, s); + }else { +return s; + } +} +
tools/libxl/libxl_internal.h +2 -0
@@ -202,6 +202,8 @@void libxl_log_child_exitstatus (struct libxl_ctx *ctx,const char *what,pid_t pid,int status); +char *libxl_abs_path (struct libxl_ctx *ctx,char *s,const char *path); +/* libxl_paths.c */ const char *libxl_sbindir_path (void );const char *libxl_bindir_path (void );