Loading...
Searching...
No Matches
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::Dataspace > | data_space () noexcept=0
| Get an L4Re::Dataspace object for the file.
virtual ssize_t | readv (const struct iovec *, int iovcnt) noexcept=0
| Read one or more blocks of data from the file.
virtual ssize_t | writev (const struct iovec *, int iovcnt) noexcept=0
| Write one or more blocks of data to the file.
virtual off64_t | lseek (off64_t, int) noexcept=0
| Change the file pointer.
virtual int | ftruncate (off64_t pos) noexcept=0
| Truncate the file at the given position.
virtual int | fsync () const noexcept=0
| Sync the data and meta data to persistent storage.
virtual int | fdatasync () const noexcept=0
| Sync the data to persistent storage.
virtual int | get_lock (struct flock64 *lock) noexcept=0
| Test if the given lock can be placed in the file.
virtual int | set_lock (struct flock64 *lock, bool wait) noexcept=0
| Acquire or release the given lock on the file.

## Detailed Description

Interface for a POSIX file that provides regular file semantics.

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

Definition at line 287 of file vfs.h.

## Member Function Documentation

## data_space()

virtual L4::Cap< L4Re::Dataspace > L4Re::Vfs::Regular_file::data_space | ( |  | ) |

pure virtualnoexcept

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

pure virtualnoexcept

Sync the data to persistent storage.

This is the backend for POSIX fdatasync.

Implemented in L4Re::Vfs::Be_file.

References fdatasync().

Referenced by fdatasync().

Here is the call graph for this function:
Here is the caller graph for this function:

## fsync()

virtual int L4Re::Vfs::Regular_file::fsync | ( |  | ) | const

pure virtualnoexcept

Sync the data and meta data to persistent storage.

This is the backend for POSIX fsync.

Implemented in L4Re::Vfs::Be_file.

References fsync().

Referenced by fsync().

Here is the call graph for this function:
Here is the caller graph for this function:

## ftruncate()

virtual int L4Re::Vfs::Regular_file::ftruncate | ( | off64_t | pos | ) |

pure virtualnoexcept

Truncate the file at the given position.

This function is the backend for truncate and friends.

Parameters

  pos | The offset at which the file shall be truncated.

Returns
  0 on success, or <0 on error.

Implemented in L4Re::Vfs::Be_file.

References ftruncate().

Referenced by ftruncate().

Here is the call graph for this function:
Here is the caller graph for this function:

## get_lock()

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

pure virtualnoexcept

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

This function is used as backend for fcntl F_GETLK commands.

Parameters

  lock | The 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.

References get_lock().

Referenced by get_lock().

Here is the call graph for this function:
Here is the caller graph for this function:

## lseek()

virtual off64_t L4Re::Vfs::Regular_file::lseek | ( | off64_t | ,
|  | int | )

pure virtualnoexcept

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.

References lseek().

Referenced by lseek().

Here is the call graph for this function:
Here is the caller graph for this function:

## readv()

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

pure virtualnoexcept

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 from the f_pos pointer of that open file. The file pointer is advanced according to the number of bytes read.

Returns
  The number of bytes read from the file, or <0 on error.

Implemented in L4Re::Vfs::Be_file.

References readv().

Referenced by readv().

Here is the call graph for this function:
Here is the caller graph for this function:

## set_lock()

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

pure virtualnoexcept

Acquire or release the given lock on the file.

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

Parameters

  lock | The lock that shall be placed on the file.
  wait | If 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.

References set_lock().

Referenced by set_lock().

Here is the call graph for this function:
Here is the caller graph for this function:

## writev()

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

pure virtualnoexcept

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.

References writev().

Referenced by writev().

Here is the call graph for this function:
Here is the caller graph for this function:

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

- l4/l4re_vfs/vfs.h