commit | 73030639a5ba8adfc9d8e54ef66746c95e8958a7 | [log] [tgz] |
---|---|---|
author | Ed Tanous <edtanous@google.com> | Fri Jan 14 10:09:47 2022 -0800 |
committer | Vernon Mauery <vernon.mauery@linux.intel.com> | Tue Feb 15 05:41:07 2022 +0000 |
tree | c0cc1e25977e015ea04b798bdc45420590d61483 | |
parent | 8d0fd3c3d4b5ff93ba4c251301285c320cc7ca97 [diff] |
Enable cppcoreguidelines-avoid-goto checks We've been pretty good about this one, the only usages seem to be in nvme sensor and added recently. To move to more RAII compliant containers, this commit creates a FileHandle class, which accepts either a file path and a mode, or a direct file handle, to be handled via RAII. Ideally we wouldn't have to create this ourselves, and could rely on some library, but the alternatives all have compromises that are worse. boost::asio::random_access_file requires iouring to be enabled, and isn't available until boost 0.78, which we haven't rebased to yet. https://www.boost.org/doc/libs/develop/doc/html/boost_asio/reference/random_access_file.html Once available, this is what I would hope that a bunch of the nvme stuff evolves into to be much simpler. boost::iostream::file_descriptor requires linking against boost::iostream, which would bloat our binary size for a lot of things we don't use. There is a file_descriptor.cpp that we could compile directly to solve this, but the existing yocto boost project (nor any other distro project) installs these files for use, which would complicate this solution std::fstream doesn't allow direct access to the file handle, which would be required for streaming operations. https://www.boost.org/doc/libs/1_35_0/libs/iostreams/doc/installation.html https://www.boost.org/doc/libs/1_78_0/libs/iostreams/doc/classes/file_descriptor.html#file_descriptor A very similar class exists within ipmid here: https://github.com/openbmc/phosphor-host-ipmid/blob/master/user_channel/file.hpp This class differs in a couple minor ways, in that it throws exceptions on open failures (similar to the boost classes), accepts the input by std::filesystem::path, instead of string, and supports std::move, which is required for the pipe usage. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8be2419783e41e8f529030bb3d05c2e7aa890307
dbus-sensors is a collection of sensor applications that provide the xyz.openbmc_project.Sensor collection of interfaces. They read sensor values from hwmon, d-bus, or direct driver access to provide readings. Some advance non-sensor features such as fan presence, pwm control, and automatic cpu detection (x86) are also supported.
runtime re-configurable from d-bus (entity-manager or the like)
isolated: each sensor type is isolated into its own daemon, so a bug in one sensor is unlikely to affect another, and single sensor modifications are possible
async single-threaded: uses sdbusplus/asio bindings
multiple data inputs: hwmon, d-bus, direct driver access