Back to home page

LXR

 
 

    


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

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup rtems_rfs
0007  *
0008  * @brief RTEMS File System Format
0009  *
0010  * This function lets you format a disk in the RFS format.
0011  */
0012 
0013 /*
0014  *  COPYRIGHT (c) 2010 Chris Johns <chrisj@rtems.org>
0015  *
0016  * Redistribution and use in source and binary forms, with or without
0017  * modification, are permitted provided that the following conditions
0018  * are met:
0019  * 1. Redistributions of source code must retain the above copyright
0020  *    notice, this list of conditions and the following disclaimer.
0021  * 2. Redistributions in binary form must reproduce the above copyright
0022  *    notice, this list of conditions and the following disclaimer in the
0023  *    documentation and/or other materials provided with the distribution.
0024  *
0025  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0026  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0027  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0028  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0029  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0030  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0031  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0032  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0033  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0034  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0035  * POSSIBILITY OF SUCH DAMAGE.
0036  */
0037 
0038 #if !defined (_RTEMS_RFS_FORMAT_H_)
0039 #define _RTEMS_RFS_FORMAT_H_
0040 
0041 #include <stddef.h>
0042 #include <stdbool.h>
0043 #include <stdint.h>
0044 
0045 #ifdef __cplusplus
0046 extern "C" {
0047 #endif
0048 
0049 #include <rtems/rfs/rtems-rfs-trace.h>
0050 
0051 /**
0052  * RFS File System Configuration data used to format the file system. For
0053  * default values leave the field set to 0.
0054  */
0055 typedef struct _rtems_rfs_format_config
0056 {
0057   /**
0058    * The size of a block.
0059    */
0060   size_t block_size;
0061 
0062   /**
0063    * The number of blocks in a group.
0064    */
0065   size_t group_blocks;
0066 
0067   /**
0068    * The number of inodes in a group.
0069    */
0070   size_t group_inodes;
0071 
0072   /**
0073    * The percentage overhead allocated to inodes.
0074    */
0075   int inode_overhead;
0076 
0077   /**
0078    * The maximum length of a name.
0079    */
0080   size_t max_name_length;
0081 
0082   /**
0083    * Initialise the inode tables to all ones.
0084    */
0085   bool initialise_inodes;
0086 
0087   /**
0088    * Is the format verbose.
0089    */
0090   bool verbose;
0091 
0092 } rtems_rfs_format_config;
0093 
0094 /**
0095  * RFS Format command.
0096  *
0097  * @param[in] name is the device name to format.
0098  * @param[in] config is a pointer to the configuration table.
0099  *
0100  * @retval -1 Error. See errno.
0101  * @retval 0 No error. Format successful.
0102  */
0103 int rtems_rfs_format (const char* name, const rtems_rfs_format_config* config);
0104 
0105 #ifdef __cplusplus
0106 }
0107 #endif
0108 
0109 #endif