2 Copyright (c) 2014-2016 Intel Corporation. All Rights Reserved.
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions
8 * Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
13 * Neither the name of Intel Corporation nor the names of its
14 contributors may be used to endorse or promote products derived
15 from this software without specific prior written permission.
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef OFFLOAD_ENV_H_INCLUDED
32 #define OFFLOAD_ENV_H_INCLUDED
35 #include "offload_util.h"
37 // data structure and routines to parse MIC user environment and pass to MIC
41 c_no_mic
, // not MIC env var
42 c_mic_var
, // for <mic-prefix>_<var>
43 c_mic_card_var
, // for <mic-prefix>_<card-number>_<var>
44 c_mic_card_env
// for <mic-prefix>_<card-number>_ENV
47 struct DLL_LOCAL MicEnvVar
{
49 MicEnvVar() : prefix(0) {}
52 void analyze_env_var(char *env_var_string
);
53 char** create_environ_for_card(int card_num
);
54 MicEnvVarKind
get_env_var_kind(
58 int *env_var_name_length
,
64 int env_var_name_length
,
68 void set_prefix(const char *pref
) {
69 prefix
= (pref
&& *pref
!= '\0') ? pref
: 0;
78 VarValue(char* var
, int ln
, char* value
)
82 env_var_value
= value
;
91 std::list
<struct VarValue
*> env_vars
;
93 CardEnvVars() { card_number
= any_card
; }
94 CardEnvVars(int num
) { card_number
= num
; }
97 void add_new_env_var(int number
, char *env_var
, int length
,
99 VarValue
* find_var(char* env_var_name
, int env_var_name_length
);
101 static const int any_card
;
104 void mic_parse_env_var_list(int card_number
, char *env_var_def
);
105 CardEnvVars
* get_card(int number
);
108 std::list
<struct CardEnvVars
*> card_spec_list
;
109 CardEnvVars common_vars
;
112 #endif // OFFLOAD_ENV_H_INCLUDED