Skip to content

Commit 8a929d4

Browse files
committed
distances: relax constraints on distance kinds
Allow FROM or MEANS to be missing if unknown. Nothing requires them internally, they are only used to enable/disable grouping (latency only) and checked by the get() API filters. Signed-off-by: Brice Goglin <[email protected]>
1 parent 15f5aaf commit 8a929d4

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

hwloc/distances.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright © 2010-2022 Inria. All rights reserved.
2+
* Copyright © 2010-2024 Inria. All rights reserved.
33
* Copyright © 2011-2012 Université Bordeaux
44
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
55
* See COPYING in top-level directory.
@@ -624,8 +624,8 @@ void * hwloc_distances_add_create(hwloc_topology_t topology,
624624
return NULL;
625625
}
626626
if ((kind & ~HWLOC_DISTANCES_KIND_ALL)
627-
|| hwloc_weight_long(kind & HWLOC_DISTANCES_KIND_FROM_ALL) != 1
628-
|| hwloc_weight_long(kind & HWLOC_DISTANCES_KIND_MEANS_ALL) != 1) {
627+
|| hwloc_weight_long(kind & HWLOC_DISTANCES_KIND_FROM_ALL) > 1
628+
|| hwloc_weight_long(kind & HWLOC_DISTANCES_KIND_MEANS_ALL) > 1) {
629629
errno = EINVAL;
630630
return NULL;
631631
}

include/hwloc/distances.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ struct hwloc_distances_s {
7070
* The \p kind attribute of struct hwloc_distances_s is a OR'ed set
7171
* of kinds.
7272
*
73-
* Each distance matrix has exactly one kind HWLOC_DISTANCES_KIND_FROM_*
73+
* Each distance matrix may have only one kind among HWLOC_DISTANCES_KIND_FROM_*
7474
* specifying where distance information comes from,
75-
* and exactly one kind HWLOC_DISTANCES_KIND_MEANS_* specifying
75+
* and one kind among HWLOC_DISTANCES_KIND_MEANS_* specifying
7676
* whether values are latencies or bandwidths.
7777
*/
7878
enum hwloc_distances_kind_e {
@@ -356,7 +356,7 @@ typedef void * hwloc_distances_add_handle_t;
356356
* Otherwise, it will be copied internally and may later be freed by the caller.
357357
*
358358
* \p kind specifies the kind of distance as a OR'ed set of ::hwloc_distances_kind_e.
359-
* Exactly one kind of meaning and one kind of provenance must be given
359+
* Only one kind of meaning and one kind of provenance may be given if appropriate
360360
* (e.g. ::HWLOC_DISTANCES_KIND_MEANS_BANDWIDTH and ::HWLOC_DISTANCES_KIND_FROM_USER).
361361
* Kind ::HWLOC_DISTANCES_KIND_HETEROGENEOUS_TYPES will be automatically set
362362
* according to objects having different types in hwloc_distances_add_values().

0 commit comments

Comments
 (0)