mnt_tab_strerror(tb, buf, sizeof(buf));
warnx(_("%s: parse error: %s"), path, buf);
}
+
return tb;
}
if (tabfile)
errx_mutually_exclusive("--{fstab,mtab,kernel}");
tabfile = _PATH_MNTTAB;
- flags &= ~TT_FL_TREE;
+ tt_flags &= ~TT_FL_TREE;
break;
case 'k': /* kernel (mountinfo) */
if (tabfile)
set_match(COL_FSTYPE, optarg);
break;
case 'r':
- if (!(tt_flags & TT_FL_TREE) &&
- !(tt_flags & TT_FL_RAW))
- errx_mutually_exclusive("--{raw,list}");
-
tt_flags &= ~TT_FL_TREE; /* disable the default */
tt_flags |= TT_FL_RAW; /* enable raw */
break;
if (!is_listall_mode() || (flags & FL_FIRSTONLY))
tt_flags &= ~TT_FL_TREE;
+ if (!(flags & FL_NOSWAPMATCH) &&
+ !get_match(COL_TARGET) && get_match(COL_SOURCE)) {
+ /*
+ * Check if we can swap source and target, it's
+ * not possible if the source is LABEL=/UUID=
+ */
+ const char *x = get_match(COL_SOURCE);
+
+ if (!strncmp(x, "LABEL=", 6) || !strncmp(x, "UUID=", 5))
+ flags |= FL_NOSWAPMATCH;
+ }
+
/*
* initialize libmount
*/
+ mnt_init_debug(0);
+
tb = parse_tabfile(tabfile);
if (!tb)
goto leave;
warn(_("failed to initialize libmount iterator"));
goto leave;
}
+
cache = mnt_new_cache();
if (!cache) {
warn(_("failed to initialize libmount cache"));
warn(_("failed to initialize output table"));
goto leave;
}
+
for (i = 0; i < ncolumns; i++) {
int fl = get_column_truncate(i) ? TT_FL_TRUNCATE : 0;