#
d7857201
|
| 28-Jan-2025 |
Ed Tanous <etanous@nvidia.com> |
Fix includes
Clang-tidy misc-include-cleaner appears to now be enforcing significantly more headers than previously. That is overall a good thing, but forces us to fix some issues. This commit is
Fix includes
Clang-tidy misc-include-cleaner appears to now be enforcing significantly more headers than previously. That is overall a good thing, but forces us to fix some issues. This commit is largely just taking the clang-recommended fixes and checking them in. Subsequent patches will fix the more unique issues.
Note, that a number of new ignores are added into the .clang-tidy file. These can be cleaned up over time as they're understood. The majority are places where boost includes a impl/x.hpp and x.hpp, but expects you to use the later. include-cleaner opts for the impl, but it isn't clear why.
Change-Id: Id3fdd7ee6df6c33b2fd35626898523048dd51bfb Signed-off-by: Ed Tanous <etanous@nvidia.com> Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
show more ...
|
#
a93e9c77
|
| 18-Nov-2024 |
Ed Tanous <etanous@nvidia.com> |
Move time_utils to compile unit
There's no reason for these functions to be in a header, and pulling them into a compile unit can reduce compile times overall.
Tested: Unit tests pass (Good coverag
Move time_utils to compile unit
There's no reason for these functions to be in a header, and pulling them into a compile unit can reduce compile times overall.
Tested: Unit tests pass (Good coverage)
Change-Id: Ia6dc50d16bf2967e647a3c7437ba13bd7ab7ca3c Signed-off-by: Ed Tanous <etanous@nvidia.com>
show more ...
|
#
c069fca7
|
| 18-Nov-2024 |
Ed Tanous <etanous@nvidia.com> |
Move to std::chrono
gcc-14 finally has calendar support. Move the existing helper functions over to using it, and deprecate the old methods (which involved a lot of magic numbers). The old methods
Move to std::chrono
gcc-14 finally has calendar support. Move the existing helper functions over to using it, and deprecate the old methods (which involved a lot of magic numbers). The old methods are kept behind ifdefs for those still compiling against gcc-13 for the moment, but will be removed when we bump the requirements to gcc-14.
Unrelated to the cleanup, this also saves 2Kb on the compressed binary size, presumably due to relying on implementations in libc++ instead of in bmcweb.
Tested: Unit tests pass, good coverage.
Change-Id: I739a3e876e84150dc654b9dff5eb05261b1daaf5 Signed-off-by: Ed Tanous <etanous@nvidia.com>
show more ...
|
#
40e9b92e
|
| 10-Sep-2024 |
Ed Tanous <etanous@nvidia.com> |
Use SPDX identifiers
SPDX identifiers are simpler, and reduce the amount of cruft we have in code files. They are recommended by linux foundation, and therefore we should do as they allow.
This pa
Use SPDX identifiers
SPDX identifiers are simpler, and reduce the amount of cruft we have in code files. They are recommended by linux foundation, and therefore we should do as they allow.
This patchset does not intend to modify any intent on any existing copyrights or licenses, only to standardize their inclusion.
[1] https://www.linuxfoundation.org/blog/blog/copyright-notices-in-open-source-software-projects
Change-Id: I935c7c0156caa78fc368c929cebd0f068031e830 Signed-off-by: Ed Tanous <etanous@nvidia.com>
show more ...
|
#
41868c66
|
| 09-Oct-2024 |
Myung Bae <myungbae@us.ibm.com> |
Reformat with Never-AlignTrailingComments style
clang-format currently formats the codes to align the trailing comments of the consecutive lines via `AlignTrailingComments/Kind` as `Always` in `.cla
Reformat with Never-AlignTrailingComments style
clang-format currently formats the codes to align the trailing comments of the consecutive lines via `AlignTrailingComments/Kind` as `Always` in `.clang-format` file.
This could shift the comment lines by the neighboring code changes and also potentially mislead the `diff` of code changes.
This commit is to keep the existing trailing comments as they were.
Tested: - Check whitespace only - Code compiles & CI passes.
Change-Id: I1c64d53572a81d5012aa748fe44478f80c271c5f Signed-off-by: Myung Bae <myungbae@us.ibm.com>
show more ...
|
#
b5190062
|
| 10-Jul-2024 |
Hieu Huynh <hieuh@os.amperecomputing.com> |
Support ProductionDate report
DSP0268 Redfish Data Model Specification provides ProductionDate property for various schema. phosphor-dbus-interface [1] also supports BuildDate property which we can
Support ProductionDate report
DSP0268 Redfish Data Model Specification provides ProductionDate property for various schema. phosphor-dbus-interface [1] also supports BuildDate property which we can map from FRU data, like `Board Manufacturer Date`. This adds code to support which gets the date from BuildDate property and report via Redfish.
[1] https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Inventory/Decorator/Asset.interface.yaml#L16
Tested: Redfish Validator passes
Signed-off-by: Hieu Huynh <hieuh@os.amperecomputing.com> Change-Id: Ie4ae564fa00218e7896f04ec61941fa92b23b912
show more ...
|
#
478b7adf
|
| 15-Jul-2024 |
Ed Tanous <etanous@nvidia.com> |
Remove IWYU pragmas
These were added as part of d5c80ad9c07b94465d8ea62d2b6f87c30cac765e: test treewide: iwyu
Since then, Nan hasn't been very active on the project, and to my knowledge, since the
Remove IWYU pragmas
These were added as part of d5c80ad9c07b94465d8ea62d2b6f87c30cac765e: test treewide: iwyu
Since then, Nan hasn't been very active on the project, and to my knowledge, since the initial run, we've never used IWYU again.
clang-include-cleaner seems to work well without needing these pragmas, and is what we're using, even if it's less useful than IWYU.
Remove all mention of IWYU.
Tested: Code compiles.
Change-Id: I06feedeeac9a114f5bdec81d59ca83223efd8aa7 Signed-off-by: Ed Tanous <etanous@nvidia.com>
show more ...
|
#
f653730d
|
| 19-Jun-2024 |
Ed Tanous <ed@tanous.net> |
Clean up time utils
We have std::format and c++20 now, this code can be simplified.
Tested: Unit tests pass. Good coverage.
Change-Id: Idc466d0ace9128a72bcd098290010a6a19da8536 Signed-off-by: Ed
Clean up time utils
We have std::format and c++20 now, this code can be simplified.
Tested: Unit tests pass. Good coverage.
Change-Id: Idc466d0ace9128a72bcd098290010a6a19da8536 Signed-off-by: Ed Tanous <ed@tanous.net>
show more ...
|
#
c98dbc64
|
| 07-Apr-2024 |
Ed Tanous <ed@tanous.net> |
Remove logically dead code
Stage::T is never set, so it can never happen. Remove it entirely.
Found using static analysis.
Tested: Unit tests pass, good coverage here
Change-Id: I0dfb1aad5bef3ab
Remove logically dead code
Stage::T is never set, so it can never happen. Remove it entirely.
Found using static analysis.
Tested: Unit tests pass, good coverage here
Change-Id: I0dfb1aad5bef3ab4451df5e81794e56074f6e939 Signed-off-by: Ed Tanous <ed@tanous.net>
show more ...
|
#
c51afd54
|
| 07-Mar-2024 |
Ed Tanous <ed@tanous.net> |
Call systemd SetTime directly
Internally inside phosphor-time-manager, the elapsed(uint64) dbus call just forwards the request directly to systemd after static casting to int64_t (signed).
bmcweb s
Call systemd SetTime directly
Internally inside phosphor-time-manager, the elapsed(uint64) dbus call just forwards the request directly to systemd after static casting to int64_t (signed).
bmcweb should just call systemd directly, for several reasons.
phosphor-timesyncd might block on other calls, given it's a single threaded blocking design, due to bugs like #264. Calling systemd directly means that calls that don't require phosphor networkd won't be blocked.
Calling systemd directly allows bmcweb to drop some code that parses a date as int64_t, then converts it to uint64_t to fulfill the phosphor datetime interface. We can now keep int64_t all the way through.
Calling systemd directly allows bmcweb to give a more specific error code in the case there NTP is enabled, registering a PropertyValueConflict error, instead of a 500 InternalError.
Tested: Patching DateTime property with NTP enabled returns 400, PropertyValueConflict ``` curl -vvvv -k --user "root:0penBmc" -H "Content-Type: application/json" -X PATCH -d '{"DateTime":"2020-12-15T15:40:52+00:00"}' https://192.168.7.2/redfish/v1/Managers/bmc ```
Disabling NTP using the following command: ``` curl -vvvv -k --user "root:0penBmc" -H "Content-Type: application/json" -X PATCH -d '{"NTP":{"ProtocolEnabled":false}}' https://192.168.7.2/redfish/v1/Managers/bmc/NetworkProtocol ```
Allows the prior command to succeed.
[1] https://github.com/openbmc/phosphor-time-manager/blob/5ce9ac0e56440312997b25771507585905e8b360/bmc_epoch.cpp#L126
Change-Id: I6fbb6f63e17de8ab847ca5ed4eadc2bd313586d2 Signed-off-by: Ed Tanous <ed@tanous.net>
show more ...
|
#
8ece0e45
|
| 02-Jan-2024 |
Ed Tanous <ed@tanous.net> |
Fix spelling mistakes
These were found with: codespell -w $(git ls-files | grep "\.[hc]\(pp\)\?$")
At some point in the future, we might want to get this enabled in CI.
Change-Id: Iccb57b2adfd06a2
Fix spelling mistakes
These were found with: codespell -w $(git ls-files | grep "\.[hc]\(pp\)\?$")
At some point in the future, we might want to get this enabled in CI.
Change-Id: Iccb57b2adfd06a2e177e99db2923fe4e8e329118 Signed-off-by: Ed Tanous <ed@tanous.net>
show more ...
|
#
1b8b02a4
|
| 08-Jan-2023 |
Ed Tanous <edtanous@google.com> |
Simplify datetime parsing
This code as it stands pulls in the full datetime library from boost, including io, and a bunch of timezone code. The bmc doesn't make use of any of this, so we can rely o
Simplify datetime parsing
This code as it stands pulls in the full datetime library from boost, including io, and a bunch of timezone code. The bmc doesn't make use of any of this, so we can rely on a much simplified version.
Unfortunately for us, gcc still doesn't implement the c++20 std::chrono::parse[1]. There is a reference library available from [2] that backports the parse function to compilers that don't yet support it, and is the basis for the libc++ version. This commit opts to copy in the header as-written, under the assumption that we will never need to pull in new versions of this library, and will move to the std ersion as soon as it's available in the next gcc version.
This commit simplifies things down to improve compile times and binary size. It saves ~22KB of compressed binary size, or about 3%.
Tested: Unit tests pass. Pretty good coverage.
[1] https://en.cppreference.com/w/cpp/chrono/parse [2] https://github.com/HowardHinnant/date/blob/master/include/date/date.h
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I706b91cc3d9df3f32068125bc47ff0c374eb8d87
show more ...
|
#
62598e31
|
| 17-Jul-2023 |
Ed Tanous <ed@tanous.net> |
Replace logging with std::format
std::format is a much more modern logging solution, and gives us a lot more flexibility, and better compile times when doing logging.
Unfortunately, given its level
Replace logging with std::format
std::format is a much more modern logging solution, and gives us a lot more flexibility, and better compile times when doing logging.
Unfortunately, given its level of compile time checks, it needs to be a method, instead of the stream style logging we had before. This requires a pretty substantial change. Fortunately, this change can be largely automated, via the script included in this commit under scripts/replace_logs.py. This is to aid people in moving their patchsets over to the new form in the short period where old patches will be based on the old logging. The intention is that this script eventually goes away.
The old style logging (stream based) looked like.
BMCWEB_LOG_DEBUG << "Foo " << foo;
The new equivalent of the above would be: BMCWEB_LOG_DEBUG("Foo {}", foo);
In the course of doing this, this also cleans up several ignored linter errors, including macro usage, and array to pointer deconstruction.
Note, This patchset does remove the timestamp from the log message. In practice, this was duplicated between journald and bmcweb, and there's no need for both to exist.
One design decision of note is the addition of logPtr. Because the compiler can't disambiguate between const char* and const MyThing*, it's necessary to add an explicit cast to void*. This is identical to how fmt handled it.
Tested: compiled with logging meson_option enabled, and launched bmcweb
Saw the usual logging, similar to what was present before: ``` [Error include/webassets.hpp:60] Unable to find or open /usr/share/www/ static file hosting disabled [Debug include/persistent_data.hpp:133] Restored Session Timeout: 1800 [Debug redfish-core/include/event_service_manager.hpp:671] Old eventService config not exist [Info src/webserver_main.cpp:59] Starting webserver on port 18080 [Error redfish-core/include/event_service_manager.hpp:1301] inotify_add_watch failed for redfish log file. [Info src/webserver_main.cpp:137] Start Hostname Monitor Service... ``` Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: I86a46aa2454be7fe80df608cb7e5573ca4029ec8
show more ...
|
#
1249e9cb
|
| 21-Feb-2023 |
Ed Tanous <edtanous@google.com> |
Simplify duration string parsing
The code that was here was quite complex, and relied on a number of c++ features that were hard to track. It also implemented a parser that would parse a given numb
Simplify duration string parsing
The code that was here was quite complex, and relied on a number of c++ features that were hard to track. It also implemented a parser that would parse a given number multiple times.
This commit replaces fromDurationString with a single pass, simpler parser, that doesn't rely on templates. It does this with a basic state machine, like one would see in any number of places.
This allows the details section to be completely removed, as it can now be simply inlined. This results in a decrease of 1.1KB of the binary size of bmcweb.
Note, C++20 now has an implementation of std::chrono::days, which obsoletes the need for redfish::time_utils::details::Days, so that conversion is done opportunistically.
Tested: Unit tests pass. Pretty good coverage here.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8eb9bee9807cc102f3680105b39f4eed3bd2e73c
show more ...
|
#
97c920c5
|
| 10-May-2023 |
Patrick Williams <patrick@stwcx.xyz> |
time-utils: fix clang-tidy warning
The code already does size checking to ensure that buffer overruns are not done, so switch to using operator[] rather than pointer arithmetic.
``` ../redfish-core
time-utils: fix clang-tidy warning
The code already does size checking to ensure that buffer overruns are not done, so switch to using operator[] rather than pointer arithmetic.
``` ../redfish-core/include/utils/time_utils.hpp:71:19: error: unsafe pointer arithmetic [-Werror,-Wunsafe-buffer-usage] end = fmt.data() + pos; ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Iaabe82d7c1621dc27ad10288732609dfd0516d17
show more ...
|
#
89492a15
|
| 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: I75f89d2959b0f1338c20d72ad669fbdc1d720835 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
#
c2e32007
|
| 08-Jan-2023 |
Ed Tanous <edtanous@google.com> |
Break out set time function and unit test it
This function is something that's easily unit tested. Do it.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8d664c77ec4b3a9886128597449c5f9
Break out set time function and unit test it
This function is something that's easily unit tested. Do it.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8d664c77ec4b3a9886128597449c5f9c041b86b3
show more ...
|
#
7be4c8ad
|
| 03-Aug-2022 |
Ed Tanous <edtanous@google.com> |
Deduplicate leftZeroPadding
We have two functions, leftZeroPadding, and padZeros that effectively do the same thing. leftZeroPadding has only one usage, and padZeros is debatably more efficient (gi
Deduplicate leftZeroPadding
We have two functions, leftZeroPadding, and padZeros that effectively do the same thing. leftZeroPadding has only one usage, and padZeros is debatably more efficient (given it doesn't need to construct an intermediate string). Move the one usage of leftZeroPadding to padZeros, and remove leftZeroPadding.
One minor change needs to be made to padZeros, in that it needs to accept a long int instead of an int, given that some implementations use long int as their duration object.
Tested: Unit tests pass. Good coverage on time functions.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Icbec45787ff940d098e18b61741b7476f4263558
show more ...
|
#
2b82937e
|
| 03-Aug-2022 |
Ed Tanous <edtanous@google.com> |
Move time utils to be in one place
We've accumulated several time utility functions in the http classes. Time isn't a core HTTP primitive, so http is not where those functions below.
This commit mo
Move time utils to be in one place
We've accumulated several time utility functions in the http classes. Time isn't a core HTTP primitive, so http is not where those functions below.
This commit moves all the time functions from the crow::utility namespace into the redfish::time_utils namespace, as well as moves the unit tests.
No code changes where made to the individual functions, with the exception of changing the namespace on the unit tests.
Tested: Unit tests pass.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8493375f60aea31899c84ae703e0f71a17dbdb73
show more ...
|
#
d5c80ad9
|
| 10-Jul-2022 |
Nan Zhou <nanzhoumails@gmail.com> |
test treewide: iwyu
These changes are done by running iwyu manually under clang14.
Suppressed some obvious impl or details headers. Kept the recommended public headers.
IWYU can increase readabili
test treewide: iwyu
These changes are done by running iwyu manually under clang14.
Suppressed some obvious impl or details headers. Kept the recommended public headers.
IWYU can increase readability, make maintenance easier, and avoid errors in some cases. See details in https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/WhyIWYU.md.
This commit also uses its best effort to correct obvious errors through iwyu pragma. See reference here: https://github.com/include-what-you-use/include-what-you-use#how-to-correct-iwyu-mistakes
Tested: unit test passed.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I983b6f75601707cbb0f2f04546c3362ff4ba7fee
show more ...
|
#
9ea15c35
|
| 04-Jan-2022 |
Ed Tanous <edtanous@google.com> |
Include what you use
Do a partial update from the include what you use tool.
While ideally we'd be able to do this as part of CI, there's still quite a bit of noise in the output that requires manu
Include what you use
Do a partial update from the include what you use tool.
While ideally we'd be able to do this as part of CI, there's still quite a bit of noise in the output that requires manual intervention.
Tested: Code compiles
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Iaaeb7a9199f64b5d6913c3abab4779b252768ed8
show more ...
|
#
543f4400
|
| 06-Jan-2022 |
Ed Tanous <edtanous@google.com> |
Enable init checker
clang-tidy added cppcoreguidelines-init-variables as a check, which is something we already enforce to some extent, but getting CI to enforce it will help reviews move faster.
T
Enable init checker
clang-tidy added cppcoreguidelines-init-variables as a check, which is something we already enforce to some extent, but getting CI to enforce it will help reviews move faster.
Tested: Code compiles. Noop changes.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I7e10950de617b1d3262265572b1703f2e60b69d0
show more ...
|
#
6de264cc
|
| 06-Jan-2022 |
Ed Tanous <edtanous@google.com> |
Enable bugprone widening checks in clang
Most of the errors we hit are simply places we need to explicitly increase the width of the integer. Luckily, these are few and far between.
Tested: Code c
Enable bugprone widening checks in clang
Most of the errors we hit are simply places we need to explicitly increase the width of the integer. Luckily, these are few and far between.
Tested: Code compiles, unit tests pass.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I617d87f3970ae773e0767bb2f20118fca2e71daa
show more ...
|
#
1b7e696b
|
| 02-Aug-2021 |
Lukasz Kazmierczak <lukasz.kazmierczak@intel.com> |
Add GET method for Triggers
Added GET method for retrieving details of individual Trigger searched by given Trigger name, details are extracted from Telemetry service
Tested: - Added single Trigger
Add GET method for Triggers
Added GET method for retrieving details of individual Trigger searched by given Trigger name, details are extracted from Telemetry service
Tested: - Added single Trigger and requested result from bmcweb via /redfish/v1/TelemetryService/Triggers/<triggername> - Added multiple Triggers numeric and discrete with various parameters (empty, non-empty), and requested results from bmcweb via /redfish/v1/TelemetryService/Triggers/<triggername> - Verified uris /redfish/v1/TelemetryService/Triggers/<triggername> by using Redfish-Service-Validator (all passed)
Signed-off-by: Lukasz Kazmierczak <lukasz.kazmierczak@intel.com> Change-Id: I1c966b2f792324cc6f6a8784ad18a683e5ce7bd9
show more ...
|
#
4f48d5f6
|
| 21-Jun-2021 |
Ed Tanous <edtanous@google.com> |
Make code compile with clang-13
Clang-13 rightfully warns that the hasWebuiRoute variable isn't declared as static. This commit resolves that, and adds the static keyword so it can be used in multi
Make code compile with clang-13
Clang-13 rightfully warns that the hasWebuiRoute variable isn't declared as static. This commit resolves that, and adds the static keyword so it can be used in multiple compile units. It also adds the static keyword to the privilege registry, and the inline keyword to many methods that now need it.
clang-format is also updated to version 12 in parse_registies.py, as that's what CI uses, and what most people have installed.
Tested: Followed clang-tidy instructions in README.md "bitbake bmcweb" step now succeeds.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Id43b13606754cb37a404799fce155599ac3a3240
show more ...
|