futility/updater_archive.c
/*
 * Finds available patch files by given model.
 * Updates `model` argument with path of patch files.
 */
Finds available patch files by given model.
Updates `model` argument with path of patch files.
Finds available patch files by given model . Updates ` model ` argument with path of patch files .
static void find_patches_for_model(struct model_config *model,
				   struct archive *archive,
				   const char *signature_id)
{
	char *path;
	int i;
	const char *names[] = {
		"rootkey",
		"vblock_A",
		"vblock_B",
	};
	char **targets[] = {
		&model->patches.rootkey,
		&model->patches.vblock_a,
		&model->patches.vblock_b,
	};
	assert(ARRAY_SIZE(names) == ARRAY_SIZE(targets));
	for (i = 0; i < ARRAY_SIZE(names); i++) {
		ASPRINTF(&path, "%s/%s.%s", DIR_KEYSET, names[i], signature_id);
		if (archive_has_entry(archive, path))
			*targets[i] = path;
		else
			free(path);
	}
}
static void find_patches_for_model ( struct model_config * model , struct archive * archive , const char * signature_id ) { char * path ; int i ; const char * names [ ] = { " " , " " , " " , } ; char * * targets [ ] = { & model -> patches . rootkey , & model -> patches . vblock_a , & model -> patches . vblock_b , } ; assert ( ARRAY_SIZE ( names ) == ARRAY_SIZE ( targets ) ) ; for ( i = 0 ; i < ARRAY_SIZE ( names ) ; i ++ ) { ASPRINTF ( & path , " " , DIR_KEYSET , names [ i ] , signature_id ) ; if ( archive_has_entry ( archive , path ) ) * targets [ i ] = path ; else free ( path ) ; } }
Finds available patch files by given model.
Finds available patch files by given model .