简体   繁体   English

什么是文件系统协议,它如何工作?

[英]What is a filesystem protocol and how does it work?

Just as example I will pick up Plan9's filesystem protocol called 9P (aka Styx). 作为示例,我将选择Plan9的文件系统协议9P(又名Styx)。 As the article in Wikipedia states: 正如Wikipedia中的文章所述:

9P is a network protocol developed (...) as the means of connecting the components of a Plan 9 system 9P是开发为(...)作为连接Plan 9系统组件的方式的网络协议

I want to know, from the programming perspective, what are the technologies that should be used to build such a module communication system. 从编程的角度来看,我想知道构建此类模块通信系统应使用哪些技术。 And what are the requirements for the operating system (read Unix derivatives) to support this protocol. 支持该协议的操作系统(阅读Unix派生产品)有哪些要求?

In my understanding, each component ( id est , application, module) of the entire network must have a private controller (or should this controller be shared across the system?), to send requests and receive responses, with the ability to perform the translation tasks between the internal logic of the individual application and the communication protocol itself (may be a specific language such as XML?, database, or even some kind of filesystem reflection of information?). 以我的理解,整个网络的每个组件( id est ,应用程序,模块)都必须具有一个专用控制器(或者该控制器是否应在整个系统中共享?),以便能够发送请求和接收响应,并具有执行翻译的能力单个应用程序的内部逻辑和通信协议本身之间的任务(可能是特定语言,例如XML ?、数据库,甚至某种文件系统的信息反射?)。 From this (my) point of view the described system may be defined as a variant of client-server architecture but been projected to the local or restricted network scope and with emphasis on direct data access and efficiency. 从这个角度(我的观点),可以将所描述的系统定义为客户端-服务器体系结构的一种变体,但是可以将其投影到本地或受限制的网络范围,并着重于直接数据访问和效率。 That's how I see the design of a filesystem protocol ... 这就是我如何看待文件系统协议的设计...

I just initiated the study of operating systems' process/application communication techniques and would like to develop a mini filesystem protocol to see this concepts in action. 我刚刚开始研究操作系统的过程/应用程序通信技术,并想开发一个小型文件系统协议以了解该概念的实际作用。 I don't have any real and concrete work plan due to leak of theoretical fundaments so any explanations, literature suggestions, examples and just comments will be welcome! 由于理论基础的泄漏,我没有任何实际而具体的工作计划,因此,欢迎您提供任何解释,文献建议,示例和评论!

You can read all about the Plan9 network in the /sys/doc section (or online html , ps , pdf ). 您可以在/sys/doc部分(或在线htmlpspdf )中阅读有关Plan9网络的所有信息。

The high-level way that this works is similar to your understanding, the system has 17 protocol messages (stuff like open , create , walk and remove ). 这种工作的高级方式类似于您的理解,系统具有17条协议消息(诸如opencreatewalkremove类的东西)。 There is an RPC mechanism that takes care of sending and receiving the messages from the server. 有一个RPC机制,负责从服务器发送和接收消息。 Here's a quote from the paper: 这是这篇论文的引文:

A kernel data structure, the channel , is a handle to a file server. 内核数据结构channel是文件服务器的句柄。 Operations on a channel generate the following 9P messages. 通道上的操作会产生以下9P消息。 The session and attach messages authenticate a connection, established by means external to 9P, and validate its user. sessionattach消息对通过9P外部方式建立的连接进行身份验证,并验证其用户。 The result is an authenticated channel referencing the root of the server. 结果是引用服务器根目录的经过身份验证的通道。 The clone message makes a new channel identical to an existing channel, much like the dup system call. clone消息使新通道与现有通道相同,非常类似于dup系统调用。 A channel may be moved to a file on the server using a walk message to descend each level in the hierarchy. 可以使用walk消息将频道移至服务器上的文件,以降低层次结构中的每个级别。 The stat and wstat messages read and write the attributes of the file referenced by a channel. statwstat消息读取和写入通道引用的文件的属性。 The open message prepares a channel for subsequent read and write messages to access the contents of the file. open消息准备用于随后的信道readwrite的消息,以访问该文件的内容。 Create and remove perform the actions implied by their names on the file referenced by the channel. Createremove在通道引用的文件上执行其名称所隐含的操作。 The clunk message discards a channel without affecting the file. clunk消息丢弃一个信道,而不会影响该文件。

What's neat about Plan9 is that this interface is ubiquitous in the operating system. Plan9的巧妙之处在于该接口在操作系统中无处不在。 Lots of things present this interface (a file server). 该接口(文件服务器)提供了很多东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM