@@ -38,8 +38,6 @@ import { wrapFileSystem, checkChildProcess } from "./permissions.js";
3838import { UserManager } from "./user.js" ;
3939import { SocketTable } from "./socket-table.js" ;
4040import { TimerTable } from "./timer-table.js" ;
41- import { InodeTable } from "./inode-table.js" ;
42- import { InMemoryFileSystem } from "../shared/in-memory-fs.js" ;
4341import {
4442 FILETYPE_REGULAR_FILE ,
4543 FILETYPE_DIRECTORY ,
@@ -72,7 +70,6 @@ export function createKernel(options: KernelOptions): Kernel {
7270class KernelImpl implements Kernel {
7371 private vfs : VirtualFileSystem ;
7472 private mountTable : MountTable ;
75- private rawInMemoryFs ?: InMemoryFileSystem ;
7673 private fdTableManager = new FDTableManager ( ) ;
7774 private processTable ! : ProcessTable ;
7875 private pipeManager = new PipeManager ( ) ;
@@ -81,7 +78,6 @@ class KernelImpl implements Kernel {
8178 private commandRegistry = new CommandRegistry ( ) ;
8279 readonly socketTable : SocketTable ;
8380 readonly timerTable : TimerTable ;
84- readonly inodeTable : InodeTable ;
8581 private userManager : UserManager ;
8682 private drivers : RuntimeDriver [ ] = [ ] ;
8783 private driverPids = new Map < string , Set < number > > ( ) ;
@@ -109,12 +105,6 @@ class KernelImpl implements Kernel {
109105 } ,
110106 this . log . child ( { component : "pty" } ) ,
111107 ) ;
112- this . inodeTable = new InodeTable ( ) ;
113- if ( options . filesystem instanceof InMemoryFileSystem ) {
114- options . filesystem . setInodeTable ( this . inodeTable ) ;
115- this . rawInMemoryFs = options . filesystem ;
116- }
117-
118108 // Build mount table: root FS → /dev → /proc → user mounts.
119109 const mt = new MountTable ( options . filesystem ) ;
120110 mt . mount ( "/dev" , createDeviceBackend ( ) ) ;
@@ -834,9 +824,6 @@ class KernelImpl implements Kernel {
834824 const filetype = FILETYPE_REGULAR_FILE ;
835825 const fd = table . open ( path , flags , filetype ) ;
836826 const fdEntry = table . get ( fd ) ;
837- if ( fdEntry ) {
838- this . trackDescriptionInode ( fdEntry . description ) ;
839- }
840827
841828 // Stash the effective mode for the first write that materializes a new file.
842829 if ( created && ( flags & O_CREAT ) ) {
@@ -1471,7 +1458,7 @@ class KernelImpl implements Kernel {
14711458 // Close all FDs and remove the table
14721459 this . fdTableManager . remove ( pid ) ;
14731460
1474- // Release inode-backed file data after the last shared reference closes.
1461+ // Flush buffered writes when the last shared reference closes.
14751462 for ( const description of descriptions . values ( ) ) {
14761463 if ( description . refCount <= 0 ) {
14771464 this . releaseDescriptionInode ( description ) ;
@@ -1516,48 +1503,24 @@ class KernelImpl implements Kernel {
15161503 return data . length ;
15171504 }
15181505
1519- private trackDescriptionInode ( description : import ( "./types.js" ) . FileDescription ) : void {
1520- if ( ! this . rawInMemoryFs || description . inode !== undefined ) return ;
1521- const ino = this . rawInMemoryFs . getInodeForPath ( description . path ) ;
1522- if ( ino === null ) return ;
1523- description . inode = ino ;
1524- this . inodeTable . incrementOpenRefs ( ino ) ;
1525- }
1526-
15271506 private releaseDescriptionInode (
15281507 description : import ( "./types.js" ) . FileDescription ,
15291508 ) : void {
15301509 // Flush buffered writes to durable storage when the last FD is closed.
15311510 void this . vfs . fsync ?.( description . path ) ;
1532-
1533- if ( description . inode === undefined ) return ;
1534- this . inodeTable . decrementOpenRefs ( description . inode ) ;
1535- if ( this . inodeTable . shouldDelete ( description . inode ) ) {
1536- this . rawInMemoryFs ?. deleteInodeData ( description . inode ) ;
1537- this . inodeTable . delete ( description . inode ) ;
1538- }
1539- description . inode = undefined ;
15401511 }
15411512
15421513 private async readDescriptionFile (
15431514 description : import ( "./types.js" ) . FileDescription ,
15441515 ) : Promise < Uint8Array > {
1545- if ( description . inode !== undefined && this . rawInMemoryFs ) {
1546- return this . rawInMemoryFs . readFileByInode ( description . inode ) ;
1547- }
15481516 return this . vfs . readFile ( description . path ) ;
15491517 }
15501518
15511519 private async writeDescriptionFile (
15521520 description : import ( "./types.js" ) . FileDescription ,
15531521 content : Uint8Array ,
15541522 ) : Promise < void > {
1555- if ( description . inode !== undefined && this . rawInMemoryFs ) {
1556- this . rawInMemoryFs . writeFileByInode ( description . inode , content ) ;
1557- return ;
1558- }
15591523 await this . vfs . writeFile ( description . path , content ) ;
1560- this . trackDescriptionInode ( description ) ;
15611524 }
15621525
15631526 private prepareOpenSync ( path : string , flags : number ) : boolean {
@@ -1572,9 +1535,6 @@ class KernelImpl implements Kernel {
15721535 offset : number ,
15731536 length : number ,
15741537 ) : Promise < Uint8Array > {
1575- if ( description . inode !== undefined && this . rawInMemoryFs ) {
1576- return this . rawInMemoryFs . preadByInode ( description . inode , offset , length ) ;
1577- }
15781538 return this . vfs . pread ( description . path , offset , length ) ;
15791539 }
15801540
@@ -1583,12 +1543,7 @@ class KernelImpl implements Kernel {
15831543 offset : number ,
15841544 data : Uint8Array ,
15851545 ) : Promise < void > {
1586- if ( description . inode !== undefined && this . rawInMemoryFs ) {
1587- this . rawInMemoryFs . pwriteByInode ( description . inode , offset , data ) ;
1588- return ;
1589- }
15901546 await this . vfs . pwrite ( description . path , offset , data ) ;
1591- this . trackDescriptionInode ( description ) ;
15921547 }
15931548
15941549 private async getDescriptionSize (
@@ -1600,9 +1555,6 @@ class KernelImpl implements Kernel {
16001555 private async statDescription (
16011556 description : import ( "./types.js" ) . FileDescription ,
16021557 ) : Promise < VirtualStat > {
1603- if ( description . inode !== undefined && this . rawInMemoryFs ) {
1604- return this . rawInMemoryFs . statByInode ( description . inode ) ;
1605- }
16061558 return this . vfs . stat ( description . path ) ;
16071559 }
16081560
0 commit comments