MGMT: Add user data to mgmt_handler

RFC: #60616

Signed-off-by: Kuno Heltborg <kunoh@live.dk>
This commit is contained in:
Kuno Heltborg 2023-08-07 11:00:15 +02:00 committed by Fabio Baltieri
parent 326d8c79fe
commit 2d02cae964
3 changed files with 12 additions and 0 deletions

View File

@ -328,6 +328,9 @@ Libraries / Subsystems
* Added :kconfig:option:`CONFIG_MCUMGR_GRP_IMG_ALLOW_ERASE_PENDING` that allows
to erase slots pending for next boot, that are not revert slots.
* Added ``user_data`` as an optional field to :c:struct:`mgmt_handler` when
:kconfig:option:`CONFIG_MCUMGR_MGMT_HANDLER_USER_DATA` is enabled.
* File systems
* Added support for ext2 file system.

View File

@ -71,6 +71,9 @@ typedef int (*mgmt_handler_fn)(struct smp_streamer *ctxt);
struct mgmt_handler {
mgmt_handler_fn mh_read;
mgmt_handler_fn mh_write;
#if IS_ENABLED(CONFIG_MCUMGR_MGMT_HANDLER_USER_DATA)
void *user_data;
#endif
};
/**

View File

@ -25,3 +25,9 @@ config MCUMGR_MGMT_NOTIFICATION_HOOKS
or decline the current operation, by returning false this will signal to the calling
function that the request should be denied, for informal-only notifications or
acceptable, true must be returned by all the registered notification handlers.
config MCUMGR_MGMT_HANDLER_USER_DATA
bool "MCUmgr mgmt handler user data support"
help
This will add an extra field to the struct mgmt_handler that will allow a user
to pass user_data when the defined handler is called.