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