summaryrefslogtreecommitdiffstats
path: root/cpukit/libblock/include/rtems/diskdevs.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-03-26 14:58:35 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-04-12 10:42:43 +0200
commitb467782b5354c5d524f46bac84c5b70a8b4fa1f6 (patch)
tree82e37f50cb88569fad625d5c0f30ae9786fd31c5 /cpukit/libblock/include/rtems/diskdevs.h
parentlibblock: Change error status to fatal error (diff)
downloadrtems-b467782b5354c5d524f46bac84c5b70a8b4fa1f6.tar.bz2
libblock: Add rtems_bdbuf_set_block_size()
The new function rtems_bdbuf_set_block_size() must be used to set the block size of a disk device. It will check if the block size is valid and set the new fields block_to_media_block_shift and bds_per_group of the rtems_disk_device structure. This helps to avoid complex arithmetic operations in the block device buffer get and read path.
Diffstat (limited to 'cpukit/libblock/include/rtems/diskdevs.h')
-rw-r--r--cpukit/libblock/include/rtems/diskdevs.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/cpukit/libblock/include/rtems/diskdevs.h b/cpukit/libblock/include/rtems/diskdevs.h
index 8e59f36af3..8571daaa90 100644
--- a/cpukit/libblock/include/rtems/diskdevs.h
+++ b/cpukit/libblock/include/rtems/diskdevs.h
@@ -109,7 +109,9 @@ struct rtems_disk_device {
/**
* @brief Device block size in bytes.
*
- * This is the minimum transfer unit. It can be any size.
+ * This is the minimum transfer unit. It must be positive.
+ *
+ * @see rtems_bdbuf_set_block_size().
*/
uint32_t block_size;
@@ -121,6 +123,24 @@ struct rtems_disk_device {
uint32_t media_block_size;
/**
+ * @brief Block to media block shift.
+ *
+ * In case this value is non-negative the media block of a block can be
+ * calculated as media block = block << block_to_media_block_shift, otherwise
+ * a 64-bit operation will be used.
+ *
+ * @see rtems_bdbuf_set_block_size().
+ */
+ int block_to_media_block_shift;
+
+ /**
+ * @brief Buffer descriptors per group count.
+ *
+ * @see rtems_bdbuf_set_block_size().
+ */
+ size_t bds_per_group;
+
+ /**
* @brief IO control handler for this disk.
*/
rtems_block_device_ioctl ioctl;
@@ -222,7 +242,7 @@ static inline rtems_blkdev_bnum rtems_disk_get_block_count(
* @retval RTEMS_SUCCESSFUL Successful operation.
* @retval RTEMS_NOT_CONFIGURED Cannot lock disk device operation mutex.
* @retval RTEMS_INVALID_ADDRESS IO control handler is @c NULL.
- * @retval RTEMS_INVALID_NUMBER Block size is zero.
+ * @retval RTEMS_INVALID_NUMBER Block size is invalid.
* @retval RTEMS_NO_MEMORY Not enough memory.
* @retval RTEMS_RESOURCE_IN_USE Disk device descriptor is already in use.
* @retval RTEMS_UNSATISFIED Cannot create device node.