xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-for-4.7 1/2] xendriverdomain: use POSIX sh and not bash
@ 2016-05-12 15:29 Doug Goldstein
  2016-05-12 15:29 ` [PATCH 2/2] xendriverdomain: don't depend on legacy /proc/xen Doug Goldstein
  2016-05-12 15:56 ` [PATCH-for-4.7 1/2] xendriverdomain: use POSIX sh and not bash Wei Liu
  0 siblings, 2 replies; 5+ messages in thread
From: Doug Goldstein @ 2016-05-12 15:29 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson, Doug Goldstein

The script doesn't use any bash-isms and works fine with BusyBox's ash.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
 tools/hotplug/Linux/init.d/xendriverdomain.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/hotplug/Linux/init.d/xendriverdomain.in b/tools/hotplug/Linux/init.d/xendriverdomain.in
index 5fd4e9a..8d4592a 100644
--- a/tools/hotplug/Linux/init.d/xendriverdomain.in
+++ b/tools/hotplug/Linux/init.d/xendriverdomain.in
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # xendriverdomain    Script to start services needed in a Xen driver domain
 #
-- 
2.7.4 (Apple Git-66)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] xendriverdomain: don't depend on legacy /proc/xen
  2016-05-12 15:29 [PATCH-for-4.7 1/2] xendriverdomain: use POSIX sh and not bash Doug Goldstein
@ 2016-05-12 15:29 ` Doug Goldstein
  2016-05-12 15:56   ` Wei Liu
  2016-05-12 15:56 ` [PATCH-for-4.7 1/2] xendriverdomain: use POSIX sh and not bash Wei Liu
  1 sibling, 1 reply; 5+ messages in thread
From: Doug Goldstein @ 2016-05-12 15:29 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson, Doug Goldstein

xl devd prefers to use /dev/xen/ instead of /proc/xen so the init script
should use the new interface as well and drop the legacy interface. To
check for support this uses /sys/hypervisor which has been present since
2.6.18 Xen kernels. Fix bad whitespace at the same time.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
 tools/hotplug/Linux/init.d/xendriverdomain.in | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/tools/hotplug/Linux/init.d/xendriverdomain.in b/tools/hotplug/Linux/init.d/xendriverdomain.in
index 8d4592a..830aa5b 100644
--- a/tools/hotplug/Linux/init.d/xendriverdomain.in
+++ b/tools/hotplug/Linux/init.d/xendriverdomain.in
@@ -27,23 +27,12 @@ test -f $xendriverdomain_config/xendriverdomain && . $xendriverdomain_config/xen
 XLDEVD_PIDFILE=/var/run/xldevd.pid
 
 # not running in Xen dom0 or domU
-if ! test -d /proc/xen ; then
+if ! grep -q '^xen' /sys/hypervisor/type ; then
 	exit 0
 fi
 
-# mount xenfs in dom0 or domU with a pv_ops kernel
-if test "x$1" = xstart && \
-   ! test -f /proc/xen/capabilities && \
-   ! grep '^xenfs ' /proc/mounts >/dev/null;
-then
-	mount -t xenfs xenfs /proc/xen
-fi
-
 # run this script only in domU:
-# no capabilities file in xenlinux domU kernel
-# empty capabilities file in pv_ops domU kernel
-if ! test -f /proc/xen/capabilities || \
-   grep -q "control_d" /proc/xen/capabilities ; then
+if grep -q '00000000-0000-0000-0000-000000000000' /sys/hypervisor/uuid; then
 	exit 0
 fi
 
@@ -52,7 +41,7 @@ do_start () {
 	${sbindir}/xl devd --pidfile=$XLDEVD_PIDFILE $XLDEVD_ARGS
 }
 do_stop () {
-        echo Stopping xl devd...
+    echo Stopping xl devd...
 	if read 2>/dev/null <$XLDEVD_PIDFILE pid; then
 		kill $pid
 		while kill -9 $pid >/dev/null 2>&1; do sleep 1; done
@@ -71,7 +60,7 @@ case "$1" in
 	echo >&2 'Reload not available; use force-reload'; exit 1
 	;;
   force-reload|restart)
-        do_stop
+    do_stop
 	do_start
 	;;
   *)
-- 
2.7.4 (Apple Git-66)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] xendriverdomain: don't depend on legacy /proc/xen
  2016-05-12 15:29 ` [PATCH 2/2] xendriverdomain: don't depend on legacy /proc/xen Doug Goldstein
