How to implement a very simple filesystem?

前端 未结 5 1152
滥情空心
滥情空心 2021-01-30 04:31

I am wondering how the OS is reading/writing to the hard drive.
I would like as an exercise to implement a simple filesystem with no directories that can read and write file

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-30 04:48

    Take a look at FUSE: http://fuse.sourceforge.net/

    This will allow you to write a filesystem without having to actually write a device driver. From there, I'd start with a single file. Basically create a file that's (for example) 100MB in length, then write your routines to read and write from that file.

    Once you're happy with the results, then you can look into writing a device driver, and making your driver run against a physical disk.

    The nice thing is you can use almost any language with FUSE, not just C/C++.

提交回复
热议问题