lib: Add pass_resource_monitor_set_resource_public sandbox/sebuns2/visibility
authorSung-hun Kim <sfoon.kim@samsung.com>
Tue, 23 Aug 2022 11:45:57 +0000 (20:45 +0900)
committerSung-hun Kim <sfoon.kim@samsung.com>
Tue, 23 Aug 2022 11:45:57 +0000 (20:45 +0900)
The user of libpass can set whose resource as public.

Change-Id: Id012ca5cf2eca90653a17c85b86e6a1913b86d35
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
lib/resource-monitor/resource-monitor.c
lib/resource-monitor/resource-monitor.h

index d22540e1111c2a179e78a7815f169e8ff1f4379a..a9499289ef752ce58d70f041fe69a583756f9bb7 100644 (file)
@@ -141,6 +141,7 @@ static inline int handle_request(struct request_data *data)
                break;
        case REQUEST_UPDATE_RESOURCE:
        case REQUEST_DELETE_RESOURCE:
+       case REQUEST_SET_RESOURCE_PUBLIC:
                buffer_len = sprintf(buffer, "%d$%d",
                                data->request, data->resource_id);
                break;
@@ -234,6 +235,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_PUBLIC:
        case REQUEST_SET_RESOURCE_CTRL:
        case REQUEST_SET_RESOURCE_ATTR:
        case REQUEST_UNSET_RESOURCE_ATTR:
@@ -383,6 +385,18 @@ int pass_resource_monitor_delete_resource(int id, int resource_id)
        return handle_request(&request);
 }
 
+EXPORT
+int pass_resource_monitor_set_resource_public(int id, int resource_id)
+{
+       struct request_data request = {
+               .request        = REQUEST_SET_RESOURCE_PUBLIC,
+               .client_id      = id,
+               .resource_id    = resource_id,
+       };
+
+       return handle_request(&request);
+}
+
 EXPORT
 int pass_resource_monitor_set_resource_ctrl(int id, int resource_id, u_int64_t ctrl_id, int value)
 {
index 84d3e9f9bad60ab8b18da8d4a9e731b5dc8f0f8b..fd4b7d0b51708abe0bf471f0b1dae04078c111e6 100644 (file)
@@ -203,6 +203,14 @@ int pass_resource_monitor_create_resource(int id, int resource_type);
  */
 int pass_resource_monitor_delete_resource(int id, int resource_id);
 
+/**
+ * @brief Set visibility of resource of given resource id to public
+ * @param[in] Resource monitor id which be returnted by pass_resource_monitor_init
+ * @param[in] Resource id
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int pass_resource_monitor_set_resource_public(int id, int resource_id);
+
 /**
  * @brief Set the resource control with value which is diffierential according to resource control id
  * @param[in] Resource monitor id