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 ...
|
4a46eb5a | 23-Nov-2021 |
Patrick Williams <patrick@stwcx.xyz> |
object: handle diamond inheritance
Commit 664922157bbbd14f0ad1692cee5547f60f6c617c added an inheritance to `server::object` to gain access to the bus-pointer. This was observed to cause a compile f
object: handle diamond inheritance
Commit 664922157bbbd14f0ad1692cee5547f60f6c617c added an inheritance to `server::object` to gain access to the bus-pointer. This was observed to cause a compile failure in some applications which had a diamond-inheritance structure due to a nested `object` inheritance:
`object<object<iface0, iface1>, object<iface2, iface3>>`
These clients probably should not have attempted a nested/diamond because the previous implementation would have resulted in a silent failure to make `action::emit_interface_added` work properly (since object itself doesn't have an `emit_added` function).
Improve the `object` so that: - Diamond inheritance is no longer possible with nested inherits. - The `action::emit_interface_added` action works properly with nested inherits.
This required adding some template specialization to determine if one of the type arguments to `object` were nested (ie. `object<Args0..., object<Args1...>, Args2...>`) and collapse out the nested `object` inheritance (so that the example acts exactly the same as `object<Args0..., Args1..., Args2...>`).
Tested: Enhance the existing `object::emit` test cases to operate on a nested `object` structure.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I10635a256aafbdc1e42439a49fa61127e06c8e36
show more ...
|
2404176d | 02-Dec-2021 |
Jonathan Doman <jonathan.doman@intel.com> |
Make asio::object_server take const ptr to connection
No reason the parameter shouldn't be a const reference, and it enables passing an rvalue to the constructor.
Signed-off-by: Jonathan Doman <jon
Make asio::object_server take const ptr to connection
No reason the parameter shouldn't be a const reference, and it enables passing an rvalue to the constructor.
Signed-off-by: Jonathan Doman <jonathan.doman@intel.com> Change-Id: I7bd40395c6e16b0962c39ab55adaefa8e56ceb87
show more ...
|
f0eb650e | 22-Nov-2021 |
Patrick Williams <patrick@stwcx.xyz> |
slot: add friended get function
Similar to bus, infrequently sdbusplus classes need to be able to gain access to the slot pointer to pass along to other calls. Create a `slot_friend` class which pr
slot: add friended get function
Similar to bus, infrequently sdbusplus classes need to be able to gain access to the slot pointer to pass along to other calls. Create a `slot_friend` class which provides a static method to gain access to the underlying pointer.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I371b62ca7b82c9c93e5abb71cdab4abda713aa5e
show more ...
|
66492215 | 19-Nov-2021 |
Patrick Williams <patrick@stwcx.xyz> |
bus: reduce forward declaration for friendship
Generally we do not want users to be able to get the underlying `sd_bus` pointer held by the `bus_t`, but there are a number of classes inside sdbusplu
bus: reduce forward declaration for friendship
Generally we do not want users to be able to get the underlying `sd_bus` pointer held by the `bus_t`, but there are a number of classes inside sdbusplus that do need the bus so that they can make appropriate sd_bus call. Previously, we've required every one of these classes to be forward declared inside `bus.hpp`, which is clutter. Create a new class, with a simple static function, which can be inherited by any internal class and allows access to the underlying `sd_bus*`.
Refactor classes which were previously friends to now inherit from this class.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ide0e7147801d01dc45b255261ba2cafefabddbb1
show more ...
|
a7ac313c | 19-Nov-2021 |
Patrick Williams <patrick@stwcx.xyz> |
slot: explicitly transfer pointer
The slot class is intended to be an RAII wrapper around the C-style `sd_bus_slot*`. As part of the constructor it gets the pointer it is assuming ownership for.
T
slot: explicitly transfer pointer
The slot class is intended to be an RAII wrapper around the C-style `sd_bus_slot*`. As part of the constructor it gets the pointer it is assuming ownership for.
The previous constructor took the `sd_bus_slot*` by value so it was possible that the caller still kept the slot rather than fully transferring ownership. Switch the constructor to an r-value reference so that the caller's pointer can be erased as part of the ownership transfer.
Also, add an assignment operator to simplify the syntax when a slot is first initialized with `nullptr` and then later given ownership of a newly constructed slot.
While this is an incompatible constructor change, it is not expected to affect any current users. The only example of referencing a `slot::slot` I could see in the current OpenBMC org calls the constructor with a `nullptr`, which will seamlessly call the new r-value variant.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I577de2e10e4d5ccae6337c763b848ea4cf2121dd
show more ...
|
ce90da1d | 19-Nov-2021 |
Patrick Williams <patrick@stwcx.xyz> |
slot: shorten slot type
Create an alias `sdbusplus::slot_t` to `sdbusplus::slot::slot` to reduce duplication.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I0ac45f676f1e52f53b6ea3a
slot: shorten slot type
Create an alias `sdbusplus::slot_t` to `sdbusplus::slot::slot` to reduce duplication.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I0ac45f676f1e52f53b6ea3a5b487d0f183641e37
show more ...
|
a735ca5c | 19-Nov-2021 |
Patrick Williams <patrick@stwcx.xyz> |
vtable: shorten vtable type
Create an alias `sdbusplus::vtable_t` to `sdbusplus::vtable::vtable_t` to reduce duplication.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I0c3a8e40827
vtable: shorten vtable type
Create an alias `sdbusplus::vtable_t` to `sdbusplus::vtable::vtable_t` to reduce duplication.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I0c3a8e40827cb011a07d75c99550a371afdefc64
show more ...
|
ba33c2a2 | 19-Nov-2021 |
Patrick Williams <patrick@stwcx.xyz> |
manager,interface: use shortened types
Use the shortened alias types whenever possible for `manager` and `interface`.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ib0f10bd0912f366
manager,interface: use shortened types
Use the shortened alias types whenever possible for `manager` and `interface`.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ib0f10bd0912f3668dcb3fce660a95facdf02c23b
show more ...
|
0f282c48 | 19-Nov-2021 |
Patrick Williams <patrick@stwcx.xyz> |
bus: shorten bus type
Create an alias `sdbusplus::bus_t` to `sdbusplus::bus::bus` to reduce duplication.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I9f17892eed5112d4946949861488
bus: shorten bus type
Create an alias `sdbusplus::bus_t` to `sdbusplus::bus::bus` to reduce duplication.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I9f17892eed5112d49469498614884c02bba86011
show more ...
|
10d7aa12 | 19-Nov-2021 |
Patrick Williams <patrick@stwcx.xyz> |
message: shorten message type
Create an alias `sdbusplus::message_t` to `sdbusplus::message::message` to reduce duplication.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ib400b12f
message: shorten message type
Create an alias `sdbusplus::message_t` to `sdbusplus::message::message` to reduce duplication.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ib400b12fe4a412c0c0c3d26a88f3fae46445cfa8
show more ...
|
6d83cf53 | 19-Oct-2021 |
Szymon Dompke <szymon.dompke@intel.com> |
Add non-throwing version of unpackProperties
Some projects (e.g., bmcweb) don't use functions which throw exceptions. This change introduces unpackPropertiesNoThrow() function, which returns optiona
Add non-throwing version of unpackProperties
Some projects (e.g., bmcweb) don't use functions which throw exceptions. This change introduces unpackPropertiesNoThrow() function, which returns optional string. In case of mismatched type or missing property, it will contain its name. In case of no errors, std::nullopt will be returned.
As a side change, message returned by UnpackPropertyError::what() now also includes propertyName and reason.
Testing done: - Added unit tests for unpackPropertiesNoThrow(). - unpackProperties() functionality remained the same.
Signed-off-by: Szymon Dompke <szymon.dompke@intel.com> Change-Id: I61318bb906de7d5a252414c1d3ea25322874e23e Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
b4667654 | 06-Oct-2021 |
Patrick Williams <patrick@stwcx.xyz> |
catch exceptions as const
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: If708716cc4c05ad30ea0fcd89518236d815bdafb |
a8e3502c | 28-Sep-2021 |
Patrick Williams <patrick@stwcx.xyz> |
exception: ensure base exception vtable is non-hidden
I found that when building this library under Yocto, `-flto=auto` is used by default and the vtable for the exception class ends up becoming hid
exception: ensure base exception vtable is non-hidden
I found that when building this library under Yocto, `-flto=auto` is used by default and the vtable for the exception class ends up becoming hidden (since there are no non-pure/non-inline functions). I've tried using `__attribute__((visibility("default")))` with no luck. The only thing which seems to work is defining some non-inline function to force the vtable to be emitted.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Iaac957591be38d38d021503e15e16f0c982808a9
show more ...
|
b68700e8 | 09-Sep-2021 |
Patrick Williams <patrick@stwcx.xyz> |
exception: make base get_errno pure virtual
In order to enforce that exception authors make an explicit decision on the errno, switch get_errno to pure virtual.
Signed-off-by: Patrick Williams <pat
exception: make base get_errno pure virtual
In order to enforce that exception authors make an explicit decision on the errno, switch get_errno to pure virtual.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I647ef6802149b1092b115fdc78bb9f3e5e67bfa0
show more ...
|
15228663 | 03-Sep-2021 |
Patrick Williams <patrick@stwcx.xyz> |
exception: create subclass for generated errors
All errors generated by sdbus++ YAML we want to follow the systemd default errno value (EIO). All exceptions defined otherwise it is probably a good
exception: create subclass for generated errors
All errors generated by sdbus++ YAML we want to follow the systemd default errno value (EIO). All exceptions defined otherwise it is probably a good idea to ensure that the author picks an explicit errno.
Create a base class for generated exceptions to hold the default `get_errno() { return EIO; }` implementation, which can be used by various repositories and later turn the exception_t one into a pure virtual.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I2648825b677353970eed4724bd2d3710a103d814
show more ...
|
bd372ecb | 02-Sep-2021 |
Patrick Williams <patrick@stwcx.xyz> |
exception: add errno for internal errors
Assign errnos for InvalidEnumString and UnpackPropertyError.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I1ca283050a95846f9409554696880fc
exception: add errno for internal errors
Assign errnos for InvalidEnumString and UnpackPropertyError.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I1ca283050a95846f9409554696880fc043570edf
show more ...
|
b6f729d6 | 02-Sep-2021 |
Patrick Williams <patrick@stwcx.xyz> |
exception: add errno for all exceptions
sd_bus maintains an errno for all exceptions. There are some users of the library that are catching an SdBusError because they want an easy way to change to
exception: add errno for all exceptions
sd_bus maintains an errno for all exceptions. There are some users of the library that are catching an SdBusError because they want an easy way to change to an errno, but as a result they are potentially missing exceptions. Add the `get_errno` method into our base exception object and return the same default that sd_bus uses: EIO.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I5d7610f78934c94841f99573db6adca2b5ec895c
show more ...
|
0c8136a4 | 28-Aug-2021 |
Patrick Williams <patrick@stwcx.xyz> |
enable building with clang
Clang is more pedantic about systemd's use of C99 extensions when high warning levels are enabled. Disable the "-Wc99-extensions" when using the SD_BUS_ERROR_NULL macro f
enable building with clang
Clang is more pedantic about systemd's use of C99 extensions when high warning levels are enabled. Disable the "-Wc99-extensions" when using the SD_BUS_ERROR_NULL macro from systemd. This enables sdbusplus to compile with clang.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I5433244ad33e5803d0291de11056a7feee57d55c
show more ...
|
daaad8f7 | 28-Aug-2021 |
Patrick Williams <patrick@stwcx.xyz> |
message: append: fix unused variable warning
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I26e542e7acdac08e143fe15ad50a2d570ff9ea5d |
0ade192c | 19-Aug-2021 |
Nidhin MS <nidhin.ms@intel.com> |
Fix: Unused parameter in object_server.hpp
The function argument m in callback_method_instance::callFunction is unused.
Compiler is throwing unsused parameter error when all warnings are enabled an
Fix: Unused parameter in object_server.hpp
The function argument m in callback_method_instance::callFunction is unused.
Compiler is throwing unsused parameter error when all warnings are enabled and -Werr is set.
Tested: Build was succesful
Signed-off-by: Nidhin MS <nidhin.ms@intel.com> Change-Id: If8da994e90f564962a2b872bc1286bd43aa600da
show more ...
|
cf0c0722 | 06-Aug-2021 |
Rashmica Gupta <rashmica.g@gmail.com> |
match: Add new PropertiesChanged rule
Matches on path_namespace rather than path.
Signed-off-by: Rashmica Gupta <rashmica.g@gmail.com> Change-Id: I69d7b6cb4b79da381ebae3c4572c17b51faaf24d |
bb8be9f7 | 29-Jul-2021 |
William A. Kennington III <wak@google.com> |
native_types: Fix pendantic error
Trailing semicolons for function declarations are superfluous.
Change-Id: Ifbf8806b135deccb558bc478b1e6746c9beb9a60 Signed-off-by: William A. Kennington III <wak@g
native_types: Fix pendantic error
Trailing semicolons for function declarations are superfluous.
Change-Id: Ifbf8806b135deccb558bc478b1e6746c9beb9a60 Signed-off-by: William A. Kennington III <wak@google.com>
show more ...
|
c1c51060 | 21-Jul-2021 |
Patrick Williams <patrick@stwcx.xyz> |
message: export has_convert_from_string
Commit 87b6a8d331867c24f7bd5f0160199478d97383b0 added a SFINAE template to determine if a type has 'convert_from_string'. Export this template out of the deta
message: export has_convert_from_string
Commit 87b6a8d331867c24f7bd5f0160199478d97383b0 added a SFINAE template to determine if a type has 'convert_from_string'. Export this template out of the details namespace so other code can use it.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Idf8b95b4b76854c7d94729add9101c978ee6056b
show more ...
|