RTEMS: cpukit/libfs/src/rfs/rtems-rfs-file.c File Reference

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Functions
rtems-rfs-file.c File Reference
IO Library » File System Types and Mount » RTEMS File System Group Management

RTEMS File Systems File Routines. More...

`#include <inttypes.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <rtems/rfs/rtems-rfs-block-pos.h>`
`#include <rtems/rfs/rtems-rfs-file.h>`
`#include <rtems/rfs/rtems-rfs-file-system.h>`
`#include <rtems/rfs/rtems-rfs-trace.h>`

## Functions
int | rtems_rfs_file_open (rtems_rfs_file_system *fs, rtems_rfs_ino ino, int oflag, rtems_rfs_file_handle **file)
int | rtems_rfs_file_close (rtems_rfs_file_system *fs, rtems_rfs_file_handle *handle)
int | rtems_rfs_file_io_start (rtems_rfs_file_handle *handle, size_t *available, bool read)
int | rtems_rfs_file_io_end (rtems_rfs_file_handle *handle, size_t size, bool read)
int | rtems_rfs_file_io_release (rtems_rfs_file_handle *handle)
int | rtems_rfs_file_seek (rtems_rfs_file_handle *handle, rtems_rfs_pos pos, rtems_rfs_pos *new_pos)
int | rtems_rfs_file_set_size (rtems_rfs_file_handle *handle, rtems_rfs_pos new_size)
rtems_rfs_file_shared * | rtems_rfs_file_get_shared (rtems_rfs_file_system *fs, rtems_rfs_ino ino)

## Detailed Description

RTEMS File Systems File Routines.

These functions manage files.

## Function Documentation

## ◆ rtems_rfs_file_close()

int rtems_rfs_file_close | ( | rtems_rfs_file_system * | fs,
|  | rtems_rfs_file_handle * | handle
| ) |  |

Close an open file handle.

Parameters

  [in] | fs | is the file system.
  [in] | handle | is the open file handle.

Return values

  0 | Successful operation.
  error_code | An error occurred.

## ◆ rtems_rfs_file_get_shared()

rtems_rfs_file_shared * rtems_rfs_file_get_shared | ( | rtems_rfs_file_system * | fs,
|  | rtems_rfs_ino | ino
| ) |  |

Return the shared file data for an ino.

Parameters

  [in] | fs | is the file system data.
  [in] | ino | is the inode number to locate the data for.

Returns
  rtems_rfs_file_shared* The shared data or NULL is not located.

Return values

  shared | The shared data.
  NULL | No shared file data is located.

## ◆ rtems_rfs_file_io_end()

int rtems_rfs_file_io_end | ( | rtems_rfs_file_handle * | handle,
|  | size_t | size,
|  | bool | read
| ) |  |

End the I/O. Any buffers held in the file handle and returned to the cache. If inode updating is not disable and the I/O is a read the atime field is updated and if a write I/O the mtime is updated.

If the file's position is updated by the size amount.

Parameters

  [in] | handle | is the file handle.
  [in] | size | is the amount of data read or written.
  [in] | read | is the I/O was a read if true else it was a write.

Return values

  0 | Successful operation.
  error_code | An error occurred.

## ◆ rtems_rfs_file_io_release()

int rtems_rfs_file_io_release | ( | rtems_rfs_file_handle * | handle | ) |

Release the I/O resources without any changes. If data has changed in the buffer and the buffer was not already released as modified the data will be lost.

Parameters

  [in] | handle | is the file handle.

Return values

  0 | Successful operation.
  error_code | An error occurred.

## ◆ rtems_rfs_file_io_start()

int rtems_rfs_file_io_start | ( | rtems_rfs_file_handle * | handle,
|  | size_t * | available,
|  | bool | read
| ) |  |

Start I/O on a block of a file. This call only requests the block from the media if reading and makes the buffer available to you the via the rtems_rfs_file_data interface after the call. The available amount data is taken from the current file position until the end of the block. The file position is not adujsted until the I/O ends. An I/O request cannot perform I/O past the end of a block so the call returns the amount of data available.

Parameters

  [in] | handle | is the file handle.
  [in] | available | is the amount of data available for I/O.
  [in] | read | is the I/O operation is a read so the block is read from the media.

Return values

  0 | Successful operation.
  error_code | An error occurred.

## ◆ rtems_rfs_file_open()

int rtems_rfs_file_open | ( | rtems_rfs_file_system * | fs,
|  | rtems_rfs_ino | ino,
|  | int | oflag,
|  | rtems_rfs_file_handle ** | handle
| ) |  |

Open a file handle.

Parameters

  [in] | fs | is the file system.
  [in] | ino | is the inode number of the file to be opened.
  [out] | handle | will be filled in with the handle pointer.

Return values

  0 | Successful operation.
  error_code | An error occurred.

## ◆ rtems_rfs_file_seek()

int rtems_rfs_file_seek | ( | rtems_rfs_file_handle * | handle,
|  | rtems_rfs_pos | pos,
|  | rtems_rfs_pos * | new_pos
| ) |  |

The file to the position returning the old position. The position is abolute.

Parameters

  [in] | handle | The file handle.
  [in] | pos | is the position to seek to.
  [out] | new_pos | will contain the actual position.

Return values

  0 | Successful operation.
  error_code | An error occurred.

## ◆ rtems_rfs_file_set_size()

int rtems_rfs_file_set_size | ( | rtems_rfs_file_handle * | handle,
|  | rtems_rfs_pos | size
| ) |  |

Set the size of the file to the new size. This can extend the file to a new size.

Parameters

  [in] | handle | is the file handle.
  [in] | size | is the new size of the file.

Return values

  0 | Successful operation.
  error_code | An error occurred.