Provide an accessor function liveupdate_session_name() to retrieve the name of a live update session from its session handle.
This allows kernel subsystems like CPU preservation to identify the session managing preserved resources. Signed-off-by: Pasha Tatashin <[email protected]> --- include/linux/liveupdate.h | 6 ++++++ kernel/liveupdate/luo_session.c | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/linux/liveupdate.h b/include/linux/liveupdate.h index 6051abc0612c..119ad0f82705 100644 --- a/include/linux/liveupdate.h +++ b/include/linux/liveupdate.h @@ -256,6 +256,7 @@ int liveupdate_get_file_incoming(struct liveupdate_session *s, u64 token, /* Get a token for an outgoing file, or -ENOENT if file is not preserved */ int liveupdate_get_token_outgoing(struct liveupdate_session *s, struct file *file, u64 *tokenp); +const char *liveupdate_session_name(struct liveupdate_session *s); #else /* CONFIG_LIVEUPDATE */ @@ -321,5 +322,10 @@ static inline int liveupdate_get_token_outgoing(struct liveupdate_session *s, return -EOPNOTSUPP; } +static inline const char *liveupdate_session_name(struct liveupdate_session *s) +{ + return NULL; +} + #endif /* CONFIG_LIVEUPDATE */ #endif /* _LINUX_LIVEUPDATE_H */ diff --git a/kernel/liveupdate/luo_session.c b/kernel/liveupdate/luo_session.c index f48e9a4185f9..3c4f195d375d 100644 --- a/kernel/liveupdate/luo_session.c +++ b/kernel/liveupdate/luo_session.c @@ -683,3 +683,17 @@ int luo_session_serialize(void) return err; } + +/** + * liveupdate_session_name - Get the name of a liveupdate session + * @s: Live update session pointer. + * + * Return: Pointer to session name string. + */ +const char *liveupdate_session_name(struct liveupdate_session *s) +{ + struct luo_session *session = (struct luo_session *)s; + + return session->name; +} +EXPORT_SYMBOL_GPL(liveupdate_session_name); -- 2.55.0.1082.g2b9226bbc0-goog

