ae0a8384 | 17-Nov-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: improve bad enum diagnostics
When unpacking an event from JSON, if a bad enum value was given a generic STL exception resulted:
``` terminate called after throwing an instance of '
sdbus++: events: improve bad enum diagnostics
When unpacking an event from JSON, if a bad enum value was given a generic STL exception resulted:
``` terminate called after throwing an instance of 'std::bad_optional_access' ```
Improve this by using the sdbusplus `InvalidEnumString` exception: ``` terminate called after throwing an instance of 'sdbusplus::exception::InvalidEnumString' ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I746f7265c8cf97e9a123915a123a4749d31e560c
show more ...
|
fe1ebd43 | 09-Nov-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: add object_path include
Event metadata often includes object_path. Add the header file into the generated events.hpp files.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Cha
sdbus++: events: add object_path include
Event metadata often includes object_path. Add the header file into the generated events.hpp files.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ia3da51483d25c6f65e6bcf977d47f65d59a37748
show more ...
|
17e54abc | 06-Nov-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: adjust schema for metadata
Switch the preferred format of metadata from SNAKE_CASE to CamelCase. This has no affect on the metadata names in the phosphor-logging object as those wil
sdbus++: events: adjust schema for metadata
Switch the preferred format of metadata from SNAKE_CASE to CamelCase. This has no affect on the metadata names in the phosphor-logging object as those will still be generated as SNAKE_CASE.
SNAKE_CASE is a lossy format. Consider `BMC_ADDRESS`; it cannot be identified if BMC is an acronym or a word. Our conversion functions will convert this to `bmcaddress` when becoming a camelCase format since there is special handling for acronyms and this will appear equivalent to an acronym.
All of the generators for events are explicit to use `foo.camelCase` or `foo.SNAKE_CASE` as appropriate, so switching to CamelCase has little effect. The primary thing it does is make the event class member variables named sanely: `numberOfLogs` rather than `numberoflogs`.
This will require a minor edit to the few events that are defined in phosphor-dbus-interfaces already, which will be done at the same time.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I10310986b9214aec99a3c7eabecf55f7054cdad0
show more ...
|
b08d14dd | 05-Nov-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: unpack an event from JSON
Generate code necessary to unpack a generated event from its JSON representation.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I7a28617f
sdbus++: events: unpack an event from JSON
Generate code necessary to unpack a generated event from its JSON representation.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I7a28617f3f0374968609328a44587b655a9141c1
show more ...
|
1800045e | 01-Nov-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: schema: explicitly prohibit unspecified properties
Modify the schema so that properties that do not belong are called out as a schema violation. It was easy for someone to accident
sdbus++: events: schema: explicitly prohibit unspecified properties
Modify the schema so that properties that do not belong are called out as a schema violation. It was easy for someone to accidentally add 'severity' on events, which should only be specified on errors. Adding it to the schema to prohibit makes it clearer what the expectations are.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I3decce5cddce2ce7215f7351339157a2597fdb0b
show more ...
|
7ffcdaac | 30-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: add source location and pid
Add the source code location and process ID to the generated events, which are useful for debug.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Cha
sdbus++: events: add source location and pid
Add the source code location and process ID to the generated events, which are useful for debug.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Iefaab6becc13292e1cd7835d97c6b3cc61a52776
show more ...
|
3b54a8e5 | 25-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: simplify handling of empty parameter lists
Add a template specialization of the type-tuple generation for empty parameter lists in order to simplify the Mako templates. This eliminates a sp
sdbus++: simplify handling of empty parameter lists
Add a template specialization of the type-tuple generation for empty parameter lists in order to simplify the Mako templates. This eliminates a special case for empty parameter lists in multiple places.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I7ca8d962ab1c7a65e0ad6d80ece1cd7e3847f2c6
show more ...
|
7377a0bf | 25-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: async: handle zero parameter signals
Adding a zero parameter signal results in the following compile failure:
``` ../include/sdbusplus/message/types.hpp: In instantiation of ‘constexpr aut
sdbus++: async: handle zero parameter signals
Adding a zero parameter signal results in the following compile failure:
``` ../include/sdbusplus/message/types.hpp: In instantiation of ‘constexpr auto sdbusplus::message::types::type_id() [with Args = {}]’: example/gen/net/poettering/Calculator/aserver.hpp:372:58: required from here ../include/sdbusplus/message/types.hpp:302:72: error: no matching function for call to ‘type_id_multiple<>()’ ```
Fix this by reusing logic from the non-async code to special case zero parameter length signals.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I0cde8810dfaf15afa2033a4c6699fb264facb9e8
show more ...
|
578b9733 | 11-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
bus: add error handling for bus-open calls
sd-bus can return ENOMEDIUM in some cases for bus-open calls, so we need to detect this condition rather than blindly ignoring the return value. Add appro
bus: add error handling for bus-open calls
sd-bus can return ENOMEDIUM in some cases for bus-open calls, so we need to detect this condition rather than blindly ignoring the return value. Add appropriate error handling.
Tested: ``` $ sudo builddir/example/calculator-server Password: terminate called after throwing an instance of 'sdbusplus::exception::SdBusError' what(): sdbusplus::bus::bus sdbusplus::bus::new_default(): System.Error.ENOMEDIUM: No medium found zsh: IOT instruction sudo builddir/example/calculator-server ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I7b82a9e182f21a1cbbb80fc3dbfeaaa0174a369d
show more ...
|
fc0bb996 | 11-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
bus: un-inline functions
Due to additional upstream error results, the bus creation functions need better error handling. This will result in larger functions that are no longer a direct sd-bus cal
bus: un-inline functions
Due to additional upstream error results, the bus creation functions need better error handling. This will result in larger functions that are no longer a direct sd-bus call and probably shouldn't be inlined. Move the functions to the `bus.cpp` file.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: If141ef74a62fd04b3bbf58b0720da2a9410481a7
show more ...
|
4b3720f8 | 10-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
async: context: use new_bus by default
There are two primary methods for creating a generic bus: * new_default * new_bus
The "default" methods use TLS to get a shared bus for the thread. Thi
async: context: use new_bus by default
There are two primary methods for creating a generic bus: * new_default * new_bus
The "default" methods use TLS to get a shared bus for the thread. This is likely not the desired bus to use for async operations because:
1. Currently a separate thread is used for the message processing. 2. Some existing synchronous code throughout openbmc uses `new_default` instead of referencing an existing bus, which could interfere with the async context.
Switch to using `new_bus` by default to ensure we get a fresh, unused and unshared bus in the typical case.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I1fd27de7bce9a8737294a5ab8e63e0dbe1afc8c3
show more ...
|
c012fde4 | 07-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
events: add severity to class generation
Use the severity field to add to the class generation for use by phosphor-logging to commit entries.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Cha
events: add severity to class generation
Use the severity field to add to the class generation for use by phosphor-logging to commit entries.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I82bb8482c0f95435275fb3a1fcdcb37bd29fc7ec
show more ...
|
760adffd | 05-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
events: add non-template base class
In order to allow non-template implementations that interact with the `sdbusplus::excception::generated_event<T>` class, it is useful to have a non-template base
events: add non-template base class
In order to allow non-template implementations that interact with the `sdbusplus::excception::generated_event<T>` class, it is useful to have a non-template base class. Add the `to_json` there for use by phosphor-logging.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ibed2c7c4fc0e23f1c82c4c003e16a6f438f7e68f
show more ...
|
f5b39215 | 03-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: add description for metadata
It is useful to document the purpose of a metadata field. Add it to the schema and make it required.
Signed-off-by: Patrick Williams <patrick@stwcx.xy
sdbus++: events: add description for metadata
It is useful to document the purpose of a metadata field. Add it to the schema and make it required.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I88f994a6004583bef586c86091dfff0c18d2bddf
show more ...
|
9213e158 | 03-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: fix for event-only YAML
If an event YAML file only had events and not errors, nothing would get generated. This was due to the wrong variable being checked for empty (error vs even
sdbus++: events: fix for event-only YAML
If an event YAML file only had events and not errors, nothing would get generated. This was due to the wrong variable being checked for empty (error vs event).
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I4fef5bd7b70b13e56682dce758a07f548005f549
show more ...
|
00fd0a8b | 24-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: use sd_bus_error_add_map to register
Register errors with `sd_bus_error_add_map` so that `errno` translation is handled appropriately.
Signed-off-by: Patrick Williams <patrick@stwc
sdbus++: events: use sd_bus_error_add_map to register
Register errors with `sd_bus_error_add_map` so that `errno` translation is handled appropriately.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I61e0cbed239a44842c6ea598904ac4411e195588
show more ...
|
14c4797c | 24-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: create json for events
Create JSON for the events containing their metadata and leverage that as the "message" portion of the `sd_bus_error`. This will allow unpacking the message
sdbus++: events: create json for events
Create JSON for the events containing their metadata and leverage that as the "message" portion of the `sd_bus_error`. This will allow unpacking the message on a client side back to the original exception.
Tested: ``` $ busctl --user call net.poettering.Calculator /net/poettering/calculator net.poettering.Calculator Divide xx 5 0 Call failed: {"net.poettering.Calculator.DivisionByZero":{"FOO":"unused"}} ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I4edd76d983267f28e51c4aa41902d45f5d6da793
show more ...
|
a4bfefde | 24-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
exception: move sd_bus_error_set calls to exception
In the future, generated exceptions will need to fill the sd_error with something other than the "description" in order to pass more metadata. Mo
exception: move sd_bus_error_set calls to exception
In the future, generated exceptions will need to fill the sd_error with something other than the "description" in order to pass more metadata. Move the sd_bus_error_set calls to exception as a virtual function so this can be accomplished.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I6e6947e4977701a8e7e27fef119bd35e837d866b
show more ...
|
ebe01794 | 24-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: simplify constructor
Consolidate consteval_string usage to simplify the generated code.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I6340eb369c117bb580a128e53381
sdbus++: events: simplify constructor
Consolidate consteval_string usage to simplify the generated code.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I6340eb369c117bb580a128e5338113a4b38a0f80
show more ...
|
d925c0bc | 23-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: generate exception constructors
Generate constructors for exceptions using the listed metadata.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I99dc912e4ad0746a14d3
sdbus++: events: generate exception constructors
Generate constructors for exceptions using the listed metadata.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I99dc912e4ad0746a14d3053a5653327ae12440dd
show more ...
|
0ac157a0 | 23-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++-gen-meson: fix [more] meson dependencies
As a follow on to 5800d07910384ffad8409515bc510812e4f34334, additional cases were noticed where the meson dependencies are not correctly updated when
sdbus++-gen-meson: fix [more] meson dependencies
As a follow on to 5800d07910384ffad8409515bc510812e4f34334, additional cases were noticed where the meson dependencies are not correctly updated when multiple YAML files are used (such as interfaces and events).
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ie47bc156c2b3954d3c47c9d07a2e106d7cc87c63
show more ...
|
093034c9 | 23-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: handle redfish-mapping events
Handle loading events with redfish-mapping without crashing.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I4140e948d938c775e52d41ec6
sdbus++: events: handle redfish-mapping events
Handle loading events with redfish-mapping without crashing.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I4140e948d938c775e52d41ec65793a70364ab831
show more ...
|
8bde6c7f | 23-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: specify redfish-mapping in schema
Redfish events are expected to conform to a specific format and our YAML format should omit the version identifiers (since we'll always be using th
sdbus++: events: specify redfish-mapping in schema
Redfish events are expected to conform to a specific format and our YAML format should omit the version identifiers (since we'll always be using the most recent Redfish event registry, which may be newer than the event YAML). Add this information to the schema for validation.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Id0c4eaab605f7230fe89670c06d0984e10db51a1
show more ...
|
e44f194c | 17-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
example: remove Calculator.errors.yaml
Example is moved to use the new event framework so there is no need for this YAML.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I1ce615c6956
example: remove Calculator.errors.yaml
Example is moved to use the new event framework so there is no need for this YAML.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I1ce615c695646bd97f8c9d87c2c64a70a62adf14
show more ...
|
d731d263 | 17-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: create event classes
Generate an equivalent amount of exception class as the `errors.yaml` supported and convert the examples to use it.
Tested:
``` ‣ Type=error Endian=l Flags=
sdbus++: events: create event classes
Generate an equivalent amount of exception class as the `errors.yaml` supported and convert the examples to use it.
Tested:
``` ‣ Type=error Endian=l Flags=1 Version=1 Cookie=9 ReplyCookie=2 Timestamp="Tue 2024-09-17 18:21:35.649674 UTC" Sender=:1.2489 Destination=:1.2495 ErrorName=net.poettering.Calculator.DivisionByZero ErrorMessage="Attempted to divide by zero." UniqueName=:1.2489 MESSAGE "s" { STRING "Attempted to divide by zero."; }; ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I4b2671838639d1e8be1ccdf655b699a98b9c2116
show more ...
|