source: rtems/cpukit/libfs/src/dosfs/msdos_init.c @ 7666afc

4.11
Last change on this file since 7666afc was 7666afc, checked in by Sebastian Huber <sebastian.huber@…>, on May 14, 2012 at 2:53:49 PM

Filesystem: Add const qualifier to lock/unlock

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*
2 *  Init routine for MSDOS
3 *
4 *  Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
5 *  Author: Eugeny S. Mints <Eugeny.Mints@oktet.ru>
6 *
7 *  Modifications to support reference counting in the file system are
8 *  Copyright (c) 2012 embedded brains GmbH.
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.rtems.com/license/LICENSE.
13 */
14
15#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <rtems/libio_.h>
20#include "dosfs.h"
21#include "msdos.h"
22
23static int msdos_clone_node_info(rtems_filesystem_location_info_t *loc)
24{
25    fat_file_fd_t *fat_fd = loc->node_access;
26
27    return fat_file_reopen(fat_fd);
28}
29
30const rtems_filesystem_operations_table  msdos_ops = {
31  .lock_h         =  msdos_lock,
32  .unlock_h       =  msdos_unlock,
33  .eval_path_h    =  msdos_eval_path,
34  .link_h         =  rtems_filesystem_default_link,
35  .are_nodes_equal_h = rtems_filesystem_default_are_nodes_equal,
36  .node_type_h    =  msdos_node_type,
37  .mknod_h        =  msdos_mknod,
38  .rmnod_h        =  msdos_rmnod,
39  .fchmod_h       =  rtems_filesystem_default_fchmod,
40  .chown_h        =  rtems_filesystem_default_chown,
41  .clonenod_h     =  msdos_clone_node_info,
42  .freenod_h      =  msdos_free_node_info,
43  .mount_h        =  rtems_filesystem_default_mount,
44  .fsmount_me_h   =  rtems_dosfs_initialize,
45  .unmount_h      =  rtems_filesystem_default_unmount,
46  .fsunmount_me_h =  msdos_shut_down,
47  .utime_h        =  rtems_filesystem_default_utime,
48  .symlink_h      =  rtems_filesystem_default_symlink,
49  .readlink_h     =  rtems_filesystem_default_readlink,
50  .rename_h       =  msdos_rename,
51  .statvfs_h      =  rtems_filesystem_default_statvfs
52};
53
54void msdos_lock(const rtems_filesystem_mount_table_entry_t *mt_entry)
55{
56  msdos_fs_info_t *fs_info = mt_entry->fs_info;
57  rtems_status_code sc = rtems_semaphore_obtain(
58    fs_info->vol_sema,
59    RTEMS_WAIT,
60    RTEMS_NO_TIMEOUT
61  );
62  if (sc != RTEMS_SUCCESSFUL) {
63    rtems_fatal_error_occurred(0xdeadbeef);
64  }
65}
66
67void msdos_unlock(const rtems_filesystem_mount_table_entry_t *mt_entry)
68{
69  msdos_fs_info_t *fs_info = mt_entry->fs_info;
70  rtems_status_code sc = rtems_semaphore_release(fs_info->vol_sema);
71  if (sc != RTEMS_SUCCESSFUL) {
72    rtems_fatal_error_occurred(0xdeadbeef);
73  }
74}
75
76/* msdos_initialize --
77 *     MSDOS filesystem initialization. Called when mounting an
78 *     MSDOS filesystem.
79 *
80 * PARAMETERS:
81 *     temp_mt_entry - mount table entry
82 *
83 * RETURNS:
84 *     RC_OK on success, or -1 if error occured (errno set apropriately).
85 *
86 */
87int rtems_dosfs_initialize(rtems_filesystem_mount_table_entry_t *mt_entry,
88                           const void                           *data)
89{
90    int rc;
91
92    rc = msdos_initialize_support(mt_entry,
93                                  &msdos_ops,
94                                  &msdos_file_handlers,
95                                  &msdos_dir_handlers);
96    return rc;
97}
Note: See TracBrowser for help on using the repository browser.