forked from Imagelibrary/rtems
libblock: Remove const qualifier from bdbuf API
This allows addtion of per disk statistics for example.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user