diff options
author | Gleb Natapov <gleb@redhat.com> | 2010-12-08 13:35:06 +0200 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2010-12-11 21:32:46 +0000 |
commit | de1f34cb6351c028ebcc61fea9fa78008ca1a529 (patch) | |
tree | 5741f0c6de842fd7966eb6df47dbd0adb94da6d7 /hw/loader.c | |
parent | 1ca4d09ae0bcc2fdd6aeef0fdc11f82394f7e757 (diff) |
Change fw_cfg_add_file() to get full file path as a parameter.
Change fw_cfg_add_file() to get full file path as a parameter instead
of building one internally. Two reasons for that. First caller may need
to know how file is named. Second this moves policy of file naming out
from fw_cfg. Platform may want to use more then two levels of
directories for instance.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/loader.c')
-rw-r--r-- | hw/loader.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/hw/loader.c b/hw/loader.c index 49ac1fa1cc..1e983261c0 100644 --- a/hw/loader.c +++ b/hw/loader.c @@ -592,8 +592,20 @@ int rom_add_file(const char *file, const char *fw_dir, } close(fd); rom_insert(rom); - if (rom->fw_file && fw_cfg) - fw_cfg_add_file(fw_cfg, rom->fw_dir, rom->fw_file, rom->data, rom->romsize); + if (rom->fw_file && fw_cfg) { + const char *basename; + char fw_file_name[56]; + + basename = strrchr(rom->fw_file, '/'); + if (basename) { + basename++; + } else { + basename = rom->fw_file; + } + snprintf(fw_file_name, sizeof(fw_file_name), "%s/%s", rom->fw_dir, + basename); + fw_cfg_add_file(fw_cfg, fw_file_name, rom->data, rom->romsize); + } return 0; err: |