RTEMS  5.1
Data Structures | Macros | Typedefs | Functions

RTEMS File System Data. More...

#include <rtems/rfs/rtems-rfs-group.h>

Go to the source code of this file.

Data Structures

struct  _rtems_rfs_file_system
 

Macros

#define RTEMS_RFS_SB_OFFSET_MAGIC   (0)
 
#define RTEMS_RFS_SB_MAGIC   (0x28092001)
 
#define RTEMS_RFS_SB_OFFSET_VERSION   (RTEMS_RFS_SB_OFFSET_MAGIC + 4)
 
#define RTEMS_RFS_SB_OFFSET_BLOCK_SIZE   (RTEMS_RFS_SB_OFFSET_VERSION + 4)
 
#define RTEMS_RFS_SB_OFFSET_BLOCKS   (RTEMS_RFS_SB_OFFSET_BLOCK_SIZE + 4)
 
#define RTEMS_RFS_SB_OFFSET_BAD_BLOCKS   (RTEMS_RFS_SB_OFFSET_BLOCKS + 4)
 
#define RTEMS_RFS_SB_OFFSET_MAX_NAME_LENGTH   (RTEMS_RFS_SB_OFFSET_BAD_BLOCKS + 4)
 
#define RTEMS_RFS_SB_OFFSET_GROUPS   (RTEMS_RFS_SB_OFFSET_MAX_NAME_LENGTH + 4)
 
#define RTEMS_RFS_SB_OFFSET_GROUP_BLOCKS   (RTEMS_RFS_SB_OFFSET_GROUPS + 4)
 
#define RTEMS_RFS_SB_OFFSET_GROUP_INODES   (RTEMS_RFS_SB_OFFSET_GROUP_BLOCKS + 4)
 
#define RTEMS_RFS_SB_OFFSET_INODE_SIZE   (RTEMS_RFS_SB_OFFSET_GROUP_INODES + 4)
 
#define RTEMS_RFS_VERSION   (0x00000000)
 
#define RTEMS_RFS_VERSION_MASK   INT32_C(0x00000000)
 
#define RTEMS_RFS_ROOT_INO   (1)
 
#define RTEMS_RFS_EMPTY_INO   (0)
 
#define RTEMS_RFS_INODE_BLOCKS   (5)
 
#define RTEMS_RFS_INODE_OVERHEAD_PERCENTAGE   (1)
 
#define RTEMS_RFS_SUPERBLOCK_SIZE   (1)
 
#define RTEMS_RFS_FS_MAX_HELD_BUFFERS   (5)
 
#define RTEMS_RFS_FS_BITMAPS_HOLD   (1 << 0)
 
#define RTEMS_RFS_FS_NO_LOCAL_CACHE   (1 << 1)
 
#define RTEMS_RFS_FS_FORCE_OPEN   (1 << 2)
 
#define RTEMS_RFS_FS_READ_ONLY   (1 << 3)
 
#define rtems_rfs_fs_flags(_f)   ((_f)->flags)
 
#define rtems_rfs_fs_release_bitmaps(_f)   (!((_f)->flags & RTEMS_RFS_FS_BITMAPS_HOLD))
 
#define rtems_rfs_fs_no_local_cache(_f)   ((_f)->flags & RTEMS_RFS_FS_NO_LOCAL_CACHE)
 
#define rtems_rfs_fs_device(_fs)   ((_fs)->device)
 
#define rtems_rfs_fs_blocks(_fs)   ((_fs)->blocks)
 
#define rtems_rfs_fs_block_size(_fs)   ((_fs)->block_size)
 
#define rtems_rfs_fs_inodes(_fs)   ((_fs)->inodes)
 
#define rtems_rfs_fs_block(_fs, _grp, _blk)   ((((_fs)->group_blocks) * (_grp)) + (_blk) + 1)
 
#define rtems_rfs_fs_media_blocks(_fs)   ((_fs)->media_size)
 
#define rtems_rfs_fs_media_block_size(_fs)   (1)
 
#define rtems_rfs_fs_max_name(_fs)   ((_fs)->max_name_length)
 
#define rtems_rfs_fs_max_block_map_blocks(_fs)   ((_fs)->block_map_doubly_blocks)
 
