X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/a7384053efe345d199440720b437a28e91058ff3..ea77b9c3fc7fb9bf9d7f9604fc187c8049212a2a:/lunaix-os/kernel/fs/ramfs/ramfs.c diff --git a/lunaix-os/kernel/fs/ramfs/ramfs.c b/lunaix-os/kernel/fs/ramfs/ramfs.c index 3dcbd59..a1018da 100644 --- a/lunaix-os/kernel/fs/ramfs/ramfs.c +++ b/lunaix-os/kernel/fs/ramfs/ramfs.c @@ -42,6 +42,7 @@ volatile static inode_t ino = 0; extern const struct v_inode_ops ramfs_inode_ops; +extern const struct v_file_ops ramfs_file_ops; int ramfs_readdir(struct v_file* file, struct dir_context* dctx) @@ -51,8 +52,10 @@ ramfs_readdir(struct v_file* file, struct dir_context* dctx) llist_for_each(pos, n, &file->dnode->children, siblings) { if (i++ >= dctx->index) { - dctx->read_complete_callback( - dctx, pos->name.value, pos->name.len, 0); + dctx->read_complete_callback(dctx, + pos->name.value, + pos->name.len, + vfs_get_dtype(pos->inode->itype)); return 1; } } @@ -88,7 +91,7 @@ ramfs_inode_init(struct v_superblock* vsb, struct v_inode* inode) { inode->id = ino++; inode->ops = &ramfs_inode_ops; - inode->default_fops = &default_file_ops; + inode->default_fops = &ramfs_file_ops; } int @@ -127,4 +130,10 @@ const struct v_inode_ops ramfs_inode_ops = { .mkdir = ramfs_mkdir, default_inode_dirlookup, .create = ramfs_create, .open = default_inode_open, - .rename = default_inode_rename }; \ No newline at end of file + .rename = default_inode_rename }; + +const struct v_file_ops ramfs_file_ops = { .readdir = ramfs_readdir, + .close = default_file_close, + .read = default_file_read, + .write = default_file_write, + .seek = default_file_seek }; \ No newline at end of file