mirror of
https://github.com/DarkMatterCore/nxdumptool.git
synced 2024-12-28 11:26:03 +00:00
94f0312566
The BIS storage interface is now initialized by utilsInitializeResources() via bisStorageInitialize(). It takes care of mounting all eMMC FAT partitions in read-only mode, making it possible for the rest of the code to interact with them at any time without having to manually mount them beforehand. Other changes include: * bis_storage: add bisStorageExit(). * bis_storage: add bisStorageGetGptPartitionNameByBisPartitionId(), bisStorageGetSystemInitializerPartitionNameByBisPartitionId() and bisStorageGetMountNameByBisPartitionId() helpers. * bis_storage: change bisStorageMountPartition(), bisStorageUnmountPartition() and bisStorageUnmountAllPartitions() to static functions. * bis_storage: mount FAT partitions with FatFs by using drive numbers instead of arbitrary strings. * cert: update code to reflect BIS storage interface changes. * defines: add BIS_FAT_PARTITION_COUNT macro. * fatfs/ffconf: use BIS_FAT_PARTITION_COUNT macro as the value for the FF_VOLUMES macro. * fatfs/ffconf: disable arbitrary string support for volume IDs. * nxdt_devoptab: increase concurrent mounted device count to 8. * nxdt_utils: add missing underscores to anonymous variables in SCOPED_LOCK and SCOPED_TRY_LOCK macros. * nxdt_utils: take care of BIS storage interface (de)initialization. * poc: update code to reflect BIS storage interface changes. * tik: update code to reflect BIS storage interface changes.
66 lines
3.3 KiB
C
66 lines
3.3 KiB
C
/*
|
|
* bis_storage.h
|
|
*
|
|
* Copyright (c) 2020-2024, DarkMatterCore <pabloacurielz@gmail.com>.
|
|
*
|
|
* This file is part of nxdumptool (https://github.com/DarkMatterCore/nxdumptool).
|
|
*
|
|
* nxdumptool is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* nxdumptool is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#ifndef __BIS_STORAGE_H__
|
|
#define __BIS_STORAGE_H__
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/// Mounts the eMMC partitions with IDs `CalibrationFile` (28) through `System` (31) and makes it possible to perform read-only FS operations with them.
|
|
/// The mount name for each partition can be retrieved via bisStorageGetMountNameByBisPartitionId().
|
|
bool bisStorageInitialize(void);
|
|
|
|
/// Unmounts all previously mounted eMMC partitions.
|
|
void bisStorageExit(void);
|
|
|
|
/// Returns a pointer to a string that holds the GPT partition name for the provided eMMC BIS partition ID (e.g. FsBisPartitionId_CalibrationFile -> "PRODINFOF").
|
|
/// Only eMMC BIS partition IDs `CalibrationFile` (28) through `System` (31) are supported.
|
|
/// Returns NULL if the eMMC BIS storage interface hasn't been initialized yet, or if an unsupported eMMC BIS partition ID is provided.
|
|
const char *bisStorageGetGptPartitionNameByBisPartitionId(u8 bis_partition_id);
|
|
|
|
/// Returns a pointer to a string that holds the SystemInitializer partition name for the provided eMMC BIS partition ID (e.g. FsBisPartitionId_CalibrationFile -> "CalibrationFile").
|
|
/// Only eMMC BIS partition IDs `CalibrationFile` (28) through `System` (31) are supported.
|
|
/// Returns NULL if the eMMC BIS storage interface hasn't been initialized yet, or if an unsupported eMMC BIS partition ID is provided.
|
|
const char *bisStorageGetSystemInitializerPartitionNameByBisPartitionId(u8 bis_partition_id);
|
|
|
|
/// Returns a pointer to a string that holds the mount name for the provided eMMC BIS partition ID (e.g. FsBisPartitionId_CalibrationFile -> "bisprodinfof").
|
|
/// This can be used to perform read-only FS operations on a specific partition.
|
|
/// Only eMMC BIS partition IDs `CalibrationFile` (28) through `System` (31) are supported.
|
|
/// Returns NULL if the eMMC BIS storage interface hasn't been initialized yet, or if an unsupported eMMC BIS partition ID is provided.
|
|
const char *bisStorageGetMountNameByBisPartitionId(u8 bis_partition_id);
|
|
|
|
/// Returns a pointer to a FsStorage object that matches the provided FatFs drive number, or NULL if it hasn't been mounted.
|
|
/// Only used by FatFs's diskio operations.
|
|
FsStorage *bisStorageGetFsStorageByFatFsDriveNumber(u8 drive_number);
|
|
|
|
/// (Un)locks the BIS storage mutex. Can be used to block other threads and prevent them from altering the internal status of this interface.
|
|
/// Use with caution.
|
|
void bisStorageControlMutex(bool lock);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* __BIS_STORAGE_H__ */
|