c9eb7e3b | 06-Mar-2023 |
Ed Tanous <edtanous@google.com> |
Optimize object_server
There are quite a few optimizations that can be made to object_server to reduce memory usage, and improve simplicity. First, the virtualized classes have been removed in exch
Optimize object_server
There are quite a few optimizations that can be made to object_server to reduce memory usage, and improve simplicity. First, the virtualized classes have been removed in exchange for std::function based type erasure.
All the underlying structures have been moved to std::vector, to improve memory packing and locality. To accomplish this, the vtable construction is moved into the initialize function, such that when initialize is called, the dbus_interface object knows there will be no more changes, and can therefore take pointers to elements within the vector for the vtable.
The independent storage of string names has been removed in lieu of dedicated structures, signal, method_callback, and property_callback, which each represent one of the primitive types, and each of which have a "name" string that can be used, whereas previously name required duplication across each of the unordered_maps.
Change-Id: I0236f1b85c53f1b5d05931ea100c04de6e571665 Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|
fd995def | 17-Mar-2023 |
Ed Tanous <edtanous@google.com> |
Break out lambdas into helpers
While these are pretty simple lambdas, keeping them inline removes the possibility for deduplication, and makes debugging harder.
Change-Id: Ia6f3398023a89216776a8be4
Break out lambdas into helpers
While these are pretty simple lambdas, keeping them inline removes the possibility for deduplication, and makes debugging harder.
Change-Id: Ia6f3398023a89216776a8be4e04406aa69c5e84b Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|
1d3a0390 | 20-Mar-2023 |
Ed Tanous <edtanous@google.com> |
Remove message copy
This was previously making an unneeded copy to try to work around some undefined behavior bugs. It is no longer needed.
Change-Id: Ic2427d37161087880e6fdcf6e1b9aa4210f15d1e Sig
Remove message copy
This was previously making an unneeded copy to try to work around some undefined behavior bugs. It is no longer needed.
Change-Id: Ic2427d37161087880e6fdcf6e1b9aa4210f15d1e Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|
6993aa4d | 17-Mar-2023 |
Ed Tanous <edtanous@google.com> |
Break out post-spawn lambda into method
This lambda really is too long to be inline. Break it out into a method for clarity.
Change-Id: I561850156d8582ebc2b68657949a4f4f5bf7a4d6 Signed-off-by: Ed
Break out post-spawn lambda into method
This lambda really is too long to be inline. Break it out into a method for clarity.
Change-Id: I561850156d8582ebc2b68657949a4f4f5bf7a4d6 Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|
da48d207 | 08-Mar-2023 |
Ed Tanous <edtanous@google.com> |
Fix vtable entires for offset callbacks
property_o didn't pass through the callbacks as sd-bus expected, so they can't be used for read-write properties. Add the expected methods.
Change-Id: Iad75
Fix vtable entires for offset callbacks
property_o didn't pass through the callbacks as sd-bus expected, so they can't be used for read-write properties. Add the expected methods.
Change-Id: Iad7592c99a60c22c10e274517ebfcbf8cf293a42 Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|
0564face | 08-Mar-2023 |
Ed Tanous <edtanous@google.com> |
Delete callbackYields
This is a duplicate of FirstArgIsYield, and doesn't add much value. Simplify.
Change-Id: Icaf1a922b5e5063d5b674ff594dbd5ee10fce500 Signed-off-by: Ed Tanous <edtanous@google.co
Delete callbackYields
This is a duplicate of FirstArgIsYield, and doesn't add much value. Simplify.
Change-Id: Icaf1a922b5e5063d5b674ff594dbd5ee10fce500 Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|
c461441e | 08-Mar-2023 |
Ed Tanous <edtanous@google.com> |
Break out callFunction
This function is duplicated between both classes, break it out into its own function to deduplicate the code.
Change-Id: I24dea73a79af6224d80a607b090eb1fffbe92fd6 Signed-off-
Break out callFunction
This function is duplicated between both classes, break it out into its own function to deduplicate the code.
Change-Id: I24dea73a79af6224d80a607b090eb1fffbe92fd6 Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|
df6133b4 | 08-Mar-2023 |
Ed Tanous <edtanous@google.com> |
Remove size_t from SetPropertyReturnValue
This enum is only ever used as an enum. Let the compiler decide what underlying type to use.
Change-Id: Ieda7835ab346c46d8a1153a8e8eb65e45ae1648c Signed-o
Remove size_t from SetPropertyReturnValue
This enum is only ever used as an enum. Let the compiler decide what underlying type to use.
Change-Id: Ieda7835ab346c46d8a1153a8e8eb65e45ae1648c Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|
3448edea | 08-Mar-2023 |
Ed Tanous <edtanous@google.com> |
Remove initialized_ member
the std::optional on interface represents the same information about whether or not this interface have been initialized.
Change-Id: I365ac35a76f3fd710bddac3d55b514f3fde2
Remove initialized_ member
the std::optional on interface represents the same information about whether or not this interface have been initialized.
Change-Id: I365ac35a76f3fd710bddac3d55b514f3fde2f255 Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|
936cb89e | 01-Mar-2023 |
Ed Tanous <edtanous@google.com> |
Change deprecated asio function
The io_context.post method has been deprecated for some time. Move to the new model, using boost::asio::post.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-
Change deprecated asio function
The io_context.post method has been deprecated for some time. Move to the new model, using boost::asio::post.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I946a32e0404809b85c72767aafd783053bf8ee5f
show more ...
|
56252bbe | 13-Feb-2023 |
Patrick Williams <patrick@stwcx.xyz> |
stdexec: update to latest commit
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Idaa873100bd02f06455b0eb5a00ca62f93b08acc |
abbdd6aa | 20-Jan-2023 |
Patrick Williams <patrick@stwcx.xyz> |
stdexec: update to latest commit
The result of execution::when_all seems to have changed, so I needed to make a slight change to `sleep_for` to return a task instead of a Sender.
Signed-off-by: Pat
stdexec: update to latest commit
The result of execution::when_all seems to have changed, so I needed to make a slight change to `sleep_for` to return a task instead of a Sender.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ib47c631f8e970838a79ffb44e2a1db4c86a831c4
show more ...
|
9688ed68 | 06-Jan-2023 |
Ed Tanous <edtanous@google.com> |
Add override keyword everywhere it's required
Clang catches some of these. Add override keywords where we override functions, per cpp core guidelines.
Change-Id: I66f9e6dff53e07f0057d86a806701593b
Add override keyword everywhere it's required
Clang catches some of these. Add override keywords where we override functions, per cpp core guidelines.
Change-Id: I66f9e6dff53e07f0057d86a806701593be16b188 Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|
640a7d56 | 04-Jan-2023 |
Ed Tanous <edtanous@google.com> |
Add support for appending std::string_view
std::string_view is used more in the project now that c++17 is available. It should be allowed as a base type in serialization of dbus interfaces.
To avo
Add support for appending std::string_view
std::string_view is used more in the project now that c++17 is available. It should be allowed as a base type in serialization of dbus interfaces.
To avoid an extra string copy, this function makes use of sd_bus_message_append_string_iovec, which allows appending in string pieces that might not be null terminated. This function is piped through the test framework, and interfaces to match.
Change-Id: Iee3e2cea9759fa9759cec98ab30c12c822aa3b73 Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|
2e3f79b3 | 05-Jan-2023 |
Ed Tanous <edtanous@google.com> |
Add missing override keyword on mock
This mock method is missing an override keyword. Looks like an unintentional omission. Add it.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ia1c2
Add missing override keyword on mock
This mock method is missing an override keyword. Looks like an unintentional omission. Add it.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ia1c2ee09ddbb5add0485b2e3f66347823bf959af
show more ...
|
87ce9630 | 04-Jan-2023 |
Ed Tanous <edtanous@google.com> |
Remove static keyword from template
Clang warns on these templates not being used, each of which use a static modifier in a header file. Given we're in a header, this likely means that this static
Remove static keyword from template
Clang warns on these templates not being used, each of which use a static modifier in a header file. Given we're in a header, this likely means that this static modifier isn't really doing anything, given that every compile unit will include the header.
Remove static to shut clang up.
Change-Id: I50c33738e4567150eeddf9e6ded0dc24db14c78d Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|
ddc57bdf | 05-Jan-2023 |
Ed Tanous <edtanous@google.com> |
Fix a bunch of docstrings
Clang correctly notes that a bunch of our docstrings are wrong. We don't really use doxygen, but it's useful to be able to run a compiler without warnings. The failures f
Fix a bunch of docstrings
Clang correctly notes that a bunch of our docstrings are wrong. We don't really use doxygen, but it's useful to be able to run a compiler without warnings. The failures fall into a couple categories.
First, when using variadic templates, the type is the variable name (ie T), not including variadic expansion. (ie T...). In these cases, the ... is removed from the definition.
Templatized structs should not use the @struct keyword. They are a template as far as doxygen is concerned, so remove the keyword.
A number of functions docstrings are just wrong in terms of argument names, or whether or not they have return types.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Iab6f76b422a9568b7ad19d3f725a9c1b870784d9
show more ...
|
ed4a5a64 | 05-Jan-2023 |
Ed Tanous <edtanous@google.com> |
Fix variable shadow warnings in sdbusplus
-Wshadow is useful for subprojects to enable, because it can find bugs in common variable names (err, r, i, etc). With these changes, projects can now buil
Fix variable shadow warnings in sdbusplus
-Wshadow is useful for subprojects to enable, because it can find bugs in common variable names (err, r, i, etc). With these changes, projects can now build sdbusplus with -Wshadow enabled.
The changes fall into a couple buckets. The first is for constructor variables that match the member variable name. In these cases, "_in" is appended to the end of the constructor variable name.
The second is a case where the variable "r" was used for return codes twice. One instance is changed to "ret".
With these changes, projects can compile with -Wshadow enabled without warnings.
Change-Id: Ia33a6f8306473c616f6278bb848460167e5463ef Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|
5e7ef083 | 05-Jan-2023 |
Patrick Williams <patrick@stwcx.xyz> |
stdexec: update to later commit
The upstream code has done some namespace changes. Point to a commit in that timeframe and fix up the local usages in order to compile successfully.
Signed-off-by:
stdexec: update to later commit
The upstream code has done some namespace changes. Point to a commit in that timeframe and fix up the local usages in order to compile successfully.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I5a21ccd0774ee5cd22d45c9a425e43560734a571
show more ...
|
b8be599f | 04-Jan-2023 |
Ed Tanous <edtanous@google.com> |
Remove extra semi-colons
A couple functions had extra semi-colons, which clang -Weverything flags. Remove them.
Change-Id: I2b44444c3184817dd0035c62b5ae114254457398 Signed-off-by: Ed Tanous <edtan
Remove extra semi-colons
A couple functions had extra semi-colons, which clang -Weverything flags. Remove them.
Change-Id: I2b44444c3184817dd0035c62b5ae114254457398 Signed-off-by: Ed Tanous <edtanous@google.com>
show more ...
|
ae47928b | 03-Jun-2022 |
Jonathan Doman <jonathan.doman@intel.com> |
Clean up ASIO set-property callback code
This reverts commit ce62764d6c0a72ec88eb433e1afd05b751225971, which introduced inconsistent semantics for the underlying ASIO set handler functions. The "ext
Clean up ASIO set-property callback code
This reverts commit ce62764d6c0a72ec88eb433e1afd05b751225971, which introduced inconsistent semantics for the underlying ASIO set handler functions. The "external" `call` case expected the handler to return an integer error code, while the "internal" `set` case expected the handler to return a boolean status.
This also does a small refactor on the two similar `call` and `set` functions to deduplicate, and adds ASIO.md to document the expected semantics of the ASIO handlers.
The vast majority of user code in OpenBMC is still returning integers from the callbacks (0/1/-1), but in most cases 0 was used to mean failure, and 1 was used to mean success, so formalizing that the callback should return a boolean value will not break things.
Tested: With accompanying dbus-sensors change I05c41318954d5d1549752c5ef2c227f3f22a45d3, using steps in that commit msg.
Signed-off-by: Jonathan Doman <jonathan.doman@intel.com> Change-Id: Ic3a36027fa95a77469439b296a1497634cfe030f
show more ...
|
5d81ca2b | 22-Nov-2022 |
William A. Kennington III <wak@google.com> |
bus: Add function for checking open status
We have a workaround in sdevent for dealing with match expressions that leak memory. If we keep trying to process bus events after sd_bus_close(), we will
bus: Add function for checking open status
We have a workaround in sdevent for dealing with match expressions that leak memory. If we keep trying to process bus events after sd_bus_close(), we will encounter errors. This allows us to stop processing when the bus should be closed.
Change-Id: I0bda95e76db8e81b56527cd1d5687a5d0b14f259 Signed-off-by: William A. Kennington III <wak@google.com>
show more ...
|
94865b3d | 21-Nov-2022 |
William A. Kennington III <wak@google.com> |
bus: Return the value of wait
Knowing the number of events being >0 is important if a timeout is set, otherwise you can't know if processing is safe to perform.
Change-Id: Ifc3b8a01666422b4f2e057f0
bus: Return the value of wait
Knowing the number of events being >0 is important if a timeout is set, otherwise you can't know if processing is safe to perform.
Change-Id: Ifc3b8a01666422b4f2e057f0b162d7588c0ab446 Signed-off-by: William A. Kennington III <wak@google.com>
show more ...
|
a8a092c0 | 17-Oct-2022 |
Willy Tu <wltu@google.com> |
remove potential memory leak with getAllProperties
Wrap handler in a lambda to remove the trigger potential memory leak with clang-tidy. Only getAllProperties have this std::move to async_method_cal
remove potential memory leak with getAllProperties
Wrap handler in a lambda to remove the trigger potential memory leak with clang-tidy. Only getAllProperties have this std::move to async_method_call and is hitting the issue.
The issue only happens if the handler captures some variabls
Example code that hit the issue. ```
void handler(const std::string& /*unused*/, const boost::system::error_code /*unused*/, const std::vector< std::pair<std::string, std::variant<std::string>>>& /*unused*/) {}
void test(sdbusplus::asio::connection* conn) { std::string test = "test"; sdbusplus::asio::getAllProperties<std::variant<std::string>>( *conn, "xyz.openbmc_project.EntityManager", "path", "xyz.openbmc_project.Inventory.Decorator.Asset", std::bind_front(handler, test)); } ``` Tested: clang-tidy is happy now
Signed-off-by: Willy Tu <wltu@google.com> Change-Id: I0a3a5ed016aed664c650d811e253d54a4eb2b0b1
show more ...
|
115e9b3d | 23-Sep-2022 |
Patrick Williams <patrick@stwcx.xyz> |
async: context: allow many exceptions
Allow many spawned tasks to throw exceptions and queue them up, re-throwing them one-by-one from `context::run` calls. Similarly enhance `context::scope` so th
async: context: allow many exceptions
Allow many spawned tasks to throw exceptions and queue them up, re-throwing them one-by-one from `context::run` calls. Similarly enhance `context::scope` so that many `context::empty` completions can complete with error.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I8744e0a3b8b0663ebd5ca26db0f5943688afe62a
show more ...
|