/* Returns 0 if the action string was recognized.  */
int kobject_action_type(const char *buf, size_t count, enum kobject_action *type)
/* Returns 0 if the action string was recognized.  */
int kobject_action_type(const char *buf, size_t count, enum kobject_action *type)
{
	enum kobject_action action;
	int ret = -EINVAL;
	if (count && (buf[count-1] == '\n' || buf[count-1] == '\0'))
		count--;
	if (!count)
		goto out;
	for (action = 0; action < ARRAY_SIZE(kobject_actions); action++) {
		if (strncmp(kobject_actions[action], buf, count) != 0)
			continue;
		if (kobject_actions[action][count] != '\0')
			continue;
		*type = action;
		ret = 0;
		break;
	}
out:
	return ret;
}