Skip to content

Commit cce9e11

Browse files
joyeecheungruyadorno
authored andcommitted
src: move FsStatsOffset and kFsStatsBufferLength to node_file.h
To avoid bloating env.h, as they are only used in node_file.* PR-URL: #45498 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 4a4f280 commit cce9e11

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

src/env.h

-27
Original file line numberDiff line numberDiff line change
@@ -99,33 +99,6 @@ class ModuleWrap;
9999
class Environment;
100100
class Realm;
101101

102-
enum class FsStatsOffset {
103-
kDev = 0,
104-
kMode,
105-
kNlink,
106-
kUid,
107-
kGid,
108-
kRdev,
109-
kBlkSize,
110-
kIno,
111-
kSize,
112-
kBlocks,
113-
kATimeSec,
114-
kATimeNsec,
115-
kMTimeSec,
116-
kMTimeNsec,
117-
kCTimeSec,
118-
kCTimeNsec,
119-
kBirthTimeSec,
120-
kBirthTimeNsec,
121-
kFsStatsFieldsNumber
122-
};
123-
124-
// Stat fields buffers contain twice the number of entries in an uv_stat_t
125-
// because `fs.StatWatcher` needs room to store 2 `fs.Stats` instances.
126-
constexpr size_t kFsStatsBufferLength =
127-
static_cast<size_t>(FsStatsOffset::kFsStatsFieldsNumber) * 2;
128-
129102
// Disables zero-filling for ArrayBuffer allocations in this scope. This is
130103
// similar to how we implement Buffer.allocUnsafe() in JS land.
131104
class NoArrayBufferZeroFillScope {

src/node_file.h

+27
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,33 @@ namespace fs {
1313

1414
class FileHandleReadWrap;
1515

16+
enum class FsStatsOffset {
17+
kDev = 0,
18+
kMode,
19+
kNlink,
20+
kUid,
21+
kGid,
22+
kRdev,
23+
kBlkSize,
24+
kIno,
25+
kSize,
26+
kBlocks,
27+
kATimeSec,
28+
kATimeNsec,
29+
kMTimeSec,
30+
kMTimeNsec,
31+
kCTimeSec,
32+
kCTimeNsec,
33+
kBirthTimeSec,
34+
kBirthTimeNsec,
35+
kFsStatsFieldsNumber
36+
};
37+
38+
// Stat fields buffers contain twice the number of entries in an uv_stat_t
39+
// because `fs.StatWatcher` needs room to store 2 `fs.Stats` instances.
40+
constexpr size_t kFsStatsBufferLength =
41+
static_cast<size_t>(FsStatsOffset::kFsStatsFieldsNumber) * 2;
42+
1643
class BindingData : public SnapshotableObject {
1744
public:
1845
explicit BindingData(Environment* env, v8::Local<v8::Object> wrap);

0 commit comments

Comments
 (0)