* grub-core/kern/disk.c (grub_disk_write): Fix sector number on 4K

sector devices.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-01-10 08:09:26 +01:00
parent f8861eaf9f
commit 4dedb13f51
2 changed files with 13 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2013-01-10 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/disk.c (grub_disk_write): Fix sector number on 4K
sector devices.
2013-01-07 Colin Watson <cjwatson@ubuntu.com>
* grub-core/io/bufio.c (grub_bufio_open): Use grub_zalloc instead of

View file

@ -658,7 +658,8 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
grub_disk_cache_invalidate (disk->dev->id, disk->id, sector);
if ((disk->dev->write) (disk, sector, 1, tmp_buf) != GRUB_ERR_NONE)
if ((disk->dev->write) (disk, transform_sector (disk, sector),
1, tmp_buf) != GRUB_ERR_NONE)
goto finish;
sector += (1 << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS));
@ -674,11 +675,15 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
len = size & ~((1 << disk->log_sector_size) - 1);
n = size >> disk->log_sector_size;
if ((disk->dev->write) (disk, sector, n, buf) != GRUB_ERR_NONE)
if ((disk->dev->write) (disk, transform_sector (disk, sector),
n, buf) != GRUB_ERR_NONE)
goto finish;
while (n--)
grub_disk_cache_invalidate (disk->dev->id, disk->id, sector++);
{
grub_disk_cache_invalidate (disk->dev->id, disk->id, sector);
sector += (1 << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS));
}
buf = (const char *) buf + len;
size -= len;