RTEMS
5.1
|
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) |
RTEMS File Systems File Routines.
These functions manage files.
int rtems_rfs_file_close | ( | rtems_rfs_file_system * | fs, |
rtems_rfs_file_handle * | handle | ||
) |
Close an open file handle.
[in] | fs | is the file system. |
[in] | handle | is the open file handle. |
0 | Successful operation. |
error_code | An error occurred. |
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.
[in] | fs | is the file system data. |
[in] | ino | is the inode number to locate the data for. |
shared | The shared data. |
NULL | No shared file data is located. |
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.
[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. |
0 | Successful operation. |
error_code | An error occurred. |
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.
[in] | handle | is the file handle. |
0 | Successful operation. |
error_code | An error occurred. |
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.
[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. |
0 | Successful operation. |
error_code | An error occurred. |
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.
[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. |
0 | Successful operation. |
error_code | An error occurred. |
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.
[in] | handle | The file handle. |
[in] | pos | is the position to seek to. |
[out] | new_pos | will contain the actual position. |
0 | Successful operation. |
error_code | An error occurred. |
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.
[in] | handle | is the file handle. |
[in] | size | is the new size of the file. |
0 | Successful operation. |
error_code | An error occurred. |