Miosix  2.0alpha1
miosix::DevFsFile Class Reference
Inheritance diagram for miosix::DevFsFile:
Collaboration diagram for miosix::DevFsFile:

Public Member Functions

 DevFsFile (intrusive_ref_ptr< FilesystemBase > fs, intrusive_ref_ptr< Device > dev, int flags)
 
virtual ssize_t write (const void *data, size_t len)
 
virtual ssize_t read (void *data, size_t len)
 
virtual off_t lseek (off_t pos, int whence)
 
virtual int fstat (struct stat *pstat) const
 
virtual int isatty () const
 
virtual int ioctl (int cmd, void *arg)
 
- Public Member Functions inherited from miosix::FileBase
 FileBase (intrusive_ref_ptr< FilesystemBase > parent)
 
virtual int fcntl (int cmd, int opt)
 
virtual int getdents (void *dp, int len)
 
const intrusive_ref_ptr
< FilesystemBase
getParent () const
 
virtual ~FileBase ()
 

Additional Inherited Members

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

Detailed Description

This file type is for reading and writing from devices

Constructor & Destructor Documentation

miosix::DevFsFile::DevFsFile ( intrusive_ref_ptr< FilesystemBase fs,
intrusive_ref_ptr< Device dev,
int  flags 
)
inline

Constructor

Parameters
fspointer to DevFs
devthe device to which this file refers
flagsfile open flags (_FREAD, _FWRITE, ...)

Member Function Documentation

int miosix::DevFsFile::fstat ( struct stat *  pstat) const
virtual

Return file information.

Parameters
pstatpointer to stat struct
Returns
0 on success, or a negative number on failure

Implements miosix::FileBase.

int miosix::DevFsFile::ioctl ( int  cmd,
void *  arg 
)
virtual

Perform various operations on a file descriptor

Parameters
cmdspecifies the operation to perform
argoptional argument that some operation require
Returns
the exact return value depends on CMD, -1 is returned on error

Reimplemented from miosix::FileBase.

int miosix::DevFsFile::isatty ( ) const
virtual

Check whether the file refers to a terminal.

Returns
1 if it is a terminal, 0 if it is not, or a negative number in case of errors

Reimplemented from miosix::FileBase.

off_t miosix::DevFsFile::lseek ( off_t  pos,
int  whence 
)
virtual

Move file pointer, if the file supports random-access.

Parameters
posoffset to sum to the beginning of the file, current position or end of file, depending on whence
whenceSEEK_SET, SEEK_CUR or SEEK_END
Returns
the offset from the beginning of the file if the operation completed, or a negative number in case of errors

Implements miosix::FileBase.

ssize_t miosix::DevFsFile::read ( void *  data,
size_t  len 
)
virtual

Read data from the file, if the file supports reading.

Parameters
databuffer to store read data
lenthe number of bytes to read
Returns
the number of read characters, or a negative number in case of errors

Implements miosix::FileBase.

ssize_t miosix::DevFsFile::write ( const void *  data,
size_t  len 
)
virtual

Write data to the file, if the file supports writing.

Parameters
datathe data to write
lenthe number of bytes to write
Returns
the number of written characters, or a negative number in case of errors

Implements miosix::FileBase.


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