On Thu, 5 Oct 2023 14:44:40 +1100
David Gibson <david(a)gibson.dropbear.id.au> wrote:
Most of our helpers which need to enter the pasta
network namespace are
quite specialised. Add one which is rather general - it just open()s a
given file in the namespace context and returns the fd back to the main
namespace. This will have some future uses.
Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
util.c | 39 +++++++++++++++++++++++++++++++++++++++
util.h | 1 +
2 files changed, 40 insertions(+)
diff --git a/util.c b/util.c
index a8f3b35..92ad375 100644
--- a/util.c
+++ b/util.c
@@ -364,6 +364,45 @@ bool ns_is_init(void)
return ret;
}
+struct open_in_ns_args {
It would be nice to have the usual kerneldoc-style comment to this
(at a first reading: are "flags" the flags for open(2) or something
specialised for internal use?).
+ const struct ctx *c;
+ int fd;
+ int err;
+ const char *path;
+ int flags;
+};
+
+static int do_open_in_ns(void *arg)
Same for this one.
Eh, ok. I left it out originally, because they both seemed like they
were essentially internals of open_in_ns() itself, but I've added them
now.