On Thu, Feb 05, 2026 at 08:58:01PM +0100, Ruslan Ruslichenko wrote:
> From: Ruslan Ruslichenko <[email protected]>
> 
> This patch adds a new command line option `-machine-path` to specify
> a directory path for shared machine resources.

We have a fairly general principal that we don't want to introduce
new top level command line arguments to QEMU anymore.

Could this perhaps be modelled as a machine  type property, settable
via -machine instead ?

> 
> This path is intended to serve as a base directory for devices or
> subsystems that need to automatically create coordination files,
> such as Unix domain sockets, particularly in multi-process simulation
> environments.
> 
> Signed-off-by: Edgar E. Iglesias <[email protected]>
> Signed-off-by: Takahiro Nakata <[email protected]>
> Signed-off-by: Ruslan Ruslichenko <[email protected]>
> ---
>  include/system/system.h |  2 ++
>  qemu-options.hx         | 10 ++++++++++
>  system/vl.c             |  4 ++++
>  3 files changed, 16 insertions(+)
> 
> diff --git a/include/system/system.h b/include/system/system.h
> index 03a2d0e900..0cd012004d 100644
> --- a/include/system/system.h
> +++ b/include/system/system.h
> @@ -57,6 +57,8 @@ bool is_mlock_on_fault(MlockState);
>  
>  extern MlockState mlock_state;
>  
> +extern const char *machine_path;
> +
>  #define MAX_OPTION_ROMS 16
>  typedef struct QEMUOptionRom {
>      const char *name;
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 6dd3e04e38..b7dd2a64f0 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -765,6 +765,16 @@ SRST
>      Preallocate memory when using -mem-path.
>  ERST
>  
> +DEF("machine-path", HAS_ARG, QEMU_OPTION_machine_path,
> +    "-machine-path DIR A directory in which to create machine nodes\n",
> +    QEMU_ARCH_ALL)
> +SRST
> +``-machine-path path``
> +    Selects the machine path.
> +    Multi-arch machine nodes will be created in <path>.
> +    This option also sets -mem-shared-path to the given path.
> +ERST
> +
>  DEF("k", HAS_ARG, QEMU_OPTION_k,
>      "-k language     use keyboard layout (for example 'fr' for French)\n",
>      QEMU_ARCH_ALL)
> diff --git a/system/vl.c b/system/vl.c
> index c890da586c..4750b1cf69 100644
> --- a/system/vl.c
> +++ b/system/vl.c
> @@ -182,6 +182,7 @@ static QemuPluginList plugin_list = 
> QTAILQ_HEAD_INITIALIZER(plugin_list);
>  static BlockdevOptionsQueue bdo_queue = QSIMPLEQ_HEAD_INITIALIZER(bdo_queue);
>  static bool nographic = false;
>  static int mem_prealloc; /* force preallocation of physical target memory */
> +const char *machine_path;
>  static const char *vga_model = NULL;
>  static DisplayOptions dpy;
>  static int num_serial_hds;
> @@ -3128,6 +3129,9 @@ void qemu_init(int argc, char **argv)
>              case QEMU_OPTION_mem_prealloc:
>                  mem_prealloc = 1;
>                  break;
> +            case QEMU_OPTION_machine_path:
> +                machine_path = optarg;
> +                break;
>              case QEMU_OPTION_d:
>                  log_mask = optarg;
>                  break;
> -- 
> 2.43.0
> 
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Reply via email to