Skip to content

Commit fdd0577

Browse files
authored
Merge pull request #479 from Mellanox/master_devel
Master devel
2 parents 646cd3b + 899914b commit fdd0577

File tree

520 files changed

+84798
-30068
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

520 files changed

+84798
-30068
lines changed

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#--
2-
# Copyright (C) Jan 2013 Mellanox Technologies Ltd. All rights reserved.
2+
# Copyright (c) 2013-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
33
#
44
# This software is available to you under a choice of one of two
55
# licenses. You may choose to be licensed under the terms of the GNU

adb_parser/Makefile.am

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#--
22
#
3-
# Copyright (C) Jan 2019 Mellanox Technologies Ltd. All rights reserved.
3+
# Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
44
#
55
# This software is available to you under a choice of one of two
66
# licenses. You may choose to be licensed under the terms of the GNU
@@ -41,4 +41,6 @@ INCLUDES = -I$(USER_DIR) -I$(USER_DIR)/common
4141
AM_CXXFLAGS = -Wall -W -g -MP -MD -Werror -pipe $(COMPILER_FPIC)
4242

4343
lib_LTLIBRARIES = libadb_parser.a
44-
libadb_parser_a_SOURCES = adb_parser.h adb_parser.cpp buf_ops.h buf_ops.cpp expr.h expr.cpp adb_expr.h adb_expr.cpp adb_db.h adb_db.cpp
44+
45+
libadb_parser_a_SOURCES = buf_ops.cpp expr.cpp adb_expr.cpp adb_parser.cpp adb_db.cpp adb_config.cpp adb_exceptionHolder.cpp adb_field.cpp adb_instance.cpp adb_logfile.cpp adb_node.cpp adb_xmlCreator.cpp
46+

adb_parser/adb_common_functions.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (C) Jan 2019 Mellanox Technologies Ltd. All rights reserved.
3+
* Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
4+
*
5+
* This software is available to you under a choice of one of two
6+
* licenses. You may choose to be licensed under the terms of the GNU
7+
* General Public License (GPL) Version 2, available from the file
8+
* COPYING in the main directory of this source tree, or the
9+
* OpenIB.org BSD license below:
10+
*
11+
* Redistribution and use in source and binary forms, with or
12+
* without modification, are permitted provided that the following
13+
* conditions are met:
14+
*
15+
* - Redistributions of source code must retain the above
16+
* copyright notice, this list of conditions and the following
17+
* disclaimer.
18+
*
19+
* - Redistributions in binary form must reproduce the above
20+
* copyright notice, this list of conditions and the following
21+
* disclaimer in the documentation and/or other materials
22+
* provided with the distribution.
23+
*
24+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31+
* SOFTWARE.
32+
*
33+
* Version: $Id$
34+
*/
35+
36+
37+
indentString(int)

adb_parser/adb_config.cpp

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
* Copyright (C) Jan 2019 Mellanox Technologies Ltd. All rights reserved.
3+
* Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
4+
*
5+
* This software is available to you under a choice of one of two
6+
* licenses. You may choose to be licensed under the terms of the GNU
7+
* General Public License (GPL) Version 2, available from the file
8+
* COPYING in the main directory of this source tree, or the
9+
* OpenIB.org BSD license below:
10+
*
11+
* Redistribution and use in source and binary forms, with or
12+
* without modification, are permitted provided that the following
13+
* conditions are met:
14+
*
15+
* - Redistributions of source code must retain the above
16+
* copyright notice, this list of conditions and the following
17+
* disclaimer.
18+
*
19+
* - Redistributions in binary form must reproduce the above
20+
* copyright notice, this list of conditions and the following
21+
* disclaimer in the documentation and/or other materials
22+
* provided with the distribution.
23+
*
24+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31+
* SOFTWARE.
32+
*
33+
*/
34+
/*************************** AdbConfig ***************************/
35+
/**
36+
* Function: AdbField::print
37+
**/
38+
39+
#include "adb_config.h"
40+
#include <iostream>
41+
42+
void AdbConfig::print(int indent) {
43+
cout << indentString(indent) << "Attributes:" << endl;
44+
AttrsMap::iterator iter;
45+
for (iter = attrs.begin(); iter != attrs.end(); iter++)
46+
cout << indentString(indent + 1) << iter->first << " - "
47+
<< iter->second << endl;
48+
49+
cout << indentString(indent) << "Enums:" << endl;
50+
for (iter = enums.begin(); iter != enums.end(); iter++)
51+
cout << indentString(indent + 1) << iter->first << " - "
52+
<< iter->second << endl;
53+
}
54+
55+
/**
56+
* Function: AdbConfig::toXml
57+
**/
58+
string AdbConfig::toXml() {
59+
string xml = "<config ";
60+
61+
for (AttrsMap::iterator it = attrs.begin(); it != attrs.end(); it++) {
62+
xml += " " + it->first + "=\"" + encodeXml(it->second) + "\"";
63+
}
64+
65+
if (!enums.empty()) {
66+
xml += " >\n";
67+
68+
for (AttrsMap::iterator it = enums.begin(); it != enums.end(); it++) {
69+
xml += "\t<enum name=\"" + encodeXml(it->first) + "\" value=\""
70+
+ encodeXml(it->second) + "\" />\n";
71+
}
72+
xml += "</config>";
73+
} else {
74+
xml += " />";
75+
}
76+
77+
return xml;
78+
}

