utility: Clang format updates
Used `format-code.sh` build script to make changes to conform to clang
format.
Tested: Compiled
Change-Id: I8c300579c9c631f30cf4b789bb12b1f67b8ab7f4
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/utility.hpp b/utility.hpp
index 168bd57..7db9047 100644
--- a/utility.hpp
+++ b/utility.hpp
@@ -1,17 +1,17 @@
#pragma once
-#include <sdbusplus/bus.hpp>
-#include <unistd.h>
#include <fcntl.h>
-#include <phosphor-logging/log.hpp>
-#include <phosphor-logging/elog.hpp>
+#include <unistd.h>
+
#include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/log.hpp>
+#include <sdbusplus/bus.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
-
using namespace phosphor::logging;
-using InternalFailure = sdbusplus::xyz::openbmc_project::Common::
- Error::InternalFailure;
+using InternalFailure =
+ sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
namespace phosphor
{
@@ -33,50 +33,47 @@
class FileDescriptor
{
- public:
- FileDescriptor() = delete;
- FileDescriptor(const FileDescriptor&) = delete;
- FileDescriptor(FileDescriptor&&) = default;
- FileDescriptor& operator=(const FileDescriptor&) = delete;
- FileDescriptor& operator=(FileDescriptor&&) = default;
+ public:
+ FileDescriptor() = delete;
+ FileDescriptor(const FileDescriptor&) = delete;
+ FileDescriptor(FileDescriptor&&) = default;
+ FileDescriptor& operator=(const FileDescriptor&) = delete;
+ FileDescriptor& operator=(FileDescriptor&&) = default;
- FileDescriptor(int fd) : fd(fd)
+ FileDescriptor(int fd) : fd(fd)
+ {}
+
+ ~FileDescriptor()
+ {
+ if (fd != -1)
{
+ close(fd);
}
+ }
- ~FileDescriptor()
+ int operator()()
+ {
+ return fd;
+ }
+
+ void open(const std::string& pathname, int flags)
+ {
+ fd = ::open(pathname.c_str(), flags);
+ if (-1 == fd)
{
- if (fd != -1)
- {
- close(fd);
- }
+ log<level::ERR>("Failed to open file device: ",
+ entry("PATHNAME=%s", pathname.c_str()));
+ elog<InternalFailure>();
}
+ }
- int operator()()
- {
- return fd;
- }
+ bool is_open()
+ {
+ return fd != -1;
+ }
- void open(const std::string& pathname, int flags)
- {
- fd = ::open(pathname.c_str(), flags);
- if (-1 == fd)
- {
- log<level::ERR>(
- "Failed to open file device: ",
- entry("PATHNAME=%s", pathname.c_str()));
- elog<InternalFailure>();
- }
- }
-
- bool is_open()
- {
- return fd != -1;
- }
-
- private:
- int fd = -1;
-
+ private:
+ int fd = -1;
};
/**
@@ -90,10 +87,8 @@
* @return - The full object path containing the property value
*/
template <typename T>
-auto getObjMap(const std::string& path,
- const std::string& intf,
- const std::string& prop,
- const T& value)
+auto getObjMap(const std::string& path, const std::string& intf,
+ const std::string& prop, const T& value)
{
using Property = std::string;
using Value = std::variant<T>;
@@ -116,6 +111,6 @@
return objectMap;
}
-}
-}
-}
+} // namespace util
+} // namespace fan
+} // namespace phosphor