4aacf268 | 01-Sep-2022 |
Ed Tanous <edtanous@google.com> |
Change return codes to match sd-bus convention
in sd-bus callbacks we should be following the same conventions as sd-bus, returning 0 for success, and returning some correct errno for failure. This
Change return codes to match sd-bus convention
in sd-bus callbacks we should be following the same conventions as sd-bus, returning 0 for success, and returning some correct errno for failure. This changes the couple spots I found to follow that convention.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I9914e35d4938e31c2d94c4f165108606263ac0e7
show more ...
|
6c97486f | 31-Aug-2022 |
Ed Tanous <edtanous@google.com> |
Make asio connection use composed operations
Composed operations [1] are the way that asio is attempting to support multiple executor, coroutine, and async concepts in parallel. This commit is the
Make asio connection use composed operations
Composed operations [1] are the way that asio is attempting to support multiple executor, coroutine, and async concepts in parallel. This commit is the first in hopefully a line of commits where we move to a pattern that is more generally reusable, and reliant on fewer strict types.
This is coming up because asio has removed support for completion_token_type on the async_result object when used with yield_context. A discussion with the maintainers on slack makes it seem like this was unintentional, but regardless, we can improve this code.
The primary upshot of this is that async_send is now moved to use async_initiate, which abstracts away all the result and completion types from the code. This requires moving some of the details namespaces structures to allow for construction without requiring the callback type paramter. In the same move, it moves what was previously a duplicated callback into its own class, called do_unpack, which separates the two concepts, and makes it more clear which is responsible for what.
In doing this move, the templates are now moved to be called "CompletionToken", to be more in line with other asio async operations. There are a number of cases where these template parameters already weren't callbacks, so changing the naming to be inline with asio seems appropriate.
This allows sdbusplus to support boost 1.80.0.
[1] https://www.boost.org/doc/libs/1_80_0/libs/beast/doc/html/beast/using_io/writing_composed_operations.html
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I9d25040abbffbedb39f55eb93c0d7270091cdd63
show more ...
|
164b98bd | 19-Aug-2022 |
Krzysztof Grobelny <krzysztof.grobelny@intel.com> |
Fix coroutine_method_instance error handling
Unlike other methods (method_handler, get/set handlers) coroutine_method_instance did not catch exception_t which was causing wrong error to be send in r
Fix coroutine_method_instance error handling
Unlike other methods (method_handler, get/set handlers) coroutine_method_instance did not catch exception_t which was causing wrong error to be send in response. This commit fixes this issue.
Tested: - Throw exception from register_method(boost::asio::yield_context...), message that was captured using busctl monitor contains proper error information after this change.
Change-Id: Ia7e8ef5fb010a3da0f80c2404da59b0da555d2ef Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
show more ...
|
2e37e97c | 28-Aug-2022 |
Patrick Williams <patrick@stwcx.xyz> |
message: set 'get' as const
Since 'get' is simply a wrapper around the unique_ptr::get call there is no reason it cannot be const. Without it being const it requires lambda functions that use messa
message: set 'get' as const
Since 'get' is simply a wrapper around the unique_ptr::get call there is no reason it cannot be const. Without it being const it requires lambda functions that use messages to all be 'mutable' even though there are cases where they might not need to be.
Without this change, the following lambda would have a needless 'mutable': ``` [bus = get_busp(ctx.get_bus()), msg = std::move(msg)](auto cb, auto data) { return sd_bus_call_async(bus, nullptr, msg.get(), cb, data, 0); } ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ic7501e5e84f8a7ba230edf873ceb851548313bc4
show more ...
|
f289c65f | 26-Aug-2022 |
Patrick Williams <patrick@stwcx.xyz> |
clang-format: update with latest
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I461b17ee197528f125239f3cb8678dca45eaa634 |
af955670 | 27-Jun-2022 |
Krzysztof Grobelny <krzysztof.grobelny@intel.com> |
Added missing include
Missing include was causing compilation error when g++-12 was used.
Tested: - Code compiles
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Change-Id: I583c3
Added missing include
Missing include was causing compilation error when g++-12 was used.
Tested: - Code compiles
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Change-Id: I583c3571dfac5b574d27f2585158d4309681959d
show more ...
|
a6c05b8e | 25-May-2022 |
Jiaqing Zhao <jiaqing.zhao@intel.com> |
Fix clang-tidy issue
When running CI build, clang-tidy gives "missing 'typename' prior to dependent type name" error, casuing build failure.
Fixes c8447d5 ("added support for optionals in unpackPro
Fix clang-tidy issue
When running CI build, clang-tidy gives "missing 'typename' prior to dependent type name" error, casuing build failure.
Fixes c8447d5 ("added support for optionals in unpackProperties")
Change-Id: I5d79a520815173e70ee3b6c4da306ae17f9a41d8 Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
show more ...
|
c8447d52 | 05-Jan-2022 |
Krzysztof Grobelny <krzysztof.grobelny@intel.com> |
added support for optionals in unpackProperties
- Added support for optionals - Added support for pointers - Removed support for moving data from input container - Removed support for container type
added support for optionals in unpackProperties
- Added support for optionals - Added support for pointers - Removed support for moving data from input container - Removed support for container types other than std::vector
Tested: - Unit tests are passing - Examples which use unpackProperties are working correctly
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Change-Id: I3dbd7333237a1373d784187951ad6abe217567d1
show more ...
|
b7329a90 | 28-Apr-2022 |
Patrick Williams <patrick@stwcx.xyz> |
message: append: support span
Change how we detect the ability to iterate over a type so that it supports additional types, such as span. Add test case to cover span. Add some static_asserts in th
message: append: support span
Change how we detect the ability to iterate over a type so that it supports additional types, such as span. Add test case to cover span. Add some static_asserts in the test cases to ensure we are triggering the correct add_multiple/add_single paths for a few assorted types.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I42ff496ab58af613940c9ceb979c71f468f125fc
show more ...
|
1229576b | 30-Mar-2022 |
Patrick Williams <patrick@stwcx.xyz> |
server: object: remove non-enumerated ctor version
There was a constructor variant which tool a bool and mapped it to values in the `action` enumeration for backwards compatibility. This makes it d
server: object: remove non-enumerated ctor version
There was a constructor variant which tool a bool and mapped it to values in the `action` enumeration for backwards compatibility. This makes it difficult to identify users of the various enum behaviors and was intended as a temporary mapping. Remove it now so we don't get new users.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I6dac0db8da4261f55b06e911cd67716afd411f5a
show more ...
|
ba5460db | 30-Mar-2022 |
Patrick Williams <patrick@stwcx.xyz> |
server: object: default emit destruct signals
In the mailing list discussion [1] it was observed that there were cases where daemons like `phosphor-logging` do not end up emitting InterfacesRemoved
server: object: default emit destruct signals
In the mailing list discussion [1] it was observed that there were cases where daemons like `phosphor-logging` do not end up emitting InterfacesRemoved signals even when the holding sdbusplus::object_t was destructed.
After investigation, we determined that there are valid use cases for not calling `object->emit_added()` but still wanting the removal signals to be emitted. Specifically, the case of a daemon creating initial object prior to claiming a bus-name it is good to omit the emission.
I examined all cases where callers were using `action::defer_emit` and it was acceptable for all of them to later send the InterfacesRemoved signals on destruction. To enable the old behavior, if desired, I added a new enumeration which is `action::emit_no_signals`.
1. https://lore.kernel.org/openbmc/CAGm54UHMED4Np0MThLfp4H-i8R24o8pCns2-6MEzy1Me-9XJmA@mail.gmail.com/
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I70bd5d5f2ecc676bdc9475e8a2a27e02c52d9142
show more ...
|
4b0d1268 | 30-Mar-2022 |
Patrick Williams <patrick@stwcx.xyz> |
server: object: add 'action::emit_no_signals'
In a future commit we're going to change the behavior of the destructor to always emit signals when 'action::defer_emit' is chosen so we need a placehol
server: object: add 'action::emit_no_signals'
In a future commit we're going to change the behavior of the destructor to always emit signals when 'action::defer_emit' is chosen so we need a placeholder enum to clearly indicate that no signals should ever be emitted. Add it now, but keep the same behavior as 'action::defer_emit'.
Change-Id: I606c7739041667186f6141548a377adf91ff5518 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
a1fa6e5e | 14-Mar-2022 |
Patrick Williams <patrick@stwcx.xyz> |
asio: object_server: fix 'callFunction' for void result
`auto r = ...` doesn't work when the expression returns a void. Improve the 'callFunction' functions to handle the void result case by putting
asio: object_server: fix 'callFunction' for void result
`auto r = ...` doesn't work when the expression returns a void. Improve the 'callFunction' functions to handle the void result case by putting the `m.append` into a separate constexpr-if.
Fixes eb6a9d0.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I31dfc23d123000c62efe6243b374ba65fc0d5abd
show more ...
|
d8a19ada | 12-Mar-2022 |
Patrick Williams <patrick@stwcx.xyz> |
doc: format with markdownlint
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I53c76c240a893ede5314839e70fe82b93325d59a |
13573801 | 28-Feb-2022 |
Ed Tanous <edtanous@google.com> |
Make getProperty mutable
The lambda passed through getProperty prevents passing mutable lambdas through this interface. For examples of why this is needed, there's a bmcweb commit here that's attem
Make getProperty mutable
The lambda passed through getProperty prevents passing mutable lambdas through this interface. For examples of why this is needed, there's a bmcweb commit here that's attempting to replace templated callbacks with non templated std::function, type erased types.
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/51585
Tested: Above commit compiles. Trivial change.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I08bbfdea8aa4b75916d3e610b9543353c4cd3a1d
show more ...
|
eb6a9d0c | 01-Mar-2022 |
Patrick Williams <patrick@stwcx.xyz> |
asio: object_server: simpilify 'callFunction'
The original implementation of this function seemed to be in a C++14 template style that is no longer necessary. Utilizing if-constexpr and auto the fu
asio: object_server: simpilify 'callFunction'
The original implementation of this function seemed to be in a C++14 template style that is no longer necessary. Utilizing if-constexpr and auto the function was able to be simplified to be non-templated and support both void/non-void returns without duplication.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I589e80ccc4ce673d46e6bc1a0441983a4e18c12e
show more ...
|
8c1f669b | 01-Mar-2022 |
Patrick Williams <patrick@stwcx.xyz> |
asio: object_server: remove non-if_constexpr cases
C++17 has been out for a long time now. There isn't any reason to continue supporting compilers without if-constexpr. Delete these cases to remov
asio: object_server: remove non-if_constexpr cases
C++17 has been out for a long time now. There isn't any reason to continue supporting compilers without if-constexpr. Delete these cases to remove the cruft.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I88fd98cc129756d34380075e244dcaaafe193c3f
show more ...
|
9ca0c929 | 01-Mar-2022 |
Patrick Williams <patrick@stwcx.xyz> |
asio: object_server: remove unused variable
Reported by clang:
../subprojects/sdbusplus/include/sdbusplus/asio/object_server.hpp:245:33: error: unused parameter 'm' [-Werror,-Wunused-parameter]
asio: object_server: remove unused variable
Reported by clang:
../subprojects/sdbusplus/include/sdbusplus/asio/object_server.hpp:245:33: error: unused parameter 'm' [-Werror,-Wunused-parameter] callFunction(message_t& m, InputTupleType& inputArgs)
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I1a53b0aef444d80f1b1f4af6192d59ccd0381aaf
show more ...
|
90fab6bb | 18-Feb-2022 |
Krzysztof Grobelny <krzysztof.grobelny@intel.com> |
Add new overload to register_property_r/rw
New overload doesn't take initial property values as parameter, instead getter function result is used to set stored reference value. This approach prevent
Add new overload to register_property_r/rw
New overload doesn't take initial property values as parameter, instead getter function result is used to set stored reference value. This approach prevents situation when initial value can be different than value returned by getter function which can cause signals to missbehave.
Tested: - Changed examples register-property.cpp and get-all-properties.cpp to use new overload. Examples are working as before.
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Change-Id: Ib7d870dd9fa0c178e17d16c565e6f05339bf3e60
show more ...
|
7662fa69 | 18-Jan-2022 |
George Liu <liuxiwei@inspur.com> |
match: Fix propertiesChangedNamespace method
It should use arg0namespace instead of argN in the propertiesChangedNamespace method.
Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: Ia73a30
match: Fix propertiesChangedNamespace method
It should use arg0namespace instead of argN in the propertiesChangedNamespace method.
Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: Ia73a30c875ebbe9ec070094ee78085e9fd596ddf
show more ...
|
b40dfec6 | 18-Jan-2022 |
Patrick Williams <patrick@stwcx.xyz> |
util: variant: add static assert
The two variant utilities both have an 'Unused' template parameter pack which is expected to be empty. Add static assert to confirm the parameter pack is indeed alw
util: variant: add static assert
The two variant utilities both have an 'Unused' template parameter pack which is expected to be empty. Add static assert to confirm the parameter pack is indeed always empty. (Generally the non-empty parameter pack should match with a specialization.)
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Iae4523142df563d208e20ab81dd47266b3f7dd27
show more ...
|
5770f51a | 10-Jan-2022 |
Paul Fertser <fercerpav@gmail.com> |
utility: add merge_variants_t
This type is useful for processing D-Bus messages containing information for multiple interfaces. For doing sdbusplus::message::message::read() on them one needs to def
utility: add merge_variants_t
This type is useful for processing D-Bus messages containing information for multiple interfaces. For doing sdbusplus::message::message::read() on them one needs to define an std::variant which would be a combination of all the PropertiesVariant's involved.
Signed-off-by: Paul Fertser <fercerpav@gmail.com> Change-Id: Idcb7b9841cc0253f2f7d5552dae540fba5ad488d
show more ...
|
69f5b901 | 17-Jan-2022 |
Willy Tu <wltu@google.com> |
test: Replace the C++ MOCK_METHOD<n> macros with the new MOCK_METHOD
Change-Id: I46c937202701a43aba5cd2f3dcf8d17b982c3716 Signed-off-by: Willy Tu <wltu@google.com> |
55949c29 | 08-Dec-2021 |
Krzysztof Grobelny <krzysztof.grobelny@intel.com> |
Used erased type to reduce binary for getProperty
Introduced erased type patern to reduce amount of templates which reduces binary size for bmcweb.
Tested: - Examples which use getProperty helper f
Used erased type to reduce binary for getProperty
Introduced erased type patern to reduce amount of templates which reduces binary size for bmcweb.
Tested: - Examples which use getProperty helper function are working as before.
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/44019
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Change-Id: I6b089412edb31f1124a9e2364008cf170b17beff
show more ...
|
ce62764d | 07-Dec-2021 |
gokulsanker <gokul.sanker.v.g@intel.com> |
Modified set_handler() to return dbus error code
set_handler() will call the registered callback if set command is given to a dbus property. The callback can return error code but the existing code
Modified set_handler() to return dbus error code
set_handler() will call the registered callback if set command is given to a dbus property. The callback can return error code but the existing code were not handling it properly.
The following patch replaced sdbusplus exception with a negative error code in dbus-senors
https://gerrit.openbmc-project.xyz/c/openbmc/dbus-sensors/+/46444
The error code must be used to set the dbus error. This was handled properly in case of an exception but not if the callback was returning error code
Signed-off-by: Gokul Sanker V.G <gokul.sanker.v.g@intel.com> Change-Id: Id164a9b3e62e65ec607d27d2219a3847d2cc7aab
show more ...
|