[rtems commit] imfs: Constify rtems_tarfs_load()
Sebastian Huber
sebh at rtems.org
Thu Nov 2 12:17:22 UTC 2023
Module: rtems
Branch: master
Commit: 51d596281c86461373462e2cdd187a03786b9ff4
Changeset: http://git.rtems.org/rtems/commit/?id=51d596281c86461373462e2cdd187a03786b9ff4
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Oct 20 10:01:35 2023 +0200
imfs: Constify rtems_tarfs_load()
Change the public image data type to a void pointer.
---
cpukit/include/rtems/imfs.h | 2 +-
cpukit/libfs/src/imfs/imfs_load_tar.c | 8 +++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/cpukit/include/rtems/imfs.h b/cpukit/include/rtems/imfs.h
index 7db9b4e462..405f489ab3 100644
--- a/cpukit/include/rtems/imfs.h
+++ b/cpukit/include/rtems/imfs.h
@@ -477,7 +477,7 @@ extern void IMFS_fsunmount(
*/
extern int rtems_tarfs_load(
const char *mountpoint,
- uint8_t *tar_image,
+ const void *tar_image,
size_t tar_size
);
diff --git a/cpukit/libfs/src/imfs/imfs_load_tar.c b/cpukit/libfs/src/imfs/imfs_load_tar.c
index ec651d820a..18c5366b56 100644
--- a/cpukit/libfs/src/imfs/imfs_load_tar.c
+++ b/cpukit/libfs/src/imfs/imfs_load_tar.c
@@ -45,7 +45,7 @@
int rtems_tarfs_load(
const char *mountpoint,
- uint8_t *tar_image,
+ const void *tar_image,
size_t tar_size
)
{
@@ -57,6 +57,7 @@ int rtems_tarfs_load(
size_t len;
Untar_HeaderContext ctx;
unsigned long ptr;
+ const uint8_t *image;
len = strlen( mountpoint );
if ( len >= sizeof( buf ) - UNTAR_FILE_NAME_SIZE - 2 ) {
@@ -82,11 +83,12 @@ int rtems_tarfs_load(
}
ptr = 0;
+ image = tar_image;
while ( ptr + 512 <= tar_size ) {
int retval;
- retval = Untar_ProcessHeader( &ctx, (const char *) &tar_image[ ptr ] );
+ retval = Untar_ProcessHeader( &ctx, (const char *) &image[ ptr ] );
if ( retval != UNTAR_SUCCESSFUL ) {
return -1;
}
@@ -97,7 +99,7 @@ int rtems_tarfs_load(
retval = IMFS_make_linearfile(
ctx.file_path,
ctx.mode,
- &tar_image[ ptr ],
+ &image[ ptr ],
ctx.file_size
);
if ( retval != 0 ) {
More information about the vc
mailing list