[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH V2] grub-core: modify sector by sysfs as disk sector
From: |
Daniel Kiper |
Subject: |
Re: [PATCH V2] grub-core: modify sector by sysfs as disk sector |
Date: |
Tue, 14 Feb 2023 12:45:59 +0100 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
On Thu, Feb 09, 2023 at 04:51:48PM -0600, Glenn Washburn wrote:
> On Thu, 9 Feb 2023 13:09:16 +0530
> Mukesh Kumar Chaurasiya <mchauras@linux.vnet.ibm.com> wrote:
>
> > The disk sector size provided by sysfs file system considers the
> > sector size of 512 irrespective of disk sector size, Thus
> > causing the read by grub to an incorrect offset from what was
> > originally intended.
> >
> > Considering the 512 sector size of sysfs data the actual sector
> > needs to be modified corresponding to disk sector size.
> >
> > Signed-off-by: Mukesh Kumar Chaurasiya <mchauras@linux.vnet.ibm.com>
> > ---
> > grub-core/osdep/linux/hostdisk.c | 8 +++++---
> > include/grub/disk.h | 7 +++++++
> > 2 files changed, 12 insertions(+), 3 deletions(-)
> >
> > diff --git a/grub-core/osdep/linux/hostdisk.c
> > b/grub-core/osdep/linux/hostdisk.c index 07058f63a..fd0769e3b 100644
> > --- a/grub-core/osdep/linux/hostdisk.c
> > +++ b/grub-core/osdep/linux/hostdisk.c
> > @@ -198,7 +198,8 @@ have_devfs (void)
> > #pragma GCC diagnostic ignored "-Wformat-nonliteral"
> >
> > static int
> > -grub_hostdisk_linux_find_partition (char *dev, grub_disk_addr_t
> > sector) +grub_hostdisk_linux_find_partition (const grub_disk_t disk,
> > char *dev,
> > + grub_disk_addr_t sector)
> > {
> > size_t len = strlen (dev);
> > const char *format;
> > @@ -263,7 +264,8 @@ grub_hostdisk_linux_find_partition (char *dev,
> > grub_disk_addr_t sector) if (fstat (fd, &st) < 0
> > || !grub_util_device_is_mapped_stat (&st)
> > || !grub_util_get_dm_node_linear_info (st.st_rdev, 0, 0,
> > &start))
> > - start = grub_util_find_partition_start_os (real_dev);
> > + start = grub_disk_to_native_sector (disk,
> > +
> > grub_util_find_partition_start_os (real_dev)); /* We don't care about
> > errors here. */
>
> There needs to be a space to tab conversion here on both lines. Perhaps
> Daniel you can do this when merging.
Good point! I will do it when I merge the patch.
Thanks,
Daniel