diff mbox

[v3,05/14] loader: use file path size from fw_cfg.h

Message ID 1374681580-17439-6-git-send-email-mst@redhat.com
State New
Headers show

Commit Message

Michael S. Tsirkin July 24, 2013, 4:01 p.m. UTC
Avoid a bit of code duplication, make
max file path constant reusable.

Suggested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/core/loader.c          | 2 +-
 include/hw/nvram/fw_cfg.h | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

Comments

Andreas Färber July 24, 2013, 11:42 p.m. UTC | #1
Am 24.07.2013 18:01, schrieb Michael S. Tsirkin:
> Avoid a bit of code duplication, make
> max file path constant reusable.
> 
> Suggested-by: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Reviewed-by: Andreas Färber <afaerber@suse.de>

Andreas
Gerd Hoffmann July 25, 2013, 12:10 p.m. UTC | #2
On 07/24/13 18:01, Michael S. Tsirkin wrote:
> Avoid a bit of code duplication, make
> max file path constant reusable.

Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>

cheers,
  Gerd
diff mbox

Patch

diff --git a/hw/core/loader.c b/hw/core/loader.c
index c3c28cf..c4dd665 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -645,7 +645,7 @@  int rom_add_file(const char *file, const char *fw_dir,
     rom_insert(rom);
     if (rom->fw_file && fw_cfg) {
         const char *basename;
-        char fw_file_name[56];
+        char fw_file_name[FW_CFG_MAX_FILE_PATH];
 
         basename = strrchr(rom->fw_file, '/');
         if (basename) {
diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
index f60dd67..fa5c8c6 100644
--- a/include/hw/nvram/fw_cfg.h
+++ b/include/hw/nvram/fw_cfg.h
@@ -46,12 +46,14 @@ 
 
 #define FW_CFG_INVALID          0xffff
 
+#define FW_CFG_MAX_FILE_PATH    56
+
 #ifndef NO_QEMU_PROTOS
 typedef struct FWCfgFile {
     uint32_t  size;        /* file size */
     uint16_t  select;      /* write this to 0x510 to read it */
     uint16_t  reserved;
-    char      name[56];
+    char      name[FW_CFG_MAX_FILE_PATH];
 } FWCfgFile;
 
 typedef struct FWCfgFiles {