File kdump-move-class-SystemCPU-to-header-file.patch of Package kdump.21349

From: Petr Tesarik <ptesarik@suse.com>
Date: Fri Jun 23 13:19:41 2017 +0200
Subject: Move class SystemCPU to a header file
References: bsc#1036223
Upstream: v0.8.17
Git-commit: ded0d2117cce72fc98a7ca9ee577090889ef9b16

This allows to reuse the class outside of calibrate.cc.

Signed-off-by: Petr Tesarik <ptesarik@suse.com>

---
 kdumptool/calibrate.cc |   47 ---------------------------------------------
 kdumptool/calibrate.h  |   51 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 47 deletions(-)

--- a/kdumptool/calibrate.cc
+++ b/kdumptool/calibrate.cc
@@ -251,53 +251,6 @@ using std::ifstream;
 
 //{{{ SystemCPU ----------------------------------------------------------------
 
-class SystemCPU {
-
-    public:
-        /**
-	 * Initialize a new SystemCPU object.
-	 *
-	 * @param[in] sysdir Mount point for sysfs
-	 */
-	SystemCPU(const char *sysdir = "/sys")
-	throw ()
-	: m_cpudir(FilePath(sysdir).appendPath("devices/system/cpu"))
-	{}
-
-    protected:
-        /**
-	 * Path to the cpu system devices base directory
-	 */
-	const FilePath m_cpudir;
-
-        /**
-	 * Count the number of CPUs in a cpuset
-	 *
-	 * @param[in] name Name of the cpuset ("possible", "present", "online")
-	 *
-	 * @exception KError if the file cannot be opened or parsed
-	 */
-	unsigned long count(const char *name);
-
-    public:
-        /**
-	 * Count the number of online CPUs
-	 *
-	 * @exception KError see @c count()
-	 */
-	unsigned long numOnline(void)
-	{ return count("online"); }
-
-        /**
-	 * Count the number of offline CPUs
-	 *
-	 * @exception KError see @c count()
-	 */
-	unsigned long numOffline(void)
-	{ return count("offline"); }
-
-};
-
 // -----------------------------------------------------------------------------
 unsigned long SystemCPU::count(const char *name)
 {
--- a/kdumptool/calibrate.h
+++ b/kdumptool/calibrate.h
@@ -20,6 +20,7 @@
 #define CALIBRATE_H
 
 #include "subcommand.h"
+#include "fileutil.h"
 
 //{{{ Calibrate ----------------------------------------------------------------
 
@@ -54,6 +55,56 @@ class Calibrate : public Subcommand {
 };
 
 //}}}
+//{{{ SystemCPU ----------------------------------------------------------------
+
+class SystemCPU {
+
+    public:
+        /**
+	 * Initialize a new SystemCPU object.
+	 *
+	 * @param[in] sysdir Mount point for sysfs
+	 */
+	SystemCPU(const char *sysdir = "/sys")
+	throw ()
+	: m_cpudir(FilePath(sysdir).appendPath("devices/system/cpu"))
+	{}
+
+    protected:
+        /**
+	 * Path to the cpu system devices base directory
+	 */
+	const FilePath m_cpudir;
+
+        /**
+	 * Count the number of CPUs in a cpuset
+	 *
+	 * @param[in] name Name of the cpuset ("possible", "present", "online")
+	 *
+	 * @exception KError if the file cannot be opened or parsed
+	 */
+	unsigned long count(const char *name);
+
+    public:
+        /**
+	 * Count the number of online CPUs
+	 *
+	 * @exception KError see @c count()
+	 */
+	unsigned long numOnline(void)
+	{ return count("online"); }
+
+        /**
+	 * Count the number of offline CPUs
+	 *
+	 * @exception KError see @c count()
+	 */
+	unsigned long numOffline(void)
+	{ return count("offline"); }
+
+};
+
+//}}}
 
 #endif /* CALIBRATE_H */
 
openSUSE Build Service is sponsored by