]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Use %I64 and not %ll when using OS printf if compiling for windows.
authorVladimir Serbinenko <phcoder@gmail.com>
Tue, 17 Dec 2013 15:04:47 +0000 (16:04 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Tue, 17 Dec 2013 15:04:47 +0000 (16:04 +0100)
ChangeLog
grub-core/disk/diskfilter.c
grub-core/kern/emu/hostdisk.c
grub-core/osdep/windows/blocklist.c
include/grub/emu/misc.h
util/getroot.c
util/grub-fstest.c
util/grub-mkimagexx.c
util/misc.c
util/mkimage.c
util/setup.c

index d0746fb8ec84537dd0d244cafe8b825f2a395ed6..ec161421e288aae3f7bc61496839123ec9229607 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-12-17  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Use %I64 and not %ll when using OS printf if compiling for windows.
+
 2013-12-17  Vladimir Serbinenko  <phcoder@gmail.com>
 
        Update Mac code to match new register_efi prototype.
index dc693696a09d7b2d820c52f245de696fd957df79..28b70c666d4b826b78cd39d88449b24dadf458f1 100644 (file)
@@ -1057,7 +1057,8 @@ insert_array (grub_disk_t disk, const struct grub_diskfilter_pv_id *id,
                (unsigned long long) grub_disk_get_size (disk),
                array->name, diskfilter->name);
 #ifdef GRUB_UTIL
-  grub_util_info ("Inserting %s (+%lld,%lld) into %s (%s)\n", disk->name,
+  grub_util_info ("Inserting %s (+%" GRUB_HOST_PRIuLONG_LONG ",%"
+                 GRUB_HOST_PRIuLONG_LONG ") into %s (%s)\n", disk->name,
                  (unsigned long long) grub_partition_get_start (disk->partition),
                  (unsigned long long) grub_disk_get_size (disk),
                  array->name, diskfilter->name);
index 08ae65478db56b91e64adbe3a9980879bc7cff9d..44b0fcbb1e507cb8c14a11f31347e739d028fccf 100644 (file)
@@ -171,8 +171,8 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
 
     grub_util_fd_close (fd);
 
-    grub_util_info ("the size of %s is %" PRIuGRUB_UINT64_T,
-                   name, disk->total_sectors);
+    grub_util_info ("the size of %s is %" GRUB_HOST_PRIuLONG_LONG,
+                   name, (unsigned long long) disk->total_sectors);
 
     return GRUB_ERR_NONE;
   }
index d2003854f0dbff41865e8505148786b599ff18dd..a1a697670c0fedd4913438ffb2a5bc888e2bb767 100644 (file)
@@ -84,8 +84,10 @@ grub_install_get_blocklist (grub_device_t root_dev,
     grub_util_error ("unsupported fs for blocklist under windows: %s",
                     fs->name);
 
-  grub_util_info ("sec_per_lcn = %lld, first_lcn=%lld",
-                 (long long) sec_per_lcn, (long long) first_lcn);
+  grub_util_info ("sec_per_lcn = %"  GRUB_HOST_PRIuLONG_LONG
+                 ", first_lcn=%" GRUB_HOST_PRIuLONG_LONG,
+                 (unsigned long long) sec_per_lcn,
+                 (unsigned long long) first_lcn);
 
   first_lcn += grub_partition_get_start (root_dev->disk->partition);
 
index 4f708cf104fcbdbfbc4a92b23d7e489d1b12109d..dde48c192d321482f981c9b5ac8219c399774aa3 100644 (file)
@@ -42,6 +42,14 @@ char *grub_make_system_path_relative_to_its_root (const char *path)
 int
 grub_util_device_is_mapped (const char *dev);
 
+#ifdef __MINGW32__
+#define GRUB_HOST_PRIuLONG_LONG "I64u"
+#define GRUB_HOST_PRIxLONG_LONG "I64x"
+#else
+#define GRUB_HOST_PRIuLONG_LONG "llu"
+#define GRUB_HOST_PRIxLONG_LONG "llx"
+#endif
+
 void * EXPORT_FUNC(xmalloc) (grub_size_t size) WARN_UNUSED_RESULT;
 void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) WARN_UNUSED_RESULT;
 char * EXPORT_FUNC(xstrdup) (const char *str) WARN_UNUSED_RESULT;
index d2dc7efc4a04d0bbdf5721b7bdbd035cd649f779..d71c9e858a7fd2d65257d38977474ff02b36b717 100644 (file)
@@ -232,8 +232,8 @@ find_partition (grub_disk_t dsk __attribute__ ((unused)),
 {
   struct grub_util_biosdisk_get_grub_dev_ctx *ctx = data;
   grub_disk_addr_t part_start = 0;
-  grub_util_info ("Partition %d starts from %" PRIuGRUB_UINT64_T,
-                 partition->number, partition->start);
+  grub_util_info ("Partition %d starts from %" GRUB_HOST_PRIuLONG_LONG,
+                 partition->number, (unsigned long long) partition->start);
 
   part_start = grub_partition_get_start (partition);
 
@@ -374,7 +374,8 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
       }
 #endif
 
-    grub_util_info ("%s starts from %" PRIuGRUB_UINT64_T, os_dev, ctx.start);
+    grub_util_info ("%s starts from %" GRUB_HOST_PRIuLONG_LONG,
+                   os_dev, (unsigned long long) ctx.start);
 
     if (ctx.start == 0 && !is_part)
       return name;
index ee5880c506a0dd6061be05c0126879bc20f8d025..23dd558e4122cd0d88e180849a1e0b0079e2cc65 100644 (file)
@@ -86,7 +86,7 @@ read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len, void
       if ((! dev) || (! dev->disk))
         grub_util_error ("%s", grub_errmsg);
 
-      grub_util_info ("total sectors : %lld",
+      grub_util_info ("total sectors : %" GRUB_HOST_PRIuLONG_LONG,
                       (unsigned long long) dev->disk->total_sectors);
 
       if (! leng)
@@ -123,7 +123,8 @@ read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len, void
       return;
     }
 
-  grub_util_info ("file size : %lld", (unsigned long long) file->size);
+  grub_util_info ("file size : %" GRUB_HOST_PRIuLONG_LONG,
+                 (unsigned long long) file->size);
 
   if (skip > file->size)
     {
index 832302e59e4f9d377304ac39c01933741a080618..27aef711d8ecffd3b61306ae267dbca1eb9dc54d 100644 (file)
@@ -434,7 +434,8 @@ SUFFIX (relocate_symbols) (Elf_Ehdr *e, Elf_Shdr *sections,
          *jptr = 0;
          jptr++;
        }
-      grub_util_info ("locating %s at 0x%llx (0x%llx)", name,
+      grub_util_info ("locating %s at 0x%"  GRUB_HOST_PRIxLONG_LONG
+                     " (0x%"  GRUB_HOST_PRIxLONG_LONG ")", name,
                      (unsigned long long) sym->st_value,
                      (unsigned long long) section_addresses[cur_index]);
 
@@ -660,7 +661,9 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
                  /* This is absolute.  */
                  *target = grub_host_to_target32 (grub_target_to_host32 (*target)
                                                   + addend + sym_addr);
-                 grub_util_info ("relocating an R_386_32 entry to 0x%llx at the offset 0x%llx",
+                 grub_util_info ("relocating an R_386_32 entry to 0x%"
+                                 GRUB_HOST_PRIxLONG_LONG " at the offset 0x%"
+                                 GRUB_HOST_PRIxLONG_LONG,
                                  (unsigned long long) *target,
                                  (unsigned long long) offset);
                  break;
@@ -671,7 +674,9 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
                                                   + addend + sym_addr
                                                   - target_section_addr - offset
                                                   - image_target->vaddr_offset);
-                 grub_util_info ("relocating an R_386_PC32 entry to 0x%llx at the offset 0x%llx",
+                 grub_util_info ("relocating an R_386_PC32 entry to 0x%"
+                                 GRUB_HOST_PRIxLONG_LONG " at the offset 0x%"
+                                 GRUB_HOST_PRIxLONG_LONG,
                                  (unsigned long long) *target,
                                  (unsigned long long) offset);
                  break;
@@ -692,7 +697,9 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
                case R_X86_64_64:
                  *target = grub_host_to_target64 (grub_target_to_host64 (*target)
                                                   + addend + sym_addr);
-                 grub_util_info ("relocating an R_X86_64_64 entry to 0x%llx at the offset 0x%llx",
+                 grub_util_info ("relocating an R_X86_64_64 entry to 0x%"
+                                 GRUB_HOST_PRIxLONG_LONG " at the offset 0x%"
+                                 GRUB_HOST_PRIxLONG_LONG,
                                  (unsigned long long) *target,
                                  (unsigned long long) offset);
                  break;
@@ -704,7 +711,8 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
                                                  + addend + sym_addr
                                                  - target_section_addr - offset
                                                  - image_target->vaddr_offset);
-                   grub_util_info ("relocating an R_X86_64_PC32 entry to 0x%x at the offset 0x%llx",
+                   grub_util_info ("relocating an R_X86_64_PC32 entry to 0x%x at the offset 0x%"
+                                   GRUB_HOST_PRIxLONG_LONG,
                                    *t32, (unsigned long long) offset);
                    break;
                  }
@@ -715,7 +723,9 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
                                                     + addend + sym_addr
                                                     - target_section_addr - offset
                                                     - image_target->vaddr_offset);
-                   grub_util_info ("relocating an R_X86_64_PC64 entry to 0x%llx at the offset 0x%llx",
+                   grub_util_info ("relocating an R_X86_64_PC64 entry to 0x%"
+                                   GRUB_HOST_PRIxLONG_LONG " at the offset 0x%"
+                                   GRUB_HOST_PRIxLONG_LONG,
                                    (unsigned long long) *target,
                                    (unsigned long long) offset);
                    break;
@@ -727,7 +737,8 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
                    grub_uint32_t *t32 = (grub_uint32_t *) target;
                    *t32 = grub_host_to_target64 (grub_target_to_host32 (*t32)
                                                  + addend + sym_addr);
-                   grub_util_info ("relocating an R_X86_64_32(S) entry to 0x%x at the offset 0x%llx",
+                   grub_util_info ("relocating an R_X86_64_32(S) entry to 0x%x at the offset 0x%"
+                                   GRUB_HOST_PRIxLONG_LONG,
                                    *t32, (unsigned long long) offset);
                    break;
                  }
@@ -750,7 +761,8 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
                    tr++;
                    if (noff & ~MASK19)
                      grub_util_error ("trampoline offset too big (%"
-                                      PRIxGRUB_UINT64_T ")", noff);
+                                      GRUB_HOST_PRIxLONG_LONG ")",
+                                      (unsigned long long) noff);
                    grub_ia64_add_value_to_slot_20b ((grub_addr_t) target, noff);
                  }
                  break;
@@ -796,7 +808,9 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
                  *target = grub_host_to_target64 (grub_target_to_host64 (*target)
                                                   + addend + sym_addr);
                  grub_util_info ("relocating a direct entry to 0x%"
-                                 PRIxGRUB_UINT64_T " at the offset 0x%llx",
+                                 GRUB_HOST_PRIxLONG_LONG " at the offset 0x%"
+                                 GRUB_HOST_PRIxLONG_LONG,
+                                 (unsigned long long)
                                  grub_target_to_host64 (*target),
                                  (unsigned long long) offset);
                  break;
@@ -1095,7 +1109,8 @@ SUFFIX (make_reloc_section) (Elf_Ehdr *e, void **out,
                    Elf_Addr addr;
 
                    addr = section_address + offset;
-                   grub_util_info ("adding a relocation entry for 0x%llx",
+                   grub_util_info ("adding a relocation entry for 0x%"
+                                   GRUB_HOST_PRIxLONG_LONG,
                                    (unsigned long long) addr);
                    current_address
                      = SUFFIX (add_fixup_entry) (&lst,
@@ -1115,7 +1130,8 @@ SUFFIX (make_reloc_section) (Elf_Ehdr *e, void **out,
                    Elf_Addr addr;
 
                    addr = section_address + offset;
-                   grub_util_info ("adding a relocation entry for 0x%llx",
+                   grub_util_info ("adding a relocation entry for 0x%"
+                                   GRUB_HOST_PRIxLONG_LONG,
                                    (unsigned long long) addr);
                    current_address
                      = SUFFIX (add_fixup_entry) (&lst,
@@ -1145,7 +1161,8 @@ SUFFIX (make_reloc_section) (Elf_Ehdr *e, void **out,
                    Elf_Addr addr;
 
                    addr = section_address + offset;
-                   grub_util_info ("adding a relocation entry for 0x%llx",
+                   grub_util_info ("adding a relocation entry for 0x%"
+                                   GRUB_HOST_PRIxLONG_LONG,
                                    (unsigned long long) addr);
                    current_address
                      = SUFFIX (add_fixup_entry) (&lst,
@@ -1348,7 +1365,8 @@ SUFFIX (locate_sections) (const char *kernel_path,
        if (align)
          current_address = ALIGN_UP (current_address + image_target->vaddr_offset,
                                      align) - image_target->vaddr_offset;
-       grub_util_info ("locating the section %s at 0x%llx",
+       grub_util_info ("locating the section %s at 0x%"
+                       GRUB_HOST_PRIxLONG_LONG,
                        name, (unsigned long long) current_address);
        if (image_target->id != IMAGE_EFI)
          {
@@ -1385,7 +1403,8 @@ SUFFIX (locate_sections) (const char *kernel_path,
                                      align)
            - image_target->vaddr_offset;
 
-       grub_util_info ("locating the section %s at 0x%llx",
+       grub_util_info ("locating the section %s at 0x%"
+                       GRUB_HOST_PRIxLONG_LONG,
                        name, (unsigned long long) current_address);
        if (image_target->id != IMAGE_EFI)
          current_address = grub_host_to_target_addr (s->sh_addr)
@@ -1478,7 +1497,8 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size,
                                          sec_align)
                - image_target->vaddr_offset;
        
-           grub_util_info ("locating the section %s at 0x%llx",
+           grub_util_info ("locating the section %s at 0x%"
+                           GRUB_HOST_PRIxLONG_LONG,
                            name, (unsigned long long) current_address);
            if (image_target->id != IMAGE_EFI)
              current_address = grub_host_to_target_addr (s->sh_addr)
index 9eb1fc13cef3fa81760c862ccb827c1d02f16738..386d8472fae886b30b84cb3d175ca3af02db309c 100644 (file)
@@ -146,7 +146,8 @@ void
 grub_util_write_image_at (const void *img, size_t size, off_t offset, FILE *out,
                          const char *name)
 {
-  grub_util_info ("writing 0x%llx bytes at offset 0x%llx",
+  grub_util_info ("writing 0x%" GRUB_HOST_PRIxLONG_LONG " bytes at offset 0x%"
+                 GRUB_HOST_PRIxLONG_LONG,
                  (unsigned long long) size, (unsigned long long) offset);
   if (fseeko (out, offset, SEEK_SET) == -1)
     grub_util_error (_("cannot seek `%s': %s"),
@@ -160,7 +161,7 @@ void
 grub_util_write_image (const char *img, size_t size, FILE *out,
                       const char *name)
 {
-  grub_util_info ("writing 0x%llx bytes", (unsigned long long) size);
+  grub_util_info ("writing 0x%" GRUB_HOST_PRIxLONG_LONG " bytes", (unsigned long long) size);
   if (fwrite (img, 1, size, out) != size)
     {
       if (!name)
index ad12f8a76f7d7b77bf2cc1ef9c4d19d407ba5017..709b26cdeabf44e5e35e365c2f788d51624004e3 100644 (file)
@@ -1023,8 +1023,9 @@ grub_install_generate_image (const char *dir, const char *prefix,
       {
        size_t curs;
        curs = ALIGN_ADDR (grub_util_get_image_size (pubkey_paths[i]));
-       grub_util_info ("the size of public key %zd is 0x%llx",
-                       i, (unsigned long long) curs);
+       grub_util_info ("the size of public key %u is 0x%"
+                       GRUB_HOST_PRIxLONG_LONG,
+                       (unsigned) i, (unsigned long long) curs);
        total_module_size += curs + sizeof (struct grub_module_header);
       }
   }
@@ -1032,7 +1033,7 @@ grub_install_generate_image (const char *dir, const char *prefix,
   if (memdisk_path)
     {
       memdisk_size = ALIGN_UP(grub_util_get_image_size (memdisk_path), 512);
-      grub_util_info ("the size of memory disk is 0x%llx",
+      grub_util_info ("the size of memory disk is 0x%" GRUB_HOST_PRIxLONG_LONG,
                      (unsigned long long) memdisk_size);
       total_module_size += memdisk_size + sizeof (struct grub_module_header);
     }
@@ -1041,7 +1042,7 @@ grub_install_generate_image (const char *dir, const char *prefix,
     {
       config_size_pure = grub_util_get_image_size (config_path) + 1;
       config_size = ALIGN_ADDR (config_size_pure);
-      grub_util_info ("the size of config file is 0x%llx",
+      grub_util_info ("the size of config file is 0x%" GRUB_HOST_PRIxLONG_LONG,
                      (unsigned long long) config_size);
       total_module_size += config_size + sizeof (struct grub_module_header);
     }
@@ -1056,7 +1057,7 @@ grub_install_generate_image (const char *dir, const char *prefix,
     total_module_size += (ALIGN_ADDR (grub_util_get_image_size (p->name))
                          + sizeof (struct grub_module_header));
 
-  grub_util_info ("the total module size is 0x%llx",
+  grub_util_info ("the total module size is 0x%" GRUB_HOST_PRIxLONG_LONG,
                  (unsigned long long) total_module_size);
 
   if (image_target->voidp_sizeof == 4)
@@ -1196,13 +1197,15 @@ grub_install_generate_image (const char *dir, const char *prefix,
       offset += prefix_size;
     }
 
-  grub_util_info ("kernel_img=%p, kernel_size=0x%llx", kernel_img,
+  grub_util_info ("kernel_img=%p, kernel_size=0x%" GRUB_HOST_PRIxLONG_LONG,
+                 kernel_img,
                  (unsigned long long) kernel_size);
   compress_kernel (image_target, kernel_img, kernel_size + total_module_size,
                   &core_img, &core_size, comp);
   free (kernel_img);
 
-  grub_util_info ("the core size is 0x%llx", (unsigned long long) core_size);
+  grub_util_info ("the core size is 0x%" GRUB_HOST_PRIxLONG_LONG,
+                 (unsigned long long) core_size);
 
   if (!(image_target->flags & PLATFORM_FLAGS_DECOMPRESSORS) 
       && image_target->total_module_size != TARGET_NO_FIELD)
index 60bce683c0759f6bec2fdde43f23707b5449149b..9fb91a82f5dfaaafd470eed671c7e79f87585efd 100644 (file)
@@ -151,8 +151,8 @@ save_blocklists (grub_disk_addr_t sector, unsigned offset, unsigned length,
   struct grub_boot_blocklist *prev = bl->block + 1;
   grub_uint64_t seclen;
 
-  grub_util_info ("saving <%" PRIuGRUB_UINT64_T ",%u,%u>",
-                 sector, offset, length);
+  grub_util_info ("saving <%"  GRUB_HOST_PRIuLONG_LONG ",%u,%u>",
+                 (unsigned long long) sector, offset, length);
 
   if (bl->first_sector == (grub_disk_addr_t) -1)
     {