diod: add new recipe

diod is a multi-threaded, user space file server that speaks 9P2000.L
protocol.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
This commit is contained in:
Yi Zhao 2017-06-27 08:26:39 +08:00 committed by Bruce Ashfield
parent 95013501dc
commit e30aaeec26
5 changed files with 295 additions and 0 deletions

View File

@ -0,0 +1,32 @@
SUMMARY = "Diod is a user space server for the kernel v9fs client."
DESCRIPTION = "\
Diod is a user space server for the kernel v9fs client (9p.ko, 9pnet.ko). \
Although the kernel client supports several 9P variants, diod only supports \
9P2000.L, and only in its feature-complete form, as it appeared in 2.6.38."
SECTION = "console/network"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552"
PV = "1.0.24+git${SRCPV}"
SRCREV = "0ea3fe3d829b5085307cd27a512708d99ef48199"
SRC_URI = "git://github.com/chaos/diod.git;protocol=git \
file://diod \
file://diod.conf \
file://0001-build-allow-builds-to-work-with-separate-build-dir.patch \
file://0002-auto.diod.in-remove-bashisms.patch \
"
DEPENDS = "libcap ncurses tcp-wrappers lua"
S = "${WORKDIR}/git"
inherit autotools systemd
do_install_append () {
# install our init based on start-stop-daemon
install -D -m 0755 ${WORKDIR}/diod ${D}${sysconfdir}/init.d/diod
# install a real(not commented) configuration file for diod
install -m 0644 ${WORKDIR}/diod.conf ${D}${sysconfdir}/diod.conf
}
FILES_${PN} += "${systemd_unitdir}"

View File

@ -0,0 +1,126 @@
From 43403468298ef4167baa5d84de2ee2eaf7f4007a Mon Sep 17 00:00:00 2001
From: Mark Asselstine <mark.asselstine@windriver.com>
Date: Fri, 9 Jan 2015 18:34:04 +0000
Subject: [PATCH 1/2] build: allow builds to work with separate build dir
Remove assumptions in include paths that assume the build
is happening in the source directories.
Upstream-Status: Inappropriate [embedded specific]
Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
---
diod/Makefile.am | 2 +-
libdiod/Makefile.am | 2 +-
liblsd/Makefile.am | 2 +-
libnpclient/Makefile.am | 2 +-
scripts/Makefile.am | 6 +++---
tests/kern/dbench/Makefile.am | 4 ++--
utils/Makefile.am | 2 +-
7 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/diod/Makefile.am b/diod/Makefile.am
index 7644be7..fdaf130 100644
--- a/diod/Makefile.am
+++ b/diod/Makefile.am
@@ -1,7 +1,7 @@
AM_CFLAGS = @GCCWARN@
AM_CPPFLAGS = \
- -I../libnpfs -I../liblsd -I../libdiod
+ -I$(srcdir)/../libnpfs -I$(srcdir)/../liblsd -I$(srcdir)/../libdiod
sbin_PROGRAMS = diod
diff --git a/libdiod/Makefile.am b/libdiod/Makefile.am
index 4810e14..6905cdd 100644
--- a/libdiod/Makefile.am
+++ b/libdiod/Makefile.am
@@ -1,7 +1,7 @@
AM_CFLAGS = @GCCWARN@
AM_CPPFLAGS = \
- -I../libnpfs -I../libnpclient -I../liblsd
+ -I$(srcdir)/../libnpfs -I$(srcdir)/../libnpclient -I$(srcdir)/../liblsd
noinst_LIBRARIES = libdiod.a
diff --git a/liblsd/Makefile.am b/liblsd/Makefile.am
index c3e5658..7e18bf8 100644
--- a/liblsd/Makefile.am
+++ b/liblsd/Makefile.am
@@ -1,6 +1,6 @@
AM_CFLAGS = @GCCWARN@
-AM_CPPFLAGS = -I../libdiod
+AM_CPPFLAGS = -I$(srcdir)/../libdiod
noinst_LIBRARIES = liblsd.a
diff --git a/libnpclient/Makefile.am b/libnpclient/Makefile.am
index 5305df9..cbaf266 100644
--- a/libnpclient/Makefile.am
+++ b/libnpclient/Makefile.am
@@ -1,7 +1,7 @@
AM_CFLAGS = @GCCWARN@
AM_CPPFLAGS = \
- -I../libnpfs
+ -I$(srcdir)/../libnpfs
noinst_LIBRARIES = libnpclient.a
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 51c24a3..2aba728 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -1,9 +1,9 @@
-systemddir=$(sysconfdir)/systemd/system
+systemddir=/lib/systemd/system
install-data-local:
- $(top_srcdir)/config/install-sh -m 755 $(srcdir)/auto.diod \
+ $(top_srcdir)/config/install-sh -m 755 ./auto.diod \
$(DESTDIR)$(sysconfdir)/auto.diod
- $(top_srcdir)/config/install-sh -m 755 $(srcdir)/diod.service \
+ $(top_srcdir)/config/install-sh -m 644 ./diod.service \
$(DESTDIR)$(systemddir)/diod.service
uninstall-local:
diff --git a/tests/kern/dbench/Makefile.am b/tests/kern/dbench/Makefile.am
index e0cdefa..1704f9f 100644
--- a/tests/kern/dbench/Makefile.am
+++ b/tests/kern/dbench/Makefile.am
@@ -2,7 +2,7 @@ AM_CFLAGS = -w
# VERSION=4.00
-AM_CPPFLAGS = -DDATADIR=\"$(X_DATADIR)\"
+AM_CPPFLAGS = -I. -DDATADIR=\"$(X_DATADIR)\"
LDADD = $(LIBPOPT)
@@ -25,6 +25,6 @@ BUILT_SOURCES = proto.h
CLEANFILES = proto.h
proto.h: $(dbench_SOURCES) mkproto.pl
- perl mkproto.pl $(dbench_SOURCES) > proto.h
+ $(srcdir)/mkproto.pl $(patsubst %,$(srcdir),$(dbench_SOURCES)) > proto.h
EXTRA_DIST = mkproto.pl
diff --git a/utils/Makefile.am b/utils/Makefile.am
index 169b6c4..91d571d 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -1,7 +1,7 @@
AM_CFLAGS = @GCCWARN@
AM_CPPFLAGS = \
- -I../libnpfs -I../liblsd -I../libdiod -I../libnpclient
+ -I$(srcdir)/../libnpfs -I$(srcdir)/../liblsd -I$(srcdir)/../libdiod -I$(srcdir)/../libnpclient
sbin_PROGRAMS = diodmount diodcat dtop diodload diodls diodshowmount dioddate
--
2.11.0

