From 970b5b7c6a7778579a4398cdb8d0bfb6bcd33da1 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Fri, 26 Nov 2021 20:03:49 +0100 Subject: init/fs: add the MOUNT macro --- src/init/fs/misc.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/init/fs') diff --git a/src/init/fs/misc.h b/src/init/fs/misc.h index 8e31844..e360a25 100644 --- a/src/init/fs/misc.h +++ b/src/init/fs/misc.h @@ -6,3 +6,9 @@ bool fork2_n_mount(const char *path); void fs_passthru(const char *prefix); void fs_dir_inject(const char *path); + +/** Mounts something and injects its path into the fs */ +// TODO path needs to have a trailing slash +#define MOUNT(path, impl) \ + if (!fork2_n_mount(path)) {impl;} \ + if (!fork2_n_mount("/")) fs_dir_inject(path); -- cgit v1.2.3