cleanup hostname list for filtering
[lttngtop.git] / src / common.c
index 021f2f1217b2316bd383e1a1ec146df492b70fd4..3d8fc4040880c9a4f4dfc95031eae7dc7bd28c74 100644 (file)
@@ -212,7 +212,7 @@ struct processtop* add_proc(struct lttngtop *ctx, int tid, char *comm,
                        free(newproc->hostname);
                }
                newproc->hostname = strdup(hostname);
-               if (lookup_hostname_list(hostname)) {
+               if (is_hostname_filtered(hostname)) {
                        add_filter_tid_list(tid, newproc);
                }
        }
@@ -236,7 +236,7 @@ struct processtop* update_proc(struct processtop* proc, int pid, int tid,
                }
                if (hostname && !proc->hostname) {
                        proc->hostname = strdup(hostname);
-                       if (lookup_hostname_list(hostname)) {
+                       if (is_hostname_filtered(hostname)) {
                                add_filter_tid_list(tid, proc);
                        }
                }
@@ -669,26 +669,28 @@ struct tm format_timestamp(uint64_t timestamp)
 
 int *lookup_tid_list(int tid)
 {
-       if (!tid_list)
+       if (!tid_filter_list)
                return NULL;
 
-       return g_hash_table_lookup(tid_list, (gpointer) &tid);
+       return g_hash_table_lookup(tid_filter_list, (gpointer) &tid);
 }
 
-char *lookup_hostname_list(const char *hostname)
+struct host *lookup_hostname_list(const char *hostname)
 {
-       if (!hostname || !hostname_list)
+       if (!hostname || !global_host_list)
                return NULL;
 
-       return g_hash_table_lookup(hostname_list, (gpointer) hostname);
+       return g_hash_table_lookup(global_host_list, (gpointer) hostname);
 }
 
-void remove_hostname_list(const char *hostname)
+int is_hostname_filtered(const char *hostname)
 {
-       if (!hostname || !hostname_list)
-               return;
+       struct host *host;
 
-       g_hash_table_remove(hostname_list, (gpointer) hostname);
+       host = lookup_hostname_list(hostname);
+       if (host)
+               return host->filter;
+       return 0;
 }
 
 int *lookup_filter_tid_list(int tid)
This page took 0.024856 seconds and 4 git commands to generate.