adb_parser/adb_config.h

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright (C) Jan 2019 Mellanox Technologies Ltd. All rights reserved.
3+
* Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
4+
*
5+
* This software is available to you under a choice of one of two
6+
* licenses. You may choose to be licensed under the terms of the GNU
7+
* General Public License (GPL) Version 2, available from the file
8+
* COPYING in the main directory of this source tree, or the
9+
* OpenIB.org BSD license below:
10+
*
11+
* Redistribution and use in source and binary forms, with or
12+
* without modification, are permitted provided that the following
13+
* conditions are met:
14+
*
15+
* - Redistributions of source code must retain the above
16+
* copyright notice, this list of conditions and the following
17+
* disclaimer.
18+
*
19+
* - Redistributions in binary form must reproduce the above
20+
* copyright notice, this list of conditions and the following
21+
* disclaimer in the documentation and/or other materials
22+
* provided with the distribution.
23+
*
24+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31+
* SOFTWARE.
32+
*
33+
*/
34+
/*************************** AdbConfig ***************************/
35+
36+
#ifndef ADB_CONFIG_H
37+
#define ADB_CONFIG_H
38+
39+
#include "adb_xmlCreator.h"
40+
#include <map>
41+
#include <string>
42+
43+
using namespace xmlCreator;
44+
45+
using namespace std;
46+
47+
typedef map<string, string> AttrsMap;
48+
49+
class AdbConfig {
50+
public:
51+
// FOR DEBUG
52+
void print(int indent = 0);
53+
54+
string toXml();
55+
56+
public:
57+
// Members
58+
AttrsMap attrs;
59+
AttrsMap enums;
60+
};
61+
62+
#endif

