summaryrefslogtreecommitdiffstats
path: root/cpukit/libblock/include/rtems/bdbuf.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-02-28 17:19:49 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-03-13 12:24:18 +0100
commit796967c3df40a51a9028bc83d1a4b6dbeae07c3f (patch)
treeedd7251883f74506a69f76e6e9fbf173de195f50 /cpukit/libblock/include/rtems/bdbuf.h
parentlibblock: Documentation (diff)
downloadrtems-796967c3df40a51a9028bc83d1a4b6dbeae07c3f.tar.bz2
libblock: Change bdbuf API
The functions o rtems_bdbuf_get(), o rtems_bdbuf_read(), o rtems_bdbuf_syncdev(), and o rtems_bdbuf_purge_dev(), use now the disk device instead of the device identifier. This makes bdbuf independent of rtems_disk_obtain() and rtems_disk_release(). It is the responsiblity of the file system to obtain the disk device. This also reduces the overhead to get a buffer. The key for the AVL tree uses now the disk device instead of the device identifier. The pointer is interpreted as an unsigned integer. This reduces the memory overhead and makes the comparison operation a bit faster. Removed function rtems_bdbuf_purge_major(). This function was too destructive and could have unpredictable side effects.
Diffstat (limited to 'cpukit/libblock/include/rtems/bdbuf.h')
-rw-r--r--cpukit/libblock/include/rtems/bdbuf.h39
1 files changed, 18 insertions, 21 deletions
diff --git a/cpukit/libblock/include/rtems/bdbuf.h b/cpukit/libblock/include/rtems/bdbuf.h
index 37e06aa9e9..254c745c7a 100644
--- a/cpukit/libblock/include/rtems/bdbuf.h
+++ b/cpukit/libblock/include/rtems/bdbuf.h
@@ -301,7 +301,7 @@ typedef struct rtems_bdbuf_group rtems_bdbuf_group;
* To manage buffers we using buffer descriptors (BD). A BD holds a buffer plus
* a range of other information related to managing the buffer in the cache. To
* speed-up buffer lookup descriptors are organized in AVL-Tree. The fields
- * 'dev' and 'block' are search keys.
+ * 'dd' and 'block' are search keys.
*/
typedef struct rtems_bdbuf_buffer
{
@@ -315,7 +315,7 @@ typedef struct rtems_bdbuf_buffer
signed char bal; /**< The balance of the sub-tree */
} avl;
- dev_t dev; /**< device number */
+ const rtems_disk_device *dd; /**< disk device */
rtems_blkdev_bnum block; /**< block number on the device */
@@ -470,8 +470,7 @@ rtems_bdbuf_init (void);
* The block number is the linear block number. This is relative to the start
* of the partition on the media.
*
- * @param device [in] Device number (constructed of major and minor device
- * number).
+ * @param dd [in] The disk device.
* @param block [in] Linear media block number.
* @param bd [out] Reference to the buffer descriptor pointer.
*
@@ -481,7 +480,11 @@ rtems_bdbuf_init (void);
* @retval RTEMS_INVALID_NUMBER Invalid block size.
*/
rtems_status_code
-rtems_bdbuf_get (dev_t device, rtems_blkdev_bnum block, rtems_bdbuf_buffer** bd);
+rtems_bdbuf_get (
+ const rtems_disk_device *dd,
+ rtems_blkdev_bnum block,
+ rtems_bdbuf_buffer** bd
+);
/**
* Get the block buffer and if not already in the cache read from the disk. If
@@ -498,8 +501,7 @@ rtems_bdbuf_get (dev_t device, rtems_blkdev_bnum block, rtems_bdbuf_buffer** bd)
* buffer is returned. The highest priority waiter will obtain the buffer
* first.
*
- * @param device [in] Device number (constructed of major and minor device
- * number).
+ * @param dd [in] The disk device.
* @param block [in] Linear media block number.
* @param bd [out] Reference to the buffer descriptor pointer.
*
@@ -510,7 +512,11 @@ rtems_bdbuf_get (dev_t device, rtems_blkdev_bnum block, rtems_bdbuf_buffer** bd)
* @retval RTEMS_IO_ERROR IO error.
*/
rtems_status_code
-rtems_bdbuf_read (dev_t device, rtems_blkdev_bnum block, rtems_bdbuf_buffer** bd);
+rtems_bdbuf_read (
+ const rtems_disk_device *dd,
+ rtems_blkdev_bnum block,
+ rtems_bdbuf_buffer** bd
+);
/**
* Release the buffer obtained by a read call back to the cache. If the buffer
@@ -575,31 +581,22 @@ rtems_bdbuf_sync (rtems_bdbuf_buffer* bd);
* @note Nesting calls to sync multiple devices will be handled sequentially. A
* nested call will be blocked until the first sync request has complete.
*
- * @param dev [in] Device number (constructed of major and minor device
- * number).
+ * @param dd [in] The disk device.
*
* @retval RTEMS_SUCCESSFUL Successful operation.
* @retval RTEMS_NOT_CONFIGURED Not initialized.
* @retval RTEMS_INVALID_ID No such device.
*/
rtems_status_code
-rtems_bdbuf_syncdev (dev_t dev);
+rtems_bdbuf_syncdev (const rtems_disk_device *dd);
/**
- * @brief Purges all buffers that matches the device identifier @a dev.
+ * @brief Purges all buffers corresponding to the disk device @a dd.
*
* 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);
+rtems_bdbuf_purge_dev (const rtems_disk_device *dd);
/** @} */