summaryrefslogtreecommitdiffstats
path: root/cpukit/libblock/include
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-05-30 13:40:34 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-05-31 11:05:48 +0200
commit73c09b3b8efc52831e80295e010fd7bfbd8c4b0c (patch)
treef4232b1f6ba94d5b0666177c8a00a2ff5c87a0f5 /cpukit/libblock/include
parentlibblock: Remove explicit bds_per_group parameter (diff)
downloadrtems-73c09b3b8efc52831e80295e010fd7bfbd8c4b0c.tar.bz2
libblock: Simplify disk management
Add block_count and media_blocks_per_block to rtems_disk_device. Add and use rtems_disk_init_phys() and rtems_disk_init_log().
Diffstat (limited to 'cpukit/libblock/include')
-rw-r--r--cpukit/libblock/include/rtems/bdbuf.h11
-rw-r--r--cpukit/libblock/include/rtems/diskdevs.h54
2 files changed, 48 insertions, 17 deletions
diff --git a/cpukit/libblock/include/rtems/bdbuf.h b/cpukit/libblock/include/rtems/bdbuf.h
index c065f4ec55..43a95dfe99 100644
--- a/cpukit/libblock/include/rtems/bdbuf.h
+++ b/cpukit/libblock/include/rtems/bdbuf.h
@@ -141,7 +141,7 @@ extern "C" {
* A block being accessed is given to the file system layer and not accessible
* to another requester until released back to the cache. The same goes to a
* buffer in the transfer state. The transfer state means being read or
- * written. If the file system has modifed the block and releases it as
+ * written. If the file system has modified the block and releases it as
* modified it placed on the cache's modified list and a hold timer
* initialised. The buffer is held for the hold time before being written to
* disk. Buffers are held for a configurable period of time on the modified
@@ -462,7 +462,7 @@ rtems_bdbuf_init (void);
/**
* Get block buffer for data to be written into. The buffers is set to the
- * access or modifed access state. If the buffer is in the cache and modified
+ * access or modified access state. If the buffer is in the cache and modified
* the state is access modified else the state is access. This buffer contents
* are not initialised if the buffer is not already in the cache. If the block
* is already resident in memory it is returned how-ever if not in memory the
@@ -498,7 +498,7 @@ rtems_bdbuf_get (
/**
* Get the block buffer and if not already in the cache read from the disk. If
* specified block already cached return. The buffer is set to the access or
- * modifed access state. If the buffer is in the cache and modified the state
+ * modified access state. If the buffer is in the cache and modified the state
* is access modified else the state is access. If block is already being read
* from disk for being written to disk this call blocks. If the buffer is
* waiting to be written it is removed from modified queue and returned to the
@@ -601,7 +601,7 @@ rtems_bdbuf_sync (rtems_bdbuf_buffer* bd);
/**
* Synchronize all modified buffers for this device with the disk and wait
* until the transfers have completed. The sync mutex for the cache is locked
- * stopping the addition of any further modifed buffers. It is only the
+ * stopping the addition of any further modified buffers. It is only the
* currently modified buffers that are written.
*
* @note Nesting calls to sync multiple devices will be handled sequentially. A
@@ -635,8 +635,7 @@ rtems_bdbuf_purge_dev (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.
+ * This will set the block size derived 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
diff --git a/cpukit/libblock/include/rtems/diskdevs.h b/cpukit/libblock/include/rtems/diskdevs.h
index 2e3f7533f3..fe931f8a94 100644
--- a/cpukit/libblock/include/rtems/diskdevs.h
+++ b/cpukit/libblock/include/rtems/diskdevs.h
@@ -92,33 +92,48 @@ struct rtems_disk_device {
unsigned uses;
/**
- * @brief Start block number.
+ * @brief Start media block number.
*
- * Equals zero for physical devices. It is a block offset to the related
- * physical device for logical device.
+ * Equals zero for physical devices. It is a media block offset to the
+ * related physical device for logical device.
*/
rtems_blkdev_bnum start;
/**
- * @brief Size of the physical or logical disk in blocks.
+ * @brief Size of the physical or logical disk in media blocks.
*/
rtems_blkdev_bnum size;
/**
- * @brief Device block size in bytes.
+ * @brief Media block size in bytes.
*
- * This is the minimum transfer unit. It must be positive.
+ * This is the media transfer unit the hardware defaults to.
+ */
+ uint32_t media_block_size;
+
+ /**
+ * @brief Block size in bytes.
+ *
+ * This is the minimum transfer unit. It may be a multiple of the media
+ * block size. It must be positive.
*
* @see rtems_bdbuf_set_block_size().
*/
uint32_t block_size;
/**
- * @brief Device media block size in bytes.
+ * @brief Block count.
*
- * This is the media transfer unit the hardware defaults to.
+ * @see rtems_bdbuf_set_block_size().
*/
- uint32_t media_block_size;
+ rtems_blkdev_bnum block_count;
+
+ /**
+ * @brief Media blocks per device blocks.
+ *
+ * @see rtems_bdbuf_set_block_size().
+ */
+ uint32_t media_blocks_per_block;
/**
* @brief Block to media block shift.
@@ -259,7 +274,7 @@ rtems_status_code rtems_disk_create_phys(
*
* A logical disk manages a subset of consecutive blocks contained in the
* physical disk with identifier @a phys. The start block index of the logical
- * disk device is @a begin_block. The block count of the logcal disk will be
+ * disk device is @a block_begin. The block count of the logcal disk will be
* @a block_count. The blocks must be within the range of blocks managed by
* the associated physical disk device. A device node will be registered in
* the file system with absolute path @a name, if @a name is not @c NULL. The
@@ -278,7 +293,7 @@ rtems_status_code rtems_disk_create_phys(
rtems_status_code rtems_disk_create_log(
dev_t dev,
dev_t phys,
- rtems_blkdev_bnum begin_block,
+ rtems_blkdev_bnum block_begin,
rtems_blkdev_bnum block_count,
const char *name
);
@@ -373,6 +388,23 @@ rtems_status_code rtems_disk_io_done(void);
*/
rtems_disk_device *rtems_disk_next(dev_t dev);
+/* Internal function, do not use */
+rtems_status_code rtems_disk_init_phys(
+ rtems_disk_device *dd,
+ uint32_t block_size,
+ rtems_blkdev_bnum block_count,
+ rtems_block_device_ioctl handler,
+ void *driver_data
+);
+
+/* Internal function, do not use */
+rtems_status_code rtems_disk_init_log(
+ rtems_disk_device *dd,
+ rtems_disk_device *phys_dd,
+ rtems_blkdev_bnum block_begin,
+ rtems_blkdev_bnum block_count
+);
+
#ifdef __cplusplus
}
#endif