[LTP] [PATCH v4]: tst_find_backing_dev(): add support for overlayfs

Petr Vorel pvorel@suse.cz
Thu Mar 6 19:06:31 CET 2025


Hi Jeff, Cyril,

> Add checks for overlayfs in tst_find_backing_dev.  As with btrfs, only
> a single device is checked (the upper one) and returned from
> tst_find_backing_dev().

> The implementation uses both /proc/self/mountinfo and /proc/self/mounts.
> The former is used to map a device to a mountpoint, and the latter is
> used to get the file system options for the mountpoint.  All of the
> information is present in mountinfo, but the file format is more complex,
> and there are no glibc helpers for parsing it.

> The '#define _GNU_SOURCE' was added for the use of the strchrnul(3)
> function.

> Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
> ---
> v4: Address review comments from Petr:
>     - s/unsigned/unsigned int/
>     - string formatting
>     - code simplification: remove else block
>     - use SAFE_STAT
>     Address review comments from Cyril:
>     - s/PATH_MAX/4096
>     - string formatting fixes
>     - use strcmp() instead of strncmp() to prevent false matching
>     - don't re-implement strndup

LGTM. I leave where overlay_mount_from_dev() should be called up to Cyril.

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr


More information about the ltp mailing list