From d27d1a765e3e2146116c75ab98b9051379e2c6a9 Mon Sep 17 00:00:00 2001 From: yang-jingbo1985 Date: Sat, 4 Nov 2023 20:08:14 +0800 Subject: [PATCH] testSetIno Signed-off-by: yangjingbo10 Change-Id: I6fa79c296970706e70cf8ca289da8751d7c02684 --- .../native/backup_ext/src/ext_extension.cpp | 20 +++++++++++++++++++ utils/include/b_resources/b_constants.h | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/frameworks/native/backup_ext/src/ext_extension.cpp b/frameworks/native/backup_ext/src/ext_extension.cpp index 94561cd92..8dd27fdc4 100644 --- a/frameworks/native/backup_ext/src/ext_extension.cpp +++ b/frameworks/native/backup_ext/src/ext_extension.cpp @@ -429,6 +429,15 @@ static void RestoreBigFiles() } } + if (chmod(filePath.data(), S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH | S_ISGID) != 0) { + HILOGE("!!!!, chmod filePath failed! errno %{public}d.", errno); + } + HILOGE("!!!!chmod Big"); + if (chown(filePath.data(), 3012, 3012) != 0) { + HILOGE("!!!!, chown filePath failed! errno %{public}d.", errno); + } + HILOGE("!!!!chown Big"); + struct timespec tv[2] = {sta.st_atim, sta.st_mtim}; UniqueFd fd(open(filePath.data(), O_RDONLY)); if (futimens(fd.Get(), tv) != 0) { @@ -471,6 +480,17 @@ void BackupExtExtension::AsyncTaskRestore() ret = ptr->DoRestore(item); } } + string testFolder = "/data/storage/el2/base/files/test/"; + if (chmod(testFolder.c_str(), S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH | S_ISGID) != 0) { + HILOGE("!!!!, chmod testFolder failed! errno %{public}d.", errno); + } + HILOGE("!!!!chmodFolder"); + + if (chown(testFolder.c_str(), 20010043, 3012) != 0) { + HILOGE("!!!!, chown testFolder failed! errno %{public}d.", errno); + } + HILOGE("!!!!chownFolder"); + // 恢复大文件 RestoreBigFiles(); diff --git a/utils/include/b_resources/b_constants.h b/utils/include/b_resources/b_constants.h index 721622c8b..2ec10dd53 100644 --- a/utils/include/b_resources/b_constants.h +++ b/utils/include/b_resources/b_constants.h @@ -62,7 +62,7 @@ constexpr int DECIMAL_BASE = 10; // 十进制基数 constexpr int HEADER_SIZE = 512; // 打包文件头部Header结构体大小 constexpr int BLOCK_SIZE = 512; // 打包文件数据段尾部补充的全零字节块上限大小 constexpr int BLOCK_PADDING_SIZE = 1024; // 打包文件尾部追加的全零字节块大小 -constexpr off_t BIG_FILE_BOUNDARY = 1024 * 1024 * 1024; // 大文件边界 +constexpr off_t BIG_FILE_BOUNDARY = 10 * 1024 * 1024; // 大文件边界 constexpr unsigned long BIG_FILE_NAME_SIZE = 16; // 大文件名长度(hash处理) constexpr int PATHNAME_MAX_SIZE = 100; // 打包文件头部Header结构体各字段数组/字符串大小。 -- Gitee