From 7d6895d7ca0fe472c64964793b12f8ea536decde Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Fri, 27 Jun 2025 21:04:36 +0200 Subject: mount syscall now accepts options as dict --- linuxnamespaces/syscalls.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'linuxnamespaces/syscalls.py') diff --git a/linuxnamespaces/syscalls.py b/linuxnamespaces/syscalls.py index 108c357..e9b0e44 100644 --- a/linuxnamespaces/syscalls.py +++ b/linuxnamespaces/syscalls.py @@ -583,7 +583,7 @@ def mount( target: PathConvertible, filesystemtype: str | None, flags: MountFlags = MountFlags.NONE, - data: str | list[str] | None = None, + data: str | list[str] | dict[str, str | int | None] | None = None, ) -> None: """Python wrapper for mount(2).""" if (flags & MountFlags.PROPAGATION_FLAGS).bit_count() > 1: @@ -595,6 +595,11 @@ def mount( ) ): raise ValueError("invalid flags for mount") + if isinstance(data, dict): + data = [ + key if value is None else f"{key}={value}" + for key, value in data.items() + ] if isinstance(data, list): if any("," in s for s in data): raise ValueError("data elements must not contain a comma") -- cgit v1.2.3