From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olaf Hering Subject: [PATCH v2] hotplug: update xencommons script to run only when needed Date: Fri, 26 Aug 2011 11:10:55 +0200 Message-ID: <20110826091055.GA495@aepfle.de> References: <0e95f2c754bf526a89bb.1313133119@probook.site> <20054.26388.743123.491778@mariner.uk.xensource.com> <20110825152413.GB25643@aepfle.de> <20054.27534.720259.973323@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Return-path: Content-Disposition: inline In-Reply-To: <20054.27534.720259.973323@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Jackson Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org # HG changeset patch # Parent 227130622561e20136a1ef56201fe65ead5a76e8 hotplug: update xencommons script to run only when needed Currently xencommons prints an error if /proc/xen/capabilities does not exist when started on a non-xen kernel. Update the xencommons script to run only when needed: - do not run if /proc/xen does not exist - check if /proc/xen/capabilities exists before doing the grep for dom0 - use grep -q instead of stdout redirection when looking for xenfs Signed-off-by: Olaf Hering diff -r 227130622561 tools/hotplug/Linux/init.d/xencommons --- a/tools/hotplug/Linux/init.d/xencommons +++ b/tools/hotplug/Linux/init.d/xencommons @@ -29,14 +29,25 @@ test -f $xencommons_config/xencommons && XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid shopt -s extglob +# not running in Xen dom0 or domU +if ! test -d /proc/xen ; then + exit 0 +fi + +# mount xenfs in dom0 or domU with a pv_ops kernel if test "x$1" = xstart && \ - test -d /proc/xen && \ ! test -f /proc/xen/capabilities && \ - ! grep '^xenfs ' /proc/mounts >/dev/null; + ! grep -q '^xenfs ' /proc/mounts ; then mount -t xenfs xenfs /proc/xen fi +# run this script only in dom0: +# no capabilities file in xenlinux kernel +if ! test -f /proc/xen/capabilities ; then + exit 0 +fi +# empty capabilities file in pv_ops kernel if ! grep -q "control_d" /proc/xen/capabilities ; then exit 0 fi