return ret;
}
-static inline int mount_entry_on_systemfs(struct mntent *mntent)
+static inline int mount_entry_on_systemfs(struct lxc_rootfs *rootfs,
+ struct mntent *mntent)
{
int ret;
- char path[PATH_MAX];
/* For containers created without a rootfs all mounts are treated as
* absolute paths starting at / on the host.
*/
if (mntent->mnt_dir[0] != '/')
- ret = snprintf(path, sizeof(path), "/%s", mntent->mnt_dir);
+ ret = snprintf(rootfs->buf, sizeof(rootfs->buf), "/%s", mntent->mnt_dir);
else
- ret = snprintf(path, sizeof(path), "%s", mntent->mnt_dir);
- if (ret < 0 || ret >= sizeof(path))
+ ret = snprintf(rootfs->buf, sizeof(rootfs->buf), "%s", mntent->mnt_dir);
+ if (ret < 0 || ret >= sizeof(rootfs->buf))
return -1;
- return mount_entry_on_generic(mntent, path, NULL, NULL, NULL);
+ return mount_entry_on_generic(mntent, rootfs->buf, NULL, NULL, NULL);
}
static int mount_entry_on_absolute_rootfs(struct mntent *mntent,
return mount_entry_on_generic(mntent, path, rootfs, lxc_name, lxc_path);
}
-static int mount_file_entries(const struct lxc_rootfs *rootfs, FILE *file,
+static int mount_file_entries(struct lxc_rootfs *rootfs, FILE *file,
const char *lxc_name, const char *lxc_path)
{
char buf[PATH_MAX];
int ret;
if (!rootfs->path)
- ret = mount_entry_on_systemfs(&mntent);
+ ret = mount_entry_on_systemfs(rootfs, &mntent);
else if (mntent.mnt_dir[0] != '/')
ret = mount_entry_on_relative_rootfs(&mntent, rootfs,
lxc_name, lxc_path);
#define __do_endmntent __attribute__((__cleanup__(__auto_endmntent__)))
static int setup_mount_fstab(const struct lxc_conf *conf,
- const struct lxc_rootfs *rootfs, const char *fstab,
- const char *lxc_name, const char *lxc_path)
+ struct lxc_rootfs *rootfs, const char *fstab,
+ const char *lxc_name, const char *lxc_path)
{
__do_endmntent FILE *f = NULL;
int ret;
}
static int setup_mount_entries(const struct lxc_conf *conf,
- const struct lxc_rootfs *rootfs,
+ struct lxc_rootfs *rootfs,
struct lxc_list *mount, const char *lxc_name,
const char *lxc_path)
{