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