summaryrefslogtreecommitdiffstats
path: root/daemon/guestfsd.c
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2010-08-23 11:12:29 +0100
committerRichard Jones <rjones@redhat.com>2010-08-23 16:00:39 +0100
commit5c31f6126ba4ea3e9056c34c300f6f5e332ab997 (patch)
treee1c7b237f3d5719804fca3031d26edb9a8027221 /daemon/guestfsd.c
parent4b753c62089be663ac722e4a875bb061d259e87d (diff)
downloadlibguestfs-5c31f6126ba4ea3e9056c34c300f6f5e332ab997.tar.gz
libguestfs-5c31f6126ba4ea3e9056c34c300f6f5e332ab997.tar.xz
libguestfs-5c31f6126ba4ea3e9056c34c300f6f5e332ab997.zip
Change to using ext2-based, cached supermin appliance.
This changes the method used to build the supermin appliance to use the new ext2-based appliance supported by latest febootstrap. The appliance can also be cached, so we avoid rebuilding it each time it is used. Mailing list discussion goes into the rationale and details: https://www.redhat.com/archives/libguestfs/2010-August/msg00028.html Requires febootstrap >= 2.8.
Diffstat (limited to 'daemon/guestfsd.c')
-rw-r--r--daemon/guestfsd.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c
index 49aca08d..4e293388 100644
--- a/daemon/guestfsd.c
+++ b/daemon/guestfsd.c
@@ -74,6 +74,12 @@ static char *read_cmdline (void);
# define MAX(a,b) ((a)>(b)?(a):(b))
#endif
+/* If root device is an ext2 filesystem, this is the major and minor.
+ * This is so we can ignore this device from the point of view of the
+ * user, eg. in guestfs_list_devices and many other places.
+ */
+static dev_t root_device = 0;
+
int verbose = 0;
static int print_shell_quote (FILE *stream, const struct printf_info *info, const void *const *args);
@@ -163,6 +169,10 @@ main (int argc, char *argv[])
#endif
#endif
+ struct stat statbuf;
+ if (stat ("/", &statbuf) == 0)
+ root_device = statbuf.st_dev;
+
for (;;) {
c = getopt_long (argc, argv, options, long_options, NULL);
if (c == -1) break;
@@ -449,6 +459,22 @@ read_cmdline (void)
return r;
}
+/* Return true iff device is the root device (and therefore should be
+ * ignored from the point of view of user calls).
+ */
+int
+is_root_device (const char *device)
+{
+ struct stat statbuf;
+ if (stat (device, &statbuf) == -1) {
+ perror (device);
+ return 0;
+ }
+ if (statbuf.st_rdev == root_device)
+ return 1;
+ return 0;
+}
+
/* Turn "/path" into "/sysroot/path".
*
* Caller must check for NULL and call reply_with_perror ("malloc")