qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/2] Dump: add command "fuse-mount"


From: Daniel P. Berrange
Subject: Re: [Qemu-devel] [PATCH 2/2] Dump: add command "fuse-mount"
Date: Mon, 9 May 2016 17:30:13 +0100
User-agent: Mutt/1.6.0 (2016-04-01)

On Sun, May 08, 2016 at 07:32:48AM +0800, Nan Li wrote:
> Add a "fuse-mount" command to support the Filesystem in Userspace (FUSE).
> It can mount or unmount the filesystem with both hmp and qmp commands.
> It calls the API function qemu_fuse_main(int argc, char *argv[]).
> 
> Signed-off-by: Nan Li <address@hidden>
> ---
>  dump.c           | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
>  hmp-commands.hx  | 19 +++++++++++++++++++
>  hmp.c            | 12 ++++++++++++
>  hmp.h            |  1 +
>  qapi-schema.json | 15 +++++++++++++++
>  qmp-commands.hx  | 31 +++++++++++++++++++++++++++++++
>  6 files changed, 126 insertions(+)
> 
> diff --git a/dump.c b/dump.c
> index 9726f1f..7599f06 100644
> --- a/dump.c
> +++ b/dump.c
> @@ -26,6 +26,10 @@
>  #include "qapi/qmp/qerror.h"
>  #include "qmp-commands.h"
>  #include "qapi-event.h"
> +#ifdef CONFIG_FUSE
> +#include <sys/mount.h>
> +#include "fuse-mem.h"
> +#endif
>  
>  #include <zlib.h>
>  #ifdef CONFIG_LZO
> @@ -1846,3 +1850,47 @@ DumpGuestMemoryCapability 
> *qmp_query_dump_guest_memory_capability(Error **errp)
>  
>      return cap;
>  }
> +
> +#ifdef CONFIG_FUSE
> +static void *fuse_process(void *data)
> +{
> +    pid_t pid;
> +    int argc = 2;
> +    char *argv[2];
> +    char programname[] = "fuse-mount-process";
> +    argv[0] = programname;
> +    argv[1] = (char *)data;
> +    int ret;
> +
> +    if ((pid = fork()) < 0)
> +        perror("fork() is failed");
> +    else if (pid == 0) {
> +        ret = qemu_fuse_main(argc, argv);

If you fork() in a multi-threaded program, then you are restricted to
only use POSIX APIs declared async signal safe, until such time as
you execve().  I've not looked at the code, but I'm not imagining that
fuse_main() is going to be safe in this respect.


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|



reply via email to

[Prev in Thread] Current Thread [Next in Thread]