RTEMS 6.3
Loading...
Searching...
No Matches
#include <limits.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <pthread.h>
#include <rtems.h>
#include <rtems/thread.h>
#include <rtems/score/assert.h>
#include "rtems/bdbuf.h"

Data Structures

struct  rtems_bdbuf_swapout_transfer
struct  rtems_bdbuf_swapout_worker
struct  rtems_bdbuf_waiters
struct  rtems_bdbuf_cache

Macros

#define RTEMS_BDBUF_TRACE   0
#define BDBUF_INVALID_DEV   NULL
#define bdbuf_config   rtems_bdbuf_configuration
#define RTEMS_BDBUF_SWAPOUT_SYNC   RTEMS_EVENT_2
#define RTEMS_BDBUF_READ_AHEAD_WAKE_UP   RTEMS_EVENT_1
#define rtems_bdbuf_tracer   (0)
#define rtems_bdbuf_show_usage()
#define rtems_bdbuf_show_users(_w, _b)
#define RTEMS_BDBUF_AVL_MAX_HEIGHT   (32)
#define bdbuf_alloc(size)

Typedefs

typedef struct rtems_bdbuf_swapout_transfer rtems_bdbuf_swapout_transfer
typedef struct rtems_bdbuf_swapout_worker rtems_bdbuf_swapout_worker
typedef struct rtems_bdbuf_waiters rtems_bdbuf_waiters
typedef struct rtems_bdbuf_cache rtems_bdbuf_cache

Enumerations

enum  rtems_bdbuf_fatal_code {
  RTEMS_BDBUF_FATAL_CACHE_WAIT_2 , RTEMS_BDBUF_FATAL_CACHE_WAIT_TO , RTEMS_BDBUF_FATAL_CACHE_WAKE , RTEMS_BDBUF_FATAL_PREEMPT_DIS ,
  RTEMS_BDBUF_FATAL_PREEMPT_RST , RTEMS_BDBUF_FATAL_RA_WAKE_UP , RTEMS_BDBUF_FATAL_RECYCLE , RTEMS_BDBUF_FATAL_SO_WAKE_1 ,
  RTEMS_BDBUF_FATAL_SO_WAKE_2 , RTEMS_BDBUF_FATAL_STATE_0 , RTEMS_BDBUF_FATAL_STATE_2 , RTEMS_BDBUF_FATAL_STATE_4 ,
  RTEMS_BDBUF_FATAL_STATE_5 , RTEMS_BDBUF_FATAL_STATE_6 , RTEMS_BDBUF_FATAL_STATE_7 , RTEMS_BDBUF_FATAL_STATE_8 ,
  RTEMS_BDBUF_FATAL_STATE_9 , RTEMS_BDBUF_FATAL_STATE_10 , RTEMS_BDBUF_FATAL_STATE_11 , RTEMS_BDBUF_FATAL_SWAPOUT_RE ,
  RTEMS_BDBUF_FATAL_TREE_RM , RTEMS_BDBUF_FATAL_WAIT_EVNT , RTEMS_BDBUF_FATAL_WAIT_TRANS_EVNT
}

Functions

rtems_status_code rtems_bdbuf_init (void)
rtems_status_code rtems_bdbuf_get (rtems_disk_device *dd, rtems_blkdev_bnum block, rtems_bdbuf_buffer **bd_ptr)
rtems_status_code rtems_bdbuf_read (rtems_disk_device *dd, rtems_blkdev_bnum block, rtems_bdbuf_buffer **bd_ptr)
void rtems_bdbuf_peek (rtems_disk_device *dd, rtems_blkdev_bnum block, uint32_t nr_blocks)
 Give a hint which blocks should be cached next.
rtems_status_code rtems_bdbuf_release (rtems_bdbuf_buffer *bd)
rtems_status_code rtems_bdbuf_release_modified (rtems_bdbuf_buffer *bd)
rtems_status_code rtems_bdbuf_sync (rtems_bdbuf_buffer *bd)
rtems_status_code rtems_bdbuf_syncdev (rtems_disk_device *dd)
void rtems_bdbuf_purge_dev (rtems_disk_device *dd)
 Purges all buffers corresponding to the disk device dd.
rtems_status_code rtems_bdbuf_set_block_size (rtems_disk_device *dd, uint32_t block_size, bool sync)
 Sets the block size of a disk device.
void rtems_bdbuf_get_device_stats (const rtems_disk_device *dd, rtems_blkdev_stats *stats)
 Returns the block device statistics.
void rtems_bdbuf_reset_device_stats (rtems_disk_device *dd)
 Resets the block device statistics.

Detailed Description

Block device buffer management.

Macro Definition Documentation

◆ bdbuf_alloc

#define bdbuf_alloc ( size)
Value:
__builtin_alloca (size)

◆ RTEMS_BDBUF_AVL_MAX_HEIGHT

#define RTEMS_BDBUF_AVL_MAX_HEIGHT   (32)

The default maximum height of 32 allows for AVL trees having between 5,704,880 and 4,294,967,295 nodes, depending on order of insertion. You may change this compile-time constant as you wish.

◆ rtems_bdbuf_show_usage

#define rtems_bdbuf_show_usage ( )
Value:
((void) 0)

◆ rtems_bdbuf_show_users

#define rtems_bdbuf_show_users ( _w,
_b )
Value:
((void) 0)

◆ RTEMS_BDBUF_SWAPOUT_SYNC

#define RTEMS_BDBUF_SWAPOUT_SYNC   RTEMS_EVENT_2

The events used in this code. These should be system events rather than application events.

◆ RTEMS_BDBUF_TRACE

#define RTEMS_BDBUF_TRACE   0

Set to 1 to enable debug tracing.

Typedef Documentation

◆ rtems_bdbuf_cache

typedef struct rtems_bdbuf_cache rtems_bdbuf_cache

The BD buffer cache.

◆ rtems_bdbuf_swapout_transfer

typedef struct rtems_bdbuf_swapout_transfer rtems_bdbuf_swapout_transfer

A swapout transfer transaction data. This data is passed to a worked thread to handle the write phase of the transfer.

◆ rtems_bdbuf_swapout_worker

typedef struct rtems_bdbuf_swapout_worker rtems_bdbuf_swapout_worker

Swapout worker thread. These are available to take processing from the main swapout thread and handle the I/O operation.

◆ rtems_bdbuf_waiters

typedef struct rtems_bdbuf_waiters rtems_bdbuf_waiters

Buffer waiters synchronization.