Re: [PATCH v3 02/13] virprocess: Make virProcessRunInMountNamespace use virProcessRunInFork

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

 




On 10/17/18 5:06 AM, Michal Privoznik wrote:
> Both virProcessRunInMountNamespace() and virProcessRunInFork()
> look very similar. De-duplicate the code and make
> virProcessRunInMountNamespace() call virProcessRunInFork().>
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/util/virprocess.c | 62 +++++++++----------------------------------
>  1 file changed, 12 insertions(+), 50 deletions(-)
> 
> diff --git a/src/util/virprocess.c b/src/util/virprocess.c
> index 51b9ccb1bb..3304879212 100644
> --- a/src/util/virprocess.c
> +++ b/src/util/virprocess.c
> @@ -1073,11 +1073,17 @@ int virProcessGetStartTime(pid_t pid,
>  #endif
>  
>  
> -static int virProcessNamespaceHelper(int errfd,
> -                                     pid_t pid,
> -                                     virProcessNamespaceCallback cb,
> +typedef struct _virProcessNamespaceHelperData virProcessNamespaceHelperData;
> +struct _virProcessNamespaceHelperData {
> +    pid_t pid;
> +    virProcessNamespaceCallback cb;
> +    void *opaque;
> +};
> +
> +static int virProcessNamespaceHelper(pid_t pid ATTRIBUTE_UNUSED,
>                                       void *opaque)
>  {
> +    virProcessNamespaceHelperData *data = opaque;
>      int fd = -1;
>      int ret = -1;
>      VIR_AUTOFREE(char *) path = NULL;

Right after this there's a :

     if (virAsprintf(&path, "/proc/%lld/ns/mnt", (long long) pid) < 0)
         goto cleanup;

The last arg should be data->pid I believe...

Beyond that - nothing jumps out at me...

Reviewed-by: John Ferlan <jferlan@xxxxxxxxxx>

John

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux