GeezerVison is showing github.com — fs: expose frsize field in statfs · nodejs/node@db66a96
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: doc/api/fs.md +12Lines changed: 12 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -7895,6 +7895,7 @@ numeric values will be `bigint` instead of `number`. | 7895 | 7895 | StatFs { | 7896 | 7896 | type: 1397114950, | 7897 | 7897 | bsize: 4096, | | 7898 | + frsize: 4096, | 7898 | 7899 | blocks: 121938943, | 7899 | 7900 | bfree: 61058895, | 7900 | 7901 | bavail: 61058895, | @@ -7909,6 +7910,7 @@ StatFs { | 7909 | 7910 | StatFs { | 7910 | 7911 | type: 1397114950n, | 7911 | 7912 | bsize: 4096n, | | 7913 | + frsize: 4096n, | 7912 | 7914 | blocks: 121938943n, | 7913 | 7915 | bfree: 61058895n, | 7914 | 7916 | bavail: 61058895n, | @@ -7965,6 +7967,16 @@ added: | 7965 | 7967 |
| 7966 | 7968 | Optimal transfer block size. | 7967 | 7969 |
| | 7970 | +#### `statfs.frsize` | | 7971 | +
| | 7972 | +<!-- YAML | | 7973 | +added: REPLACEME | | 7974 | +--> | | 7975 | +
| | 7976 | +* Type: {number|bigint} | | 7977 | +
| | 7978 | +Fundamental file system block size. | | 7979 | +
| 7968 | 7980 | #### `statfs.ffree` | 7969 | 7981 |
| 7970 | 7982 | <!-- YAML | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/fs/utils.js +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -571,9 +571,10 @@ function getStatsFromBinding(stats, offset = 0) { | 571 | 571 | } | 572 | 572 |
| 573 | 573 | class StatFs { | 574 | | - constructor(type, bsize, blocks, bfree, bavail, files, ffree) { | | 574 | + constructor(type, bsize, frsize, blocks, bfree, bavail, files, ffree) { | 575 | 575 | this.type = type; | 576 | 576 | this.bsize = bsize; | | 577 | + this.frsize = frsize; | 577 | 578 | this.blocks = blocks; | 578 | 579 | this.bfree = bfree; | 579 | 580 | this.bavail = bavail; | @@ -584,7 +585,7 @@ class StatFs { | 584 | 585 |
| 585 | 586 | function getStatFsFromBinding(stats) { | 586 | 587 | return new StatFs( | 587 | | - stats[0], stats[1], stats[2], stats[3], stats[4], stats[5], stats[6], | | 588 | + stats[0], stats[1], stats[2], stats[3], stats[4], stats[5], stats[6], stats[7], | 588 | 589 | ); | 589 | 590 | } | 590 | 591 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/node_file-inl.h +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -153,6 +153,7 @@ void FillStatFsArray(AliasedBufferBase<NativeT, V8T>* fields, | 153 | 153 |
| 154 | 154 | SET_FIELD(kType, s->f_type); | 155 | 155 | SET_FIELD(kBSize, s->f_bsize); | | 156 | + SET_FIELD(kFrSize, s->f_frsize); | 156 | 157 | SET_FIELD(kBlocks, s->f_blocks); | 157 | 158 | SET_FIELD(kBFree, s->f_bfree); | 158 | 159 | SET_FIELD(kBAvail, s->f_bavail); | |
Collapse file Copy file name to clipboardExpand all lines: src/node_file.h +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -44,6 +44,7 @@ constexpr size_t kFsStatsBufferLength = | 44 | 44 | enum class FsStatFsOffset { | 45 | 45 | kType = 0, | 46 | 46 | kBSize, | | 47 | + kFrSize, | 47 | 48 | kBlocks, | 48 | 49 | kBFree, | 49 | 50 | kBAvail, | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-fs-promises.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -89,6 +89,7 @@ function verifyStatFsObject(stat, isBigint = false) { | 89 | 89 | assert.strictEqual(typeof stat, 'object'); | 90 | 90 | assert.strictEqual(typeof stat.type, valueType); | 91 | 91 | assert.strictEqual(typeof stat.bsize, valueType); | | 92 | + assert.strictEqual(typeof stat.frsize, valueType); | 92 | 93 | assert.strictEqual(typeof stat.blocks, valueType); | 93 | 94 | assert.strictEqual(typeof stat.bfree, valueType); | 94 | 95 | assert.strictEqual(typeof stat.bavail, valueType); | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-fs-statfs.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -7,7 +7,7 @@ function verifyStatFsObject(statfs, isBigint = false) { | 7 | 7 | const valueType = isBigint ? 'bigint' : 'number'; | 8 | 8 |
| 9 | 9 | [ | 10 | | - 'type', 'bsize', 'blocks', 'bfree', 'bavail', 'files', 'ffree', | | 10 | + 'type', 'bsize', 'frsize', 'blocks', 'bfree', 'bavail', 'files', 'ffree', | 11 | 11 | ].forEach((k) => { | 12 | 12 | assert.ok(Object.hasOwn(statfs, k)); | 13 | 13 | assert.strictEqual(typeof statfs[k], valueType, | |
|