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_DAEMON_ISTORAGE_DAEMON_H 17 #define OHOS_STORAGE_DAEMON_ISTORAGE_DAEMON_H 18 19 #include <string> 20 #include "iremote_broker.h" 21 22 namespace OHOS { 23 namespace StorageDaemon { 24 class IStorageDaemon : public IRemoteBroker { 25 public: 26 enum { 27 CRYPTO_FLAG_EL1 = 1, 28 CRYPTO_FLAG_EL2, 29 }; 30 31 virtual int32_t Shutdown() = 0; 32 33 virtual int32_t Mount(std::string volId, uint32_t flags) = 0; 34 virtual int32_t UMount(std::string volId) = 0; 35 virtual int32_t Check(std::string volId) = 0; 36 virtual int32_t Format(std::string volId, std::string fsType) = 0; 37 virtual int32_t Partition(std::string diskId, int32_t type) = 0; 38 virtual int32_t SetVolumeDescription(std::string volId, std::string description) = 0; 39 40 virtual int32_t StartUser(int32_t userId) = 0; 41 virtual int32_t StopUser(int32_t userId) = 0; 42 virtual int32_t PrepareUserDirs(int32_t userId, uint32_t flags) = 0; 43 virtual int32_t DestroyUserDirs(int32_t userId, uint32_t flags) = 0; 44 45 // fscrypt api 46 virtual int32_t InitGlobalKey(void) = 0; 47 virtual int32_t InitGlobalUserKeys(void) = 0; 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, uint64_t secureUid, 51 const std::vector<uint8_t> &token, 52 const std::vector<uint8_t> &oldSecret, 53 const std::vector<uint8_t> &newSecret) = 0; 54 virtual int32_t ActiveUserKey(uint32_t userId, 55 const std::vector<uint8_t> &token, 56 const std::vector<uint8_t> &secret) = 0; 57 virtual int32_t InactiveUserKey(uint32_t userId) = 0; 58 virtual int32_t UpdateKeyContext(uint32_t userId) = 0; 59 60 // app file share api 61 virtual int32_t CreateShareFile(std::string uri, uint32_t tokenId, uint32_t flag) = 0; 62 virtual int32_t DeleteShareFile(uint32_t tokenId, std::vector<std::string>sharePathList) = 0; 63 SetBundleQuota(const std::string & bundleName,int32_t uid,const std::string & bundleDataDirPath,int32_t limitSizeMb)64 virtual int32_t SetBundleQuota(const std::string &bundleName, int32_t uid, 65 const std::string &bundleDataDirPath, int32_t limitSizeMb) 66 { 67 return 0; 68 } 69 70 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.StorageDaemon"); 71 }; 72 } // STORAGE_DAEMON 73 } // OHOS 74 75 #endif // OHOS_STORAGE_DAEMON_ISTORAGE_DAEMON_H 76