From: Petr Tesarik <ptesarik@suse.cz>
Date: Thu May 15 07:42:12 2014 +0200
Subject: Rename Process -> ProcessFilter
References: FATE#318874, bsc#917747
Git-commit: 11d96076b95eb0f3dd2b4251d7a1016af48fa6c1
Patch-mainline: v0.8.12

Process-related actions should be split off this class, but then what
should be the name of that process-only class? I'd like to call it
Process, but then the original class must be renamed.

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

---
 kdumptool/configparser.cc |    2 +-
 kdumptool/fileutil.cc     |    4 ++--
 kdumptool/process.cc      |   24 ++++++++++++------------
 kdumptool/process.h       |   24 ++++++++++++------------
 kdumptool/testio.cc       |    4 ++--
 5 files changed, 29 insertions(+), 29 deletions(-)

--- a/kdumptool/configparser.cc
+++ b/kdumptool/configparser.cc
@@ -99,7 +99,7 @@ void ShellConfigParser::parse()
     ByteVector shellInputBytes = Stringutil::str2bytes(shell);
     ByteVector shellOutputBytes;
 
-    Process p;
+    ProcessFilter p;
     p.setStdinBuffer(&shellInputBytes);
     p.setStdoutBuffer(&shellOutputBytes);
     p.execute("/bin/sh", StringVector());
