From cce9e11d2dc997ac3f43f89c810a9c3518cb34aa Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Sat, 19 Nov 2022 19:22:20 +0100 Subject: [PATCH] src: move FsStatsOffset and kFsStatsBufferLength to node_file.h To avoid bloating env.h, as they are only used in node_file.* PR-URL: https://github.com/nodejs/node/pull/45498 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Richard Lau Reviewed-By: Yagiz Nizipli Reviewed-By: Anna Henningsen Reviewed-By: Daeyeon Jeong Reviewed-By: James M Snell --- src/env.h | 27 --------------------------- src/node_file.h | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/env.h b/src/env.h index 58f1dec7718c2f..dda1e391fff8f4 100644 --- a/src/env.h +++ b/src/env.h @@ -99,33 +99,6 @@ class ModuleWrap; class Environment; class Realm; -enum class FsStatsOffset { - kDev = 0, - kMode, - kNlink, - kUid, - kGid, - kRdev, - kBlkSize, - kIno, - kSize, - kBlocks, - kATimeSec, - kATimeNsec, - kMTimeSec, - kMTimeNsec, - kCTimeSec, - kCTimeNsec, - kBirthTimeSec, - kBirthTimeNsec, - kFsStatsFieldsNumber -}; - -// Stat fields buffers contain twice the number of entries in an uv_stat_t -// because `fs.StatWatcher` needs room to store 2 `fs.Stats` instances. -constexpr size_t kFsStatsBufferLength = - static_cast(FsStatsOffset::kFsStatsFieldsNumber) * 2; - // Disables zero-filling for ArrayBuffer allocations in this scope. This is // similar to how we implement Buffer.allocUnsafe() in JS land. class NoArrayBufferZeroFillScope { diff --git a/src/node_file.h b/src/node_file.h index f30bd5e8a58d97..a043f8a0eaea55 100644 --- a/src/node_file.h +++ b/src/node_file.h @@ -13,6 +13,33 @@ namespace fs { class FileHandleReadWrap; +enum class FsStatsOffset { + kDev = 0, + kMode, + kNlink, + kUid, + kGid, + kRdev, + kBlkSize, + kIno, + kSize, + kBlocks, + kATimeSec, + kATimeNsec, + kMTimeSec, + kMTimeNsec, + kCTimeSec, + kCTimeNsec, + kBirthTimeSec, + kBirthTimeNsec, + kFsStatsFieldsNumber +}; + +// Stat fields buffers contain twice the number of entries in an uv_stat_t +// because `fs.StatWatcher` needs room to store 2 `fs.Stats` instances. +constexpr size_t kFsStatsBufferLength = + static_cast(FsStatsOffset::kFsStatsFieldsNumber) * 2; + class BindingData : public SnapshotableObject { public: explicit BindingData(Environment* env, v8::Local wrap);