1 /* 2 * Copyright (c) 2021-2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_STORAGE_MANAGER_VOLUME_EXTERNAL_H 17 #define OHOS_STORAGE_MANAGER_VOLUME_EXTERNAL_H 18 19 #include <map> 20 #include "volume_core.h" 21 22 namespace OHOS { 23 namespace StorageManager { 24 enum FsType { 25 UNDEFINED = -1, 26 NTFS, 27 EXFAT, 28 VFAT, 29 HMFS, 30 F2FS, 31 MTP 32 }; 33 34 static std::map<int32_t, std::string> FS_TYPE_MAP = { 35 {NTFS, "ntfs"}, 36 {EXFAT, "exfat"}, 37 {VFAT, "vfat"}, 38 {HMFS, "hmfs"}, 39 {F2FS, "f2fs"}, 40 {MTP, "mtp"}, 41 }; 42 43 class VolumeExternal : public VolumeCore { 44 public: 45 VolumeExternal(); 46 VolumeExternal(VolumeCore vc); 47 48 void SetFlags(int32_t flags); 49 void SetFsType(int32_t fsType); 50 void SetFsUuid(std::string fsUuid); 51 void SetPath(std::string path); 52 void SetDescription(std::string description); 53 int32_t GetFlags(); 54 int32_t GetFsType(); 55 std::string GetFsTypeString(); 56 std::string GetUuid(); 57 std::string GetPath(); 58 std::string GetDescription(); 59 int32_t GetFsTypeByStr(const std::string &fsTypeStr); 60 void Reset(); 61 62 bool Marshalling(Parcel &parcel) const override; 63 static VolumeExternal *Unmarshalling(Parcel &parcel); 64 private: 65 int32_t fsType_ { UNDEFINED }; 66 int32_t flags_ {}; 67 std::string fsUuid_; 68 std::string path_; 69 std::string description_; 70 }; 71 } // OHOS 72 } // StorageManager 73 74 #endif // OHOS_STORAGE_MANAGER_VOLUME_EXTERNAL_H