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_MANAGER_SERVICE_H 17 #define OHOS_STORAGE_MANAGER_VOLUME_MANAGER_SERVICE_H 18 19 #include <singleton.h> 20 #include <nocopyable.h> 21 #include "volume_core.h" 22 #include "volume_external.h" 23 #include "storage_rl_map.h" 24 25 namespace OHOS { 26 namespace StorageManager { 27 class VolumeManagerService : public NoCopyable { 28 DECLARE_DELAYED_SINGLETON(VolumeManagerService); 29 public: 30 int32_t Mount(std::string volumeId); 31 int32_t Unmount(std::string volumeId); 32 void OnVolumeCreated(VolumeCore vc); 33 void OnVolumeMounted(std::string volumeId, int32_t fsType, std::string fsUuid, 34 std::string path, std::string description); 35 void OnVolumeStateChanged(std::string volumeId, VolumeState state); 36 std::vector<VolumeExternal> GetAllVolumes(); 37 std::shared_ptr<VolumeExternal> GetVolumeByUuid(std::string volumeUuid); 38 int32_t GetVolumeByUuid(std::string fsUuid, VolumeExternal &vc); 39 int32_t GetVolumeById(std::string volumeId, VolumeExternal &vc); 40 int32_t SetVolumeDescription(std::string fsUuid, std::string description); 41 int32_t Format(std::string volumeId, std::string fsType); 42 private: 43 StorageService::StorageRlMap<std::string, std::shared_ptr<VolumeExternal>> volumeMap_; 44 void VolumeStateNotify(VolumeState state, std::shared_ptr<VolumeExternal> volume); 45 int32_t Check(std::string volumeId); 46 }; 47 } // StorageManager 48 } // OHOS 49 50 #endif // OHOS_STORAGE_MANAGER_VOLUME_MANAGER_SERVICE_H 51