/* This function is equivalent to request_resource when no conflict happens. If a conflict happens, and the conflicting resources entirely fit within the range of the new resource, then the new resource is inserted and the conflicting resources become children of the new resource.  */
int insert_resource(struct resource *parent, struct resource *new)
/* This function is equivalent to request_resource when no conflict happens. If a conflict happens, and the conflicting resources entirely fit within the range of the new resource, then the new resource is inserted and the conflicting resources become children of the new resource.  */
int insert_resource(struct resource *parent, struct resource *new)
{
	struct resource *conflict;
	write_lock(&resource_lock);
	conflict = __insert_resource(parent, new);
	write_unlock(&resource_lock);
	return conflict ? -EBUSY : 0;
}