diff options
Diffstat (limited to 'cpukit/libfs/src/dosfs/msdos_dir.c')
-rw-r--r-- | cpukit/libfs/src/dosfs/msdos_dir.c | 120 |
1 files changed, 5 insertions, 115 deletions
diff --git a/cpukit/libfs/src/dosfs/msdos_dir.c b/cpukit/libfs/src/dosfs/msdos_dir.c index 494b9fbae6..725fd254d0 100644 --- a/cpukit/libfs/src/dosfs/msdos_dir.c +++ b/cpukit/libfs/src/dosfs/msdos_dir.c @@ -33,20 +33,10 @@ /* msdos_dir_open -- * Open fat-file which correspondes to the directory being opened and * set offset field of file control block to zero. - * - * PARAMETERS: - * iop - file control block - * pathname - name - * flag - flags - * mode - mode - * - * RETURNS: - * RC_OK, if directory opened successfully, or -1 if error occured (errno - * set apropriately) */ int -msdos_dir_open(rtems_libio_t *iop, const char *pathname, uint32_t flag, - uint32_t mode) +msdos_dir_open(rtems_libio_t *iop, const char *pathname, int oflag, + mode_t mode) { int rc = RC_OK; rtems_status_code sc = RTEMS_SUCCESSFUL; @@ -529,9 +519,9 @@ msdos_dir_lseek(rtems_libio_t *iop, off_t offset, int whence) */ int msdos_dir_stat( - rtems_filesystem_location_info_t *loc, - struct stat *buf - ) + const rtems_filesystem_location_info_t *loc, + struct stat *buf +) { rtems_status_code sc = RTEMS_SUCCESSFUL; msdos_fs_info_t *fs_info = loc->mt_entry->fs_info; @@ -594,103 +584,3 @@ msdos_dir_sync(rtems_libio_t *iop) rtems_semaphore_release(fs_info->vol_sema); return rc; } - -/* msdos_dir_chmod -- - * Change the attributes of the directory. This currently does - * nothing and returns no error. - * - * PARAMETERS: - * pathloc - node description - * mode - the new mode - * - * RETURNS: - * RC_OK always - */ -int -msdos_dir_chmod(rtems_filesystem_location_info_t *pathloc, - mode_t mode) -{ - return RC_OK; -} - -/* msdos_dir_rmnod -- - * Remove directory node. - * - * Check that this directory node is not opened as fat-file, is empty and - * not filesystem root node. If all this conditions met then delete. - * - * PARAMETERS: - * pathloc - node description - * - * RETURNS: - * RC_OK on success, or -1 if error occured (errno set apropriately). - */ -int -msdos_dir_rmnod(rtems_filesystem_location_info_t *parent_pathloc, - rtems_filesystem_location_info_t *pathloc) -{ - int rc = RC_OK; - rtems_status_code sc = RTEMS_SUCCESSFUL; - msdos_fs_info_t *fs_info = pathloc->mt_entry->fs_info; - fat_file_fd_t *fat_fd = pathloc->node_access; - bool is_empty = false; - - sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, - MSDOS_VOLUME_SEMAPHORE_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - rtems_set_errno_and_return_minus_one(EIO); - - /* - * You cannot remove a node that still has children - */ - rc = msdos_dir_is_empty(pathloc->mt_entry, fat_fd, &is_empty); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - - if (!is_empty) - { - rtems_semaphore_release(fs_info->vol_sema); - rtems_set_errno_and_return_minus_one(ENOTEMPTY); - } - - /* - * We deny attempts to delete open directory (if directory is current - * directory we assume it is open one) - */ - if (fat_fd->links_num > 1) - { - rtems_semaphore_release(fs_info->vol_sema); - rtems_set_errno_and_return_minus_one(EBUSY); - } - - /* - * You cannot remove the file system root node. - */ - if (rtems_filesystem_is_root_location(pathloc)) - { - rtems_semaphore_release(fs_info->vol_sema); - rtems_set_errno_and_return_minus_one(EBUSY); - } - - /* - * You cannot remove a mountpoint. - * not used - mount() not implemenetd yet. - */ - - /* mark file removed */ - rc = msdos_set_first_char4file_name(pathloc->mt_entry, &fat_fd->dir_pos, - MSDOS_THIS_DIR_ENTRY_EMPTY); - if (rc != RC_OK) - { - rtems_semaphore_release(fs_info->vol_sema); - return rc; - } - - fat_file_mark_removed(pathloc->mt_entry, fat_fd); - - rtems_semaphore_release(fs_info->vol_sema); - return rc; -} |