From 46bafc541d829583c038f3c4183f3035123aa668 Mon Sep 17 00:00:00 2001 From: Suvendhu Hansa Date: Fri, 31 May 2024 16:54:50 +0530 Subject: [PATCH] Removed saving process instance --- libbbfdm/dmtree/tr181/deviceinfo.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/libbbfdm/dmtree/tr181/deviceinfo.c b/libbbfdm/dmtree/tr181/deviceinfo.c index 5af68561..6fe025e2 100644 --- a/libbbfdm/dmtree/tr181/deviceinfo.c +++ b/libbbfdm/dmtree/tr181/deviceinfo.c @@ -36,7 +36,6 @@ struct process_entry { char size[8]; char priority[8]; char cputime[8]; - int instance; }; typedef struct jiffy_counts_t { @@ -156,16 +155,6 @@ static char *get_proc_state(char state) return "Idle"; } -static int find_last_instance(void) -{ - if (!list_empty(&process_list)) { - struct process_entry *entry = list_last_entry(&process_list, struct process_entry, list); - return entry->instance + 1; - } else { - return 1; - } -} - static struct process_entry *check_entry_exists(const char *pid) { struct process_entry *entry = NULL; @@ -336,7 +325,6 @@ static void init_processes(void) if (!pentry) return; - pentry->instance = find_last_instance(); list_add_tail(&pentry->list, &process_list); } @@ -891,11 +879,12 @@ static int browseProcessEntriesInst(struct dmctx *dmctx, DMNODE *parent_node, vo { struct process_entry *entry = NULL; char *inst = NULL; + int id = 0; init_processes(); list_for_each_entry(entry, &process_list, list) { - inst = handle_instance_without_section(dmctx, parent_node, entry->instance); + inst = handle_instance_without_section(dmctx, parent_node, ++id); if (DM_LINK_INST_OBJ(dmctx, parent_node, entry, inst) == DM_STOP) break;