Make / in btrfs refer to real root, not the default volume.
Modify mkrelpath to work even if device is mounted with subvolid option.
This commit is contained in:
parent
11d81fc6d1
commit
82591fa6e7
6 changed files with 311 additions and 123 deletions
|
@ -48,7 +48,13 @@ grub_make_system_path_relative_to_its_root (const char *path)
|
|||
if (p == NULL)
|
||||
grub_util_error (_("failed to get canonical path of `%s'"), path);
|
||||
|
||||
/* For ZFS sub-pool filesystems, could be extended to others (btrfs?). */
|
||||
#ifdef __linux__
|
||||
ret = grub_make_system_path_relative_to_its_root_os (p);
|
||||
if (ret)
|
||||
return ret;
|
||||
#endif
|
||||
|
||||
/* For ZFS sub-pool filesystems. */
|
||||
#ifndef __HAIKU__
|
||||
{
|
||||
char *dummy;
|
||||
|
@ -98,18 +104,6 @@ grub_make_system_path_relative_to_its_root (const char *path)
|
|||
if (offset == 0)
|
||||
{
|
||||
free (buf);
|
||||
#ifdef __linux__
|
||||
{
|
||||
char *bind;
|
||||
grub_free (grub_find_root_devices_from_mountinfo (buf2, &bind));
|
||||
if (bind && bind[0] && bind[1])
|
||||
{
|
||||
buf3 = bind;
|
||||
goto parsedir;
|
||||
}
|
||||
grub_free (bind);
|
||||
}
|
||||
#endif
|
||||
free (buf2);
|
||||
if (poolfs)
|
||||
return xasprintf ("/%s/@", poolfs);
|
||||
|
@ -131,25 +125,9 @@ grub_make_system_path_relative_to_its_root (const char *path)
|
|||
free (buf);
|
||||
buf3 = xstrdup (buf2 + offset);
|
||||
buf2[offset] = 0;
|
||||
#ifdef __linux__
|
||||
{
|
||||
char *bind;
|
||||
grub_free (grub_find_root_devices_from_mountinfo (buf2, &bind));
|
||||
if (bind && bind[0] && bind[1])
|
||||
{
|
||||
char *temp = buf3;
|
||||
buf3 = grub_xasprintf ("%s%s%s", bind, buf3[0] == '/' ?"":"/", buf3);
|
||||
grub_free (temp);
|
||||
}
|
||||
grub_free (bind);
|
||||
}
|
||||
#endif
|
||||
|
||||
free (buf2);
|
||||
|
||||
#ifdef __linux__
|
||||
parsedir:
|
||||
#endif
|
||||
/* Remove trailing slashes, return empty string if root directory. */
|
||||
len = strlen (buf3);
|
||||
while (len > 0 && buf3[len - 1] == '/')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue