From: Sung-hun Kim Date: Tue, 23 Aug 2022 11:45:57 +0000 (+0900) Subject: lib: Add pass_resource_monitor_set_resource_flag X-Git-Tag: submit/tizen/20220831.101713~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F73%2F280373%2F7;p=platform%2Fcore%2Fsystem%2Fpass.git lib: Add pass_resource_monitor_set_resource_flag By using the added function, the user of libpass can set the resource as PUBLIC. Note that, the error will be thrown at pass_resource_monitor_set_resource_attr, not at pass_resource_monitor_set_resource_flag. Change-Id: Id012ca5cf2eca90653a17c85b86e6a1913b86d35 Signed-off-by: Sung-hun Kim --- diff --git a/lib/resource-monitor/resource-monitor.c b/lib/resource-monitor/resource-monitor.c index d22540e..062bfad 100644 --- a/lib/resource-monitor/resource-monitor.c +++ b/lib/resource-monitor/resource-monitor.c @@ -100,6 +100,7 @@ struct request_data { int resource_type; u_int64_t ctrl_id; int ctrl_value; + u_int64_t flag_mask; u_int64_t attr_mask; u_int64_t attr_id; @@ -164,6 +165,10 @@ static inline int handle_request(struct request_data *data) buffer_len = sprintf(buffer, "%d$%d", data->request, data->resource_id); break; + case REQUEST_SET_RESOURCE_FLAG: + buffer_len = sprintf(buffer, "%d$%d$%"PRIu64, + data->request, data->resource_id, data->flag_mask); + break; default: _E("[libpass] Unknown request type, client(%d) | request(%d)", data->client_id, data->request); @@ -234,6 +239,7 @@ static inline int handle_request(struct request_data *data) case REQUEST_UPDATE_RESOURCE: case REQUEST_DELETE_RESOURCE: case REQUEST_CREATE_RESOURCE: + case REQUEST_SET_RESOURCE_FLAG: case REQUEST_SET_RESOURCE_CTRL: case REQUEST_SET_RESOURCE_ATTR: case REQUEST_UNSET_RESOURCE_ATTR: @@ -383,6 +389,19 @@ int pass_resource_monitor_delete_resource(int id, int resource_id) return handle_request(&request); } +EXPORT +int pass_resource_monitor_set_resource_flag(int id, int resource_id, u_int64_t flag_mask) +{ + struct request_data request = { + .request = REQUEST_SET_RESOURCE_FLAG, + .client_id = id, + .resource_id = resource_id, + .flag_mask = flag_mask, + }; + + return handle_request(&request); +} + EXPORT int pass_resource_monitor_set_resource_ctrl(int id, int resource_id, u_int64_t ctrl_id, int value) { diff --git a/lib/resource-monitor/resource-monitor.h b/lib/resource-monitor/resource-monitor.h index 5469c09..5c149ad 100644 --- a/lib/resource-monitor/resource-monitor.h +++ b/lib/resource-monitor/resource-monitor.h @@ -209,6 +209,15 @@ int pass_resource_monitor_create_resource(int id, int resource_type); */ int pass_resource_monitor_delete_resource(int id, int resource_id); +/** + * @brief Set flag of resource of the given resource id to given flag mask + * @param[in] Resource monitor id which be returnted by pass_resource_monitor_init + * @param[in] Resource id + * @param[in] Flag mask including the resource visibility + * @return @c 0 on success, otherwise a negative error value + */ +int pass_resource_monitor_set_resource_flag(int id, int resource_id, u_int64_t flag_mask); + /** * @brief Set the resource control with value which is diffierential according to resource control id * @param[in] Resource monitor id