/* The following *_index functions are used to define the val_to_name and val_to_struct arrays in a policy database structure. The val_to_name arrays are used when converting security context structures into string representations. The val_to_struct arrays are used when the attributes of a class, role, or user are needed.  */
static int common_index(void *key, void *datum, void *datap)
/* The following *_index functions are used to define the val_to_name and val_to_struct arrays in a policy database structure. The val_to_name arrays are used when converting security context structures into string representations. The val_to_struct arrays are used when the attributes of a class, role, or user are needed.  */
static int common_index(void *key, void *datum, void *datap)
{
	struct policydb *p;
	struct common_datum *comdatum;
	comdatum = datum;
	p = datap;
	if (!comdatum->value || comdatum->value > p->p_commons.nprim)
		return -EINVAL;
	p->p_common_val_to_name[comdatum->value - 1] = key;
	return 0;
}