[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH 1/3] inspect: Remove unused content field from filesystem struct



---
 src/guestfs-internal.h | 18 ------------------
 src/inspect-fs-cd.c    |  1 -
 src/inspect-fs.c       | 44 ++------------------------------------------
 3 files changed, 2 insertions(+), 61 deletions(-)

diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h
index 4be6e38..c1234ce 100644
--- a/src/guestfs-internal.h
+++ b/src/guestfs-internal.h
@@ -354,23 +354,6 @@ struct guestfs_h
 };
 
 /* Per-filesystem data stored for inspect_os. */
-enum inspect_fs_content {
-  FS_CONTENT_UNKNOWN = 0,
-  FS_CONTENT_LINUX_ROOT,
-  FS_CONTENT_WINDOWS_ROOT,
-  FS_CONTENT_WINDOWS_VOLUME_WITH_APPS,
-  FS_CONTENT_WINDOWS_VOLUME,
-  FS_CONTENT_LINUX_BOOT,
-  FS_CONTENT_LINUX_USR,
-  FS_CONTENT_LINUX_USR_LOCAL,
-  FS_CONTENT_LINUX_VAR,
-  FS_CONTENT_FREEBSD_ROOT,
-  FS_CONTENT_NETBSD_ROOT,
-  FS_CONTENT_INSTALLER,
-  FS_CONTENT_HURD_ROOT,
-  FS_CONTENT_FREEDOS_ROOT,
-};
-
 enum inspect_os_format {
   OS_FORMAT_UNKNOWN = 0,
   OS_FORMAT_INSTALLED,
@@ -444,7 +427,6 @@ struct inspect_fs {
   char *device;
   int is_mountable;
   int is_swap;
-  enum inspect_fs_content content;
   enum inspect_os_type type;
   enum inspect_os_distro distro;
   enum inspect_os_package_format package_format;
diff --git a/src/inspect-fs-cd.c b/src/inspect-fs-cd.c
index 05559b9..6bafb99 100644
--- a/src/inspect-fs-cd.c
+++ b/src/inspect-fs-cd.c
@@ -507,7 +507,6 @@ guestfs___check_installer_iso (guestfs_h *g, struct inspect_fs *fs,
   /* Otherwise we matched an ISO, so fill in the fs fields. */
   fs->device = safe_strdup (g, device);
   fs->is_root = 1;
-  fs->content = FS_CONTENT_INSTALLER;
   fs->format = OS_FORMAT_INSTALLER;
   fs->type = osinfo->type;
   fs->distro = osinfo->distro;
diff --git a/src/inspect-fs.c b/src/inspect-fs.c
index 2c81e41..706e82e 100644
--- a/src/inspect-fs.c
+++ b/src/inspect-fs.c
@@ -181,15 +181,8 @@ check_filesystem (guestfs_h *g, const char *device,
   /* Optimize some of the tests by avoiding multiple tests of the same thing. */
   int is_dir_etc = guestfs_is_dir (g, "/etc") > 0;
   int is_dir_bin = guestfs_is_dir (g, "/bin") > 0;
-  int is_dir_share = guestfs_is_dir (g, "/share") > 0;
-
-  /* Grub /boot? */
-  if (guestfs_is_file (g, "/grub/menu.lst") > 0 ||
-      guestfs_is_file (g, "/grub/grub.conf") > 0 ||
-      guestfs_is_file (g, "/grub2/grub.cfg") > 0)
-    fs->content = FS_CONTENT_LINUX_BOOT;
-  /* FreeBSD root? */
-  else if (is_dir_etc &&
+
+  if (is_dir_etc &&
            is_dir_bin &&
            guestfs_is_file (g, "/etc/freebsd-update.conf") > 0 &&
            guestfs_is_file (g, "/etc/fstab") > 0) {
@@ -201,7 +194,6 @@ check_filesystem (guestfs_h *g, const char *device,
       return 0;
 
     fs->is_root = 1;
-    fs->content = FS_CONTENT_FREEBSD_ROOT;
     fs->format = OS_FORMAT_INSTALLED;
     if (guestfs___check_freebsd_root (g, fs) == -1)
       return -1;
@@ -218,7 +210,6 @@ check_filesystem (guestfs_h *g, const char *device,
       return 0;
 
     fs->is_root = 1;
-    fs->content = FS_CONTENT_NETBSD_ROOT;
     fs->format = OS_FORMAT_INSTALLED;
     if (guestfs___check_netbsd_root (g, fs) == -1)
       return -1;
@@ -228,7 +219,6 @@ check_filesystem (guestfs_h *g, const char *device,
            guestfs_is_file (g, "/hurd/hello") > 0 &&
            guestfs_is_file (g, "/hurd/null") > 0) {
     fs->is_root = 1;
-    fs->content = FS_CONTENT_HURD_ROOT;
     fs->format = OS_FORMAT_INSTALLED; /* XXX could be more specific */
     if (guestfs___check_hurd_root (g, fs) == -1)
       return -1;
@@ -240,50 +230,21 @@ check_filesystem (guestfs_h *g, const char *device,
              guestfs_is_dir (g, "/usr/bin") > 0)) &&
            guestfs_is_file (g, "/etc/fstab") > 0) {
     fs->is_root = 1;
-    fs->content = FS_CONTENT_LINUX_ROOT;
     fs->format = OS_FORMAT_INSTALLED;
     if (guestfs___check_linux_root (g, fs) == -1)
       return -1;
   }
-  /* Linux /usr/local? */
-  else if (is_dir_etc &&
-           is_dir_bin &&
-           is_dir_share &&
-           guestfs_exists (g, "/local") == 0 &&
-           guestfs_is_file (g, "/etc/fstab") == 0)
-    fs->content = FS_CONTENT_LINUX_USR_LOCAL;
-  /* Linux /usr? */
-  else if (is_dir_etc &&
-           is_dir_bin &&
-           is_dir_share &&
-           guestfs_exists (g, "/local") > 0 &&
-           guestfs_is_file (g, "/etc/fstab") == 0)
-    fs->content = FS_CONTENT_LINUX_USR;
-  /* Linux /var? */
-  else if (guestfs_is_dir (g, "/log") > 0 &&
-           guestfs_is_dir (g, "/run") > 0 &&
-           guestfs_is_dir (g, "/spool") > 0)
-    fs->content = FS_CONTENT_LINUX_VAR;
   /* Windows root? */
   else if (guestfs___has_windows_systemroot (g) >= 0) {
     fs->is_root = 1;
-    fs->content = FS_CONTENT_WINDOWS_ROOT;
     fs->format = OS_FORMAT_INSTALLED;
     if (guestfs___check_windows_root (g, fs) == -1)
       return -1;
   }
-  /* Windows volume with installed applications (but not root)? */
-  else if (guestfs___is_dir_nocase (g, "/System Volume Information") > 0 &&
-           guestfs___is_dir_nocase (g, "/Program Files") > 0)
-    fs->content = FS_CONTENT_WINDOWS_VOLUME_WITH_APPS;
-  /* Windows volume (but not root)? */
-  else if (guestfs___is_dir_nocase (g, "/System Volume Information") > 0)
-    fs->content = FS_CONTENT_WINDOWS_VOLUME;
   /* FreeDOS? */
   else if (guestfs___is_dir_nocase (g, "/FDOS") > 0 &&
            guestfs___is_file_nocase (g, "/FDOS/FREEDOS.BSS") > 0) {
     fs->is_root = 1;
-    fs->content = FS_CONTENT_FREEBSD_ROOT;
     fs->format = OS_FORMAT_INSTALLED;
     fs->type = OS_TYPE_DOS;
     fs->distro = OS_DISTRO_FREEDOS;
@@ -311,7 +272,6 @@ check_filesystem (guestfs_h *g, const char *device,
             guestfs_is_file (g, "/amd64/txtsetup.sif") > 0 ||
             guestfs_is_file (g, "/freedos/freedos.ico") > 0)) {
     fs->is_root = 1;
-    fs->content = FS_CONTENT_INSTALLER;
     fs->format = OS_FORMAT_INSTALLER;
     if (guestfs___check_installer_root (g, fs) == -1)
       return -1;
-- 
1.7.11.7


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]