Skip to contentSkip to conversation

qemu-ga: change default state dir to /var/run

PATCH In review Luiz Capitulino 3 participants 10 messages Oct 3, 2012 – Oct 4, 2012

lore
Share & tools
lore
#0 lore raw

v2 cover qemu-ga: change default state dir to /var/run

Also allow users to change the default at configure time. Please, check individual patches for more details.

o v2

- drop --guest-agent-statedir in favor of --localstatedir
- change default from /var/run to ${prefix}/var/run

Luiz Capitulino (2):
configure: add --localstatedir
qemu-ga: use state dir from CONFIG_QEMU_LOCALSTATEDIR

 configure | 9 ++++++++-
 qemu-ga.c | 4 ++--
 2 files changed, 10 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.12.315.g682ce8b
#1 lore raw

PATCH v2 1/2 configure: add --localstatedir

Next commit wants to use it.

---
 configure | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
configure +8 -1
index 8f99b7b..dab07d6 100755
@@ -184,6 +184,7 @@ libdir="\${prefix}/lib"
 libexecdir="\${prefix}/libexec"
 includedir="\${prefix}/include"
 sysconfdir="\${prefix}/etc"
+local_statedir="\${prefix}/var"
 confsuffix="/qemu"
 slirp="yes"
 fmod_lib=""
@@ -552,6 +553,7 @@ EOF
   qemu_docdir="\${prefix}"
   bindir="\${prefix}"
   sysconfdir="\${prefix}"
+  local_statedir="\${prefix}"
   confsuffix=""
   libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
 fi
@@ -628,7 +630,9 @@ for opt do
   ;;
   --sysconfdir=*) sysconfdir="$optarg"
   ;;
-  --sbindir=*|--sharedstatedir=*|--localstatedir=*|\
+  --localstatedir=*) local_statedir="$optarg"
+  ;;
+  --sbindir=*|--sharedstatedir=*|\
   --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
   --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
     # These switches are silently ignored, for compatibility with
@@ -1022,6 +1026,7 @@ echo "  --datadir=PATH           install firmware in PATH$confsuffix"
 echo "  --docdir=PATH            install documentation in PATH$confsuffix"
 echo "  --bindir=PATH            install binaries in PATH"
 echo "  --sysconfdir=PATH        install config in PATH$confsuffix"
+echo "  --localstatedir=PATH     install local state in PATH"
 echo "  --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]"
 echo "  --enable-debug-tcg       enable TCG debugging"
 echo "  --disable-debug-tcg      disable TCG debugging (default)"
@@ -3086,6 +3091,7 @@ echo "library directory `eval echo $libdir`"
 echo "libexec directory `eval echo $libexecdir`"
 echo "include directory `eval echo $includedir`"
 echo "config directory  `eval echo $sysconfdir`"
+echo "local state directory   `eval echo $local_statedir`"
 if test "$mingw32" = "no" ; then
 echo "Manual directory  `eval echo $mandir`"
 echo "ELF interp prefix $interp_prefix"
@@ -3194,6 +3200,7 @@ echo "sysconfdir=$sysconfdir" >> $config_host_mak
 echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
 echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
 echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
+echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
 echo "CONFIG_QEMU_HELPERDIR=\"$libexecdir\"" >> $config_host_mak
 
 echo "ARCH=$ARCH" >> $config_host_mak
Signature · 1 line
1.7.12.315.g682ce8b
Reviewed-by on v2 1/2
#2 lore raw

Re: [Qemu-devel] [PATCH 1/2] configure: add --localstatedir

Quoted 3 lines · Luiz Capitulino

Next commit wants to use it.

Quoted 62 lines
---
 configure | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
configure +8 -1
index 8f99b7b..dab07d6 100755
@@ -184,6 +184,7 @@ libdir="\${prefix}/lib"
 libexecdir="\${prefix}/libexec"
 includedir="\${prefix}/include"
 sysconfdir="\${prefix}/etc"
