Cap the number of dumps

Calculate number of dumps allowed in a system based on
individual dump Max size configured in the system.

Algorithm: Setting Dump size to maximum size,
if (dump entries + active dumps) is less than total allowed dump entries.
Otherwise return error.

Next patch will provide additional algorithm to cap the
dump based on actual size of the dump files.

Change-Id: Id8916a31d72f5c2f2f23eaf68062b829b7e4100c
Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
diff --git a/dump_manager.hpp b/dump_manager.hpp
index 8318f37..9856f1e 100644
--- a/dump_manager.hpp
+++ b/dump_manager.hpp
@@ -64,6 +64,7 @@
             bus(bus),
             eventLoop(event.get()),
             lastEntryId(0),
+            activeDumpCount(0),
             dumpWatch(eventLoop,
                   IN_NONBLOCK,
                   IN_CLOSE_WRITE | IN_CREATE,
@@ -136,6 +137,14 @@
           */
         void removeWatch(const fs::path& path);
 
+        /** @brief Calculate per dump allowed size based on number of
+          *        existing dumps and total dump size. Returns
+          *        allowed size for a dump in kilo bytes.
+          *  @returns 0 indicates no space is available in dump location
+          *           non zero value indicates size of one dump.
+          */
+        size_t getAllowedSize();
+
         /** @brief sdbusplus DBus bus connection. */
         sdbusplus::bus::bus& bus;
 
@@ -148,6 +157,9 @@
         /** @brief Id of the last Dump entry */
         uint32_t lastEntryId;
 
+        /** @brief active dump count */
+        uint32_t activeDumpCount;
+
         /** @brief Dump main watch object */
         Watch dumpWatch;