1 /*
2 * Copyright (c) 2022 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 #include "storage_daemon_client.h"
17 #include "iservice_registry.h"
18 #include "libfscrypt/fscrypt_utils.h"
19 #include "storage_service_errno.h"
20 #include "storage_service_log.h"
21 #include "system_ability_definition.h"
22 #include "utils/storage_radar.h"
23
24 using namespace OHOS::StorageService;
25 namespace {
26 constexpr uint32_t STORAGE_DAEMON_SFIFT = 1;
27 constexpr uint32_t CHECK_SERVICE_TIMES = 1000;
28 constexpr uint32_t LOG_CHECK_INTERVAL = 50;
29 constexpr uint32_t SLEEP_TIME_PRE_CHECK = 20; // 20ms
30 constexpr uint32_t STORAGE_SERVICE_FLAG = (1 << STORAGE_DAEMON_SFIFT);
31 constexpr int32_t STORAGE_DAEMON_SAID = OHOS::STORAGE_MANAGER_DAEMON_ID;
32 }
33
34 namespace OHOS {
35 namespace StorageDaemon {
GetStorageDaemonProxy(void)36 sptr<IStorageDaemon> StorageDaemonClient::GetStorageDaemonProxy(void)
37 {
38 auto samgr = OHOS::SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
39 if (samgr == nullptr) {
40 LOGE("samgr empty error");
41 return nullptr;
42 }
43
44 sptr<IRemoteObject> object = samgr->GetSystemAbility(OHOS::STORAGE_MANAGER_DAEMON_ID);
45 if (object == nullptr) {
46 LOGE("storage daemon client samgr ablity empty error");
47 return nullptr;
48 }
49
50 return iface_cast<IStorageDaemon>(object);
51 }
52
CheckServiceStatus(uint32_t serviceFlags)53 int32_t StorageDaemonClient::CheckServiceStatus(uint32_t serviceFlags)
54 {
55 LOGW("CheckServiceStatus start");
56
57 auto samgr = OHOS::SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
58 if (samgr == nullptr) {
59 LOGW("samgr is nullptr, retry");
60 for (uint32_t i = 0; i < CHECK_SERVICE_TIMES; i++) {
61 samgr = OHOS::SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
62 if (samgr != nullptr) {
63 break;
64 }
65 if (i % LOG_CHECK_INTERVAL == 0) {
66 LOGW("check samgr %{public}u times", i);
67 }
68 std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_PRE_CHECK));
69 }
70 if (samgr == nullptr) {
71 LOGE("samgr is nullptr, retry failed.");
72 return E_SA_IS_NULLPTR;
73 }
74 }
75
76 if (serviceFlags & STORAGE_SERVICE_FLAG) {
77 bool exist = false;
78 for (uint32_t i = 0; i < CHECK_SERVICE_TIMES; i++) {
79 auto object = samgr->CheckSystemAbility(STORAGE_DAEMON_SAID, exist);
80 if (object != nullptr) {
81 break;
82 }
83 if (i % LOG_CHECK_INTERVAL == 0) {
84 LOGW("check storage daemon status %{public}u times", i);
85 }
86 std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_PRE_CHECK));
87 }
88 if (exist == false) {
89 LOGE("storage daemon service system ability error");
90 return E_SERVICE_IS_NULLPTR;
91 }
92 }
93 LOGW("CheckServiceStatus end, success");
94
95 return E_OK;
96 }
97
PrepareUserDirs(int32_t userId,uint32_t flags)98 int32_t StorageDaemonClient::PrepareUserDirs(int32_t userId, uint32_t flags)
99 {
100 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
101 if (status != E_OK) {
102 LOGE("service check failed");
103 std::string extraData = "flags=" + std::to_string(flags);
104 StorageRadar::ReportUserManager("PrepareUserDirs::CheckServiceStatus", userId, status, extraData);
105 return status;
106 }
107
108 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
109 if (client == nullptr) {
110 LOGE("get storage daemon service failed");
111 std::string extraData = "flags=" + std::to_string(flags);
112 StorageRadar::ReportUserManager("PrepareUserDirs::GetStorageDaemonProxy", userId, E_SA_IS_NULLPTR, extraData);
113 return E_SA_IS_NULLPTR;
114 }
115 return client->PrepareUserDirs(userId, flags);
116 }
117
DestroyUserDirs(int32_t userId,uint32_t flags)118 int32_t StorageDaemonClient::DestroyUserDirs(int32_t userId, uint32_t flags)
119 {
120 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
121 if (status != E_OK) {
122 LOGE("service check failed");
123 std::string extraData = "flags=" + std::to_string(flags);
124 StorageRadar::ReportUserManager("DestroyUserDirs::CheckServiceStatus", userId, status, extraData);
125 return status;
126 }
127
128 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
129 if (client == nullptr) {
130 LOGE("get storage daemon service failed");
131 std::string extraData = "flags=" + std::to_string(flags);
132 StorageRadar::ReportUserManager("DestroyUserDirs::GetStorageDaemonProxy", userId, E_SA_IS_NULLPTR, extraData);
133 return E_SA_IS_NULLPTR;
134 }
135 return client->DestroyUserDirs(userId, flags);
136 }
137
StartUser(int32_t userId)138 int32_t StorageDaemonClient::StartUser(int32_t userId)
139 {
140 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
141 if (status != E_OK) {
142 LOGE("service check failed");
143 StorageRadar::ReportUserManager("StartUser::CheckServiceStatus", userId, status, "");
144 return status;
145 }
146
147 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
148 if (client == nullptr) {
149 LOGE("get storage daemon service failed");
150 StorageRadar::ReportUserManager("StartUser::GetStorageDaemonProxy", userId, E_SA_IS_NULLPTR, "");
151 return E_SA_IS_NULLPTR;
152 }
153
154 return client->StartUser(userId);
155 }
156
StopUser(int32_t userId)157 int32_t StorageDaemonClient::StopUser(int32_t userId)
158 {
159 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
160 if (status != E_OK) {
161 LOGE("service check failed");
162 StorageRadar::ReportUserManager("StartUser::CheckServiceStatus", userId, status, "");
163 return status;
164 }
165
166 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
167 if (client == nullptr) {
168 LOGE("get storage daemon service failed");
169 StorageRadar::ReportUserManager("StartUser::GetStorageDaemonProxy", userId, E_SA_IS_NULLPTR, "");
170 return E_SA_IS_NULLPTR;
171 }
172
173 return client->StopUser(userId);
174 }
175
PrepareUserSpace(uint32_t userId,const std::string & volumId,uint32_t flags)176 int32_t StorageDaemonClient::PrepareUserSpace(uint32_t userId, const std::string &volumId, uint32_t flags)
177 {
178 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
179 if (status != E_OK) {
180 LOGE("service check failed");
181 return status;
182 }
183
184 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
185 if (client == nullptr) {
186 LOGE("get storage daemon service failed");
187 return E_SA_IS_NULLPTR;
188 }
189
190 return client->PrepareUserDirs(userId, flags);
191 }
192
DestroyUserSpace(uint32_t userId,const std::string & volumId,uint32_t flags)193 int32_t StorageDaemonClient::DestroyUserSpace(uint32_t userId, const std::string &volumId, uint32_t flags)
194 {
195 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
196 if (status != E_OK) {
197 LOGE("service check failed");
198 return status;
199 }
200
201 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
202 if (client == nullptr) {
203 LOGE("get storage daemon service failed");
204 return E_SA_IS_NULLPTR;
205 }
206
207 return client->DestroyUserDirs(userId, flags);
208 }
209
InitGlobalKey(void)210 int32_t StorageDaemonClient::InitGlobalKey(void)
211 {
212 int32_t status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
213 if (status != E_OK) {
214 LOGE("service check failed");
215 StorageRadar::ReportUserKeyResult("InitGlobalKey::CheckServiceStatus", 0, status, "EL1", "");
216 return status;
217 }
218
219 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
220 if (client == nullptr) {
221 LOGE("get storage daemon service failed");
222 StorageRadar::ReportUserKeyResult("InitGlobalKey::GetStorageDaemonProxy", 0, E_SA_IS_NULLPTR, "EL1", "");
223 return E_SA_IS_NULLPTR;
224 }
225
226 return client->InitGlobalKey();
227 }
228
InitGlobalUserKeys(void)229 int32_t StorageDaemonClient::InitGlobalUserKeys(void)
230 {
231 int32_t status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
232 if (status != E_OK) {
233 LOGE("service check failed");
234 StorageRadar::ReportUserKeyResult("InitGlobalUserKeys::CheckServiceStatus", 0, status, "EL1", "");
235 return status;
236 }
237
238 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
239 if (client == nullptr) {
240 LOGE("get storage daemon service failed");
241 StorageRadar::ReportUserKeyResult("InitGlobalUserKeys::GetStorageDaemonProxy", 0, E_SA_IS_NULLPTR, "EL1", "");
242 return E_SA_IS_NULLPTR;
243 }
244
245 return client->InitGlobalUserKeys();
246 }
247
GenerateUserKeys(uint32_t userId,uint32_t flags)248 int32_t StorageDaemonClient::GenerateUserKeys(uint32_t userId, uint32_t flags)
249 {
250 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
251 if (status != E_OK) {
252 LOGE("service check failed");
253 return status;
254 }
255
256 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
257 if (client == nullptr) {
258 LOGE("get storage daemon service failed");
259 return E_SA_IS_NULLPTR;
260 }
261
262 return client->GenerateUserKeys(userId, flags);
263 }
264
DeleteUserKeys(uint32_t userId)265 int32_t StorageDaemonClient::DeleteUserKeys(uint32_t userId)
266 {
267 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
268 if (status != E_OK) {
269 LOGE("service check failed");
270 return status;
271 }
272
273 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
274 if (client == nullptr) {
275 LOGE("get storage daemon service failed");
276 return E_SA_IS_NULLPTR;
277 }
278
279 return client->DeleteUserKeys(userId);
280 }
281
UpdateUserAuth(uint32_t userId,uint64_t secureUid,const std::vector<uint8_t> & token,const std::vector<uint8_t> & oldSecret,const std::vector<uint8_t> & newSecret)282 int32_t StorageDaemonClient::UpdateUserAuth(uint32_t userId, uint64_t secureUid,
283 const std::vector<uint8_t> &token,
284 const std::vector<uint8_t> &oldSecret,
285 const std::vector<uint8_t> &newSecret)
286 {
287 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
288 if (status != E_OK) {
289 LOGE("service check failed");
290 return status;
291 }
292
293 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
294 if (client == nullptr) {
295 LOGE("get storage daemon service failed");
296 return E_SA_IS_NULLPTR;
297 }
298
299 return client->UpdateUserAuth(userId, secureUid, token, oldSecret, newSecret);
300 }
301
UpdateUseAuthWithRecoveryKey(const std::vector<uint8_t> & authToken,const std::vector<uint8_t> & newSecret,uint64_t secureUid,uint32_t userId,std::vector<std::vector<uint8_t>> & plainText)302 int32_t StorageDaemonClient::UpdateUseAuthWithRecoveryKey(const std::vector<uint8_t> &authToken,
303 const std::vector<uint8_t> &newSecret,
304 uint64_t secureUid,
305 uint32_t userId,
306 std::vector<std::vector<uint8_t>> &plainText)
307 {
308 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
309 if (status != E_OK) {
310 LOGE("service check failed");
311 return status;
312 }
313
314 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
315 if (client == nullptr) {
316 LOGE("get storage daemon service failed");
317 return E_SA_IS_NULLPTR;
318 }
319
320 return client->UpdateUseAuthWithRecoveryKey(authToken, newSecret, secureUid, userId, plainText);
321 }
322
ActiveUserKey(uint32_t userId,const std::vector<uint8_t> & token,const std::vector<uint8_t> & secret)323 int32_t StorageDaemonClient::ActiveUserKey(uint32_t userId,
324 const std::vector<uint8_t> &token,
325 const std::vector<uint8_t> &secret)
326 {
327 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
328 if (status != E_OK) {
329 LOGE("service check failed");
330 return status;
331 }
332
333 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
334 if (client == nullptr) {
335 LOGE("get storage daemon service failed");
336 return E_SA_IS_NULLPTR;
337 }
338
339 return client->ActiveUserKey(userId, token, secret);
340 }
341
InactiveUserKey(uint32_t userId)342 int32_t StorageDaemonClient::InactiveUserKey(uint32_t userId)
343 {
344 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
345 if (status != E_OK) {
346 LOGE("service check failed");
347 return status;
348 }
349 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
350 if (client == nullptr) {
351 LOGE("get storage daemon service failed");
352 return E_SA_IS_NULLPTR;
353 }
354
355 return client->InactiveUserKey(userId);
356 }
357
LockUserScreen(uint32_t userId)358 int32_t StorageDaemonClient::LockUserScreen(uint32_t userId)
359 {
360 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
361 if (status != E_OK) {
362 LOGE("service check failed");
363 return status;
364 }
365
366 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
367 if (client == nullptr) {
368 LOGE("get storage daemon service failed");
369 return E_SA_IS_NULLPTR;
370 }
371
372 return client->LockUserScreen(userId);
373 }
374
UnlockUserScreen(uint32_t userId,const std::vector<uint8_t> & token,const std::vector<uint8_t> & secret)375 int32_t StorageDaemonClient::UnlockUserScreen(uint32_t userId, const std::vector<uint8_t> &token,
376 const std::vector<uint8_t> &secret)
377 {
378 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
379 if (status != E_OK) {
380 LOGE("service check failed");
381 return status;
382 }
383
384 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
385 if (client == nullptr) {
386 LOGE("get storage daemon service failed");
387 return E_SA_IS_NULLPTR;
388 }
389
390 return client->UnlockUserScreen(userId, token, secret);
391 }
392
GetLockScreenStatus(uint32_t userId,bool & lockScreenStatus)393 int32_t StorageDaemonClient::GetLockScreenStatus(uint32_t userId, bool &lockScreenStatus)
394 {
395 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
396 if (status != E_OK) {
397 LOGE("service check failed");
398 return status;
399 }
400
401 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
402 if (client == nullptr) {
403 LOGE("get storage daemon service failed");
404 return E_SA_IS_NULLPTR;
405 }
406
407 return client->GetLockScreenStatus(userId, lockScreenStatus);
408 }
409
UpdateKeyContext(uint32_t userId,bool needRemoveTmpKey)410 int32_t StorageDaemonClient::UpdateKeyContext(uint32_t userId, bool needRemoveTmpKey)
411 {
412 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
413 if (status != E_OK) {
414 LOGE("service check failed");
415 return status;
416 }
417
418 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
419 if (client == nullptr) {
420 LOGE("get storage daemon service failed");
421 return E_SA_IS_NULLPTR;
422 }
423
424 return client->UpdateKeyContext(userId, needRemoveTmpKey);
425 }
426
GenerateAppkey(uint32_t userId,uint32_t hashId,std::string & keyId)427 int32_t StorageDaemonClient::GenerateAppkey(uint32_t userId, uint32_t hashId, std::string &keyId)
428 {
429 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
430 if (status != E_OK) {
431 LOGE("service check failed");
432 return status;
433 }
434
435 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
436 if (client == nullptr) {
437 LOGE("get storage daemon service failed");
438 return E_SA_IS_NULLPTR;
439 }
440
441 return client->GenerateAppkey(userId, hashId, keyId);
442 }
443
DeleteAppkey(uint32_t userId,const std::string keyId)444 int32_t StorageDaemonClient::DeleteAppkey(uint32_t userId, const std::string keyId)
445 {
446 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
447 if (status != E_OK) {
448 LOGE("service check failed");
449 return status;
450 }
451
452 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
453 if (client == nullptr) {
454 LOGE("get storage daemon service failed");
455 return E_SA_IS_NULLPTR;
456 }
457
458 return client->DeleteAppkey(userId, keyId);
459 }
460
CreateRecoverKey(uint32_t userId,uint32_t userType,const std::vector<uint8_t> & token,const std::vector<uint8_t> & secret)461 int32_t StorageDaemonClient::CreateRecoverKey(uint32_t userId,
462 uint32_t userType,
463 const std::vector<uint8_t> &token,
464 const std::vector<uint8_t> &secret)
465 {
466 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
467 if (status != E_OK) {
468 LOGE("service check failed");
469 return status;
470 }
471
472 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
473 if (client == nullptr) {
474 LOGE("get storage daemon service failed");
475 return E_SA_IS_NULLPTR;
476 }
477
478 return client->CreateRecoverKey(userId, userType, token, secret);
479 }
480
SetRecoverKey(const std::vector<uint8_t> & key)481 int32_t StorageDaemonClient::SetRecoverKey(const std::vector<uint8_t> &key)
482 {
483 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
484 if (status != E_OK) {
485 LOGE("service check failed");
486 return status;
487 }
488
489 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
490 if (client == nullptr) {
491 LOGE("get storage daemon service failed");
492 return E_SA_IS_NULLPTR;
493 }
494
495 return client->SetRecoverKey(key);
496 }
497
MountDfsDocs(int32_t userId,const std::string & relativePath,const std::string & networkId,const std::string & deviceId)498 int32_t StorageDaemonClient::MountDfsDocs(int32_t userId, const std::string &relativePath,
499 const std::string &networkId, const std::string &deviceId)
500 {
501 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
502 if (status != E_OK) {
503 LOGE("service check failed");
504 return status;
505 }
506
507 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
508 if (client == nullptr) {
509 LOGE("Get StorageDaemon service failed!");
510 return E_SA_IS_NULLPTR;
511 }
512
513 return client->MountDfsDocs(userId, relativePath, networkId, deviceId);
514 }
515
UMountDfsDocs(int32_t userId,const std::string & relativePath,const std::string & networkId,const std::string & deviceId)516 int32_t StorageDaemonClient::UMountDfsDocs(int32_t userId, const std::string &relativePath,
517 const std::string &networkId, const std::string &deviceId)
518 {
519 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
520 if (status != E_OK) {
521 LOGE("service check failed");
522 return status;
523 }
524
525 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
526 if (client == nullptr) {
527 LOGE("Get StorageDaemon service failed!");
528 return E_SA_IS_NULLPTR;
529 }
530
531 return client->UMountDfsDocs(userId, relativePath, networkId, deviceId);
532 }
533
FscryptEnable(const std::string & fscryptOptions)534 int32_t StorageDaemonClient::FscryptEnable(const std::string &fscryptOptions)
535 {
536 #ifdef USER_CRYPTO_MANAGER
537 int ret = SetFscryptSysparam(fscryptOptions.c_str());
538 if (ret) {
539 LOGE("Init fscrypt policy failed ret %{public}d", ret);
540 return ret;
541 }
542 #endif
543
544 return 0;
545 }
546
GetFileEncryptStatus(uint32_t userId,bool & isEncrypted,bool needCheckDirMount)547 int32_t StorageDaemonClient::GetFileEncryptStatus(uint32_t userId, bool &isEncrypted, bool needCheckDirMount)
548 {
549 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
550 if (status != E_OK) {
551 LOGE("service check failed");
552 return status;
553 }
554
555 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
556 if (client == nullptr) {
557 LOGE("Get StorageDaemon service failed!");
558 return E_SA_IS_NULLPTR;
559 }
560
561 return client->GetFileEncryptStatus(userId, isEncrypted, needCheckDirMount);
562 }
563
GetUserNeedActiveStatus(uint32_t userId,bool & needActive)564 int32_t StorageDaemonClient::GetUserNeedActiveStatus(uint32_t userId, bool &needActive)
565 {
566 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
567 if (status != E_OK) {
568 LOGE("service check failed");
569 return status;
570 }
571
572 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
573 if (client == nullptr) {
574 LOGE("Get StorageDaemon service failed!");
575 return E_SA_IS_NULLPTR;
576 }
577
578 return client->GetUserNeedActiveStatus(userId, needActive);
579 }
580
MountFileMgrFuse(int32_t userId,const std::string & path,int32_t & fuseFd)581 int32_t StorageDaemonClient::MountFileMgrFuse(int32_t userId, const std::string &path, int32_t &fuseFd)
582 {
583 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
584 if (status != E_OK) {
585 LOGE("service check failed");
586 return status;
587 }
588 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
589 if (client == nullptr) {
590 LOGE("Get StorageDaemon service failed!");
591 return E_SA_IS_NULLPTR;
592 }
593 return client->MountFileMgrFuse(userId, path, fuseFd);
594 }
595
UMountFileMgrFuse(int32_t userId,const std::string & path)596 int32_t StorageDaemonClient::UMountFileMgrFuse(int32_t userId, const std::string &path)
597 {
598 auto status = CheckServiceStatus(STORAGE_SERVICE_FLAG);
599 if (status != E_OK) {
600 LOGE("service check failed");
601 return status;
602 }
603 sptr<IStorageDaemon> client = GetStorageDaemonProxy();
604 if (client == nullptr) {
605 LOGE("Get StorageDaemon service failed!");
606 return E_SA_IS_NULLPTR;
607 }
608 return client->UMountFileMgrFuse(userId, path);
609 }
610 } // namespace StorageDaemon
611 } // namespace OHOS
612