29#include <mstdlib/base/m_defs.h>
30#include <mstdlib/base/m_types.h>
31#include <mstdlib/base/m_list_str.h>
32#include <mstdlib/base/m_time.h>
136struct M_fs_dir_entry;
141struct M_fs_dir_entries;
228#define M_FS_PATH_NORM_RESDIR M_FS_PATH_NORM_HOME|M_FS_PATH_NORM_FOLLOWSYMLINKS|M_FS_PATH_NORM_SYMLINKS_FAILDNE
229#define M_FS_PATH_NORM_RESALL M_FS_PATH_NORM_HOME|M_FS_PATH_NORM_FOLLOWSYMLINKS|M_FS_PATH_NORM_SYMLINKS_FAILDNE|M_FS_PATH_NORM_SYMLINKS_FAILDNELAST
334#define M_FS_DIR_WALK_FILTER_ALL M_FS_DIR_WALK_FILTER_FILE|M_FS_DIR_WALK_FILTER_DIR|M_FS_DIR_WALK_FILTER_SYMLINK|M_FS_DIR_WALK_FILTER_HIDDEN
387#define M_FS_BUF_SIZE 1024
M_bool(* M_fs_dir_walk_cb_t)(const char *path, M_fs_dir_entry_t *entry, M_fs_error_t res, void *thunk)
Definition: m_fs.h:404
M_fs_perms_who_t
Definition: m_fs.h:205
struct M_fs_info M_fs_info_t
Definition: m_fs.h:127
M_fs_file_read_write_t
Definition: m_fs.h:261
struct M_fs_perms M_fs_perms_t
Definition: m_fs.h:122
struct M_fs_progress M_fs_progress_t
Definition: m_fs.h:147
struct M_fs_dir_entry M_fs_dir_entry_t
Definition: m_fs.h:137
M_fs_info_flags_t
Definition: m_fs.h:233
M_fs_dir_walk_filter_t
Definition: m_fs.h:288
M_fs_file_seek_t
Definition: m_fs.h:271
M_bool(* M_fs_progress_cb_t)(const M_fs_progress_t *p)
Definition: m_fs.h:416
M_fs_dir_sort_t
Definition: m_fs.h:340
struct M_fs_file M_fs_file_t
Definition: m_fs.h:132
M_fs_file_mode_t
Definition: m_fs.h:245
M_fs_type_t
Definition: m_fs.h:375
M_fs_progress_flags_t
Definition: m_fs.h:357
M_fs_error_t
Definition: m_fs.h:154
struct M_fs_dir_entries M_fs_dir_entries_t
Definition: m_fs.h:142
M_fs_iostream_t
Definition: m_fs.h:180
M_fs_perms_type_t
Definition: m_fs.h:197
M_fs_path_norm_t
Definition: m_fs.h:213
M_fs_file_sync_t
Definition: m_fs.h:279
M_fs_system_t
Definition: m_fs.h:367
M_fs_perms_mode_t
Definition: m_fs.h:188
@ M_FS_PERMS_WHO_GROUP
Definition: m_fs.h:207
@ M_FS_PERMS_WHO_OTHER
Definition: m_fs.h:208
@ M_FS_PERMS_WHO_USER
Definition: m_fs.h:206
@ M_FS_FILE_RW_FULLBUF
Definition: m_fs.h:263
@ M_FS_FILE_RW_NORMAL
Definition: m_fs.h:262
@ M_FS_PATH_INFO_FLAGS_NONE
Definition: m_fs.h:234
@ M_FS_PATH_INFO_FLAGS_FOLLOW_SYMLINKS
Definition: m_fs.h:235
@ M_FS_PATH_INFO_FLAGS_BASIC
Definition: m_fs.h:237
@ M_FS_DIR_WALK_FILTER_HIDDEN
Definition: m_fs.h:297
@ M_FS_DIR_WALK_FILTER_AS_SET
Definition: m_fs.h:305
@ M_FS_DIR_WALK_FILTER_SYMLINK
Definition: m_fs.h:295
@ M_FS_DIR_WALK_FILTER_RECURSE
Definition: m_fs.h:299
@ M_FS_DIR_WALK_FILTER_JAIL_FAIL
Definition: m_fs.h:303
@ M_FS_DIR_WALK_FILTER_READ_INFO_FULL
Definition: m_fs.h:324
@ M_FS_DIR_WALK_FILTER_JAIL_SKIP
Definition: m_fs.h:304
@ M_FS_DIR_WALK_FILTER_READ_INFO_BASIC
Definition: m_fs.h:316
@ M_FS_DIR_WALK_FILTER_FOLLOWSYMLINK
Definition: m_fs.h:302
@ M_FS_DIR_WALK_FILTER_PIPE
Definition: m_fs.h:294
@ M_FS_DIR_WALK_FILTER_DIR
Definition: m_fs.h:293
@ M_FS_DIR_WALK_FILTER_CASECMP
Definition: m_fs.h:329
@ M_FS_DIR_WALK_FILTER_NONE
Definition: m_fs.h:289
@ M_FS_DIR_WALK_FILTER_FILE
Definition: m_fs.h:291
@ M_FS_FILE_SEEK_END
Definition: m_fs.h:273
@ M_FS_FILE_SEEK_BEGIN
Definition: m_fs.h:272
@ M_FS_FILE_SEEK_CUR
Definition: m_fs.h:274
@ M_FS_DIR_SORT_ISHIDDEN
Definition: m_fs.h:344
@ M_FS_DIR_SORT_MTIME
Definition: m_fs.h:350
@ M_FS_DIR_SORT_CTIME
Definition: m_fs.h:351
@ M_FS_DIR_SORT_ISDIR
Definition: m_fs.h:343
@ M_FS_DIR_SORT_NAME_CMP
Definition: m_fs.h:342
@ M_FS_DIR_SORT_ATIME
Definition: m_fs.h:349
@ M_FS_DIR_SORT_SIZE
Definition: m_fs.h:348
@ M_FS_DIR_SORT_NONE
Definition: m_fs.h:345
@ M_FS_DIR_SORT_NAME_CASECMP
Definition: m_fs.h:341
@ M_FS_FILE_MODE_READ
Definition: m_fs.h:247
@ M_FS_FILE_MODE_NOCLOSEEXEC
Definition: m_fs.h:256
@ M_FS_FILE_MODE_PRESERVE_PERMS
Definition: m_fs.h:252
@ M_FS_FILE_MODE_OVERWRITE
Definition: m_fs.h:251
@ M_FS_FILE_MODE_NONE
Definition: m_fs.h:246
@ M_FS_FILE_MODE_APPEND
Definition: m_fs.h:250
@ M_FS_FILE_MODE_NOCREATE
Definition: m_fs.h:249
@ M_FS_FILE_MODE_WRITE
Definition: m_fs.h:248
@ M_FS_TYPE_SYMLINK
Definition: m_fs.h:380
@ M_FS_TYPE_DIR
Definition: m_fs.h:378
@ M_FS_TYPE_UNKNOWN
Definition: m_fs.h:376
@ M_FS_TYPE_FILE
Definition: m_fs.h:377
@ M_FS_TYPE_PIPE
Definition: m_fs.h:379
@ M_FS_PROGRESS_NOEXTRA
Definition: m_fs.h:358
@ M_FS_PROGRESS_SIZE_CUR
Definition: m_fs.h:361
@ M_FS_PROGRESS_SIZE_TOTAL
Definition: m_fs.h:360
@ M_FS_PROGRESS_COUNT
Definition: m_fs.h:359
@ M_FS_ERROR_READONLY
Definition: m_fs.h:162
@ M_FS_ERROR_QUOTA
Definition: m_fs.h:163
@ M_FS_ERROR_CANCELED
Definition: m_fs.h:175
@ M_FS_ERROR_IO
Definition: m_fs.h:160
@ M_FS_ERROR_NAMETOOLONG
Definition: m_fs.h:165
@ M_FS_ERROR_ISDIR
Definition: m_fs.h:169
@ M_FS_ERROR_INVALID
Definition: m_fs.h:157
@ M_FS_ERROR_NOT_SUPPORTED
Definition: m_fs.h:159
@ M_FS_ERROR_SEEK
Definition: m_fs.h:161
@ M_FS_ERROR_GENERIC
Definition: m_fs.h:156
@ M_FS_ERROR_NOTDIR
Definition: m_fs.h:170
@ M_FS_ERROR_LINK_LOOP
Definition: m_fs.h:172
@ M_FS_ERROR_DIR_NOTEMPTY
Definition: m_fs.h:171
@ M_FS_ERROR_FILE_EXISTS
Definition: m_fs.h:166
@ M_FS_ERROR_FILE_2BIG
Definition: m_fs.h:167
@ M_FS_ERROR_FILE_2MANY
Definition: m_fs.h:168
@ M_FS_ERROR_DNE
Definition: m_fs.h:164
@ M_FS_ERROR_PERMISSION
Definition: m_fs.h:158
@ M_FS_ERROR_NOT_SAMEDEV
Definition: m_fs.h:174
@ M_FS_ERROR_LINK_2MANY
Definition: m_fs.h:173
@ M_FS_ERROR_SUCCESS
Definition: m_fs.h:155
@ M_FS_IOSTREAM_OUT
Definition: m_fs.h:182
@ M_FS_IOSTREAM_IN
Definition: m_fs.h:181
@ M_FS_IOSTREAM_ERR
Definition: m_fs.h:183
@ M_FS_PERMS_TYPE_EXACT
Definition: m_fs.h:198
@ M_FS_PERMS_TYPE_REMOVE
Definition: m_fs.h:200
@ M_FS_PERMS_TYPE_ADD
Definition: m_fs.h:199
@ M_FS_PATH_NORM_ABSOLUTE
Definition: m_fs.h:215
@ M_FS_PATH_NORM_SYMLINKS_FAILDNE
Definition: m_fs.h:219
@ M_FS_PATH_NORM_FOLLOWSYMLINKS
Definition: m_fs.h:217
@ M_FS_PATH_NORM_NONE
Definition: m_fs.h:214
@ M_FS_PATH_NORM_NOPARENT
Definition: m_fs.h:224
@ M_FS_PATH_NORM_SYMLINKS_FAILDNELAST
Definition: m_fs.h:221
@ M_FS_PATH_NORM_HOME
Definition: m_fs.h:223
@ M_FS_FILE_SYNC_NONE
Definition: m_fs.h:280
@ M_FS_FILE_SYNC_BUFFER
Definition: m_fs.h:281
@ M_FS_FILE_SYNC_OS
Definition: m_fs.h:282
@ M_FS_SYSTEM_AUTO
Definition: m_fs.h:368
@ M_FS_SYSTEM_WINDOWS
Definition: m_fs.h:369
@ M_FS_SYSTEM_UNIX
Definition: m_fs.h:370
@ M_FS_PERMS_MODE_READ
Definition: m_fs.h:190
@ M_FS_PERMS_MODE_WRITE
Definition: m_fs.h:191
@ M_FS_PERMS_MODE_EXEC
Definition: m_fs.h:192
@ M_FS_PERMS_MODE_NONE
Definition: m_fs.h:189
M_fs_error_t M_fs_dir_mkdir(const char *path, M_bool create_parents, M_fs_perms_t *perms)
void M_fs_dir_entries_merge(M_fs_dir_entries_t **dest, M_fs_dir_entries_t *src) M_FREE(2)
size_t M_fs_dir_entries_len(const M_fs_dir_entries_t *d)
M_bool M_fs_dir_entries_remove_at(M_fs_dir_entries_t *d, size_t idx)
void M_fs_dir_entries_sort(M_fs_dir_entries_t *d, M_fs_dir_sort_t primary_sort, M_bool primary_asc, M_fs_dir_sort_t secondary_sort, M_bool secondary_asc)
M_bool M_fs_dir_entry_get_ishidden(const M_fs_dir_entry_t *entry)
M_list_str_t * M_fs_dir_walk_strs(const char *path, const char *pat, M_uint32 filter)
const M_fs_info_t * M_fs_dir_entry_get_info(const M_fs_dir_entry_t *entry)
const char * M_fs_dir_entry_get_resolved_name(const M_fs_dir_entry_t *entry)
void M_fs_dir_entry_destroy(M_fs_dir_entry_t *entry) M_FREE(1)
M_fs_type_t M_fs_dir_entry_get_type(const M_fs_dir_entry_t *entry)
void M_fs_dir_entries_destroy(M_fs_dir_entries_t *d) M_FREE(1)
const M_fs_dir_entry_t * M_fs_dir_entries_at(const M_fs_dir_entries_t *d, size_t idx)
M_fs_dir_entries_t * M_fs_dir_walk_entries(const char *path, const char *pat, M_uint32 filter)
void M_fs_dir_walk(const char *path, const char *pat, M_uint32 filter, M_fs_dir_walk_cb_t cb, void *thunk)
M_bool M_fs_dir_entries_remove_range(M_fs_dir_entries_t *d, size_t start, size_t end)
const char * M_fs_dir_entry_get_name(const M_fs_dir_entry_t *entry)
M_fs_dir_entry_t * M_fs_dir_entries_take_at(M_fs_dir_entries_t *d, size_t idx)
void M_fs_file_close(M_fs_file_t *fd)
M_fs_error_t M_fs_file_seek(M_fs_file_t *fd, M_int64 offset, M_fs_file_seek_t from)
M_fs_error_t M_fs_file_read(M_fs_file_t *fd, unsigned char *buf, size_t buf_len, size_t *read_len, M_uint32 flags)
M_fs_error_t M_fs_file_read_bytes(const char *path, size_t max_read, unsigned char **buf, size_t *bytes_read)
M_fs_error_t M_fs_file_open_iostream(M_fs_file_t **fd, M_fs_iostream_t stream)
M_fs_error_t M_fs_file_open(M_fs_file_t **fd, const char *path, size_t buf_size, M_uint32 mode, const M_fs_perms_t *perms)
M_fs_error_t M_fs_file_sync(M_fs_file_t *fd, M_uint32 type)
M_fs_error_t M_fs_file_write_bytes(const char *path, const unsigned char *buf, size_t write_len, M_uint32 mode, size_t *bytes_written)
M_fs_error_t M_fs_file_write(M_fs_file_t *fd, const unsigned char *buf, size_t count, size_t *wrote_len, M_uint32 flags)
void M_fs_info_destroy(M_fs_info_t *info) M_FREE(1)
M_time_t M_fs_info_get_mtime(const M_fs_info_t *info)
M_time_t M_fs_info_get_btime(const M_fs_info_t *info)
const char * M_fs_info_get_group(const M_fs_info_t *info)
M_uint64 M_fs_info_get_size(const M_fs_info_t *info)
M_fs_error_t M_fs_info_file(M_fs_info_t **info, M_fs_file_t *fd, M_uint32 flags)
M_time_t M_fs_info_get_atime(const M_fs_info_t *info)
M_fs_type_t M_fs_info_get_type(const M_fs_info_t *info)
M_bool M_fs_info_get_ishidden(const M_fs_info_t *info)
M_time_t M_fs_info_get_ctime(const M_fs_info_t *info)
M_fs_error_t M_fs_info(M_fs_info_t **info, const char *path, M_uint32 flags)
const char * M_fs_info_get_user(const M_fs_info_t *info)
const M_fs_perms_t * M_fs_info_get_perms(const M_fs_info_t *info)
M_fs_error_t M_fs_move(const char *path_old, const char *path_new, M_uint32 mode, M_fs_progress_cb_t cb, M_uint32 progress_flags)
M_fs_error_t M_fs_copy(const char *path_old, const char *path_new, M_uint32 mode, M_fs_progress_cb_t cb, M_uint32 progress_flags)
M_fs_error_t M_fs_symlink(const char *target, const char *link_name)
M_fs_error_t M_fs_delete(const char *path, M_bool remove_children, M_fs_progress_cb_t cb, M_uint32 progress_flags)
char * M_fs_path_user_confdir(M_fs_system_t sys_type)
M_fs_error_t M_fs_path_get_cwd(char **cwd)
M_fs_error_t M_fs_path_set_cwd(const char *path)
size_t M_fs_path_get_path_max(M_fs_system_t sys_type)
M_fs_error_t M_fs_path_readlink(char **out, const char *path)
char * M_fs_path_basename(const char *path, M_fs_system_t sys_type)
M_bool M_fs_path_ishidden(const char *path, const M_fs_info_t *info)
char * M_fs_path_tmpdir(M_fs_system_t sys_type)
M_bool M_fs_path_isunc(const char *p)
M_bool M_fs_path_isabs(const char *p, M_fs_system_t sys_type)
char * M_fs_path_join_parts(const M_list_str_t *path, M_fs_system_t sys_type)
char * M_fs_path_join_vparts(M_fs_system_t sys_type, size_t num,...)
char * M_fs_path_join_resolved(const char *path, const char *part, const char *resolved_name, M_fs_system_t sys_type)
M_list_str_t * M_fs_path_componentize_path(const char *path, M_fs_system_t sys_type)
char * M_fs_path_join(const char *p1, const char *p2, M_fs_system_t sys_type)
M_fs_error_t M_fs_path_norm(char **out, const char *path, M_uint32 flags, M_fs_system_t sys_type)
char * M_fs_path_dirname(const char *path, M_fs_system_t sys_type)
const char * M_fs_perms_get_group(const M_fs_perms_t *perms)
M_bool M_fs_perms_get_isset(const M_fs_perms_t *perms, M_fs_perms_who_t who)
const char * M_fs_perms_get_user(const M_fs_perms_t *perms)
M_bool M_fs_perms_get_dir_isset(const M_fs_perms_t *perms, M_fs_perms_who_t who)
M_fs_error_t M_fs_perms_set_group(M_fs_perms_t *perms, const char *group)
void M_fs_perms_destroy(M_fs_perms_t *perms) M_FREE(1)
M_fs_error_t M_fs_perms_set_perms(const M_fs_perms_t *perms, const char *path)
M_fs_perms_t * M_fs_perms_create(void) M_MALLOC
M_fs_error_t M_fs_perms_can_access(const char *path, M_uint32 mode)
void M_fs_perms_unset_dir_mode(M_fs_perms_t *perms, M_fs_perms_who_t who)
void M_fs_perms_set_dir_mode(M_fs_perms_t *perms, M_uint32 mode, M_fs_perms_who_t who, M_fs_perms_type_t type)
void M_fs_perms_merge(M_fs_perms_t **dest, M_fs_perms_t *src) M_FREE(2)
M_fs_perms_type_t M_fs_perms_get_dir_type(const M_fs_perms_t *perms, M_fs_perms_who_t who)
M_fs_error_t M_fs_perms_set_user(M_fs_perms_t *perms, const char *user)
void M_fs_perms_unset_mode(M_fs_perms_t *perms, M_fs_perms_who_t who)
M_fs_perms_type_t M_fs_perms_get_type(const M_fs_perms_t *perms, M_fs_perms_who_t who)
M_uint32 M_fs_perms_get_dir_mode(const M_fs_perms_t *perms, M_fs_perms_who_t who)
M_uint32 M_fs_perms_get_mode(const M_fs_perms_t *perms, M_fs_perms_who_t who)
void M_fs_perms_set_mode(M_fs_perms_t *perms, M_uint32 mode, M_fs_perms_who_t who, M_fs_perms_type_t type)
M_fs_error_t M_fs_perms_set_perms_file(const M_fs_perms_t *perms, M_fs_file_t *fd)
M_fs_perms_t * M_fs_perms_dup(const M_fs_perms_t *perms) M_MALLOC
M_uint64 M_fs_progress_get_size_total(const M_fs_progress_t *p)
const char * M_fs_progress_get_path(const M_fs_progress_t *p)
M_fs_type_t M_fs_progress_get_type(const M_fs_progress_t *p)
M_uint64 M_fs_progress_get_size_current_progress(const M_fs_progress_t *p)
M_uint64 M_fs_progress_get_size_current(const M_fs_progress_t *p)
M_uint64 M_fs_progress_get_size_total_progess(const M_fs_progress_t *p)
M_uint64 M_fs_progress_get_count_total(const M_fs_progress_t *p)
M_fs_error_t M_fs_progress_get_result(const M_fs_progress_t *p)
M_uint64 M_fs_progress_get_count(const M_fs_progress_t *p)
struct M_list_str M_list_str_t
Definition: m_list_str.h:80
M_int64 M_time_t
Definition: m_time.h:161