L4Re - L4 Runtime Environment
L4Re::Vfs::Regular_file Class Referenceabstract

Interface for a POSIX file that provides regular file semantics. More...

#include <vfs.h>

+ Inheritance diagram for L4Re::Vfs::Regular_file:
+ Collaboration diagram for L4Re::Vfs::Regular_file:

Public Member Functions

virtual L4::Cap< L4Re::Dataspacedata_space () const =0 throw ()
 Get an L4Re::Dataspace object for the file. More...
 
virtual ssize_t readv (const struct iovec *, int iovcnt)=0 throw ()
 Read one or more blocks of data from the file. More...
 
virtual ssize_t writev (const struct iovec *, int iovcnt)=0 throw ()
 Write one or more blocks of data to the file. More...
 
virtual off64_t lseek64 (off64_t, int)=0 throw ()
 Change the file pointer. More...
 
virtual int ftruncate64 (off64_t pos)=0 throw ()
 Truncate the file at the given position. More...
 
virtual int fsync () const =0 throw ()
 Sync the data and meta data to persistent storage. More...
 
virtual int fdatasync () const =0 throw ()
 Sync the data to persistent storage. More...
 
virtual int get_lock (struct flock64 *lock)=0 throw ()
 Test if the given lock can be placed in the file. More...
 
virtual int set_lock (struct flock64 *lock, bool wait)=0 throw ()
 Acquire or release the given lock on the file. More...
 

Detailed Description

Interface for a POSIX file that provides regular file semantics.

Real objects use always the combined L4Re::Vfs::File interface.

Definition at line 266 of file vfs.h.

Member Function Documentation

◆ data_space()

virtual L4::Cap<L4Re::Dataspace> L4Re::Vfs::Regular_file::data_space ( ) const
throw (
)
pure virtual

Get an L4Re::Dataspace object for the file.

This is used as a backend for POSIX mmap and mmap2 functions.

Note
mmap is not possible if the function returns an invalid capability.
Returns
A capability to an L4Re::Dataspace, that represents the file contents in an L4Re way.

Implemented in L4Re::Vfs::Be_file.

◆ fdatasync()

virtual int L4Re::Vfs::Regular_file::fdatasync ( ) const
throw (
)
pure virtual

Sync the data to persistent storage.

This is the backend for POSIX fdatasync.

Implemented in L4Re::Vfs::Be_file.

◆ fsync()

virtual int L4Re::Vfs::Regular_file::fsync ( ) const
throw (
)
pure virtual

Sync the data and meta data to persistent storage.

This is the backend for POSIX fsync.

Implemented in L4Re::Vfs::Be_file.

◆ ftruncate64()

virtual int L4Re::Vfs::Regular_file::ftruncate64 ( off64_t  pos)
throw (
)
pure virtual

Truncate the file at the given position.

This function is the backend for truncate and friends.

Parameters
posThe offset at which the file shall be truncated.
Returns
0 on success, or <0 on error.

Implemented in L4Re::Vfs::Be_file.

◆ get_lock()

virtual int L4Re::Vfs::Regular_file::get_lock ( struct flock64 *  lock)
throw (
)
pure virtual

Test if the given lock can be placed in the file.

This function is used as backend for fcntl F_GETLK commands.

Parameters
lockThe lock that shall be placed on the file. The l_type member will contain F_UNLCK if the lock could be placed.
Returns
0 on success, <0 on error.

Implemented in L4Re::Vfs::Be_file.

◆ lseek64()

virtual off64_t L4Re::Vfs::Regular_file::lseek64 ( off64_t  ,
int   
)
throw (
)
pure virtual

Change the file pointer.

This is the backend for POSIX seek, lseek and friends.

Returns
The new file position, or <0 on error.

Implemented in L4Re::Vfs::Be_file.

◆ readv()

virtual ssize_t L4Re::Vfs::Regular_file::readv ( const struct iovec *  ,
int  iovcnt 
)
throw (
)
pure virtual

Read one or more blocks of data from the file.

This function acts as backend for POSIX read and readv calls and reads data starting for the f_pos pointer of that open file. The file pointer is advanced according to the number of red bytes.

Returns
The number of bytes red from the file. or <0 on error-

Implemented in L4Re::Vfs::Be_file.

◆ set_lock()

virtual int L4Re::Vfs::Regular_file::set_lock ( struct flock64 *  lock,
bool  wait 
)
throw (
)
pure virtual

Acquire or release the given lock on the file.

This function is used as backend for fcntl F_SETLK and F_SETLKW commands.

Parameters
lockThe lock that shall be placed on the file.
waitIf true, then block if there is a conflicting lock on the file.
Returns
0 on success, <0 on error.

Implemented in L4Re::Vfs::Be_file.

◆ writev()

virtual ssize_t L4Re::Vfs::Regular_file::writev ( const struct iovec *  ,
int  iovcnt 
)
throw (
)
pure virtual

Write one or more blocks of data to the file.

This function acts as backend for POSIX write and writev calls. The data is written starting at the current file pointer and the file pointer must be advanced according to the number of written bytes.

Returns
The number of bytes written to the file, or <0 on error.

Implemented in L4Re::Vfs::Be_file.


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