Nikos Skalkotos
2014-Dec-02 17:15 UTC
[Libguestfs] [PATCH 4/5] Fix fstab block device resolution for FreeBSD
Take into granted that partition 'c' has a special purpose. It has always the same size as the enclosing slice and is not mapped under Linux. This is a best effort try. The mapping will be incorrect if there is a gap in the disklabel partitions sequence, e.g. 'b' (swap) partition is missing but 'd' partition is defined. Signed-off-by: Nikos Skalkotos <skalkoto@grnet.gr> --- src/inspect-fs-unix.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c index 3a2f81a..b1a2f8f 100644 --- a/src/inspect-fs-unix.c +++ b/src/inspect-fs-unix.c @@ -1620,9 +1620,13 @@ resolve_fstab_device (guestfs_h *g, const char *spec, Hash_table *md_map, free (slice); free (part); + if (part_i > 2) + /* Partition 'c' has the size of the enclosing slice. Not mapped under Linux. */ + part_i -= 1; + if (disk_i != -1 && disk_i <= 26 && slice_i > 0 && slice_i <= 1 /* > 4 .. see comment above */ && - part_i >= 0 && part_i < 26) { + part_i >= 0 && part_i < 25) { device = safe_asprintf (g, "/dev/sd%c%d", disk_i + 'a', part_i + 5); } } -- 2.1.3
Maybe Matching Threads
- [PATCH stable-1.24] Fix fstab block device resolution for FreeBSD
- [PATCH 3/4] Fix fstab block device resolution for FreeBSD
- [PATCH 3/5] Support fstab block device resolution for NetBSD
- [PATCH stable-1.24] Fix fstab block device resolution for FreeBSD
- [PATCH 2/4] Support fstab block device resolution for NetBSD