From: Christian Brauner Date: Fri, 5 Feb 2021 16:54:19 +0000 (+0100) Subject: mount_utils: kill mount_from_at() X-Git-Tag: lxc-5.0.0~298^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55a85f4a1145a4a89354db65fbf4f3ba358cbde8;p=thirdparty%2Flxc.git mount_utils: kill mount_from_at() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/mount_utils.c b/src/lxc/mount_utils.c index fa02d23d6..363c0756a 100644 --- a/src/lxc/mount_utils.c +++ b/src/lxc/mount_utils.c @@ -255,55 +255,6 @@ int fs_attach(int fd_fs, return 0; } -int mount_from_at(int dfd_from, const char *path_from, - __u64 o_flags_from, - __u64 resolve_flags_from, - int dfd_to, const char *path_to, - __u64 o_flags_to, - __u64 resolve_flags_to, - const char *fstype, unsigned int mnt_flags, const void *data) -{ - __do_close int fd_from = -EBADF, fd_to = -EBADF; - struct lxc_open_how how = {}; - int ret; - char src_buf[LXC_PROC_PID_FD_LEN], dst_buf[LXC_PROC_PID_FD_LEN]; - - if (is_empty_string(path_from)) { - ret = snprintf(src_buf, sizeof(src_buf), "/proc/self/fd/%d", dfd_from); - } else { - how.flags = o_flags_from; - how.resolve = resolve_flags_from; - fd_from = openat2(dfd_from, path_from, &how, sizeof(how)); - if (fd_from < 0) - return -errno; - - ret = snprintf(src_buf, sizeof(src_buf), "/proc/self/fd/%d", fd_from); - } - if (ret < 0 || ret >= sizeof(src_buf)) - return -EIO; - - if (is_empty_string(path_to)) { - ret = snprintf(dst_buf, sizeof(dst_buf), "/proc/self/fd/%d", dfd_to); - } else { - how.flags = o_flags_to; - how.resolve = resolve_flags_to; - fd_to = openat2(dfd_to, path_to, &how, sizeof(how)); - if (fd_to < 0) - return -errno; - - ret = snprintf(dst_buf, sizeof(dst_buf), "/proc/self/fd/%d", fd_to); - } - if (ret < 0 || ret >= sizeof(src_buf)) - return -EIO; - - if (is_empty_string(src_buf)) - ret = mount(NULL, dst_buf, fstype, mnt_flags, data); - else - ret = mount(src_buf, dst_buf, fstype, mnt_flags, data); - - return ret; -} - int fd_bind_mount(int dfd_from, const char *path_from, __u64 o_flags_from, __u64 resolve_flags_from, int dfd_to, const char *path_to, diff --git a/src/lxc/mount_utils.h b/src/lxc/mount_utils.h index cced086c4..9ba964de2 100644 --- a/src/lxc/mount_utils.h +++ b/src/lxc/mount_utils.h @@ -157,12 +157,6 @@ __hidden extern int mnt_attributes_old(unsigned int new_flags, unsigned int *old __hidden extern int mount_filesystem(const char *fs_name, const char *path, unsigned int attr_flags); -__hidden extern int mount_from_at(int dfd_from, const char *path_from, - __u64 o_flags_from, __u64 resolve_flags_from, - int dfd_to, const char *path_to, - __u64 o_flags_to, __u64 resolve_flags_to, - const char *fstype, unsigned int mnt_flags, - const void *data); __hidden extern int fs_prepare(const char *fs_name, int dfd_from, const char *path_from, __u64 o_flags_from, __u64 resolve_flags_from);