bunpen: namespace/umount: place the umount flags behind an enum

This commit is contained in:
2024-08-30 11:31:12 +00:00
parent edeb153eb8
commit 3e5cb29a7d
2 changed files with 15 additions and 16 deletions

View File

@@ -289,7 +289,7 @@ fn pivot_into(new_root: str, stash_old_root: (str|void) = void) void = {
case void =>
rtext::check_error("[namespace] pivot_root . .", rtext::pivot_root(".", "."));
// drop the old rootfs. weird idiom, but documented in `man 2 pivot_root`.
rtext::check_error("[namespace] umount .", rt::umount2(".", rtext::MNT_DETACH));
rtext::check_error("[namespace] umount .", rt::umount2(".", rtext::umount_flag::MNT_DETACH));
};
rtext::check_error("[namespace] cd /", os::chdir("/"));
};

View File

@@ -37,23 +37,22 @@ export type mount_flags = u64;
// XXX: hare is weird about these, and declares the flags parameter to `mount2`
// as `int` instead of `u64`.
// attempt to forcibily umount
export const MNT_FORCE: int = 0x00000001;
// just detach from the tree
export const MNT_DETACH: int = 0x00000002;
// mark for expiry
export const MNT_EXPIRE: int = 0x00000004;
// don't follow symlink on umount
export const UMOUNT_NOFOLLOW: int = 0x00000008;
// // flag guaranteed to be unused
// export const UMOUNT_UNUSED: int = 0x80000000;
export type umount_flag = enum int {
// attempt to forcibily umount
MNT_FORCE = 0x00000001,
// just detach from the tree
MNT_DETACH = 0x00000002,
// mark for expiry
MNT_EXPIRE = 0x00000004,
// don't follow symlink on umount
UMOUNT_NOFOLLOW = 0x00000008,
// // flag guaranteed to be unused
// UMOUNT_UNUSED = 0x80000000,
};
// union of `umount_flag`
export type umount_flags = int;
// old magic mount flag (as in: no longer necessary, does nothing!)
export const MS_MGC_VAL: u64 = 0xC0ED0000;
// old magic mount mask (as in: no longer necessary, does nothing!)
export const MS_MGC_MSK: u64 = 0xffff0000;
// XXX(2024-08-24): hare stdlib `mount` syscall has a bug where it mounts
// `target` to `target`, not `source` to `target`.
// TODO: fix upstream