}
static int
-update_resource_attr(struct syscommon_resman_resource *resource,
+monitor_update_resource_attr(struct syscommon_resman_resource *resource,
u_int64_t attr_id)
{
int attr_index = RESOURCE_ATTR_INDEX(attr_id);
attr = &resource->attrs[attr_index];
- if (!attr->ops.get)
+ if (!attr->monitor_ops.get)
return -EINVAL;
attr_value = &resource->attrs_value[attr_index];
- ret = attr->ops.get(resource->id, attr, attr_value->data);
+ ret = attr->monitor_ops.get(resource->id, attr, attr_value->data);
if (ret < 0)
return ret;
}
int
-syscommon_resman_update_resource_attrs(int resource_id)
+syscommon_resman_monitor_update_resource_attrs(int resource_id)
{
int i, ret;
struct syscommon_resman_resource *resource = find_resource(resource_id);
for (i = 0; i < resource->num_attrs; i++) {
if (!(resource->attrs[i].id & resource->attr_interest))
continue;
- update_resource_attr(resource, resource->attrs[i].id);
+ monitor_update_resource_attr(resource, resource->attrs[i].id);
}
return 0;
return get_resource_attr_value(resource, attr_id);
}
-static int is_resource_attr_supported(struct syscommon_resman_resource *resource, u_int64_t attr_id, bool *supported)
+static int monitor_is_resource_attr_supported(struct syscommon_resman_resource *resource, u_int64_t attr_id, bool *supported)
{
const struct syscommon_resman_resource_attribute *attr = NULL;
int attr_index = RESOURCE_ATTR_INDEX(attr_id);
if (attr->id & resource->attr_supported) {
is_supported = true;
- } else if (attr->ops.is_supported) {
- is_supported = attr->ops.is_supported(resource->id, attr);
- } else if (attr->ops.get) {
+ } else if (attr->monitor_ops.is_supported) {
+ is_supported = attr->monitor_ops.is_supported(resource->id, attr);
+ } else if (attr->monitor_ops.get) {
/*
* Optionally, if .is_supported ops is not implemented,
* use .get ops in order to check whether the resource attribute
*/
char data[SYSCOMMON_RESMAN_BUFF_MAX] = {0, };
- ret = attr->ops.get(resource->id, attr, (void *)data);
+ ret = attr->monitor_ops.get(resource->id, attr, (void *)data);
is_supported = (ret < 0) ? false : true;
}
}
int
-syscommon_resman_is_resource_attr_supported(int resource_id, u_int64_t attr_id, bool *supported)
+syscommon_resman_monitor_is_resource_attr_supported(int resource_id, u_int64_t attr_id, bool *supported)
{
struct syscommon_resman_resource *resource = find_resource(resource_id);
- return is_resource_attr_supported(resource, attr_id, supported);
+ return monitor_is_resource_attr_supported(resource, attr_id, supported);
}
static bool
}
int
-syscommon_resman_get_resource_attrs_json(int resource_id, char **json_string)
+syscommon_resman_monitor_get_resource_attrs_json(int resource_id, char **json_string)
{
json_object *jobj_root, *jobj_res_name, *jobj_res_type, *jobj_res_attrs, *jobj_attr;
const struct syscommon_resman_resource_attribute *attr;
}
int
-syscommon_resman_get_resource_attr_json(int resource_id, u_int64_t attr_id, char **json_string)
+syscommon_resman_monitor_get_resource_attr_json(int resource_id, u_int64_t attr_id, char **json_string)
{
const struct syscommon_resman_resource_attribute *attr;
const struct syscommon_resman_resource_attribute_value *attr_value;
}
int
-syscommon_resman_get_resource_attr_int(int resource_id, u_int64_t attr_id, int32_t *data)
+syscommon_resman_monitor_get_resource_attr_int(int resource_id, u_int64_t attr_id, int32_t *data)
{
return get_resource_attr_value_data(resource_id, attr_id, SYSCOMMON_RESMAN_DATA_TYPE_INT, data);
}
int
-syscommon_resman_get_resource_attr_int64(int resource_id, u_int64_t attr_id, int64_t *data)
+syscommon_resman_monitor_get_resource_attr_int64(int resource_id, u_int64_t attr_id, int64_t *data)
{
return get_resource_attr_value_data(resource_id, attr_id, SYSCOMMON_RESMAN_DATA_TYPE_INT64, data);
}
int
-syscommon_resman_get_resource_attr_uint(int resource_id, u_int64_t attr_id, u_int32_t *data)
+syscommon_resman_monitor_get_resource_attr_uint(int resource_id, u_int64_t attr_id, u_int32_t *data)
{
return get_resource_attr_value_data(resource_id, attr_id, SYSCOMMON_RESMAN_DATA_TYPE_UINT, data);
}
int
-syscommon_resman_get_resource_attr_uint64(int resource_id, u_int64_t attr_id, u_int64_t *data)
+syscommon_resman_monitor_get_resource_attr_uint64(int resource_id, u_int64_t attr_id, u_int64_t *data)
{
return get_resource_attr_value_data(resource_id, attr_id, SYSCOMMON_RESMAN_DATA_TYPE_UINT64, data);
}
int
-syscommon_resman_get_resource_attr_double(int resource_id, u_int64_t attr_id, double *data)
+syscommon_resman_monitor_get_resource_attr_double(int resource_id, u_int64_t attr_id, double *data)
{
return get_resource_attr_value_data(resource_id, attr_id, SYSCOMMON_RESMAN_DATA_TYPE_DOUBLE, data);
}
int
-syscommon_resman_get_resource_attr_string(int resource_id, u_int64_t attr_id, char *data)
+syscommon_resman_monitor_get_resource_attr_string(int resource_id, u_int64_t attr_id, char *data)
{
return get_resource_attr_value_data(resource_id, attr_id, SYSCOMMON_RESMAN_DATA_TYPE_STRING, data);
}
int
-syscommon_resman_get_resource_attr_array(int resource_id, u_int64_t attr_id, struct syscommon_resman_array_value **data)
+syscommon_resman_monitor_get_resource_attr_array(int resource_id, u_int64_t attr_id, struct syscommon_resman_array_value **data)
{
return get_resource_attr_value_data(resource_id, attr_id, SYSCOMMON_RESMAN_DATA_TYPE_ARRAY, data);
}
int
-syscommon_resman_get_resource_attr_ptr(int resource_id, u_int64_t attr_id, void **data)
+syscommon_resman_monitor_get_resource_attr_ptr(int resource_id, u_int64_t attr_id, void **data)
{
return get_resource_attr_value_data(resource_id, attr_id, SYSCOMMON_RESMAN_DATA_TYPE_PTR, data);
}
if (!(resource->attrs[i].id & interest_mask))
continue;
- ret = is_resource_attr_supported(resource,
- resource->attrs[i].id,
- &supported);
+ ret = monitor_is_resource_attr_supported(resource,
+ resource->attrs[i].id,
+ &supported);
if (ret < 0) {
goto err;
} else if (!supported) {
void *data;
};
-struct syscommon_resman_resource_attribute_ops {
- int (*set)(int resource_id,
- const struct syscommon_resman_resource_attribute *attr,
- const void *data, int count);
+struct syscommon_resman_resource_attribute_monitor_ops {
int (*get)(int resource_id,
const struct syscommon_resman_resource_attribute *attr,
void *data);
const u_int64_t id;
const int type;
const u_int64_t flag;
- const struct syscommon_resman_resource_attribute_ops ops;
+ const struct syscommon_resman_resource_attribute_monitor_ops monitor_ops;
const struct syscommon_resman_resource_attribute_listener_ops listener_ops;
};
const char *syscommon_resman_get_resource_control_name(int resource_id, u_int64_t ctrl_id);
/* Handle resource attribute */
-int syscommon_resman_update_resource_attrs(int resource_id);
+int syscommon_resman_monitor_update_resource_attrs(int resource_id);
const struct syscommon_resman_resource_attribute *
syscommon_resman_get_resource_attr(int resource_id, u_int64_t attr_id);
struct syscommon_resman_resource_attribute_value *
syscommon_resman_get_resource_attr_value(int resource_id, u_int64_t attr_id);
-int syscommon_resman_is_resource_attr_supported(int resource_id, u_int64_t attr_id, bool *supported);
+int syscommon_resman_monitor_is_resource_attr_supported(int resource_id, u_int64_t attr_id, bool *supported);
static inline bool
syscommon_resman_resource_attr_supported_always(int resource_id,
return true;
}
-int syscommon_resman_get_resource_attrs_json(int resource_id, char **json_string);
-int syscommon_resman_get_resource_attr_json(int resource_id, u_int64_t attr_id, char **json_string);
+int syscommon_resman_monitor_get_resource_attrs_json(int resource_id, char **json_string);
+int syscommon_resman_monitor_get_resource_attr_json(int resource_id, u_int64_t attr_id, char **json_string);
int syscommon_resman_get_resource_list_json(char **json_string);
-int syscommon_resman_get_resource_attr_int(int resource_id, u_int64_t attr_id, int32_t *data);
-int syscommon_resman_get_resource_attr_int64(int resource_id, u_int64_t attr_id, int64_t *data);
-int syscommon_resman_get_resource_attr_uint(int resource_id, u_int64_t attr_id, u_int32_t *data);
-int syscommon_resman_get_resource_attr_uint64(int resource_id, u_int64_t attr_id, u_int64_t *data);
-int syscommon_resman_get_resource_attr_double(int resource_id, u_int64_t attr_id, double *data);
-int syscommon_resman_get_resource_attr_string(int resource_id, u_int64_t attr_id, char *data);
-int syscommon_resman_get_resource_attr_array(int resource_id, u_int64_t attr_id, struct syscommon_resman_array_value **data);
-int syscommon_resman_get_resource_attr_ptr(int resource_id, u_int64_t attr_id, void **data);
+int syscommon_resman_monitor_get_resource_attr_int(int resource_id, u_int64_t attr_id, int32_t *data);
+int syscommon_resman_monitor_get_resource_attr_int64(int resource_id, u_int64_t attr_id, int64_t *data);
+int syscommon_resman_monitor_get_resource_attr_uint(int resource_id, u_int64_t attr_id, u_int32_t *data);
+int syscommon_resman_monitor_get_resource_attr_uint64(int resource_id, u_int64_t attr_id, u_int64_t *data);
+int syscommon_resman_monitor_get_resource_attr_double(int resource_id, u_int64_t attr_id, double *data);
+int syscommon_resman_monitor_get_resource_attr_string(int resource_id, u_int64_t attr_id, char *data);
+int syscommon_resman_monitor_get_resource_attr_array(int resource_id, u_int64_t attr_id, struct syscommon_resman_array_value **data);
+int syscommon_resman_monitor_get_resource_attr_ptr(int resource_id, u_int64_t attr_id, void **data);
int syscommon_resman_set_resource_attr_interest(int resource_id, u_int64_t interest_mask);
int syscommon_resman_unset_resource_attr_interest(int resource_id, u_int64_t interest_mask);