107d241fdSMauro Carvalho Chehab.. SPDX-License-Identifier: GPL-2.0
207d241fdSMauro Carvalho Chehab
307d241fdSMauro Carvalho Chehab=======================================
407d241fdSMauro Carvalho Chehabv9fs: Plan 9 Resource Sharing for Linux
507d241fdSMauro Carvalho Chehab=======================================
607d241fdSMauro Carvalho Chehab
707d241fdSMauro Carvalho ChehabAbout
807d241fdSMauro Carvalho Chehab=====
907d241fdSMauro Carvalho Chehab
1007d241fdSMauro Carvalho Chehabv9fs is a Unix implementation of the Plan 9 9p remote filesystem protocol.
1107d241fdSMauro Carvalho Chehab
1207d241fdSMauro Carvalho ChehabThis software was originally developed by Ron Minnich <rminnich@sandia.gov>
1307d241fdSMauro Carvalho Chehaband Maya Gokhale.  Additional development by Greg Watson
1407d241fdSMauro Carvalho Chehab<gwatson@lanl.gov> and most recently Eric Van Hensbergen
1507d241fdSMauro Carvalho Chehab<ericvh@gmail.com>, Latchesar Ionkov <lucho@ionkov.net> and Russ Cox
1607d241fdSMauro Carvalho Chehab<rsc@swtch.com>.
1707d241fdSMauro Carvalho Chehab
1807d241fdSMauro Carvalho ChehabThe best detailed explanation of the Linux implementation and applications of
1907d241fdSMauro Carvalho Chehabthe 9p client is available in the form of a USENIX paper:
2007d241fdSMauro Carvalho Chehab
210f540b95SAlexander A. Klimov   https://www.usenix.org/events/usenix05/tech/freenix/hensbergen.html
2207d241fdSMauro Carvalho Chehab
2307d241fdSMauro Carvalho ChehabOther applications are described in the following papers:
2407d241fdSMauro Carvalho Chehab
2507d241fdSMauro Carvalho Chehab	* XCPU & Clustering
2607d241fdSMauro Carvalho Chehab	  http://xcpu.org/papers/xcpu-talk.pdf
2707d241fdSMauro Carvalho Chehab	* KVMFS: control file system for KVM
2807d241fdSMauro Carvalho Chehab	  http://xcpu.org/papers/kvmfs.pdf
2907d241fdSMauro Carvalho Chehab	* CellFS: A New Programming Model for the Cell BE
3007d241fdSMauro Carvalho Chehab	  http://xcpu.org/papers/cellfs-talk.pdf
3107d241fdSMauro Carvalho Chehab	* PROSE I/O: Using 9p to enable Application Partitions
3207d241fdSMauro Carvalho Chehab	  http://plan9.escet.urjc.es/iwp9/cready/PROSE_iwp9_2006.pdf
3307d241fdSMauro Carvalho Chehab	* VirtFS: A Virtualization Aware File System pass-through
3407d241fdSMauro Carvalho Chehab	  http://goo.gl/3WPDg
3507d241fdSMauro Carvalho Chehab
3607d241fdSMauro Carvalho ChehabUsage
3707d241fdSMauro Carvalho Chehab=====
3807d241fdSMauro Carvalho Chehab
3907d241fdSMauro Carvalho ChehabFor remote file server::
4007d241fdSMauro Carvalho Chehab
4107d241fdSMauro Carvalho Chehab	mount -t 9p 10.10.1.2 /mnt/9
4207d241fdSMauro Carvalho Chehab
4307d241fdSMauro Carvalho ChehabFor Plan 9 From User Space applications (http://swtch.com/plan9)::
4407d241fdSMauro Carvalho Chehab
4507d241fdSMauro Carvalho Chehab	mount -t 9p `namespace`/acme /mnt/9 -o trans=unix,uname=$USER
4607d241fdSMauro Carvalho Chehab
4707d241fdSMauro Carvalho ChehabFor server running on QEMU host with virtio transport::
4807d241fdSMauro Carvalho Chehab
4907d241fdSMauro Carvalho Chehab	mount -t 9p -o trans=virtio <mount_tag> /mnt/9
5007d241fdSMauro Carvalho Chehab
5107d241fdSMauro Carvalho Chehabwhere mount_tag is the tag associated by the server to each of the exported
5207d241fdSMauro Carvalho Chehabmount points. Each 9P export is seen by the client as a virtio device with an
5307d241fdSMauro Carvalho Chehabassociated "mount_tag" property. Available mount tags can be
5407d241fdSMauro Carvalho Chehabseen by reading /sys/bus/virtio/drivers/9pnet_virtio/virtio<n>/mount_tag files.
5507d241fdSMauro Carvalho Chehab
5607d241fdSMauro Carvalho ChehabOptions
5707d241fdSMauro Carvalho Chehab=======
5807d241fdSMauro Carvalho Chehab
5907d241fdSMauro Carvalho Chehab  ============= ===============================================================
6007d241fdSMauro Carvalho Chehab  trans=name	select an alternative transport.  Valid options are
6107d241fdSMauro Carvalho Chehab  		currently:
6207d241fdSMauro Carvalho Chehab
6307d241fdSMauro Carvalho Chehab			========  ============================================
6407d241fdSMauro Carvalho Chehab			unix 	  specifying a named pipe mount point
6507d241fdSMauro Carvalho Chehab			tcp	  specifying a normal TCP/IP connection
6607d241fdSMauro Carvalho Chehab			fd   	  used passed file descriptors for connection
6707d241fdSMauro Carvalho Chehab                                  (see rfdno and wfdno)
6807d241fdSMauro Carvalho Chehab			virtio	  connect to the next virtio channel available
6907d241fdSMauro Carvalho Chehab				  (from QEMU with trans_virtio module)
7007d241fdSMauro Carvalho Chehab			rdma	  connect to a specified RDMA channel
7107d241fdSMauro Carvalho Chehab			========  ============================================
7207d241fdSMauro Carvalho Chehab
7307d241fdSMauro Carvalho Chehab  uname=name	user name to attempt mount as on the remote server.  The
7407d241fdSMauro Carvalho Chehab  		server may override or ignore this value.  Certain user
7507d241fdSMauro Carvalho Chehab		names may require authentication.
7607d241fdSMauro Carvalho Chehab
7707d241fdSMauro Carvalho Chehab  aname=name	aname specifies the file tree to access when the server is
7807d241fdSMauro Carvalho Chehab  		offering several exported file systems.
7907d241fdSMauro Carvalho Chehab
8007d241fdSMauro Carvalho Chehab  cache=mode	specifies a caching policy.  By default, no caches are used.
814eb31178SEric Van Hensbergen		The mode can be specified as a bitmask or by using one of the
82*d56b699dSBjorn Helgaas		preexisting common 'shortcuts'.
834eb31178SEric Van Hensbergen		The bitmask is described below: (unspecified bits are reserved)
8407d241fdSMauro Carvalho Chehab
854eb31178SEric Van Hensbergen			==========  ====================================================
864eb31178SEric Van Hensbergen			0b00000000  all caches disabled, mmap disabled
874eb31178SEric Van Hensbergen			0b00000001  file caches enabled
884eb31178SEric Van Hensbergen			0b00000010  meta-data caches enabled
894eb31178SEric Van Hensbergen			0b00000100  writeback behavior (as opposed to writethrough)
904eb31178SEric Van Hensbergen			0b00001000  loose caches (no explicit consistency with server)
914eb31178SEric Van Hensbergen			0b10000000  fscache enabled for persistent caching
924eb31178SEric Van Hensbergen			==========  ====================================================
934eb31178SEric Van Hensbergen
944eb31178SEric Van Hensbergen		The current shortcuts and their associated bitmask are:
954eb31178SEric Van Hensbergen
964eb31178SEric Van Hensbergen			=========   ====================================================
974eb31178SEric Van Hensbergen			none        0b00000000 (no caching)
984eb31178SEric Van Hensbergen			readahead   0b00000001 (only read-ahead file caching)
994eb31178SEric Van Hensbergen			mmap        0b00000101 (read-ahead + writeback file cache)
1004eb31178SEric Van Hensbergen			loose       0b00001111 (non-coherent file and meta-data caches)
1014eb31178SEric Van Hensbergen			fscache     0b10001111 (persistent loose cache)
1024eb31178SEric Van Hensbergen			=========   ====================================================
1034eb31178SEric Van Hensbergen
1044eb31178SEric Van Hensbergen		NOTE: only these shortcuts are tested modes of operation at the
1054eb31178SEric Van Hensbergen		moment, so using other combinations of bit-patterns is not
1064eb31178SEric Van Hensbergen		known to work.  Work on better cache support is in progress.
1074eb31178SEric Van Hensbergen
1084eb31178SEric Van Hensbergen		IMPORTANT: loose caches (and by extension at the moment fscache)
1094eb31178SEric Van Hensbergen		do not necessarily validate cached values on the server.  In other
1104eb31178SEric Van Hensbergen		words changes on the server are not guaranteed to be reflected
1114eb31178SEric Van Hensbergen		on the client system.  Only use this mode of operation if you
1124eb31178SEric Van Hensbergen		have an exclusive mount and the server will modify the filesystem
1134eb31178SEric Van Hensbergen		underneath you.
11407d241fdSMauro Carvalho Chehab
11507d241fdSMauro Carvalho Chehab  debug=n	specifies debug level.  The debug level is a bitmask.
11607d241fdSMauro Carvalho Chehab
11707d241fdSMauro Carvalho Chehab			=====   ================================
11807d241fdSMauro Carvalho Chehab			0x01    display verbose error messages
11907d241fdSMauro Carvalho Chehab			0x02    developer debug (DEBUG_CURRENT)
12007d241fdSMauro Carvalho Chehab			0x04    display 9p trace
12107d241fdSMauro Carvalho Chehab			0x08    display VFS trace
12207d241fdSMauro Carvalho Chehab			0x10    display Marshalling debug
12307d241fdSMauro Carvalho Chehab			0x20    display RPC debug
12407d241fdSMauro Carvalho Chehab			0x40    display transport debug
12507d241fdSMauro Carvalho Chehab			0x80    display allocation debug
12607d241fdSMauro Carvalho Chehab			0x100   display protocol message debug
12707d241fdSMauro Carvalho Chehab			0x200   display Fid debug
12807d241fdSMauro Carvalho Chehab			0x400   display packet debug
12907d241fdSMauro Carvalho Chehab			0x800   display fscache tracing debug
13007d241fdSMauro Carvalho Chehab			=====   ================================
13107d241fdSMauro Carvalho Chehab
13207d241fdSMauro Carvalho Chehab  rfdno=n	the file descriptor for reading with trans=fd
13307d241fdSMauro Carvalho Chehab
13407d241fdSMauro Carvalho Chehab  wfdno=n	the file descriptor for writing with trans=fd
13507d241fdSMauro Carvalho Chehab
13607d241fdSMauro Carvalho Chehab  msize=n	the number of bytes to use for 9p packet payload
13707d241fdSMauro Carvalho Chehab
13807d241fdSMauro Carvalho Chehab  port=n	port to connect to on the remote server
13907d241fdSMauro Carvalho Chehab
14007d241fdSMauro Carvalho Chehab  noextend	force legacy mode (no 9p2000.u or 9p2000.L semantics)
14107d241fdSMauro Carvalho Chehab
14207d241fdSMauro Carvalho Chehab  version=name	Select 9P protocol version. Valid options are:
14307d241fdSMauro Carvalho Chehab
14407d241fdSMauro Carvalho Chehab			========        ==============================
14507d241fdSMauro Carvalho Chehab			9p2000          Legacy mode (same as noextend)
14607d241fdSMauro Carvalho Chehab			9p2000.u        Use 9P2000.u protocol
14707d241fdSMauro Carvalho Chehab			9p2000.L        Use 9P2000.L protocol
14807d241fdSMauro Carvalho Chehab			========        ==============================
14907d241fdSMauro Carvalho Chehab
15007d241fdSMauro Carvalho Chehab  dfltuid	attempt to mount as a particular uid
15107d241fdSMauro Carvalho Chehab
15207d241fdSMauro Carvalho Chehab  dfltgid	attempt to mount with a particular gid
15307d241fdSMauro Carvalho Chehab
15407d241fdSMauro Carvalho Chehab  afid		security channel - used by Plan 9 authentication protocols
15507d241fdSMauro Carvalho Chehab
15607d241fdSMauro Carvalho Chehab  nodevmap	do not map special files - represent them as normal files.
15707d241fdSMauro Carvalho Chehab  		This can be used to share devices/named pipes/sockets between
15807d241fdSMauro Carvalho Chehab		hosts.  This functionality will be expanded in later versions.
15907d241fdSMauro Carvalho Chehab
1604eb31178SEric Van Hensbergen  directio	bypass page cache on all read/write operations
1614eb31178SEric Van Hensbergen
1624eb31178SEric Van Hensbergen  ignoreqv	ignore qid.version==0 as a marker to ignore cache
1634eb31178SEric Van Hensbergen
1648142db4fSEric Van Hensbergen  noxattr	do not offer xattr functions on this mount.
1658142db4fSEric Van Hensbergen
16607d241fdSMauro Carvalho Chehab  access	there are four access modes.
16707d241fdSMauro Carvalho Chehab			user
16807d241fdSMauro Carvalho Chehab				if a user tries to access a file on v9fs
16907d241fdSMauro Carvalho Chehab			        filesystem for the first time, v9fs sends an
17007d241fdSMauro Carvalho Chehab			        attach command (Tattach) for that user.
17107d241fdSMauro Carvalho Chehab				This is the default mode.
17207d241fdSMauro Carvalho Chehab			<uid>
17307d241fdSMauro Carvalho Chehab				allows only user with uid=<uid> to access
17407d241fdSMauro Carvalho Chehab				the files on the mounted filesystem
17507d241fdSMauro Carvalho Chehab			any
17607d241fdSMauro Carvalho Chehab				v9fs does single attach and performs all
17707d241fdSMauro Carvalho Chehab				operations as one user
17807d241fdSMauro Carvalho Chehab			clien
17907d241fdSMauro Carvalho Chehab				 ACL based access check on the 9p client
18007d241fdSMauro Carvalho Chehab			         side for access validation
18107d241fdSMauro Carvalho Chehab
18207d241fdSMauro Carvalho Chehab  cachetag	cache tag to use the specified persistent cache.
18307d241fdSMauro Carvalho Chehab		cache tags for existing cache sessions can be listed at
18407d241fdSMauro Carvalho Chehab		/sys/fs/9p/caches. (applies only to cache=fscache)
18507d241fdSMauro Carvalho Chehab  ============= ===============================================================
18607d241fdSMauro Carvalho Chehab
1875d30bcacSLinus TorvaldsBehavior
1885d30bcacSLinus Torvalds========
1895d30bcacSLinus Torvalds
1905d30bcacSLinus TorvaldsThis section aims at describing 9p 'quirks' that can be different
1915d30bcacSLinus Torvaldsfrom a local filesystem behaviors.
1925d30bcacSLinus Torvalds
1935d30bcacSLinus Torvalds - Setting O_NONBLOCK on a file will make client reads return as early
1945d30bcacSLinus Torvalds   as the server returns some data instead of trying to fill the read
1955d30bcacSLinus Torvalds   buffer with the requested amount of bytes or end of file is reached.
1965d30bcacSLinus Torvalds
19707d241fdSMauro Carvalho ChehabResources
19807d241fdSMauro Carvalho Chehab=========
19907d241fdSMauro Carvalho Chehab
20007d241fdSMauro Carvalho ChehabProtocol specifications are maintained on github:
20107d241fdSMauro Carvalho Chehabhttp://ericvh.github.com/9p-rfc/
20207d241fdSMauro Carvalho Chehab
20307d241fdSMauro Carvalho Chehab9p client and server implementations are listed on
20407d241fdSMauro Carvalho Chehabhttp://9p.cat-v.org/implementations
20507d241fdSMauro Carvalho Chehab
20607d241fdSMauro Carvalho ChehabA 9p2000.L server is being developed by LLNL and can be found
20707d241fdSMauro Carvalho Chehabat http://code.google.com/p/diod/
20807d241fdSMauro Carvalho Chehab
20907d241fdSMauro Carvalho ChehabThere are user and developer mailing lists available through the v9fs project
21007d241fdSMauro Carvalho Chehabon sourceforge (http://sourceforge.net/projects/v9fs).
21107d241fdSMauro Carvalho Chehab
21207d241fdSMauro Carvalho ChehabNews and other information is maintained on a Wiki.
21307d241fdSMauro Carvalho Chehab(http://sf.net/apps/mediawiki/v9fs/index.php).
21407d241fdSMauro Carvalho Chehab
21507d241fdSMauro Carvalho ChehabBug reports are best issued via the mailing list.
21607d241fdSMauro Carvalho Chehab
21707d241fdSMauro Carvalho ChehabFor more information on the Plan 9 Operating System check out
21807d241fdSMauro Carvalho Chehabhttp://plan9.bell-labs.com/plan9
21907d241fdSMauro Carvalho Chehab
22007d241fdSMauro Carvalho ChehabFor information on Plan 9 from User Space (Plan 9 applications and libraries
221b529c06fSJuan Manuel Méndez Reyported to Linux/BSD/OSX/etc) check out https://9fans.github.io/plan9port/
222