• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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_MANAGER_SERVICE_EXT_H
17 #define OHOS_STORAGE_MANAGER_VOLUME_MANAGER_SERVICE_EXT_H
18 
19 #include <mutex>
20 #include "volume_external.h"
21 
22 namespace OHOS {
23 namespace StorageManager {
24 
25 class FuseExtInterface {
26 public:
27     virtual ~FuseExtInterface() = default;
28     virtual bool NotifyExternalVolumeFuseMount(int fd, std::string volumeId, std::string fsUuid) = 0;
29     virtual bool NotifyExternalVolumeFuseUMount(std::string volumeId) = 0;
30 };
31 
32 class VolumeManagerServiceExt {
33 public:
GetInstance(void)34     static VolumeManagerServiceExt &GetInstance(void)
35     {
36         static VolumeManagerServiceExt instance;
37         return instance;
38     }
39 
40     int32_t NotifyUsbFuseMount(int fuseFd, const std::string &volumeId, const std::string &fsUuid);
41     int32_t NotifyUsbFuseUmount(const std::string &volumeId);
42 
43 private:
44     VolumeManagerServiceExt();
45     ~VolumeManagerServiceExt();
46     VolumeManagerServiceExt(const VolumeManagerServiceExt &) = delete;
47     VolumeManagerServiceExt &operator=(const VolumeManagerServiceExt &) = delete;
48     VolumeManagerServiceExt(const VolumeManagerServiceExt &&) = delete;
49     VolumeManagerServiceExt &operator=(const VolumeManagerServiceExt &&) = delete;
50 
51     void Init();
52     void UnInit();
53     void *handler_ = nullptr;
54 };
55 } // StorageManager
56 } // OHOS
57 
58 #endif // OHOS_STORAGE_MANAGER_VOLUME_MANAGER_SERVICE_EXT_H