xref: /OK3568_Linux_fs/kernel/Documentation/filesystems/9p.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun=======================================
4*4882a593Smuzhiyunv9fs: Plan 9 Resource Sharing for Linux
5*4882a593Smuzhiyun=======================================
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunAbout
8*4882a593Smuzhiyun=====
9*4882a593Smuzhiyun
10*4882a593Smuzhiyunv9fs is a Unix implementation of the Plan 9 9p remote filesystem protocol.
11*4882a593Smuzhiyun
12*4882a593SmuzhiyunThis software was originally developed by Ron Minnich <rminnich@sandia.gov>
13*4882a593Smuzhiyunand Maya Gokhale.  Additional development by Greg Watson
14*4882a593Smuzhiyun<gwatson@lanl.gov> and most recently Eric Van Hensbergen
15*4882a593Smuzhiyun<ericvh@gmail.com>, Latchesar Ionkov <lucho@ionkov.net> and Russ Cox
16*4882a593Smuzhiyun<rsc@swtch.com>.
17*4882a593Smuzhiyun
18*4882a593SmuzhiyunThe best detailed explanation of the Linux implementation and applications of
19*4882a593Smuzhiyunthe 9p client is available in the form of a USENIX paper:
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun   https://www.usenix.org/events/usenix05/tech/freenix/hensbergen.html
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunOther applications are described in the following papers:
24*4882a593Smuzhiyun
25*4882a593Smuzhiyun	* XCPU & Clustering
26*4882a593Smuzhiyun	  http://xcpu.org/papers/xcpu-talk.pdf
27*4882a593Smuzhiyun	* KVMFS: control file system for KVM
28*4882a593Smuzhiyun	  http://xcpu.org/papers/kvmfs.pdf
29*4882a593Smuzhiyun	* CellFS: A New Programming Model for the Cell BE
30*4882a593Smuzhiyun	  http://xcpu.org/papers/cellfs-talk.pdf
31*4882a593Smuzhiyun	* PROSE I/O: Using 9p to enable Application Partitions
32*4882a593Smuzhiyun	  http://plan9.escet.urjc.es/iwp9/cready/PROSE_iwp9_2006.pdf
33*4882a593Smuzhiyun	* VirtFS: A Virtualization Aware File System pass-through
34*4882a593Smuzhiyun	  http://goo.gl/3WPDg
35*4882a593Smuzhiyun
36*4882a593SmuzhiyunUsage
37*4882a593Smuzhiyun=====
38*4882a593Smuzhiyun
39*4882a593SmuzhiyunFor remote file server::
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun	mount -t 9p 10.10.1.2 /mnt/9
42*4882a593Smuzhiyun
43*4882a593SmuzhiyunFor Plan 9 From User Space applications (http://swtch.com/plan9)::
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun	mount -t 9p `namespace`/acme /mnt/9 -o trans=unix,uname=$USER
46*4882a593Smuzhiyun
47*4882a593SmuzhiyunFor server running on QEMU host with virtio transport::
48*4882a593Smuzhiyun
49*4882a593Smuzhiyun	mount -t 9p -o trans=virtio <mount_tag> /mnt/9
50*4882a593Smuzhiyun
51*4882a593Smuzhiyunwhere mount_tag is the tag associated by the server to each of the exported
52*4882a593Smuzhiyunmount points. Each 9P export is seen by the client as a virtio device with an
53*4882a593Smuzhiyunassociated "mount_tag" property. Available mount tags can be
54*4882a593Smuzhiyunseen by reading /sys/bus/virtio/drivers/9pnet_virtio/virtio<n>/mount_tag files.
55*4882a593Smuzhiyun
56*4882a593SmuzhiyunOptions
57*4882a593Smuzhiyun=======
58*4882a593Smuzhiyun
59*4882a593Smuzhiyun  ============= ===============================================================
60*4882a593Smuzhiyun  trans=name	select an alternative transport.  Valid options are
61*4882a593Smuzhiyun  		currently:
62*4882a593Smuzhiyun
63*4882a593Smuzhiyun			========  ============================================
64*4882a593Smuzhiyun			unix 	  specifying a named pipe mount point
65*4882a593Smuzhiyun			tcp	  specifying a normal TCP/IP connection
66*4882a593Smuzhiyun			fd   	  used passed file descriptors for connection
67*4882a593Smuzhiyun                                  (see rfdno and wfdno)
68*4882a593Smuzhiyun			virtio	  connect to the next virtio channel available
69*4882a593Smuzhiyun				  (from QEMU with trans_virtio module)
70*4882a593Smuzhiyun			rdma	  connect to a specified RDMA channel
71*4882a593Smuzhiyun			========  ============================================
72*4882a593Smuzhiyun
73*4882a593Smuzhiyun  uname=name	user name to attempt mount as on the remote server.  The
74*4882a593Smuzhiyun  		server may override or ignore this value.  Certain user
75*4882a593Smuzhiyun		names may require authentication.
76*4882a593Smuzhiyun
77*4882a593Smuzhiyun  aname=name	aname specifies the file tree to access when the server is
78*4882a593Smuzhiyun  		offering several exported file systems.
79*4882a593Smuzhiyun
80*4882a593Smuzhiyun  cache=mode	specifies a caching policy.  By default, no caches are used.
81*4882a593Smuzhiyun
82*4882a593Smuzhiyun                        none
83*4882a593Smuzhiyun				default no cache policy, metadata and data
84*4882a593Smuzhiyun                                alike are synchronous.
85*4882a593Smuzhiyun			loose
86*4882a593Smuzhiyun				no attempts are made at consistency,
87*4882a593Smuzhiyun                                intended for exclusive, read-only mounts
88*4882a593Smuzhiyun                        fscache
89*4882a593Smuzhiyun				use FS-Cache for a persistent, read-only
90*4882a593Smuzhiyun				cache backend.
91*4882a593Smuzhiyun                        mmap
92*4882a593Smuzhiyun				minimal cache that is only used for read-write
93*4882a593Smuzhiyun                                mmap.  Northing else is cached, like cache=none
94*4882a593Smuzhiyun
95*4882a593Smuzhiyun  debug=n	specifies debug level.  The debug level is a bitmask.
96*4882a593Smuzhiyun
97*4882a593Smuzhiyun			=====   ================================
98*4882a593Smuzhiyun			0x01    display verbose error messages
99*4882a593Smuzhiyun			0x02    developer debug (DEBUG_CURRENT)
100*4882a593Smuzhiyun			0x04    display 9p trace
101*4882a593Smuzhiyun			0x08    display VFS trace
102*4882a593Smuzhiyun			0x10    display Marshalling debug
103*4882a593Smuzhiyun			0x20    display RPC debug
104*4882a593Smuzhiyun			0x40    display transport debug
105*4882a593Smuzhiyun			0x80    display allocation debug
106*4882a593Smuzhiyun			0x100   display protocol message debug
107*4882a593Smuzhiyun			0x200   display Fid debug
108*4882a593Smuzhiyun			0x400   display packet debug
109*4882a593Smuzhiyun			0x800   display fscache tracing debug
110*4882a593Smuzhiyun			=====   ================================
111*4882a593Smuzhiyun
112*4882a593Smuzhiyun  rfdno=n	the file descriptor for reading with trans=fd
113*4882a593Smuzhiyun
114*4882a593Smuzhiyun  wfdno=n	the file descriptor for writing with trans=fd
115*4882a593Smuzhiyun
116*4882a593Smuzhiyun  msize=n	the number of bytes to use for 9p packet payload
117*4882a593Smuzhiyun
118*4882a593Smuzhiyun  port=n	port to connect to on the remote server
119*4882a593Smuzhiyun
120*4882a593Smuzhiyun  noextend	force legacy mode (no 9p2000.u or 9p2000.L semantics)
121*4882a593Smuzhiyun
122*4882a593Smuzhiyun  version=name	Select 9P protocol version. Valid options are:
123*4882a593Smuzhiyun
124*4882a593Smuzhiyun			========        ==============================
125*4882a593Smuzhiyun			9p2000          Legacy mode (same as noextend)
126*4882a593Smuzhiyun			9p2000.u        Use 9P2000.u protocol
127*4882a593Smuzhiyun			9p2000.L        Use 9P2000.L protocol
128*4882a593Smuzhiyun			========        ==============================
129*4882a593Smuzhiyun
130*4882a593Smuzhiyun  dfltuid	attempt to mount as a particular uid
131*4882a593Smuzhiyun
132*4882a593Smuzhiyun  dfltgid	attempt to mount with a particular gid
133*4882a593Smuzhiyun
134*4882a593Smuzhiyun  afid		security channel - used by Plan 9 authentication protocols
135*4882a593Smuzhiyun
136*4882a593Smuzhiyun  nodevmap	do not map special files - represent them as normal files.
137*4882a593Smuzhiyun  		This can be used to share devices/named pipes/sockets between
138*4882a593Smuzhiyun		hosts.  This functionality will be expanded in later versions.
139*4882a593Smuzhiyun
140*4882a593Smuzhiyun  access	there are four access modes.
141*4882a593Smuzhiyun			user
142*4882a593Smuzhiyun				if a user tries to access a file on v9fs
143*4882a593Smuzhiyun			        filesystem for the first time, v9fs sends an
144*4882a593Smuzhiyun			        attach command (Tattach) for that user.
145*4882a593Smuzhiyun				This is the default mode.
146*4882a593Smuzhiyun			<uid>
147*4882a593Smuzhiyun				allows only user with uid=<uid> to access
148*4882a593Smuzhiyun				the files on the mounted filesystem
149*4882a593Smuzhiyun			any
150*4882a593Smuzhiyun				v9fs does single attach and performs all
151*4882a593Smuzhiyun				operations as one user
152*4882a593Smuzhiyun			clien
153*4882a593Smuzhiyun				 ACL based access check on the 9p client
154*4882a593Smuzhiyun			         side for access validation
155*4882a593Smuzhiyun
156*4882a593Smuzhiyun  cachetag	cache tag to use the specified persistent cache.
157*4882a593Smuzhiyun		cache tags for existing cache sessions can be listed at
158*4882a593Smuzhiyun		/sys/fs/9p/caches. (applies only to cache=fscache)
159*4882a593Smuzhiyun  ============= ===============================================================
160*4882a593Smuzhiyun
161*4882a593SmuzhiyunBehavior
162*4882a593Smuzhiyun========
163*4882a593Smuzhiyun
164*4882a593SmuzhiyunThis section aims at describing 9p 'quirks' that can be different
165*4882a593Smuzhiyunfrom a local filesystem behaviors.
166*4882a593Smuzhiyun
167*4882a593Smuzhiyun - Setting O_NONBLOCK on a file will make client reads return as early
168*4882a593Smuzhiyun   as the server returns some data instead of trying to fill the read
169*4882a593Smuzhiyun   buffer with the requested amount of bytes or end of file is reached.
170*4882a593Smuzhiyun
171*4882a593SmuzhiyunResources
172*4882a593Smuzhiyun=========
173*4882a593Smuzhiyun
174*4882a593SmuzhiyunProtocol specifications are maintained on github:
175*4882a593Smuzhiyunhttp://ericvh.github.com/9p-rfc/
176*4882a593Smuzhiyun
177*4882a593Smuzhiyun9p client and server implementations are listed on
178*4882a593Smuzhiyunhttp://9p.cat-v.org/implementations
179*4882a593Smuzhiyun
180*4882a593SmuzhiyunA 9p2000.L server is being developed by LLNL and can be found
181*4882a593Smuzhiyunat http://code.google.com/p/diod/
182*4882a593Smuzhiyun
183*4882a593SmuzhiyunThere are user and developer mailing lists available through the v9fs project
184*4882a593Smuzhiyunon sourceforge (http://sourceforge.net/projects/v9fs).
185*4882a593Smuzhiyun
186*4882a593SmuzhiyunNews and other information is maintained on a Wiki.
187*4882a593Smuzhiyun(http://sf.net/apps/mediawiki/v9fs/index.php).
188*4882a593Smuzhiyun
189*4882a593SmuzhiyunBug reports are best issued via the mailing list.
190*4882a593Smuzhiyun
191*4882a593SmuzhiyunFor more information on the Plan 9 Operating System check out
192*4882a593Smuzhiyunhttp://plan9.bell-labs.com/plan9
193*4882a593Smuzhiyun
194*4882a593SmuzhiyunFor information on Plan 9 from User Space (Plan 9 applications and libraries
195*4882a593Smuzhiyunported to Linux/BSD/OSX/etc) check out https://9fans.github.io/plan9port/
196