/* Find sub-partition type given its name. If the name does not exist, returns -1.  */
static int find_type_by_name(const char *name)
/* Find sub-partition type given its name. If the name does not exist, returns -1.  */
static int find_type_by_name(const char *name)
{
	int i;
	for (i = 0; i < MAX_SUBPARTS; i++) {
		if ((strlen(subparts[i].name) == strlen(name)) &&
		    (!strcmp(subparts[i].name, name)))
			break;
	}
	if (i == MAX_SUBPARTS) {
		ERROR("Invalid sub-partition name %s.\n", name);
		return -1;
	}
	return i;
}