#define rtems_rfs_fs_user(_fs)   ((_fs)->user)
 

Typedefs

typedef uint64_t rtems_rfs_pos
 
typedef int64_t rtems_rfs_pos_rel
 

Functions

uint64_t rtems_rfs_fs_size (rtems_rfs_file_system *fs)
 
uint64_t rtems_rfs_fs_media_size (rtems_rfs_file_system *fs)
 
int rtems_rfs_fs_open (const char *name, void *user, uint32_t flags, uint32_t max_held_buffers, rtems_rfs_file_system **fs)
 
int rtems_rfs_fs_close (rtems_rfs_file_system *fs)
 

Detailed Description

RTEMS File System Data.

RTEMS File System Data

This file defines the file system data.

Macro Definition Documentation

◆ RTEMS_RFS_EMPTY_INO

#define RTEMS_RFS_EMPTY_INO   (0)

Empty inode number.

◆ RTEMS_RFS_FS_BITMAPS_HOLD

#define RTEMS_RFS_FS_BITMAPS_HOLD   (1 << 0)

Flags to control the file system.Do not release bitmaps when finished. Default is off so they are released.

◆ rtems_rfs_fs_block

#define rtems_rfs_fs_block (   _fs,
  _grp,
  _blk 
)    ((((_fs)->group_blocks) * (_grp)) + (_blk) + 1)

Calculate a block in the file system given the group and the block within the group.

Parameters
[in]_fsis a pointer to the file system.
[in]_grpis the group.
[in]_blkis the block within the group.
Returns
The absolute block number.

◆ rtems_rfs_fs_block_size

#define rtems_rfs_fs_block_size (   _fs)    ((_fs)->block_size)

The block size.

Parameters
[in]_fsis a pointer to the file system.

◆ rtems_rfs_fs_blocks

#define rtems_rfs_fs_blocks (   _fs)    ((_fs)->blocks)

The size of the disk in blocks.

Parameters
[in]_fsis a pointer to the file system.

◆ rtems_rfs_fs_device

#define rtems_rfs_fs_device (   _fs)    ((_fs)->device)

The disk device number.

Parameters
[in]_fsis a pointer to the file system.

◆ rtems_rfs_fs_flags

#define rtems_rfs_fs_flags (   _f)    ((_f)->flags)

Return the flags.

Parameters
[in]_fsis a pointer to the file system.

◆ RTEMS_RFS_FS_FORCE_OPEN

#define RTEMS_RFS_FS_FORCE_OPEN   (1 << 2)

Force open and ignore any errors.

◆ rtems_rfs_fs_inodes

#define rtems_rfs_fs_inodes (   _fs)    ((_fs)->inodes)

The number of inodes.

Parameters
[in]_fsis a pointer to the file system.

◆ rtems_rfs_fs_max_block_map_blocks

#define rtems_rfs_fs_max_block_map_blocks (   _fs)    ((_fs)->block_map_doubly_blocks)

Return the maximum number of blocks in a block map.

Returns
uint32_t The maximum number of blocks possible.

◆ RTEMS_RFS_FS_MAX_HELD_BUFFERS

#define RTEMS_RFS_FS_MAX_HELD_BUFFERS   (5)

The maximum number of buffers held by the file system at any one time.

◆ rtems_rfs_fs_max_name

#define rtems_rfs_fs_max_name (   _fs)    ((_fs)->max_name_length)

The maximum length of a name supported by the file system.

◆ rtems_rfs_fs_media_block_size

#define rtems_rfs_fs_media_block_size (   _fs)    (1)

The media block size. This is the size of a block on disk. For a device I/O this value is 1.

Parameters
[in]_fsis a pointer to the file system.

◆ rtems_rfs_fs_media_blocks

#define rtems_rfs_fs_media_blocks (   _fs)    ((_fs)->media_size)

The media size of the disk in media size blocks.

Parameters
[in]_fsis a pointer to the file system.

◆ RTEMS_RFS_FS_NO_LOCAL_CACHE

#define RTEMS_RFS_FS_NO_LOCAL_CACHE   (1 << 1)

Do not cache the buffers and release directly to the buffer support layer. The default is to hold buffers.

