fs/partition: Make read_partition_block callable outside ptable
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
b5134565fa
commit
eb720388ca
@ -108,6 +108,21 @@ static int parse_partition(FAR struct partition_state_s *state,
|
|||||||
* Public Functions
|
* 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
|
* Name: parse_block_partition
|
||||||
*
|
*
|
||||||
|
@ -59,25 +59,6 @@ struct ptable_s
|
|||||||
struct ptable_entry_s entries[];
|
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
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -44,6 +44,14 @@ struct partition_state_s
|
|||||||
size_t erasesize;
|
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 /* CONFIG_DISABLE_MOUNTPOINT */
|
||||||
|
|
||||||
#endif /* __FS_PARTITION_PARTITION_H */
|
#endif /* __FS_PARTITION_PARTITION_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user