From 8fe9f9df7ca17aa14b3d22d6f82d5491bdaec0c8 Mon Sep 17 00:00:00 2001 From: 18721213663 Date: Sat, 8 Jun 2024 19:14:29 +0800 Subject: [PATCH 1/3] test liburing Signed-off-by: 18721213663 --- bundle.json | 3 ++- interfaces/kits/js/BUILD.gn | 4 ++++ interfaces/kits/js/src/mod_fs/properties/stat.cpp | 10 +++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/bundle.json b/bundle.json index a54d1e9e4..7065d0c65 100644 --- a/bundle.json +++ b/bundle.json @@ -47,7 +47,8 @@ ], "third_party": [ "e2fsprogs", - "openssl" + "openssl", + "liburing" ] }, "build": { diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/BUILD.gn index 6c98d30f3..ec453688e 100644 --- a/interfaces/kits/js/BUILD.gn +++ b/interfaces/kits/js/BUILD.gn @@ -119,6 +119,8 @@ ohos_shared_library("fileio") { defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ] } +out_dir = root_out_dir + "/third_party_liburing/liburing" + ohos_shared_library("fs") { subsystem_name = "filemanagement" part_name = "file_api" @@ -134,6 +136,7 @@ ohos_shared_library("fs") { "${src_path}/mod_fs/properties/copy_listener", "${utils_path}/common/include", "//third_party/libuv/include", + "${out_dir}/src/include", ] sources = [ @@ -241,6 +244,7 @@ ohos_shared_library("fs") { deps += [ "${file_api_path}/interfaces/kits/native:remote_uri_native", "${file_api_path}/interfaces/kits/rust:rust_file", + "//third_party/liburing:liburing" ] } } diff --git a/interfaces/kits/js/src/mod_fs/properties/stat.cpp b/interfaces/kits/js/src/mod_fs/properties/stat.cpp index 20f1d77ab..41d956efa 100644 --- a/interfaces/kits/js/src/mod_fs/properties/stat.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/stat.cpp @@ -22,6 +22,7 @@ #include "common_func.h" #include "file_utils.h" #include "filemgmt_libhilog.h" +#include "liburing.h" namespace OHOS::FileManagement::ModuleFileIO { using namespace std; @@ -83,7 +84,14 @@ napi_value Stat::Sync(napi_env env, napi_callback_info info) if (!succ) { return nullptr; } - + struct io_uring ring; + auto ret = io_uring_queue_init(64, &ring, 0); + if (ret < 0) { + HILOGE("Failed to init iouring"); + NError(ret).ThrowErr(env); + return nullptr; + } + HILOGI("iouring init"); std::unique_ptr stat_req = { new (std::nothrow) uv_fs_t, CommonFunc::fs_req_cleanup }; if (!stat_req) { -- Gitee From 04c7d028281130956f7bba60a50823cb5345e125 Mon Sep 17 00:00:00 2001 From: zhuhongtao666 Date: Thu, 13 Jun 2024 13:24:49 +0000 Subject: [PATCH 2/3] update bundle.json. test liburing Signed-off-by: zhuhongtao666 --- bundle.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bundle.json b/bundle.json index 7065d0c65..8cb5dad83 100644 --- a/bundle.json +++ b/bundle.json @@ -43,12 +43,12 @@ "samgr", "app_file_service", "os_account", - "libuv" + "libuv", + "liburing" ], "third_party": [ "e2fsprogs", - "openssl", - "liburing" + "openssl" ] }, "build": { -- Gitee From 86e0b1fdbd65cc1926a9c29f11e158dd6dc5069f Mon Sep 17 00:00:00 2001 From: zhuhongtao666 Date: Thu, 13 Jun 2024 13:26:05 +0000 Subject: [PATCH 3/3] update interfaces/kits/js/BUILD.gn. test liburing Signed-off-by: zhuhongtao666 --- interfaces/kits/js/BUILD.gn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/BUILD.gn index ec453688e..5a29ab566 100644 --- a/interfaces/kits/js/BUILD.gn +++ b/interfaces/kits/js/BUILD.gn @@ -240,11 +240,11 @@ ohos_shared_library("fs") { "hitrace:hitrace_meter", "ipc:ipc_core", "samgr:samgr_proxy", + "liburing:liburing" ] deps += [ "${file_api_path}/interfaces/kits/native:remote_uri_native", - "${file_api_path}/interfaces/kits/rust:rust_file", - "//third_party/liburing:liburing" + "${file_api_path}/interfaces/kits/rust:rust_file" ] } } -- Gitee