◆ rtems_rfs_fs_no_local_cache

#define rtems_rfs_fs_no_local_cache (   _f)    ((_f)->flags & RTEMS_RFS_FS_NO_LOCAL_CACHE)

Are the buffers locally cache or released back to the buffering layer ?

Parameters
[in]_fsis a pointer to the file system.

◆ RTEMS_RFS_FS_READ_ONLY

#define RTEMS_RFS_FS_READ_ONLY   (1 << 3)

Make the mount read-only. Currently not supported.

◆ rtems_rfs_fs_release_bitmaps

#define rtems_rfs_fs_release_bitmaps (   _f)    (!((_f)->flags & RTEMS_RFS_FS_BITMAPS_HOLD))

Should bitmap buffers be released when finished ?

Parameters
[in]_fsis a pointer to the file system.

◆ rtems_rfs_fs_user

#define rtems_rfs_fs_user (   _fs)    ((_fs)->user)

Return the user pointer.

◆ RTEMS_RFS_INODE_BLOCKS

#define RTEMS_RFS_INODE_BLOCKS   (5)

The number of blocks in the inode. This number effects the size of the inode and that effects the overhead of the inode tables in a group.

◆ RTEMS_RFS_INODE_OVERHEAD_PERCENTAGE

#define RTEMS_RFS_INODE_OVERHEAD_PERCENTAGE   (1)

The inode overhead is the percentage of space reserved for inodes. It is calculated as the percentage number of blocks in a group. The number of blocks in a group is the number of bits a block can hold.

◆ RTEMS_RFS_ROOT_INO

#define RTEMS_RFS_ROOT_INO   (1)

The root inode number. Do not use 0 as this has special meaning in some Unix operating systems.

◆ RTEMS_RFS_SB_OFFSET_MAGIC

#define RTEMS_RFS_SB_OFFSET_MAGIC   (0)

Superblock offsets and values.

◆ RTEMS_RFS_SUPERBLOCK_SIZE

#define RTEMS_RFS_SUPERBLOCK_SIZE   (1)

Number of blocks in the superblock. Yes I know it is a superblock and not superblocks but if for any reason this needs to change it is handled.

◆ RTEMS_RFS_VERSION

#define RTEMS_RFS_VERSION   (0x00000000)

RFS Version Number.

◆ RTEMS_RFS_VERSION_MASK

#define RTEMS_RFS_VERSION_MASK   INT32_C(0x00000000)

RFS Version Number Mask. The mask determines which bits of the version number indicate compatility issues.

Typedef Documentation

◆ rtems_rfs_pos

typedef uint64_t rtems_rfs_pos

Absolute position. Make a 64bit value.

◆ rtems_rfs_pos_rel

typedef int64_t rtems_rfs_pos_rel

Relative position. Make a 64bit value.

Function Documentation

◆ rtems_rfs_fs_close()

int rtems_rfs_fs_close ( rtems_rfs_file_system fs)

Close the file system.

Parameters
[in]fsis the file system data.
Return values
0Successful operation.
-1Error. See errno

◆ rtems_rfs_fs_media_size()

uint64_t rtems_rfs_fs_media_size ( rtems_rfs_file_system fs)

The size of the disk in bytes calculated from the media parameters..

Parameters
[in]fsis a pointer to the file system.
Returns
uint64_t The size of the disk in bytes.

◆ rtems_rfs_fs_open()

int rtems_rfs_fs_open ( const char *  name,
void *  user,
uint32_t  flags,
uint32_t  max_held_buffers,
rtems_rfs_file_system **  fs 
)

Open the file system given a file path.

Parameters
[in]nameis a pointer to the device to open.
[in]fsis the file system data filled in by this call.
[in]useris a pointer to the user data.
[in]flagsis a initial set of user flags for the file system.
[in]max_held_buffersis the maximum number of buffers the RFS holds.
Return values
0Successful operation.
-1Error. See errno

◆ rtems_rfs_fs_size()

uint64_t rtems_rfs_fs_size ( rtems_rfs_file_system fs)

Return the size of the disk in bytes.

Parameters
[in]fsis a pointer to the file system.
Returns
uint64_t The size of the disk in bytes.