From 3394b87f25df98b3b3ae8a489f80296a0bc75940 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Thu, 30 Sep 2021 01:02:27 +0800 Subject: [PATCH] fs/partition: Make read_partition_block callable outside ptable Signed-off-by: Xiang Xiao Change-Id: I42d036116783b7a08af6eb8a8f82905c485b7f91 --- fs/partition/fs_partition.c | 15 +++++++++++++++ fs/partition/fs_ptable.c | 19 ------------------- fs/partition/partition.h | 8 ++++++++ 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/fs/partition/fs_partition.c b/fs/partition/fs_partition.c index d40e9680434..110bacd4810 100644 --- a/fs/partition/fs_partition.c +++ b/fs/partition/fs_partition.c @@ -108,6 +108,21 @@ static int parse_partition(FAR struct partition_state_s *state, * Public Functions ****************************************************************************/ +int read_partition_block(FAR struct partition_state_s *state, + FAR void *buffer, size_t startblock, + size_t nblocks) +{ + if (state->blk) + { + return state->blk->u.i_bops->read(state->blk, + buffer, startblock, nblocks); + } + else + { + return state->mtd->bread(state->mtd, startblock, nblocks, buffer); + } +} + /**************************************************************************** * Name: parse_block_partition * diff --git a/fs/partition/fs_ptable.c b/fs/partition/fs_ptable.c index b83b1235a2b..541776877bd 100644 --- a/fs/partition/fs_ptable.c +++ b/fs/partition/fs_ptable.c @@ -59,25 +59,6 @@ struct ptable_s struct ptable_entry_s entries[]; }; -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -static int read_partition_block(FAR struct partition_state_s *state, - FAR void *buffer, size_t startblock, - size_t nblocks) -{ - if (state->blk) - { - return state->blk->u.i_bops->read(state->blk, - buffer, startblock, nblocks); - } - else - { - return state->mtd->bread(state->mtd, startblock, nblocks, buffer); - } -} - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/fs/partition/partition.h b/fs/partition/partition.h index df5d9174a37..2c8348ff7b9 100644 --- a/fs/partition/partition.h +++ b/fs/partition/partition.h @@ -44,6 +44,14 @@ struct partition_state_s size_t erasesize; }; +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +int read_partition_block(FAR struct partition_state_s *state, + FAR void *buffer, size_t startblock, + size_t nblocks); + #endif /* CONFIG_DISABLE_MOUNTPOINT */ #endif /* __FS_PARTITION_PARTITION_H */