SHR(3)SHR(3)

NAME

shr – global mountpoints

SYNOPSIS

bind ’#σ’ /shr

#σ/share1 #σc/share1/service1 #σc/share1/service2 ...

DESCRIPTION

The shr device provides global mountpoints in the form of share directories where 9P services can be mounted.

Effectively, it is a global mountpoint registry that is separate from private namespaces.

The shr device exports a mount tree and a control tree. The directories in the mount tree are the share mountpoints themselves, while the directories in #σc contain the service files of the share.

To create a new share, create the directory #σc/myshare

To mount a service in that share, create the file #σc/myshare/myserv and then write a text string (suitable for strtoul; see atof(2)) giving the file descriptor number of an open 9P service. Any process with the proper permission may then access #σ/myshare on the mount tree.

The service file can be reopened and passed to mount (see bind(2)) or added to another share.

Multiple services can be mounted under a share forming a union directory. New services get mounted before old ones. Removing the service file unmounts the service from the share.

Creating shares and mounts requires read-write access in the share directory. The special user none is prohibited from these operations.

EXAMPLES

To mount a 9p service from srv(3) to the shr device

 

mkdir '#σc'/myshare
echo 3 > '#σc'/myshare/myserv <>[3]/srv/myserv

SOURCE

/sys/src/9/port/devshr.c

HISTORY

Shr first appeared in 9front (July, 2011).