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

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