* [PATCH] hurd: Use part: qualifier
@ 2022-02-26 11:51 Samuel Thibault
2022-05-17 14:43 ` Daniel Kiper
0 siblings, 1 reply; 4+ messages in thread
From: Samuel Thibault @ 2022-02-26 11:51 UTC (permalink / raw)
To: grub-devel; +Cc: bug-hurd
When using userland drivers such as rumpdisk, we'd rather make ext2fs use
parted-based libstore partitioning support. That can be used for kernelland
drivers as well, so we can just make grub always use the part: qualifier to
switch ext2fs to it.
grub_util_find_hurd_root_device then has to understand this syntax and translate
it into the /dev/ entry name.
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Index: grub2-2.06/util/grub.d/10_hurd.in
===================================================================
--- grub2-2.06.orig/util/grub.d/10_hurd.in
+++ grub2-2.06/util/grub.d/10_hurd.in
@@ -128,9 +128,11 @@ EOF
else
opts=
fi
+ device=device:${GRUB_DEVICE#/dev/}
+ device=$(echo "$device" | sed -e 's/^device:\(.*[0-9]\+\)s\([0-9]\+\)$/part:\2:device:\1'/)
sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$message" | grub_quote)'
- multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/} $opts ${GRUB_CMDLINE_GNUMACH}
+ multiboot ${kernel} root=$device $opts ${GRUB_CMDLINE_GNUMACH}
EOF
if [ x$type != xrecovery ] ; then
Index: grub2-2.06/grub-core/osdep/hurd/getroot.c
===================================================================
--- grub2-2.06.orig/grub-core/osdep/hurd/getroot.c
+++ grub2-2.06/grub-core/osdep/hurd/getroot.c
@@ -109,6 +109,16 @@ grub_util_find_hurd_root_device (const c
grub_util_error (_("translator `%s' for path `%s' is given only options, "
"cannot find device part"), argz, path);
+ int part = -1;
+ if (strncmp (name, "part:", sizeof ("part:") - 1) == 0)
+ {
+ char *next = strchr (name + sizeof ("part:") - 1, ':');
+ if (next)
+ {
+ part = atoi (name + sizeof ("part:") - 1);
+ name = next + 1;
+ }
+ }
if (strncmp (name, "device:", sizeof ("device:") - 1) == 0)
{
char *dev_name = name + sizeof ("device:") - 1;
@@ -123,11 +133,10 @@ grub_util_find_hurd_root_device (const c
}
{
- size_t size = sizeof ("/dev/") - 1 + strlen (dev_name) + 1;
- char *next;
- ret = malloc (size);
- next = stpncpy (ret, "/dev/", size);
- stpncpy (next, dev_name, size - (next - ret));
+ if (part >= 0)
+ ret = xasprintf("/dev/%ss%u", dev_name, part);
+ else
+ ret = xasprintf("/dev/%s", dev_name);
}
}
else if (!strncmp (name, "file:", sizeof ("file:") - 1))
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hurd: Use part: qualifier
2022-02-26 11:51 [PATCH] hurd: Use part: qualifier Samuel Thibault
@ 2022-05-17 14:43 ` Daniel Kiper
2022-05-25 12:56 ` Daniel Kiper
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Kiper @ 2022-05-17 14:43 UTC (permalink / raw)
To: grub-devel, bug-hurd
On Sat, Feb 26, 2022 at 12:51:18PM +0100, Samuel Thibault wrote:
> When using userland drivers such as rumpdisk, we'd rather make ext2fs use
> parted-based libstore partitioning support. That can be used for kernelland
> drivers as well, so we can just make grub always use the part: qualifier to
> switch ext2fs to it.
>
> grub_util_find_hurd_root_device then has to understand this syntax and translate
> it into the /dev/ entry name.
>
> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Daniel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hurd: Use part: qualifier
2022-05-17 14:43 ` Daniel Kiper
@ 2022-05-25 12:56 ` Daniel Kiper
2022-05-25 22:59 ` Samuel Thibault
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Kiper @ 2022-05-25 12:56 UTC (permalink / raw)
To: samuel.thibault; +Cc: grub-devel, bug-hurd
On Tue, May 17, 2022 at 04:43:45PM +0200, Daniel Kiper wrote:
> On Sat, Feb 26, 2022 at 12:51:18PM +0100, Samuel Thibault wrote:
> > When using userland drivers such as rumpdisk, we'd rather make ext2fs use
> > parted-based libstore partitioning support. That can be used for kernelland
> > drivers as well, so we can just make grub always use the part: qualifier to
> > switch ext2fs to it.
> >
> > grub_util_find_hurd_root_device then has to understand this syntax and translate
> > it into the /dev/ entry name.
> >
> > Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
>
> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Sadly this patch does not apply. I suppose it conflicts with "hurd:
Support device entries with @/dev/disk: qualifier" patch which I pushed
into master. If you want me to get this patch please rebase it on the
latest master and post on the grub-devel again.
Daniel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hurd: Use part: qualifier
2022-05-25 12:56 ` Daniel Kiper
@ 2022-05-25 22:59 ` Samuel Thibault
0 siblings, 0 replies; 4+ messages in thread
From: Samuel Thibault @ 2022-05-25 22:59 UTC (permalink / raw)
To: Daniel Kiper; +Cc: grub-devel, bug-hurd
Daniel Kiper, le mer. 25 mai 2022 14:56:38 +0200, a ecrit:
> On Tue, May 17, 2022 at 04:43:45PM +0200, Daniel Kiper wrote:
> > On Sat, Feb 26, 2022 at 12:51:18PM +0100, Samuel Thibault wrote:
> > > When using userland drivers such as rumpdisk, we'd rather make ext2fs use
> > > parted-based libstore partitioning support. That can be used for kernelland
> > > drivers as well, so we can just make grub always use the part: qualifier to
> > > switch ext2fs to it.
> > >
> > > grub_util_find_hurd_root_device then has to understand this syntax and translate
> > > it into the /dev/ entry name.
> > >
> > > Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> >
> > Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
>
> Sadly this patch does not apply. I suppose it conflicts with "hurd:
> Support device entries with @/dev/disk: qualifier" patch which I pushed
> into master.
Indeed, the "part:" patch was based on an earlier version of that patch.
I have now sent an updated patch.
Samuel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-05-25 22:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-26 11:51 [PATCH] hurd: Use part: qualifier Samuel Thibault
2022-05-17 14:43 ` Daniel Kiper
2022-05-25 12:56 ` Daniel Kiper
2022-05-25 22:59 ` Samuel Thibault
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.