我正在尝试编写程序以用作可编程目录,换句话说:用户或其他系统打开该目录并读/写文件或目录。我尝试创建程序来缓存内存中最常用的文件(减少 HDD 的 I/O),但现在我不知道如何实现这一点。可能有一些关于此的文档,但我找不到它们。我知道有 FUSE、NFS 等,但阅读它们的源代码相当困难。如果有人有关于 C 语言实现的信息,我将非常感激。
对不起我的英语..
I'm trying to write program to work as programmable directory, in other words: User, or other systems open that directory and read/write files or dirs. I try to create program to cache most used files in memory (less I/O to HDD), but right now I don't know how to achive that. There are probably some docs about this but I can't find them. I know that there is FUSE, NFS and others, but reading their source is quite difficult. If any one has info about implementation in C lang I'll be very grateful.
Sorry for my English..
发布评论
评论(4)
FUSE 有一个 C 接口 - 看看他们的 Hello World 示例。
FUSE has a C interface - take a look at their Hello World example.
如果您想要一个简单的实现,请尝试Python的FUSE库。可以在此处找到快速教程。
If you want a simple implementation, try Python's FUSE library. A quick tutorial can be found here.
您可以查看 GIO 库 — 它是 GTK 的一部分,但可以单独使用。该文档非常详尽,如果您需要进行一些快速原型设计,可以使用 PyGTK GIO 绑定,在返回并用 C 编写之前进行混乱。
它已根据 LGPL 获得许可。
You could have a look at the GIO library — it's part of GTK, but can be used separately. The documentation is pretty thorough, and if you need to do some quick prototyping you can use the PyGTK GIO bindings to mess around before going back and writing it in C.
It's licensed under the LGPL.
如果您发现用 Python 编码更容易,可以使用 cx_Freeze 创建编译程序。
If you find it easier to code in Python, it's possible to create a compiled program using cx_Freeze.