Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:13

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @brief Basic Filesystem Types
0007  *
0008  * This file defines basic filesystem types
0009  */
0010 
0011 /*
0012  *  COPYRIGHT (c) 1989-2011.
0013  *  On-Line Applications Research Corporation (OAR).
0014  *
0015  *  Modifications to support reference counting in the file system are
0016  *  Copyright (c) 2012 embedded brains GmbH & Co. KG
0017  *
0018  * Redistribution and use in source and binary forms, with or without
0019  * modification, are permitted provided that the following conditions
0020  * are met:
0021  * 1. Redistributions of source code must retain the above copyright
0022  *    notice, this list of conditions and the following disclaimer.
0023  * 2. Redistributions in binary form must reproduce the above copyright
0024  *    notice, this list of conditions and the following disclaimer in the
0025  *    documentation and/or other materials provided with the distribution.
0026  *
0027  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0028  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0029  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0030  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0031  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0032  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0033  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0034  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0035  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0036  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0037  * POSSIBILITY OF SUCH DAMAGE.
0038  */
0039 
0040 #ifndef _RTEMS_FS_H
0041 #define _RTEMS_FS_H
0042 
0043 #include <rtems/chain.h>
0044 
0045 #ifdef __cplusplus
0046 extern "C" {
0047 #endif
0048 
0049 /*
0050  *  File descriptor Table Information
0051  */
0052 
0053 /* Forward declarations */
0054 
0055 /* FIXME: shouldn't this better not be here? */
0056 typedef struct rtems_libio_tt rtems_libio_t;
0057 
0058 struct rtems_filesystem_mount_table_entry_tt;
0059 typedef struct rtems_filesystem_mount_table_entry_tt
0060     rtems_filesystem_mount_table_entry_t;
0061 
0062 typedef struct _rtems_filesystem_file_handlers_r
0063     rtems_filesystem_file_handlers_r;
0064 typedef struct _rtems_filesystem_operations_table
0065     rtems_filesystem_operations_table;
0066 
0067 /**
0068  * @brief File system location.
0069  *
0070  * @ingroup LibIO
0071  */
0072 typedef struct rtems_filesystem_location_info_tt {
0073    rtems_chain_node                         mt_entry_node;
0074    void                                    *node_access;
0075    void                                    *node_access_2;
0076    const rtems_filesystem_file_handlers_r  *handlers;
0077    rtems_filesystem_mount_table_entry_t    *mt_entry;
0078 } rtems_filesystem_location_info_t;
0079 
0080 /**
0081  * @brief Global file system location.
0082  *
0083  * @ingroup LibIO
0084  *
0085  * The global file system locations are used for
0086  * - the mount point location in the mount table entry,
0087  * - the file system root location in the mount table entry,
0088  * - the root directory location in the user environment, and
0089  * - the current directory location in the user environment.
0090  *
0091  * During the path evaluation global start locations are obtained to ensure
0092  * that the current file system will be not unmounted in the meantime.
0093  *
0094  * To support a release within critical sections of the operating system a
0095  * deferred release is supported.  This is similar to malloc() and free().
0096  *
0097  * @see rtems_filesystem_global_location_obtain() and
0098  * rtems_filesystem_global_location_release().
0099  */
0100 typedef struct rtems_filesystem_global_location_t {
0101   rtems_filesystem_location_info_t location;
0102   int reference_count;
0103 
0104   /**
0105    * A release within a critical section of the operating system will add this
0106    * location to a list of deferred released locations.  This list is processed
0107    * in the next rtems_filesystem_global_location_obtain() in FIFO order.
0108    */
0109   struct rtems_filesystem_global_location_t *deferred_released_next;
0110 
0111   /**
0112    * A release within a critical section can happen multiple times.  This field
0113    * counts the deferred releases.
0114    */
0115   int deferred_released_count;
0116 } rtems_filesystem_global_location_t;
0117 
0118 /*
0119  * Return the mount table entry for a path location.
0120  */
0121 #define rtems_filesystem_location_mount(_pl) ((_pl)->mt_entry)
0122 
0123 #ifdef __cplusplus
0124 }
0125 #endif
0126 
0127 #endif
0128 /* end of include file */