source: rtems/cpukit/include/rtems/fs.h @ da154e14

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

Filesystem: Move operations to mount table entry

The scope of the file system operations is the file system instance.
The scope of the file system node handlers is the file location. The
benefit of moving the operations to the mount table entry is a size
reduction of the file location (rtems_filesystem_location_info_t). The
code size is slightly increased due to additional load instructions.

Restructure rtems_filesystem_mount_table_entry_t to improve cache
efficiency.

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/**
2 * @file rtems/fs.h
3 *
4 * This file defines basic filesystem types
5 */
6
7/*
8 *  COPYRIGHT (c) 1989-2011.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  Modifications to support reference counting in the file system are
12 *  Copyright (c) 2012 embedded brains GmbH.
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 */
18
19#ifndef _RTEMS_FS_H
20#define _RTEMS_FS_H
21
22#include <rtems/chain.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/*
29 *  File descriptor Table Information
30 */
31
32/* Forward declarations */
33
34/* FIXME: shouldn't this better not be here? */
35typedef struct rtems_libio_tt rtems_libio_t;
36
37struct rtems_filesystem_mount_table_entry_tt;
38typedef struct rtems_filesystem_mount_table_entry_tt
39    rtems_filesystem_mount_table_entry_t;
40
41typedef struct _rtems_filesystem_file_handlers_r
42    rtems_filesystem_file_handlers_r;
43typedef struct _rtems_filesystem_operations_table
44    rtems_filesystem_operations_table;
45
46/**
47 * @brief File system location.
48 *
49 * @ingroup LibIO
50 */
51typedef struct rtems_filesystem_location_info_tt {
52   rtems_chain_node                         mt_entry_node;
53   void                                    *node_access;
54   void                                    *node_access_2;
55   const rtems_filesystem_file_handlers_r  *handlers;
56   rtems_filesystem_mount_table_entry_t    *mt_entry;
57} rtems_filesystem_location_info_t;
58
59/**
60 * @brief Global file system location.
61 *
62 * @ingroup LibIO
63 *
64 * The global file system locations are used for
65 * - the mount point location in the mount table entry,
66 * - the file system root location in the mount table entry,
67 * - the root directory location in the user environment, and
68 * - the current directory location in the user environment.
69 *
70 * During the path evaluation global start locations are obtained to ensure
71 * that the current file system will be not unmounted in the meantime.
72 *
73 * To support a release within critical sections of the operating system a
74 * deferred release is supported.  This is similar to malloc() and free().
75 *
76 * @see rtems_filesystem_global_location_obtain() and
77 * rtems_filesystem_global_location_release().
78 */
79typedef struct rtems_filesystem_global_location_t {
80  rtems_filesystem_location_info_t location;
81  int reference_count;
82
83  /**
84   * A release within a critical section of the operating system will add this
85   * location to a list of deferred released locations.  This list is processed
86   * in the next rtems_filesystem_global_location_obtain() in FIFO order.
87   */
88  struct rtems_filesystem_global_location_t *deferred_released_next;
89
90  /**
91   * A release within a critical section can happen multiple times.  This field
92   * counts the deferred releases.
93   */
94  int deferred_released_count;
95} rtems_filesystem_global_location_t;
96
97/*
98 * Return the mount table entry for a path location.
99 */
100#define rtems_filesystem_location_mount(_pl) ((_pl)->mt_entry)
101
102#ifdef __cplusplus
103}
104#endif
105
106#endif
107/* end of include file */
Note: See TracBrowser for help on using the repository browser.