mirror of
https://gitee.com/openharmony/filemanagement_storage_service
synced 2024-11-23 06:59:59 +00:00
message
Signed-off-by: l30054665 <lishang21@huawei.com>
This commit is contained in:
parent
1f5aa95934
commit
474039f8d3
@ -383,6 +383,7 @@ group("storage_daemon_unit_test") {
|
||||
"disk/test:storage_daemon_disk_test",
|
||||
"netlink/test:storage_daemon_netlink_test",
|
||||
"volume/test:storage_daemon_volume_test",
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
|
79
services/storage_daemon/mtp/test/BUILD.gn
Normal file
79
services/storage_daemon/mtp/test/BUILD.gn
Normal file
@ -0,0 +1,79 @@
|
||||
# Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//build/ohos.gni")
|
||||
import("//foundation/filemanagement/storage_service/storage_service_aafwk.gni")
|
||||
|
||||
ohos_executable("mtpfs") {
|
||||
branch_protector_ret = "pac_ret"
|
||||
|
||||
sanitize = {
|
||||
integer_overflow = true
|
||||
ubsan = true
|
||||
boundary_sanitize = true
|
||||
cfi = true
|
||||
cfi_cross_dso = true
|
||||
debug = false
|
||||
}
|
||||
|
||||
include_dirs = [
|
||||
"./include",
|
||||
"${storage_daemon_path}/include/utils",
|
||||
"${storage_service_common_path}/include",
|
||||
]
|
||||
|
||||
defines = [
|
||||
"STORAGE_LOG_TAG = \"StorageDaemon\"",
|
||||
"LOG_DOMAIN = 0xD004301",
|
||||
]
|
||||
|
||||
cflags = [
|
||||
"-w",
|
||||
"-DFUSE_USE_VERSION=31",
|
||||
"-D_FILE_OFFSET_BITS=64",
|
||||
"-std=c++11",
|
||||
]
|
||||
|
||||
deps = [ "${storage_daemon_path}:storage_common_utils" ]
|
||||
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
"hilog:libhilog",
|
||||
]
|
||||
|
||||
if (support_open_source_libmtp) {
|
||||
sources = [
|
||||
"./src/mtpfs_fuse.cpp",
|
||||
"./src/mtpfs_libmtp.cpp",
|
||||
"./src/mtpfs_main.cpp",
|
||||
"./src/mtpfs_mtp_device.cpp",
|
||||
"./src/mtpfs_tmp_files_pool.cpp",
|
||||
"./src/mtpfs_type_dir.cpp",
|
||||
"./src/mtpfs_type_file.cpp",
|
||||
"./src/mtpfs_type_tmp_file.cpp",
|
||||
"./src/mtpfs_util.cpp",
|
||||
]
|
||||
external_deps += [
|
||||
"libfuse:libfuse",
|
||||
"libmtp:libmtp",
|
||||
"libusb:libusb",
|
||||
"openssl:libcrypto_shared",
|
||||
]
|
||||
} else {
|
||||
sources = [ "./src/mtpfs_main_virtual.cpp" ]
|
||||
}
|
||||
|
||||
subsystem_name = "filemanagement"
|
||||
part_name = "storage_service"
|
||||
install_enable = true
|
||||
}
|
44
services/storage_daemon/mtp/test/mtp_device_manager_test.cpp
Normal file
44
services/storage_daemon/mtp/test/mtp_device_manager_test.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "mtp/mtp_device_manager.h"
|
||||
|
||||
#include <config.h>
|
||||
#include <dirent.h>
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include "ipc/storage_manager_client.h"
|
||||
#include "storage_service_errno.h"
|
||||
#include "storage_service_log.h"
|
||||
#include "utils/file_utils.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageDaemon {
|
||||
MtpDeviceManager::MtpDeviceManager() {}
|
||||
|
||||
MtpDeviceManager::~MtpDeviceManager()
|
||||
{
|
||||
LOGI("MtpDeviceManager Destructor.");
|
||||
}
|
||||
|
||||
|
||||
} // namespace StorageDaemon
|
||||
} // namespace OHOS
|
79
services/storage_daemon/mtpfs/test/BUILD.gn
Normal file
79
services/storage_daemon/mtpfs/test/BUILD.gn
Normal file
@ -0,0 +1,79 @@
|
||||
# Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//build/ohos.gni")
|
||||
import("//foundation/filemanagement/storage_service/storage_service_aafwk.gni")
|
||||
|
||||
ohos_executable("mtpfs") {
|
||||
branch_protector_ret = "pac_ret"
|
||||
|
||||
sanitize = {
|
||||
integer_overflow = true
|
||||
ubsan = true
|
||||
boundary_sanitize = true
|
||||
cfi = true
|
||||
cfi_cross_dso = true
|
||||
debug = false
|
||||
}
|
||||
|
||||
include_dirs = [
|
||||
"./include",
|
||||
"${storage_daemon_path}/include/utils",
|
||||
"${storage_service_common_path}/include",
|
||||
]
|
||||
|
||||
defines = [
|
||||
"STORAGE_LOG_TAG = \"StorageDaemon\"",
|
||||
"LOG_DOMAIN = 0xD004301",
|
||||
]
|
||||
|
||||
cflags = [
|
||||
"-w",
|
||||
"-DFUSE_USE_VERSION=31",
|
||||
"-D_FILE_OFFSET_BITS=64",
|
||||
"-std=c++11",
|
||||
]
|
||||
|
||||
deps = [ "${storage_daemon_path}:storage_common_utils" ]
|
||||
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
"hilog:libhilog",
|
||||
]
|
||||
|
||||
if (support_open_source_libmtp) {
|
||||
sources = [
|
||||
"./src/mtpfs_fuse.cpp",
|
||||
"./src/mtpfs_libmtp.cpp",
|
||||
"./src/mtpfs_main.cpp",
|
||||
"./src/mtpfs_mtp_device.cpp",
|
||||
"./src/mtpfs_tmp_files_pool.cpp",
|
||||
"./src/mtpfs_type_dir.cpp",
|
||||
"./src/mtpfs_type_file.cpp",
|
||||
"./src/mtpfs_type_tmp_file.cpp",
|
||||
"./src/mtpfs_util.cpp",
|
||||
]
|
||||
external_deps += [
|
||||
"libfuse:libfuse",
|
||||
"libmtp:libmtp",
|
||||
"libusb:libusb",
|
||||
"openssl:libcrypto_shared",
|
||||
]
|
||||
} else {
|
||||
sources = [ "./src/mtpfs_main_virtual.cpp" ]
|
||||
}
|
||||
|
||||
subsystem_name = "filemanagement"
|
||||
part_name = "storage_service"
|
||||
install_enable = true
|
||||
}
|
44
services/storage_daemon/mtpfs/test/mtpfs_fuse_test.cpp
Normal file
44
services/storage_daemon/mtpfs/test/mtpfs_fuse_test.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "mtp/mtp_device_manager.h"
|
||||
|
||||
#include <config.h>
|
||||
#include <dirent.h>
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include "ipc/storage_manager_client.h"
|
||||
#include "storage_service_errno.h"
|
||||
#include "storage_service_log.h"
|
||||
#include "utils/file_utils.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageDaemon {
|
||||
MtpDeviceManager::MtpDeviceManager() {}
|
||||
|
||||
MtpDeviceManager::~MtpDeviceManager()
|
||||
{
|
||||
LOGI("MtpDeviceManager Destructor.");
|
||||
}
|
||||
|
||||
|
||||
} // namespace StorageDaemon
|
||||
} // namespace OHOS
|
Loading…
Reference in New Issue
Block a user