diff options
author | Adriana Kobylak <anoo@us.ibm.com> | 2018-02-27 15:36:59 -0600 |
---|---|---|
committer | Adriana Kobylak <anoo@us.ibm.com> | 2018-03-02 09:51:17 -0600 |
commit | 2285fe0fc6a6bba7c587bec0a1f733b333dc2650 (patch) | |
tree | 66a38d166d39d50a5f635a18fe3a69ed29cbf909 /watch.cpp | |
parent | 83cd21fbab1a59f57c4a8752406478a0127bde21 (diff) | |
download | phosphor-bmc-code-mgmt-2285fe0fc6a6bba7c587bec0a1f733b333dc2650.tar.gz phosphor-bmc-code-mgmt-2285fe0fc6a6bba7c587bec0a1f733b333dc2650.zip |
Enable clang code format
Change-Id: Ia899858c11cff6e4fa26b820b35b1e5dca1b57df
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
Diffstat (limited to 'watch.cpp')
-rw-r--r-- | watch.cpp | 33 |
1 files changed, 12 insertions, 21 deletions
@@ -21,9 +21,8 @@ using namespace phosphor::logging; using namespace std::string_literals; namespace fs = std::experimental::filesystem; -Watch::Watch(sd_event* loop, - std::function<int(std::string&)> imageCallback) : imageCallback( - imageCallback) +Watch::Watch(sd_event* loop, std::function<int(std::string&)> imageCallback) : + imageCallback(imageCallback) { // Check if IMAGE DIR exists. fs::path imgDirPath(IMG_UPLOAD_DIR); @@ -38,8 +37,8 @@ Watch::Watch(sd_event* loop, // Store a copy of errno, because the string creation below will // invalidate errno due to one more system calls. auto error = errno; - throw std::runtime_error( - "inotify_init1 failed, errno="s + std::strerror(error)); + throw std::runtime_error("inotify_init1 failed, errno="s + + std::strerror(error)); } wd = inotify_add_watch(fd, IMG_UPLOAD_DIR, IN_CLOSE_WRITE); @@ -47,20 +46,15 @@ Watch::Watch(sd_event* loop, { auto error = errno; close(fd); - throw std::runtime_error( - "inotify_add_watch failed, errno="s + std::strerror(error)); + throw std::runtime_error("inotify_add_watch failed, errno="s + + std::strerror(error)); } - auto rc = sd_event_add_io(loop, - nullptr, - fd, - EPOLLIN, - callback, - this); + auto rc = sd_event_add_io(loop, nullptr, fd, EPOLLIN, callback, this); if (0 > rc) { - throw std::runtime_error( - "failed to add to event loop, rc="s + std::strerror(-rc)); + throw std::runtime_error("failed to add to event loop, rc="s + + std::strerror(-rc)); } } @@ -73,9 +67,7 @@ Watch::~Watch() } } -int Watch::callback(sd_event_source* s, - int fd, - uint32_t revents, +int Watch::callback(sd_event_source* s, int fd, uint32_t revents, void* userdata) { if (!(revents & EPOLLIN)) @@ -89,8 +81,8 @@ int Watch::callback(sd_event_source* s, if (0 > bytes) { auto error = errno; - throw std::runtime_error( - "failed to read inotify event, errno="s + std::strerror(error)); + throw std::runtime_error("failed to read inotify event, errno="s + + std::strerror(error)); } auto offset = 0; @@ -106,7 +98,6 @@ int Watch::callback(sd_event_source* s, log<level::ERR>("Error processing image", entry("IMAGE=%s", tarballPath.c_str())); } - } offset += offsetof(inotify_event, name) + event->len; |