From: Christian Brauner Date: Wed, 28 Apr 2021 09:26:11 +0000 (+0200) Subject: storage/dir: use "source" and "target" as terms X-Git-Tag: lxc-5.0.0~188^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=196a800af5cc8c52e8d213578be4036e6acb46f6;p=thirdparty%2Flxc.git storage/dir: use "source" and "target" as terms Signed-off-by: Christian Brauner --- diff --git a/src/lxc/storage/dir.c b/src/lxc/storage/dir.c index 8a3d33f67..5cf1fd359 100644 --- a/src/lxc/storage/dir.c +++ b/src/lxc/storage/dir.c @@ -131,7 +131,7 @@ int dir_mount(struct lxc_storage *bdev) struct lxc_mount_options *mnt_opts = &rootfs->mnt_opts; unsigned long mflags = 0; int ret; - const char *src; + const char *source, *target; if (!strequal(bdev->type, "dir")) return syserror_set(-EINVAL, "Invalid storage driver"); @@ -145,23 +145,24 @@ int dir_mount(struct lxc_storage *bdev) if (rootfs->dfd_idmapped >= 0 && !can_use_bind_mounts()) return syserror_set(-EOPNOTSUPP, "Idmapped mount requested but kernel doesn't support new mount API"); - src = lxc_storage_get_path(bdev->src, bdev->type); + source = lxc_storage_get_path(bdev->src, bdev->type); + target = bdev->dest; if (can_use_bind_mounts()) { __do_close int fd_source = -EBADF, fd_target = -EBADF; - fd_target = open_at(-EBADF, bdev->dest, PROTECT_OPATH_DIRECTORY, 0, 0); + fd_target = open_at(-EBADF, target, PROTECT_OPATH_DIRECTORY, 0, 0); if (fd_target < 0) - return syserror("Failed to open \"%s\"", bdev->dest); + return syserror("Failed to open \"%s\"", target); if (rootfs->dfd_idmapped >= 0) { ret = move_detached_mount(rootfs->dfd_idmapped, fd_target, "", PROTECT_OPATH_DIRECTORY, PROTECT_LOOKUP_BENEATH); } else { - fd_source = open_at(-EBADF, src, PROTECT_OPATH_DIRECTORY, 0, 0); + fd_source = open_at(-EBADF, source, PROTECT_OPATH_DIRECTORY, 0, 0); if (fd_source < 0) - return syserror("Failed to open \"%s\"", src); + return syserror("Failed to open \"%s\"", source); ret = fd_bind_mount(fd_source, "", PROTECT_OPATH_DIRECTORY, @@ -170,29 +171,29 @@ int dir_mount(struct lxc_storage *bdev) PROTECT_LOOKUP_BENEATH, 0, true); } if (ret < 0) - return syserror("Failed to mount \"%s\" onto \"%s\"", src, bdev->dest); + return syserror("Failed to mount \"%s\" onto \"%s\"", source, target); } else { - ret = mount(src, bdev->dest, "bind", MS_BIND | MS_REC | mnt_opts->mnt_flags | mnt_opts->prop_flags, mnt_opts->data); + ret = mount(source, target, "bind", MS_BIND | MS_REC | mnt_opts->mnt_flags | mnt_opts->prop_flags, mnt_opts->data); if (ret < 0) - return log_error_errno(-errno, errno, "Failed to mount \"%s\" on \"%s\"", src, bdev->dest); + return log_error_errno(-errno, errno, "Failed to mount \"%s\" on \"%s\"", source, target); if (ret == 0 && (mnt_opts->mnt_flags & MS_RDONLY)) { - mflags = add_required_remount_flags(src, bdev->dest, MS_BIND | MS_REC | mnt_opts->mnt_flags | mnt_opts->mnt_flags | MS_REMOUNT); + mflags = add_required_remount_flags(source, target, MS_BIND | MS_REC | mnt_opts->mnt_flags | mnt_opts->mnt_flags | MS_REMOUNT); - ret = mount(src, bdev->dest, "bind", mflags, mnt_opts->data); + ret = mount(source, target, "bind", mflags, mnt_opts->data); if (ret < 0) return log_error_errno(-errno, errno, "Failed to remount \"%s\" on \"%s\" read-only with options \"%s\", mount flags \"%lu\", and propagation flags \"%lu\"", - src ? src : "(none)", bdev->dest, mnt_opts->data, mflags, mnt_opts->mnt_flags); + source ? source : "(none)", target, mnt_opts->data, mflags, mnt_opts->mnt_flags); else DEBUG("Remounted \"%s\" on \"%s\" read-only with options \"%s\", mount flags \"%lu\", and propagation flags \"%lu\"", - src ? src : "(none)", bdev->dest, mnt_opts->data, mflags, mnt_opts->mnt_flags); + source ? source : "(none)", target, mnt_opts->data, mflags, mnt_opts->mnt_flags); } TRACE("Mounted \"%s\" on \"%s\" with options \"%s\", mount flags \"%lu\", and propagation flags \"%lu\"", - src ? src : "(none)", bdev->dest, mnt_opts->data, mflags, mnt_opts->mnt_flags); + source ? source : "(none)", target, mnt_opts->data, mflags, mnt_opts->mnt_flags); } - TRACE("Mounted \"%s\" onto \"%s\"", src, bdev->dest); + TRACE("Mounted \"%s\" onto \"%s\"", source, target); return 0; }