File indexing completed on 2025-05-11 08:24:17
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifdef HAVE_CONFIG_H
0019 #include "config.h"
0020 #endif
0021
0022 #include "msdos.h"
0023
0024 int
0025 msdos_rmnod(const rtems_filesystem_location_info_t *parent_pathloc,
0026 const rtems_filesystem_location_info_t *pathloc)
0027 {
0028 int rc = RC_OK;
0029 msdos_fs_info_t *fs_info = pathloc->mt_entry->fs_info;
0030 fat_file_fd_t *fat_fd = pathloc->node_access;
0031
0032 if (fat_fd->fat_file_type == FAT_DIRECTORY)
0033 {
0034 bool is_empty = false;
0035
0036
0037
0038
0039 rc = msdos_dir_is_empty(pathloc->mt_entry, fat_fd, &is_empty);
0040 if (rc != RC_OK)
0041 {
0042 return rc;
0043 }
0044
0045 if (!is_empty)
0046 {
0047 rtems_set_errno_and_return_minus_one(ENOTEMPTY);
0048 }
0049
0050
0051
0052
0053
0054 if (fat_fd->links_num > 1)
0055 {
0056 rtems_set_errno_and_return_minus_one(EBUSY);
0057 }
0058
0059
0060
0061
0062
0063 }
0064
0065
0066 rc = msdos_set_first_char4file_name(pathloc->mt_entry, &fat_fd->dir_pos,
0067 MSDOS_THIS_DIR_ENTRY_EMPTY);
0068 if (rc != RC_OK)
0069 {
0070 return rc;
0071 }
0072
0073 fat_file_mark_removed(&fs_info->fat, fat_fd);
0074
0075 return rc;
0076 }