/* Handle resource control */
int set_resource_control(struct resource *resource, u_int64_t ctrl_id, const void *data);
+const char *get_resource_control_name(struct resource *resource, u_int64_t ctrl_id);
/* Handle resource attribute */
int update_resource_attrs(struct resource *resource);
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);
+const char *get_resource_attr_name(struct resource *resource, u_int64_t attr_id);
const char *get_resource_name(struct resource *resource);
void *get_resource_privdata(struct resource *resource);
return 0;
}
+const char *get_resource_control_name(struct resource *resource, u_int64_t ctrl_id)
+{
+ const struct resource_control *ctrl;
+ int ctrl_index = RESOURCE_CTRL_INDEX(ctrl_id);
+
+ if (!resource)
+ return NULL;
+ ctrl = &resource->ctrls[ctrl_index];
+
+ return ctrl->name;
+}
+
static int update_resource_attr(struct resource *resource, u_int64_t attr_id)
{
int attr_index = RESOURCE_ATTR_INDEX(attr_id);
return true;
}
+const char *get_resource_attr_name(struct resource *resource, u_int64_t attr_id)
+{
+ const struct resource_attribute *attr;
+
+ attr = get_resource_attr(resource, attr_id);
+ if (!attr)
+ return NULL;
+
+ return attr->name;
+}
+
const char *get_resource_name(struct resource *resource)
{
return resource ? resource->name : NULL;