--- a/kdumptool/fileutil.cc
+++ b/kdumptool/fileutil.cc
@@ -305,7 +305,7 @@ void FileUtil::mount(const std::string &
     args.push_back(device);
     args.push_back(mountpoint);
 
-    Process p;
+    ProcessFilter p;
     ByteVector stderrBuffer;
     p.setStderrBuffer(&stderrBuffer);
 
@@ -326,7 +326,7 @@ void FileUtil::umount(const std::string
 
     Debug::debug()->trace("FileUtil::umount(%s)", mountpoint.c_str());
 
-    Process p;
+    ProcessFilter p;
     ByteVector stderrBuffer;
     p.setStderrBuffer(&stderrBuffer);
 
--- a/kdumptool/process.cc
+++ b/kdumptool/process.cc
@@ -36,40 +36,40 @@ using std::min;
 using std::max;
 
 // -----------------------------------------------------------------------------
-Process::Process()
+ProcessFilter::ProcessFilter()
     throw ()
     : m_stdinBuffer(NULL), m_stdoutBuffer(NULL), m_stderrBuffer(NULL)
 {}
 
 // -----------------------------------------------------------------------------
-void Process::setStdinBuffer(ByteVector *buffer)
+void ProcessFilter::setStdinBuffer(ByteVector *buffer)
     throw ()
 {
     m_stdinBuffer = buffer;
 }
 
 // -----------------------------------------------------------------------------
-void Process::setStdoutBuffer(ByteVector *buffer)
+void ProcessFilter::setStdoutBuffer(ByteVector *buffer)
     throw ()
 {
     m_stdoutBuffer = buffer;
 }
 
 // -----------------------------------------------------------------------------
-void Process::setStderrBuffer(ByteVector *buffer)
+void ProcessFilter::setStderrBuffer(ByteVector *buffer)
     throw ()
 {
     m_stderrBuffer = buffer;
 }
 
 // -----------------------------------------------------------------------------
-uint8_t Process::execute(const string &name, const StringVector &args)
+uint8_t ProcessFilter::execute(const string &name, const StringVector &args)
     throw (KError)
 {
     pid_t child;
     int status = 0;
 
-    Debug::debug()->trace("Process::execute(%s, %s)",
+    Debug::debug()->trace("ProcessFilter::execute(%s, %s)",
         name.c_str(), Stringutil::vector2string(args, ":").c_str());
 
     //
@@ -230,7 +230,7 @@ uint8_t Process::execute(const string &n
                     // check if the process is still running
                     ret = waitpid(child, &status, 0);
                     if (ret != child) {
-                        throw KSystemError("Process::execute() waits for "
+                        throw KSystemError("ProcessFilter::execute() waits for "
                         + Stringutil::number2string(child) + " but "
                         + Stringutil::number2string(ret) + " exited.", errno);
                     }
@@ -241,7 +241,7 @@ uint8_t Process::execute(const string &n
         } else {
             ret = waitpid(child, &status, 0);
             if (ret != child) {
-                throw KSystemError("Process::execute() waits for "
+                throw KSystemError("ProcessFilter::execute() waits for "
                     + Stringutil::number2string(child) + " but "
                     + Stringutil::number2string(ret) + " exited.", errno);
             }
@@ -270,7 +270,7 @@ uint8_t Process::execute(const string &n
 
     } else { // error in fork()
         closeFds();
-        throw KSystemError("fork() failed in Process::execute", errno);
+        throw KSystemError("fork() failed in ProcessFilter::execute", errno);
     }
 
     closeFds();
@@ -279,14 +279,14 @@ uint8_t Process::execute(const string &n
 }
 
 // -----------------------------------------------------------------------------
-void Process::closeFds()
+void ProcessFilter::closeFds()
     throw ()
 {
-    Debug::debug()->trace("Process::closeFds()");
+    Debug::debug()->trace("ProcessFilter::closeFds()");
 }
 
 // -----------------------------------------------------------------------------
-void Process::executeProcess(const string &name, const StringVector &args)
+void ProcessFilter::executeProcess(const string &name, const StringVector &args)
     throw (KError)
 {
     StringVector fullV = args;
--- a/kdumptool/process.h
+++ b/kdumptool/process.h
@@ -25,25 +25,25 @@
 #include "optionparser.h"
 #include "subcommand.h"
 
-//{{{ Process ------------------------------------------------------------------
+//{{{ ProcessFilter ------------------------------------------------------------
 
 /**
- * Simple to use process API.
+ * Simple to use API to process-based filters.
  */
-class Process {
+class ProcessFilter {
 
     public:
 
         /**
-         * Creates a new process.
+         * Creates a new process filter.
          */
-        Process()
+        ProcessFilter()
         throw ();
 
         /**
          * Desctructor.
          */
-        virtual ~Process () {}
+        virtual ~ProcessFilter () {}
 
         /**
          * Executes a process.
@@ -61,8 +61,8 @@ class Process {
 
         /**
          * Sets the buffer where the bytes from stdin are read from to
-         * @p buffer. This function overwrites the Process::setStdinFd()
-         * and Process::setStdinFile().
+         * @p buffer. This function overwrites the ProcessFilter::setStdinFd()
+         * and ProcessFilter::setStdinFile().
          *
          * @param[in] buffer a byte vector
          */
@@ -71,8 +71,8 @@ class Process {
 
         /**
          * Sets the buffer where the bytes from stdout are written to.
-         * This function overwrites the Process::setStdoutFd() and
-         * Process::setStdoutFile().
+         * This function overwrites the ProcessFilter::setStdoutFd() and
+         * ProcessFilter::setStdoutFile().
          *
          * @param[in] buffer a byte vector
          */
@@ -81,8 +81,8 @@ class Process {
 
         /**
          * Sets the buffer where the bytes from stdout are written to.
-         * This function overwrites the Process::setStderrFd() and
-         * Process::setStderrFile().
+         * This function overwrites the ProcessFilter::setStderrFd() and
+         * ProcessFilter::setStderrFile().
          *
          * @param[in] buffer a byte vector
          */
--- a/kdumptool/testio.cc
+++ b/kdumptool/testio.cc
@@ -58,7 +58,7 @@ int main(int argc, char *argv[])
 
         Debug::debug()->info("1st test: %s -> %s",
             testdata.c_str(), output1.c_str());
-        Process p;
+        ProcessFilter p;
 
         ByteVector stdoutV;
         p.setStdinFile(testdata.c_str());
@@ -72,7 +72,7 @@ int main(int argc, char *argv[])
         Debug::debug()->info("1st test: %s -> %s",
             testdata.c_str(), output2.c_str());
 
-        Process p2;
+        ProcessFilter p2;
         ifstream fin(testdata.c_str());
         string s;
         if (!fin)
