From: Chanwoo Choi Date: Wed, 29 Jun 2022 01:44:08 +0000 (+0900) Subject: util: resource: Add new is_resource_attr_interested function X-Git-Tag: accepted/tizen/unified/20220701.055139~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F85%2F276985%2F4;p=platform%2Fcore%2Fsystem%2Fpass.git util: resource: Add new is_resource_attr_interested function Provide is_resource_attr_interested function to check whether some attribute id is already interested or not. It will be used as internal function for libpass-resource-monitor and capi-resource-monitor. Change-Id: I1cdac2eab2672869cfa98069fc7d958c4da4dc93 Signed-off-by: Chanwoo Choi --- diff --git a/include/util/resource.h b/include/util/resource.h index 97a1b93..4934cc4 100644 --- a/include/util/resource.h +++ b/include/util/resource.h @@ -199,6 +199,7 @@ int get_resource_attr_ptr(struct resource *resource, u_int64_t attr_id, void **d int set_resource_attr_interest(struct resource *resource, u_int64_t interest_mask); int unset_resource_attr_interest(struct resource *resource, u_int64_t interest_mask); +bool is_resource_attr_interested(struct resource *resource, u_int64_t interest_mask); inline __attribute__((always_inline)) int64_t get_time_now(void) { diff --git a/src/util/resource.c b/src/util/resource.c index 9c2233d..4543981 100644 --- a/src/util/resource.c +++ b/src/util/resource.c @@ -943,3 +943,14 @@ int unset_resource_attr_interest(struct resource *resource, u_int64_t interest_m return 0; } + +bool is_resource_attr_interested(struct resource *resource, u_int64_t interest_mask) +{ + if (!resource) + return false; + + if (resource->attr_interest != (resource->attr_interest | interest_mask)) + return false; + + return true; +}