adb_parser/adb_db.cpp

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
1-
/*
2-
* Copyright (C) Jan 2019 Mellanox Technologies Ltd. All rights reserved.
3-
*
1+
/*
2+
*
3+
* Copyright (c) 2010-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
4+
*
45
* This software is available to you under a choice of one of two
56
* licenses. You may choose to be licensed under the terms of the GNU
67
* General Public License (GPL) Version 2, available from the file
78
* COPYING in the main directory of this source tree, or the
89
* OpenIB.org BSD license below:
9-
*
10+
*
1011
* Redistribution and use in source and binary forms, with or
1112
* without modification, are permitted provided that the following
1213
* conditions are met:
13-
*
14+
*
1415
* - Redistributions of source code must retain the above
1516
* copyright notice, this list of conditions and the following
1617
* disclaimer.
17-
*
18+
*
1819
* - Redistributions in binary form must reproduce the above
1920
* copyright notice, this list of conditions and the following
2021
* disclaimer in the documentation and/or other materials
2122
* provided with the distribution.
22-
*
23+
*
2324
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2425
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2526
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -28,12 +29,6 @@
2829
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2930
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3031
* SOFTWARE.
31-
32-
*
33-
* End of legal section ......................................................
34-
*
35-
* adb_db.c - "C" wrapper module for adb_parser classes.
36-
* This module provides an alternative "C" way to work with AdbInstance objects.
3732
*
3833
* Version: $Id$
3934
*
@@ -45,7 +40,6 @@
4540
#include <boost/algorithm/string.hpp>
4641
#include <boost/lexical_cast.hpp>
4742
#include "adb_db.h"
48-
#include "adb_parser.h"
4943

5044
#define CHECK_FIELD(field, node_w) \
5145
if (((AdbInstance*)field)->isReserved()) { \
@@ -79,7 +73,7 @@ adb_db_t* db_create()
7973
*/
8074
int db_load(adb_db_t *db, const char *adb_file_path, int add_reserved)
8175
{
82-
if (!((Adb*)db)->load(adb_file_path, add_reserved, NULL, false)) {
76+
if (!((Adb*)db)->load(adb_file_path, add_reserved, false)) {
8377
sprintf(err, "Failed to load adabe project: %s", ((Adb*)db)->getLastError().c_str());
8478
return 1;
8579
}
@@ -92,7 +86,7 @@ int db_load(adb_db_t *db, const char *adb_file_path, int add_reserved)
9286
*/
9387
int db_load_from_str(adb_db_t *db, const char *adb_data, int add_reserved)
9488
{
95-
if (!((Adb*)db)->loadFromString(adb_data, add_reserved, NULL, false)) {
89+
if (!((Adb*)db)->loadFromString(adb_data, add_reserved, false)) {
9690
sprintf(err, "Failed to load adabe project: %s", ((Adb*)db)->getLastError().c_str());
9791
return 1;
9892
}
@@ -157,7 +151,7 @@ void db_destroy_limits_map(adb_limits_map_t *limits)
157151
adb_node_t* db_get_node(adb_db_t *db, const char *node_name)
158152
{
159153
Adb *adb = (Adb*)db;
160-
AdbInstance *node = adb->createLayout(node_name, false, NULL);
154+
AdbInstance *node = adb->createLayout(node_name, false);
161155
if (!node) {
162156
sprintf(err, "Failed to create node %s: %s", node_name, adb->getLastError().c_str());
163157
return NULL;

adb_parser/adb_db.h

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
1-
/*
2-
* Copyright (C) Jan 2019 Mellanox Technologies Ltd. All rights reserved.
3-
*
1+
/*
2+
*
3+
* Copyright (C) February 2010, Mellanox Technologies Ltd. ALL RIGHTS RESERVED.
4+
* Copyright (c) 2010-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
5+
*
46
* This software is available to you under a choice of one of two
57
* licenses. You may choose to be licensed under the terms of the GNU
68
* General Public License (GPL) Version 2, available from the file
79
* COPYING in the main directory of this source tree, or the
810
* OpenIB.org BSD license below:
9-
*
11+
*
1012
* Redistribution and use in source and binary forms, with or
1113
* without modification, are permitted provided that the following
1214
* conditions are met:
13-
*
15+
*
1416
* - Redistributions of source code must retain the above
1517
* copyright notice, this list of conditions and the following
1618
* disclaimer.
17-
*
19+
*
1820
* - Redistributions in binary form must reproduce the above
1921
* copyright notice, this list of conditions and the following
2022
* disclaimer in the documentation and/or other materials
2123
* provided with the distribution.
22-
*
24+
*
2325
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2426
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2527
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -28,12 +30,6 @@
2830
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2931
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3032
* SOFTWARE.
31-
32-
*
33-
* End of legal section ......................................................
34-
*
35-
* adb_db.h - "C" wrapper module for adb_parser classes.
36-
* This module provides an alternative "C" way to work with AdbInstance objects.
3733
*
3834
* Version: $Id$
3935
*
@@ -42,8 +38,10 @@
4238
#ifndef ADB_DB_H
4339
#define ADB_DB_H
4440

41+
4542
#include <stdio.h>
4643
#include <common/compatibility.h>
44+
#include "adb_parser.h"
4745
#ifdef __cplusplus
4846
extern "C" {
4947
#endif

0 commit comments

Comments
 (0)