mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-20 22:48:22 +00:00
osdep/hurd/getroot: Use "part:" qualifier
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>
This commit is contained in:
1 parent
d46e65328e
commit
e981b0a248
2 files changed
+17
-5
No files matched your search
@@ -109,6 +109,16 @@ grub_util_find_hurd_root_device (const char *path)
|
||||
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;
|
||||
@@ -127,10 +137,10 @@ grub_util_find_hurd_root_device (const char *path)
|
||||
dev_name = next_name + 1;
|
||||
}
|
||||
|
||||
size = sizeof ("/dev/") - 1 + strlen (dev_name) + 1;
|
||||
ret = xmalloc (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))
|
||||
ret = strdup (name + sizeof ("file:") - 1);
|
||||
|
||||
Reference in new issue
Block a user