What is a file system protocol and how does it work?

As an example, I will select a Plan9 file system protocol called 9P (aka Styx). As stated in the Wikipedia article:

9P is a network protocol developed (...) as a means of connecting Plan 9 system components

I want to know, in terms of programming, which technologies should be used to create such a modular communication system. And what are the requirements for the operating system (read Unix derivatives) to support this protocol.

In my understanding, each component (id est, application, module) of the entire network should have a private controller (or should this controller be shared through the system?), Send requests and receive answers, with the ability to perform translation tasks between the internal logic of a separate application and the communication protocol itself (can it be a specific language, such as XML ?, a database, or even some kind of reflection of information in the file system?). From this (my) point of view, the described system can be defined as a variant of the client-server architecture, but is projected into a local or limited network and with an emphasis on direct access to data and efficiency. This is how I see the file system protocol design ...

I was just starting to learn the methods of connecting processes / applications of the operating system and would like to develop a mini file system protocol to see these concepts in action. I do not have a real and concrete work plan due to a leak of theoretical foundations, so any explanations, suggestions from the literature, examples and just comments will be welcome!

+4
source share
1 answer

You can read all about the Plan9 network in the /sys/doc section (or online html , ps , pdf ).

The high-level way of working is similar to your understanding, the system has 17 protocol messages (for example, open , create , walk and remove ). There is an RPC mechanism that provides sending and receiving messages from the server. Here is a quote from the article:

The kernel data structure, the channel, is a file server descriptor. Channel operations generate the following 9P messages. session and attach messages authenticate the connection established using external 9P tools and verify its user. The result is an authenticated channel that references the server root. The clone message makes the new channel identical to the existing channel, similar to the dup system call. A channel can be moved to a file on the server using the walk message to lower each level in the hierarchy. The stat and wstat read and write the attributes of the file the channel refers to. The open message prepares a channel for subsequent read and write messages to access the contents of the file. create and remove perform the actions indicated by their names in the file referenced by the channel. The clunk message discards the channel without affecting the file.

What accuracy in Plan9 is that this interface is ubiquitous in the operating system. Many things represent this interface (file server).

+2
source

Source: https://habr.com/ru/post/1335325/


All Articles