]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libmount: fix sync options between context and fs structs
authorKarel Zak <kzak@redhat.com>
Thu, 22 Jun 2023 11:11:57 +0000 (13:11 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 26 Jun 2023 10:00:12 +0000 (12:00 +0200)
commit1a4522541b94409f38b7e979cd3b212519d0159e
treef7ddc9fda6a4c104036acac2d3ec931968c3d441
parentd9fca2b62e0322ff5a3dbc90605ac47d3d8b284f
libmount: fix sync options between context and fs structs

Since v2.39 libmount prefers "struct libmnt_optlist" to keep mount options
rather than the original "struct libmnt_fs". This is problem if the
"fs" struct is defined and maintained outside the context.

The library has already a way how to sync "fs" and "optlist", but this
needs to be improved and used more widely. Changes:

* force "fs" from context to always read options from "optlist"

* copy options from "fs" to "optlist" in mnt_context_set_fs()

* internally redirect mnt_fs_* API for options to "optlist" if optlist
  defined

* add simple test to make sure options from different sources are
  always merged together

Addresses: https://github.com/util-linux/util-linux/issues/2326
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/context.c
libmount/src/fs.c