summaryrefslogtreecommitdiffstats
path: root/cpukit/libblock/include/rtems
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-03-05 15:06:02 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-03-13 12:24:18 +0100
commit01211720ec7e19f70e900c1e21b415e2a126436b (patch)
treea9f7eaee61a37c71bd829aacc124215710568e6d /cpukit/libblock/include/rtems
parentlibblock: Split file and simplify (diff)
downloadrtems-01211720ec7e19f70e900c1e21b415e2a126436b.tar.bz2
libblock: Add generic IMFS block device nodes
New functions o rtems_blkdev_create(), and o rtems_blkdev_create_partition(). New test libtests/block11.
Diffstat (limited to 'cpukit/libblock/include/rtems')
-rw-r--r--cpukit/libblock/include/rtems/blkdev.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/cpukit/libblock/include/rtems/blkdev.h b/cpukit/libblock/include/rtems/blkdev.h
index 70259d6c43..c51238084b 100644
--- a/cpukit/libblock/include/rtems/blkdev.h
+++ b/cpukit/libblock/include/rtems/blkdev.h
@@ -307,6 +307,56 @@ rtems_blkdev_ioctl(rtems_disk_device *dd, uint32_t req, void *argp);
*/
extern const rtems_driver_address_table rtems_blkdev_generic_ops;
+/**
+ * @brief Creates a block device.
+ *
+ * @param[in] device The path for the new block device.
+ * @param[in] block_size The block size. Must be positive.
+ * @param[in] block_count The block count. Must be positive.
+ * @param[in] handler The block device IO control handler. Must not be @c NULL.
+ * @param[in] driver_data The block device driver data.
+ *
+ * @retval RTEMS_SUCCESSFUL Successful operation.
+ * @retval RTEMS_INVALID_NUMBER Block size or block count is not positive.
+ * @retval RTEMS_NO_MEMORY Not enough memory.
+ * @retval RTEMS_UNSATISFIED Cannot create generic device node.
+ */
+rtems_status_code rtems_blkdev_create(
+ const char *device,
+ uint32_t block_size,
+ rtems_blkdev_bnum block_count,
+ rtems_block_device_ioctl handler,
+ void *driver_data
+);
+
+/**
+ * @brief Creates a partition within a block device.
+ *
+ * A partition manages a subset of consecutive blocks contained in a block
+ * device. The blocks must be within the range of blocks managed by the
+ * associated block device. The media block size, block size, and IO control
+ * handler are inherited by the block device.
+ *
+ * @param[in] partition The path for the new partition device.
+ * @param[in] device The block device path.
+ * @param[in] block_begin The block begin of the partition.
+ * @param[in] block_count The block count of the partition.
+ *
+ * @retval RTEMS_SUCCESSFUL Successful operation.
+ * @retval RTEMS_INVALID_ID Block device node does not exist.
+ * @retval RTEMS_INVALID_NODE File system node is not a block device.
+ * @retval RTEMS_NOT_IMPLEMENTED Block device implementation is incomplete.
+ * @retval RTEMS_INVALID_NUMBER Block begin or block count is invalid.
+ * @retval RTEMS_NO_MEMORY Not enough memory.
+ * @retval RTEMS_UNSATISFIED Cannot create generic device node.
+ */
+rtems_status_code rtems_blkdev_create_partition(
+ const char *partition,
+ const char *device,
+ rtems_blkdev_bnum block_begin,
+ rtems_blkdev_bnum block_count
+);
+
/** @} */
#ifdef __cplusplus