loader: use file path size from fw_cfg.h
authorMichael S. Tsirkin <mst@redhat.com>
Wed, 24 Jul 2013 15:56:05 +0000 (18:56 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 14 Oct 2013 14:48:52 +0000 (17:48 +0300)
Avoid a bit of code duplication, make
max file path constant reusable.

Suggested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/core/loader.c
include/hw/nvram/fw_cfg.h

index 449bd4c90abbc2d348f7275b814e05b42f72ba96..060729f140222d02071dccee775480d8e723068a 100644 (file)
@@ -663,7 +663,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];
         void *data;
 
         basename = strrchr(rom->fw_file, '/');
index 2ab0fc2950a1922fb8726572222de31101c4a37f..72b1549dc4ad85dc5678710af57ef5557b011867 100644 (file)
 
 #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 {