Blame SOURCES/0001-ignoring-autofs-as-real-filesystem-by-counting-numbe.patch

64179f
From 5b5339d06c4f50730e5cc679e0854ce716f39117 Mon Sep 17 00:00:00 2001
64179f
From: Ondrej Dubaj <odubaj@redhat.com>
64179f
Date: Thu, 28 Feb 2019 15:29:08 +0100
64179f
Subject: [PATCH] ignoring autofs as real filesystem by counting number of
64179f
 valid filesystems and getting all valid filesystems
64179f
64179f
---
64179f
 count.c    | 18 ++++++++++++++++--
64179f
 rd_stats.c | 18 ++++++++++++++++--
64179f
 2 files changed, 32 insertions(+), 4 deletions(-)
64179f
64179f
diff --git a/count.c b/count.c
64179f
index 03469b0..6424baa 100644
64179f
--- a/count.c
64179f
+++ b/count.c
64179f
@@ -463,8 +463,8 @@ __nr_t get_usb_nr(void)
64179f
 __nr_t get_filesystem_nr(void)
64179f
 {
64179f
 	FILE *fp;
64179f
-	char line[512], fs_name[MAX_FS_LEN], mountp[256];
64179f
-	char *pos = 0;
64179f
+	char line[512], fs_name[MAX_FS_LEN], mountp[256], type[128];
64179f
+	char *pos = 0, *pos2 = 0;
64179f
 	__nr_t fs = 0;
64179f
 	int skip = 0, skip_next = 0;
64179f
 	struct statvfs buf;
64179f
@@ -491,6 +491,20 @@ __nr_t get_filesystem_nr(void)
64179f
 			if (pos == NULL)
64179f
 				continue;
64179f
 
64179f
+			/* 	
64179f
+			 * Find second field separator position,
64179f
+			 * read filesystem type,
64179f
+			 * if filesystem type is autofs, skip it 
64179f
+			*/
64179f
+			memset(type, 0, sizeof(type));
64179f
+			pos2 = strchr(pos + 1, ' ');
64179f
+			if (pos2 == NULL)
64179f
+				continue;
64179f
+			
64179f
+			sscanf(pos2 + 1, "%127s", type);
64179f
+			if(strcmp(type, "autofs") == 0)
64179f
+				continue;
64179f
+
64179f
 			/* Read filesystem name and mount point */
64179f
 			sscanf(line, "%127s", fs_name);
64179f
 			sscanf(pos + 1, "%255s", mountp);
64179f
diff --git a/rd_stats.c b/rd_stats.c
64179f
index 61dc958..43e082c 100644
64179f
--- a/rd_stats.c
64179f
+++ b/rd_stats.c
64179f
@@ -2464,10 +2464,10 @@ __nr_t read_bus_usb_dev(struct stats_pwr_usb *st_pwr_usb, __nr_t nr_alloc)
64179f
 __nr_t read_filesystem(struct stats_filesystem *st_filesystem, __nr_t nr_alloc)
64179f
 {
64179f
 	FILE *fp;
64179f
-	char line[512], fs_name[128], mountp[256];
64179f
+	char line[512], fs_name[128], mountp[256], type[128];
64179f
 	int skip = 0, skip_next = 0;
64179f
 	char *pos = 0;
64179f
-	__nr_t fs_read = 0;
64179f
+	__nr_t fs_read = 0, *pos2 = 0;
64179f
 	struct stats_filesystem *st_filesystem_i;
64179f
 	struct statvfs buf;
64179f
 
64179f
@@ -2491,6 +2491,20 @@ __nr_t read_filesystem(struct stats_filesystem *st_filesystem, __nr_t nr_alloc)
64179f
 			if (pos == NULL)
64179f
 				continue;
64179f
 
64179f
+			/* 	
64179f
+			 * Find second field separator position,
64179f
+			 * read filesystem type,
64179f
+			 * if filesystem type is autofs, skip it 
64179f
+			*/
64179f
+			memset(type, 0, sizeof(type));
64179f
+			pos2 = strchr(pos + 1, ' ');
64179f
+			if (pos2 == NULL)
64179f
+				continue;
64179f
+
64179f
+			sscanf(pos2 + 1, "%127s", type);
64179f
+			if(strcmp(type, "autofs") == 0)
64179f
+				continue;
64179f
+
64179f
 			/* Read current filesystem name */
64179f
 			sscanf(line, "%127s", fs_name);
64179f
 			/*
64179f
-- 
64179f
2.30.1 (Apple Git-130)
64179f