+local_statedir="\${prefix}/var"
 confsuffix="/qemu"
 slirp="yes"
 fmod_lib=""
@@ -552,6 +553,7 @@ EOF
   qemu_docdir="\${prefix}"
   bindir="\${prefix}"
   sysconfdir="\${prefix}"
+  local_statedir="\${prefix}"
   confsuffix=""
   libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
 fi
@@ -628,7 +630,9 @@ for opt do
   ;;
   --sysconfdir=*) sysconfdir="$optarg"
   ;;
-  --sbindir=*|--sharedstatedir=*|--localstatedir=*|\
+  --localstatedir=*) local_statedir="$optarg"
+  ;;
+  --sbindir=*|--sharedstatedir=*|\
   --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
   --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
     # These switches are silently ignored, for compatibility with
@@ -1022,6 +1026,7 @@ echo "  --datadir=PATH           install firmware in PATH$confsuffix"
 echo "  --docdir=PATH            install documentation in PATH$confsuffix"
 echo "  --bindir=PATH            install binaries in PATH"
 echo "  --sysconfdir=PATH        install config in PATH$confsuffix"
+echo "  --localstatedir=PATH     install local state in PATH"
 echo "  --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]"
 echo "  --enable-debug-tcg       enable TCG debugging"
 echo "  --disable-debug-tcg      disable TCG debugging (default)"
@@ -3086,6 +3091,7 @@ echo "library directory `eval echo $libdir`"
 echo "libexec directory `eval echo $libexecdir`"
 echo "include directory `eval echo $includedir`"
 echo "config directory  `eval echo $sysconfdir`"
+echo "local state directory   `eval echo $local_statedir`"
 if test "$mingw32" = "no" ; then
 echo "Manual directory  `eval echo $mandir`"
 echo "ELF interp prefix $interp_prefix"
@@ -3194,6 +3200,7 @@ echo "sysconfdir=$sysconfdir" >> $config_host_mak
 echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
 echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
 echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
+echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
 echo "CONFIG_QEMU_HELPERDIR=\"$libexecdir\"" >> $config_host_mak
 
 echo "ARCH=$ARCH" >> $config_host_mak
Signature · 1 line
1.7.12.315.g682ce8b
#3 lore raw

PATCH v2 2/2 qemu-ga: use state dir from CONFIG_QEMU_LOCALSTATEDIR

In reply to Luiz Capitulino

Has the side effect of changing the default directory used to save the freeze status file from /tmp to ${prefix}/var/run.

This is a beneficial change for two reasons:

1. FHS states that programs must not assume that files in /tmp will still exist between invocations of the program. This defeats the purpose of the freeze status file

2. FHS dictates that /var/run must be cleaned on boot, this ensures that a stale freeze status file will be removed on boot

---
 qemu-ga.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
qemu-ga.c +2 -2
index b747470..daeaea5 100644
@@ -40,8 +40,8 @@
 #else
 #define QGA_VIRTIO_PATH_DEFAULT "\\\\.\\Global\\org.qemu.guest_agent.0"
 #endif
