osdep/hurd: Support device entries with @/dev/disk: qualifier

Those are used with non-bootstrap disk drivers, for which libstore has to
open /dev/disk before calling device_open on it instead of on the device
master port. Normally in that case all /dev/ entries also have the @/dev/disk:
qualifier, so we can just drop it.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Samuel Thibault authored and Daniel Kiper committed 2022-05-24 14:18:45 +02:00
1 parent bda136e1bb
commit ea1b565e8c
2 files changed
+33 -2

No files matched your search

+16 -2
View File
@@ -112,9 +112,23 @@ grub_util_find_hurd_root_device (const char *path)
if (strncmp (name, "device:", sizeof ("device:") - 1) == 0)
{
char *dev_name = name + sizeof ("device:") - 1;
size_t size = sizeof ("/dev/") - 1 + strlen (dev_name) + 1;
size_t size;
char *next;
ret = malloc (size);
if (dev_name[0] == '@')
{
/*
* Non-bootstrap disk driver, the /dev/ entry is normally set up with
* the same @.
*/
char *next_name = strchr (dev_name, ':');
if (next_name)
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));
}