source:
rtems/cpukit/libfs/src/dosfs/msdos_fsunmount.c
@
71c012af
Last change on this file since 71c012af was 71c012af, checked in by Joel Sherrill <joel.sherrill@…>, on 07/04/10 at 14:53:47 | |
---|---|
|
|
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 | */ |
45 | int |
46 | msdos_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.