diff options
author | Sung-hun Kim <sfoon.kim@samsung.com> | 2022-08-23 20:45:57 +0900 |
---|---|---|
committer | Sung-hun Kim <sfoon.kim@samsung.com> | 2022-08-31 18:36:58 +0900 |
commit | 7f6f9f0094b0d4bf47b6890236591182a5cc3ab6 (patch) | |
tree | 743750e83775a4664fdce654feadbafb0f17c478 | |
parent | 5081911ad619e90cf0c1734125b1475698d017f3 (diff) | |
download | pass-7f6f9f0094b0d4bf47b6890236591182a5cc3ab6.tar.gz pass-7f6f9f0094b0d4bf47b6890236591182a5cc3ab6.tar.bz2 pass-7f6f9f0094b0d4bf47b6890236591182a5cc3ab6.zip |
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 <sfoon.kim@samsung.com>
-rw-r--r-- | lib/resource-monitor/resource-monitor.c | 19 | ||||
-rw-r--r-- | lib/resource-monitor/resource-monitor.h | 9 |
2 files changed, 28 insertions, 0 deletions
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: @@ -384,6 +390,19 @@ int pass_resource_monitor_delete_resource(int id, int resource_id) } 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) { struct request_data request = { 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 @@ -210,6 +210,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 * @param[in] Resource id |