View File

@ -0,0 +1,47 @@
From 5a9e09dc5de833db11607530351cd87cecbfd17e Mon Sep 17 00:00:00 2001
From: Roy Li <rongqing.li@windriver.com>
Date: Thu, 22 Jun 2017 06:32:30 +0000
Subject: [PATCH 2/2] auto.diod.in: remove bashisms
Upstream-Status: Pending
Signed-off-by: Roy Li <rongqing.li@windriver.com>
---
scripts/auto.diod.in | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/scripts/auto.diod.in b/scripts/auto.diod.in
index f63e004..4d5fc3a 100755
--- a/scripts/auto.diod.in
+++ b/scripts/auto.diod.in
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# auto.diod - executable automounter map for diod file systems
#
@@ -41,15 +41,15 @@ dcatopts="${DIOD_TIMEOUT:+-t $DIOD_TIMEOUT}"
for server in $DIOD_SERVERS; do
$DIOD_DIODCAT -s $server $dcatopts exports | awk '{print $1}' |\
while read path; do
- if [ "$path" == "/" ]; then
- if [ "$key" == "ROOT" ]; then
+ if [ "$path" = "/" ]; then
+ if [ "$key" = "ROOT" ]; then
echo "$prefix $server:$path"
exit 0
fi
- elif [ "$key" == "$(echo $path|sed -e's/^\///' -e's/\//./g')" ] \
- || [ "$key" == "$(echo $path|sed -e's/^\///' -e's/\//_/g')" ] \
- || [ "$key" == "$(echo $path|sed -e's/^\///' -e's/\//-/g')" ] \
- || [ "$key" == "$(basename $path)" ]; then
+ elif [ "$key" = "$(echo $path|sed -e's/^\///' -e's/\//./g')" ] \
+ || [ "$key" = "$(echo $path|sed -e's/^\///' -e's/\//_/g')" ] \
+ || [ "$key" = "$(echo $path|sed -e's/^\///' -e's/\//-/g')" ] \
+ || [ "$key" = "$(basename $path)" ]; then
echo "$prefix $server:$path"
exit 0
fi
--
2.11.0

View File

@ -0,0 +1,75 @@
#!/bin/sh
#
# chkconfig: 35 20 80
# description: Distributed Input Output Daemon
#
# Get function from functions library
. /etc/init.d/functions
BASE=diod
PIDFILE=/var/run/$BASE.pid
PID=`test -f $PIDFILE && cat $PIDFILE`
DIOD_BIN=/usr/sbin/$BASE
DIOD_CONF=/etc/$BASE.conf
DIOD_OPTS="-c $DIOD_CONF"
DIOD="$DIOD_BIN $DIOD_OPTS"
RETVAL=0
# Start the service $BASE
start()
{
# Force creation of the log directory even on a tmpfs /var/log.
mkdir -p /var/log/diod
start-stop-daemon --stop --test --quiet --pidfile $PIDFILE
status=$?
if [ $status -eq 0 ]; then
echo "diod service is already running with pid $PID"
exit 1
else
echo -n "Starting $BASE:"
start-stop-daemon --start --pidfile $PIDFILE \
--exec $DIOD_BIN -- $DIOD_OPTS
RETVAL=$?
echo
[ $RETVAL -ne 0 ] && exit $RETVAL
fi
}
# Stop the service $BASE
stop()
{
echo -n "Stopping $BASE:"
start-stop-daemon --stop --test --quiet --pidfile $PIDFILE
status=$?
if [ $status -eq 0 ]; then
start-stop-daemon --stop --quiet --pidfile $PIDFILE
[ -w $PIDFILE ] && rm -f $PIDFILE
else
start-stop-daemon --stop --quiet --name $BASE
fi
}
### service arguments ###
case $1 in
start)
start
;;
stop)
stop
;;
status)
status $BASE
;;
restart | force-reload)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|status|restart}."
exit 1
esac
exit 0

View File

@ -0,0 +1,15 @@
--
-- /etc/diod.conf - config file for diod distributed I/O daemon
--
-- NOTE: This config file is a lua script that diod runs, then extracts
-- the value of certain globally defined variables. See diod.conf(5).
listen = { "0.0.0.0:564" }
nwthreads = 16
auth_required = 1
logdest = "syslog:daemon:err"
exports = { "/g/g0", "/g/g10" }
allsquash = 0
squashuser = "nobody"