-#define QGA_PIDFILE_DEFAULT "/var/run/qemu-ga.pid"
-#define QGA_STATEDIR_DEFAULT "/tmp"
+#define QGA_STATEDIR_DEFAULT CONFIG_QEMU_LOCALSTATEDIR "/run"
+#define QGA_PIDFILE_DEFAULT QGA_STATEDIR_DEFAULT "/qemu-ga.pid"
 #define QGA_SENTINEL_BYTE 0xFF
 
 struct GAState {
Signature · 1 line
1.7.12.315.g682ce8b
Reviewed-by on v2 2/2
#4 lore raw

Re: [Qemu-devel] [PATCH 2/2] qemu-ga: use state dir from CONFIG_QEMU_LOCALSTATEDIR

Quoted 22 lines · Luiz Capitulino

Has the side effect of changing the default directory used to save the freeze status file from /tmp to ${prefix}/var/run.

This is a beneficial change for two reasons:

1. FHS states that programs must not assume that files in /tmp will still exist between invocations of the program. This defeats the purpose of the freeze status file

2. FHS dictates that /var/run must be cleaned on boot, this ensures that a stale freeze status file will be removed on boot

---
 qemu-ga.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
qemu-ga.c +0 -0
index b747470..daeaea5 100644

qemu-ga.c line 44

Quoted 7 lines
qemu-ga.c +2 -2
@@ -40,8 +40,8 @@
 #else
 #define QGA_VIRTIO_PATH_DEFAULT "\\\\.\\Global\\org.qemu.guest_agent.0"
 #endif
-#define QGA_PIDFILE_DEFAULT "/var/run/qemu-ga.pid"
-#define QGA_STATEDIR_DEFAULT "/tmp"
+#define QGA_STATEDIR_DEFAULT CONFIG_QEMU_LOCALSTATEDIR "/run"
+#define QGA_PIDFILE_DEFAULT QGA_STATEDIR_DEFAULT "/qemu-ga.pid"

Just to confirm, in configure we have:

echo "qemu_localstatedir=$local_statedir" >> $config_host_mak

Is there some magic that generates a CONFIG_QEMU_LOCALSTATEDIR with the same value? If so:

Quoted 6 lines
qemu-ga.c +0 -0
 #define QGA_SENTINEL_BYTE 0xFF
 
 struct GAState {
Signature · 1 line
1.7.12.315.g682ce8b
#5 lore raw

Re: [Qemu-devel] [PATCH 2/2] qemu-ga: use state dir from CONFIG_QEMU_LOCALSTATEDIR

Quoted 33 lines · On Thu, 4 Oct 2012 10:47:06 -0500 Michael Roth <[email protected]>…
Quoted 22 lines · Luiz Capitulino

Has the side effect of changing the default directory used to save the freeze status file from /tmp to ${prefix}/var/run.

This is a beneficial change for two reasons:

1. FHS states that programs must not assume that files in /tmp will still exist between invocations of the program. This defeats the purpose of the freeze status file

2. FHS dictates that /var/run must be cleaned on boot, this ensures that a stale freeze status file will be removed on boot

---
 qemu-ga.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
qemu-ga.c +0 -0
index b747470..daeaea5 100644

qemu-ga.c line 44

Quoted 7 lines
qemu-ga.c +2 -2
@@ -40,8 +40,8 @@
 #else
 #define QGA_VIRTIO_PATH_DEFAULT "\\\\.\\Global\\org.qemu.guest_agent.0"
 #endif
-#define QGA_PIDFILE_DEFAULT "/var/run/qemu-ga.pid"
-#define QGA_STATEDIR_DEFAULT "/tmp"
+#define QGA_STATEDIR_DEFAULT CONFIG_QEMU_LOCALSTATEDIR "/run"
+#define QGA_PIDFILE_DEFAULT QGA_STATEDIR_DEFAULT "/qemu-ga.pid"

Just to confirm, in configure we have:

Quoted 4 lines

echo "qemu_localstatedir=$local_statedir" >> $config_host_mak

Is there some magic that generates a CONFIG_QEMU_LOCALSTATEDIR with the same value? If so:

Yes, that's done by scripts/create_config

Quoted 1 line

Btw, is this going through your tree?

Quoted 8 lines
Quoted 7 lines
qemu-ga.c +0 -0
 #define QGA_SENTINEL_BYTE 0xFF
 
 struct GAState {
Signature · 1 line
1.7.12.315.g682ce8b
#6 lore raw

Re: [Qemu-devel] [PATCH 2/2] qemu-ga: use state dir from CONFIG_QEMU_LOCALSTATEDIR

Quoted 38 lines · Luiz Capitulino
Quoted 35 lines · On Thu, 4 Oct 2012 10:47:06 -0500 Michael Roth <[email protected]>…
Quoted 22 lines · Luiz Capitulino

Has the side effect of changing the default directory used to save the freeze status file from /tmp to ${prefix}/var/run.

This is a beneficial change for two reasons:

1. FHS states that programs must not assume that files in /tmp will still exist between invocations of the program. This defeats the purpose of the freeze status file

2. FHS dictates that /var/run must be cleaned on boot, this ensures that a stale freeze status file will be removed on boot

---
 qemu-ga.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
qemu-ga.c +0 -0
index b747470..daeaea5 100644

qemu-ga.c line 44

Quoted 7 lines
qemu-ga.c +2 -2
@@ -40,8 +40,8 @@
 #else
 #define QGA_VIRTIO_PATH_DEFAULT "\\\\.\\Global\\org.qemu.guest_agent.0"
 #endif
-#define QGA_PIDFILE_DEFAULT "/var/run/qemu-ga.pid"
-#define QGA_STATEDIR_DEFAULT "/tmp"
+#define QGA_STATEDIR_DEFAULT CONFIG_QEMU_LOCALSTATEDIR "/run"
+#define QGA_PIDFILE_DEFAULT QGA_STATEDIR_DEFAULT "/qemu-ga.pid"

Just to confirm, in configure we have:

echo "qemu_localstatedir=$local_statedir" >> $config_host_mak

Quoted 8 lines
Quoted 2 lines

Is there some magic that generates a CONFIG_QEMU_LOCALSTATEDIR with the same value? If so:

Yes, that's done by scripts/create_config

Quoted 1 line

Btw, is this going through your tree?

Yup, was planning on sending a pull tomorrow after some basic testing. Same for the standalone pidfile fix-up.

Quoted 10 lines
Quoted 9 lines
Quoted 8 lines
qemu-ga.c +0 -0
 #define QGA_SENTINEL_BYTE 0xFF
 
 struct GAState {
Signature · 1 line
1.7.12.315.g682ce8b
#7 lore raw

Re: [Qemu-devel] [PATCH 2/2] qemu-ga: use state dir from CONFIG_QEMU_LOCALSTATEDIR

Quoted 42 lines · On Thu, 4 Oct 2012 12:37:55 -0500 Michael Roth <[email protected]>…
Quoted 41 lines · Luiz Capitulino
Quoted 37 lines · On Thu, 4 Oct 2012 10:47:06 -0500 Michael Roth <[email protected]>…
Quoted 22 lines · Luiz Capitulino

Has the side effect of changing the default directory used to save the freeze status file from /tmp to ${prefix}/var/run.

This is a beneficial change for two reasons:

1. FHS states that programs must not assume that files in /tmp will still exist between invocations of the program. This defeats the purpose of the freeze status file

2. FHS dictates that /var/run must be cleaned on boot, this ensures that a stale freeze status file will be removed on boot

---
 qemu-ga.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
qemu-ga.c +0 -0
index b747470..daeaea5 100644

qemu-ga.c line 44

Quoted 7 lines
qemu-ga.c +2 -2
@@ -40,8 +40,8 @@
 #else
 #define QGA_VIRTIO_PATH_DEFAULT "\\\\.\\Global\\org.qemu.guest_agent.0"
 #endif
-#define QGA_PIDFILE_DEFAULT "/var/run/qemu-ga.pid"
-#define QGA_STATEDIR_DEFAULT "/tmp"
+#define QGA_STATEDIR_DEFAULT CONFIG_QEMU_LOCALSTATEDIR "/run"
+#define QGA_PIDFILE_DEFAULT QGA_STATEDIR_DEFAULT "/qemu-ga.pid"

Just to confirm, in configure we have:

echo "qemu_localstatedir=$local_statedir" >> $config_host_mak

Is there some magic that generates a CONFIG_QEMU_LOCALSTATEDIR with the same value? If so:

Quoted 8 lines
Quoted 5 lines

Yes, that's done by scripts/create_config

Quoted 1 line

Btw, is this going through your tree?

Yup, was planning on sending a pull tomorrow after some basic testing. Same for the standalone pidfile fix-up.

Ok! Please, I didn't mean to hurry you up, just wanted to check we wouldn't deadlock waiting for each other :)

Quoted 12 lines
Quoted 11 lines
Quoted 10 lines
Quoted 9 lines
qemu-ga.c +0 -0
 #define QGA_SENTINEL_BYTE 0xFF
 
 struct GAState {
Signature · 1 line
1.7.12.315.g682ce8b
#8 lore raw

Re: [Qemu-devel] [PATCH 2/2] qemu-ga: use state dir from CONFIG_QEMU_LOCALSTATEDIR

Quoted 49 lines · Luiz Capitulino
Quoted 46 lines · On Thu, 4 Oct 2012 12:37:55 -0500 Michael Roth <[email protected]>…
Quoted 45 lines · Luiz Capitulino
Quoted 33 lines · On Thu, 4 Oct 2012 10:47:06 -0500 Michael Roth <[email protected]>…
Quoted 22 lines · Luiz Capitulino

Has the side effect of changing the default directory used to save the freeze status file from /tmp to ${prefix}/var/run.

This is a beneficial change for two reasons:

1. FHS states that programs must not assume that files in /tmp will still exist between invocations of the program. This defeats the purpose of the freeze status file

2. FHS dictates that /var/run must be cleaned on boot, this ensures that a stale freeze status file will be removed on boot

---
 qemu-ga.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
qemu-ga.c +0 -0
index b747470..daeaea5 100644

qemu-ga.c line 44

Quoted 7 lines
qemu-ga.c +2 -2
@@ -40,8 +40,8 @@
 #else
 #define QGA_VIRTIO_PATH_DEFAULT "\\\\.\\Global\\org.qemu.guest_agent.0"
 #endif
-#define QGA_PIDFILE_DEFAULT "/var/run/qemu-ga.pid"
-#define QGA_STATEDIR_DEFAULT "/tmp"
+#define QGA_STATEDIR_DEFAULT CONFIG_QEMU_LOCALSTATEDIR "/run"
+#define QGA_PIDFILE_DEFAULT QGA_STATEDIR_DEFAULT "/qemu-ga.pid"

Just to confirm, in configure we have:

Quoted 4 lines

echo "qemu_localstatedir=$local_statedir" >> $config_host_mak

Is there some magic that generates a CONFIG_QEMU_LOCALSTATEDIR with the same value? If so:

Yes, that's done by scripts/create_config

Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Btw, is this going through your tree?

Yup, was planning on sending a pull tomorrow after some basic testing. Same for the standalone pidfile fix-up.

Ok! Please, I didn't mean to hurry you up, just wanted to check we wouldn't deadlock waiting for each other :)

Understood; no worries :) Patches seem pretty straightforward and the qemu-ga queue isn't exactly overflowing atm so I didn't see any reason to sit on these for too long.

Quoted 14 lines
Quoted 13 lines
Quoted 12 lines
Quoted 11 lines
Quoted 10 lines
qemu-ga.c +0 -0
 #define QGA_SENTINEL_BYTE 0xFF
 
 struct GAState {
Signature · 1 line
1.7.12.315.g682ce8b
Reviewed-by on the v2 series
#9 lore raw
In reply to Luiz Capitulino

Il 03/10/2012 23:35, Luiz Capitulino ha scritto:

Quoted 8 lines

Also allow users to change the default at configure time. Please, check individual patches for more details.

o v2

- drop --guest-agent-statedir in favor of --localstatedir
- change default from /var/run to ${prefix}/var/run

Quoted 8 lines

Luiz Capitulino (2):
configure: add --localstatedir
qemu-ga: use state dir from CONFIG_QEMU_LOCALSTATEDIR

 configure | 9 ++++++++-
 qemu-ga.c | 4 ++--
 2 files changed, 10 insertions(+), 3 deletions(-)