summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linuxnamespaces/__init__.py16
-rw-r--r--linuxnamespaces/syscalls.py10
2 files changed, 13 insertions, 13 deletions
diff --git a/linuxnamespaces/__init__.py b/linuxnamespaces/__init__.py
index f19503a..a39f43a 100644
--- a/linuxnamespaces/__init__.py
+++ b/linuxnamespaces/__init__.py
@@ -132,7 +132,7 @@ def bind_mount(
srcloc = os.fspath(source)
tgtloc = os.fspath(target)
except ValueError:
- otflags = OpenTreeFlags.OPEN_TREE_CLONE
+ otflags = OpenTreeFlags.CLONE
if recursive:
otflags |= OpenTreeFlags.AT_RECURSIVE
with open_tree(source, otflags) as srcfd:
@@ -218,12 +218,12 @@ def populate_dev(
for fn in "null zero full random urandom tty".split():
files.add(fn)
bind_mounts[fn] = exitstack.enter_context(
- open_tree(origdev / fn, OpenTreeFlags.OPEN_TREE_CLONE)
+ open_tree(origdev / fn, OpenTreeFlags.CLONE)
)
if fuse:
files.add("fuse")
bind_mounts["fuse"] = exitstack.enter_context(
- open_tree(origdev / "fuse", OpenTreeFlags.OPEN_TREE_CLONE)
+ open_tree(origdev / "fuse", OpenTreeFlags.CLONE)
)
if pidns:
symlinks["ptmx"] = "pts/ptmx"
@@ -231,18 +231,18 @@ def populate_dev(
bind_mounts["pts"] = exitstack.enter_context(
open_tree(
origdev / "pts",
- OpenTreeFlags.AT_RECURSIVE | OpenTreeFlags.OPEN_TREE_CLONE,
+ OpenTreeFlags.AT_RECURSIVE | OpenTreeFlags.CLONE,
)
)
files.add("ptmx")
bind_mounts["ptmx"] = exitstack.enter_context(
- open_tree(origdev / "ptmx", OpenTreeFlags.OPEN_TREE_CLONE)
+ open_tree(origdev / "ptmx", OpenTreeFlags.CLONE)
)
if tun:
directories.add("net")
files.add("net/tun")
bind_mounts["net/tun"] = exitstack.enter_context(
- open_tree(origdev / "net/tun", OpenTreeFlags.OPEN_TREE_CLONE)
+ open_tree(origdev / "net/tun", OpenTreeFlags.CLONE)
)
mount(
"devtmpfs",
@@ -309,7 +309,7 @@ def populate_proc(
if namespaces & CloneFlags.NEWNET == CloneFlags.NEWNET:
psn = open_tree(
newproc / "sys/net",
- OpenTreeFlags.OPEN_TREE_CLONE | OpenTreeFlags.AT_RECURSIVE,
+ OpenTreeFlags.CLONE | OpenTreeFlags.AT_RECURSIVE,
)
bind_mount(newproc / "sys", newproc / "sys", True, True)
if psn is not None:
@@ -365,7 +365,7 @@ def populate_sys(
bindfd = exitstack.enter_context(
open_tree(
AtLocation(origroot) / "sys" / source,
- OpenTreeFlags.OPEN_TREE_CLONE | OpenTreeFlags.AT_RECURSIVE,
+ OpenTreeFlags.CLONE | OpenTreeFlags.AT_RECURSIVE,
),
)
if rdonly:
diff --git a/linuxnamespaces/syscalls.py b/linuxnamespaces/syscalls.py
index b55be37..9c18af5 100644
--- a/linuxnamespaces/syscalls.py
+++ b/linuxnamespaces/syscalls.py
@@ -366,15 +366,15 @@ class OpenTreeFlags(enum.IntFlag):
"""This value may be supplied to open_tree(2) as flags."""
NONE = 0
- OPEN_TREE_CLONE = 0x1
- OPEN_TREE_CLOEXEC = os.O_CLOEXEC
+ CLONE = 0x1
+ CLOEXEC = os.O_CLOEXEC
AT_SYMLINK_NOFOLLOW = 0x100
AT_NO_AUTOMOUNT = 0x800
AT_EMPTY_PATH = 0x1000
AT_RECURSIVE = 0x8000
ALL_FLAGS = (
- OPEN_TREE_CLONE
- | OPEN_TREE_CLOEXEC
+ CLONE
+ | CLOEXEC
| AT_SYMLINK_NOFOLLOW
| AT_NO_AUTOMOUNT
| AT_EMPTY_PATH
@@ -690,7 +690,7 @@ def open_tree(
raise ValueError("invalid flags for open_tree")
if (
flags & OpenTreeFlags.AT_RECURSIVE
- and not flags & OpenTreeFlags.OPEN_TREE_CLONE
+ and not flags & OpenTreeFlags.CLONE
):
raise ValueError("invalid flags for open_tree")
if source.flags & AtFlags.AT_SYMLINK_NOFOLLOW: