RTEMS  5.1
Data Structures | Macros | Typedefs | Functions

Maps Blocks to the Media Interface Layers. More...

#include <errno.h>
#include <rtems/rfs/rtems-rfs-file-system-fwd.h>
#include <rtems/rfs/rtems-rfs-trace.h>

Go to the source code of this file.

Data Structures

struct  _rtems_rfs_buffer
 
struct  rtems_rfs_buffer_handle_t
 

Macros

#define rtems_rfs_buffer_io_request   rtems_rfs_buffer_deviceio_request
 
#define rtems_rfs_buffer_io_release   rtems_rfs_buffer_deviceio_release
 
#define rtems_rfs_buffer_link(_h)   (&(_h)->buffer->link)
 
#define rtems_rfs_buffer_data(_h)   ((void*)((_h)->buffer->buffer))
 
#define rtems_rfs_buffer_size(_h)   ((_h)->buffer->size)
 
#define rtems_rfs_buffer_bnum(_h)   ((_h)->bnum)
 
#define rtems_rfs_buffer_dirty(_h)   ((_h)->dirty)
 
#define rtems_rfs_buffer_handle_has_block(_h)   ((_h)->buffer ? true : false)
 
#define rtems_rfs_buffer_mark_dirty(_h)   ((_h)->dirty = true)
 
#define rtems_rfs_buffer_refs(_h)   ((_h)->buffer->references)
 
#define rtems_rfs_buffer_refs_up(_h)   ((_h)->buffer->references += 1)
 
#define rtems_rfs_buffer_refs_down(_h)   ((_h)->buffer->references -= 1)
 

Typedefs

typedef uint32_t rtems_rfs_buffer_block
 
typedef struct _rtems_rfs_buffer rtems_rfs_buffer
 
typedef struct rtems_rfs_buffer_handle_t rtems_rfs_buffer_handle
 

Functions

int rtems_rfs_buffer_deviceio_request (rtems_rfs_file_system *fs, rtems_rfs_buffer_block block, bool read, rtems_rfs_buffer *buffer)
 
int rtems_rfs_buffer_deviceio_release (rtems_rfs_buffer *handle, bool modified)
 
int rtems_rfs_buffer_handle_request (rtems_rfs_file_system *fs, rtems_rfs_buffer_handle *handle, rtems_rfs_buffer_block block, bool read)
 
int rtems_rfs_buffer_handle_release (rtems_rfs_file_system *fs, rtems_rfs_buffer_handle *handle)
 
int rtems_rfs_buffer_open (const char *name, rtems_rfs_file_system *fs)
 
int rtems_rfs_buffer_close (rtems_rfs_file_system *fs)
 
int rtems_rfs_buffer_sync (rtems_rfs_file_system *fs)
 
int rtems_rfs_buffer_setblksize (rtems_rfs_file_system *fs, uint32_t size)
 
int rtems_rfs_buffers_release (rtems_rfs_file_system *fs)
 

Detailed Description

Maps Blocks to the Media Interface Layers.

These functions map blocks to the media interface layers.

Macro Definition Documentation

◆ rtems_rfs_buffer_bnum

#define rtems_rfs_buffer_bnum (   _h)    ((_h)->bnum)

Return the block number.

◆ rtems_rfs_buffer_data

#define rtems_rfs_buffer_data (   _h)    ((void*)((_h)->buffer->buffer))

Return the start of the data area of the buffer given a handle.

◆ rtems_rfs_buffer_dirty

#define rtems_rfs_buffer_dirty (   _h)    ((_h)->dirty)

Return the buffer dirty status.

◆ rtems_rfs_buffer_handle_has_block

#define rtems_rfs_buffer_handle_has_block (   _h)    ((_h)->buffer ? true : false)

Does the handle have a valid block attached ?

◆ rtems_rfs_buffer_link

#define rtems_rfs_buffer_link (   _h)    (&(_h)->buffer->link)

The buffer linkage.

◆ rtems_rfs_buffer_mark_dirty

#define rtems_rfs_buffer_mark_dirty (   _h)    ((_h)->dirty = true)

Mark the buffer as dirty.

