- return cbfs_copyfile(dst, maxlen, fname);
-}
-
-// Copy the next file with the given prefix - starting at pos 'last'.
-struct cbfs_file *
-cbfs_copyfile_prefix(void *dst, u32 maxlen, const char *prefix
- , struct cbfs_file *last)
-{
- if (! CONFIG_COREBOOT_FLASH)
- return NULL;
- dprintf(3, "Searching CBFS for data file prefix %s\n", prefix);
- struct cbfs_file *file;
- if (! last)
- file = cbfs_getfirst();
- else
- file = cbfs_getnext(last);
- int prefixlen = strlen(prefix);
- for (; file; file = cbfs_getnext(file)) {
- if (memcmp(prefix, file->filename, prefixlen) != 0)
- continue;
- u32 size = ntohl(file->len);
- void *src = (void*)file + ntohl(file->offset);
- int fnamelen = strlen(file->filename);
- int rv;
- if (fnamelen > 5 && strcmp(&file->filename[fnamelen-5], ".lzma") == 0)
- rv = ulzma(dst, maxlen, src, size);
- else
- rv = data_copy(dst, maxlen, src, size);
- if (rv >= 0)
- return file;
- }
- return NULL;
+ int iscomp;
+ struct cbfs_file *file = cbfs_finddatafile(fname, &iscomp);
+ return cbfs_copyfile(file, dst, maxlen, iscomp);