source: rtems/cpukit/libfs/src/dosfs/msdos_fsunmount.c @ 71c012af

4.115
Last change on this file since 71c012af was 71c012af, checked in by Joel Sherrill <joel.sherrill@…>, on 07/04/10 at 14:53:47

2010-07-04 Joel Sherrill <joel.sherrill@…>

  • libblock/include/rtems/ide_part_table.h, libblock/src/bdbuf.c, libcsupport/src/times.c, libcsupport/src/libio_init.c, libcsupport/src/mallocfreespace.c, libcsupport/src/mount-mgr.c, libcsupport/src/mount.c, libcsupport/src/rewinddir.c, libcsupport/src/seekdir.c, libcsupport/src/telldir.c, libcsupport/src/unmount.c, libfs/src/dosfs/fat.c, libfs/src/dosfs/fat_fat_operations.c, libfs/src/dosfs/msdos_create.c, libfs/src/dosfs/msdos_dir.c, libfs/src/dosfs/msdos_eval.c, libfs/src/dosfs/msdos_file.c, libfs/src/dosfs/msdos_format.c, libfs/src/dosfs/msdos_fsunmount.c, libfs/src/dosfs/msdos_initsupp.c, libfs/src/dosfs/msdos_rename.c, libmisc/cpuuse/cpuusagereport.c, libmisc/shell/vis.c, libmisc/stackchk/check.c, sapi/src/posixapi.c, telnetd/telnetd.c: Remove include of assert.h when it is not needed.
  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  MSDOS shut down handler implementation
3 *
4 *  Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
5 *  Author: Eugeny S. Mints <Eugeny.Mints@oktet.ru>
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  @(#) $Id$
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <sys/types.h>
19#include <fcntl.h>
20#include <unistd.h>
21#include <stdlib.h>
22#include <stdio.h>
23
24#include <rtems.h>
25#include <rtems/libio_.h>
26
27#include "fat.h"
28#include "fat_fat_operations.h"
29#include "fat_file.h"
30
31#include "msdos.h"
32
33/* msdos_shut_down --
34 *     Shut down MSDOS filesystem - free all allocated resources (don't
35 *     return if deallocation of some resource failed - free as much as
36 *     possible).
37 *
38 * PARAMETERS:
39 *     temp_mt_entry - mount table entry
40 *
41 * RETURNS:
42 *     RC_OK on success, or -1 if error occured (errno set apropriately).
43 *
44 */
45int
46msdos_shut_down(rtems_filesystem_mount_table_entry_t *temp_mt_entry)
47{
48    int              rc = RC_OK;
49    msdos_fs_info_t *fs_info = temp_mt_entry->fs_info;
50    fat_file_fd_t   *fat_fd = temp_mt_entry->mt_fs_root.node_access;
51
52    /* close fat-file which correspondes to root directory */
53    if (fat_file_close(temp_mt_entry, fat_fd) != RC_OK)
54    {
55        /* no return - try to free as much as possible */
56        rc = -1;
57    }
58
59    if (fat_shutdown_drive(temp_mt_entry) != RC_OK)
60    {
61        /* no return - try to free as much as possible */
62        rc = -1;
63    }
64
65    rtems_semaphore_delete(fs_info->vol_sema);
66    free(fs_info->cl_buf);
67    free(temp_mt_entry->fs_info);
68
69    return rc;
70}
Note: See TracBrowser for help on using the repository browser.