This source file includes following definitions.
- empty_process
- empty_query
- opal_memory_base_malloc_init_hook
- opal_memory_base_open
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 
  19 
  20 
  21 
  22 
  23 
  24 
  25 
  26 #include "opal_config.h"
  27 
  28 #include "opal/constants.h"
  29 #include "opal/mca/mca.h"
  30 #include "opal/mca/base/base.h"
  31 #include "opal/mca/memory/memory.h"
  32 #include "opal/mca/memory/base/base.h"
  33 #include "opal/mca/memory/base/empty.h"
  34 
  35 
  36 
  37 
  38 
  39 
  40 
  41 #include "opal/mca/memory/base/static-components.h"
  42 
  43 static int empty_process(void)
  44 {
  45     return OPAL_SUCCESS;
  46 }
  47 
  48 static int empty_query (int *priority)
  49 {
  50     *priority = 0;
  51     return OPAL_SUCCESS;
  52 }
  53 
  54 
  55 
  56 
  57 static opal_memory_base_component_2_0_0_t empty_component = {
  58     
  59     .memoryc_query = empty_query,
  60     .memoryc_process = empty_process,
  61     .memoryc_register = opal_memory_base_component_register_empty,
  62     .memoryc_deregister = opal_memory_base_component_deregister_empty,
  63     .memoryc_set_alignment = opal_memory_base_component_set_alignment_empty,
  64 };
  65 
  66 
  67 
  68 
  69 
  70 opal_memory_base_component_2_0_0_t *opal_memory = &empty_component;
  71 
  72 
  73 void opal_memory_base_malloc_init_hook (void)
  74 {
  75     if (opal_memory->memoryc_init_hook) {
  76         opal_memory->memoryc_init_hook ();
  77     }
  78 }
  79 
  80 
  81 
  82 
  83 
  84 static int opal_memory_base_open(mca_base_open_flag_t flags)
  85 {
  86     mca_base_component_list_item_t *item, *next;
  87     opal_memory_base_component_2_0_0_t *tmp;
  88     int priority, highest_priority = 0;
  89     int ret;
  90 
  91     
  92     OPAL_LIST_FOREACH(item, &opal_memory_base_framework.framework_components, mca_base_component_list_item_t) {
  93         tmp = (opal_memory_base_component_2_0_0_t *) item->cli_component;
  94         ret = tmp->memoryc_query (&priority);
  95         if (OPAL_SUCCESS != ret || priority < highest_priority) {
  96             continue;
  97         }
  98 
  99         highest_priority = priority;
 100         opal_memory = tmp;
 101     }
 102 
 103     OPAL_LIST_FOREACH_SAFE(item, next, &opal_memory_base_framework.framework_components, mca_base_component_list_item_t) {
 104         if ((void *) opal_memory != (void *) item->cli_component) {
 105             mca_base_component_unload (item->cli_component, opal_memory_base_framework.framework_output);
 106             opal_list_remove_item (&opal_memory_base_framework.framework_components, &item->super);
 107         }
 108     }
 109 
 110     
 111     ret = mca_base_framework_components_open (&opal_memory_base_framework, flags);
 112     if (ret != OPAL_SUCCESS) {
 113         return ret;
 114     }
 115 
 116     
 117     return OPAL_SUCCESS;
 118 }
 119 
 120 
 121 MCA_BASE_FRAMEWORK_DECLARE(opal, memory, "memory hooks", NULL, opal_memory_base_open, NULL,
 122                            mca_memory_base_static_components, 0);