mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof: propagate devices to processinfo
We need access to this from the process info but can share the instance. It sucks to walk the hashtable here, but the alternative is to make these recursive so that we can check a parent mount namespace. Until then, take the hit and iterate all the pids to populate them with the additional device. Related GNOME/gnome-builder#2090
This commit is contained in:
@ -580,6 +580,7 @@ sysprof_document_load_mounts (SysprofDocument *self)
|
||||
g_autoptr(SysprofDocumentFile) file = NULL;
|
||||
g_autoptr(GBytes) bytes = NULL;
|
||||
LineReader reader;
|
||||
GHashTableIter iter;
|
||||
const char *contents;
|
||||
gsize contents_len;
|
||||
gsize line_len;
|
||||
@ -599,6 +600,8 @@ sysprof_document_load_mounts (SysprofDocument *self)
|
||||
line_reader_init (&reader, (char *)contents, contents_len);
|
||||
while ((line = line_reader_next (&reader, &line_len)))
|
||||
{
|
||||
g_autoptr(SysprofMountDevice) mount_device = NULL;
|
||||
SysprofProcessInfo *process_info = NULL;
|
||||
g_autofree char *subvol = NULL;
|
||||
g_auto(GStrv) parts = NULL;
|
||||
const char *filesystem;
|
||||
@ -641,10 +644,17 @@ sysprof_document_load_mounts (SysprofDocument *self)
|
||||
}
|
||||
}
|
||||
|
||||
sysprof_mount_namespace_add_device (self->mount_namespace,
|
||||
sysprof_mount_device_new (sysprof_strings_get (self->strings, device),
|
||||
sysprof_strings_get (self->strings, mountpoint),
|
||||
sysprof_strings_get (self->strings, subvol)));
|
||||
mount_device =
|
||||
sysprof_mount_device_new (sysprof_strings_get (self->strings, device),
|
||||
sysprof_strings_get (self->strings, mountpoint),
|
||||
sysprof_strings_get (self->strings, subvol));
|
||||
|
||||
g_hash_table_iter_init (&iter, self->pid_to_process_info);
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&process_info))
|
||||
sysprof_mount_namespace_add_device (process_info->mount_namespace,
|
||||
g_object_ref (mount_device));
|
||||
|
||||
sysprof_mount_namespace_add_device (self->mount_namespace, g_object_ref (mount_device));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user