diff --git a/ChangeLog b/ChangeLog index 02e89cda8..2c9b65757 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-04-15 Pavel Roskin + + * include/grub/types.h: Rename ULONG_MAX to GRUB_ULONG_MAX and + LONG_MAX to GRUB_LONG_MAX. Introduce GRUB_LONG_MIN. Update all + users of ULONG_MAX, LONG_MAX and LONG_MIN to use the new + definitions. + 2009-04-15 Felix Zielcke * disk/lvm.c (grub_lvm_scan_device): Add `LVM' to the error messages, diff --git a/disk/i386/pc/biosdisk.c b/disk/i386/pc/biosdisk.c index 120d46f25..ba1eb77b8 100644 --- a/disk/i386/pc/biosdisk.c +++ b/disk/i386/pc/biosdisk.c @@ -120,7 +120,7 @@ grub_biosdisk_open (const char *name, grub_disk_t disk) { data->flags = GRUB_BIOSDISK_FLAG_LBA | GRUB_BIOSDISK_FLAG_CDROM; data->sectors = 32; - total_sectors = ULONG_MAX; /* TODO: get the correct size. */ + total_sectors = GRUB_ULONG_MAX; /* TODO: get the correct size. */ } else if (drive & 0x80) { diff --git a/disk/raid.c b/disk/raid.c index 4d6422236..2b3130b20 100644 --- a/disk/raid.c +++ b/disk/raid.c @@ -604,7 +604,7 @@ grub_raid_scan_device (int head_only) if (!disk) return 0; - if (disk->total_sectors == ULONG_MAX) + if (disk->total_sectors == GRUB_ULONG_MAX) { grub_disk_close (disk); return 0; diff --git a/fs/fshelp.c b/fs/fshelp.c index a5eccdd68..89b62387f 100644 --- a/fs/fshelp.c +++ b/fs/fshelp.c @@ -83,7 +83,7 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode, if (filetype == GRUB_FSHELP_UNKNOWN || (grub_strcmp (name, filename) && (! (filetype & GRUB_FSHELP_CASE_INSENSITIVE) || - grub_strncasecmp (name, filename, LONG_MAX)))) + grub_strncasecmp (name, filename, GRUB_LONG_MAX)))) { grub_free (node); return 0; diff --git a/include/grub/types.h b/include/grub/types.h index 8d51b66f7..50f8f58d5 100644 --- a/include/grub/types.h +++ b/include/grub/types.h @@ -93,11 +93,13 @@ typedef grub_int32_t grub_ssize_t; #endif #if GRUB_CPU_SIZEOF_VOID_P == 8 -# define ULONG_MAX 18446744073709551615UL -# define LONG_MAX 9223372036854775807UL +# define GRUB_ULONG_MAX 18446744073709551615UL +# define GRUB_LONG_MAX 9223372036854775807UL +# define GRUB_LONG_MIN -9223372036854775808UL #else -# define ULONG_MAX 4294967295UL -# define LONG_MAX 2147483647UL +# define GRUB_ULONG_MAX 4294967295UL +# define GRUB_LONG_MAX 2147483647UL +# define GRUB_LONG_MIN -2147483648UL #endif /* The type for representing a file offset. */ diff --git a/kern/i386/coreboot/init.c b/kern/i386/coreboot/init.c index 13484886d..fdaf6fd84 100644 --- a/kern/i386/coreboot/init.c +++ b/kern/i386/coreboot/init.c @@ -81,13 +81,13 @@ grub_machine_init (void) { #if GRUB_CPU_SIZEOF_VOID_P == 4 /* Restrict ourselves to 32-bit memory space. */ - if (addr > ULONG_MAX) + if (addr > GRUB_ULONG_MAX) { - grub_upper_mem = ULONG_MAX; + grub_upper_mem = GRUB_ULONG_MAX; return 0; } - if (addr + size > ULONG_MAX) - size = ULONG_MAX - addr; + if (addr + size > GRUB_ULONG_MAX) + size = GRUB_ULONG_MAX - addr; #endif grub_upper_mem = grub_max (grub_upper_mem, addr + size); diff --git a/util/hostdisk.c b/util/hostdisk.c index 2fd1010a2..aa41703fe 100644 --- a/util/hostdisk.c +++ b/util/hostdisk.c @@ -1004,7 +1004,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev) p++; n = strtol (p, &q, 10); - if (p != q && n != LONG_MIN && n != LONG_MAX) + if (p != q && n != GRUB_LONG_MIN && n != GRUB_LONG_MAX) { dos_part = (int) n; @@ -1035,7 +1035,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev) { p++; n = strtol (p, &q, 10); - if (p != q && n != LONG_MIN && n != LONG_MAX) + if (p != q && n != GRUB_LONG_MIN && n != GRUB_LONG_MAX) { dos_part = (int) n - 1;