1
1
# Requirements and Expectations for dbus interfaces
2
2
3
- This document outlines requirements and expectations for dbus interfaces.
4
- These are usually specified as requirements due to our dbus architecture
5
- or for consistency in implementations.
3
+ This document outlines requirements and expectations for dbus interfaces. These
4
+ are usually specified as requirements due to our dbus architecture or for
5
+ consistency in implementations.
6
6
7
7
## General
8
8
@@ -13,30 +13,32 @@ unless there is a strong basis for it (usually driven by hardware or another
13
13
protocol's specification).
14
14
15
15
For countable entities always prefer ` size ` , which are an sdbusplus implemented
16
- type that maps to the C equivalent of ` size_t ` on the architecture. For
16
+ type that maps to the C equivalent of ` size_t ` on the architecture. For
17
17
non-countable values prefer ` uint64 ` or ` int64 ` .
18
18
19
19
### Avoid use of arbitrary strings
20
20
21
- Arbitrary strings should only be utilized for human consumption and never
22
- parsed by code. Any arbitrary string is typically expected to have a
23
- description such as "... can be shown in user interfaces but this field should
24
- not be used for any programmatic interrogation of an object".
21
+ Arbitrary strings should only be utilized for human consumption and never parsed
22
+ by code. Any arbitrary string is typically expected to have a description such
23
+ as "... can be shown in user interfaces but this field should not be used for
24
+ any programmatic interrogation of an object".
25
25
26
26
### Leverage enumerations instead of strings or magic values
27
27
28
- The sdbusplus implementation has built-in support for enumerations, which
29
- flow across the dbus as uniquely encoded string values but has support in the
28
+ The sdbusplus implementation has built-in support for enumerations, which flow
29
+ across the dbus as uniquely encoded string values but has support in the
30
30
bindings for automatically converting to a C++ enum type.
31
31
32
32
In some cases it is useful to have hardware-specific or OEM values for
33
- enumerations. In those cases a property may be a string, but should specify
34
- that the values contained within are to be sdbusplus-enumerations of a specific
35
- pattern. See the [ software compatiblity] [ software-compat ] and
36
- [ dump interface] [ dump-interface ] as two current examples of this.
33
+ enumerations. In those cases a property may be a string, but should specify that
34
+ the values contained within are to be sdbusplus-enumerations of a specific
35
+ pattern. See the [ software compatiblity] [ software-compat ] and [ dump
36
+ interface] [ dump-interface ] as two current examples of this.
37
37
38
- [ software-compat ] : https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Software/README.md#compatibility
39
- [ dump-interface ] : https://github.com/openbmc/phosphor-dbus-interfaces/blob/991b2b8bdbc950f2a85aebfc29d1b34ea3264686/yaml/xyz/openbmc_project/Dump/Create.interface.yaml#L25
38
+ [ software-compat] :
39
+ https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Software/README.md#compatibility
40
+ [ dump-interface] :
41
+ https://github.com/openbmc/phosphor-dbus-interfaces/blob/991b2b8bdbc950f2a85aebfc29d1b34ea3264686/yaml/xyz/openbmc_project/Dump/Create.interface.yaml#L25
40
42
41
43
## Interfaces
42
44
@@ -58,24 +60,24 @@ required to be represented in different dbus path hierarchies due to some
58
60
overriding aspect of the dbus design.
59
61
60
62
Directed associations are more common and are used to show a relationship
61
- between two different entities. Though it may at times feel contrived,
62
- directed associations should be considered to have a "primary" and "secondary"
63
- end, which helps establish a pattern for naming consistency. For example, a
64
- chassis might be "containing" (primary) any number of other inventory objects
65
- which are "contained_by" (secondary) the chassis.
63
+ between two different entities. Though it may at times feel contrived, directed
64
+ associations should be considered to have a "primary" and "secondary" end, which
65
+ helps establish a pattern for naming consistency. For example, a chassis might
66
+ be "containing" (primary) any number of other inventory objects which are
67
+ "contained_by" (secondary) the chassis.
66
68
67
69
### Peer associations should be named with hierarchy names
68
70
69
71
Consider an entity which is contained at ` /.../foo/entity ` and
70
- ` /.../bar/entity ` . The association is what links the ` foo ` and ` bar ` aspects
71
- of the entity in the dbus path hierarchy. Accordingly, the association should
72
- be named with end-points "foo" and "bar".
72
+ ` /.../bar/entity ` . The association is what links the ` foo ` and ` bar ` aspects of
73
+ the entity in the dbus path hierarchy. Accordingly, the association should be
74
+ named with end-points "foo" and "bar".
73
75
74
76
A made-up example of a peer association might be a ` Inventory.Processor ` ,
75
77
located under the ` .../inventory ` hierarchy, and a ` Control.Power.Cap ` for that
76
- processor, located under the ` .../control ` hierarchy. The peer association
77
- allows traversal between the ` inventory ` and ` control ` namespaces for the
78
- single Processor entity.
78
+ processor, located under the ` .../control ` hierarchy. The peer association
79
+ allows traversal between the ` inventory ` and ` control ` namespaces for the single
80
+ Processor entity.
79
81
80
82
### Directed associations should not codify type
81
83
@@ -91,8 +93,8 @@ The primary relationship should be a verb with a Present Participle tense
91
93
(ending in '-ing'). The secondary relationship should be a verb with a Past
92
94
Participle tense (typically ending in '-ed').
93
95
94
- The association end-points should be named in a way that the following
95
- sentences are grammatically correct:
96
+ The association end-points should be named in a way that the following sentences
97
+ are grammatically correct:
96
98
97
99
- The ` {primary element} ` is ` {primary association} ` the ` {secondary element} ` .
98
100
- The ` {secondary element} ` is ` {secondary association} ` the
0 commit comments