| 1 | /* @title: Filesystem Detection */ |
| 2 | #pragma once |
| 3 | #include <log.h> |
| 4 | |
| 5 | struct block_device; |
| 6 | enum fs_type { |
| 7 | FS_DEVTMPFS = -2, |
| 8 | FS_TMPFS = -1, |
| 9 | FS_UNKNOWN = 0, |
| 10 | FS_FAT32 = 1, |
| 11 | FS_FAT16 = 2, |
| 12 | FS_FAT12 = 3, |
| 13 | FS_EXFAT = 4, |
| 14 | FS_EXT2 = 5, |
| 15 | FS_EXT3 = 6, |
| 16 | FS_EXT4 = 7, |
| 17 | FS_NTFS = 8, |
| 18 | FS_ISO9660 = 9 |
| 19 | }; |
| 20 | |
| 21 | const char *detect_fstr(enum fs_type type); |
| 22 | enum fs_type detect_fs(struct block_device *drive); |
| 23 | |
| 24 | LOG_SITE_EXTERN(fs_detect); |
| 25 | LOG_HANDLE_EXTERN(fs_detect); |
| 26 | |
| 27 | #define fs_detect_log(lvl, fmt, ...) \ |
| 28 | log(LOG_SITE(fs_detect), LOG_HANDLE(fs_detect), lvl, fmt, ##__VA_ARGS__) |
| 29 | |
| 30 | #define fs_detect_err(fmt, ...) fs_detect_log(LOG_ERROR, fmt, ##__VA_ARGS__) |
| 31 | #define fs_detect_warn(fmt, ...) fs_detect_log(LOG_WARN, fmt, ##__VA_ARGS__) |
| 32 | #define fs_detect_info(fmt, ...) fs_detect_log(LOG_INFO, fmt, ##__VA_ARGS__) |
| 33 | #define fs_detect_debug(fmt, ...) fs_detect_log(LOG_DEBUG, fmt, ##__VA_ARGS__) |
| 34 | #define fs_detect_trace(fmt, ...) fs_detect_log(LOG_TRACE, fmt, ##__VA_ARGS__) |
| 35 | |