[rtems commit] libblock: Remove const qualifier from bdbuf API
Sebastian Huber
sebh at rtems.org
Thu May 31 09:03:03 UTC 2012
Module: rtems
Branch: master
Commit: 40284de8443df5e8f60420c11d2dcac09b6befb1
Changeset: http://git.rtems.org/rtems/commit/?id=40284de8443df5e8f60420c11d2dcac09b6befb1
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed May 30 12:43:56 2012 +0200
libblock: Remove const qualifier from bdbuf API
This allows addtion of per disk statistics for example.
---
cpukit/libblock/include/rtems/bdbuf.h | 8 ++++----
cpukit/libblock/include/rtems/bdpart.h | 2 +-
cpukit/libblock/include/rtems/blkdev.h | 2 +-
cpukit/libblock/src/bdbuf.c | 8 ++++----
cpukit/libblock/src/bdpart-read.c | 8 ++++----
cpukit/libblock/src/bdpart-register.c | 4 ++--
cpukit/libblock/src/bdpart-write.c | 4 ++--
cpukit/libblock/src/blkdev-imfs.c | 18 +++++++++---------
testsuites/fstests/fsbdpart01/init.c | 2 +-
testsuites/libtests/block01/init.c | 2 +-
testsuites/libtests/block02/init.c | 4 ++--
testsuites/libtests/block03/init.c | 2 +-
testsuites/libtests/block04/init.c | 2 +-
testsuites/libtests/block05/init.c | 6 +++---
testsuites/libtests/block06/init.c | 10 +++++-----
testsuites/libtests/block08/bdbuf_tests.c | 2 +-
testsuites/libtests/block08/bdbuf_tests.h | 2 +-
testsuites/libtests/block09/init.c | 2 +-
testsuites/libtests/block10/init.c | 2 +-
testsuites/libtests/block11/init.c | 2 +-
20 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/cpukit/libblock/include/rtems/bdbuf.h b/cpukit/libblock/include/rtems/bdbuf.h
index ead4020..c065f4e 100644
--- a/cpukit/libblock/include/rtems/bdbuf.h
+++ b/cpukit/libblock/include/rtems/bdbuf.h
@@ -490,7 +490,7 @@ rtems_bdbuf_init (void);
*/
rtems_status_code
rtems_bdbuf_get (
- const rtems_disk_device *dd,
+ rtems_disk_device *dd,
rtems_blkdev_bnum block,
rtems_bdbuf_buffer** bd
);
@@ -524,7 +524,7 @@ rtems_bdbuf_get (
*/
rtems_status_code
rtems_bdbuf_read (
- const rtems_disk_device *dd,
+ rtems_disk_device *dd,
rtems_blkdev_bnum block,
rtems_bdbuf_buffer** bd
);
@@ -616,7 +616,7 @@ rtems_bdbuf_sync (rtems_bdbuf_buffer* bd);
* @retval RTEMS_SUCCESSFUL Successful operation.
*/
rtems_status_code
-rtems_bdbuf_syncdev (const rtems_disk_device *dd);
+rtems_bdbuf_syncdev (rtems_disk_device *dd);
/**
* @brief Purges all buffers corresponding to the disk device @a dd.
@@ -630,7 +630,7 @@ rtems_bdbuf_syncdev (const rtems_disk_device *dd);
* @param dd [in] The disk device.
*/
void
-rtems_bdbuf_purge_dev (const rtems_disk_device *dd);
+rtems_bdbuf_purge_dev (rtems_disk_device *dd);
/**
* @brief Sets the block size of a disk device.
diff --git a/cpukit/libblock/include/rtems/bdpart.h b/cpukit/libblock/include/rtems/bdpart.h
index 873b9d3..d1d81e7 100644
--- a/cpukit/libblock/include/rtems/bdpart.h
+++ b/cpukit/libblock/include/rtems/bdpart.h
@@ -400,7 +400,7 @@ static inline uint8_t rtems_bdpart_mbr_partition_type(
rtems_status_code rtems_bdpart_get_disk_data(
const char *disk_name,
int *fd_ptr,
- const rtems_disk_device **dd_ptr,
+ rtems_disk_device **dd_ptr,
rtems_blkdev_bnum *disk_end
);
diff --git a/cpukit/libblock/include/rtems/blkdev.h b/cpukit/libblock/include/rtems/blkdev.h
index 4df881b..7c27872 100644
--- a/cpukit/libblock/include/rtems/blkdev.h
+++ b/cpukit/libblock/include/rtems/blkdev.h
@@ -192,7 +192,7 @@ static inline int rtems_disk_fd_get_block_count(
static inline int rtems_disk_fd_get_disk_device(
int fd,
- const rtems_disk_device **dd_ptr
+ rtems_disk_device **dd_ptr
)
{
return ioctl(fd, RTEMS_BLKIO_GETDISKDEV, dd_ptr);
diff --git a/cpukit/libblock/src/bdbuf.c b/cpukit/libblock/src/bdbuf.c
index 439da98..8c929f0 100644
--- a/cpukit/libblock/src/bdbuf.c
+++ b/cpukit/libblock/src/bdbuf.c
@@ -1774,7 +1774,7 @@ rtems_bdbuf_get_media_block (const rtems_disk_device *dd,
}
rtems_status_code
-rtems_bdbuf_get (const rtems_disk_device *dd,
+rtems_bdbuf_get (rtems_disk_device *dd,
rtems_blkdev_bnum block,
rtems_bdbuf_buffer **bd_ptr)
{
@@ -1992,7 +1992,7 @@ rtems_bdbuf_execute_transfer_request (const rtems_disk_device *dd,
}
rtems_status_code
-rtems_bdbuf_read (const rtems_disk_device *dd,
+rtems_bdbuf_read (rtems_disk_device *dd,
rtems_blkdev_bnum block,
rtems_bdbuf_buffer **bd_ptr)
{
@@ -2176,7 +2176,7 @@ rtems_bdbuf_sync (rtems_bdbuf_buffer *bd)
}
rtems_status_code
-rtems_bdbuf_syncdev (const rtems_disk_device *dd)
+rtems_bdbuf_syncdev (rtems_disk_device *dd)
{
if (rtems_bdbuf_tracer)
printf ("bdbuf:syncdev: %08x\n", (unsigned) dd->dev);
@@ -2877,7 +2877,7 @@ rtems_bdbuf_gather_for_purge (rtems_chain_control *purge_list,
}
void
-rtems_bdbuf_purge_dev (const rtems_disk_device *dd)
+rtems_bdbuf_purge_dev (rtems_disk_device *dd)
{
rtems_chain_control purge_list;
diff --git a/cpukit/libblock/src/bdpart-read.c b/cpukit/libblock/src/bdpart-read.c
index 4604e10..b14fc4c 100644
--- a/cpukit/libblock/src/bdpart-read.c
+++ b/cpukit/libblock/src/bdpart-read.c
@@ -68,14 +68,14 @@ bool rtems_bdpart_to_mbr_partition_type(
rtems_status_code rtems_bdpart_get_disk_data(
const char *disk_name,
int *fd_ptr,
- const rtems_disk_device **dd_ptr,
+ rtems_disk_device **dd_ptr,
rtems_blkdev_bnum *disk_end
)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
int rv = 0;
int fd = -1;
- const rtems_disk_device *dd = NULL;
+ rtems_disk_device *dd = NULL;
rtems_blkdev_bnum disk_begin = 0;
rtems_blkdev_bnum block_size = 0;
@@ -185,7 +185,7 @@ static rtems_status_code rtems_bdpart_read_mbr_partition(
}
static rtems_status_code rtems_bdpart_read_record(
- const rtems_disk_device *dd,
+ rtems_disk_device *dd,
rtems_blkdev_bnum index,
rtems_bdbuf_buffer **block
)
@@ -237,7 +237,7 @@ rtems_status_code rtems_bdpart_read(
size_t i = 0;
const uint8_t *data = NULL;
int fd = -1;
- const rtems_disk_device *dd = NULL;
+ rtems_disk_device *dd = NULL;
/* Check parameter */
if (format == NULL || pt == NULL || count == NULL) {
diff --git a/cpukit/libblock/src/bdpart-register.c b/cpukit/libblock/src/bdpart-register.c
index d937e65..ebaffd1 100644
--- a/cpukit/libblock/src/bdpart-register.c
+++ b/cpukit/libblock/src/bdpart-register.c
@@ -48,7 +48,7 @@ rtems_status_code rtems_bdpart_register(
size_t disk_name_size = strlen( disk_name);
size_t i = 0;
int fd = -1;
- const rtems_disk_device *dd = NULL;
+ rtems_disk_device *dd = NULL;
/* Get disk data */
sc = rtems_bdpart_get_disk_data( disk_name, &fd, &dd, &disk_end);
@@ -139,7 +139,7 @@ rtems_status_code rtems_bdpart_unregister(
dev_t logical_disk = 0;
size_t i = 0;
int fd = -1;
- const rtems_disk_device *dd = NULL;
+ rtems_disk_device *dd = NULL;
/* Get disk data */
sc = rtems_bdpart_get_disk_data( disk_name, &fd, &dd, &disk_end);
diff --git a/cpukit/libblock/src/bdpart-write.c b/cpukit/libblock/src/bdpart-write.c
index 9cccda5..d4523e0 100644
--- a/cpukit/libblock/src/bdpart-write.c
+++ b/cpukit/libblock/src/bdpart-write.c
@@ -45,7 +45,7 @@ static void rtems_bdpart_write_mbr_partition(
}
static rtems_status_code rtems_bdpart_new_record(
- const rtems_disk_device *dd,
+ rtems_disk_device *dd,
rtems_blkdev_bnum index,
rtems_bdbuf_buffer **block
)
@@ -103,7 +103,7 @@ rtems_status_code rtems_bdpart_write(
size_t i = 0;
uint8_t *data = NULL;
int fd = -1;
- const rtems_disk_device *dd = NULL;
+ rtems_disk_device *dd = NULL;
/* Check if we have something to do */
if (count == 0) {
diff --git a/cpukit/libblock/src/blkdev-imfs.c b/cpukit/libblock/src/blkdev-imfs.c
index c69542d..c159ca3 100644
--- a/cpukit/libblock/src/blkdev-imfs.c
+++ b/cpukit/libblock/src/blkdev-imfs.c
@@ -38,8 +38,8 @@ static ssize_t rtems_blkdev_imfs_read(
)
{
int rv;
- const rtems_blkdev_imfs_context *ctx = IMFS_generic_get_context_by_iop(iop);
- const rtems_disk_device *dd = &ctx->dd;
+ rtems_blkdev_imfs_context *ctx = IMFS_generic_get_context_by_iop(iop);
+ rtems_disk_device *dd = &ctx->dd;
ssize_t remaining = (ssize_t) count;
off_t offset = iop->offset;
ssize_t block_size = (ssize_t) rtems_disk_get_block_size(dd);
@@ -92,8 +92,8 @@ static ssize_t rtems_blkdev_imfs_write(
)
{
int rv;
- const rtems_blkdev_imfs_context *ctx = IMFS_generic_get_context_by_iop(iop);
- const rtems_disk_device *dd = &ctx->dd;
+ rtems_blkdev_imfs_context *ctx = IMFS_generic_get_context_by_iop(iop);
+ rtems_disk_device *dd = &ctx->dd;
ssize_t remaining = (ssize_t) count;
off_t offset = iop->offset;
ssize_t block_size = (ssize_t) rtems_disk_get_block_size(dd);
@@ -174,9 +174,9 @@ static int rtems_blkdev_imfs_fstat(
struct stat *buf
)
{
- const rtems_blkdev_imfs_context *ctx =
+ rtems_blkdev_imfs_context *ctx =
IMFS_generic_get_context_by_location(loc);
- const rtems_disk_device *dd = &ctx->dd;
+ rtems_disk_device *dd = &ctx->dd;
buf->st_rdev = rtems_disk_get_device_identifier(dd);
buf->st_blksize = rtems_disk_get_block_size(dd);
@@ -190,8 +190,8 @@ static int rtems_blkdev_imfs_fsync_or_fdatasync(
)
{
int rv = 0;
- const rtems_blkdev_imfs_context *ctx = IMFS_generic_get_context_by_iop(iop);
- const rtems_disk_device *dd = &ctx->dd;
+ rtems_blkdev_imfs_context *ctx = IMFS_generic_get_context_by_iop(iop);
+ rtems_disk_device *dd = &ctx->dd;
rtems_status_code sc = rtems_bdbuf_syncdev(dd);
if (sc != RTEMS_SUCCESSFUL) {
@@ -332,7 +332,7 @@ rtems_status_code rtems_blkdev_create_partition(
if (rv == 0 && S_ISBLK(st.st_mode)) {
rtems_disk_device *dd;
- rv = ioctl(fd, RTEMS_BLKIO_GETDISKDEV, &dd);
+ rv = rtems_disk_fd_get_disk_device(fd, &dd);
if (rv == 0) {
rtems_blkdev_bnum device_block_count = rtems_disk_get_block_count(dd);
diff --git a/testsuites/fstests/fsbdpart01/init.c b/testsuites/fstests/fsbdpart01/init.c
index 69fe071..3539a05 100644
--- a/testsuites/fstests/fsbdpart01/init.c
+++ b/testsuites/fstests/fsbdpart01/init.c
@@ -80,7 +80,7 @@ static void test_logical_disks(const char *const *rdax, bool exists)
int fd = open(rdax [i], O_RDONLY);
if (exists) {
- const rtems_disk_device *dd = NULL;
+ rtems_disk_device *dd = NULL;
int rv = 0;
rtems_test_assert(fd >= 0);
diff --git a/testsuites/libtests/block01/init.c b/testsuites/libtests/block01/init.c
index 43d612e..03ff097 100644
--- a/testsuites/libtests/block01/init.c
+++ b/testsuites/libtests/block01/init.c
@@ -48,7 +48,7 @@ static void test_block_io_control_api(dev_t dev, ramdisk *rd)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
rtems_disk_device *dd = NULL;
- const rtems_disk_device *fd_dd = NULL;
+ rtems_disk_device *fd_dd = NULL;
int fd = -1;
int rv = -1;
uint32_t value = 0;
diff --git a/testsuites/libtests/block02/init.c b/testsuites/libtests/block02/init.c
index 7c6c5d6..ed68830 100644
--- a/testsuites/libtests/block02/init.c
+++ b/testsuites/libtests/block02/init.c
@@ -52,9 +52,9 @@ static rtems_task Init(rtems_task_argument argument);
#define BLOCK_COUNT_B 1
-static const rtems_disk_device *dd_a;
+static rtems_disk_device *dd_a;
-static const rtems_disk_device *dd_b;
+static rtems_disk_device *dd_b;
static volatile bool sync_done = false;
diff --git a/testsuites/libtests/block03/init.c b/testsuites/libtests/block03/init.c
index 1c4c993..2ad2b49 100644
--- a/testsuites/libtests/block03/init.c
+++ b/testsuites/libtests/block03/init.c
@@ -48,7 +48,7 @@ static rtems_task Init(rtems_task_argument argument);
#define BLOCK_COUNT 2
-static const rtems_disk_device *dd;
+static rtems_disk_device *dd;
static volatile bool sync_done = false;
diff --git a/testsuites/libtests/block04/init.c b/testsuites/libtests/block04/init.c
index eed81fa..1a93a30 100644
--- a/testsuites/libtests/block04/init.c
+++ b/testsuites/libtests/block04/init.c
@@ -48,7 +48,7 @@ static rtems_task Init(rtems_task_argument argument);
#define BLOCK_COUNT 1
-static const rtems_disk_device *dd;
+static rtems_disk_device *dd;
static rtems_id task_id_low;
diff --git a/testsuites/libtests/block05/init.c b/testsuites/libtests/block05/init.c
index e68e53d..3d221a9 100644
--- a/testsuites/libtests/block05/init.c
+++ b/testsuites/libtests/block05/init.c
@@ -60,9 +60,9 @@ static rtems_task Init(rtems_task_argument argument);
/* In case of trouble change this to 1 or 2 for more output */
static unsigned output_level = 0;
-static const rtems_disk_device *dd_a;
+static rtems_disk_device *dd_a;
-static const rtems_disk_device *dd_b;
+static rtems_disk_device *dd_b;
static rtems_id task_id_init;
@@ -393,7 +393,7 @@ static int disk_ioctl(rtems_disk_device *dd, uint32_t req, void *argp)
static void disk_register(
uint32_t block_size,
rtems_blkdev_bnum block_count,
- const rtems_disk_device **dd_ptr
+ rtems_disk_device **dd_ptr
)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
diff --git a/testsuites/libtests/block06/init.c b/testsuites/libtests/block06/init.c
index 838f371..90097ea 100644
--- a/testsuites/libtests/block06/init.c
+++ b/testsuites/libtests/block06/init.c
@@ -108,7 +108,7 @@ typedef struct bdbuf_task_control
rtems_device_major_number major;
rtems_device_minor_number minor;
bool passed;
- const rtems_disk_device *dd;
+ rtems_disk_device *dd;
} bdbuf_task_control;
#define BDBUF_TEST_TASKS (3)
@@ -345,7 +345,7 @@ bdbuf_task_control_init (int task,
bdbuf_task_control* tc,
rtems_id master,
rtems_device_major_number major,
- const rtems_disk_device *dd)
+ rtems_disk_device *dd)
{
char name[6];
sprintf (name, "bdt%d", task);
@@ -614,8 +614,8 @@ static rtems_driver_address_table bdbuf_disk_io_ops = {
*/
static bool
-bdbuf_tests_setup_disk (rtems_device_major_number* major,
- const rtems_disk_device **dd_ptr)
+bdbuf_tests_setup_disk (rtems_device_major_number *major,
+ rtems_disk_device **dd_ptr)
{
rtems_status_code sc;
bool ok;
@@ -1765,7 +1765,7 @@ bdbuf_tester (void)
rtems_task_priority old_priority;
int t;
bool passed = true;
- const rtems_disk_device *dd;
+ rtems_disk_device *dd;
/*
* Change priority to a lower one.
diff --git a/testsuites/libtests/block08/bdbuf_tests.c b/testsuites/libtests/block08/bdbuf_tests.c
index ae4d73d..e764d9b 100644
--- a/testsuites/libtests/block08/bdbuf_tests.c
+++ b/testsuites/libtests/block08/bdbuf_tests.c
@@ -47,7 +47,7 @@ struct bdbuf_test_descr {
#define TEST_SEM_ATTRIBS RTEMS_DEFAULT_ATTRIBUTES
/** Device ID used for testing */
-const rtems_disk_device *test_dd = NULL;
+rtems_disk_device *test_dd = NULL;
/** Test result variable */
bool good_test_result = true;
diff --git a/testsuites/libtests/block08/bdbuf_tests.h b/testsuites/libtests/block08/bdbuf_tests.h
index acc9099..21ee2a3 100644
--- a/testsuites/libtests/block08/bdbuf_tests.h
+++ b/testsuites/libtests/block08/bdbuf_tests.h
@@ -150,7 +150,7 @@ typedef struct test_ctx {
extern test_ctx g_test_ctx;
/** Device ID used for testing */
-extern const rtems_disk_device *test_dd;
+extern rtems_disk_device *test_dd;
/**
* Create a message queue for test driver that is used for
diff --git a/testsuites/libtests/block09/init.c b/testsuites/libtests/block09/init.c
index 36479fe..d29d6ac 100644
--- a/testsuites/libtests/block09/init.c
+++ b/testsuites/libtests/block09/init.c
@@ -143,7 +143,7 @@ static rtems_status_code disk_register(
}
static void check_read(
- const rtems_disk_device *dd,
+ rtems_disk_device *dd,
rtems_blkdev_bnum block,
rtems_status_code expected_sc
)
diff --git a/testsuites/libtests/block10/init.c b/testsuites/libtests/block10/init.c
index 186d745..37b757a 100644
--- a/testsuites/libtests/block10/init.c
+++ b/testsuites/libtests/block10/init.c
@@ -55,7 +55,7 @@ typedef rtems_bdbuf_buffer *(*access_func)(char task);
typedef void (*release_func)(char task, rtems_bdbuf_buffer *bd);
-static const rtems_disk_device *dd;
+static rtems_disk_device *dd;
static rtems_id task_id_init;
diff --git a/testsuites/libtests/block11/init.c b/testsuites/libtests/block11/init.c
index 2458edc..095d8bd 100644
--- a/testsuites/libtests/block11/init.c
+++ b/testsuites/libtests/block11/init.c
@@ -157,7 +157,7 @@ static void test_blkdev_imfs_parameters(void)
int rv;
ramdisk *rd;
int fd;
- const rtems_disk_device *dd;
+ rtems_disk_device *dd;
struct stat st;
rd = ramdisk_allocate(NULL, BLOCK_SIZE, BLOCK_COUNT, false);
More information about the vc
mailing list