merge mainline into nestpart
This commit is contained in:
commit
bc6fcf0931
62 changed files with 7634 additions and 189 deletions
|
|
@ -339,7 +339,8 @@ open_device (const grub_disk_t disk, grub_disk_addr_t sector, int flags)
|
|||
part_start = grub_partition_get_start (disk->partition);
|
||||
|
||||
strcpy (dev, map[disk->id].device);
|
||||
if (disk->partition && strncmp (map[disk->id].device, "/dev/", 5) == 0)
|
||||
if (disk->partition && sector >= part_start
|
||||
&& strncmp (map[disk->id].device, "/dev/", 5) == 0)
|
||||
is_partition = linux_find_partition (dev, part_start);
|
||||
|
||||
/* Open the partition. */
|
||||
|
|
@ -493,6 +494,23 @@ grub_util_biosdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
{
|
||||
int fd;
|
||||
|
||||
/* Split pre-partition and partition reads. */
|
||||
if (disk->partition && sector < disk->partition->start
|
||||
&& sector + size > disk->partition->start)
|
||||
{
|
||||
grub_err_t err;
|
||||
err = grub_util_biosdisk_read (disk, sector,
|
||||
disk->partition->start - sector,
|
||||
buf);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return grub_util_biosdisk_read (disk, disk->partition->start,
|
||||
size - (disk->partition->start - sector),
|
||||
buf + ((disk->partition->start - sector)
|
||||
<< GRUB_DISK_SECTOR_BITS));
|
||||
}
|
||||
|
||||
fd = open_device (disk, sector, O_RDONLY);
|
||||
if (fd < 0)
|
||||
return grub_errno;
|
||||
|
|
@ -530,6 +548,23 @@ grub_util_biosdisk_write (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
{
|
||||
int fd;
|
||||
|
||||
/* Split pre-partition and partition writes. */
|
||||
if (disk->partition && sector < disk->partition->start
|
||||
&& sector + size > disk->partition->start)
|
||||
{
|
||||
grub_err_t err;
|
||||
err = grub_util_biosdisk_write (disk, sector,
|
||||
disk->partition->start - sector,
|
||||
buf);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return grub_util_biosdisk_write (disk, disk->partition->start,
|
||||
size - (disk->partition->start - sector),
|
||||
buf + ((disk->partition->start - sector)
|
||||
<< GRUB_DISK_SECTOR_BITS));
|
||||
}
|
||||
|
||||
fd = open_device (disk, sector, O_WRONLY);
|
||||
if (fd < 0)
|
||||
return grub_errno;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue