[PATCH] mount: add feature to ignore flags starting with "x-"

Xabier Oneca -- xOneca xoneca at gmail.com
Sat Mar 18 12:23:09 UTC 2023


Hi Isaac,

> Some tools add non-standard mount flags beginning with "x-", which are
> commonly used for adding comments and metadata to mountpoints. These can
> be optionally safely ignored, as they don't affect the functionality of
> the mount and would otherwise cause Busybox to fail to mount the device.
>
> Some examples for such mount flags are "x-gdu.hide" and "x-gvfs-hide",
> both of which are used to indicate to userspace programs that a given
> mount should not be shown in a list of mounted partitions/filesystems.
>
> This patch does not change the current default behaviour; the mount
> flags will only be ignored if this feature is enabled. An additional
> verbose option has also been added to enable the ability to report that
> the mount flags have been ignored, rather than silently ignoring them.
>
> Signed-off-by: Isaac True <isaac at is.having.coffee>
> ---
>  util-linux/mount.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 88 insertions(+)

Thanks for the patch. I only want to add that there are two types of
x-* options according to the util-linux manual:

> X-*
>   All options prefixed with "X-" are interpreted as comments or as userspace application-specific options. These options are not stored in user space (e.g.,
>   mtab file), nor sent to the mount.type helpers nor to the mount(2) system call. The suggested format is X-appname.option.
>
> x-*
>   The same as X-* options, but stored permanently in user space. This means the options are also available for umount(8) or other operations. Note that
>   maintaining mount options in user space is tricky, because it’s necessary use libmount-based tools and there is no guarantee that the options will be always
>   available (for example after a move mount operation or in unshared namespace).
>
>   Note that before util-linux v2.30 the x-* options have not been maintained by libmount and stored in user space (functionality was the same as for X-* now),
>   but due to the growing number of use-cases (in initrd, systemd etc.) the functionality has been extended to keep existing fstab configurations usable
>   without a change.

Cheers,

Xabier Oneca_,,_


More information about the busybox mailing list