1 /* 2 * Copyright (c) 2021 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 EXT2, 27 EXT3, 28 EXT4, 29 NTFS, 30 EXFAT, 31 VFAT, 32 MTP 33 }; 34 35 static std::map<int32_t, std::string> FS_TYPE_MAP = { 36 {EXT2, "ext2"}, 37 {EXT3, "ext3"}, 38 {EXT4, "ext4"}, 39 {NTFS, "ntfs"}, 40 {EXFAT, "exfat"}, 41 {VFAT, "vfat"}, 42 {MTP, "mtp"}, 43 }; 44 45 class VolumeExternal : public VolumeCore { 46 public: 47 VolumeExternal(); 48 VolumeExternal(VolumeCore vc); 49 50 void SetFlags(int32_t flags); 51 void SetFsType(int32_t fsType); 52 void SetFsUuid(std::string fsUuid); 53 void SetPath(std::string path); 54 void SetDescription(std::string description); 55 int32_t GetFlags(); 56 int32_t GetFsType(); 57 std::string GetFsTypeString(); 58 std::string GetUuid(); 59 std::string GetPath(); 60 std::string GetDescription(); 61 void Reset(); 62 63 bool Marshalling(Parcel &parcel) const override; 64 static std::unique_ptr<VolumeExternal> Unmarshalling(Parcel &parcel); 65 private: 66 int32_t fsType_ { UNDEFINED }; 67 int32_t flags_ {}; 68 std::string fsUuid_; 69 std::string path_; 70 std::string description_; 71 }; 72 } // OHOS 73 } // StorageManager 74 75 #endif // OHOS_STORAGE_MANAGER_VOLUME_EXTERNAL_H