summaryrefslogtreecommitdiffstats
path: root/watch.hpp
diff options
context:
space:
mode:
authorJayanth Othayoth <ojayanth@in.ibm.com>2018-10-16 08:29:32 -0500
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-10-18 16:33:14 -0400
commitcb65ffce0f0496c603cba6d6e12b20d66372cb9a (patch)
treeea178b2585004b8b00a1006ec1b2f5adffc99ca1 /watch.hpp
parentae871bd0661c472a0c3ad231fc3623535bcfba2d (diff)
downloadphosphor-debug-collector-cb65ffce0f0496c603cba6d6e12b20d66372cb9a.tar.gz
phosphor-debug-collector-cb65ffce0f0496c603cba6d6e12b20d66372cb9a.zip
Enable clang code format
Change-Id: Ib640ef7cea99ff505965182ec9900a2d53a8986e Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com> Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'watch.hpp')
-rw-r--r--watch.hpp139
1 files changed, 67 insertions, 72 deletions
diff --git a/watch.hpp b/watch.hpp
index da1ffad..5452b20 100644
--- a/watch.hpp
+++ b/watch.hpp
@@ -1,13 +1,14 @@
#pragma once
+#include "dump_utils.hpp"
+
+#include <sys/inotify.h>
+#include <systemd/sd-event.h>
+
#include <experimental/filesystem>
#include <functional>
-#include <systemd/sd-event.h>
-#include <sys/inotify.h>
#include <map>
-#include "dump_utils.hpp"
-
namespace phosphor
{
namespace dump
@@ -17,10 +18,10 @@ namespace inotify
namespace fs = std::experimental::filesystem;
-//User specific call back function input map(path:event) type.
+// User specific call back function input map(path:event) type.
using UserMap = std::map<fs::path, uint32_t>;
-//User specific callback function wrapper type.
+// User specific callback function wrapper type.
using UserType = std::function<void(const UserMap&)>;
/** @class Watch
@@ -33,72 +34,66 @@ using UserType = std::function<void(const UserMap&)>;
*/
class Watch
{
- public:
- /** @brief ctor - hook inotify watch with sd-event
- *
- * @param[in] eventObj - Event loop object
- * @param[in] flags - inotify flags
- * @param[in] mask - Mask of events
- * @param[in] events - Events to be watched
- * @param[in] path - File path to be watched
- * @param[in] userFunc - User specific callback fnction wrapper.
- *
- */
- Watch(const EventPtr& eventObj,
- int flags,
- uint32_t mask,
- uint32_t events,
- const fs::path& path,
- UserType userFunc);
-
- Watch(const Watch&) = delete;
- Watch& operator=(const Watch&) = delete;
- Watch(Watch&&) = default;
- Watch& operator=(Watch&&) = default;
-
- /* @brief dtor - remove inotify watch and close fd's */
- ~Watch();
-
- private:
- /** @brief sd-event callback.
- * @details Collects the files and event info and call the
- * appropriate user function for further action.
- *
- * @param[in] s - event source, floating (unused) in our case
- * @param[in] fd - inotify fd
- * @param[in] revents - events that matched for fd
- * @param[in] userdata - pointer to Watch object
- *
- * @returns 0 on success, -1 on fail
- */
- static int callback(sd_event_source* s,
- int fd,
- uint32_t revents,
- void* userdata);
-
- /** initialize an inotify instance and returns file descriptor */
- int inotifyInit();
-
- /** @brief inotify flags */
- int flags;
-
- /** @brief Mask of events */
- uint32_t mask;
-
- /** @brief Events to be watched */
- uint32_t events;
-
- /** @brief File path to be watched */
- fs::path path;
-
- /** @brief dump file directory watch descriptor */
- int wd = -1;
-
- /** @brief file descriptor manager */
- CustomFd fd;
-
- /** @brief The user level callback function wrapper */
- UserType userFunc;
+ public:
+ /** @brief ctor - hook inotify watch with sd-event
+ *
+ * @param[in] eventObj - Event loop object
+ * @param[in] flags - inotify flags
+ * @param[in] mask - Mask of events
+ * @param[in] events - Events to be watched
+ * @param[in] path - File path to be watched
+ * @param[in] userFunc - User specific callback fnction wrapper.
+ *
+ */
+ Watch(const EventPtr& eventObj, int flags, uint32_t mask, uint32_t events,
+ const fs::path& path, UserType userFunc);
+
+ Watch(const Watch&) = delete;
+ Watch& operator=(const Watch&) = delete;
+ Watch(Watch&&) = default;
+ Watch& operator=(Watch&&) = default;
+
+ /* @brief dtor - remove inotify watch and close fd's */
+ ~Watch();
+
+ private:
+ /** @brief sd-event callback.
+ * @details Collects the files and event info and call the
+ * appropriate user function for further action.
+ *
+ * @param[in] s - event source, floating (unused) in our case
+ * @param[in] fd - inotify fd
+ * @param[in] revents - events that matched for fd
+ * @param[in] userdata - pointer to Watch object
+ *
+ * @returns 0 on success, -1 on fail
+ */
+ static int callback(sd_event_source* s, int fd, uint32_t revents,
+ void* userdata);
+
+ /** initialize an inotify instance and returns file descriptor */
+ int inotifyInit();
+
+ /** @brief inotify flags */
+ int flags;
+
+ /** @brief Mask of events */
+ uint32_t mask;
+
+ /** @brief Events to be watched */
+ uint32_t events;
+
+ /** @brief File path to be watched */
+ fs::path path;
+
+ /** @brief dump file directory watch descriptor */
+ int wd = -1;
+
+ /** @brief file descriptor manager */
+ CustomFd fd;
+
+ /** @brief The user level callback function wrapper */
+ UserType userFunc;
};
} // namespace inotify
OpenPOWER on IntegriCloud