GeezerVison is showing github.com — fs: expose frsize field in statfs · nodejs/node@40ccfde
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 |
|---|
@@ -7615,6 +7615,7 @@ numeric values will be `bigint` instead of `number`. | 7615 | 7615 | StatFs { | 7616 | 7616 | type: 1397114950, | 7617 | 7617 | bsize: 4096, | | 7618 | + frsize: 4096, | 7618 | 7619 | blocks: 121938943, | 7619 | 7620 | bfree: 61058895, | 7620 | 7621 | bavail: 61058895, | @@ -7629,6 +7630,7 @@ StatFs { | 7629 | 7630 | StatFs { | 7630 | 7631 | type: 1397114950n, | 7631 | 7632 | bsize: 4096n, | | 7633 | + frsize: 4096n, | 7632 | 7634 | blocks: 121938943n, | 7633 | 7635 | bfree: 61058895n, | 7634 | 7636 | bavail: 61058895n, | @@ -7685,6 +7687,16 @@ added: | 7685 | 7687 |
| 7686 | 7688 | Optimal transfer block size. | 7687 | 7689 |
| | 7690 | +#### `statfs.frsize` | | 7691 | +
| | 7692 | +<!-- YAML | | 7693 | +added: REPLACEME | | 7694 | +--> | | 7695 | +
| | 7696 | +* Type: {number|bigint} | | 7697 | +
| | 7698 | +Fundamental file system block size. | | 7699 | +
| 7688 | 7700 | #### `statfs.ffree` | 7689 | 7701 |
| 7690 | 7702 | <!-- 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, | |
|