X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Fdaemon.h;h=4a686c092998c54a39d8ecffdb36558a9d0b8fd2;hb=7fb25f53f836172376c25b405b5f88f4ec37eed8;hp=1e58910042fc8f498c31057f1f861a6b253fc2bd;hpb=3aa8182c3cc478bf723205f1a4dd84e160768448;p=libguestfs.git diff --git a/daemon/daemon.h b/daemon/daemon.h index 1e58910..4a686c0 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -33,6 +33,8 @@ /*-- in guestfsd.c --*/ extern int verbose; +extern int autosync_umount; + extern const char *sysroot; extern int sysroot_len; @@ -81,8 +83,8 @@ extern int prog_exists (const char *prog); extern void udev_settle (void); -/* This just stops gcc from giving a warning about our custom - * printf formatters %Q and %R. See HACKING file for more +/* This just stops gcc from giving a warning about our custom printf + * formatters %Q and %R. See guestfs(3)/EXTENDING LIBGUESTFS for more * info about these. */ static inline int @@ -107,7 +109,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 +180,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; \ @@ -253,17 +255,21 @@ extern void notify_progress (uint64_t position, uint64_t total); */ #define CHROOT_IN \ do { \ - int __old_errno = errno; \ - if (chroot (sysroot) == -1) \ - perror ("CHROOT_IN: sysroot"); \ - errno = __old_errno; \ + if (sysroot_len > 0) { \ + int __old_errno = errno; \ + if (chroot (sysroot) == -1) \ + perror ("CHROOT_IN: sysroot"); \ + errno = __old_errno; \ + } \ } while (0) #define CHROOT_OUT \ do { \ - int __old_errno = errno; \ - if (chroot (".") == -1) \ - perror ("CHROOT_OUT: ."); \ - errno = __old_errno; \ + if (sysroot_len > 0) { \ + int __old_errno = errno; \ + if (chroot (".") == -1) \ + perror ("CHROOT_OUT: ."); \ + errno = __old_errno; \ + } \ } while (0) /* Marks functions which are not implemented.