root/mpich2/trunk/src/pm/hydra/css/src/cssi_init.c.in @ 4887

Revision 4887, 1.3 KB (checked in by balaji, 5 months ago)

Warning stomp.

Line 
1/* -*- Mode: C; c-basic-offset:4 ; -*- */
2/*
3 *  (C) 2008 by Argonne National Laboratory.
4 *      See COPYRIGHT in top-level directory.
5 */
6
7#include "hydra_utils.h"
8#include "cssi.h"
9
10struct HYD_CSSI_fns HYD_CSSI_fns = { 0 };
11
12const char *HYD_CSSI_comp_array[] = { @hydra_css_name_array@ };
13HYD_Status(*HYD_CSSI_comp_init[])(void) = { @hydra_css_init_array@ };
14
15HYD_Status HYD_CSSI_init(char *css)
16{
17    int i;
18    HYD_Status status = HYD_SUCCESS;
19
20    HYDU_FUNC_ENTER();
21
22    for (i = 0; HYD_CSSI_comp_array[i]; i++) {
23        if (!strcmp(css, HYD_CSSI_comp_array[i])) {
24            status = (*HYD_CSSI_comp_init[i])();
25            break;
26        }
27    }
28
29    if (HYD_CSSI_comp_array[i] == NULL)
30        HYDU_ERR_SETANDJUMP1(status, HYD_INTERNAL_ERROR,
31                             "unrecognized communication sub-system: %s\n", css);
32
33    /* These functions are mandatory */
34    if (HYD_CSSI_fns.query_string == NULL)
35        HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR,
36                            "mandatory communication sub-system function undefined\n");
37    if (HYD_CSSI_fns.finalize == NULL)
38        HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR,
39                            "mandatory communication sub-system function undefined\n");
40
41  fn_exit:
42    HYDU_FUNC_EXIT();
43    return status;
44
45  fn_fail:
46    goto fn_exit;
47}
Note: See TracBrowser for help on using the browser.