summaryrefslogtreecommitdiffhomepage
path: root/src/neboot-partition-map.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/neboot-partition-map.c')
-rw-r--r--src/neboot-partition-map.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/neboot-partition-map.c b/src/neboot-partition-map.c
new file mode 100644
index 0000000..c13907c
--- /dev/null
+++ b/src/neboot-partition-map.c
@@ -0,0 +1,30 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024, Amlal EL Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#include <lib/partition-map.h>
+#include <lib/string.h>
+
+// include this for documentation.
+
+#define NB_FILESYSTEM_COUNT 4
+#define NB_FILESYSTEM_LIST \
+ { "NeFS", "HeFS", "FAT32", "ext4" }
+
+/// @brief check if filesystem is supported by NeBoot.
+/// @param fs the filesystem magic, as provided by EPM.
+boolean cb_filesystem_exists(caddr_t fs, size_t len) {
+ if (fs == nil || *fs == 0) return no;
+
+ char* fs_list[] = NB_FILESYSTEM_LIST;
+
+ for (size_t fs_index = 0; fs_index < NB_FILESYSTEM_COUNT; fs_index++) {
+ if (strncmp(fs_list[fs_index], fs, strlen(fs_list[fs_index])) == 0) {
+ return yes;
+ }
+ }
+
+ return no;
+}