scaraOS icon indicating copy to clipboard operation
scaraOS copied to clipboard

File handling updates

Open gdarcy opened this issue 16 years ago • 6 comments

Updated code now enables you to manipulate files directly as an alternative to using the fdt system. Currently only supports opening new files and closing files. To what extent should we work to abstract a layer over the fdt code?

gdarcy avatar Apr 19 '10 10:04 gdarcy

Further abstractions duly committed.

gdarcy avatar Apr 19 '10 11:04 gdarcy

Any reason not to start working on write?

Things that appear necessary for it:

  • Necessary handling for STDOUT as a write target
  • Implementation of pwrite for ext2

    Anything I'm missing?

  • gdarcy avatar Apr 26 '10 11:04 gdarcy

    Heh, very much:

    • floppy driver support for write
    • ext2 pwrite includes block allocation and metadata updates
    • how to co-ordinate file-size changes and consequent block allocations with writing blocks vs. page cache and making sure everything happens in right order
    • writes to page-cache can trigger reads if not overwriting a whole page
    • kernel thread to flush page-cache periodically
    • perhaps even vm-balancing code to squeeze page-cache when other allocations fail

    IOW, read side of vfs is waaay less than half the work!

    stdin/stdout are total hacks at the moment and require a character device layer at the very least, and a terminal implementation ideally :)

    Still too tied up working on qemu things in citrix as of yet, just committed first cut of fork() implementation though :)

    giannitedesco avatar Jun 11 '10 17:06 giannitedesco

    Heh, there was me hoping for an easy job :P Once I've finished and committed the kernel/user refactor, I'll rough in the kernel/user write support and start drilling down towards the floppy driver.

    At this point, I figure it's probably more useful for me to code the wrong thing than to code nothing -- it's ages since I did anything on here, and it took me a while to get back up to speed.

    gdarcy avatar Jun 11 '10 19:06 gdarcy

    Yeah, a lot of the bits for write support are orthogonal, eg. low level floppy disk writes and block layer stuff like queuing.... I'm not even sure myself how it'll all link in to the page-cache. An ATA hard-disk and ATAPI CD-ROM driver would also come in handy :)

    giannitedesco avatar Jun 12 '10 11:06 giannitedesco

    Actually kernel/read.c could do with being re-worked to use the page-cache. Rather than call pread directly just do a loop to pull everything in to page-cache and then kernel_read() would memcpy it in to the buffer and sys_read would copy_to_user it.

    giannitedesco avatar Oct 05 '10 17:10 giannitedesco