lib/util/cpuset: add negate and xor
Change-Id: I8d2fc9d0fcc6cb8b088c307d1520f0b1051c3ef6 Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/443518 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
7b0579df17
commit
ebce385d61
@ -100,6 +100,21 @@ void spdk_cpuset_and(struct spdk_cpuset *dst, const struct spdk_cpuset *src);
|
||||
*/
|
||||
void spdk_cpuset_or(struct spdk_cpuset *dst, const struct spdk_cpuset *src);
|
||||
|
||||
/**
|
||||
* Perform XOR operation on two CPU sets. The result is stored in dst.
|
||||
*
|
||||
* \param dst First argument of operation. This value also stores the result of operation.
|
||||
* \param src Second argument of operation.
|
||||
*/
|
||||
void spdk_cpuset_xor(struct spdk_cpuset *dst, const struct spdk_cpuset *src);
|
||||
|
||||
/**
|
||||
* Negate all CPUs in CPU set.
|
||||
*
|
||||
* \param set CPU set to be negated. This value also stores the result of operation.
|
||||
*/
|
||||
void spdk_cpuset_negate(struct spdk_cpuset *set);
|
||||
|
||||
/**
|
||||
* Clear all CPUs in CPU set.
|
||||
*
|
||||
|
@ -67,6 +67,16 @@ spdk_cpuset_copy(struct spdk_cpuset *set1, const struct spdk_cpuset *set2)
|
||||
memcpy(&set1->cpus, &set2->cpus, sizeof(set2->cpus));
|
||||
}
|
||||
|
||||
void
|
||||
spdk_cpuset_negate(struct spdk_cpuset *set)
|
||||
{
|
||||
unsigned int i;
|
||||
assert(set != NULL);
|
||||
for (i = 0; i < sizeof(set->cpus); i++) {
|
||||
set->cpus[i] = ~set->cpus[i];
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
spdk_cpuset_and(struct spdk_cpuset *set1, const struct spdk_cpuset *set2)
|
||||
{
|
||||
@ -89,6 +99,17 @@ spdk_cpuset_or(struct spdk_cpuset *set1, const struct spdk_cpuset *set2)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
spdk_cpuset_xor(struct spdk_cpuset *set1, const struct spdk_cpuset *set2)
|
||||
{
|
||||
unsigned int i;
|
||||
assert(set1 != NULL);
|
||||
assert(set2 != NULL);
|
||||
for (i = 0; i < sizeof(set2->cpus); i++) {
|
||||
set1->cpus[i] ^= set2->cpus[i];
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
spdk_cpuset_zero(struct spdk_cpuset *set)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user