LCOV - code coverage report
Current view: top level - mlops-agent-1.8.8/daemon - modules.c (source / functions) Coverage Total Hit
Test: ML-Agent 1.8.8-0 platform/core/ml/mlops-agent#7b658b7dd8532af4825478883945a4c388cff1b4 Lines: 0.0 % 26 0
Test Date: 2026-05-07 08:04:31 Functions: 0.0 % 4 0

            Line data    Source code
       1              : /* SPDX-License-Identifier: Apache-2.0 */
       2              : /**
       3              :  * Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
       4              :  *
       5              :  * @file    modules.c
       6              :  * @date    25 June 2022
       7              :  * @brief   Internal module utility header of Machine Learning agent daemon
       8              :  * @see     https://github.com/nnstreamer/deviceMLOps.MLAgent
       9              :  * @author  Sangjung Woo <sangjung.woo@samsung.com>
      10              :  * @bug     No known bugs except for NYI items
      11              :  */
      12              : 
      13              : #include <glib.h>
      14              : #include <stdio.h>
      15              : 
      16              : #include "common.h"
      17              : #include "modules.h"
      18              : #include "log.h"
      19              : 
      20              : static GList *module_head = NULL;
      21              : 
      22              : /**
      23              :  * @brief Add the specific DBus interface into the Machine Learning agent daemon.
      24              :  */
      25              : void
      26            0 : add_module (const struct module_ops *module)
      27              : {
      28            0 :   module_head = g_list_append (module_head, (gpointer) module);
      29            0 : }
      30              : 
      31              : /**
      32              :  * @brief Remove the specific DBus interface from the Machine Learning agent daemon.
      33              :  */
      34              : void
      35            0 : remove_module (const struct module_ops *module)
      36              : {
      37            0 :   module_head = g_list_remove (module_head, (gconstpointer) module);
      38            0 : }
      39              : 
      40              : /**
      41              :  * @brief Initialize all added modules by calling probe and init callback functions.
      42              :  */
      43              : void
      44            0 : init_modules (void *data)
      45              : {
      46              :   GList *elem, *elem_n;
      47              :   const struct module_ops *module;
      48              : 
      49            0 :   elem = module_head;
      50            0 :   while (elem != NULL) {
      51            0 :     module = elem->data;
      52            0 :     elem_n = elem->next;
      53              : 
      54            0 :     if (module->probe && module->probe (data) != 0) {
      55            0 :       ml_loge ("[%s] probe fail", module->name);
      56            0 :       module_head = g_list_remove (module_head, (gconstpointer) module);
      57            0 :       elem = elem_n;
      58            0 :       continue;
      59              :     }
      60              : 
      61            0 :     if (module->init)
      62            0 :       module->init (data);
      63            0 :     elem = elem_n;
      64              :   }
      65            0 : }
      66              : 
      67              : /**
      68              :  * @brief Clean up all added modules by calling the exit callback function.
      69              :  */
      70              : void
      71            0 : exit_modules (void *data)
      72              : {
      73              :   GList *elem;
      74              :   const struct module_ops *module;
      75              : 
      76            0 :   for (elem = module_head; elem != NULL; elem = elem->next) {
      77            0 :     module = elem->data;
      78            0 :     if (module->exit)
      79            0 :       module->exit (data);
      80              :   }
      81            0 : }
        

Generated by: LCOV version 2.0-1