Skip to content

Commit

Permalink
fatfs: consistent client to FS data region naming
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan-Velickovic <[email protected]>
  • Loading branch information
Ivan-Velickovic committed Oct 9, 2024
1 parent 9c70d55 commit ecb834d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion components/fs/fat/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ uint64_t worker_thread_stack_two;
uint64_t worker_thread_stack_three;
uint64_t worker_thread_stack_four;

char *client_data_addr;
char *fs_share;

// File system metadata region
uintptr_t fs_metadata;
Expand Down
14 changes: 7 additions & 7 deletions components/fs/fat/op.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ FIL* files;
descriptor_status* dir_status;
DIR* dirs;

// Data buffer offset
extern char *client_data_addr;
/* Data shared with client */
extern char *fs_share;

// Sanity check functions
// Checking if the memory region that provided by request is within valid memory region
Expand Down Expand Up @@ -69,7 +69,7 @@ static FRESULT validate_and_copy_path(uint64_t path, uint64_t len, char* memory)
return FR_INVALID_PARAMETER;
}
// Copy the string to our private memory
memcpy(memory, client_data_addr + path, len);
memcpy(memory, fs_share + path, len);
// Return error if the string is not NULL terminated
memory[len] = '\0';

Expand Down Expand Up @@ -256,7 +256,7 @@ void fat_pwrite(void) {
args->status = FS_STATUS_INVALID_FD;
return;
}
void* data = client_data_addr + buffer;
void* data = fs_share + buffer;

FIL* file = &(files[fd]);

Expand Down Expand Up @@ -304,7 +304,7 @@ void fat_pread(void) {
return;
}

void* data = client_data_addr + buffer;
void* data = fs_share + buffer;

// Maybe add validation check of file descriptor here
FIL* file = &(files[fd]);
Expand Down Expand Up @@ -378,7 +378,7 @@ void fat_stat(void) {
return;
}

fs_stat_t* file_stat = (fs_stat_t *)(client_data_addr + output_buffer);
fs_stat_t* file_stat = (fs_stat_t *)(fs_share + output_buffer);

LOG_FATFS("fat_stat:asking for filename: %s\n", filepath);

Expand Down Expand Up @@ -613,7 +613,7 @@ void fat_readdir(void) {
return;
}

void* name = client_data_addr + buffer;
void* name = fs_share + buffer;

FILINFO fno;
RET = f_readdir(&dirs[fd], &fno);
Expand Down
2 changes: 1 addition & 1 deletion examples/fileio/board/maaxboard/fileio.system
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
<map mr="blk_client_data" vaddr="0x40_800_000" perms="rw" cached="true" setvar_vaddr="blk_data_region" />

<map mr="fs_metadata" vaddr="0x42_000_000" perms="rw" cached="true" setvar_vaddr="fs_metadata" />
<map mr="shared_fs_micropython" vaddr="0x43_000_000" perms="rw" cached="true" setvar_vaddr="client_data_addr"/>
<map mr="shared_fs_micropython" vaddr="0x43_000_000" perms="rw" cached="true" setvar_vaddr="fs_share"/>

<map mr="fat_thread_stack1" vaddr="0xA0_000_000" perms="rw" cached="true" setvar_vaddr="worker_thread_stack_one" />
<map mr="fat_thread_stack2" vaddr="0xB0_000_000" perms="rw" cached="true" setvar_vaddr="worker_thread_stack_two" />
Expand Down
2 changes: 1 addition & 1 deletion examples/fileio/board/qemu_virt_aarch64/fileio.system
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
<map mr="blk_client_data" vaddr="0x40_800_000" perms="rw" cached="true" setvar_vaddr="blk_data_region" />

<map mr="fs_metadata" vaddr="0x42_000_000" perms="rw" cached="true" setvar_vaddr="fs_metadata" />
<map mr="shared_fs_micropython" vaddr="0x43_000_000" perms="rw" cached="true" setvar_vaddr="client_data_addr"/>
<map mr="shared_fs_micropython" vaddr="0x43_000_000" perms="rw" cached="true" setvar_vaddr="fs_share"/>

<map mr="fat_thread_stack1" vaddr="0xA0_000_000" perms="rw" cached="true" setvar_vaddr="worker_thread_stack_one" />
<map mr="fat_thread_stack2" vaddr="0xB0_000_000" perms="rw" cached="true" setvar_vaddr="worker_thread_stack_two" />
Expand Down

0 comments on commit ecb834d

Please sign in to comment.