summaryrefslogtreecommitdiffstats
path: root/cpukit/libblock
diff options
context:
space:
mode:
authorThomas Doerfler <Thomas.Doerfler@embedded-brains.de>2009-05-05 12:57:16 +0000
committerThomas Doerfler <Thomas.Doerfler@embedded-brains.de>2009-05-05 12:57:16 +0000
commitd0c3b38bedafb489350a0fd30769fc630ebc6d0b (patch)
treef7b384472fadd26658dae3f2355a63413ad4d1eb /cpukit/libblock
parentDocumentation (diff)
downloadrtems-d0c3b38bedafb489350a0fd30769fc630ebc6d0b.tar.bz2
Documentation. Changed integer types to match block device types.
Added const qualifier whenever possible. Added rtems_fsmount_create_mount_point() prototype.
Diffstat (limited to 'cpukit/libblock')
-rw-r--r--cpukit/libblock/include/rtems/ramdisk.h78
-rw-r--r--cpukit/libblock/src/ramdisk.c34
2 files changed, 77 insertions, 35 deletions
diff --git a/cpukit/libblock/include/rtems/ramdisk.h b/cpukit/libblock/include/rtems/ramdisk.h
index 0df21b4ca0..62b1293a8a 100644
--- a/cpukit/libblock/include/rtems/ramdisk.h
+++ b/cpukit/libblock/include/rtems/ramdisk.h
@@ -1,6 +1,7 @@
/**
- * @file rtems/ramdisk.h
- * RAM disk block device implementation
+ * @file
+ *
+ * RAM disk block device.
*/
/*
@@ -21,33 +22,70 @@
extern "C" {
#endif
-/* RAM disk configuration table entry */
+/**
+ * @defgroup rtems_ramdisk RAM Disk Device
+ *
+ * @ingroup rtems_blkdev
+ *
+ * @{
+ */
+
+/**
+ * RAM disk configuration table entry.
+ */
typedef struct rtems_ramdisk_config {
- int block_size; /* RAM disk block size */
- int block_num; /* Number of blocks on this RAM disk */
- void *location; /* RAM disk permanent location (out of RTEMS controlled
- memory), or NULL if RAM disk memory should be
- allocated dynamically */
+ /**
+ * RAM disk block size (must be a power of two).
+ */
+ uint32_t block_size;
+
+ /**
+ * Number of blocks on this RAM disk.
+ */
+ rtems_blkdev_bnum block_num;
+
+ /**
+ * RAM disk location or @c NULL if RAM disk memory should be allocated
+ * dynamically.
+ */
+ void *location;
} rtems_ramdisk_config;
-/* If application want to use RAM disk, it should specify configuration of
- * available RAM disks.
- * The following is definitions for RAM disk configuration table
+/**
+ * External reference to the RAM disk configuration table describing each RAM
+ * disk in the system.
+ *
+ * The configuration table is provided by the application.
+ */
+extern rtems_ramdisk_config rtems_ramdisk_configuration [];
+
+/**
+ * External reference the size of the RAM disk configuration table
+ * @ref rtems_ramdisk_configuration.
+ *
+ * The configuration table size is provided by the application.
*/
-extern rtems_ramdisk_config rtems_ramdisk_configuration[];
extern size_t rtems_ramdisk_configuration_size;
-/* ramdisk_initialize --
- * RAM disk driver initialization entry point.
+/**
+ * RAM disk driver initialization entry point.
*/
-rtems_device_driver
-ramdisk_initialize(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void *arg);
+rtems_device_driver ramdisk_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *arg
+);
+/**
+ * RAM disk driver table entry.
+ */
#define RAMDISK_DRIVER_TABLE_ENTRY \
- { ramdisk_initialize, RTEMS_GENERIC_BLOCK_DEVICE_DRIVER_ENTRIES }
+ { \
+ .initialization_entry = ramdisk_initialize, \
+ RTEMS_GENERIC_BLOCK_DEVICE_DRIVER_ENTRIES \
+ }
+
+/** @} */
#ifdef __cplusplus
}
diff --git a/cpukit/libblock/src/ramdisk.c b/cpukit/libblock/src/ramdisk.c
index 05a896016b..0b18ad34f8 100644
--- a/cpukit/libblock/src/ramdisk.c
+++ b/cpukit/libblock/src/ramdisk.c
@@ -1,5 +1,10 @@
-/* ramdisk.c -- RAM disk block device implementation
+/**
+ * @file
*
+ * RAM disk block device.
+ */
+
+/*
* Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
* Author: Victor V. Vengerov <vvv@oktet.ru>
*
@@ -18,9 +23,9 @@
#include <string.h>
#include <inttypes.h>
-#include "rtems/blkdev.h"
-#include "rtems/diskdevs.h"
-#include "rtems/ramdisk.h"
+#include <rtems/blkdev.h>
+#include <rtems/diskdevs.h>
+#include <rtems/ramdisk.h>
/**
* Control tracing. It can be compiled out of the code for small
@@ -30,23 +35,22 @@
#define RTEMS_RAMDISK_TRACE 0
#endif
-#define RAMDISK_DEVICE_BASE_NAME "/dev/ramdisk"
+#define RAMDISK_DEVICE_BASE_NAME "/dev/rd"
/* Internal RAM disk descriptor */
struct ramdisk {
- int block_size; /* RAM disk block size */
- int block_num; /* Number of blocks on this RAM disk */
- void *area; /* RAM disk memory area */
- bool initialized;/* RAM disk is initialized */
- bool malloced; /* != 0, if memory allocated by malloc for this
- RAM disk */
+ uint32_t block_size; /* RAM disk block size */
+ rtems_blkdev_bnum block_num; /* Number of blocks on this RAM disk */
+ void *area; /* RAM disk memory area */
+ bool initialized; /* RAM disk is initialized */
+ bool malloced; /* != 0, if memory allocated by malloc for this RAM disk */
#if RTEMS_RAMDISK_TRACE
- int info_level; /* Trace level */
+ int info_level; /* Trace level */
#endif
};
static struct ramdisk *ramdisk;
-static uint32_t nramdisks;
+static uint32_t nramdisks;
#if RTEMS_RAMDISK_TRACE
/**
@@ -242,8 +246,8 @@ ramdisk_initialize(
for (i = 0; i < rtems_ramdisk_configuration_size; i++, c++, r++)
{
dev_t dev = rtems_filesystem_make_dev_t(major, i);
- char name[sizeof(RAMDISK_DEVICE_BASE_NAME "0123456789")];
- snprintf(name, sizeof(name), RAMDISK_DEVICE_BASE_NAME "%" PRIu32, i);
+ char name [] = RAMDISK_DEVICE_BASE_NAME "a";
+ name [sizeof(RAMDISK_DEVICE_BASE_NAME)] += i;
r->block_size = c->block_size;
r->block_num = c->block_num;
if (c->location == NULL)