From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
Ahmad Fatoum <a.fatoum@barebox.org>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 00/44] commands: add bfetch/buds of command redirection
Date: Tue, 12 Aug 2025 13:23:40 +0200 [thread overview]
Message-ID: <5e2ad1d8-6049-409c-b048-99d58452747a@pengutronix.de> (raw)
In-Reply-To: <aJsXhGDeqQptV4Rh@pengutronix.de>
Hello Sascha,
On 12.08.25 12:29, Sascha Hauer wrote:
> On Mon, Aug 11, 2025 at 02:27:40PM +0200, Ahmad Fatoum wrote:
>> This series does exactly that. Device parameters are now associated
>> with a struct bobject and that bobject can be returned and consumed
>> by commands without requiring association with a device.
>>
>> This mechanism should be able to bring support for the pipe operator
>> to barebox' shell once the critical commands are adapted to use it and
>> there exists a way for commands to report whether they support
>> structured I/O or not. As I am still figuring out how to do that,
>> I did not include a command that captures structured output to
>> a variable, but that would follow in future.
>
> Very nice!
>
> How about something along the lines:
>
> struct device structio_device = {
> .name = "structio",
> .id = DEVICE_ID_SINGLE,
> };
bobjects already have a local flag. I think we should rather have a
bobject_export() that clears the flag on an existing object and makes
it available globally. Code will need to be adapted to loop through
global bobjects instead of devices.
Then there is the matter that:
- many commands return lists or a tree of objects (e.g. iomem,
clk_dump, findmnt), so structio should perhaps
- We will probably want an error bobject that not only holds an
error code, but also a message.
(Future teaser: Once we have support for bobject trees, every
structio command output can be trivially formatted as JSON
output for test suite consumption!)
> static int do_structio(int argc, char *argv[])
> {
> int ret;
>
> active_capture = &structio_device.bobject;
>
> bobject_del(active_capture);
>
> /* TODO: merge argv[1-x] to a single string */
> ret = run_command(argv[1]);
We have strjoin for that used in watch and time, but we should really
have a function that takes argv directly to avoid whitespace issues.
> static int structio_init(void)
> {
> return register_device(&structio_device);
> }
> late_initcall(structio_init);
I was thinking of a command that you pass in the variable name and the
bobject is exported using that name. That way you can call multiple
commands to collect the results and then operate on them.
Shell variable garbage collection should in this case take care to
free the bobjects.
That command would also check if structio is even supported for the
command to be executed and fail otherwise.
That's all future work though.
Cheers,
Ahmad
> BAREBOX_CMD_START(structio)
> .cmd = do_structio,
> BAREBOX_CMD_DESC("run with structio")
> BAREBOX_CMD_GROUP(CMD_GRP_INFO)
> BAREBOX_CMD_END
>
> With this you could do a
>
> structio cpuinfo; echo $structio.core
>
> We would have to replace characters like whitespaces and hyphens in the
> variablenames though.
>
> Sascha
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2025-08-12 16:21 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-11 12:27 Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 01/44] driver: move device name definition into device.h Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 02/44] driver: introduce common struct bobject Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 03/44] lib: param: rename dev_remove_param to param_remove Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 04/44] param: implement dev_remove_parameters using param_remove Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 05/44] lib: param: add dev_for_each_param helpers Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 06/44] driver: initialize device parameters as part of bobject Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 07/44] param: operate on bobjects instead of full devices Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 08/44] commands: version: print value of CONFIG_NAME Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 09/44] treewide: populate CONFIG_NAME for all configs in-tree Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 10/44] test: py: change barebox_config from set to dict Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 11/44] test: add heuristic for guessing labgrid environment YAML Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 12/44] usb: drop dead iSerialNumber parameter addition Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 13/44] drivers: use dev_add_param_uint32_fixed for IDs Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 14/44] param: make bobject_add_param_fixed variadic Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 15/44] param: handle NULL gracefully in bobject_get_param Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 16/44] common: introduce structured I/O Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 17/44] ARM: cpuinfo: support structio output Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 18/44] commands: uptime: enable structured I/O Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 19/44] string: implement strv_length helper Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 20/44] ARM: psci: client: add PSCI version/method parameters Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 21/44] net: move netmask_to_prefix into header Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 22/44] stringlist: implement string_list_empty Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 23/44] optee: add revision info to tee devinfo output Ahmad Fatoum
2025-08-12 9:35 ` Sascha Hauer
2025-08-12 9:44 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 24/44] tee: enable structured I/O in devinfo handler Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 25/44] mtd: add devices to new mtd class Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 26/44] nvmem: add devices to new nvmem class Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 27/44] nvmem: export functions to query NVMEM size Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 28/44] video: add devices to new fb class Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 29/44] security: blobgen: add easy way to check for existent providers Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 30/44] pmdomain: add easy way to check for provider support Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 31/44] bbu: add easy way to check for existent providers Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 32/44] firmware: " Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 33/44] rtc: export rtc_class in header Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 34/44] driver: featctrl: export of_feature_controllers Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 35/44] net: dsa: export dsa_switch_list Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 36/44] usb: export usb_host_list Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 37/44] pstore: export pstore_is_ready Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 38/44] pinctrl: export pinctrl_list Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 39/44] clk: implement clk_have_nonfixed_providers Ahmad Fatoum
2025-08-13 5:38 ` Sascha Hauer
2025-08-11 12:28 ` [PATCH 40/44] driver: bus: export get_bus_by_name Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 41/44] fimware: arm_scmi: export scmi_list Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 42/44] block: define BLK_TYPE_COUNT as last enum blk_type value Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 43/44] commands: introduce bfetch command Ahmad Fatoum
2025-08-12 10:39 ` Sascha Hauer
2025-08-12 11:09 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 44/44] configs: enable bfetch in some popular defconfigs Ahmad Fatoum
2025-08-12 10:29 ` [PATCH 00/44] commands: add bfetch/buds of command redirection Sascha Hauer
2025-08-12 11:23 ` Ahmad Fatoum [this message]
2025-08-13 5:48 ` (subset) " Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5e2ad1d8-6049-409c-b048-99d58452747a@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=a.fatoum@barebox.org \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox