diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-03-26 14:58:35 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-04-12 10:42:43 +0200 |
commit | b467782b5354c5d524f46bac84c5b70a8b4fa1f6 (patch) | |
tree | 82e37f50cb88569fad625d5c0f30ae9786fd31c5 /cpukit/libblock/include/rtems/bdbuf.h | |
parent | libblock: Change error status to fatal error (diff) | |
download | rtems-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/bdbuf.h')
-rw-r--r-- | cpukit/libblock/include/rtems/bdbuf.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/cpukit/libblock/include/rtems/bdbuf.h b/cpukit/libblock/include/rtems/bdbuf.h index 8e672bbf73..134a0ceff5 100644 --- a/cpukit/libblock/include/rtems/bdbuf.h +++ b/cpukit/libblock/include/rtems/bdbuf.h @@ -479,7 +479,7 @@ rtems_bdbuf_init (void); * @param bd [out] Reference to the buffer descriptor pointer. * * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_NUMBER Invalid block size. + * @retval RTEMS_INVALID_ID Invalid block number. */ rtems_status_code rtems_bdbuf_get ( @@ -512,7 +512,7 @@ rtems_bdbuf_get ( * @param bd [out] Reference to the buffer descriptor pointer. * * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_NUMBER Invalid block size. + * @retval RTEMS_INVALID_ID Invalid block number. * @retval RTEMS_IO_ERROR IO error. */ rtems_status_code @@ -625,6 +625,25 @@ rtems_bdbuf_syncdev (const rtems_disk_device *dd); void rtems_bdbuf_purge_dev (const rtems_disk_device *dd); +/** + * @brief Sets the block size of a disk device. + * + * This will also change the block_to_media_block_shift and bds_per_group + * fields of the disk device. + * + * Before you can use this function, the rtems_bdbuf_init() routine must be + * called at least once to initialize the cache, otherwise a fatal error will + * occur. + * + * @param dd [in, out] The disk device. + * @param dd [in] The new block size. + * + * @retval RTEMS_SUCCESSFUL Successful operation. + * @retval RTEMS_INVALID_NUMBER Invalid block size. + */ +rtems_status_code +rtems_bdbuf_set_block_size (rtems_disk_device *dd, uint32_t block_size); + /** @} */ #ifdef __cplusplus |