From: Tulio A M Mendes Date: Sat, 14 Feb 2026 02:08:36 +0000 (-0300) Subject: refactor: migrate pty and fat to inode_operations X-Git-Url: https://projects.tadryanom.me/docs/static/git-logo.png?a=commitdiff_plain;h=132760e30c4077af550ec676da394bee5d1aa9fc;p=AdrOS.git refactor: migrate pty and fat to inode_operations - pty: pty_pts_dir_iops with lookup/readdir; pty_pts_dir_fops now empty - fat: fat_dir_iops with lookup/readdir/create/mkdir/unlink/rmdir/rename; fat_file_iops with truncate; fat_dir_fops and fat_file_fops keep only close and read/write/close respectively - ext2 has no VFS integration yet, no migration needed All node creation sites wire both f_ops and i_ops. 20/20 smoke tests pass. --- diff --git a/src/kernel/fat.c b/src/kernel/fat.c index 7864128..b5e9eb0 100644 --- a/src/kernel/fat.c +++ b/src/kernel/fat.c @@ -487,12 +487,18 @@ static const struct file_operations fat_file_fops = { .read = fat_file_read, .write = fat_file_write, .close = fat_close_impl, +}; + +static const struct inode_operations fat_file_iops = { .truncate = fat_truncate_impl, }; static const struct file_operations fat_dir_fops = { .close = fat_close_impl, - .finddir = fat_finddir, +}; + +static const struct inode_operations fat_dir_iops = { + .lookup = fat_finddir, .readdir = fat_readdir_impl, .create = fat_create_impl, .mkdir = fat_mkdir_impl, @@ -522,11 +528,13 @@ static struct fat_node* fat_make_node(const struct fat_dirent* de, uint32_t pare fn->vfs.length = 0; fn->vfs.inode = fn->first_cluster; fn->vfs.f_ops = &fat_dir_fops; + fn->vfs.i_ops = &fat_dir_iops; } else { fn->vfs.flags = FS_FILE; fn->vfs.length = de->file_size; fn->vfs.inode = fn->first_cluster; fn->vfs.f_ops = &fat_file_fops; + fn->vfs.i_ops = &fat_file_iops; } return fn; @@ -1164,6 +1172,7 @@ fs_node_t* fat_mount(int drive, uint32_t partition_lba) { g_fat_root.parent_cluster = 0; g_fat_root.dir_entry_offset = 0; g_fat_root.vfs.f_ops = &fat_dir_fops; + g_fat_root.vfs.i_ops = &fat_dir_iops; g_fat_ready = 1; diff --git a/src/kernel/pty.c b/src/kernel/pty.c index 24f2ff5..8efb64e 100644 --- a/src/kernel/pty.c +++ b/src/kernel/pty.c @@ -125,8 +125,10 @@ static const struct file_operations pty_ptmx_fops = { .poll = pty_master_poll_fn, }; -static const struct file_operations pty_pts_dir_fops = { - .finddir = pty_pts_finddir, +static const struct file_operations pty_pts_dir_fops = {0}; + +static const struct inode_operations pty_pts_dir_iops = { + .lookup = pty_pts_finddir, .readdir = pty_pts_readdir, }; @@ -249,6 +251,7 @@ void pty_init(void) { g_dev_pts_dir_node.flags = FS_DIRECTORY; g_dev_pts_dir_node.inode = 5; g_dev_pts_dir_node.f_ops = &pty_pts_dir_fops; + g_dev_pts_dir_node.i_ops = &pty_pts_dir_iops; devfs_register_device(&g_dev_pts_dir_node); }