RTEMS  5.1
Functions

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_sharedrtems_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]fsis the file system.
[in]handleis the open file handle.
Return values
0Successful operation.
error_codeAn 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]fsis the file system data.
[in]inois the inode number to locate the data for.
Returns
rtems_rfs_file_shared* The shared data or NULL is not located.
Return values
sharedThe shared data.
NULLNo 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]handleis the file handle.
[in]sizeis the amount of data read or written.
[in]readis the I/O was a read if true else it was a write.
Return values
0Successful operation.
error_codeAn 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]handleis the file handle.
Return values
0Successful operation.
error_codeAn 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]handleis the file handle.
[in]availableis the amount of data available for I/O.
[in]readis the I/O operation is a read so the block is read from the media.
Return values
0Successful operation.
error_codeAn 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]fsis the file system.
[in]inois the inode number of the file to be opened.
[out]handlewill be filled in with the handle pointer.
Return values
0Successful operation.
error_codeAn 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]handleThe file handle.
[in]posis the position to seek to.
[out]new_poswill contain the actual position.
Return values
0Successful operation.
error_codeAn 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]handleis the file handle.
[in]sizeis the new size of the file.
Return values
0Successful operation.
error_codeAn error occurred.