OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [libfs/] [src/] [dosfs/] [msdos_fsunmount.c] - Blame information for rev 1771

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
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.OARcorp.com/rtems/license.html.
10
 *
11
 *  @(#) msdos_fsunmount.c,v 1.1 2002/02/28 20:43:50 joel Exp
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 <assert.h>
25
#include <rtems.h>
26
#include <rtems/libio_.h>
27
 
28
#include "fat.h"
29
#include "fat_fat_operations.h"
30
#include "fat_file.h"
31
 
32
#include "msdos.h"
33
 
34
/* msdos_shut_down --
35
 *     Shut down MSDOS filesystem - free all allocated resources (don't
36
 *     return if deallocation of some resource failed - free as much as
37
 *     possible).
38
 *
39
 * PARAMETERS:
40
 *     temp_mt_entry - mount table entry
41
 *
42
 * RETURNS:
43
 *     RC_OK on success, or -1 if error occured (errno set apropriately).
44
 *
45
 */
46
int
47
msdos_shut_down(rtems_filesystem_mount_table_entry_t *temp_mt_entry)
48
{
49
    int              rc = RC_OK;
50
    msdos_fs_info_t *fs_info = temp_mt_entry->fs_info;
51
    fat_file_fd_t   *fat_fd = temp_mt_entry->mt_fs_root.node_access;
52
 
53
    /* close fat-file which correspondes to root directory */
54
    if (fat_file_close(temp_mt_entry, fat_fd) != RC_OK)
55
    {
56
        /* no return - try to free as much as possible */
57
        rc = -1;
58
    }
59
 
60
    if (fat_shutdown_drive(temp_mt_entry) != RC_OK)
61
    {
62
        /* no return - try to free as much as possible */
63
        rc = -1;
64
    }
65
 
66
    rtems_semaphore_delete(fs_info->vol_sema);
67
    free(fs_info->cl_buf);
68
    free(temp_mt_entry->fs_info);
69
 
70
    return rc;
71
}

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.