* grub-core/kern/ieee1275/openfw.c (grub_claimmap): Change to

grub_error framework. All users updated.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-02-04 14:00:23 +01:00
parent c39992a436
commit db606889a9
6 changed files with 21 additions and 11 deletions

View file

@ -1,3 +1,8 @@
2012-02-04 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/ieee1275/openfw.c (grub_claimmap): Change to
grub_error framework. All users updated.
2012-02-04 Vladimir Serbinenko <phcoder@gmail.com> 2012-02-04 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/gettext/gettext.c: Mostly rewritten to avoid using * grub-core/gettext/gettext.c: Mostly rewritten to avoid using

View file

@ -192,11 +192,11 @@ grub_claim_heap (void)
if (len) if (len)
{ {
grub_err_t err;
/* Claim and use it. */ /* Claim and use it. */
if (grub_claimmap (addr, len) < 0) err = grub_claimmap (addr, len);
return grub_error (GRUB_ERR_OUT_OF_MEMORY, if (err)
"failed to claim heap at 0x%llx, len 0x%llx", return err;
addr, len);
grub_mm_init_region ((void *) (grub_addr_t) addr, len); grub_mm_init_region ((void *) (grub_addr_t) addr, len);
} }

View file

@ -255,7 +255,7 @@ grub_ieee1275_map (grub_addr_t phys, grub_addr_t virt, grub_size_t size,
return args.catch_result; return args.catch_result;
} }
int grub_err_t
grub_claimmap (grub_addr_t addr, grub_size_t size) grub_claimmap (grub_addr_t addr, grub_size_t size)
{ {
if (grub_ieee1275_claim (addr, size, 0, 0)) if (grub_ieee1275_claim (addr, size, 0, 0))
@ -264,13 +264,13 @@ grub_claimmap (grub_addr_t addr, grub_size_t size)
if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_REAL_MODE) if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_REAL_MODE)
&& grub_ieee1275_map (addr, addr, size, 0x00)) && grub_ieee1275_map (addr, addr, size, 0x00))
{ {
grub_printf ("map failed: address 0x%llx, size 0x%llx\n", grub_error (GRUB_ERR_OUT_OF_MEMORY, "map failed: address 0x%llx, size 0x%llx\n",
(long long) addr, (long long) size); (long long) addr, (long long) size);
grub_ieee1275_release (addr, size); grub_ieee1275_release (addr, size);
return -1; return grub_errno;
} }
return 0; return GRUB_ERR_NONE;
} }
/* Get the device arguments of the Open Firmware node name `path'. */ /* Get the device arguments of the Open Firmware node name `path'. */

View file

@ -85,7 +85,10 @@ grub_relocator_firmware_fill_events (struct grub_relocator_mmap_event *events)
int int
grub_relocator_firmware_alloc_region (grub_addr_t start, grub_size_t size) grub_relocator_firmware_alloc_region (grub_addr_t start, grub_size_t size)
{ {
return (grub_claimmap (start, size) >= 0); grub_err_t err;
err = grub_claimmap (start, size);
grub_errno = 0;
return (err == 0);
} }
void void

View file

@ -76,6 +76,7 @@ grub_linux_claimmap_iterate (grub_addr_t target, grub_size_t size,
found_addr = target; found_addr = target;
return 1; return 1;
} }
grub_print_error ();
} }
/* Target below the memory chunk. */ /* Target below the memory chunk. */
if (target < addr && addr + size <= end) if (target < addr && addr + size <= end)
@ -85,6 +86,7 @@ grub_linux_claimmap_iterate (grub_addr_t target, grub_size_t size,
found_addr = addr; found_addr = addr;
return 1; return 1;
} }
grub_print_error ();
} }
return 0; return 0;
} }

View file

@ -186,7 +186,7 @@ int EXPORT_FUNC(grub_devalias_iterate)
(int (*hook) (struct grub_ieee1275_devalias *alias)); (int (*hook) (struct grub_ieee1275_devalias *alias));
int EXPORT_FUNC(grub_children_iterate) (const char *devpath, int EXPORT_FUNC(grub_children_iterate) (const char *devpath,
int (*hook) (struct grub_ieee1275_devalias *alias)); int (*hook) (struct grub_ieee1275_devalias *alias));
int EXPORT_FUNC(grub_claimmap) (grub_addr_t addr, grub_size_t size); grub_err_t EXPORT_FUNC(grub_claimmap) (grub_addr_t addr, grub_size_t size);
int int
EXPORT_FUNC(grub_ieee1275_map) (grub_addr_t phys, grub_addr_t virt, EXPORT_FUNC(grub_ieee1275_map) (grub_addr_t phys, grub_addr_t virt,