theCore C++ embedded framework
Collaboration diagram for Filesystem interfaces:

Data Structures

class  ecl::fs::dir_descriptor
 Directory descriptor interface. More...
 
class  ecl::fs::file_descriptor
 Abstract file descriptor. More...
 
class  ecl::fs::vfs< Fs >
 Virtual filesystem. More...
 
class  ecl::fs::fs_descriptor< Mount, Fs >
 Wraps filesystem class into correct descriptor, required by main FS module. More...
 
class  ecl::fs::inode
 Abstract class holding metadata about the file in the filesystem. More...
 
class  ecl::fs::path_handle
 Abstract path handle. More...
 
class  ecl::fs::path_erased< Alloc >
 Holds path and manages its deallocation. More...
 
class  ecl::fs::path_iter
 Path iterator. More...
 

Macros

#define ECL_FS_MOUNT_POINT(struct_name, mnt_point_path)
 Creates mount point structure with given name and given mount point path. More...
 

Typedefs

using ecl::fs::inode_ptr = ecl::shared_ptr< inode >
 Alias to inode pointer. More...
 
using ecl::fs::path_ptr = ecl::shared_ptr< path_handle >
 Alias to path smart pointer. More...
 
using ecl::fs::inode_weak = ecl::weak_ptr< inode >
 
using ecl::fs::file_ptr = ecl::shared_ptr< file_descriptor >
 
using ecl::fs::dir_ptr = ecl::shared_ptr< dir_descriptor >
 

Enumerations

enum  ecl::fs::seekdir { ecl::fs::seekdir::beg, ecl::fs::seekdir::cur, ecl::fs::seekdir::end }
 Offset changing direction. More...
 

Functions

template<class Alloc >
path_ptr ecl::fs::allocate_path (const char *path, const char *tail, const Alloc &alloc)
 Allocates new path, concatenating with tail, if needed. More...
 
static ecl::err ecl::fs::vfs< Fs >::mount_all ()
 Mounts all filesystems to their mountpoints. More...
 
static file_ptr ecl::fs::vfs< Fs >::open_file (const char *path)
 Opens file using given path. More...
 
static dir_ptr ecl::fs::vfs< Fs >::open_dir (const char *path)
 Opens file using given path. More...
 
static ecl::err ecl::fs::fs_descriptor< Mount, Fs >::mount ()
 Mounts a filesystem. More...
 
static auto ecl::fs::fs_descriptor< Mount, Fs >::get_root ()
 Gets root node. More...
 
 ecl::fs::path_erased< Alloc >::path_erased (const char *path, size_t alloc_sz, const Alloc &alloc)
 Owns given path, allocated by given allocator. More...
 
virtual ecl::fs::path_erased< Alloc >::~path_erased ()
 Destroys path. More...
 
virtual const char * ecl::fs::path_erased< Alloc >::get_path () const override
 Gets path string. More...
 

Detailed Description

Macro Definition Documentation

◆ ECL_FS_MOUNT_POINT

#define ECL_FS_MOUNT_POINT (   struct_name,
  mnt_point_path 
)
Value:
struct struct_name \
{ \
static constexpr auto mount_point() \
{ return mnt_point_path; } \
}

Creates mount point structure with given name and given mount point path.

Mounpoint struct then can be passed to the filesystem descriptor.

Parameters
[in]struct_nameStructure name.
[in]mnt_point_pathMounpoint path.

Typedef Documentation

◆ inode_ptr

Alias to inode pointer.

Todo:
move it somewhere

◆ path_ptr

Alias to path smart pointer.

◆ inode_weak

◆ file_ptr

◆ dir_ptr

Enumeration Type Documentation

◆ seekdir

enum ecl::fs::seekdir
strong

Offset changing direction.

See also
file_descriptor::seek()
Enumerator
beg 
cur 

Set new offset from the beginning.

end 

Set new offset to its current location plus given offset.

Function Documentation

◆ allocate_path()

template<class Alloc >
path_ptr ecl::fs::allocate_path ( const char *  path,
const char *  tail,
const Alloc &  alloc 
)

Allocates new path, concatenating with tail, if needed.

Template Parameters
AllocAllocator type.
Parameters
[in]pathBase path.
[in]tailIf not null, then this string will be added to the end of the path. Trailing '/' will be added, if needed.
[in]allocAllocator object.
Returns
pointer to the new path.
Here is the call graph for this function:

◆ mount_all()

template<class ... Fs>
ecl::err ecl::fs::vfs< Fs >::mount_all ( )
static

Mounts all filesystems to their mountpoints.

Returns
Status of operation.
Here is the call graph for this function:

◆ open_file()

template<class ... Fs>
file_ptr ecl::fs::vfs< Fs >::open_file ( const char *  path)
static

Opens file using given path.

Returns
Pointer to the file descriptor, or nullptr if open failed.

◆ open_dir()

template<class ... Fs>
dir_ptr ecl::fs::vfs< Fs >::open_dir ( const char *  path)
static

Opens file using given path.

Returns
Pointer to the dir descriptor, or nullptr if open failed.

◆ mount()

template<class Mount , class Fs >
ecl::err ecl::fs::fs_descriptor< Mount, Fs >::mount ( )
static

Mounts a filesystem.

Return values
Statusof operation.

◆ get_root()

template<class Mount , class Fs >
auto ecl::fs::fs_descriptor< Mount, Fs >::get_root ( )
static

Gets root node.

Return values
Statusof operation.

◆ path_erased()

template<class Alloc >
ecl::fs::path_erased< Alloc >::path_erased ( const char *  path,
size_t  alloc_sz,
const Alloc &  alloc 
)

Owns given path, allocated by given allocator.

Allocation size is an amount of space allocated for the path.

Parameters
[in]pathString representing a path.
[in]alloc_szSize of path string.
[in]allocAllocator that was used to allocate given path.

◆ ~path_erased()

template<class Alloc >
ecl::fs::path_erased< Alloc >::~path_erased ( )
virtual

Destroys path.

◆ get_path()

template<class Alloc >
const char * ecl::fs::path_erased< Alloc >::get_path ( ) const
overridevirtual

Gets path string.

Implements ecl::fs::path_handle.