2008-06-08 Robert Millan <rmh@aybabtu.com>

Based on description from Pavel:
        * kern/disk.c (grub_disk_check_range): Rename to ...
        (grub_disk_adjust_range): ... this.  Add a comment explaining the
        tasks performed by this function.
This commit is contained in:
robertmh 2008-06-08 19:46:43 +00:00
parent ad4936a035
commit ce525529f9
2 changed files with 14 additions and 3 deletions

View file

@ -1,3 +1,10 @@
2008-06-08 Robert Millan <rmh@aybabtu.com>
Based on description from Pavel:
* kern/disk.c (grub_disk_check_range): Rename to ...
(grub_disk_adjust_range): ... this. Add a comment explaining the
tasks performed by this function.
2008-06-08 Robert Millan <rmh@aybabtu.com> 2008-06-08 Robert Millan <rmh@aybabtu.com>
* include/grub/ntfs.h (struct grub_ntfs_bpb): Rename `serial_number' to * include/grub/ntfs.h (struct grub_ntfs_bpb): Rename `serial_number' to

View file

@ -322,8 +322,12 @@ grub_disk_close (grub_disk_t disk)
grub_free (disk); grub_free (disk);
} }
/* This function performs three tasks:
- Make sectors disk relative from partition relative.
- Normalize offset to be less than the sector size.
- Verify that the range is inside the partition. */
static grub_err_t static grub_err_t
grub_disk_check_range (grub_disk_t disk, grub_disk_addr_t *sector, grub_disk_adjust_range (grub_disk_t disk, grub_disk_addr_t *sector,
grub_off_t *offset, grub_size_t size) grub_off_t *offset, grub_size_t size)
{ {
*sector += *offset >> GRUB_DISK_SECTOR_BITS; *sector += *offset >> GRUB_DISK_SECTOR_BITS;
@ -364,7 +368,7 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
grub_dprintf ("disk", "Reading `%s'...\n", disk->name); grub_dprintf ("disk", "Reading `%s'...\n", disk->name);
/* First of all, check if the region is within the disk. */ /* First of all, check if the region is within the disk. */
if (grub_disk_check_range (disk, &sector, &offset, size) != GRUB_ERR_NONE) if (grub_disk_adjust_range (disk, &sector, &offset, size) != GRUB_ERR_NONE)
{ {
grub_error_push (); grub_error_push ();
grub_dprintf ("disk", "Read out of range: sector 0x%llx (%s).\n", grub_dprintf ("disk", "Read out of range: sector 0x%llx (%s).\n",
@ -502,7 +506,7 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
grub_dprintf ("disk", "Writing `%s'...\n", disk->name); grub_dprintf ("disk", "Writing `%s'...\n", disk->name);
if (grub_disk_check_range (disk, &sector, &offset, size) != GRUB_ERR_NONE) if (grub_disk_adjust_range (disk, &sector, &offset, size) != GRUB_ERR_NONE)
return -1; return -1;
real_offset = offset; real_offset = offset;