Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
11da735a
Commit
11da735a
authored
Nov 19, 2013
by
Thomas Jahns
🤸
Browse files
Return more information about mismatch from reshListCompare.
* Also reduce debugging output correspondingly.
parent
f2a20568
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/resource_handle.c
View file @
11da735a
...
...
@@ -592,65 +592,47 @@ void reshUnlock ()
int
reshListCompare
(
int
nsp0
,
int
nsp1
)
{
int
valCompare
=
0
;
int
i
;
LIST_INIT
();
LIST_LOCK
();
xassert
(
resHListSize
>
nsp0
&&
resHListSize
>
nsp1
&&
nsp0
>=
0
&&
nsp1
>=
0
);
for
(
i
=
0
;
i
<
resHList
[
nsp0
].
size
;
i
++
)
int
valCompare
=
0
;
int
i
,
listSizeMin
=
(
resHList
[
nsp0
].
size
<=
resHList
[
nsp1
].
size
)
?
resHList
[
nsp0
].
size
:
resHList
[
nsp1
].
size
;
listElem_t
*
resources0
=
resHList
[
nsp0
].
resources
,
*
resources1
=
resHList
[
nsp1
].
resources
;
for
(
i
=
0
;
i
<
listSizeMin
;
i
++
)
{
listElem_t
*
listElem0
=
resHList
[
nsp0
].
resources
+
i
,
*
listElem1
=
resHList
[
nsp1
].
resources
+
i
;
if
(
listElem0
->
val
)
{
if
(
i
>=
resHList
[
nsp1
].
size
)
{
valCompare
=
1
;
xdebug
(
"%s %d"
,
"namespace active length mismatch at resource"
,
i
);
break
;
}
if
(
!
listElem1
->
val
)
{
valCompare
=
1
;
xdebug
(
"%s %d"
,
"namespace occupation mismatch at resource"
,
i
);
break
;
}
if
(
listElem0
->
ops
!=
listElem1
->
ops
||
listElem0
->
ops
==
NULL
)
{
valCompare
=
1
;
xdebug
(
"%s %d"
,
"resource type mismatch at resource"
,
i
);
break
;
}
valCompare
=
listElem0
->
ops
->
valCompare
(
listElem0
->
val
,
listElem1
->
val
);
if
(
valCompare
)
break
;
}
else
if
(
listElem1
->
val
)
int
occupied0
=
resources0
[
i
].
val
!=
NULL
,
occupied1
=
resources1
[
i
].
val
!=
NULL
;
/* occupation mismatch ? */
int
diff
=
occupied0
^
occupied1
;
valCompare
|=
(
diff
<<
cdiResHListOccupationMismatch
);
if
(
!
diff
&&
occupied0
)
{
valCompare
=
1
;
xdebug
(
"namespace 1 has value at empty place %d of namespace 0"
,
i
);
break
;
/* both occupied, do resource types match? */
diff
=
(
resources0
[
i
].
ops
!=
resources1
[
i
].
ops
||
resources0
[
i
].
ops
==
NULL
);
valCompare
|=
(
diff
<<
cdiResHListResourceTypeMismatch
);
if
(
!
diff
)
{
/* types match, does content match also? */
diff
=
resources0
[
i
].
ops
->
valCompare
(
resources0
[
i
].
val
,
resources1
[
i
].
val
);
valCompare
|=
(
diff
<<
cdiResHListResourceContentMismatch
);
}
}
}
if
(
!
valCompare
)
{
for
(
;
i
<
resHList
[
nsp1
].
size
;
i
++
)
valCompare
=
valCompare
||
resHList
[
nsp1
].
resources
[
i
].
val
!=
NULL
;
if
(
valCompare
)
xdebug
(
"%s"
,
"extra elements in second namespace"
);
}
/* find resources in nsp 0 beyond end of nsp 1 */
for
(
int
j
=
listSizeMin
;
j
<
resHList
[
nsp0
].
size
;
++
j
)
valCompare
|=
((
resources0
[
j
].
val
!=
NULL
)
<<
cdiResHListOccupationMismatch
);
/* find resources in nsp 1 beyond end of nsp 0 */
for
(;
i
<
resHList
[
nsp1
].
size
;
++
i
)
valCompare
|=
((
resources1
[
i
].
val
!=
NULL
)
<<
cdiResHListOccupationMismatch
);
LIST_UNLOCK
();
...
...
src/resource_handle.h
View file @
11da735a
...
...
@@ -71,6 +71,13 @@ int reshGetStatus ( cdiResH, resOps * );
void
reshLock
(
void
);
void
reshUnlock
(
void
);
enum
reshListMismatch
{
cdiResHListOccupationMismatch
,
cdiResHListResourceTypeMismatch
,
cdiResHListResourceContentMismatch
,
};
int
reshListCompare
(
int
nsp0
,
int
nsp1
);
void
reshListPrint
(
FILE
*
fp
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment