History log of /openbmc/dbus-sensors/src/FileHandle.cpp (Results 1 – 7 of 7)
Revision Date Author Comments
# 2aaf7175 16-Aug-2024 Patrick Williams <patrick@stwcx.xyz>

clang-format: re-format for clang-18

clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda forma

clang-format: re-format for clang-18

clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.

See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.

Change-Id: Ib7af6345a7b9e858700bd81645fe87d9d7e9d0fb
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...


# eacbfdd1 04-Apr-2024 Ed Tanous <ed@tanous.net>

Enable misc-include-cleaner

Change-Id: I22099a0f95b2eb884dec7d95cee0bdd0c159fd1f
Signed-off-by: Ed Tanous <ed@tanous.net>


# 779c96a2 10-May-2023 Patrick Williams <patrick@stwcx.xyz>

clang-format: copy latest and re-format

clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest

clang-format: copy latest and re-format

clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.

Change-Id: I0d10afa582342818b9d90b168f6f39f71ce4e0f4
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
[AJ: regenerate using .clang-format from openbmc/docs@f44abd66eca8]
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>

show more ...


# e73bd0a1 24-Jan-2023 Andrew Jeffery <andrew@aj.id.au>

sensors: Align source structure away from anti-patterns

The anti-patterns document comments on source structure, specifically
on placing internal headers in a parallel subtree[1]. dbus-sensors is an

sensors: Align source structure away from anti-patterns

The anti-patterns document comments on source structure, specifically
on placing internal headers in a parallel subtree[1]. dbus-sensors is an
example of violating this anti-pattern, so fix it.

[1]: https://github.com/openbmc/docs/blob/master/anti-patterns.md#placing-internal-headers-in-a-parallel-subtree

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I50ecaddd53fa9c9b7a0441af9de5e60bd94e47c6

show more ...


# e330c0c1 06-Sep-2022 Hao Jiang <jianghao@google.com>

FileHandle: only close on valid fd

When fd < 0, we didn't open the fd given the fd is invalid. So we won't
need to close the fd as well. The current implement prints false alarm
on move constructer/

FileHandle: only close on valid fd

When fd < 0, we didn't open the fd given the fd is invalid. So we won't
need to close the fd as well. The current implement prints false alarm
on move constructer/assignment.

Signed-off-by: Hao Jiang <jianghao@google.com>
Change-Id: Ib6e0227fd1ba865ca037e8e5f8d1fc0dcc304185

show more ...


# 2049bd26 09-Jul-2022 Ed Tanous <edtanous@google.com>

Clang-tidy-14 fixes

Do as the robot commands. All changes made automatically by tidy.

Tested: (Thanks Zhikui)
Downloaded and run on system. Sensors scan normally.

Signed-off-by: Ed Tanous <edtan

Clang-tidy-14 fixes

Do as the robot commands. All changes made automatically by tidy.

Tested: (Thanks Zhikui)
Downloaded and run on system. Sensors scan normally.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I752f37c9e7a95aa3be8e6980ba6e4b2b48b3395a

show more ...


# 73030639 14-Jan-2022 Ed Tanous <edtanous@google.com>

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 commi

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

show more ...