fstests: add a new test case for FS_IOC_GETFSUUID
PATCH 1/1 fstests: add a new test case for FS_IOC_GETFSUUID
This is inspired by a recent btrfs patch that adds the support for that generic ioctl.
The new test case is just a simple one to make sure the ioctl returned the same value as the one reported by blkid.
Older kernels or unsupported fs will still be skipped.
Signed-off-by Qu Wenruo <[email protected]>
--- .gitignore | 1 + configure.ac | 1 + include/builddefs.in | 1 + m4/package_libcdev.m4 | 14 +++++++ src/Makefile | 4 ++ src/t_getfsuuid.c | 89 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/816 | 42 ++++++++++++++++++++ tests/generic/816.out | 2 + 8 files changed, 154 insertions(+) create mode 100644 src/t_getfsuuid.c create mode 100755 tests/generic/816 create mode 100644 tests/generic/816.out
.gitignore +1 -0
@@ -213,6 +213,7 @@ tags /src/perf/*.pyc /src/fiemap-fault /src/min_dio_alignment +/src/t_getfsuuid /src/dio-writeback-race /src/unlink-fsync /src/file_attr
configure.ac +1 -0
@@ -75,6 +75,7 @@ AC_HAVE_FICLONE AC_HAVE_TRIVIAL_AUTO_VAR_INIT AC_HAVE_FILE_GETATTR AC_HAVE_FANOTIFY_FID +AC_HAVE_FS_IOC_GETFSUUID AC_CHECK_FUNCS([renameat2]) AC_CHECK_FUNCS([reallocarray])
include/builddefs.in +1 -0
@@ -76,6 +76,7 @@ NEED_INTERNAL_XFS_IOC_EXCHANGE_RANGE = @need_internal_xfs_ioc_exchange_range@ HAVE_FICLONE = @have_ficlone@ HAVE_FILE_GETATTR = @have_file_getattr@ HAVE_FANOTIFY_FID = @have_fanotify_fid@ +HAVE_FS_IOC_GETFSUUID = @have_fs_ioc_getfsuuid@ GCCFLAGS = -std=gnu11 -funsigned-char -fno-strict-aliasing -Wall SANITIZER_CFLAGS += @autovar_init_cflags@
m4/package_libcdev.m4 +14 -0
@@ -116,3 +116,17 @@ AC_DEFUN([AC_HAVE_FANOTIFY_FID], AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)]) AC_SUBST(have_fanotify_fid) ]) + +# Check if we have FS_IOC_GETFSUUID +AC_DEFUN([AC_HAVE_FS_IOC_GETFSUUID], + [ AC_MSG_CHECKING([for FS_IOC_GETFSUUID]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include <sys/ioctl.h> +#include <linux/fs.h> + ]], [[ + struct fsuuid2 u; + ioctl(-1, FS_IOC_GETFSUUID, &u); + ]])],[have_fs_ioc_getfsuuid=yes + AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)]) + AC_SUBST(have_fs_ioc_getfsuuid) + ])
src/Makefile +4 -0
@@ -106,6 +106,10 @@ ifeq ($(HAVE_FICLONE),yes) LINUX_TARGETS += t_reflink_read_race endif +ifeq ($(HAVE_FS_IOC_GETFSUUID),yes) + LINUX_TARGETS += t_getfsuuid +endif + ifeq ($(HAVE_FANOTIFY_FID),yes) LINUX_TARGETS += fs-monitor endif
src/t_getfsuuid.c new file +89 -0
89 lines not on this page · raw message
tests/generic/816 new file +42 -0
42 lines not on this page · raw message
tests/generic/816.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 816 +Silence is golden
Signature · 1 line
2.56.1