From 417265c68731537deeed22a3a3530cd6dd986513 Mon Sep 17 00:00:00 2001 From: Samuel Mendoza-Jonas Date: Thu, 23 Mar 2017 17:41:28 +1100 Subject: discover/sysinfo: Add system_info_reinit() Currently over reinit events the system info is not affected. However network and block device information can change over reinit, so clear this information. Signed-off-by: Samuel Mendoza-Jonas --- discover/sysinfo.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'discover/sysinfo.c') diff --git a/discover/sysinfo.c b/discover/sysinfo.c index 0ac29c1..e8e6d52 100644 --- a/discover/sysinfo.c +++ b/discover/sysinfo.c @@ -139,3 +139,21 @@ void system_info_init(struct discover_server *s) sysinfo = talloc_zero(server, struct system_info); platform_get_sysinfo(sysinfo); } + +/* Only reset device information. Platform information is static */ +void system_info_reinit(void) +{ + unsigned int i; + + for (i = 0; i < sysinfo->n_blockdevs; i++) + talloc_free(sysinfo->blockdevs[i]); + talloc_free(sysinfo->blockdevs); + sysinfo->blockdevs = NULL; + sysinfo->n_blockdevs = 0; + + for (i = 0; i < sysinfo->n_interfaces; i++) + talloc_free(sysinfo->interfaces[i]); + talloc_free(sysinfo->interfaces); + sysinfo->interfaces = NULL; + sysinfo->n_interfaces = 0; +} -- cgit v1.2.1