summaryrefslogtreecommitdiffstats
path: root/libmount/src/tab_parse.c
diff options
context:
space:
mode:
authorKarel Zak2016-03-15 14:02:19 +0100
committerKarel Zak2016-03-15 14:07:34 +0100
commit40f00b4f8e50c201647e0adb1d44bf01efbed09f (patch)
treedba875d6bf9743892a0a6b5ec4faec3337307614 /libmount/src/tab_parse.c
parentswapon: remove unnecessary assert (diff)
downloadkernel-qcow2-util-linux-40f00b4f8e50c201647e0adb1d44bf01efbed09f.tar.gz
kernel-qcow2-util-linux-40f00b4f8e50c201647e0adb1d44bf01efbed09f.tar.xz
kernel-qcow2-util-linux-40f00b4f8e50c201647e0adb1d44bf01efbed09f.zip
libmount: improve conversion from root= to the devname
Currently the code supports /dev/name or PARTUUID= only. We also need to support 'maj:min' and 'hexhex' notations. Reported-by: George Spelvin <linux@horizon.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/tab_parse.c')
-rw-r--r--libmount/src/tab_parse.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c
index cee700816..23076bfc0 100644
--- a/libmount/src/tab_parse.c
+++ b/libmount/src/tab_parse.c
@@ -580,19 +580,16 @@ static int kernel_fs_postparse(struct libmnt_table *tb,
* Convert obscure /dev/root to something more usable
*/
if (src && strcmp(src, "/dev/root") == 0) {
- char *spec = mnt_get_kernel_cmdline_option("root=");
char *real = NULL;
- DBG(TAB, ul_debugobj(tb, "root FS: %s", spec));
- if (spec)
- real = mnt_resolve_spec(spec, tb->cache);
- if (real) {
+ rc = mnt_guess_system_root(fs->devno, tb->cache, &real);
+ if (rc < 0)
+ return rc;
+
+ if (rc == 0 && real) {
DBG(TAB, ul_debugobj(tb, "canonical root FS: %s", real));
- rc = mnt_fs_set_source(fs, real);
- if (!tb->cache)
- free(real);
+ rc = __mnt_fs_set_source_ptr(fs, real);
}
- free(spec);
}
return rc;