◆ rtems_rfs_buffer_refs

#define rtems_rfs_buffer_refs (   _h)    ((_h)->buffer->references)

Return the reference count.

◆ rtems_rfs_buffer_refs_down

#define rtems_rfs_buffer_refs_down (   _h)    ((_h)->buffer->references -= 1)

Decrement the reference count.

◆ rtems_rfs_buffer_refs_up

#define rtems_rfs_buffer_refs_up (   _h)    ((_h)->buffer->references += 1)

Increment the reference count.

◆ rtems_rfs_buffer_size

#define rtems_rfs_buffer_size (   _h)    ((_h)->buffer->size)

Return the size of the buffer given a handle.

Typedef Documentation

◆ rtems_rfs_buffer_block

typedef uint32_t rtems_rfs_buffer_block

Define the method used to interface to the buffers. It can be libblock or device I/O. The libblock interface is to the RTEMS cache and block devices and device I/O accesses the media via a device file handle.The RTEMS RFS I/O Layering.

◆ rtems_rfs_buffer_handle

RFS Buffer handle.

Function Documentation

◆ rtems_rfs_buffer_close()

int rtems_rfs_buffer_close ( rtems_rfs_file_system fs)

Close the buffer interface.

Parameters
[in]fsis the file system data.
Return values
0Successful operation.
error_codeAn error occurred.

◆ rtems_rfs_buffer_deviceio_release()

int rtems_rfs_buffer_deviceio_release ( rtems_rfs_buffer handle,
bool  modified 
)

Release a buffer to the RTEMS libblock BD buffer cache.

◆ rtems_rfs_buffer_deviceio_request()

int rtems_rfs_buffer_deviceio_request ( rtems_rfs_file_system fs,
rtems_rfs_buffer_block  block,
bool  read,
rtems_rfs_buffer buffer 
)

Request a buffer from the device I/O.

◆ rtems_rfs_buffer_handle_release()

int rtems_rfs_buffer_handle_release ( rtems_rfs_file_system fs,
rtems_rfs_buffer_handle handle 
)

Release a buffer. If the buffer is dirty the buffer is written to disk. The result does not indicate if the data was successfully written to the disk as this operation may be performed in asynchronously to this release.

Parameters
[in]fsis the file system data.
[in]handleis the handle the requested buffer is attached to.
Return values
0Successful operation.
error_codeAn error occurred.

◆ rtems_rfs_buffer_handle_request()

int rtems_rfs_buffer_handle_request ( rtems_rfs_file_system fs,
rtems_rfs_buffer_handle handle,
rtems_rfs_buffer_block  block,
bool  read 
)

Request a buffer. The buffer can be filled with data from the media (read == true) or you can request a buffer to fill with data.

Parameters
[in]fsis the file system data.
[in]handleis the handle the requested buffer is attached to.
[in]blockis the block number.
[in]readRead the data from the disk.
Return values
0Successful operation.
error_codeAn error occurred.

◆ rtems_rfs_buffer_open()

int rtems_rfs_buffer_open ( const char *  name,
rtems_rfs_file_system fs 
)

Open the buffer interface.

Parameters
[in]nameis a pointer to the device name to the media.
[in]fsis the file system data.
Return values
0Successful operation.
error_codeAn error occurred.

◆ rtems_rfs_buffer_setblksize()

int rtems_rfs_buffer_setblksize ( rtems_rfs_file_system fs,
uint32_t  size 
)

Set the block size of the device.

Parameters
[in]fsis the file system data.
[in]sizeis the new block size.
Return values
0Successful operation.
error_codeAn error occurred.

◆ rtems_rfs_buffer_sync()

int rtems_rfs_buffer_sync ( rtems_rfs_file_system fs)

Sync all buffers to the media.

Parameters
[in]fsis the file system data.
Return values
0Successful operation.
error_codeAn error occurred.

◆ rtems_rfs_buffers_release()

int rtems_rfs_buffers_release ( rtems_rfs_file_system fs)

Release any chained buffers.

Parameters
[in]fsis the file system data.
Return values
0Successful operation.
error_codeAn error occurred.