Re: [systemd-devel] sd-bus parameter names
Hi Lennart, all, On Sun, Jan 6, 2019 at 6:40 PM Lennart Poettering wrote: > > On Fr, 04.01.19 09:39, Giacinto Cifelli (gciof...@gmail.com) wrote: > > > Hi, > > > > I would like to give my DBus parameters names other than the default > > arg_X for the introspection. > > > > Is it ok if I post some commits to do that, or is the feature excluded > > by choice? > > It was excluded because the data is kinda redundant and I couldn't > come up with a sexy, convincing way how to denote this in the sources. > I have submitted my change, it has been reviewed (for the form), but not taken for merge. I don't want to be pushy, just I don't know if I need to do something more. And I was expecting some comments about the sexy part. None came, so I will give myself one. DBus uses for in/out parameters a single string each, but splits them for the introspectable interface (where the names are used). sd-bus takes the first path, more functional, and then splits the parameters internally for the XML declaration. Given that, a matching way to declare parameter names is using a 'concatenated' string and splitting it at the same time as the parameters themselves. I have taken this path. > > Adding this certainly makes, if you can come up with macro syntax that > makes this nice to read. I don't know if the macro names are appealing: I just added '_WITH_NAMES' ones, following the '_WITH_OFFSET' already in place. I would like a comment also on this. > > (I'd prefer if this would use \0 or so as separator though maybe, > given it sounds weird compiling in strings that the code first has to > parse, and if \0 is used as separator then things feel more > "pre-parsed" to me) submitted so, with \0 separators. > > Anyway, by all means, please prep a patch set and submit as PR, and we > can continue discussions there!y > > Lennart > Regards, Giacinto ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] sd-bus parameter names
On Fr, 04.01.19 09:39, Giacinto Cifelli (gciof...@gmail.com) wrote: > Hi, > > I would like to give my DBus parameters names other than the default > arg_X for the introspection. > > Is it ok if I post some commits to do that, or is the feature excluded > by choice? It was excluded because the data is kinda redundant and I couldn't come up with a sexy, convincing way how to denote this in the sources. > - additional macros for adding the name strings. > - processing of this additional information in bus-introspect.c, > changing the introspect_write_arguments: > static int introspect_write_arguments(struct introspect *i, > const char *signature, const char *direction, const char *names) > and related call in introspect_write_interface. Adding this certainly makes, if you can come up with macro syntax that makes this nice to read. (I'd prefer if this would use \0 or so as separator though maybe, given it sounds weird compiling in strings that the code first has to parse, and if \0 is used as separator then things feel more "pre-parsed" to me) Anyway, by all means, please prep a patch set and submit as PR, and we can continue discussions there!y Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] sd-bus parameter names
Hi, I would like to give my DBus parameters names other than the default arg_X for the introspection. Is it ok if I post some commits to do that, or is the feature excluded by choice? The changes I would propose are: - sd-bus-vtable.h: struct sd_bus_vtable extended like: struct sd_bus_vtable { /* Please do not initialize this structure directly, use the * macros below instead */ uint8_t type:8; uint64_t flags:56; union { struct { size_t element_size; } start; struct { const char *member; const char *signature; const char *in_names; const char *result; const char *out_names; sd_bus_message_handler_t handler; size_t offset; } method; struct { const char *member; const char *signature; const char *out_names; } signal; struct { const char *member; const char *signature; sd_bus_property_get_t get; sd_bus_property_set_t set; size_t offset; } property; } x; }; The names would be separated by spaces for ease of coding. If the list is too long, additional parameters are ignores, if too short, no name tag is given (hence backward compatibility). - additional macros for adding the name strings. - processing of this additional information in bus-introspect.c, changing the introspect_write_arguments: static int introspect_write_arguments(struct introspect *i, const char *signature, const char *direction, const char *names) and related call in introspect_write_interface. Thank you, Regards, Giacinto ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel