Have the Target class manage the file descriptor

The sysfs file descriptor will now stay open from first
use until the Target class is destroyed.

Change-Id: Ib9803a527115cc75ecc9a5351d1e748ccd54a993
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/targeting.hpp b/targeting.hpp
index 92c224e..463ccc5 100644
--- a/targeting.hpp
+++ b/targeting.hpp
@@ -2,6 +2,7 @@
 
 #include <memory>
 #include <vector>
+#include "filedescriptor.hpp"
 
 namespace openpower
 {
@@ -28,7 +29,7 @@
          * @param[in] - The sysfs device path
          */
         Target(size_t position, const std::string& devPath) :
-            pos(position), path(devPath)
+            pos(position), cfamPath(devPath)
         {
         }
 
@@ -47,13 +48,19 @@
         }
 
         /**
-         * Returns the path
+         * Returns the CFAM sysfs path
          */
-        inline auto getPath() const
+        inline auto getCFAMPath() const
         {
-            return path;
+            return cfamPath;
         }
 
+        /**
+         * Returns the file descriptor to use
+         * for read/writeCFAM operations.
+         */
+        int getCFAMFD();
+
     private:
 
         /**
@@ -62,9 +69,14 @@
         size_t pos;
 
         /**
-         * The sysfs device path
+         * The sysfs device path for the CFAM
          */
-        const std::string path;
+        const std::string cfamPath;
+
+        /**
+         * The file descriptor to use for read/writeCFAMReg
+         */
+        std::unique_ptr<openpower::util::FileDescriptor> cfamFD;
 };