Skip to contentSkip to conversation

Make xencommons a bit more idiomatic

PATCH In review Jeremy Fitzhardinge 3 participants 5 messages Aug 20, 2011 – Aug 30, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Make xencommons a bit more idiomatic

tools/hotplug/Linux/init.d/xencommons +3 -5
diff -r 8d6edc3d26d2 -r cfb49fe940fd tools/hotplug/Linux/init.d/xencommons
@@ -29,11 +29,9 @@
 XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid
 shopt -s extglob
 
-if test "x$1" = xstart && \
-     test -d /proc/xen && \
-   ! test -f /proc/xen/capabilities && \
-   ! grep '^xenfs ' /proc/mounts >/dev/null;
-then
+if [ "x$1" = xstart -a -d /proc/xen -a \
+    ! -f /proc/xen/capabilities ] && \
+    ! grep -qw '^xenfs' /proc/mounts; then
 	mount -t xenfs xenfs /proc/xen
 fi
#2 lore raw
Quoted 5 lines · Olaf Hering
Quoted 3 lines · Jeremy Fitzhardinge
Quoted 7 lines

tools/hotplug/Linux/init.d/xencommons

Quoted 3 lines

diff -r 8d6edc3d26d2 -r cfb49fe940fd tools/hotplug/Linux/init.d/xencommons

tools/hotplug/Linux/init.d/xencommons +0 -0

I think this one is more complete:

http://lists.xensource.com/archives/html/xen-devel/2011-08/msg00438.html

1/2 is really just a style cleanup. 2/2 is closer to your patch, but it also modprobes evtchn/gntdev.

J

#3 lore raw
In reply to Jeremy Fitzhardinge

Jeremy Fitzhardinge writes ("[Xen-devel] [PATCH 1/2] Make xencommons a bit more idiomatic"):

Quoted 1 line

...

tools/hotplug/Linux/init.d/xencommons line 35

Quoted 9 lines
tools/hotplug/Linux/init.d/xencommons +3 -5
-if test "x$1" = xstart && \
-     test -d /proc/xen && \
-   ! test -f /proc/xen/capabilities && \
-   ! grep '^xenfs ' /proc/mounts >/dev/null;
-then
+if [ "x$1" = xstart -a -d /proc/xen -a \
+    ! -f /proc/xen/capabilities ] && \
+    ! grep -qw '^xenfs' /proc/mounts; then
 	mount -t xenfs xenfs /proc/xen

I'm afraid I'm reluctant to accept this purely stylistic change. I might if it seemed to me to be a clear improvement, but I don't think that's the case.

If anything we should be moving towards the use of && rather than -a, as that is harmless and will make the script depend less on /bin/bash.

Ian.

#4 lore raw
Quoted 16 lines · Ian Jackson

Jeremy Fitzhardinge writes ("[Xen-devel] [PATCH 1/2] Make xencommons a bit more idiomatic"):

Quoted 1 line

...

tools/hotplug/Linux/init.d/xencommons line 35

Quoted 9 lines
tools/hotplug/Linux/init.d/xencommons +3 -5
-if test "x$1" = xstart && \
-     test -d /proc/xen && \
-   ! test -f /proc/xen/capabilities && \
-   ! grep '^xenfs ' /proc/mounts >/dev/null;
-then
+if [ "x$1" = xstart -a -d /proc/xen -a \
+    ! -f /proc/xen/capabilities ] && \
+    ! grep -qw '^xenfs' /proc/mounts; then
 	mount -t xenfs xenfs /proc/xen

I'm afraid I'm reluctant to accept this purely stylistic change. I might if it seemed to me to be a clear improvement, but I don't think that's the case.

Quoted 2 lines

If anything we should be moving towards the use of && rather than -a, as that is harmless and will make the script depend less on /bin/bash.

No, you've misread it. I'm changing it to use test for all the file-existence checks in it's idiomatic form of '[', which implements -a. It is not at all bash-specific.

J