]> git.proxmox.com Git - mirror_lxc.git/commitdiff
mount_utils: kill mount_at()
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 5 Feb 2021 16:34:57 +0000 (17:34 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 5 Feb 2021 17:52:54 +0000 (18:52 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/mount_utils.c
src/lxc/mount_utils.h

index 590b4bf397ff48eabac332e05a32a4fd1e89d37c..a11526d0e6b29b6a115326062d8310d4645a3e52 100644 (file)
@@ -139,61 +139,6 @@ int mount_filesystem(const char *fs_name, const char *path, unsigned int attr_fl
        return mount("none", path, fs_name, old_flags, NULL);
 }
 
-int mount_at(int dfd,
-            const char *src_under_dfd,
-            const char *dst_under_dfd,
-            __u64 o_flags,
-            __u64 resolve_flags,
-            const char *fstype,
-            unsigned int mnt_flags,
-            const void *data)
-{
-       __do_close int source_fd = -EBADF, target_fd = -EBADF;
-       struct lxc_open_how how = {
-               .flags          = o_flags,
-               .resolve        = resolve_flags,
-       };
-       int ret;
-       char src_buf[LXC_PROC_PID_FD_LEN], dst_buf[LXC_PROC_PID_FD_LEN];
-
-       if (dfd < 0)
-               return ret_errno(EINVAL);
-
-       if (!is_empty_string(src_buf) && *src_buf == '/')
-               return log_error_errno(-EINVAL, EINVAL, "Absolute path specified");
-
-       if (!is_empty_string(src_under_dfd)) {
-               source_fd = openat2(dfd, src_under_dfd, &how, sizeof(how));
-               if (source_fd < 0)
-                       return -errno;
-
-               ret = snprintf(src_buf, sizeof(src_buf), "/proc/self/fd/%d", source_fd);
-               if (ret < 0 || ret >= sizeof(src_buf))
-                       return -EIO;
-       }
-
-       if (!is_empty_string(dst_under_dfd)) {
-               target_fd = openat2(dfd, dst_under_dfd, &how, sizeof(how));
-               if (target_fd < 0)
-                       return log_error_errno(-errno, errno, "Failed to open %d(%s)", dfd, dst_under_dfd);
-
-               TRACE("Mounting %d(%s) through /proc/self/fd/%d", target_fd, dst_under_dfd, target_fd);
-               ret = snprintf(dst_buf, sizeof(dst_buf), "/proc/self/fd/%d", target_fd);
-       } else {
-               TRACE("Mounting %d through /proc/self/fd/%d", dfd, dfd);
-               ret = snprintf(dst_buf, sizeof(dst_buf), "/proc/self/fd/%d", dfd);
-       }
-       if (ret < 0 || ret >= sizeof(dst_buf))
-               return -EIO;
-
-       if (!is_empty_string(src_buf))
-               ret = mount(src_buf, dst_buf, fstype, mnt_flags, data);
-       else
-               ret = mount(NULL, dst_buf, fstype, mnt_flags, data);
-
-       return ret;
-}
-
 static int __fs_prepare(const char *fs_name, int fd_from)
 {
        __do_close int fd_fs = -EBADF;
index efb9915c65ab443452a57c659190811374fa95ae..8f57802f5acbef8404b903cb56078dc667724386 100644 (file)
@@ -152,11 +152,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_at(int dfd, const char *src_under_dfd,
-                            const char *dst_under_dfd, __u64 o_flags,
-                            __u64 resolve_flags, const char *fstype,
-                            unsigned int mnt_flags, const void *data);
-
 __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,