diff options
author | Leandro Pereira <leandro@hardinfo.org> | 2012-01-26 22:14:43 -0200 |
---|---|---|
committer | Leandro Pereira <leandro@hardinfo.org> | 2012-01-26 22:14:43 -0200 |
commit | d3b9aa19f04e6be78afb8497e7808a3d42042bf2 (patch) | |
tree | 340e9be8f863e1ad29e1da91cd87a66409d6f706 /modules/devices/storage.c | |
parent | d9e242117b7a73dd3057af25956027a361f7999f (diff) |
Better manage moreinfo hashes
Have only one for the whole program and use per-module namespaces/prefixes
so that each module can clear its own information easily.
Diffstat (limited to 'modules/devices/storage.c')
-rw-r--r-- | modules/devices/storage.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/modules/devices/storage.c b/modules/devices/storage.c index a9dfd665..3df6c765 100644 --- a/modules/devices/storage.c +++ b/modules/devices/storage.c @@ -23,12 +23,6 @@ gchar *storage_icons = NULL; -static gboolean -remove_scsi_devices(gpointer key, gpointer value, gpointer data) -{ - return g_str_has_prefix(key, "SCSI"); -} - /* SCSI support by Pascal F.Martin <pascalmartin@earthlink.net> */ void __scan_scsi_devices(void) @@ -44,7 +38,7 @@ __scan_scsi_devices(void) gchar *scsi_storage_list; /* remove old devices from global device table */ - g_hash_table_foreach_remove(moreinfo, remove_scsi_devices, NULL); + moreinfo_del_with_prefix("DEV:SCSI"); if (!g_file_test("/proc/scsi/scsi", G_FILE_TEST_EXISTS)) return; @@ -141,7 +135,8 @@ __scan_scsi_devices(void) scsi_channel, scsi_id, scsi_lun); - g_hash_table_insert(moreinfo, devid, strhash); + moreinfo_add_with_prefix("DEV", devid, strhash); + g_free(devid); g_free(model); g_free(revision); @@ -159,12 +154,6 @@ __scan_scsi_devices(void) } } -static gboolean -remove_ide_devices(gpointer key, gpointer value, gpointer data) -{ - return g_str_has_prefix(key, "IDE"); -} - void __scan_ide_devices(void) { @@ -175,7 +164,7 @@ __scan_ide_devices(void) gchar *capab = NULL, *speed = NULL, *driver = NULL, *ide_storage_list; /* remove old devices from global device table */ - g_hash_table_foreach_remove(moreinfo, remove_ide_devices, NULL); + moreinfo_del_with_prefix("DEV:IDE"); ide_storage_list = g_strdup("\n[IDE Disks]\n"); @@ -362,7 +351,8 @@ __scan_ide_devices(void) speed = NULL; } - g_hash_table_insert(moreinfo, devid, strhash); + moreinfo_add_with_prefix("DEV", devid, strhash); + g_free(devid); g_free(model); model = g_strdup(""); |