Discuss the replacement strategy interface in bdbuf

Xiang Cui medivhc at gmail.com
Fri Jul 20 08:20:02 UTC 2012


Hi

The basic idea about the interface is to change the current LRU list
to FREE list which only contains buffer in FREE state. So transform to
CACHED state could be "enqueue" and transform from CACHED state could
be "dequeue".


/**
 * @brief Init replace policy
 * @retval RTEMS_SUCCESSFUL Successful operation.
 */
rtems_status_code
rtems_bdbuf_init_policy(void);

/**
* @brief Gets the victim buffer candidate.
* Briefly this call works like iterator for buffer in CACHED.
*
* @param pre  From where to select. Use NULL to start.
*
* @return The less suitable victim buffer candidate. The state of the buffer
*  must be CACHED. Return NULL if no less suitable buffer.
*/
rtems_bdbuf_buffer* rtems_bdbuf_victim_next(rtems_bdbuf_buffer *pre);

/**
* @brief Add the buffer to the queue.
* The next state of the buffer is CACHED.
*
* The state of the buffer could be TRANSFER or ACCESS_CACHED.
* TRANSER and ACCESS_CACHED are the previous state of the buffer.
*
*/
void rtems_bdbuf_enqueue(rtems_bdbuf_buffer *bd);

/**
* @brief Remove the buffer from the queue.
* The previous state of the buffer is CACHED.
*
* The state of the buffer coulde be EMPTY CACHED or ACCESS_CACHED.
* EMPTY and ACCESS_CACHED are the next state of the buffer.
* EMPTY means the buffer is recycled.
* CACHED means the buffer is purgred. The next state of the buffer is EMPTY.
* ACCESS_CACHED means the is called by get or read.
*/
void rtems_bdbuf_dequeue(rtems_bdbuf_buffer *bd);



More information about the devel mailing list