summaryrefslogtreecommitdiffhomepage
path: root/src/neboot-partition-map.c
blob: d27f534876cef54d0d9c00e8a5c8f441539b3c2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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 (5U)
#define NB_FILESYSTEM_LIST \
  { "NeFS", "HeFS", "FAT32", "ext4", "XeFS" }

/// @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;
}