Merge branch 'master' of gitee.com:openharmony/filemanagement_storage_service into master

Signed-off-by: 廖永煌 <liaoyonghuang1@huawei.com>
This commit is contained in:
廖永煌 2023-08-28 01:49:59 +00:00 committed by Gitee
commit f45f1f540e
9 changed files with 52 additions and 6 deletions

View File

@ -103,7 +103,6 @@ ohos_executable("storage_daemon") {
"ability_base:want",
"ability_base:zuri",
"c_utils:utils",
"dfs_service:cloud_daemon_kit_inner",
"hilog:libhilog",
"init:libbegetutil",
"ipc:ipc_core",
@ -123,6 +122,11 @@ ohos_executable("storage_daemon") {
external_deps += [ "huks:libhukssdk" ]
}
if (storage_service_dfs_service) {
defines += [ "DFS_SERVICE" ]
external_deps += [ "dfs_service:cloud_daemon_kit_inner" ]
}
ldflags = [
"-Wl,-z,max-page-size=4096",
"-Wl,-z,separate-code",

View File

@ -32,7 +32,9 @@
#include "user/user_manager.h"
#include "user/mount_manager.h"
#include "system_ability_definition.h"
#ifdef DFS_SERVICE
#include "cloud_daemon_manager.h"
#endif
#ifdef USER_CRYPTO_MIGRATE_KEY
#include "string_ex.h"
#include "utils/file_utils.h"
@ -41,7 +43,9 @@
namespace OHOS {
namespace StorageDaemon {
#ifdef DFS_SERVICE
using namespace OHOS::FileManagement::CloudFile;
#endif
typedef int32_t (*CreateShareFileFunc)(std::string, uint32_t, uint32_t);
typedef int32_t (*DeleteShareFileFunc)(uint32_t, std::vector<std::string>);

View File

@ -29,10 +29,14 @@
#include "user/user_manager.h"
#include "utils/string_utils.h"
#include "system_ability_definition.h"
#ifdef DFS_SERVICE
#include "cloud_daemon_manager.h"
#endif
using namespace OHOS;
#ifdef DFS_SERVICE
using namespace OHOS::FileManagement::CloudFile;
#endif
using CloudListener = StorageDaemon::StorageDaemon::SystemAbilityStatusChangeListener;
#ifdef EXTERNAL_STORAGE_MANAGER

View File

@ -27,13 +27,17 @@
#include "utils/mount_argument_utils.h"
#include "utils/string_utils.h"
#include "system_ability_definition.h"
#ifdef DFS_SERVICE
#include "cloud_daemon_manager.h"
#endif
namespace OHOS {
namespace StorageDaemon {
using namespace std;
#ifdef DFS_SERVICE
using namespace OHOS::FileManagement::CloudFile;
#endif
constexpr int32_t UMOUNT_RETRY_TIMES = 3;
std::shared_ptr<MountManager> MountManager::instance_ = nullptr;
@ -149,6 +153,7 @@ int32_t MountManager::HmdfsMount(int32_t userId, std::string relativePath)
int32_t MountManager::CloudMount(int32_t userId)
{
#ifdef DFS_SERVICE
int fd = -1;
string opt;
int ret;
@ -188,6 +193,9 @@ int32_t MountManager::CloudMount(int32_t userId)
LOGI("mount %{public}s success", path.c_str());
close(fd);
return ret;
#else
return E_OK;
#endif
}
int32_t MountManager::HmdfsMount(int32_t userId)
@ -288,6 +296,7 @@ int32_t MountManager::HmdfsUMount(int32_t userId, std::string relativePath)
int32_t MountManager::CloudUMount(int32_t userId)
{
#ifdef DFS_SERVICE
int32_t err = E_OK;
Utils::MountArgument cloudMntArgs(Utils::MountArgumentDescriptors::Alpha(userId, ""));
const string path = cloudMntArgs.GetFullCloud();
@ -299,6 +308,9 @@ int32_t MountManager::CloudUMount(int32_t userId)
}
LOGI("umount %{public}s success", path.c_str());
return E_OK;
#else
return E_OK;
#endif
}
int32_t MountManager::HmdfsUMount(int32_t userId)

View File

@ -50,13 +50,17 @@ ohos_unittest("user_manager_test") {
external_deps = [
"c_utils:utils",
"dfs_service:cloud_daemon_kit_inner",
"hilog:libhilog",
"huks:libhukssdk",
"init:libbegetutil",
"ipc:ipc_core",
"ipc:libdbinder",
]
if (storage_service_dfs_service) {
defines += [ "DFS_SERVICE" ]
external_deps += [ "dfs_service:cloud_daemon_kit_inner" ]
}
}
group("storage_daemon_user_test") {

View File

@ -18,6 +18,12 @@ declare_args() {
storage_service_user_crypto_manager = true
storage_service_external_storage_manager = true
storage_service_storage_statistics_manager = true
if (defined(global_parts_info) &&
defined(global_parts_info.filemanagement_dfs_service)) {
storage_service_dfs_service = true
} else {
storage_service_dfs_service = false
}
}
storage_manager_path =
"//foundation/filemanagement/storage_service/services/storage_manager"

View File

@ -51,13 +51,17 @@ ohos_fuzztest("StorageDaemonFuzzTest") {
external_deps = [
"ability_runtime:abilitykit_native",
"c_utils:utils",
"dfs_service:cloud_daemon_kit_inner",
"hilog:libhilog",
"init:libbegetutil",
"ipc:ipc_core",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
]
if (storage_service_dfs_service) {
defines += [ "DFS_SERVICE" ]
external_deps += [ "dfs_service:cloud_daemon_kit_inner" ]
}
}
group("fuzztest") {

View File

@ -53,13 +53,17 @@ ohos_fuzztest("StorageDaemonCreateShareFileFuzzTest") {
external_deps = [
"ability_runtime:abilitykit_native",
"c_utils:utils",
"dfs_service:cloud_daemon_kit_inner",
"hilog:libhilog",
"init:libbegetutil",
"ipc:ipc_core",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
]
if (storage_service_dfs_service) {
defines += [ "DFS_SERVICE" ]
external_deps += [ "dfs_service:cloud_daemon_kit_inner" ]
}
}
group("fuzztest") {

View File

@ -53,13 +53,17 @@ ohos_fuzztest("StorageDaemonDeleteShareFileFuzzTest") {
external_deps = [
"ability_runtime:abilitykit_native",
"c_utils:utils",
"dfs_service:cloud_daemon_kit_inner",
"hilog:libhilog",
"init:libbegetutil",
"ipc:ipc_core",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
]
if (storage_service_dfs_service) {
defines += [ "DFS_SERVICE" ]
external_deps += [ "dfs_service:cloud_daemon_kit_inner" ]
}
}
group("fuzztest") {