diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2002-02-28 20:43:50 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2002-02-28 20:43:50 +0000 |
commit | f36a7bfcde756cae3b3e933f0e688137fb684be8 (patch) | |
tree | 0d1c325e5c12913674c0e1d6ddfd656fa8c0fcd8 /cpukit/libfs/src/dosfs/msdos_fsunmount.c | |
parent | 2002-02-28 Joel Sherrill <joel@OARcorp.com> (diff) | |
download | rtems-f36a7bfcde756cae3b3e933f0e688137fb684be8.tar.bz2 |
2002-02-28 Victor V. Vengerov <vvv@oktet.ru>
* DOS filesystem including FAT12, FAT16, and FAT32 support submitted.
* src/dosfs, src/dosfs/Makefile.am, src/dosfs/stamp-h2.in,
src/dosfs/config.h.in, src/dosfs/dosfs.h, src/dosfs/fat.c,
src/dosfs/fat.h, src/dosfs/fat_fat_operations.c,
src/dosfs/fat_fat_operations.h, src/dosfs/fat_file.c,
src/dosfs/fat_file.h, src/dosfs/msdos.h, src/dosfs/msdos_create.c,
src/dosfs/msdos_dir.c, src/dosfs/msdos_eval.c, src/dosfs/msdos_file.c,
src/dosfs/msdos_free.c, src/dosfs/msdos_fsunmount.c,
src/dosfs/msdos_handlers_dir.c, src/dosfs/msdos_handlers_file.c,
src/dosfs/msdos_init.c, src/dosfs/msdos_initsupp.c,
src/dosfs/msdos_misc.c, src/dosfs/msdos_mknod.c,
src/dosfs/msdos_node_type.c, src/dosfs/.cvsignore: New files.
* configure.ac, src/Makefile.am, wrapup/Makefile.am: Modified to
reflect addition.
Diffstat (limited to 'cpukit/libfs/src/dosfs/msdos_fsunmount.c')
-rw-r--r-- | cpukit/libfs/src/dosfs/msdos_fsunmount.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/cpukit/libfs/src/dosfs/msdos_fsunmount.c b/cpukit/libfs/src/dosfs/msdos_fsunmount.c new file mode 100644 index 0000000000..9072a2fad5 --- /dev/null +++ b/cpukit/libfs/src/dosfs/msdos_fsunmount.c @@ -0,0 +1,71 @@ +/* + * MSDOS shut down handler implementation + * + * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia + * Author: Eugeny S. Mints <Eugeny.Mints@oktet.ru> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * @(#) $Id$ + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include <sys/types.h> +#include <fcntl.h> +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> + +#include <assert.h> +#include <rtems.h> +#include <rtems/libio_.h> + +#include "fat.h" +#include "fat_fat_operations.h" +#include "fat_file.h" + +#include "msdos.h" + +/* msdos_shut_down -- + * Shut down MSDOS filesystem - free all allocated resources (don't + * return if deallocation of some resource failed - free as much as + * possible). + * + * PARAMETERS: + * temp_mt_entry - mount table entry + * + * RETURNS: + * RC_OK on success, or -1 if error occured (errno set apropriately). + * + */ +int +msdos_shut_down(rtems_filesystem_mount_table_entry_t *temp_mt_entry) +{ + int rc = RC_OK; + msdos_fs_info_t *fs_info = temp_mt_entry->fs_info; + fat_file_fd_t *fat_fd = temp_mt_entry->mt_fs_root.node_access; + + /* close fat-file which correspondes to root directory */ + if (fat_file_close(temp_mt_entry, fat_fd) != RC_OK) + { + /* no return - try to free as much as possible */ + rc = -1; + } + + if (fat_shutdown_drive(temp_mt_entry) != RC_OK) + { + /* no return - try to free as much as possible */ + rc = -1; + } + + rtems_semaphore_delete(fs_info->vol_sema); + free(fs_info->cl_buf); + free(temp_mt_entry->fs_info); + + return rc; +} |