From d2e6b850279562593f6ac3cb6fc3721947fea23d Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Tue, 12 Mar 2024 12:44:23 +0000 Subject: [PATCH] stress-file-ioctl: add FS_IOC_GETFSSYSFSPATH ioctl This appears in Linux 6.8 Signed-off-by: Colin Ian King --- Makefile.config | 5 ++++- stress-file-ioctl.c | 12 ++++++++++++ test/test-fs_sysfs_path.c | 27 +++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 test/test-fs_sysfs_path.c diff --git a/Makefile.config b/Makefile.config index ea8a08e09..c8674f094 100644 --- a/Makefile.config +++ b/Makefile.config @@ -1397,7 +1397,7 @@ types: \ PTHREAD_MUTEXATTR_T PTRACE_REQUEST RLIMIT_RESOURCE_T RUSAGE_WHO CDROM_BLK \ CDROM_MCN CDROM_MSF CDROM_READ_AUDIO CDROM_SUBCHNL CDROM_TI CDROM_TOCENTRY \ CDROM_TOCHDR CDROM_VOLCTRL CONSOLEFONTDESC DIRENT_D_TYPE DM_IOCTL FLOPPY_FDC_STATE \ - FLOPPY_DRIVE_STRUCT FLOPPY_STRUCT FLOPPY_WRITE_ERRORS FSVERITY_DIGEST \ + FLOPPY_DRIVE_STRUCT FLOPPY_STRUCT FLOPPY_WRITE_ERRORS FS_SYSFS_PATH FSVERITY_DIGEST \ FSVERITY_ENABLE_ARG FSXATTR_STRUCT IFCONF IFREQ ICMPHDR IPHDR KBDIACRS KBENTRY \ KBKEYCODE KBSENTRY LANDLOCK_RULESET_ATTR MEDIA_DEVICE_INFO MSGINFO \ MTRR_GENTRY MTRR_SENTRY OPEN_HOW RTC_PARAM RUSAGE_RU_MAXRSS \ @@ -1558,6 +1558,9 @@ FLOPPY_STRUCT: FLOPPY_WRITE_ERRORS: $(call check,test-floppy_write_errors,HAVE_FLOPPY_WRITE_ERRORS,struct floppy_write_errors) +FS_SYSFS_PATH: + $(call check,test-fs_sysfs_path,HAVE_FS_SYSFS_PATH,struct fs_sysfs_path) + FSVERITY_DIGEST: $(call check,test-fsverity_digest,HAVE_FSVERITY_DIGEST,struct fsverity_digest) diff --git a/stress-file-ioctl.c b/stress-file-ioctl.c index 1af68e7b7..93e728c48 100644 --- a/stress-file-ioctl.c +++ b/stress-file-ioctl.c @@ -527,6 +527,18 @@ static int stress_file_ioctl(stress_args_t *args) #else UNEXPECTED #endif + +#if defined(FS_IOC_GETFSSYSFSPATH) && \ + defined(HAVE_FS_SYSFS_PATH) + { + struct fs_sysfs_path sysfs_path; + + (void)memset(&sysfs_path, 0, sizeof(sysfs_path)); + + VOID_RET(int, ioctl(fd, FS_IOC_GETFSSYSFSPATH, &sysfs_path)); + } +#endif + if (!exercised) { /* cppcheck-suppress knownConditionTrueFalse */ pr_inf("%s: no available file ioctls to exercise\n", args->name); diff --git a/test/test-fs_sysfs_path.c b/test/test-fs_sysfs_path.c new file mode 100644 index 000000000..0d9161001 --- /dev/null +++ b/test/test-fs_sysfs_path.c @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2024 Colin Ian King + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include + +int main(void) +{ + struct fs_sysfs_path path; + + return sizeof(path); +}