[libvirt] [PATCH 2/6] Remove unused 'opts' field from LXC basic mounts struct

Chen Hanxiao chenhanxiao at cn.fujitsu.com
Tue Oct 8 03:56:56 UTC 2013


Reviewed-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>

> -----Original Message-----
> From: libvir-list-bounces at redhat.com
[mailto:libvir-list-bounces at redhat.com]
> On Behalf Of Daniel P. Berrange
> Sent: Monday, October 07, 2013 9:07 PM
> To: libvir-list at redhat.com
> Subject: [libvirt] [PATCH 2/6] Remove unused 'opts' field from LXC basic
mounts
> struct
> 
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> The virLXCBasicMountInfo struct contains a 'char *opts'
> field passed onto the mount() syscall. Every entry in the
> list sets this to NULL though, so it can be removed to
> simplify life.
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  src/lxc/lxc_container.c | 29 ++++++++++++++---------------
>  1 file changed, 14 insertions(+), 15 deletions(-)
> 
> diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
> index b1f429c..3c89ed7 100644
> --- a/src/lxc/lxc_container.c
> +++ b/src/lxc/lxc_container.c
> @@ -752,7 +752,6 @@ typedef struct {
>      const char *src;
>      const char *dst;
>      const char *type;
> -    const char *opts;
>      int mflags;
>  } virLXCBasicMountInfo;
> 
> @@ -763,16 +762,16 @@ static const virLXCBasicMountInfo lxcBasicMounts[]
> = {
>       * mount point in the main OS becomes readonly too which is not what
>       * we want. Hence some things have two entries here.
>       */
> -    { "proc", "/proc", "proc", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV },
> -    { "/proc/sys", "/proc/sys", NULL, NULL, MS_BIND },
> -    { "/proc/sys", "/proc/sys", NULL, NULL,
> MS_BIND|MS_REMOUNT|MS_RDONLY },
> -    { "sysfs", "/sys", "sysfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV },
> -    { "sysfs", "/sys", "sysfs", NULL, MS_BIND|MS_REMOUNT|MS_RDONLY },
> -    { "securityfs", "/sys/kernel/security", "securityfs", NULL,
> MS_NOSUID|MS_NOEXEC|MS_NODEV },
> -    { "securityfs", "/sys/kernel/security", "securityfs", NULL,
> MS_BIND|MS_REMOUNT|MS_RDONLY },
> +    { "proc", "/proc", "proc", MS_NOSUID|MS_NOEXEC|MS_NODEV },
> +    { "/proc/sys", "/proc/sys", NULL, MS_BIND },
> +    { "/proc/sys", "/proc/sys", NULL,
> MS_BIND|MS_REMOUNT|MS_RDONLY },
> +    { "sysfs", "/sys", "sysfs", MS_NOSUID|MS_NOEXEC|MS_NODEV },
> +    { "sysfs", "/sys", "sysfs", MS_BIND|MS_REMOUNT|MS_RDONLY },
> +    { "securityfs", "/sys/kernel/security", "securityfs",
> MS_NOSUID|MS_NOEXEC|MS_NODEV },
> +    { "securityfs", "/sys/kernel/security", "securityfs",
> MS_BIND|MS_REMOUNT|MS_RDONLY },
>  #if WITH_SELINUX
> -    { SELINUX_MOUNT, SELINUX_MOUNT, "selinuxfs", NULL,
> MS_NOSUID|MS_NOEXEC|MS_NODEV },
> -    { SELINUX_MOUNT, SELINUX_MOUNT, NULL, NULL,
> MS_BIND|MS_REMOUNT|MS_RDONLY },
> +    { SELINUX_MOUNT, SELINUX_MOUNT, "selinuxfs",
> MS_NOSUID|MS_NOEXEC|MS_NODEV },
> +    { SELINUX_MOUNT, SELINUX_MOUNT, NULL,
> MS_BIND|MS_REMOUNT|MS_RDONLY },
>  #endif
>  };
> 
> @@ -882,13 +881,13 @@ static int lxcContainerMountBasicFS(bool
> userns_enabled)
>              goto cleanup;
>          }
> 
> -        VIR_DEBUG("Mount %s on %s type=%s flags=%x, opts=%s",
> -                  srcpath, mnt->dst, mnt->type, mnt->mflags,
> mnt->opts);
> -        if (mount(srcpath, mnt->dst, mnt->type, mnt->mflags, mnt->opts) <
> 0) {
> +        VIR_DEBUG("Mount %s on %s type=%s flags=%x",
> +                  srcpath, mnt->dst, mnt->type, mnt->mflags);
> +        if (mount(srcpath, mnt->dst, mnt->type, mnt->mflags, NULL) < 0) {
>              virReportSystemError(errno,
> -                                 _("Failed to mount %s on %s type %s
> flags=%x opts=%s"),
> +                                 _("Failed to mount %s on %s type %s
> flags=%x"),
>                                   srcpath, mnt->dst,
> NULLSTR(mnt->type),
> -                                 mnt->mflags, NULLSTR(mnt->opts));
> +                                 mnt->mflags);
>              goto cleanup;
>          }
>      }
> --
> 1.8.3.1
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list





More information about the libvir-list mailing list