summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Scherer <misc@zarb.org>2011-10-14 01:05:06 +0200
committerRichard W.M. Jones <rjones@redhat.com>2011-10-14 10:26:16 +0100
commit05a8359c7cf98fdcf75628299dd3e64401f07ee4 (patch)
tree0150cad835d8d075c2149c28775c48fcb5772e94
parent15d79b5ea95ba28ebf6d8bb7542d86702edc1e8f (diff)
downloadlibguestfs-05a8359c7cf98fdcf75628299dd3e64401f07ee4.tar.gz
libguestfs-05a8359c7cf98fdcf75628299dd3e64401f07ee4.tar.xz
libguestfs-05a8359c7cf98fdcf75628299dd3e64401f07ee4.zip
Add support for mounting ufs from NetBSD, and fix FreeBSD detection on Fedora 16
While testing on Fedora 16, I noticed that Linux will mount the disk without trouble by using automatically ufstype=old, and yet do not let us read the directories. So we should start directly with usftype=ufs2, and if it fail, try 44bsd, as used for netbsd and openbsd ( as seen on http://wiki-static.aydogan.net/How_to_mount_FFS_partition_under_Linux ).
-rw-r--r--src/inspect_fs.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/inspect_fs.c b/src/inspect_fs.c
index 25336265..68e2ddb7 100644
--- a/src/inspect_fs.c
+++ b/src/inspect_fs.c
@@ -120,9 +120,16 @@ guestfs___check_for_filesystem_on (guestfs_h *g, const char *device,
/* Try mounting the device. As above, ignore errors. */
g->error_cb = NULL;
- int r = guestfs_mount_ro (g, device, "/");
- if (r == -1 && vfs_type && STREQ (vfs_type, "ufs")) /* Hack for the *BSDs. */
+ int r;
+ if (vfs_type && STREQ (vfs_type, "ufs")) { /* Hack for the *BSDs. */
+ /* FreeBSD fs is a variant of ufs called ufs2 ... */
r = guestfs_mount_vfs (g, "ro,ufstype=ufs2", "ufs", device, "/");
+ if (r == -1)
+ /* while NetBSD and OpenBSD use another variant labeled 44bsd */
+ r = guestfs_mount_vfs (g, "ro,ufstype=44bsd", "ufs", device, "/");
+ } else {
+ r = guestfs_mount_ro (g, device, "/");
+ }
free (vfs_type);
g->error_cb = old_error_cb;
if (r == -1)