• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_ISTORAGE_MANAGER_H
17 #define OHOS_STORAGE_MANAGER_ISTORAGE_MANAGER_H
18 
19 #include "iremote_broker.h"
20 #include "volume_core.h"
21 #include "volume_external.h"
22 #include "disk.h"
23 
24 namespace OHOS {
25 namespace StorageManager {
26 class IStorageManager : public IRemoteBroker {
27 public:
28     virtual int32_t PrepareAddUser(int32_t userId, uint32_t flags) = 0;
29     virtual int32_t RemoveUser(int32_t userId, uint32_t flags) = 0;
30     virtual int32_t PrepareStartUser(int32_t userId) = 0;
31     virtual int32_t StopUser(int32_t userId) = 0;
32     virtual int64_t GetFreeSizeOfVolume(std::string volumeUuid) = 0;
33     virtual int64_t GetTotalSizeOfVolume(std::string volumeUuid) = 0;
34     virtual std::vector<int64_t> GetBundleStats(std::string pkgName) = 0;
35     virtual void NotifyVolumeCreated(VolumeCore vc) = 0;
36     virtual void NotifyVolumeMounted(std::string volumeId, int fsType, std::string fsUuid,
37                                      std::string path, std::string description) = 0;
38     virtual void NotifyVolumeDestroyed(std::string volumeId) = 0;
39     virtual int32_t Mount(std::string volumeId) = 0;
40     virtual int32_t Unmount(std::string volumeId) = 0;
41     virtual std::vector<VolumeExternal> GetAllVolumes() = 0;
42     virtual void NotifyDiskCreated(Disk disk) = 0;
43     virtual void NotifyDiskDestroyed(std::string diskId) = 0;
44     virtual int32_t Partition(std::string diskId, int32_t type) = 0;
45     virtual std::vector<Disk> GetAllDisks() = 0;
46 
47     // fscrypt api
48     virtual int32_t GenerateUserKeys(uint32_t userId, uint32_t flags) = 0;
49     virtual int32_t DeleteUserKeys(uint32_t userId) = 0;
50     virtual int32_t UpdateUserAuth(uint32_t userId, std::string auth, std::string compSecret) = 0;
51     virtual int32_t ActiveUserKey(uint32_t userId, std::string auth, std::string compSecret) = 0;
52     virtual int32_t InactiveUserKey(uint32_t userId) = 0;
53     virtual int32_t UpdateKeyContext(uint32_t userId) = 0;
54 
55     enum {
56         PREPARE_ADD_USER = 1,
57         REMOVE_USER,
58         PREPARE_START_USER,
59         STOP_USER,
60         GET_TOTAL,
61         GET_FREE,
62         GET_BUNDLE_STATUS,
63         NOTIFY_VOLUME_CREATED,
64         NOTIFY_VOLUME_MOUNTED,
65         NOTIFY_VOLUME_DESTROYED,
66         MOUNT,
67         UNMOUNT,
68         GET_ALL_VOLUMES,
69         NOTIFY_DISK_CREATED,
70         NOTIFY_DISK_DESTROYED,
71         PARTITION,
72         GET_ALL_DISKS,
73         CREATE_USER_KEYS,
74         DELETE_USER_KEYS,
75         UPDATE_USER_AUTH,
76         ACTIVE_USER_KEY,
77         INACTIVE_USER_KEY,
78         UPDATE_KEY_CONTEXT,
79     };
80 
81     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.StorageManager.IStorageManager");
82 };
83 } // StorageManager
84 } // OHOS
85 
86 #endif // OHOS_STORAGE_MANAGER_ISTORAGER_MANAGER_H