Miosix  2.0alpha1
miosix::FilesystemBase Class Referenceabstract

#include <file.h>

Inheritance diagram for miosix::FilesystemBase:
Collaboration diagram for miosix::FilesystemBase:

Public Member Functions

 FilesystemBase ()
 
virtual int open (intrusive_ref_ptr< FileBase > &file, StringPart &name, int flags, int mode)=0
 
virtual int lstat (StringPart &name, struct stat *pstat)=0
 
virtual int unlink (StringPart &name)=0
 
virtual int rename (StringPart &oldName, StringPart &newName)=0
 
virtual int mkdir (StringPart &name, int mode)=0
 
virtual int rmdir (StringPart &name)=0
 
virtual int readlink (StringPart &name, std::string &target)
 
virtual bool supportsSymlinks () const
 
short int getFsId () const
 
virtual ~FilesystemBase ()
 
- Public Member Functions inherited from miosix::IntrusiveRefCountedSharedFromThis< FilesystemBase >
 IntrusiveRefCountedSharedFromThis ()
 
intrusive_ref_ptr< FilesystemBaseshared_from_this ()
 
intrusive_ref_ptr< const
FilesystemBase
shared_from_this () const
 
virtual ~IntrusiveRefCountedSharedFromThis ()
 

Protected Attributes

const short int filesystemId
 The unique filesystem id, used by lstat.
 
int parentFsMountpointInode
 The inode of the directory in the parent fs.
 

Additional Inherited Members

- Protected Member Functions inherited from miosix::IntrusiveRefCounted
 IntrusiveRefCounted ()
 
 IntrusiveRefCounted (const IntrusiveRefCounted &)
 
IntrusiveRefCountedoperator= (const IntrusiveRefCounted &)
 

Detailed Description

All filesystems derive from this class. Classes of this type are reference counted, must be allocated on the heap and managed through intrusive_ref_ptr<FilesystemBase>

Constructor & Destructor Documentation

miosix::FilesystemBase::FilesystemBase ( )

Constructor

miosix::FilesystemBase::~FilesystemBase ( )
virtual

Destructor

Member Function Documentation

short int miosix::FilesystemBase::getFsId ( ) const
inline
Returns
filesystem id
virtual int miosix::FilesystemBase::lstat ( StringPart &  name,
struct stat *  pstat 
)
pure virtual

Obtain information on a file, identified by a path name. Does not follow symlinks

Parameters
namepath name, relative to the local filesystem
pstatfile information is stored here
Returns
0 on success, or a negative number on failure

Implemented in miosix::MountpointFs, and miosix::Fat32Fs.

virtual int miosix::FilesystemBase::mkdir ( StringPart &  name,
int  mode 
)
pure virtual

Create a directory

Parameters
namedirectory name
modedirectory permissions
Returns
0 on success, or a negative number on failure

Implemented in miosix::MountpointFs, and miosix::Fat32Fs.

virtual int miosix::FilesystemBase::open ( intrusive_ref_ptr< FileBase > &  file,
StringPart &  name,
int  flags,
int  mode 
)
pure virtual

Open a file

Parameters
filethe file object will be stored here, if the call succeeds
namethe name of the file to open, relative to the local filesystem
flagsfile flags (open for reading, writing, ...)
modefile permissions
Returns
0 on success, or a negative number on failure

Implemented in miosix::MountpointFs, and miosix::Fat32Fs.

int miosix::FilesystemBase::readlink ( StringPart &  name,
std::string &  target 
)
virtual

Follows a symbolic link

Parameters
pathpath identifying a symlink, relative to the local filesystem
targetthe link target is returned here if the call succeeds. Note that the returned path is not relative to this filesystem, and can be either relative or absolute.
Returns
0 on success, a negative number on failure
virtual int miosix::FilesystemBase::rename ( StringPart &  oldName,
StringPart &  newName 
)
pure virtual

Rename a file or directory

Parameters
oldNameold file name
newNamenew file name
Returns
0 on success, or a negative number on failure

Implemented in miosix::MountpointFs, and miosix::Fat32Fs.

virtual int miosix::FilesystemBase::rmdir ( StringPart &  name)
pure virtual

Remove a directory if empty

Parameters
namedirectory name
Returns
0 on success, or a negative number on failure

Implemented in miosix::MountpointFs, and miosix::Fat32Fs.

bool miosix::FilesystemBase::supportsSymlinks ( ) const
virtual
Returns
true if the filesystem supports symbolic links. In this case, the filesystem should override readlink
virtual int miosix::FilesystemBase::unlink ( StringPart &  name)
pure virtual

Remove a file or directory

Parameters
namepath name of file or directory to remove
Returns
0 on success, or a negative number on failure

Implemented in miosix::MountpointFs, and miosix::Fat32Fs.


The documentation for this class was generated from the following files: