parent
1a3f3f54e7
commit
6352d6e1da
|
@ -35,14 +35,8 @@
|
|||
#include "unistd.h"
|
||||
#include "sys/mount.h"
|
||||
#include "linux/spinlock.h"
|
||||
|
||||
#include "fs/path_cache.h"
|
||||
|
||||
#ifdef LOSCFG_DRIVERS_MMC
|
||||
#include "mmc/block.h"
|
||||
#endif
|
||||
|
||||
|
||||
los_disk g_sysDisk[SYS_MAX_DISK];
|
||||
los_part g_sysPart[SYS_MAX_PART];
|
||||
|
||||
|
@ -1685,13 +1679,17 @@ VOID show_part(los_part *part)
|
|||
PRINTK("part sec count : %llu\n", part->sector_count);
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_DRIVERS_MMC
|
||||
ssize_t StorageBlockMmcErase(uint32_t blockId, size_t secStart, size_t secNr);
|
||||
#endif
|
||||
|
||||
INT32 EraseDiskByID(UINT32 diskID, size_t startSector, UINT32 sectors)
|
||||
{
|
||||
INT32 ret = VFS_ERROR;
|
||||
#ifdef LOSCFG_DRIVERS_MMC
|
||||
los_disk *disk = get_disk((INT32)diskID);
|
||||
if (disk != NULL) {
|
||||
ret = do_mmc_erase(diskID, startSector, sectors);
|
||||
ret = StorageBlockMmcErase(diskID, startSector, sectors);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "mtd_partition.h"
|
||||
#endif
|
||||
#ifdef LOSCFG_DRIVERS_MMC
|
||||
#include "mmc/block.h"
|
||||
#include "disk.h"
|
||||
#endif
|
||||
#include "sys/mount.h"
|
||||
|
@ -103,18 +102,22 @@ los_disk *GetMmcDisk(UINT8 type)
|
|||
#endif
|
||||
|
||||
#ifdef LOSCFG_STORAGE_EMMC
|
||||
struct disk_divide_info *StorageBlockGetEmmc(void);
|
||||
struct block_operations *StorageBlockGetMmcOps(void);
|
||||
char *StorageBlockGetEmmcNodeName(void *block);
|
||||
|
||||
STATIC const CHAR *AddEmmcRootfsPart(INT32 rootAddr, INT32 rootSize)
|
||||
{
|
||||
INT32 ret;
|
||||
|
||||
struct mmc_block *block = (struct mmc_block *)((struct drv_data *)g_emmcDisk->dev->data)->priv;
|
||||
const char *node_name = mmc_block_get_node_name(block);
|
||||
void *block = ((struct drv_data *)g_emmcDisk->dev->data)->priv;
|
||||
const char *node_name = StorageBlockGetEmmcNodeName(block);
|
||||
if (los_disk_deinit(g_emmcDisk->disk_id) != ENOERR) {
|
||||
PRINT_ERR("Failed to deinit emmc disk!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct disk_divide_info *emmc = get_emmc();
|
||||
struct disk_divide_info *emmc = StorageBlockGetEmmc();
|
||||
ret = add_mmc_partition(emmc, rootAddr / EMMC_SEC_SIZE, rootSize / EMMC_SEC_SIZE);
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("Failed to add mmc root partition!\n");
|
||||
|
@ -138,7 +141,7 @@ STATIC const CHAR *AddEmmcRootfsPart(INT32 rootAddr, INT32 rootSize)
|
|||
PRINT_ERR("Failed to alloc disk %s!\n", node_name);
|
||||
return NULL;
|
||||
}
|
||||
if (los_disk_init(node_name, mmc_block_get_bops(block), (void *)block, diskId, emmc) != ENOERR) {
|
||||
if (los_disk_init(node_name, StorageBlockGetMmcOps(), block, diskId, emmc) != ENOERR) {
|
||||
PRINT_ERR("Failed to init emmc disk!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue