Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:16

0001 /**
0002  * @file
0003  *
0004  * @ingroup libfs_msdos MSDOS FileSystem
0005  *
0006  * @brief Shut Down MSDOS FileSystem
0007  */
0008 
0009 /*
0010  *  Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
0011  *  Author: Eugeny S. Mints <Eugeny.Mints@oktet.ru>
0012  *
0013  *  The license and distribution terms for this file may be
0014  *  found in the file LICENSE in this distribution or at
0015  *  http://www.rtems.org/license/LICENSE.
0016  */
0017 
0018 #ifdef HAVE_CONFIG_H
0019 #include "config.h"
0020 #endif
0021 
0022 #include <sys/types.h>
0023 #include <fcntl.h>
0024 #include <unistd.h>
0025 #include <stdlib.h>
0026 #include <stdio.h>
0027 
0028 #include <rtems.h>
0029 #include <rtems/libio_.h>
0030 
0031 #include "fat.h"
0032 #include "fat_fat_operations.h"
0033 #include "fat_file.h"
0034 
0035 #include "msdos.h"
0036 
0037 /* msdos_shut_down --
0038  *     Shut down MSDOS filesystem - free all allocated resources (don't
0039  *     return if deallocation of some resource failed - free as much as
0040  *     possible).
0041  *
0042  * PARAMETERS:
0043  *     temp_mt_entry - mount table entry
0044  *
0045  */
0046 void
0047 msdos_shut_down(rtems_filesystem_mount_table_entry_t *temp_mt_entry)
0048 {
0049     msdos_fs_info_t *fs_info = temp_mt_entry->fs_info;
0050     fat_file_fd_t   *fat_fd = temp_mt_entry->mt_fs_root->location.node_access;
0051     rtems_dosfs_convert_control *converter = fs_info->converter;
0052 
0053     /* close fat-file which corresponds to root directory */
0054     fat_file_close(&fs_info->fat, fat_fd);
0055 
0056     fat_shutdown_drive(&fs_info->fat);
0057 
0058     rtems_recursive_mutex_destroy(&fs_info->vol_mutex);
0059     (*converter->handler->destroy)( converter );
0060     free(fs_info->cl_buf);
0061     free(temp_mt_entry->fs_info);
0062 }