[PATCH rtems6 - v2 03/16] flashdev: Align IOCTL function and macro
berndmoessner80 at gmail.com
berndmoessner80 at gmail.com
Sun Jan 7 18:18:37 UTC 2024
From: Bernd Moessner <berndmoessner80 at gmail.com>
Updates #4981
---
cpukit/dev/flash/flashdev.c | 72 +++++++++----------
cpukit/include/dev/flash/flashdev.h | 12 ++--
.../libtests/flashdev01/test_flashdev.c | 36 +++++-----
3 files changed, 60 insertions(+), 60 deletions(-)
diff --git a/cpukit/dev/flash/flashdev.c b/cpukit/dev/flash/flashdev.c
index 40666290e0..27edead968 100644
--- a/cpukit/dev/flash/flashdev.c
+++ b/cpukit/dev/flash/flashdev.c
@@ -99,31 +99,31 @@ static int rtems_flashdev_ioctl_clear_region(
rtems_libio_t *iop
);
-static uint32_t rtems_flashdev_ioctl_jedec_id(
+static uint32_t rtems_flashdev_ioctl_get_jedec_id(
rtems_flashdev *flash
);
-static uint32_t rtems_flashdev_ioctl_flash_type(
+static uint32_t rtems_flashdev_ioctl_get_flash_type(
rtems_flashdev *flash,
void *arg
);
-static int rtems_flashdev_ioctl_pageinfo_offset(
+static int rtems_flashdev_ioctl_get_pageinfo_offset(
rtems_flashdev *flash,
void *arg
);
-static int rtems_flashdev_ioctl_pageinfo_index(
+static int rtems_flashdev_ioctl_get_pageinfo_index(
rtems_flashdev *flash,
void *arg
);
-static int rtems_flashdev_ioctl_page_count(
+static int rtems_flashdev_ioctl_get_page_count(
rtems_flashdev *flash,
void *arg
);
-static int rtems_flashdev_ioctl_write_block_size(
+static int rtems_flashdev_ioctl_get_write_block_size(
rtems_flashdev *flash,
void *arg
);
@@ -363,7 +363,7 @@ static int rtems_flashdev_ioctl(
err = 0;
break;
case RTEMS_FLASHDEV_IOCTL_GET_JEDEC_ID:
- *( (uint32_t *) arg ) = rtems_flashdev_ioctl_jedec_id( flash );
+ *( (uint32_t *) arg ) = rtems_flashdev_ioctl_get_jedec_id( flash );
err = 0;
break;
case RTEMS_FLASHDEV_IOCTL_ERASE:
@@ -376,19 +376,19 @@ static int rtems_flashdev_ioctl(
err = rtems_flashdev_ioctl_clear_region( flash, iop );
break;
case RTEMS_FLASHDEV_IOCTL_GET_TYPE:
- err = rtems_flashdev_ioctl_flash_type( flash, arg );
+ err = rtems_flashdev_ioctl_get_flash_type( flash, arg );
break;
case RTEMS_FLASHDEV_IOCTL_GET_PAGEINFO_BY_OFFSET:
- err = rtems_flashdev_ioctl_pageinfo_offset( flash, arg );
+ err = rtems_flashdev_ioctl_get_pageinfo_offset( flash, arg );
break;
case RTEMS_FLASHDEV_IOCTL_GET_PAGEINFO_BY_INDEX:
- err = rtems_flashdev_ioctl_pageinfo_index( flash, arg );
+ err = rtems_flashdev_ioctl_get_pageinfo_index( flash, arg );
break;
case RTEMS_FLASHDEV_IOCTL_GET_PAGE_COUNT:
- err = rtems_flashdev_ioctl_page_count( flash, arg );
+ err = rtems_flashdev_ioctl_get_page_count( flash, arg );
break;
case RTEMS_FLASHDEV_IOCTL_GET_WRITE_BLOCK_SIZE:
- err = rtems_flashdev_ioctl_write_block_size( flash, arg );
+ err = rtems_flashdev_ioctl_get_write_block_size( flash, arg );
break;
}
@@ -493,12 +493,12 @@ static int rtems_flashdev_do_init(
flash->read = NULL;
flash->write = NULL;
flash->erase = NULL;
- flash->jedec_id = NULL;
- flash->flash_type = NULL;
- flash->page_info_by_offset = NULL;
- flash->page_info_by_index = NULL;
- flash->page_count = NULL;
- flash->write_block_size = NULL;
+ flash->get_jedec_id = NULL;
+ flash->get_flash_type = NULL;
+ flash->get_page_info_by_offset = NULL;
+ flash->get_page_info_by_index = NULL;
+ flash->get_page_count = NULL;
+ flash->get_write_block_size = NULL;
flash->region_table = NULL;
return 0;
}
@@ -768,29 +768,29 @@ static size_t rtems_flashdev_get_region_size(
return table->regions[ rtems_flashdev_get_region_index( iop ) ].size;
}
-static uint32_t rtems_flashdev_ioctl_jedec_id( rtems_flashdev *flash )
+static uint32_t rtems_flashdev_ioctl_get_jedec_id( rtems_flashdev *flash )
{
- if ( flash->jedec_id == NULL ) {
+ if ( flash->get_jedec_id == NULL ) {
return 0;
} else {
- return ( *flash->jedec_id )( flash );
+ return ( *flash->get_jedec_id )( flash );
}
}
-static uint32_t rtems_flashdev_ioctl_flash_type(
+static uint32_t rtems_flashdev_ioctl_get_flash_type(
rtems_flashdev *flash,
void *arg
)
{
rtems_flashdev_flash_type *type = (rtems_flashdev_flash_type*)arg;
- if ( flash->flash_type == NULL ) {
+ if ( flash->get_flash_type == NULL ) {
return 0;
} else {
- return ( *flash->flash_type )( flash, type );
+ return ( *flash->get_flash_type )( flash, type );
}
}
-static int rtems_flashdev_ioctl_pageinfo_offset(
+static int rtems_flashdev_ioctl_get_pageinfo_offset(
rtems_flashdev *flash,
void *arg
)
@@ -800,18 +800,18 @@ static int rtems_flashdev_ioctl_pageinfo_offset(
if ( arg == NULL ) {
rtems_set_errno_and_return_minus_one( EINVAL );
}
- if ( flash->page_info_by_offset == NULL ) {
+ if ( flash->get_page_info_by_offset == NULL ) {
return 0;
} else {
page_info = (rtems_flashdev_ioctl_page_info *) arg;
- return ( *flash->page_info_by_offset )( flash,
+ return ( *flash->get_page_info_by_offset )( flash,
page_info->location,
&page_info->page_info.offset,
&page_info->page_info.size );
}
}
-static int rtems_flashdev_ioctl_pageinfo_index( rtems_flashdev *flash,
+static int rtems_flashdev_ioctl_get_pageinfo_index( rtems_flashdev *flash,
void *arg )
{
rtems_flashdev_ioctl_page_info *page_info;
@@ -819,30 +819,30 @@ static int rtems_flashdev_ioctl_pageinfo_index( rtems_flashdev *flash,
if ( arg == NULL ) {
rtems_set_errno_and_return_minus_one( EINVAL );
}
- if ( flash->page_info_by_index == NULL ) {
+ if ( flash->get_page_info_by_index == NULL ) {
return 0;
} else {
page_info = (rtems_flashdev_ioctl_page_info *) arg;
- return ( *flash->page_info_by_index )( flash,
+ return ( *flash->get_page_info_by_index )( flash,
page_info->location,
&page_info->page_info.offset,
&page_info->page_info.size );
}
}
-static int rtems_flashdev_ioctl_page_count( rtems_flashdev *flash, void *arg )
+static int rtems_flashdev_ioctl_get_page_count( rtems_flashdev *flash, void *arg )
{
if ( arg == NULL ) {
rtems_set_errno_and_return_minus_one( EINVAL );
}
- if ( flash->page_count == NULL ) {
+ if ( flash->get_page_count == NULL ) {
return 0;
} else {
- return ( *flash->page_count )( flash, ( (int *) arg ) );
+ return ( *flash->get_page_count )( flash, ( (int *) arg ) );
}
}
-static int rtems_flashdev_ioctl_write_block_size(
+static int rtems_flashdev_ioctl_get_write_block_size(
rtems_flashdev *flash,
void *arg
)
@@ -850,10 +850,10 @@ static int rtems_flashdev_ioctl_write_block_size(
if ( arg == NULL ) {
rtems_set_errno_and_return_minus_one( EINVAL );
}
- if ( flash->write_block_size == NULL ) {
+ if ( flash->get_write_block_size == NULL ) {
return 0;
} else {
- return ( *flash->write_block_size )( flash, ( (size_t *) arg ) );
+ return ( *flash->get_write_block_size )( flash, ( (size_t *) arg ) );
}
}
diff --git a/cpukit/include/dev/flash/flashdev.h b/cpukit/include/dev/flash/flashdev.h
index 59028a8cba..6244d38e3a 100644
--- a/cpukit/include/dev/flash/flashdev.h
+++ b/cpukit/include/dev/flash/flashdev.h
@@ -279,7 +279,7 @@ struct rtems_flashdev {
*
* @retval JEDEC ID.
*/
- uint32_t ( *jedec_id )(
+ uint32_t ( *get_jedec_id )(
rtems_flashdev *flash
);
@@ -292,7 +292,7 @@ struct rtems_flashdev {
* @retval 0 Success
* @retbal Other Failure
*/
- int ( *flash_type )(
+ int ( *get_flash_type )(
rtems_flashdev *flash,
rtems_flashdev_flash_type *type
);
@@ -310,7 +310,7 @@ struct rtems_flashdev {
* @retval 0 Success.
* @retval non-zero Failed.
*/
- int ( *page_info_by_offset )(
+ int ( *get_page_info_by_offset )(
rtems_flashdev *flash,
off_t search_offset,
off_t *page_offset,
@@ -329,7 +329,7 @@ struct rtems_flashdev {
* @retval 0 Success.
* @retval non-zero Failed.
*/
- int ( *page_info_by_index )(
+ int ( *get_page_info_by_index )(
rtems_flashdev *flashdev,
off_t search_index,
off_t *page_offset,
@@ -345,7 +345,7 @@ struct rtems_flashdev {
* @retval 0 Success.
* @retval non-zero Failed.
*/
- int ( *page_count )(
+ int ( *get_page_count )(
rtems_flashdev *flashdev,
int *page_count
);
@@ -359,7 +359,7 @@ struct rtems_flashdev {
* @retval 0 Success.
* @retval non-zero Failed.
*/
- int ( *write_block_size )(
+ int ( *get_write_block_size )(
rtems_flashdev *flashdev,
size_t *write_block_size
);
diff --git a/testsuites/libtests/flashdev01/test_flashdev.c b/testsuites/libtests/flashdev01/test_flashdev.c
index 708d708977..d97f5d8145 100644
--- a/testsuites/libtests/flashdev01/test_flashdev.c
+++ b/testsuites/libtests/flashdev01/test_flashdev.c
@@ -49,35 +49,35 @@ typedef struct test_flashdev {
rtems_flashdev_region regions[MAX_NUM_REGIONS];
} test_flashdev;
-int test_flashdev_page_by_off(
+int test_flashdev_get_page_by_off(
rtems_flashdev *flash,
off_t search_offset,
off_t *page_offset,
size_t *page_size
);
-int test_flashdev_page_by_index(
+int test_flashdev_get_page_by_index(
rtems_flashdev *flash,
off_t search_index,
off_t *page_offset,
size_t *page_size
);
-int test_flashdev_page_count(
+int test_flashdev_get_page_count(
rtems_flashdev *flash,
int *page_count
);
-int test_flashdev_wb_size(
+int test_flashdev_get_wb_size(
rtems_flashdev *flash,
size_t *write_block_size
);
-uint32_t test_flashdev_jedec_id(
+uint32_t test_flashdev_get_jedec_id(
rtems_flashdev* flash
);
-int test_flashdev_type(
+int test_flashdev_get_type(
rtems_flashdev* flash,
rtems_flashdev_flash_type* type
);
@@ -103,7 +103,7 @@ int test_flashdev_erase(
);
/* Find page info by offset handler */
-int test_flashdev_page_by_off(
+int test_flashdev_get_page_by_off(
rtems_flashdev *flash,
off_t search_offset,
off_t *page_offset,
@@ -116,7 +116,7 @@ int test_flashdev_page_by_off(
}
/* Find page by index handler */
-int test_flashdev_page_by_index(
+int test_flashdev_get_page_by_index(
rtems_flashdev *flash,
off_t search_index,
off_t *page_offset,
@@ -129,7 +129,7 @@ int test_flashdev_page_by_index(
}
/* Page count handler */
-int test_flashdev_page_count(
+int test_flashdev_get_page_count(
rtems_flashdev *flash,
int *page_count
)
@@ -139,7 +139,7 @@ int test_flashdev_page_count(
}
/* Write block size handler */
-int test_flashdev_wb_size(
+int test_flashdev_get_wb_size(
rtems_flashdev *flash,
size_t *write_block_size
)
@@ -151,7 +151,7 @@ int test_flashdev_wb_size(
/* JEDEC ID handler, this would normally require a READID
* call to the physical flash device.
*/
-uint32_t test_flashdev_jedec_id(
+uint32_t test_flashdev_get_jedec_id(
rtems_flashdev* flash
)
{
@@ -160,7 +160,7 @@ uint32_t test_flashdev_jedec_id(
}
/* Function to identify what kind of flash is attached. */
-int test_flashdev_type(
+int test_flashdev_get_type(
rtems_flashdev *flash,
rtems_flashdev_flash_type *type
)
@@ -263,12 +263,12 @@ rtems_flashdev* test_flashdev_init(void)
flash->read = &test_flashdev_read;
flash->write = &test_flashdev_write;
flash->erase = &test_flashdev_erase;
- flash->jedec_id = &test_flashdev_jedec_id;
- flash->flash_type = &test_flashdev_type;
- flash->page_info_by_offset = &test_flashdev_page_by_off;
- flash->page_info_by_index = &test_flashdev_page_by_index;
- flash->page_count = &test_flashdev_page_count;
- flash->write_block_size = &test_flashdev_wb_size;
+ flash->get_jedec_id = &test_flashdev_get_jedec_id;
+ flash->get_flash_type = &test_flashdev_get_type;
+ flash->get_page_info_by_offset = &test_flashdev_get_page_by_off;
+ flash->get_page_info_by_index = &test_flashdev_get_page_by_index;
+ flash->get_page_count = &test_flashdev_get_page_count;
+ flash->get_write_block_size = &test_flashdev_get_wb_size;
flash->region_table = ftable;
return flash;
--
2.34.1
More information about the devel
mailing list