move errno and log to common dir

Signed-off-by: 张文迪 <zhangwendi3@huawei.com>
This commit is contained in:
张文迪 2022-01-19 17:46:27 +08:00 committed by jiahaoluo
parent df968be5a7
commit d53f25aee7
38 changed files with 65 additions and 142 deletions

View File

@ -19,8 +19,9 @@ config("public_config") {
config("private_config") {
include_dirs = [
"../../../../services/storage_manager/include",
"../../../../services/storage_daemon/include",
"//foundation/filemanagement/storage_service/services/storage_manager/include",
"//foundation/filemanagement/storage_service/services/storage_daemon/include",
"//foundation/filemanagement/storage_service/utils/include"
]
}

View File

@ -30,6 +30,7 @@ ohos_shared_library("storagestatistics") {
"//utils/native/base/include",
"//foundation/distributeddatamgr/distributedfile/interfaces/kits/js/src/",
"//foundation/filemanagement/storage_service/interfaces/innerkits/storage_manager/native",
"//foundation/filemanagement/storage_service/utils/include"
]
sources = [

View File

@ -29,6 +29,7 @@ config("storage_daemon_config") {
"//utils/native/base/include",
"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include",
"//base/startup/syspara_lite/interfaces/innerkits/native/syspara/include",
"//foundation/filemanagement/storage_service/utils/include"
]
}
@ -70,6 +71,7 @@ ohos_executable("storage_daemon") {
config("sdc_config") {
include_dirs = [
"include",
"//foundation/filemanagement/storage_service/utils/include",
"//utils/native/base/include",
"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include",
"//utils/system/safwk/native/include",

View File

@ -14,7 +14,7 @@
*/
#include "storage_daemon_client.h"
#include "utils/log.h"
#include "storage_service_log.h"
#include "iremote_proxy.h"
#include "iremote_object.h"
#include "iservice_registry.h"

View File

@ -19,6 +19,7 @@ config("storage_daemon_crypto_config") {
include_dirs = [
"../include",
"../include/crypto",
"//foundation/filemanagement/storage_service/utils/include",
"//third_party/openssl/include/openssl",
"//base/security/huks/interfaces/innerkits/huks_standard/main/include",
"//utils/system/safwk/native/include",

View File

@ -25,7 +25,7 @@
#include "directory_ex.h"
#include "string_ex.h"
#include "file_ex.h"
#include "utils/log.h"
#include "storage_service_log.h"
#include "huks_master.h"
namespace OHOS {

View File

@ -15,7 +15,7 @@
#include "fscrypt_key_v1.h"
#include <openssl/sha.h>
#include "utils/log.h"
#include "storage_service_log.h"
#include "key_ctrl.h"
namespace OHOS {

View File

@ -14,7 +14,7 @@
*/
#include "fscrypt_key_v2.h"
#include "utils/log.h"
#include "storage_service_log.h"
#include "key_ctrl.h"
namespace OHOS {

View File

@ -23,7 +23,7 @@
#include "hks_api.h"
#include "hks_param.h"
#include "utils/log.h"
#include "storage_service_log.h"
namespace OHOS {
namespace StorageDaemon {

View File

@ -24,7 +24,7 @@
#include <linux/fs.h>
#include <linux/keyctl.h>
#include "utils/log.h"
#include "storage_service_log.h"
#include "securec.h"
#include "file_ex.h"
#include "string_ex.h"

View File

@ -18,9 +18,10 @@
#include "directory_ex.h"
#include "file_ex.h"
#include "utils/log.h"
#include "utils/errno.h"
#include "fscrypt_key_v2.h"
#include "storage_service_log.h"
#include "storage_service_errno.h"
#include "key_ctrl.h"
namespace OHOS {
namespace StorageDaemon {

View File

@ -1,39 +0,0 @@
/*
* 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.
*/
#ifndef STORAGE_DAEMON_UTILS_ERRNO_H
#define STORAGE_DAEMON_UTILS_ERRNO_H
namespace OHOS {
namespace StorageDaemon {
constexpr int32_t E_ERR = -1;
enum ErrNo {
E_OK = 0,
E_PERMISSION_DENIED = 1, // no permission
E_IPC_ERROR = 2, // ipc error
E_EXIST = 3, // exist
E_WRONG_TYPE = 4, // wrong file type
E_USER_STATE = 5, // wrong user state
E_NON_EXIST = 6, // no such user
E_PREPARE_DIR = 7, // failed to prepare dir
E_DESTROY_DIR = 8, // failed to destroy dir
E_MOUNT, // mount error
E_UMOUNT, // umount error
E_SET_POLICY,
};
}
}
#endif // STORAGE_DAEMON_UTILS_ERRNO_H

View File

@ -15,9 +15,9 @@
#include "ipc/storage_daemon.h"
#include "user/user_manager.h"
#include "utils/errno.h"
#include "storage_service_errno.h"
#include "crypto/key_manager.h"
#include "utils/log.h"
#include "storage_service_log.h"
namespace OHOS {
namespace StorageDaemon {

View File

@ -14,8 +14,8 @@
*/
#include "ipc/storage_daemon_proxy.h"
#include "utils/errno.h"
#include "utils/log.h"
#include "storage_service_errno.h"
#include "storage_service_log.h"
namespace OHOS {
namespace StorageDaemon {

View File

@ -14,8 +14,8 @@
*/
#include "ipc/storage_daemon_stub.h"
#include "utils/errno.h"
#include "utils/log.h"
#include "storage_service_errno.h"
#include "storage_service_log.h"
namespace OHOS {
namespace StorageDaemon {

View File

@ -25,6 +25,7 @@ ohos_unittest("storage_daemon_test") {
"$ROOT_DIR/utils",
"//base/security/huks/interfaces/innerkits/huks_standard/main/include",
"//foundation/communication/ipc/interfaces/innerkits/libdbinder/include",
"//foundation/filemanagement/storage_service/utils/include"
]
sources = [

View File

@ -18,7 +18,7 @@
#include "ipc/istorage_daemon.h"
#include "ipc/storage_daemon_proxy.h"
#include "storage_daemon_service_mock.h"
#include "utils/errno.h"
#include "storage_service_errno.h"
namespace OHOS {
namespace StorageDaemon {

View File

@ -17,7 +17,7 @@
#include "gmock/gmock.h"
#include "ipc/storage_daemon_stub.h"
#include "utils/errno.h"
#include "storage_service_errno.h"
namespace OHOS {
namespace StorageDaemon {

View File

@ -23,8 +23,8 @@
#include "ipc/storage_daemon_stub.h"
#include "storage_daemon_stub_mock.h"
#include "utils/errno.h"
#include "utils/log.h"
#include "storage_service_errno.h"
#include "storage_service_log.h"
namespace OHOS {
namespace StorageDaemon {

View File

@ -21,9 +21,9 @@
#include "ipc/storage_daemon.h"
#include "test/common/help_utils.h"
#include "user/user_manager.h"
#include "utils/errno.h"
#include "storage_service_errno.h"
#include "utils/file_utils.h"
#include "utils/log.h"
#include "storage_service_log.h"
namespace OHOS {
namespace StorageDaemon {

View File

@ -17,7 +17,7 @@
#include <iostream>
#include <vector>
#include "utils/log.h"
#include "storage_service_log.h"
#include "utils/file_utils.h"
#include "storage_daemon_client.h"

View File

@ -19,9 +19,9 @@
#include "crypto/key_manager.h"
#include "ipc/istorage_daemon.h"
#include "parameter.h"
#include "utils/errno.h"
#include "storage_service_errno.h"
#include "utils/file_utils.h"
#include "utils/log.h"
#include "storage_service_log.h"
#include "utils/mount_argument_utils.h"
#include "utils/string_utils.h"

View File

@ -23,6 +23,7 @@ ohos_unittest("user_manager_test") {
"$ROOT_DIR/utils",
"//base/security/huks/interfaces/innerkits/huks_standard/main/include",
"//foundation/communication/ipc/interfaces/innerkits/libdbinder/include",
"//foundation/filemanagement/storage_service/utils/include"
]
sources = [

View File

@ -18,9 +18,9 @@
#include "ipc/istorage_daemon.h"
#include "test/common/help_utils.h"
#include "user/user_manager.h"
#include "utils/errno.h"
#include "storage_service_errno.h"
#include "utils/file_utils.h"
#include "utils/log.h"
#include "storage_service_log.h"
namespace OHOS {
namespace StorageDaemon {

View File

@ -19,8 +19,8 @@
#include <cstring>
#include <dirent.h>
#include <sys/stat.h>
#include "utils/errno.h"
#include "utils/log.h"
#include "storage_service_errno.h"
#include "storage_service_log.h"
#include "string_ex.h"
namespace OHOS {

View File

@ -21,6 +21,7 @@ config("storage_manager_config") {
"//utils/system/safwk/native/include",
"//utils/native/base/include",
"../storage_daemon/include",
"//foundation/filemanagement/storage_service/utils/include",
"//foundation/appexecfwk/standard/services/bundlemgr/include",
]
}

View File

@ -1,39 +0,0 @@
/*
* 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.
*/
#ifndef STORAGE_MANAGER_UTILS_LOG_H
#define STORAGE_MANAGER_UTILS_LOG_H
#include "hilog/log.h"
#ifndef LOG_DOMAIN
#define LOG_DOMAIN 0
#endif
namespace OHOS {
namespace StorageManager {
static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = { LOG_CORE, LOG_DOMAIN, "StorageManager" };
#define PRINT_LOG(Level, fmt, ...) \
HiviewDFX::HiLog::Level(LOG_LABEL, "[%{public}s:%{public}d] " fmt, \
__FUNCTION__, __LINE__, ##__VA_ARGS__)
#define LOGD(fmt, ...) PRINT_LOG(Debug, fmt, ##__VA_ARGS__)
#define LOGI(fmt, ...) PRINT_LOG(Info, fmt, ##__VA_ARGS__)
#define LOGW(fmt, ...) PRINT_LOG(Warn, fmt, ##__VA_ARGS__)
#define LOGE(fmt, ...) PRINT_LOG(Error, fmt, ##__VA_ARGS__)
#define LOGF(fmt, ...) PRINT_LOG(Fatal, fmt, ##__VA_ARGS__)
} // StorageManager
} // OHOS
#endif // STORAGE_Manager_UTILS_LOG_H

View File

@ -15,8 +15,8 @@
#include "ipc/storage_manager.h"
#include "system_ability_definition.h"
#include "utils/storage_manager_log.h"
#include "utils/storage_manager_errno.h"
#include "storage_service_log.h"
#include "storage_service_errno.h"
#include "user/multi_user_manager_service.h"
#include <storage/storage_status_service.h>
#include <storage/storage_total_status_service.h>

View File

@ -14,8 +14,8 @@
*/
#include "ipc/storage_manager_proxy.h"
#include "utils/storage_manager_errno.h"
#include "utils/storage_manager_log.h"
#include "storage_service_errno.h"
#include "storage_service_log.h"
namespace OHOS {
namespace StorageManager {

View File

@ -14,8 +14,8 @@
*/
#include "ipc/storage_manager_stub.h"
#include "utils/storage_manager_errno.h"
#include "utils/storage_manager_log.h"
#include "storage_service_errno.h"
#include "storage_service_log.h"
namespace OHOS {
namespace StorageManager {

View File

@ -19,8 +19,10 @@
#include <system_ability_definition.h>
#include "storage/storage_status_service.h"
#include "utils/storage_manager_errno.h"
#include "utils/storage_manager_log.h"
#include "storage_service_errno.h"
#include "storage_service_log.h"
#include <system_ability_definition.h>
#include "storage_manager_connect.h"
#include "ipc/storage_manager_proxy.h"
#include "ipc/storage_manager.h"

View File

@ -25,9 +25,7 @@
#include "common/napi/n_async/n_async_work_callback.h"
#include "common/napi/n_async/n_async_work_promise.h"
#include "storage_statistics_napi.h"
#include "storage_manager_connect.h"
#include "utils/storage_manager_log.h"
#include "storage_service_log.h"
using namespace OHOS::DistributedFS;

View File

@ -14,14 +14,12 @@
*/
#include "storage/storage_status_service.h"
#include "storage_service_errno.h"
#include "storage_service_log.h"
#include "installd_client.h"
#include "os_account_manager.h"
#include "os_account_constants.h"
#include "utils/storage_manager_errno.h"
#include "utils/storage_manager_log.h"
using namespace std;
namespace OHOS {

View File

@ -14,10 +14,7 @@
*/
#include "storage/storage_total_status_service.h"
#include <sys/statvfs.h>
#include "utils/storage_manager_errno.h"
#include "storage_service_errno.h"
using namespace std;

View File

@ -15,8 +15,8 @@
#include "storage_daemon_communication/storage_daemon_communication.h"
#include <system_ability_definition.h>
#include <iservice_registry.h>
#include "utils/storage_manager_log.h"
#include "utils/storage_manager_errno.h"
#include "storage_service_log.h"
#include "storage_service_errno.h"
#include "ipc/istorage_daemon.h"
#include "ipc/storage_daemon.h"
#include "ipc/storage_daemon_proxy.h"

View File

@ -16,8 +16,8 @@
#include "user/multi_user_manager_service.h"
#include "os_account_constants.h"
#include "storage_daemon_communication/storage_daemon_communication.h"
#include "utils/storage_manager_log.h"
#include "utils/storage_manager_errno.h"
#include "storage_service_log.h"
#include "storage_service_errno.h"
namespace OHOS {
namespace StorageManager {

View File

@ -12,11 +12,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef STORAGE_MANAGER_UTILS_ERRNO_H
#define STORAGE_MANAGER_UTILS_ERRNO_H
#ifndef STORAGE_SERVICE_UTILS_ERRNO_H
#define STORAGE_SERVICE_UTILS_ERRNO_H
namespace OHOS {
namespace StorageManager {
constexpr int32_t E_ERR = -1;
enum ErrNo {
@ -31,9 +30,9 @@ enum ErrNo {
E_DESTROY_DIR = 8, // failed to destroy dir
E_MOUNT, // mount error
E_UMOUNT, // umount error
E_SET_POLICY,
E_USERID_RANGE, // id out or range
};
}
}
#endif // STORAGE_MANAGER_UTILS_ERRNO_H
#endif // STORAGE_SERVICE_UTILS_ERRNO_H

View File

@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef STORAGE_DAEMON_UTILS_LOG_H
#define STORAGE_DAEMON_UTILS_LOG_H
#ifndef STORAGE_SERVICE_UTILS_LOG_H
#define STORAGE_SERVICE_UTILS_LOG_H
#include "hilog/log.h"
@ -22,11 +22,10 @@
#endif
namespace OHOS {
namespace StorageDaemon {
static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = { LOG_CORE, LOG_DOMAIN, "StorageDaemon" };
static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = { LOG_CORE, LOG_DOMAIN, "StorageService" };
#define PRINT_LOG(Level, fmt, ...) \
OHOS::HiviewDFX::HiLog::Level(OHOS::StorageDaemon::LOG_LABEL, "[%{public}s:%{public}d] " fmt, \
OHOS::HiviewDFX::HiLog::Level(OHOS::LOG_LABEL, "[%{public}s:%{public}d] " fmt, \
__FUNCTION__, __LINE__, ##__VA_ARGS__)
#define LOGD(fmt, ...) PRINT_LOG(Debug, fmt, ##__VA_ARGS__)
@ -34,7 +33,6 @@ static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = { LOG_CORE, LOG_DOMAIN,
#define LOGW(fmt, ...) PRINT_LOG(Warn, fmt, ##__VA_ARGS__)
#define LOGE(fmt, ...) PRINT_LOG(Error, fmt, ##__VA_ARGS__)
#define LOGF(fmt, ...) PRINT_LOG(Fatal, fmt, ##__VA_ARGS__)
} // StorageDaemon
} // OHOS
#endif // STORAGE_DAEMON_UTILS_LOG_H
#endif // STORAGE_SERVICE_UTILS_LOG_H