From 970fb72923f7eb1387adc7fcc1bc70c274acaf4c Mon Sep 17 00:00:00 2001 From: jiangqianrong Date: Sat, 21 Mar 2026 15:34:25 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=20ohos=5Fmbr=5Fhelper.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jiangqianrong --- ohos/ohos_mbr_helper.h | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/ohos/ohos_mbr_helper.h b/ohos/ohos_mbr_helper.h index 75e2672..fa93bde 100644 --- a/ohos/ohos_mbr_helper.h +++ b/ohos/ohos_mbr_helper.h @@ -13,24 +13,25 @@ #include #include +#include "basicmbr.h" + // MBR operation result codes enum class MbrResult { SUCCESS = 0, ERROR_UNKNOWN = 1, ERROR_READ_FAILED = 2, ERROR_WRITE_FAILED = 3, - ERROR_INVALID_PARTITION = 4, - ERROR_INVALID_TYPECODE = 5, - ERROR_NOT_MBR_DISK = 6, - ERROR_GPT_DISK = 7, - ERROR_EMPTY_PARTITION = 8, - ERROR_INVALID_DEVICE = 9 + ERROR_INVALID_ARGUMENT = 4, + ERROR_NOT_SUPPORT_PART = 5, + ERROR_GPT_PART = 6 }; #define MIN_MBR_PARTS 1 +#define MIN_TYPE_CODE 0x01 +#define MAX_TYPE_CODE 0xFF // MBR partition type code modifier class -class OhosMbrHelper { +class OhosMbrHelper final { public: OhosMbrHelper(); ~OhosMbrHelper(); @@ -38,9 +39,6 @@ public: // Load MBR data MbrResult LoadMbrData(const std::string &device); - // Validate device path - MbrResult ValidateDevice(const std::string &device); - // Read MBR data from device MbrResult ReadMbrFromDevice(); @@ -58,17 +56,10 @@ public: // Display MBR partition table void DisplayMBRData(); - // Get error message - std::string GetLastError() const; - private: - void *mbrData_; // BasicMBRData object pointer - std::string lastError_; + BasicMBRData *mbrData_; // MBR data object pointer (initialized in constructor) std::string device_; bool loaded_; - - // Set error message - void SetError(const std::string &error); }; #endif // OHOS_MBR_HELPER_H