From e7fb54eb0593f80966502ca9b3cc2159e5e4a863 Mon Sep 17 00:00:00 2001 From: Thomas Doerfler Date: Tue, 26 Jan 2010 15:09:03 +0000 Subject: add purge capability to libblock, add proper test case --- cpukit/libblock/include/rtems/bdbuf.h | 67 ++++++++++++++++++++++++++++------- 1 file changed, 55 insertions(+), 12 deletions(-) (limited to 'cpukit/libblock/include/rtems/bdbuf.h') diff --git a/cpukit/libblock/include/rtems/bdbuf.h b/cpukit/libblock/include/rtems/bdbuf.h index f4e87568da..66a9bbf59b 100644 --- a/cpukit/libblock/include/rtems/bdbuf.h +++ b/cpukit/libblock/include/rtems/bdbuf.h @@ -86,7 +86,9 @@ extern "C" { * ac [label="ACCESS CACHED",style="filled",fillcolor="royalblue"]; * am [label="ACCESS MODIFIED",style="filled",fillcolor="royalblue"]; * ae [label="ACCESS EMPTY",style="filled",fillcolor="royalblue"]; + * ap [label="ACCESS PURGED",style="filled",fillcolor="royalblue"]; * t [label="TRANSFER",style="filled",fillcolor="red"]; + * tp [label="TRANSFER PURGED",style="filled",fillcolor="red"]; * s [label="SYNC",style="filled",fillcolor="red"]; * m [label="MODIFIED",style="filled",fillcolor="gold"]; * i [label="INITIAL"]; @@ -97,26 +99,33 @@ extern "C" { * i -> f [label="Init"]; * f -> e [label="Buffer Recycle"]; * e -> ae [label="Get"]; - * e -> t [label="Read\nRead Ahead"]; - * c -> f [label="Reallocate\nBlock Size Changed"]; + * e -> t [label="Read"]; + * e -> f [label="Nobody Waits"]; * c -> ac [label="Get\nRead"]; - * c -> e [label="Buffer Recycle"]; + * c -> e [label="Buffer Recycle\nPurge"]; + * c -> f [label="Reallocate\nBlock Size Changed"]; * t -> c [label="Transfer Done",color="red",fontcolor="red"]; - * t -> e [label="Transfer Error With Waiter",color="red",fontcolor="red"]; - * t -> f [label="Transfer Error Without Waiter",color="red",fontcolor="red"]; + * t -> e [label="Transfer Error",color="red",fontcolor="red"]; + * t -> tp [label="Purge"]; + * tp -> e [label="Transfer Done\nTransfer Error",color="red",fontcolor="red"]; * m -> t [label="Swapout"]; * m -> s [label="Block Size Changed"]; * m -> am [label="Get\nRead"]; + * m -> e [label="Purge"]; * ac -> m [label="Release Modified",color="royalblue",fontcolor="royalblue"]; * ac -> s [label="Sync",color="royalblue",fontcolor="royalblue"]; * ac -> c [label="Release",color="royalblue",fontcolor="royalblue"]; + * ac -> ap [label="Purge"]; * am -> m [label="Release\nRelease Modified",color="royalblue",fontcolor="royalblue"]; * am -> s [label="Sync",color="royalblue",fontcolor="royalblue"]; + * am -> ap [label="Purge"]; * ae -> m [label="Release Modified",color="royalblue",fontcolor="royalblue"]; * ae -> s [label="Sync",color="royalblue",fontcolor="royalblue"]; - * ae -> e [label="Release With Waiter",color="royalblue",fontcolor="royalblue"]; - * ae -> f [label="Release Without Waiter",color="royalblue",fontcolor="royalblue"]; + * ae -> e [label="Release",color="royalblue",fontcolor="royalblue"]; + * ae -> ap [label="Purge"]; + * ap -> e [label="Release\nRelease Modified\nSync",color="royalblue",fontcolor="royalblue"]; * s -> t [label="Swapout"]; + * s -> e [label="Purge",color="red",fontcolor="red"]; * } * @enddot * @@ -184,22 +193,26 @@ extern "C" { * * * EMPTYX - * X + * * * * CACHEDXX * X * * - * ACCESS_CACHEDXX + * ACCESS CACHEDXX + * XX + * + * + * ACCESS MODIFIEDXX * XX * * - * ACCESS_MODIFIEDXX + * ACCESS EMPTYX * XX * * - * ACCESS_EMPTYX + * ACCESS PURGEDX * XX * * @@ -214,6 +227,10 @@ extern "C" { * TRANSFERXX * XX * + * + * TRANSFER PURGEDX + * XX + * * */ typedef enum @@ -248,6 +265,11 @@ typedef enum */ RTEMS_BDBUF_STATE_ACCESS_EMPTY, + /** + * @brief Accessed by upper layer with purged data. + */ + RTEMS_BDBUF_STATE_ACCESS_PURGED, + /** * @brief Modified by upper layer. */ @@ -261,7 +283,12 @@ typedef enum /** * @brief In transfer by block device driver. */ - RTEMS_BDBUF_STATE_TRANSFER + RTEMS_BDBUF_STATE_TRANSFER, + + /** + * @brief In transfer by block device driver and purged. + */ + RTEMS_BDBUF_STATE_TRANSFER_PURGED } rtems_bdbuf_buf_state; /** @@ -542,6 +569,22 @@ rtems_bdbuf_sync (rtems_bdbuf_buffer* bd); rtems_status_code rtems_bdbuf_syncdev (dev_t dev); +/** + * @brief Purges all buffers that matches the device identifier @a dev. + * + * This may result in loss of data. + */ +void +rtems_bdbuf_purge_dev (dev_t dev); + +/** + * @brief Purges all buffers that matches the device major number @a major. + * + * This may result in loss of data. + */ +void +rtems_bdbuf_purge_major (rtems_device_major_number major); + /** @} */ #ifdef __cplusplus -- cgit v1.2.3