From: Andrey Borzenkov <arvidjaar@gmail.com>
To: grub-devel@gnu.org
Subject: Re: [PATCH] Make grub_efidisk_get_device_name() work on 4K native disks.
Date: Wed, 3 Apr 2013 23:03:46 +0400 [thread overview]
Message-ID: <20130403230346.01b981c2@opensuse.site> (raw)
In-Reply-To: <1365004386-24760-1-git-send-email-pjones@redhat.com>
В Wed, 3 Apr 2013 11:53:06 -0400
Peter Jones <pjones@redhat.com> пишет:
> When we have 4kB sectors instead of 512b sectors, hd.partition_start and
> grub_partition_get_start() won't match - the latter assumes 512-byte
> sectors, and the former gives us the correct number based on the
> physical media's sector size. So when we have to compare them, we need
> to compensate.
>
> Signed-off-by: Peter Jones <pjones@redhat.com>
> ---
> grub-core/disk/efi/efidisk.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c
> index 77ab5b0..a905b52 100644
> --- a/grub-core/disk/efi/efidisk.c
> +++ b/grub-core/disk/efi/efidisk.c
> @@ -791,11 +791,13 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
> auto int find_partition (grub_disk_t disk, const grub_partition_t part);
>
You need to rebase to current trunk which does not use nested functions
anymore. Also in current trunk there is second use of
grub_partition_get_start() which looks like it has the same issue.
> /* Find the identical partition. */
> - int find_partition (grub_disk_t disk __attribute__ ((unused)),
> - const grub_partition_t part)
> + int find_partition (grub_disk_t disk, const grub_partition_t part)
> {
> - if (grub_partition_get_start (part) == hd.partition_start
> - && grub_partition_get_len (part) == hd.partition_size)
> + struct grub_efidisk_data *d = disk->data;
> + grub_efi_block_io_media_t *m = d->block_io->media;
> +
> + if (grub_partition_get_start (part) / (m->block_size / 512) == hd.partition_start
> + && grub_partition_get_len (part) / (m->block_size / 512) == hd.partition_size)
> {
> partition_name = grub_partition_get_name (part);
> return 1;
next prev parent reply other threads:[~2013-04-03 19:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-03 15:53 [PATCH] Make grub_efidisk_get_device_name() work on 4K native disks Peter Jones
2013-04-03 19:03 ` Andrey Borzenkov [this message]
2013-04-04 17:52 ` Peter Jones
2013-04-04 18:14 ` Andrey Borzenkov
2013-04-05 7:09 ` Vladimir 'φ-coder/phcoder' Serbinenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130403230346.01b981c2@opensuse.site \
--to=arvidjaar@gmail.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).