From 929c016d20b0f92ea8a38dfb815a47751196fe5a Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 11 May 2020 22:15:02 -0500 Subject: [PATCH] Update: add directory functions, file functions, and status codes --- level_0/f_directory/c/directory.c | 182 ++++++++++++++++++++++++++++++++++++ level_0/f_directory/c/directory.h | 122 +++++++++++++++++++++++- level_0/f_file/c/file.c | 80 +++++++++++++++- level_0/f_file/c/file.h | 96 +++++++++++++++++-- level_0/f_status/c/status.h | 7 ++ level_1/fl_status/c/status.c | 15 +++ level_1/fl_status/c/status.h | 14 +++ level_2/fll_directory/c/directory.c | 2 +- level_2/fll_status/c/status.c | 22 +++++ 9 files changed, 526 insertions(+), 14 deletions(-) diff --git a/level_0/f_directory/c/directory.c b/level_0/f_directory/c/directory.c index 6c245ba..b8bc179 100644 --- a/level_0/f_directory/c/directory.c +++ b/level_0/f_directory/c/directory.c @@ -5,6 +5,188 @@ extern "C" { #endif +#ifndef _di_f_directory_create_ + f_return_status f_directory_create(const f_string path, const mode_t modes) { + if (mkdir(path, modes) < 0) { + if (errno == EACCES) { + return f_status_set_error(f_access_denied); + } + else if (errno == EDQUOT) { + return f_status_set_error(f_filesystem_quota_blocks); + } + else if (errno == EEXIST) { + return f_status_set_error(f_file_found); + } + else if (errno == ENAMETOOLONG || errno == EFAULT) { + return f_status_set_error(f_invalid_name); + } + else if (errno == EINVAL) { + return f_status_set_error(f_invalid_parameter); + } + else if (errno == ELOOP) { + return f_status_set_error(f_loop); + } + else if (errno == EMLINK) { + return f_status_set_error(f_directory_error_link_max); + } + else if (errno == ENOENT) { + return f_status_set_error(f_file_not_found); + } + else if (errno == ENOMEM) { + return f_status_set_error(f_out_of_memory); + } + else if (errno == ENOSPC) { + return f_status_set_error(f_filesystem_quota_reached); + } + else if (errno == ENOTDIR) { + return f_status_set_error(f_invalid_directory); + } + else if (errno == EPERM) { + return f_status_set_error(f_prohibited); + } + else if (errno == EROFS) { + return f_status_set_error(f_read_only); + } + + return f_status_set_error(f_failure); + } + + return f_none; + } +#endif // _di_f_directory_create_ + +/* @todo +#ifndef _di_f_directory_create_at_ + f_return_status f_directory_create_at(const int at_id, const f_string path, const mode_t modes) { + #ifndef _di_level_0_parameter_checking_ + if (at_id <= 0) return f_status_set_error(f_invalid_parameter); + #endif // _di_level_0_parameter_checking_ + + if (mkdirat(path, modes) < 0) { + if (errno == EACCES) { + return f_status_set_error(f_access_denied); + } + else if (errno == EDQUOT) { + return f_status_set_error(f_filesystem_quota_blocks); + } + else if (errno == EEXIST) { + return f_status_set_error(f_file_found); + } + else if (errno == ENAMETOOLONG || errno == EFAULT) { + return f_status_set_error(f_invalid_name); + } + else if (errno == EINVAL || errno == EBADF) { + return f_status_set_error(f_invalid_parameter); + } + else if (errno == ELOOP) { + return f_status_set_error(f_loop); + } + else if (errno == EMLINK) { + return f_status_set_error(f_directory_error_link_max); + } + else if (errno == ENOENT) { + return f_status_set_error(f_file_not_found); + } + else if (errno == ENOMEM) { + return f_status_set_error(f_out_of_memory); + } + else if (errno == ENOSPC) { + return f_status_set_error(f_filesystem_quota_reached); + } + else if (errno == ENOTDIR) { + return f_status_set_error(f_invalid_directory); + } + else if (errno == EPERM) { + return f_status_set_error(f_prohibited); + } + else if (errno == EROFS) { + return f_status_set_error(f_read_only); + } + + return f_status_set_error(f_failure); + } + + return f_none; + } +#endif // _di_f_directory_create_at_ +*/ + +#ifndef _di_f_directory_is_ + f_return_status f_directory_is(const f_string path) { + struct stat file_stat; + + memset(&file_stat, 0, sizeof(file_stat)); + + if (stat(path, &file_stat) < 0) { + if (errno == ENAMETOOLONG || errno == EFAULT) { + return f_status_set_error(f_invalid_name); + } + else if (errno == ENOMEM) { + return f_status_set_error(f_out_of_memory); + } + else if (errno == EOVERFLOW) { + return f_status_set_error(f_number_overflow); + } + else if (errno == ENOTDIR) { + return f_false; + } + else if (errno == ENOENT) { + return f_file_not_found; + } + else if (errno == EACCES) { + return f_status_set_error(f_access_denied); + } + else if (errno == ELOOP) { + return f_status_set_error(f_loop); + } + + return f_status_set_error(f_file_error_stat); + } + + if ((file_stat.st_mode & S_IFMT) == S_IFDIR) return f_true; + + return f_false; + } +#endif // _di_f_directory_is_ + +#ifndef _di_f_directory_is_at_ + f_return_status f_directory_is_at(const int file_id, const f_string path, const bool follow) { + struct stat file_stat; + + memset(&file_stat, 0, sizeof(file_stat)); + + if (fstatat(file_id, path, &file_stat, follow ? 0 : AT_SYMLINK_NOFOLLOW) < 0) { + if (errno == ENAMETOOLONG || errno == EFAULT) { + return f_status_set_error(f_invalid_name); + } + else if (errno == ENOMEM) { + return f_status_set_error(f_out_of_memory); + } + else if (errno == EOVERFLOW) { + return f_status_set_error(f_number_overflow); + } + else if (errno == ENOTDIR) { + return f_false; + } + else if (errno == ENOENT) { + return f_file_not_found; + } + else if (errno == EACCES) { + return f_status_set_error(f_access_denied); + } + else if (errno == ELOOP) { + return f_status_set_error(f_loop); + } + + return f_status_set_error(f_file_error_stat); + } + + if ((file_stat.st_mode & S_IFMT) == S_IFDIR) return f_true; + + return f_false; + } +#endif // _di_f_directory_is_at_ + #ifndef _di_f_directory_list_ f_return_status f_directory_list(const f_string path, int (*filter)(const struct dirent *), int (*sort)(const struct dirent **, const struct dirent **), f_string_dynamics *names) { #ifndef _di_level_0_parameter_checking_ diff --git a/level_0/f_directory/c/directory.h b/level_0/f_directory/c/directory.h index 8f55a9a..c467704 100644 --- a/level_0/f_directory/c/directory.h +++ b/level_0/f_directory/c/directory.h @@ -13,9 +13,11 @@ // libc includes #include #include +#include #include #include #include +#include #include // work-around for out-dated systems. @@ -42,11 +44,14 @@ extern "C" { * * The name max 255 because the directory name size is 256. * The last 1 is for the NULL character. + * + * The directory max recursion is more of a default than a rule. */ #ifndef _di_f_directory_limitations_ #define f_directory_default_allocation_step f_memory_default_allocation_step - #define f_directory_name_max 255 + #define f_directory_name_max 255 + #define f_directory_max_recursion 2048 #endif // _di_f_directory_limitations_ /** @@ -136,6 +141,121 @@ extern "C" { #endif // _di_f_directory_ /** + * Create a directory at the given path. + * + * @param path + * The path file name. + * @param modes + * The directory modes to use when creating. + * + * @return + * f_none on success. + * f_invalid_parameter (with error bit) if a parameter is invalid. + * f_access_denied (with error bit) on access denied. + * f_loop (with error bit) on loop error. + * f_file_not_found (with error bit) if a file within the path is not found (such as a broken symbolic link). + * f_out_of_memory (with error bit) if out of memory. + * f_prohibited (with error bit) if filesystem does not allow for removing. + * f_read_only (with error bit) if file is read-only. + * f_failure (with error bit) for any other (mkdir()) error. + * f_filesystem_quota_blocks (with error bit) if filesystem's disk blocks or inodes are exhausted. + * f_filesystem_quota_reached (with error bit) quota reached of filesystem is out of space. + * f_file_found (with error bit) of a directory aleady exists at the path. + * f_invalid_name (with error bit) on path name error. + * f_directory_error_link_max (with error bit) max links limit reached or exceeded. + * f_invalid_directory (with error bit) if a supposed directory in path is not actually a directory. + * + * @see mkdir() + */ +#ifndef _di_f_directory_create_ + extern f_return_status f_directory_create(const f_string path, const mode_t modes); +#endif // _di_f_directory_create_ + +/** + * Create a directory at the given path within the directories specified by the file descriptor. + * + * @param at_id + * The file descriptor in which the directory will be created within. + * @param path + * The path file name. + * @param modes + * The directory modes to use when creating. + * + * @return + * f_none on success. + * f_invalid_parameter (with error bit) if a parameter is invalid. + * f_access_denied (with error bit) on access denied. + * f_loop (with error bit) on loop error. + * f_file_not_found (with error bit) if a file within the path is not found (such as a broken symbolic link). + * f_out_of_memory (with error bit) if out of memory. + * f_prohibited (with error bit) if filesystem does not allow for removing. + * f_read_only (with error bit) if file is read-only. + * f_failure (with error bit) for any other (mkdir()) error. + * f_filesystem_quota_blocks (with error bit) if filesystem's disk blocks or inodes are exhausted. + * f_filesystem_quota_reached (with error bit) quota reached of filesystem is out of space. + * f_file_found (with error bit) of a directory aleady exists at the path. + * f_invalid_name (with error bit) on path name error. + * f_directory_error_link_max (with error bit) max links limit reached or exceeded. + * f_invalid_directory (with error bit) if a supposed directory in path is not actually a directory. + * + * @see mkdir() + * +#ifndef _di_f_directory_create_at_ + extern f_return_status f_directory_create_at(const int at_id, const f_string path, const mode_t modes); +#endif // _di_f_directory_create_at_ + +/** + * Identify whether or not a file exists at the given path and if that file is a directory. + * + * @param path + * The path file name. + * + * @return + * t_true if path was found and path is a directory. + * f_false if path was found and path is not a directory. + * f_file_not_found if the path was not found. + * f_invalid_name (with error bit) if the name is somehow invalid. + * f_out_of_memory (with error bit) if out of memory. + * f_number_overflow (with error bit) on overflow error. + * f_access_denied (with error bit) if access to the file was denied. + * f_loop (with error bit) if a loop occurred. + * f_invalid_parameter (with error bit) if a parameter is invalid. + * + * @see fstat() + */ +#ifndef _di_f_directory_is_ + extern f_return_status f_directory_is(const f_string path); +#endif // _di_f_directory_is_ + +/** + * Identify whether or not a file exists at the given path within the parent directory and if that file is a directory. + * + * @param file_id + * The file descriptor representing the parent directory to search within. + * @param path + * The path file name. + * @param follow + * Set to TRUE to follow symbolic links when determining if path is a file. + * Set to FALSE to not follow. + * + * @return + * t_true if path was found and path is a directory. + * f_false if path was found and path is not a directory. + * f_file_not_found if the path was not found. + * f_invalid_name (with error bit) if the name is somehow invalid. + * f_out_of_memory (with error bit) if out of memory. + * f_number_overflow (with error bit) on overflow error. + * f_access_denied (with error bit) if access to the file was denied. + * f_loop (with error bit) if a loop occurred. + * f_invalid_parameter (with error bit) if a parameter is invalid. + * + * @see fstatat() + */ +#ifndef _di_f_directory_is_at_ + extern f_return_status f_directory_is_at(const int file_id, const f_string path, const bool follow); +#endif // _di_f_directory_is_at_ + +/** * For some given path, print the names of each file and/or directory inside the directory. * * Allows specifying a custom filter and custom sort. diff --git a/level_0/f_file/c/file.c b/level_0/f_file/c/file.c index 4edca30..29cab72 100644 --- a/level_0/f_file/c/file.c +++ b/level_0/f_file/c/file.c @@ -154,6 +154,82 @@ extern "C" { } #endif // _di_f_file_flush_ +#ifndef _di_f_file_is_ + f_return_status f_file_is(const f_string path, const int type) { + struct stat file_stat; + + memset(&file_stat, 0, sizeof(file_stat)); + + if (stat(path, &file_stat) < 0) { + if (errno == ENAMETOOLONG || errno == EFAULT) { + return f_status_set_error(f_invalid_name); + } + else if (errno == ENOMEM) { + return f_status_set_error(f_out_of_memory); + } + else if (errno == EOVERFLOW) { + return f_status_set_error(f_number_overflow); + } + else if (errno == ENOTDIR) { + return f_status_set_error(f_invalid_directory); + } + else if (errno == ENOENT) { + return f_file_not_found; + } + else if (errno == EACCES) { + return f_status_set_error(f_access_denied); + } + else if (errno == ELOOP) { + return f_status_set_error(f_loop); + } + + return f_status_set_error(f_file_error_stat); + } + + if (f_macro_file_type_get(file_stat.st_mode) == type) return f_true; + + return f_false; + } +#endif // _di_f_file_is_ + +#ifndef _di_f_file_is_at_ + f_return_status f_file_is_at(const int file_id, const f_string path, const int type, const bool follow) { + struct stat file_stat; + + memset(&file_stat, 0, sizeof(file_stat)); + + if (fstatat(file_id, path, &file_stat, follow ? 0 : AT_SYMLINK_NOFOLLOW) < 0) { + if (errno == ENAMETOOLONG || errno == EFAULT) { + return f_status_set_error(f_invalid_name); + } + else if (errno == ENOMEM) { + return f_status_set_error(f_out_of_memory); + } + else if (errno == EOVERFLOW) { + return f_status_set_error(f_number_overflow); + } + else if (errno == ENOTDIR) { + return f_status_set_error(f_invalid_directory); + } + else if (errno == ENOENT) { + return f_file_not_found; + } + else if (errno == EACCES) { + return f_status_set_error(f_access_denied); + } + else if (errno == ELOOP) { + return f_status_set_error(f_loop); + } + + return f_status_set_error(f_file_error_stat); + } + + if (file_stat.st_mode == (S_IFMT & S_IFDIR)) return f_true; + + return f_false; + } +#endif // _di_f_file_is_at_ + #ifndef _di_f_file_read_ f_return_status f_file_read(f_file *file, f_string_dynamic *buffer) { #ifndef _di_level_0_parameter_checking_ @@ -370,9 +446,7 @@ extern "C" { if (file_id <= 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_0_parameter_checking_ - int result = fstatat(file_id, path, file_stat, flags); - - if (result < 0) { + if (fstatat(file_id, path, file_stat, flags) < 0) { if (errno == ENAMETOOLONG || errno == EFAULT) { return f_status_set_error(f_invalid_name); } diff --git a/level_0/f_file/c/file.h b/level_0/f_file/c/file.h index 1d42b58..4652838 100644 --- a/level_0/f_file/c/file.h +++ b/level_0/f_file/c/file.h @@ -88,15 +88,15 @@ extern "C" { #define f_file_type_link S_IFLNK #define f_file_type_socket S_IFSOCK - #define f_macro_file_type_is(mode) f_file_type_mask & S_IFIFO - - #define f_macro_file_type_is_pipe(mode) f_macro_file_type_is(mode) == f_file_type_pipe - #define f_macro_file_type_is_character(mode) f_macro_file_type_is(mode) == f_file_type_character - #define f_macro_file_type_is_directory(mode) f_macro_file_type_is(mode) == f_file_type_directory - #define f_macro_file_type_is_block(mode) f_macro_file_type_is(mode) == f_file_type_block - #define f_macro_file_type_is_file(mode) f_macro_file_type_is(mode) == f_file_type_file - #define f_macro_file_type_is_link(mode) f_macro_file_type_is(mode) == f_file_type_link - #define f_macro_file_type_is_socket(mode) f_macro_file_type_is(mode) == f_file_type_socket + #define f_macro_file_type_get(mode) (f_file_type_mask & mode) + + #define f_macro_file_type_is_pipe(mode) f_macro_file_type_get(mode) == f_file_type_pipe + #define f_macro_file_type_is_character(mode) f_macro_file_type_get(mode) == f_file_type_character + #define f_macro_file_type_is_directory(mode) f_macro_file_type_get(mode) == f_file_type_directory + #define f_macro_file_type_is_block(mode) f_macro_file_type_get(mode) == f_file_type_block + #define f_macro_file_type_is_file(mode) f_macro_file_type_get(mode) == f_file_type_file + #define f_macro_file_type_is_link(mode) f_macro_file_type_get(mode) == f_file_type_link + #define f_macro_file_type_is_socket(mode) f_macro_file_type_get(mode) == f_file_type_socket #endif // _di_f_file_type_ /** @@ -249,6 +249,27 @@ extern "C" { #define f_file_mode_world_rw (S_IROTH | S_IWOTH) #define f_file_mode_world_rx (S_IROTH | S_IXOTH) #define f_file_mode_world_wx (S_IWOTH | S_IXOTH) + + #define f_file_mode_all_rwx (f_file_mode_owner_rwx | f_file_mode_group_rwx | f_file_mode_world_rwx) + #define f_file_mode_all_rw (f_file_mode_owner_rw | f_file_mode_group_rw | f_file_mode_world_rw) + #define f_file_mode_all_wx (f_file_mode_owner_wx | f_file_mode_group_wx | f_file_mode_world_wx) + #define f_file_mode_all_rx (f_file_mode_owner_rx | f_file_mode_group_rx | f_file_mode_world_rx) + #define f_file_mode_all_r (f_file_mode_owner_r | f_file_mode_group_r | f_file_mode_world_r) + #define f_file_mode_all_w (f_file_mode_owner_w | f_file_mode_group_w | f_file_mode_world_w) + #define f_file_mode_all_x (f_file_mode_owner_x | f_file_mode_group_x | f_file_mode_world_x) + + // file mode sticky-bits and all bits. + #define f_file_mode_special_user S_ISUID + #define f_file_mode_special_group S_ISGID + #define f_file_mode_special_world S_ISVTX + #define f_file_mode_special_all (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO) + + // special file mode combinations. + #define f_file_mode_user_access (f_file_mode_owner_rwx | f_file_mode_group_rwx | f_file_mode_world_x) + #define f_file_mode_user_directory (f_file_mode_owner_rwx | f_file_mode_group_rwx) + #define f_file_mode_user_file (f_file_mode_owner_rw | f_file_mode_group_rw) + #define f_file_mode_user_program (f_file_mode_owner_rx | f_file_mode_group_rx) + #define f_file_mode_user_protected (f_file_mode_owner_r | f_file_mode_group_r) #endif // _di_f_file_modes_ /** @@ -378,6 +399,63 @@ extern "C" { #endif // _di_f_file_flush_ /** + * Identify whether or not a file exists at the given path and if that file is a specific type. + * + * @param path + * The path file name. + * @param type + * The type of the file + * + * @return + * t_true if path was found and path is type. + * f_false if path was found and path is not type. + * f_file_not_found if the path was not found. + * f_invalid_name (with error bit) if the name is somehow invalid. + * f_out_of_memory (with error bit) if out of memory. + * f_number_overflow (with error bit) on overflow error. + * f_invalid_directory (with error bit) on invalid directory. + * f_access_denied (with error bit) if access to the file was denied. + * f_loop (with error bit) if a loop occurred. + * f_invalid_parameter (with error bit) if a parameter is invalid. + * + * @see fstat() + */ +#ifndef _di_f_file_is_ + extern f_return_status f_file_is(const f_string path, const int type); +#endif // _di_f_file_is_ + +/** + * Identify whether or not a file exists at the given path within the parent directory and if that file is a specific type. + * + * @param file_id + * The file descriptor representing the parent directory to search within. + * @param path + * The path file name. + * @param type + * The type of the file + * @param follow + * Set to TRUE to follow symbolic links when determining if path is a file. + * Set to FALSE to not follow. + * + * @return + * t_true if path was found and path is type. + * f_false if path was found and path is not type. + * f_file_not_found if the path was not found. + * f_invalid_name (with error bit) if the name is somehow invalid. + * f_out_of_memory (with error bit) if out of memory. + * f_number_overflow (with error bit) on overflow error. + * f_invalid_directory (with error bit) on invalid directory. + * f_access_denied (with error bit) if access to the file was denied. + * f_loop (with error bit) if a loop occurred. + * f_invalid_parameter (with error bit) if a parameter is invalid. + * + * @see fstatat() + */ +#ifndef _di_f_file_is_at_ + extern f_return_status f_file_is_at(const int file_id, const f_string path, const int type, const bool follow); +#endif // _di_f_file_is_at_ + +/** * Read until a single block is filled or EOF is reached. * * This does not allocate space to the buffer, so be sure enough space exists (file->size_chunk * file->size_block). diff --git a/level_0/f_status/c/status.h b/level_0/f_status/c/status.h index e0d03bf..5376b61 100644 --- a/level_0/f_status/c/status.h +++ b/level_0/f_status/c/status.h @@ -305,6 +305,12 @@ extern "C" { f_file_max_open, #endif // _di_f_status_file_ + #ifndef _di_f_status_filesystem_ + f_filesystem_error, + f_filesystem_quota_blocks, + f_filesystem_quota_reached, + #endif // _di_f_status_filesystem_ + // Most of these are a guess until I get around to researching & implementing linux directory I/O. #ifndef _di_f_status_directory_ f_directory_error, @@ -312,6 +318,7 @@ extern "C" { f_directory_error_close, f_directory_error_descriptor, f_directory_error_flush, + f_directory_error_link_max, f_directory_error_open, f_directory_error_purge, f_directory_error_read, diff --git a/level_1/fl_status/c/status.c b/level_1/fl_status/c/status.c index 529628d..bdbb5fb 100644 --- a/level_1/fl_status/c/status.c +++ b/level_1/fl_status/c/status.c @@ -680,6 +680,18 @@ extern "C" { break; #endif // _di_fl_status_file_ + #ifndef _di_f_status_filesystem_ + case f_filesystem_error: + *string = fl_status_string_filesystem_error; + break; + case f_filesystem_quota_blocks: + *string = fl_status_string_filesystem_quota_blocks; + break; + case f_filesystem_quota_reached: + *string = fl_status_string_filesystem_quota_reached; + break; + #endif // _di_f_status_filesystem_ + #ifndef _di_fl_status_directory_ case f_directory_error_read: *string = fl_status_string_directory_read_error; @@ -690,6 +702,9 @@ extern "C" { case f_directory_error_flush: *string = fl_status_string_directory_flush_error; break; + case f_directory_error_link_max: + *string = fl_status_string_directory_error_link_max; + break; case f_directory_error_purge: *string = fl_status_string_directory_purge_error; break; diff --git a/level_1/fl_status/c/status.h b/level_1/fl_status/c/status.h index f642b84..9de5fc4 100644 --- a/level_1/fl_status/c/status.h +++ b/level_1/fl_status/c/status.h @@ -682,6 +682,17 @@ extern "C" { #define fl_status_string_file_max_open_length 15 #endif // _di_fl_status_file_ + #ifndef _di_f_status_filesystem_ + #define fl_status_string_filesystem_error "f_filesystem_error" + #define fl_status_string_filesystem_error_length 18 + + #define fl_status_string_filesystem_quota_blocks "f_filesystem_quota_blocks" + #define fl_status_string_filesystem_quota_blocks_length 25 + + #define fl_status_string_filesystem_quota_reached "f_filesystem_quota_reached" + #define fl_status_string_filesystem_quota_reached_length 26 + #endif // _di_f_status_filesystem_ + #ifndef _di_fl_status_directory_ #define fl_status_string_directory_read_error "f_directory_error_read" #define fl_status_string_directory_read_error_length 22 @@ -692,6 +703,9 @@ extern "C" { #define fl_status_string_directory_flush_error "f_directory_error_flush" #define fl_status_string_directory_flush_error_length 23 + #define fl_status_string_directory_error_link_max "f_directory_error_link_max" + #define fl_status_string_directory_error_link_max_length 26 + #define fl_status_string_directory_purge_error "f_directory_error_purge" #define fl_status_string_directory_purge_error_length 23 diff --git a/level_2/fll_directory/c/directory.c b/level_2/fll_directory/c/directory.c index a0ebf9f..6cf90b3 100644 --- a/level_2/fll_directory/c/directory.c +++ b/level_2/fll_directory/c/directory.c @@ -86,7 +86,7 @@ extern "C" { status = f_file_stat_at(parent_fd, entity[i]->d_name, &file_stat, 0); if (f_status_is_error(status)) break; - mode = f_macro_file_type_is(file_stat.d_type); + mode = f_macro_file_type_get(file_stat.st_mode); if (mode == f_file_type_block) { names = &listing->block; diff --git a/level_2/fll_status/c/status.c b/level_2/fll_status/c/status.c index e741f48..be2b8f3 100644 --- a/level_2/fll_status/c/status.c +++ b/level_2/fll_status/c/status.c @@ -1108,6 +1108,23 @@ extern "C" { } #endif // _di_fll_status_file_ + #ifndef _di_f_status_filesystem_ + if (fl_string_compare(string, fl_status_string_filesystem_error, length, fl_status_string_filesystem_error_length) == f_equal_to) { + *code = f_filesystem_error; + return f_none; + } + + if (fl_string_compare(string, fl_status_string_filesystem_quota_blocks, length, fl_status_string_filesystem_quota_blocks_length) == f_equal_to) { + *code = f_filesystem_quota_blocks; + return f_none; + } + + if (fl_string_compare(string, fl_status_string_filesystem_quota_reached, length, fl_status_string_filesystem_quota_reached_length) == f_equal_to) { + *code = f_filesystem_quota_reached; + return f_none; + } + #endif // _di_f_status_filesystem_ + #ifndef _di_fll_status_directory_ if (fl_string_compare(string, fl_status_string_directory_read_error, length, fl_status_string_directory_read_error_length) == f_equal_to) { *code = f_directory_error_read; @@ -1124,6 +1141,11 @@ extern "C" { return f_none; } + if (fl_string_compare(string, fl_status_string_directory_error_link_max, length, fl_status_string_directory_error_link_max_length) == f_equal_to) { + *code = f_directory_error_link_max; + return f_none; + } + if (fl_string_compare(string, fl_status_string_directory_purge_error, length, fl_status_string_directory_purge_error_length) == f_equal_to) { *code = f_directory_error_purge; return f_none; -- 1.8.3.1