From: Robert Millan <rmh@aybabtu.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] biosdisk, getroot for Cygwin
Date: Fri, 9 May 2008 14:45:06 +0200 [thread overview]
Message-ID: <20080509124506.GA3705@thorin> (raw)
In-Reply-To: <4822142F.1040505@t-online.de>
On Wed, May 07, 2008 at 10:42:23PM +0200, Christian Franke wrote:
> +
> + /* Check signature. */
> + if (!(buf[0x1fe] == 0x55 && buf[0x1ff] == 0xaa))
> + return ~0;
> +
> + /* Serial number offset depends on boot sector type. */
> + if (mbr)
> + n = 0x1b8;
> + else if (memcmp (buf + 0x03, "NTFS", 4) == 0)
> + n = 0x048;
> + else if (memcmp (buf + 0x52, "FAT32", 5) == 0)
> + n = 0x043;
> + else if (memcmp (buf + 0x36, "FAT", 3) == 0)
> + n = 0x027;
Did you consider using a struct here?
> + /* Cygwin returns the partition serial number in stat.st_dev.
> + This is never identical to the device number of the emulated
> + /dev/sdXN device, so above find_root_device () does not work.
> + Search the partion with the same serial in boot sector instead. */
> + char devpath[sizeof ("/dev/sda15") + 13];
Where does this 13 come from? Would be nice to make it explicit (e.g.
sizeof(something) or so).
> +#ifndef __CYGWIN__
> #ifdef __linux__
> /* We first try to find the device in the /dev/mapper directory. If
> we don't do this, we get useless device names like /dev/dm-0 for
> @@ -242,12 +373,19 @@ grub_guess_root_device (const char *dir)
> os_dev = find_root_device ("/dev", st.st_dev);
> }
>
> +#else
> + /* Cygwin specific function. */
> + os_dev = find_cygwin_root_device (dir, st.st_dev);
> +
> +#endif /* __CYGWIN__ */
The logic here seems a bit over-complicated. Surely whenever you have __linux__
you don't have __CYGWIN__. Are you sure it can't be simplified?
> +#ifndef __CYGWIN__
> /* Check for LVM. */
> if (!strncmp (os_dev, "/dev/mapper/", 12))
> return GRUB_DEV_ABSTRACTION_LVM;
> @@ -255,6 +393,7 @@ grub_util_get_dev_abstraction (const char *os_dev)
> /* Check for RAID. */
> if (!strncmp (os_dev, "/dev/md", 7))
> return GRUB_DEV_ABSTRACTION_RAID;
> +#endif /* !__CYGWIN__ */
I think what we're missing here is "ifdef __linux__" since both LVM and
dmRAID are Linux-specific.
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
next prev parent reply other threads:[~2008-05-09 12:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-23 20:30 [PATCH] biosdisk, getroot for Cygwin Christian Franke
2008-05-07 20:42 ` Christian Franke
2008-05-09 12:45 ` Robert Millan [this message]
2008-05-09 17:32 ` Christian Franke
2008-05-11 21:04 ` Christian Franke
2008-05-12 15:25 ` Robert Millan
2008-05-13 21:17 ` Christian Franke
2008-05-16 21:43 ` Christian Franke
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=20080509124506.GA3705@thorin \
--to=rmh@aybabtu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.