grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] grub-install: Improve support for partitioned loop devices.
@ 2014-01-26  1:41 Mike Gilbert
  2014-01-26  5:16 ` Andrey Borzenkov
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Gilbert @ 2014-01-26  1:41 UTC (permalink / raw)
  To: grub-devel

* grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Detect
/dev/loopX as being the parent of /dev/loopXpY.
---
 ChangeLog                       |  5 +++++
 grub-core/osdep/linux/getroot.c | 13 +++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index c93f11f..d5c5c3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-01-26  Mike Gilbert <floppym@gentoo.org>
+	grub-install: Improve support for partitioned loop devices.
+
+	* grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Detect
+	/dev/loopX as being the parent of /dev/loopXpY.
 
 2014-01-25  Andrey Borzenkov <arvidjaar@gmail.com>
 
diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
index 772de0a..19581d3 100644
--- a/grub-core/osdep/linux/getroot.c
+++ b/grub-core/osdep/linux/getroot.c
@@ -883,6 +883,19 @@ grub_util_part_to_disk (const char *os_dev, struct stat *st,
 	  *pp = '\0';
 	  return path;
 	}
+
+      /* If this is a loop device */
+      if ((strncmp ("loop", p, 4) == 0) && p[4] >= '0' && p[4] <= '9')
+	{
+	  char *pp = p + 4;
+	  while (*pp >= '0' && *pp <= '9')
+	    pp++;
+	  if (*pp == 'p')
+	    *is_part = 1;
+	  /* /dev/loop[0-9]+p[0-9]* */
+	  *pp = '\0';
+	  return path;
+	}
     }
 
   return path;
-- 
1.8.5.3



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] grub-install: Improve support for partitioned loop devices.
  2014-01-26  1:41 [PATCH] grub-install: Improve support for partitioned loop devices Mike Gilbert
@ 2014-01-26  5:16 ` Andrey Borzenkov
  2014-01-26  6:20   ` Mike Gilbert
  0 siblings, 1 reply; 4+ messages in thread
From: Andrey Borzenkov @ 2014-01-26  5:16 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: floppym

В Sat, 25 Jan 2014 20:41:00 -0500
Mike Gilbert <floppym@gentoo.org> пишет:

> * grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Detect
> /dev/loopX as being the parent of /dev/loopXpY.

Those devices are normally device-mapper ones (created by kpartx) and
grub already detects parent by following device-mapper tree. What
exact problem are you trying to solve?

> ---
>  ChangeLog                       |  5 +++++
>  grub-core/osdep/linux/getroot.c | 13 +++++++++++++
>  2 files changed, 18 insertions(+)
> 
> diff --git a/ChangeLog b/ChangeLog
> index c93f11f..d5c5c3c 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,8 @@
> +2014-01-26  Mike Gilbert <floppym@gentoo.org>
> +	grub-install: Improve support for partitioned loop devices.
> +
> +	* grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Detect
> +	/dev/loopX as being the parent of /dev/loopXpY.
>  
>  2014-01-25  Andrey Borzenkov <arvidjaar@gmail.com>
>  
> diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
> index 772de0a..19581d3 100644
> --- a/grub-core/osdep/linux/getroot.c
> +++ b/grub-core/osdep/linux/getroot.c
> @@ -883,6 +883,19 @@ grub_util_part_to_disk (const char *os_dev, struct stat *st,
>  	  *pp = '\0';
>  	  return path;
>  	}
> +
> +      /* If this is a loop device */
> +      if ((strncmp ("loop", p, 4) == 0) && p[4] >= '0' && p[4] <= '9')
> +	{
> +	  char *pp = p + 4;
> +	  while (*pp >= '0' && *pp <= '9')
> +	    pp++;
> +	  if (*pp == 'p')
> +	    *is_part = 1;
> +	  /* /dev/loop[0-9]+p[0-9]* */
> +	  *pp = '\0';
> +	  return path;
> +	}
>      }
>  
>    return path;



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] grub-install: Improve support for partitioned loop devices.
  2014-01-26  5:16 ` Andrey Borzenkov
@ 2014-01-26  6:20   ` Mike Gilbert
  2014-01-26  6:25     ` Andrey Borzenkov
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Gilbert @ 2014-01-26  6:20 UTC (permalink / raw)
  To: Andrey Borzenkov; +Cc: The development of GNU GRUB

On Sun, Jan 26, 2014 at 12:16 AM, Andrey Borzenkov <arvidjaar@gmail.com> wrote:
> В Sat, 25 Jan 2014 20:41:00 -0500
> Mike Gilbert <floppym@gentoo.org> пишет:
>
>> * grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Detect
>> /dev/loopX as being the parent of /dev/loopXpY.
>
> Those devices are normally device-mapper ones (created by kpartx) and
> grub already detects parent by following device-mapper tree. What
> exact problem are you trying to solve?

The kernel supports partitioned loop devices without device mapper.
These can be set up using losetup -P, or by calling partx from
util-linux.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] grub-install: Improve support for partitioned loop devices.
  2014-01-26  6:20   ` Mike Gilbert
@ 2014-01-26  6:25     ` Andrey Borzenkov
  0 siblings, 0 replies; 4+ messages in thread
From: Andrey Borzenkov @ 2014-01-26  6:25 UTC (permalink / raw)
  To: Mike Gilbert; +Cc: The development of GNU GRUB

В Sun, 26 Jan 2014 01:20:09 -0500
Mike Gilbert <floppym@gentoo.org> пишет:

> On Sun, Jan 26, 2014 at 12:16 AM, Andrey Borzenkov <arvidjaar@gmail.com> wrote:
> > В Sat, 25 Jan 2014 20:41:00 -0500
> > Mike Gilbert <floppym@gentoo.org> пишет:
> >
> >> * grub-core/osdep/linux/getroot.c (grub_util_part_to_disk): Detect
> >> /dev/loopX as being the parent of /dev/loopXpY.
> >
> > Those devices are normally device-mapper ones (created by kpartx) and
> > grub already detects parent by following device-mapper tree. What
> > exact problem are you trying to solve?
> 
> The kernel supports partitioned loop devices without device mapper.
> These can be set up using losetup -P, or by calling partx from
> util-linux.

Thank you, was not aware of it.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-01-26  6:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-26  1:41 [PATCH] grub-install: Improve support for partitioned loop devices Mike Gilbert
2014-01-26  5:16 ` Andrey Borzenkov
2014-01-26  6:20   ` Mike Gilbert
2014-01-26  6:25     ` Andrey Borzenkov

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).