@ 2016-05-12 15:56   ` Wei Liu
  0 siblings, 0 replies; 5+ messages in thread
From: Wei Liu @ 2016-05-12 15:56 UTC (permalink / raw)
  To: Doug Goldstein; +Cc: Wei Liu, Ian Jackson, xen-devel

On Thu, May 12, 2016 at 10:29:30AM -0500, Doug Goldstein wrote:
> xl devd prefers to use /dev/xen/ instead of /proc/xen so the init script
> should use the new interface as well and drop the legacy interface. To
> check for support this uses /sys/hypervisor which has been present since
> 2.6.18 Xen kernels. Fix bad whitespace at the same time.
> 
> Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
> ---
>  tools/hotplug/Linux/init.d/xendriverdomain.in | 19 ++++---------------
>  1 file changed, 4 insertions(+), 15 deletions(-)
> 
> diff --git a/tools/hotplug/Linux/init.d/xendriverdomain.in b/tools/hotplug/Linux/init.d/xendriverdomain.in
> index 8d4592a..830aa5b 100644
> --- a/tools/hotplug/Linux/init.d/xendriverdomain.in
> +++ b/tools/hotplug/Linux/init.d/xendriverdomain.in
> @@ -27,23 +27,12 @@ test -f $xendriverdomain_config/xendriverdomain && . $xendriverdomain_config/xen
>  XLDEVD_PIDFILE=/var/run/xldevd.pid
>  
>  # not running in Xen dom0 or domU
> -if ! test -d /proc/xen ; then
> +if ! grep -q '^xen' /sys/hypervisor/type ; then
>  	exit 0
>  fi
>  
> -# mount xenfs in dom0 or domU with a pv_ops kernel
> -if test "x$1" = xstart && \
> -   ! test -f /proc/xen/capabilities && \
> -   ! grep '^xenfs ' /proc/mounts >/dev/null;
> -then
> -	mount -t xenfs xenfs /proc/xen
> -fi

This unilaterally remove mounting xenfs. We need to keep mounting it
because some applications might use those legacy devices.

I do think we need to avoid breaking old stuff, especially when it is
not to hard to achieve.

> -
>  # run this script only in domU:
> -# no capabilities file in xenlinux domU kernel
> -# empty capabilities file in pv_ops domU kernel
> -if ! test -f /proc/xen/capabilities || \
> -   grep -q "control_d" /proc/xen/capabilities ; then
> +if grep -q '00000000-0000-0000-0000-000000000000' /sys/hypervisor/uuid; then

Here you're relying on the fact that dom0 uuid is all zeros. I don't
think this is documented in Linux, so you can't do it here.

>  	exit 0
>  fi
>  
> @@ -52,7 +41,7 @@ do_start () {
>  	${sbindir}/xl devd --pidfile=$XLDEVD_PIDFILE $XLDEVD_ARGS
>  }
>  do_stop () {
> -        echo Stopping xl devd...
> +    echo Stopping xl devd...

Indentation looks wrong. Should use tab here.

>  	if read 2>/dev/null <$XLDEVD_PIDFILE pid; then
>  		kill $pid
>  		while kill -9 $pid >/dev/null 2>&1; do sleep 1; done
> @@ -71,7 +60,7 @@ case "$1" in
>  	echo >&2 'Reload not available; use force-reload'; exit 1
>  	;;
>    force-reload|restart)
> -        do_stop
> +    do_stop

Ditto.

>  	do_start
>  	;;
>    *)
> -- 
> 2.7.4 (Apple Git-66)
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH-for-4.7 1/2] xendriverdomain: use POSIX sh and not bash
  2016-05-12 15:29 [PATCH-for-4.7 1/2] xendriverdomain: use POSIX sh and not bash Doug Goldstein
  2016-05-12 15:29 ` [PATCH 2/2] xendriverdomain: don't depend on legacy /proc/xen Doug Goldstein
@ 2016-05-12 15:56 ` Wei Liu
  2016-05-12 17:02   ` Wei Liu
  1 sibling, 1 reply; 5+ messages in thread
From: Wei Liu @ 2016-05-12 15:56 UTC (permalink / raw)
  To: Doug Goldstein; +Cc: Wei Liu, Ian Jackson, xen-devel

On Thu, May 12, 2016 at 10:29:29AM -0500, Doug Goldstein wrote:
> The script doesn't use any bash-isms and works fine with BusyBox's ash.
> 
> Signed-off-by: Doug Goldstein <cardoe@cardoe.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>

> ---
>  tools/hotplug/Linux/init.d/xendriverdomain.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/hotplug/Linux/init.d/xendriverdomain.in b/tools/hotplug/Linux/init.d/xendriverdomain.in
> index 5fd4e9a..8d4592a 100644
> --- a/tools/hotplug/Linux/init.d/xendriverdomain.in
> +++ b/tools/hotplug/Linux/init.d/xendriverdomain.in
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#!/bin/sh
>  #
>  # xendriverdomain    Script to start services needed in a Xen driver domain
>  #
> -- 
> 2.7.4 (Apple Git-66)
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH-for-4.7 1/2] xendriverdomain: use POSIX sh and not bash
  2016-05-12 15:56 ` [PATCH-for-4.7 1/2] xendriverdomain: use POSIX sh and not bash Wei Liu
@ 2016-05-12 17:02   ` Wei Liu
  0 siblings, 0 replies; 5+ messages in thread
From: Wei Liu @ 2016-05-12 17:02 UTC (permalink / raw)
  To: Doug Goldstein; +Cc: Wei Liu, Ian Jackson, xen-devel

On Thu, May 12, 2016 at 04:56:30PM +0100, Wei Liu wrote:
> On Thu, May 12, 2016 at 10:29:29AM -0500, Doug Goldstein wrote:
> > The script doesn't use any bash-isms and works fine with BusyBox's ash.
> > 
> > Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
> 
> Acked-by: Wei Liu <wei.liu2@citrix.com>
> Release-acked-by: Wei Liu <wei.liu2@citrix.com>
> 

Pushed.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-12 17:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-12 15:29 [PATCH-for-4.7 1/2] xendriverdomain: use POSIX sh and not bash Doug Goldstein
2016-05-12 15:29 ` [PATCH 2/2] xendriverdomain: don't depend on legacy /proc/xen Doug Goldstein
2016-05-12 15:56   ` Wei Liu
2016-05-12 15:56 ` [PATCH-for-4.7 1/2] xendriverdomain: use POSIX sh and not bash Wei Liu
2016-05-12 17:02   ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).