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 ...
|
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 ...
|
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 ...
|
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 ...
|
2dcf64bf | 30-Jul-2021 |
William A. Kennington III <wak@google.com> |
native_types: Use int8_t instead of char
Technically a char is signed, but the compiler warns about using -1 char values. int8_t is the intended type here.
Change-Id: I888aef3bff9b585beed7d0ebc0e75
native_types: Use int8_t instead of char
Technically a char is signed, but the compiler warns about using -1 char values. int8_t is the intended type here.
Change-Id: I888aef3bff9b585beed7d0ebc0e75f01f0e7558b Signed-off-by: William A. Kennington III <wak@google.com>
show more ...
|
2bba553d | 27-May-2021 |
William A. Kennington III <wak@google.com> |
message/native_types: Constexpr fix in c++17 mode
If we don't initialize the array at declaration time, we can't consider the function constexpr as the values could be non-deterministic.
Change-Id:
message/native_types: Constexpr fix in c++17 mode
If we don't initialize the array at declaration time, we can't consider the function constexpr as the values could be non-deterministic.
Change-Id: I3ba476cf58b86c44ad2e2216b74da09229e3d0c4 Signed-off-by: William A. Kennington III <wak@google.com>
show more ...
|
8db46a0f | 05-May-2021 |
William A. Kennington III <wak@google.com> |
native_types: string_path_wrapper: Don't escape all strings
Not all strings require escaping when appending them to a path. This allows us to now append `openbmc_project` to `/xyz` and have expected
native_types: string_path_wrapper: Don't escape all strings
Not all strings require escaping when appending them to a path. This allows us to now append `openbmc_project` to `/xyz` and have expected behavior.
Change-Id: I49a2ee100455cff4067dcf3df61f3e145231eeba Signed-off-by: William A. Kennington III <wak@google.com>
show more ...
|
285f78b1 | 01-May-2021 |
William A. Kennington III <wak@google.com> |
native_types: Reduce append allocation
This builds the string from left to right, instead of dealing with string inserts, optimizing for allocations. Uses our own hex encoder instead of relying on s
native_types: Reduce append allocation
This builds the string from left to right, instead of dealing with string inserts, optimizing for allocations. Uses our own hex encoder instead of relying on systemd libraries. This maintains explicit compatability with the systemd encoding scheme.
Change-Id: Ia6c2f4fb19984f549c6bac2d67d0b5d610022038 Signed-off-by: William A. Kennington III <wak@google.com>
show more ...
|
226bc42a | 05-May-2021 |
William A. Kennington III <wak@google.com> |
native_types: Migrate large functions to shared lib
This speeds up compilation of changes and should save space in users of the functions.
Change-Id: Iee9029800c11dcd4e94f165766836bae327ee9b5 Signe
native_types: Migrate large functions to shared lib
This speeds up compilation of changes and should save space in users of the functions.
Change-Id: Iee9029800c11dcd4e94f165766836bae327ee9b5 Signed-off-by: William A. Kennington III <wak@google.com>
show more ...
|
32ffb03d | 12-Oct-2020 |
Patrick Williams <patrick@stwcx.xyz> |
server: un-inline various large functions
Save approximiately 70k (ARM32) of size from the generated library of libphosphor-dbus.so by un-inlining various large functions.
Signed-off-by: Patrick Wi
server: un-inline various large functions
Save approximiately 70k (ARM32) of size from the generated library of libphosphor-dbus.so by un-inlining various large functions.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ie238ca7807960bf1577dcbb272226f197de84b01
show more ...
|
09b88f26 | 02-Sep-2020 |
Krzysztof Grobelny <krzysztof.grobelny@intel.com> |
Added utility functions getAllProperties and unpackProperties
Tested: - Added example to verify that functions work correctly - Added new unit tests that are passing - All other tests are stil
Added utility functions getAllProperties and unpackProperties
Tested: - Added example to verify that functions work correctly - Added new unit tests that are passing - All other tests are still passing after this change - Added handling of new type (std::monostate) which can be used as first type in variant to represent that none of the other types was matched
Change-Id: Ic8e7c8d3116d64b94be37147ae8a80ebb5d3811d Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
show more ...
|
7f664254 | 04-Jun-2020 |
Patrick Williams <patrick@stwcx.xyz> |
build: split source and header directories
Split the headers and source to simplify the install_header directive such that we no longer need to specify cpp files to exclude in the install_header cal
build: split source and header directories
Split the headers and source to simplify the install_header directive such that we no longer need to specify cpp files to exclude in the install_header call.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Iac4c38f95e690aa8ef8ecf87b032f55a1a31409c
show more ...
|