summaryrefslogtreecommitdiffstats
path: root/discover/sysinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'discover/sysinfo.c')
-rw-r--r--discover/sysinfo.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/discover/sysinfo.c b/discover/sysinfo.c
index 870e9a1..3c13277 100644
--- a/discover/sysinfo.c
+++ b/discover/sysinfo.c
@@ -53,6 +53,40 @@ void system_info_register_interface(unsigned int hwaddr_size, uint8_t *hwaddr,
discover_server_notify_system_info(server, sysinfo);
}
+void system_info_register_blockdev(const char *name, const char *uuid,
+ const char *mountpoint)
+{
+ struct blockdev_info *bd_info;
+ unsigned int i;
+
+ for (i = 0; i < sysinfo->n_blockdevs; i++) {
+ bd_info = sysinfo->blockdevs[i];
+
+ if (strcmp(bd_info->name, name))
+ continue;
+
+ /* update the mountpoint and UUID, and we're done */
+ talloc_free(bd_info->mountpoint);
+ bd_info->uuid = talloc_strdup(bd_info, uuid);
+ bd_info->mountpoint = talloc_strdup(bd_info, mountpoint);
+ discover_server_notify_system_info(server, sysinfo);
+ return;
+ }
+
+ bd_info = talloc_zero(sysinfo, struct blockdev_info);
+ bd_info->name = talloc_strdup(bd_info, name);
+ bd_info->uuid = talloc_strdup(bd_info, uuid);
+ bd_info->mountpoint = talloc_strdup(bd_info, mountpoint);
+
+ sysinfo->n_blockdevs++;
+ sysinfo->blockdevs = talloc_realloc(sysinfo, sysinfo->blockdevs,
+ struct blockdev_info *,
+ sysinfo->n_blockdevs);
+ sysinfo->blockdevs[sysinfo->n_blockdevs - 1] = bd_info;
+
+ discover_server_notify_system_info(server, sysinfo);
+}
+
static void system_info_set_identifier(struct system_info *info)
{
struct process *process;
OpenPOWER on IntegriCloud