diff options
author | Matthew Booth <mbooth@redhat.com> | 2011-10-18 13:42:16 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-10-19 16:27:38 +0100 |
commit | 6aa3ece129d04a588ceb161c4b203a20664ddcd8 (patch) | |
tree | 4b28f3c314240061c5c0b299b05ac8f225fae596 /src | |
parent | f5c9f0e9ee1729b1260cef3e51ca91936e1868c4 (diff) | |
download | libguestfs-6aa3ece129d04a588ceb161c4b203a20664ddcd8.tar.gz libguestfs-6aa3ece129d04a588ceb161c4b203a20664ddcd8.tar.xz libguestfs-6aa3ece129d04a588ceb161c4b203a20664ddcd8.zip |
inspect: Handle cciss devices in /etc/fstab
Diffstat (limited to 'src')
-rw-r--r-- | src/inspect_fs_unix.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/inspect_fs_unix.c b/src/inspect_fs_unix.c index 77834a1d..6b1a05ba 100644 --- a/src/inspect_fs_unix.c +++ b/src/inspect_fs_unix.c @@ -64,6 +64,7 @@ static pcre *re_scientific_linux_no_minor; static pcre *re_major_minor; static pcre *re_aug_seq; static pcre *re_xdev; +static pcre *re_cciss; static pcre *re_first_partition; static pcre *re_freebsd; static pcre *re_netbsd; @@ -108,6 +109,7 @@ compile_regexps (void) COMPILE (re_major_minor, "(\\d+)\\.(\\d+)", 0); COMPILE (re_aug_seq, "/\\d+$", 0); COMPILE (re_xdev, "^/dev/(h|s|v|xv)d([a-z]+)(\\d*)$", 0); + COMPILE (re_cciss, "^/dev/(cciss/c\\d+d\\d+)(?:p(\\d+))?$", 0); COMPILE (re_freebsd, "^/dev/ad(\\d+)s(\\d+)([a-z])$", 0); COMPILE (re_netbsd, "^NetBSD (\\d+)\\.(\\d+)", 0); } @@ -128,6 +130,7 @@ free_regexps (void) pcre_free (re_major_minor); pcre_free (re_aug_seq); pcre_free (re_xdev); + pcre_free (re_cciss); pcre_free (re_freebsd); pcre_free (re_netbsd); } @@ -880,6 +883,35 @@ resolve_fstab_device (guestfs_h *g, const char *spec) free (part); guestfs___free_string_list (devices); } + else if (match2 (g, spec, re_cciss, &disk, &part)) { + /* disk: (cciss/c\d+d\d+) + * part: (\d+)? */ + char **devices = guestfs_list_devices (g); + if (devices == NULL) + return NULL; + + /* Check any hints we were passed for a non-heuristic mapping */ + size_t i = 0; + struct drive *drive = g->drives; + while (drive) { + if (drive->name && STREQ(drive->name, disk)) { + if (part) { + device = safe_asprintf (g, "%s%s", devices[i], part); + } else { + device = safe_strdup (g, devices[i]); + } + break; + } + + i++; drive = drive->next; + } + + /* We don't try to guess mappings for cciss devices */ + + free (disk); + free (part); + guestfs___free_string_list (devices); + } else if (match3 (g, spec, re_freebsd, &disk, &slice, &part)) { /* FreeBSD disks are organized quite differently. See: * http://www.freebsd.org/doc/handbook/disk-organization.html |