Initialize first byte in IPMI cache file

In the IPMI cache file, the first byte of this file was always
essentially random, because it was in a structure that had this field
uninitialized. Fixing it, by arbitrarily choosing the value 0x01.

Added a new constant "mdrDirVersion" for this, and also added a similar
constant for "smbiosDirVersion" (which was being initialized, but to a
magic number directly in the code, not a constant).

Tested: Cache files now appear consistently.

Change-Id: I1f13ae973965b1a7105e2ac054ae30c52f45e2a9
Signed-off-by: Josh Lehan <krellan@google.com>
diff --git a/include/mdrv2.hpp b/include/mdrv2.hpp
index 65890ed..c2cf038 100644
--- a/include/mdrv2.hpp
+++ b/include/mdrv2.hpp
@@ -79,7 +79,7 @@
                                  smbiosPath, smbiosInterfaceName))
     {
         smbiosDir.agentVersion = smbiosAgentVersion;
-        smbiosDir.dirVersion = 1;
+        smbiosDir.dirVersion = smbiosDirVersion;
         smbiosDir.dirEntries = 1;
         directoryEntries(smbiosDir.dirEntries);
         smbiosDir.status = 1;
diff --git a/include/smbios_mdrv2.hpp b/include/smbios_mdrv2.hpp
index 0b4638a..e77abf4 100644
--- a/include/smbios_mdrv2.hpp
+++ b/include/smbios_mdrv2.hpp
@@ -32,10 +32,12 @@
 constexpr uint32_t mdr2SMSize = 0x00100000;
 constexpr uint32_t mdr2SMBaseAddress = 0x9FF00000;
 
+constexpr uint8_t mdrDirVersion = 1;
 constexpr uint8_t mdrTypeII = 2;
 
 constexpr uint8_t mdr2Version = 2;
 constexpr uint8_t smbiosAgentVersion = 1;
+constexpr uint8_t smbiosDirVersion = 1;
 
 constexpr uint32_t pageMask = 0xf000;
 constexpr int smbiosDirIndex = 0;
diff --git a/src/smbios-ipmi-blobs/handler.cpp b/src/smbios-ipmi-blobs/handler.cpp
index 4b1841f..3763762 100644
--- a/src/smbios-ipmi-blobs/handler.cpp
+++ b/src/smbios-ipmi-blobs/handler.cpp
@@ -192,6 +192,7 @@
     blobPtr->state &= ~blobs::StateFlags::commit_error;
 
     MDRSMBIOSHeader mdrHdr;
+    mdrHdr.dirVer = mdrDirVersion;
     mdrHdr.mdrType = mdrTypeII;
     mdrHdr.timestamp = std::time(nullptr);
     mdrHdr.dataSize = blobPtr->buffer.size();