Skip to content

Commit a267bd6

Browse files
Remove InoIssuer abstraction
1 parent c488d4b commit a267bd6

File tree

3 files changed

+7
-16
lines changed

3 files changed

+7
-16
lines changed

src/fd.ts

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,26 +116,17 @@ export abstract class Fd {
116116
}
117117
}
118118

119-
class InoIssuer {
120-
// NOTE: ino 0 is reserved for the root directory
121-
private next_ino: bigint = 1n;
122-
123-
issue(_node: unknown): bigint {
124-
// TODO: consider recycling ino if the node is deallocated
125-
return this.next_ino++;
126-
}
127-
}
128-
129119
export abstract class Inode {
130120
ino: bigint;
131121

132122
constructor() {
133-
this.ino = Inode.issue_ino(this);
123+
this.ino = Inode.issue_ino();
134124
}
135125

136-
static default_issuer = new InoIssuer();
137-
static issue_ino(node: unknown): bigint {
138-
return Inode.default_issuer.issue(node);
126+
// NOTE: ino 0 is reserved for the root directory
127+
private static next_ino: bigint = 1n;
128+
static issue_ino(): bigint {
129+
return Inode.next_ino++;
139130
}
140131
static root_ino(): bigint {
141132
return 0n;

src/fs_mem.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ export class ConsoleStdout extends Fd {
726726

727727
constructor(write: (buffer: Uint8Array) => void) {
728728
super();
729-
this.ino = Inode.issue_ino(this);
729+
this.ino = Inode.issue_ino();
730730
this.write = write;
731731
}
732732

src/fs_opfs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export class OpenSyncOPFSFile extends Fd {
7070
constructor(file: SyncOPFSFile) {
7171
super();
7272
this.file = file;
73-
this.ino = Inode.issue_ino(this);
73+
this.ino = Inode.issue_ino();
7474
}
7575

7676
fd_allocate(offset: bigint, len: bigint): number {

0 commit comments

Comments
 (0)