mirror of
https://gitee.com/openharmony/filemanagement_storage_service
synced 2024-11-23 06:59:59 +00:00
commit
729939f1ab
@ -54,11 +54,12 @@ private:
|
||||
|
||||
const std::string devPathDir_ = "/dev/block/%s";
|
||||
const std::string mountPathDir_ = "/mnt/data/external/%s";
|
||||
std::vector<std::string> supportMountType_ = { "ext2", "ext3", "ext4", "ntfs", "exfat", "vfat", "hmfs" };
|
||||
std::vector<std::string> supportMountType_ = { "ext2", "ext3", "ext4", "ntfs", "exfat", "vfat", "hmfs", "f2fs" };
|
||||
std::map<std::string, std::string> supportFormatType_ = {{"exfat", "mkfs.exfat"}, {"vfat", "newfs_msdos"}};
|
||||
|
||||
int32_t ReadMetadata();
|
||||
int32_t DoMount4Ext(uint32_t mountFlags);
|
||||
int32_t DoMount4Hmfs(uint32_t mountFlags);
|
||||
int32_t DoMount4Ntfs(uint32_t mountFlags);
|
||||
int32_t DoMount4Exfat(uint32_t mountFlags);
|
||||
int32_t DoMount4OtherType(uint32_t mountFlags);
|
||||
|
@ -110,6 +110,17 @@ int32_t ExternalVolumeInfo::DoMount4Ext(uint32_t mountFlags)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t ExternalVolumeInfo::DoMount4Hmfs(uint32_t mountFlags)
|
||||
{
|
||||
mode_t mode = 0777;
|
||||
const char *fsType = "hmfs";
|
||||
int32_t ret = mount(devPath_.c_str(), mountPath_.c_str(), fsType, mountFlags, "");
|
||||
if (!ret) {
|
||||
TravelChmod(mountPath_, mode);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t ExternalVolumeInfo::DoMount4Ntfs(uint32_t mountFlags)
|
||||
{
|
||||
auto mountData = StringPrintf("rw,uid=%d,gid=%d,dmask=0007,fmask=0007", UID_FILE_MANAGER, UID_FILE_MANAGER);
|
||||
@ -174,8 +185,10 @@ int32_t ExternalVolumeInfo::DoMount(uint32_t mountFlags)
|
||||
}
|
||||
|
||||
LOGI("Ready to mount: external volume fstype is %{public}s, mountflag is %{public}d", fsType_.c_str(), mountFlags);
|
||||
if (fsType_ == "ext2" || fsType_ == "ext3" || fsType_ == "ext4" || fsType_ == "hmfs") {
|
||||
if (fsType_ == "ext2" || fsType_ == "ext3" || fsType_ == "ext4") {
|
||||
ret = DoMount4Ext(mountFlags);
|
||||
} else if (fsType_ == "hmfs" || fsType_ == "f2fs") {
|
||||
ret = DoMount4Hmfs(mountFlags);
|
||||
} else if (fsType_ == "ntfs") {
|
||||
ret = DoMount4Ntfs(mountFlags);
|
||||
} else if (fsType_ == "exfat") {
|
||||
|
Loading…
Reference in New Issue
Block a user