Comment # 5 on bug 1127701 from
The de-duplication of fstab is more complicated than "fstrim -a", as it needs
to evaluate tags, bind mounts, pseudo filesystems and everything else that
"mount -a" does. Otherwise de-duplication can fail in many ways (use source
specified by tags, subvolumes as source, bind mounts, false evaluation of
pseudo or net filesystem path).

The core of the path evaluation is implemented in
mnt_context_prepare_srcpath(). But it is not possible to use it directly in
fstrim. mnt_context_prepare_srcpath() uses libmnt_context structure, but the
de-duplication functions mnt_table_uniq_fs() use libmnt_table and libmnt_fs.

So there are several options to implement this:

1. Rewrite fstrim.c to use libmnt_context instead of libmnt_fs (libmnt_context
is a superset of libmnt_fs), and then use mnt_context_prepare_srcpath() and
then de-duplicate.

2. Use parts of mount_all() code to perform full parsing of fstab, and then
fill table with evaluated and canonicalized srcpath.

3. Implement mnt_fs_prepare_srcpath() as a counterpart of
mnt_context_prepare_srcpath().

4. Create a temporary libmnt_context for performing the tag evaluation and
canonicalization.


You are receiving this mail because: