如何实现一个非常简单的文件系统? [英] How to implement a very simple filesystem?

查看:219
本文介绍了如何实现一个非常简单的文件系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道操作系统如何读/写硬盘。

我想作为一个练习来实现一个简单的文件系统,没有可以读写文件的目录。

我该从哪里开始?

C / C ++会诀窍吗?还是必须采用更低层次的方法?

一个人太过分了处理?

解决方案

看看FUSE: http://fuse.sourceforge.net/

这将允许你写一个文件系统,而不必真正写一个设备驱动程序。从那里,我会从一个单一的文件开始。基本上创建一个文件(例如)100MB的长度,然后写你的例程来读取和写入该文件。

一旦您对结果感到满意,那么您可以考虑编写设备驱动程序,并使您的驱动程序在物理磁盘上运行。



好的是你可以使用几乎所有的FUSE语言,而不仅仅是C / C ++。

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 files.
Where do I start?
Will C/C++ do the trick or do I have to go with a more low level approach?
Is it too much for one person to handle?

解决方案

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++.

这篇关于如何实现一个非常简单的文件系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