Implement createWithFFDCFiles

This commit adds support for the createWithFFDCFiles D-Bus method.  This
method creates a new OpenBMC event log, just like create() does, but it
also adds a new parameter to pass through information about files
containing FFDC (First Failure Data Capture) to any extensions.  This
FFDC may be stored by the extensions code to provide additional debug
information about an error.

The FFDC parameter is a vector of tuples.  Each tuple contains:
* Format Type - An enumeration describing the format of the data
* Subtype - If the format type is custom, then this can be used
            to provide a format type that is specific to the
            creator.
* Version - If the format type is custom, then this can be used
            to provide the version of the custom data.
* FD      - A file descriptor to the file containing the FFDC.
            This does not need to be closed (an attempt will fail)
            by phosphor-log-manager.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I3e8e03d6393dfc145e9fd11bd078595868bb3767
diff --git a/log_manager.cpp b/log_manager.cpp
index 569413a..bdb2e2e 100644
--- a/log_manager.cpp
+++ b/log_manager.cpp
@@ -185,7 +185,8 @@
 }
 
 void Manager::createEntry(std::string errMsg, Entry::Level errLvl,
-                          std::vector<std::string> additionalData)
+                          std::vector<std::string> additionalData,
+                          const FFDCEntries& ffdc)
 {
     if (!Extensions::disableDefaultLogCaps())
     {
@@ -229,12 +230,14 @@
                                      std::move(objects), fwVersion, *this);
     serialize(*e);
 
-    doExtensionLogCreate(*e);
+    doExtensionLogCreate(*e, ffdc);
+
+    // Note: No need to close the file descriptors in the FFDC.
 
     entries.insert(std::make_pair(entryId, std::move(e)));
 }
 
-void Manager::doExtensionLogCreate(const Entry& entry)
+void Manager::doExtensionLogCreate(const Entry& entry, const FFDCEntries& ffdc)
 {
     // Make the association <endpointpath>/<endpointtype> paths
     std::vector<std::string> assocs;
@@ -251,7 +254,7 @@
         try
         {
             create(entry.message(), entry.id(), entry.timestamp(),
-                   entry.severity(), entry.additionalData(), assocs);
+                   entry.severity(), entry.additionalData(), assocs, ffdc);
         }
         catch (std::exception& e)
         {
@@ -583,6 +586,18 @@
     createEntry(message, severity, ad);
 }
 
+void Manager::createWithFFDC(
+    const std::string& message, Entry::Level severity,
+    const std::map<std::string, std::string>& additionalData,
+    const FFDCEntries& ffdc)
+{
+    // Convert the map into a vector of "key=value" strings
+    std::vector<std::string> ad;
+    metadata::associations::combine(additionalData, ad);
+
+    createEntry(message, severity, ad, ffdc);
+}
+
 } // namespace internal
 } // namespace logging
 } // namespace phosphor