This source file includes following definitions.
- opal_patcher_base_select
- opal_patcher_base_close
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 #include "opal_config.h"
  13 
  14 #include "opal/mca/patcher/patcher.h"
  15 #include "opal/mca/patcher/base/base.h"
  16 #include "opal/mca/patcher/base/static-components.h"
  17 
  18 
  19 
  20 
  21 static mca_patcher_base_module_t empty_module;
  22 
  23 
  24 
  25 
  26 mca_patcher_base_module_t *opal_patcher = &empty_module;
  27 
  28 int opal_patcher_base_select (void)
  29 {
  30     mca_patcher_base_module_t *best_module;
  31     mca_patcher_base_component_t *best_component;
  32     int rc, priority;
  33 
  34     rc = mca_base_select ("patcher", opal_patcher_base_framework.framework_output,
  35                           &opal_patcher_base_framework.framework_components,
  36                           (mca_base_module_t **) &best_module, (mca_base_component_t **) &best_component,
  37                           &priority);
  38     if (OPAL_SUCCESS != rc) {
  39         return rc;
  40     }
  41 
  42     OBJ_CONSTRUCT(&best_module->patch_list, opal_list_t);
  43     OBJ_CONSTRUCT(&best_module->patch_list_mutex, opal_mutex_t);
  44 
  45     if (best_module->patch_init) {
  46         rc = best_module->patch_init ();
  47         if (OPAL_SUCCESS != rc) {
  48             return rc;
  49         }
  50     }
  51 
  52     opal_patcher = best_module;
  53 
  54     return OPAL_SUCCESS;
  55 }
  56 
  57 static int opal_patcher_base_close (void)
  58 {
  59     if (opal_patcher == &empty_module) {
  60         return OPAL_SUCCESS;
  61     }
  62 
  63     mca_patcher_base_patch_t *patch;
  64     OPAL_LIST_FOREACH_REV(patch, &opal_patcher->patch_list, mca_patcher_base_patch_t) {
  65         patch->patch_restore (patch);
  66     }
  67 
  68     OPAL_LIST_DESTRUCT(&opal_patcher->patch_list);
  69     OBJ_DESTRUCT(&opal_patcher->patch_list_mutex);
  70 
  71     if (opal_patcher->patch_fini) {
  72         return opal_patcher->patch_fini ();
  73     }
  74 
  75     return OPAL_SUCCESS;
  76 }
  77 
  78 
  79 MCA_BASE_FRAMEWORK_DECLARE(opal, patcher, "runtime code patching", NULL, NULL,
  80                            opal_patcher_base_close, mca_patcher_base_static_components,
  81                            0);