8fc06397 | 28-Sep-2020 |
Krzysztof Grobelny <krzysztof.grobelny@intel.com> |
asio: Added method add_unique_interface to object_server
Add_unique_interface returns unique_ptr instead of shared_ptr. When shared_ptr is used call to object_server::remove_interface is needed, whe
asio: Added method add_unique_interface to object_server
Add_unique_interface returns unique_ptr instead of shared_ptr. When shared_ptr is used call to object_server::remove_interface is needed, when unique_ptr is used interface is removed when goes out of scope.
Tested: - Changed two of the examples to use this method - All other tests are still passing after this change
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Change-Id: I490acafdaf0cd62419a0540adbb846c393c3939f
show more ...
|
4690d88c | 08-Oct-2020 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: handle duplicate generated variant types
4ac7e56e8e18202fad3b2734346c6d4c7a6957fc added support for 'size_t' and 'ssize_t' types to sdbus++. On some architectures these collide with '[u]in
sdbus++: handle duplicate generated variant types
4ac7e56e8e18202fad3b2734346c6d4c7a6957fc added support for 'size_t' and 'ssize_t' types to sdbus++. On some architectures these collide with '[u]int32_t' or '[u]int64_t' types and so may not be added to a combined variant (ie. variant<uint32_t, size_t> will fail to compile on some architectures). The generated bindings in sdbus++ need a variant from the set of all properties for some of the constructor forms.
Create a template type which will formulate a non-duplicative type set from which a variant can be constructed and modify the sdbus++ generator to use this variant type instead of std::variant directly. Added test cases here to cover this condition for 'size' and 'ssize' sdbus++ types.
It is possible this could have been resolved in the generator itself, but then the generator would have needed to know which architecture the generated bindings were going to be compiled for. This would have made the header files incompatible between x86-64 and arm32. I chose instead to keep the header files consistent across all architectures and let the compiler make the type decision.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I7db5ad2c32d86d37d920a1801cdabfcaeda89489
show more ...
|
807419d3 | 28-Sep-2020 |
Krzysztof Grobelny <krzysztof.grobelny@intel.com> |
asio: Added utility functions getProperty and setProperty
Tested: - Modified one of the examples to use this utility instead - All other tests are still passing after this change
Change-Id: I32
asio: Added utility functions getProperty and setProperty
Tested: - Modified one of the examples to use this utility instead - All other tests are still passing after this change
Change-Id: I3237e281915c7edf931e3326b88bd24714ee8ecb Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
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 ...
|
992ab24a | 09-Sep-2020 |
Wludzik, Jozef <jozef.wludzik@intel.com> |
Remove regex match pattern from object_server
Removed regex from object_server to avoid crash on std::regex_match function when input string is very long. It is known bug in gcc that std::regex cras
Remove regex match pattern from object_server
Removed regex from object_server to avoid crash on std::regex_match function when input string is very long. It is known bug in gcc that std::regex crashes with stack overflow when matching long lines. Removed verifying path and interface from add_interface method because both are verified in sd_bus_add_object_vtable function. Checking return code of sd_bus_add_object_vtable is covered in 017a19da5f67a74daedf4d63111569902d4764e6 commit thanks to Waqar Hameed <waqarh@axis.com>.
Tested: - Added new path longer than 1024 signs with success - Verified if add_interface return invalid argument on invalid path and interface
Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com> Change-Id: I11481fa724f04ae441e5d247a120882b272b3b6e
show more ...
|
dbfb9679 | 11-Sep-2020 |
Patrick Williams <patrick@stwcx.xyz> |
native_types: add != comparison for string_wrapper
If a 'type: path' is added to a sdbus++ interface YAML file, the resulting code does not compile due to a missing != comparison operator for string
native_types: add != comparison for string_wrapper
If a 'type: path' is added to a sdbus++ interface YAML file, the resulting code does not compile due to a missing != comparison operator for string_wrapper. Add it and enhance the test case to cover.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Iaa661a15e58a99e4e816c391152926e9af1a8339
show more ...
|
2be0e173 | 27-Jul-2020 |
Krzysztof Grobelny <krzysztof.grobelny@intel.com> |
Added flags parameter to register_property method
- flags parameter is set by default to vtable::property_::emits_change - with this change user can set parameter to vtable::property_::none to avo
Added flags parameter to register_property method
- flags parameter is set by default to vtable::property_::emits_change - with this change user can set parameter to vtable::property_::none to avoid sending property change signal for greater performance - added example/register-property.cpp with example application which uses new functions
Tested: - run openbmc tests with this change, no regression detected - tested that default behaviour (property_::emits_change) is working as intended - tested that properties still signal change when emit_change flag is used - tested that properties doesn't signal change when no emit_change flag is used - tested that const flag is passed and handled corretly - verified that performance of application increases when emit_change flag turned off
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Change-Id: If6187cf076b8e05a5211c83797374a3be94da0c9
show more ...
|
38ab5ecf | 17-Aug-2020 |
Ed Tanous <ed@tanous.net> |
Refine include headers
sdbusplus #includes all of asio.hpp, which causes every single consumer compile all of asio, just to throw it away afterward. This is wasteful.
This commit changes sdbusplus
Refine include headers
sdbusplus #includes all of asio.hpp, which causes every single consumer compile all of asio, just to throw it away afterward. This is wasteful.
This commit changes sdbusplus to only include the components that it uses, and (hopefully) decrease the overall project compile times by a bit.
This commit requires: https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-net-ipmid/+/35718 https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-host-ipmid/+/35719 https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-objmgr/+/35720
Before the project as a whole will build.
Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: Id6372de936cd2562ff3c96f19f632ccfaa21c14e
show more ...
|
72f24b07 | 14-Jul-2020 |
Vernon Mauery <vernon.mauery@linux.intel.com> |
fix interface and path patterns to match D-Bus specification
The old regex checks did not account for all the requirements, namely empty paths and two-part names.
Tested: This rejects poorly-named
fix interface and path patterns to match D-Bus specification
The old regex checks did not account for all the requirements, namely empty paths and two-part names.
Tested: This rejects poorly-named interfaces and paths as expected. Tested interfaces: "" "xyz.openbmc_project.some-interface" "xyz.openbmc_project.some/interface" "bob" Tested paths: "" "/xyz/openbmc_project/some-interface" "/xyz/openbmc_project/some.interface" "xyz/openbmc_project/some/interface" "bob"
Change-Id: I3d8979c9eb19680c66a5031efd334a574f8f7be3 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
show more ...
|
0f19c872 | 26-Jun-2020 |
Zhikui Ren <zhikui.ren@intel.com> |
Add new_signal and extend set_property methods to dbus_interface
new_signal exports the same member function of sdbusplus::server::interface
extend set_property to be able to return true only when
Add new_signal and extend set_property methods to dbus_interface
new_signal exports the same member function of sdbusplus::server::interface
extend set_property to be able to return true only when the property value is changed. default behavior remains unchanged - returns true when property is updated successfully, value may be same or changed.
With these two functions, dbus_interface can broadcast new signal when a property is changed. This allows a customized message to be sent when a property changes.
Tested: Build test code to use the two new method to create and send new_signal when a property is changed.
Signed-off-by: Zhikui Ren <zhikui.ren@intel.com> Change-Id: I1815885bc77aad2c526b402f1386d4914479e738
show more ...
|
f534ba04 | 25-Jun-2020 |
William A. Kennington III <wak@google.com> |
message: Add method_error creation from exception
We currently only support creating methods from a unix errno and description. This allows us to create error return messages directly from sdbusplus
message: Add method_error creation from exception
We currently only support creating methods from a unix errno and description. This allows us to create error return messages directly from sdbusplus exceptions that internally provide the required name and description.
Change-Id: I4db91b191e13ba78e7796312d018d3d08d2c8aed Signed-off-by: William A. Kennington III <wak@google.com>
show more ...
|
b98bdc6f | 16-Jun-2020 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: add support for 'set'
Add 'set' as a supported type to `sdbus++` and set as `std::set`. The use of ordered-set is to match 'dict' as `std::map` and because 'struct' is `std::tuple`, which h
sdbus++: add support for 'set'
Add 'set' as a supported type to `sdbus++` and set as `std::set`. The use of ordered-set is to match 'dict' as `std::map` and because 'struct' is `std::tuple`, which has `operator<=>` but not `std::hash`. This ensures better compatiblilty with possible property type choices by users.
Also, add a few test cases to ensure `std::set` and `std::unordered_set` are well-covered.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I59605db1b22d54f783d807eda1e1ec1f9eb6792f
show more ...
|
fb0366b5 | 09-Jun-2020 |
Patrick Williams <patrick@stwcx.xyz> |
asio: object_server: remove invalid root interface
Right now a trivial snippet of code will throw an exception: ``` boost::asio::io_service io; auto systemBus = std::make_shared<sdbusplus::a
asio: object_server: remove invalid root interface
Right now a trivial snippet of code will throw an exception: ``` boost::asio::io_service io; auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
systemBus->request_name(this_name); sdbusplus::asio::object_server objectServer(systemBus); ```
In commit 017a19da, code was added to detect the return code from `sd_bus_add_object_vtable` and turn it into an exception. It turns out that our existing `asio::object_server` is triggering this exception itself.
I traced the issue down to the empty-named interface being added into the / path by `asio::object_server`: ``` auto root = add_interface("/", ""); ```
Empty interface names are invalid and thus this gives us an error from `sd_bus_add_object_vtable`. I cannot tell the history or rationale on this code, because it has been around from the beginning, but I suspect at one point if we didn't have _some_ object we also did not get an `ObjectManager` interface. I deleted this code now and confirmed we do still get an `ObjectManager`.
``` $ busctl --user tree xyz.openbmc_project.sdbusplus.test.Aio Only root object discovered. $ busctl --user introspect xyz.openbmc_project.sdbusplus.test.Aio / | grep interface org.freedesktop.DBus.Introspectable interface - - - org.freedesktop.DBus.ObjectManager interface - - - org.freedesktop.DBus.Peer interface - - - org.freedesktop.DBus.Properties interface - - - ```
Since we still get an `ObjectManager` and this code likely hasn't worked for quite a while, but was silently ignoring the error from sd-bus, I think we are safe to remove it.
Reported-by: Andrew Geissler <geissonator@yahoo.com> Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I989ae218a882bc2e45594cb380d318e6a8f0f17e
show more ...
|
da0b3f13 | 27-Mar-2020 |
Konrad Sztyber <konrad.sztyber@intel.com> |
sdbusplus: settable timeout value for async_method_call
Added extra method, asio::connection::async_method_call_timed allowing the user to specify the value of the timeout to be used for that call (
sdbusplus: settable timeout value for async_method_call
Added extra method, asio::connection::async_method_call_timed allowing the user to specify the value of the timeout to be used for that call (in microseconds). Using 0 as the timeout results in using the default value, which is equivalent to calling asio::connection::async_method_call.
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com> Change-Id: Id79772e46a77f62af5b39ec341648e34af6aaf99
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 ...
|