From febe447ded3862669b0b9eece6205938705ffcf5 Mon Sep 17 00:00:00 2001 From: xionglei6 Date: Mon, 29 Nov 2021 11:02:37 +0800 Subject: [PATCH] init: modify fixed misc file about issue Signed-off-by: xionglei6 Change-Id: I07a14bb637e1c09022e0c79fb6de839297048987 --- interfaces/innerkits/fs_manager/fstab.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/interfaces/innerkits/fs_manager/fstab.c b/interfaces/innerkits/fs_manager/fstab.c index e8059f8d..0591065c 100755 --- a/interfaces/innerkits/fs_manager/fstab.c +++ b/interfaces/innerkits/fs_manager/fstab.c @@ -288,6 +288,23 @@ FstabItem *FindFstabItemForPath(Fstab fstab, const char *path) return item; } +int GetPartitionFilePath(const char *filePath, const char *partitionName, char *partitionPath, size_t pathSize) +{ + Fstab *fstab = NULL; + FstabItem *miscItem = NULL; + if ((fstab = ReadFstabFromFile(filePath, false)) != NULL) { + miscItem = FindFstabItemForMountPoint(*fstab, partitionName); + INIT_ERROR_CHECK(miscItem != NULL, ReleaseFstab(fstab); return -1, "Failed to find misc partition"); + } else { + FSMGR_LOGE("Failed to ReadFstabFromFile"); + return -1; + } + int ret = strcpy_s(partitionPath, pathSize, miscItem->deviceName); + INIT_ERROR_CHECK(ret == EOK, ReleaseFstab(fstab); return -1, "Failed to copy misc device name"); + ReleaseFstab(fstab); + return 0; +} + static const struct MountFlags mountFlags[] = { { "noatime", MS_NOATIME }, { "noexec", MS_NOEXEC }, @@ -382,4 +399,4 @@ unsigned long GetMountFlags(char *mountFlag, char *fsSpecificData, size_t fsSpec #if __cplusplus } #endif -#endif \ No newline at end of file +#endif -- GitLab