Skip to content

Commit

Permalink
stress-file-ioctl: add FS_IOC_GETFSSYSFSPATH ioctl
Browse files Browse the repository at this point in the history
This appears in Linux 6.8

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
  • Loading branch information
ColinIanKing committed Mar 12, 2024
1 parent 9aef6df commit d2e6b85
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Makefile.config
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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)

Expand Down
12 changes: 12 additions & 0 deletions stress-file-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
27 changes: 27 additions & 0 deletions test/test-fs_sysfs_path.c
Original file line number Diff line number Diff line change
@@ -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 <linux/fs.h>

int main(void)
{
struct fs_sysfs_path path;

return sizeof(path);
}

0 comments on commit d2e6b85

Please sign in to comment.