clean up 9p virtio init to check which drivers are available

Signed-off-by: Justin Cormack <justin.cormack@unikernel.com>
This commit is contained in:
Justin Cormack 2016-01-14 11:25:34 +00:00
parent 8db1056b36
commit c809a196b3
3 changed files with 30 additions and 6 deletions

View File

@ -3,11 +3,26 @@
start()
{
ebegin "Mounting 9p sockets"
mkdir -p /Socket
mount -t 9p -o trans=virtio,dfltuid=1001,dfltgid=50,version=9p2000 socket /Socket
mkdir -p /Mac
mount -t 9p -o trans=virtio,dfltuid=1001,dfltgid=50,version=9p2000.u plan9 /Mac
mkdir -p /Transfuse
mount -t 9p -o trans=virtio,dfltuid=1001,dfltgid=50,version=9p2000 fuse /Transfuse
for virtio in $(find /sys/bus/virtio/drivers/9pnet_virtio -name 'virtio*')
do
TAG=$(cat $virtio/mount_tag)
case $TAG in
"socket")
mkdir -p /Socket
mount -t 9p -o trans=virtio,dfltuid=1001,dfltgid=50,version=9p2000 socket /Socket
;;
"plan9")
mkdir -p /Mac
mount -t 9p -o trans=virtio,dfltuid=1001,dfltgid=50,version=9p2000.u plan9 /Mac
;;
"fuse")
mkdir -p /Transfuse
mount -t 9p -o trans=virtio,dfltuid=1001,dfltgid=50,version=9p2000 fuse /Transfuse
;;
esac
done
eend 0
}

View File

@ -9,6 +9,9 @@ depend()
start()
{
[ -d /Socket ] || exit 0
ebegin "Starting docker socket passthrough"
[ -n "${PIDFILE}" ] || PIDFILE=/var/run/9pudc.pid
@ -24,6 +27,8 @@ start()
stop()
{
[ -d /Socket ] || exit 0
ebegin "Stopping docker socket passthrough"
[ -n "${PIDFILE}" ] || PIDFILE=/var/run/9pudc.pid

View File

@ -9,6 +9,8 @@ depend()
start()
{
[ -d /Transfuse ] || exit 0
ebegin "Starting FUSE socket passthrough"
[ -n "${PIDFILE}" ] || PIDFILE=/var/run/9pudfuse.pid
@ -23,6 +25,8 @@ start()
stop()
{
[ -d /Transfuse ] || exit 0
ebegin "Stopping FUSE socket passthrough"
[ -n "${PIDFILE}" ] || PIDFILE=/var/run/9pudfuse.pid