summaryrefslogtreecommitdiffstats
path: root/daemon/daemon.h
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2011-01-27 17:27:41 +0000
committerRichard W.M. Jones <rjones@redhat.com>2011-01-27 18:08:45 +0000
commit77df7d6d537cebe05e06bf07e6e4a2082fe6656a (patch)
tree5ff1b7f29a47c5839c2c5e2ebd8b6d1f4f92c599 /daemon/daemon.h
parente85fbee7bff9422a370d3f437594d262c043d89b (diff)
downloadlibguestfs-77df7d6d537cebe05e06bf07e6e4a2082fe6656a.tar.gz
libguestfs-77df7d6d537cebe05e06bf07e6e4a2082fe6656a.tar.xz
libguestfs-77df7d6d537cebe05e06bf07e6e4a2082fe6656a.zip
daemon: Replace root_mounted global with intelligence.
We used to maintain a global flag 'root_mounted' which tells us if the user has mounted something on root (ie. on the sysroot directory). This flag caused a lot of trouble (eg. RHBZ#599503) because it's hard to keep the flag updated correctly when the user can do arbitrary mounts and also use mkmountpoint. Remove this flag and replace it with a test to see if something is mounted on *or under* the sysroot. (It has to be *or under* because of mkmountpoint and friends). This also replaces a rather convoluted "have we mounted root yet" check in the mount* APIs with a simpler check to see if the mountpoint exists and is an ordinary directory.
Diffstat (limited to 'daemon/daemon.h')
-rw-r--r--daemon/daemon.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/daemon/daemon.h b/daemon/daemon.h
index 6845e1b3..da991b17 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -107,7 +107,7 @@ extern uint64_t progress_hint;
extern uint64_t optargs_bitmask;
/*-- in mount.c --*/
-extern int root_mounted;
+extern int is_root_mounted (void);
/*-- in stubs.c (auto-generated) --*/
extern void dispatch_incoming_message (XDR *);
@@ -178,7 +178,7 @@ extern void notify_progress (uint64_t position, uint64_t total);
*/
#define NEED_ROOT(cancel_stmt,fail_stmt) \
do { \
- if (!root_mounted) { \
+ if (!is_root_mounted ()) { \
if ((cancel_stmt) != -2) \
reply_with_error ("%s: you must call 'mount' first to mount the root filesystem", __func__); \
fail_stmt; \