[Libguestfs] [PATCH 2/5] inspect: mark CoreOS /usr partitions with own USR role

Pino Toscano ptoscano at redhat.com
Tue Dec 6 15:29:19 UTC 2016


Add a new inspect role for "/usr" partitions, and use that to mark the
/usr partition in CoreOS: this additional role allows to ease its lookup
later on, when merging its results into those of the root.
---
 src/guestfs-internal.h | 1 +
 src/inspect-fs-unix.c  | 1 +
 src/inspect.c          | 2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h
index 861ca75..d10191d 100644
--- a/src/guestfs-internal.h
+++ b/src/guestfs-internal.h
@@ -636,6 +636,7 @@ enum inspect_os_package_management {
 enum inspect_os_role {
   OS_ROLE_UNKNOWN = 0,
   OS_ROLE_ROOT,
+  OS_ROLE_USR,
 };
 
 /**
diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c
index a1a757c..c833304 100644
--- a/src/inspect-fs-unix.c
+++ b/src/inspect-fs-unix.c
@@ -1013,6 +1013,7 @@ guestfs_int_check_coreos_usr (guestfs_h *g, struct inspect_fs *fs)
 
   fs->type = OS_TYPE_LINUX;
   fs->distro = OS_DISTRO_COREOS;
+  fs->role = OS_ROLE_USR;
 
   if (guestfs_is_file_opts (g, "/lib/os-release",
                             GUESTFS_IS_FILE_OPTS_FOLLOWSYMLINKS, 1, -1) > 0) {
diff --git a/src/inspect.c b/src/inspect.c
index ae5c457..9055226 100644
--- a/src/inspect.c
+++ b/src/inspect.c
@@ -123,7 +123,7 @@ collect_coreos_inspection_info (guestfs_h *g)
   for (i = 0; i < g->nr_fses; ++i) {
     struct inspect_fs *fs = &g->fses[i];
 
-    if (fs->distro != OS_DISTRO_COREOS || fs->role == OS_ROLE_ROOT)
+    if (fs->distro != OS_DISTRO_COREOS || fs->role != OS_ROLE_USR)
       continue;
 
     /* CoreOS is designed to contain 2 /usr partitions (USR-A, USR-B):
-- 
2.7.4




More information about the Libguestfs mailing list