From f4023af018e1ffaea81450efd1ef00701d09e4de Mon Sep 17 00:00:00 2001 From: Krishnan <52651976+KrishnanGosakan@users.noreply.github.com> Date: Sat, 25 Jul 2020 20:05:02 +0530 Subject: [PATCH 1/7] Update README.md tested with fsstress added to readme file --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 19ca2c1ee9..4a68c8262d 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ The kernel patch for the implementation of relink() system call for linux v4.13 ## Limitations SplitFS is under active development. 1. The current implementation of SplitFS handles the following system calls: `open, openat, close, read, pread64, write, pwrite64, fsync, unlink, ftruncate, fallocate, stat, fstat, lstat, dup, dup2, execve and clone`. The rest of the calls are passed through to the kernel. -2. The current implementation of SplitFS works correctly for the following applictions: `LevelDB running YCSB, SQLite running TPCC, tar, git, rsync`. This limitation is purely due to the state of the implementation, and we aim to increase the coverage of applications by supporting more system calls in the future. +2. The current implementation of SplitFS works correctly for the following applictions: `LevelDB running YCSB, SQLite running TPCC, tar, git, rsync, fsstress`. This limitation is purely due to the state of the implementation, and we aim to increase the coverage of applications by supporting more system calls in the future. ## Applications currently supported 1. LevelDB (with YCSB) @@ -120,6 +120,7 @@ SplitFS is under active development. 3. git 4. tar 5. rsync +6. fsstress ## Testing [PJD POSIX Test Suite](https://www.tuxera.com/community/posix-test-suite/) that tests primarily the metadata operations was run on SplitFS successfully. SplitFS passes all tests. From 14c333a856e8b9386aaf0604d0eb4c070e994dd9 Mon Sep 17 00:00:00 2001 From: Krishnan Date: Sun, 2 Aug 2020 09:12:57 -0700 Subject: [PATCH 2/7] added fsstress related files in splitfs repo --- fsstress/Makefile | 36 + fsstress/fsstress.c | 2676 +++++++++++++++++ fsstress/global.h | 66 + fsstress/include/Makefile | 45 + fsstress/include/config.h | 588 ++++ fsstress/include/config.h.in | 587 ++++ fsstress/include/ipcmsg.h | 68 + fsstress/include/ipcsem.h | 55 + fsstress/include/ipcshm.h | 54 + fsstress/include/lapi/.gitignore | 1 + fsstress/include/lapi/abisize.h | 31 + fsstress/include/lapi/acct.h | 74 + fsstress/include/lapi/bpf.h | 567 ++++ fsstress/include/lapi/capability.h | 51 + fsstress/include/lapi/clone.h | 49 + fsstress/include/lapi/common_timers.h | 81 + fsstress/include/lapi/cpuset.h | 51 + fsstress/include/lapi/cryptouser.h | 182 ++ fsstress/include/lapi/dccp.h | 17 + fsstress/include/lapi/epoll.h | 13 + fsstress/include/lapi/execveat.h | 22 + fsstress/include/lapi/fallocate.h | 60 + fsstress/include/lapi/fcntl.h | 139 + fsstress/include/lapi/fnmatch.h | 14 + fsstress/include/lapi/fs.h | 66 + fsstress/include/lapi/fsmount.h | 145 + fsstress/include/lapi/futex.h | 13 + fsstress/include/lapi/getrandom.h | 30 + fsstress/include/lapi/if_alg.h | 38 + fsstress/include/lapi/if_ether.h | 19 + fsstress/include/lapi/if_packet.h | 50 + fsstress/include/lapi/io_pgetevents.h | 35 + fsstress/include/lapi/io_uring.h | 283 ++ fsstress/include/lapi/ioctl.h | 40 + fsstress/include/lapi/ioctl_ns.h | 28 + fsstress/include/lapi/iovec.h | 20 + fsstress/include/lapi/ipcbuf.h | 195 ++ fsstress/include/lapi/keyctl.h | 178 ++ fsstress/include/lapi/loop.h | 55 + fsstress/include/lapi/membarrier.h | 30 + fsstress/include/lapi/memfd.h | 50 + fsstress/include/lapi/mkdirat.h | 20 + fsstress/include/lapi/mlock2.h | 16 + fsstress/include/lapi/mmap.h | 87 + fsstress/include/lapi/mount.h | 33 + fsstress/include/lapi/msgbuf.h | 306 ++ fsstress/include/lapi/namespaces_constants.h | 31 + fsstress/include/lapi/netinet_in.h | 23 + fsstress/include/lapi/openat2.h | 72 + fsstress/include/lapi/personality.h | 23 + fsstress/include/lapi/pidfd_open.h | 24 + fsstress/include/lapi/pidfd_send_signal.h | 27 + fsstress/include/lapi/posix_clocks.h | 42 + fsstress/include/lapi/posix_types.h | 21 + fsstress/include/lapi/prctl.h | 55 + fsstress/include/lapi/preadv2.h | 30 + fsstress/include/lapi/pwritev2.h | 26 + fsstress/include/lapi/quotactl.h | 78 + fsstress/include/lapi/readdir.h | 19 + fsstress/include/lapi/readlinkat.h | 20 + fsstress/include/lapi/renameat.h | 23 + fsstress/include/lapi/rt_sigaction.h | 245 ++ fsstress/include/lapi/safe_rt_signal.h | 50 + fsstress/include/lapi/sched.h | 62 + fsstress/include/lapi/sctp.h | 17 + fsstress/include/lapi/seccomp.h | 40 + fsstress/include/lapi/securebits.h | 17 + fsstress/include/lapi/seek.h | 19 + fsstress/include/lapi/sembuf.h | 234 ++ fsstress/include/lapi/semun.h | 22 + fsstress/include/lapi/setns.h | 20 + fsstress/include/lapi/shmbuf.h | 273 ++ fsstress/include/lapi/signal.h | 24 + fsstress/include/lapi/socket.h | 72 + fsstress/include/lapi/splice.h | 22 + fsstress/include/lapi/stat.h | 257 ++ fsstress/include/lapi/sync_file_range.h | 58 + fsstress/include/lapi/syncfs.h | 21 + fsstress/include/lapi/syscalls/aarch64.in | 315 ++ fsstress/include/lapi/syscalls/arc.in | 314 ++ fsstress/include/lapi/syscalls/arm.in | 392 +++ fsstress/include/lapi/syscalls/hppa.in | 41 + fsstress/include/lapi/syscalls/i386.in | 428 +++ fsstress/include/lapi/syscalls/ia64.in | 341 +++ fsstress/include/lapi/syscalls/mips_n32.in | 366 +++ fsstress/include/lapi/syscalls/mips_n64.in | 342 +++ fsstress/include/lapi/syscalls/mips_o32.in | 412 +++ fsstress/include/lapi/syscalls/order | 17 + fsstress/include/lapi/syscalls/powerpc.in | 421 +++ fsstress/include/lapi/syscalls/powerpc64.in | 421 +++ fsstress/include/lapi/syscalls/regen.sh | 132 + fsstress/include/lapi/syscalls/s390.in | 408 +++ fsstress/include/lapi/syscalls/s390x.in | 356 +++ fsstress/include/lapi/syscalls/sh.in | 402 +++ fsstress/include/lapi/syscalls/sparc.in | 407 +++ fsstress/include/lapi/syscalls/sparc64.in | 372 +++ .../include/lapi/syscalls/strip_syscall.awk | 19 + fsstress/include/lapi/syscalls/x86_64.in | 385 +++ fsstress/include/lapi/tcp.h | 19 + fsstress/include/lapi/tee.h | 20 + fsstress/include/lapi/termbits.h | 13 + fsstress/include/lapi/timerfd.h | 41 + fsstress/include/lapi/timex.h | 30 + fsstress/include/lapi/tty.h | 17 + fsstress/include/lapi/udp.h | 18 + fsstress/include/lapi/ustat.h | 22 + fsstress/include/lapi/utime.h | 16 + fsstress/include/lapi/utsname.h | 16 + fsstress/include/lapi/vmsplice.h | 23 + fsstress/include/lapi/xfrm.h | 17 + fsstress/include/libmsgctl.h | 39 + fsstress/include/libnewipc.h | 59 + fsstress/include/mk/automake.mk | 115 + fsstress/include/mk/config-openposix.mk | 5 + fsstress/include/mk/config-openposix.mk.in | 5 + fsstress/include/mk/config.mk | 85 + fsstress/include/mk/config.mk.in | 85 + fsstress/include/mk/env_post.mk | 110 + fsstress/include/mk/env_pre.mk | 155 + fsstress/include/mk/features.mk | 49 + fsstress/include/mk/features.mk.in | 49 + fsstress/include/mk/functions.mk | 76 + fsstress/include/mk/generic_leaf_target.inc | 106 + fsstress/include/mk/generic_leaf_target.mk | 24 + fsstress/include/mk/generic_trunk_target.inc | 98 + fsstress/include/mk/generic_trunk_target.mk | 24 + fsstress/include/mk/gitignore.mk | 51 + fsstress/include/mk/lib.mk | 73 + fsstress/include/mk/man.mk | 37 + fsstress/include/mk/module.mk | 62 + fsstress/include/mk/testcases.mk | 63 + fsstress/include/old/cleanup.c | 47 + fsstress/include/old/ltp_cpuid.h | 35 + fsstress/include/old/ltp_priv.h | 74 + fsstress/include/old/ltp_signal.h | 56 + fsstress/include/old/old_checkpoint.h | 59 + fsstress/include/old/old_device.h | 84 + fsstress/include/old/old_module.h | 72 + fsstress/include/old/old_resource.h | 55 + fsstress/include/old/old_safe_file_ops.h | 64 + fsstress/include/old/old_safe_net.h | 50 + fsstress/include/old/old_safe_stdio.h | 37 + fsstress/include/old/old_tmpdir.h | 56 + fsstress/include/old/random_range.h | 45 + fsstress/include/old/safe_macros.h | 340 +++ fsstress/include/old/test.h | 214 ++ fsstress/include/old/tlibio.h | 161 + fsstress/include/old/usctest.h | 105 + fsstress/include/parse_vdso.h | 41 + fsstress/include/safe_file_ops_fn.h | 83 + fsstress/include/safe_macros_fn.h | 187 ++ fsstress/include/safe_net_fn.h | 81 + fsstress/include/safe_stdio_fn.h | 35 + fsstress/include/stamp-h1 | 1 + fsstress/include/tst_af_alg.h | 136 + fsstress/include/tst_ansi_color.h | 22 + fsstress/include/tst_assert.h | 56 + fsstress/include/tst_atomic.h | 334 ++ fsstress/include/tst_buffers.h | 63 + fsstress/include/tst_capability.h | 83 + fsstress/include/tst_cgroup.h | 45 + fsstress/include/tst_checkpoint.h | 28 + fsstress/include/tst_checkpoint_fn.h | 42 + fsstress/include/tst_checksum.h | 16 + fsstress/include/tst_clocks.h | 23 + fsstress/include/tst_clone.h | 21 + fsstress/include/tst_cmd.h | 94 + fsstress/include/tst_common.h | 86 + fsstress/include/tst_coredump.h | 18 + fsstress/include/tst_cpu.h | 19 + fsstress/include/tst_crypto.h | 112 + fsstress/include/tst_device.h | 94 + fsstress/include/tst_fs.h | 246 ++ fsstress/include/tst_fuzzy_sync.h | 776 +++++ fsstress/include/tst_get_bad_addr.h | 12 + fsstress/include/tst_hugepage.h | 37 + fsstress/include/tst_kconfig.h | 56 + fsstress/include/tst_kernel.h | 21 + fsstress/include/tst_kvercmp.h | 44 + fsstress/include/tst_minmax.h | 24 + fsstress/include/tst_mkfs.h | 22 + fsstress/include/tst_net.h | 35 + fsstress/include/tst_netlink.h | 88 + fsstress/include/tst_numa.h | 112 + fsstress/include/tst_path_has_mnt_flags.h | 29 + fsstress/include/tst_pid.h | 43 + fsstress/include/tst_private.h | 32 + fsstress/include/tst_process_state.h | 53 + fsstress/include/tst_res_flags.h | 23 + fsstress/include/tst_safe_clocks.h | 67 + fsstress/include/tst_safe_file_ops.h | 49 + fsstress/include/tst_safe_macros.h | 571 ++++ fsstress/include/tst_safe_net.h | 79 + fsstress/include/tst_safe_posix_ipc.h | 47 + fsstress/include/tst_safe_prw.h | 47 + fsstress/include/tst_safe_pthread.h | 33 + fsstress/include/tst_safe_stdio.h | 24 + fsstress/include/tst_safe_sysv_ipc.h | 54 + fsstress/include/tst_safe_timerfd.h | 32 + fsstress/include/tst_sig_proc.h | 12 + fsstress/include/tst_sys_conf.h | 19 + fsstress/include/tst_taint.h | 93 + fsstress/include/tst_test.h | 325 ++ fsstress/include/tst_timer.h | 1055 +++++++ fsstress/include/tst_timer_test.h | 45 + fsstress/include/tst_uinput.h | 47 + fsstress/include/tst_wallclock.h | 15 + fsstress/xfscompat.h | 7 + micro/rw_expt | Bin 13920 -> 13480 bytes scripts/fsstress/compile_fsstress.sh | 13 + scripts/fsstress/run_fsstress.sh | 12 + 211 files changed, 24717 insertions(+) create mode 100644 fsstress/Makefile create mode 100644 fsstress/fsstress.c create mode 100644 fsstress/global.h create mode 100644 fsstress/include/Makefile create mode 100644 fsstress/include/config.h create mode 100644 fsstress/include/config.h.in create mode 100644 fsstress/include/ipcmsg.h create mode 100644 fsstress/include/ipcsem.h create mode 100644 fsstress/include/ipcshm.h create mode 100644 fsstress/include/lapi/.gitignore create mode 100644 fsstress/include/lapi/abisize.h create mode 100644 fsstress/include/lapi/acct.h create mode 100644 fsstress/include/lapi/bpf.h create mode 100644 fsstress/include/lapi/capability.h create mode 100644 fsstress/include/lapi/clone.h create mode 100644 fsstress/include/lapi/common_timers.h create mode 100644 fsstress/include/lapi/cpuset.h create mode 100644 fsstress/include/lapi/cryptouser.h create mode 100644 fsstress/include/lapi/dccp.h create mode 100644 fsstress/include/lapi/epoll.h create mode 100644 fsstress/include/lapi/execveat.h create mode 100644 fsstress/include/lapi/fallocate.h create mode 100644 fsstress/include/lapi/fcntl.h create mode 100644 fsstress/include/lapi/fnmatch.h create mode 100644 fsstress/include/lapi/fs.h create mode 100644 fsstress/include/lapi/fsmount.h create mode 100644 fsstress/include/lapi/futex.h create mode 100644 fsstress/include/lapi/getrandom.h create mode 100644 fsstress/include/lapi/if_alg.h create mode 100644 fsstress/include/lapi/if_ether.h create mode 100644 fsstress/include/lapi/if_packet.h create mode 100644 fsstress/include/lapi/io_pgetevents.h create mode 100644 fsstress/include/lapi/io_uring.h create mode 100644 fsstress/include/lapi/ioctl.h create mode 100644 fsstress/include/lapi/ioctl_ns.h create mode 100644 fsstress/include/lapi/iovec.h create mode 100644 fsstress/include/lapi/ipcbuf.h create mode 100644 fsstress/include/lapi/keyctl.h create mode 100644 fsstress/include/lapi/loop.h create mode 100644 fsstress/include/lapi/membarrier.h create mode 100644 fsstress/include/lapi/memfd.h create mode 100644 fsstress/include/lapi/mkdirat.h create mode 100644 fsstress/include/lapi/mlock2.h create mode 100644 fsstress/include/lapi/mmap.h create mode 100644 fsstress/include/lapi/mount.h create mode 100644 fsstress/include/lapi/msgbuf.h create mode 100644 fsstress/include/lapi/namespaces_constants.h create mode 100644 fsstress/include/lapi/netinet_in.h create mode 100644 fsstress/include/lapi/openat2.h create mode 100644 fsstress/include/lapi/personality.h create mode 100644 fsstress/include/lapi/pidfd_open.h create mode 100644 fsstress/include/lapi/pidfd_send_signal.h create mode 100644 fsstress/include/lapi/posix_clocks.h create mode 100644 fsstress/include/lapi/posix_types.h create mode 100644 fsstress/include/lapi/prctl.h create mode 100644 fsstress/include/lapi/preadv2.h create mode 100644 fsstress/include/lapi/pwritev2.h create mode 100644 fsstress/include/lapi/quotactl.h create mode 100644 fsstress/include/lapi/readdir.h create mode 100644 fsstress/include/lapi/readlinkat.h create mode 100644 fsstress/include/lapi/renameat.h create mode 100644 fsstress/include/lapi/rt_sigaction.h create mode 100644 fsstress/include/lapi/safe_rt_signal.h create mode 100644 fsstress/include/lapi/sched.h create mode 100644 fsstress/include/lapi/sctp.h create mode 100644 fsstress/include/lapi/seccomp.h create mode 100644 fsstress/include/lapi/securebits.h create mode 100644 fsstress/include/lapi/seek.h create mode 100644 fsstress/include/lapi/sembuf.h create mode 100644 fsstress/include/lapi/semun.h create mode 100644 fsstress/include/lapi/setns.h create mode 100644 fsstress/include/lapi/shmbuf.h create mode 100644 fsstress/include/lapi/signal.h create mode 100644 fsstress/include/lapi/socket.h create mode 100644 fsstress/include/lapi/splice.h create mode 100644 fsstress/include/lapi/stat.h create mode 100644 fsstress/include/lapi/sync_file_range.h create mode 100644 fsstress/include/lapi/syncfs.h create mode 100644 fsstress/include/lapi/syscalls/aarch64.in create mode 100644 fsstress/include/lapi/syscalls/arc.in create mode 100644 fsstress/include/lapi/syscalls/arm.in create mode 100644 fsstress/include/lapi/syscalls/hppa.in create mode 100644 fsstress/include/lapi/syscalls/i386.in create mode 100644 fsstress/include/lapi/syscalls/ia64.in create mode 100644 fsstress/include/lapi/syscalls/mips_n32.in create mode 100644 fsstress/include/lapi/syscalls/mips_n64.in create mode 100644 fsstress/include/lapi/syscalls/mips_o32.in create mode 100644 fsstress/include/lapi/syscalls/order create mode 100644 fsstress/include/lapi/syscalls/powerpc.in create mode 100644 fsstress/include/lapi/syscalls/powerpc64.in create mode 100755 fsstress/include/lapi/syscalls/regen.sh create mode 100644 fsstress/include/lapi/syscalls/s390.in create mode 100644 fsstress/include/lapi/syscalls/s390x.in create mode 100644 fsstress/include/lapi/syscalls/sh.in create mode 100644 fsstress/include/lapi/syscalls/sparc.in create mode 100644 fsstress/include/lapi/syscalls/sparc64.in create mode 100755 fsstress/include/lapi/syscalls/strip_syscall.awk create mode 100644 fsstress/include/lapi/syscalls/x86_64.in create mode 100644 fsstress/include/lapi/tcp.h create mode 100644 fsstress/include/lapi/tee.h create mode 100644 fsstress/include/lapi/termbits.h create mode 100644 fsstress/include/lapi/timerfd.h create mode 100644 fsstress/include/lapi/timex.h create mode 100644 fsstress/include/lapi/tty.h create mode 100644 fsstress/include/lapi/udp.h create mode 100644 fsstress/include/lapi/ustat.h create mode 100644 fsstress/include/lapi/utime.h create mode 100644 fsstress/include/lapi/utsname.h create mode 100644 fsstress/include/lapi/vmsplice.h create mode 100644 fsstress/include/lapi/xfrm.h create mode 100644 fsstress/include/libmsgctl.h create mode 100644 fsstress/include/libnewipc.h create mode 100644 fsstress/include/mk/automake.mk create mode 100644 fsstress/include/mk/config-openposix.mk create mode 100644 fsstress/include/mk/config-openposix.mk.in create mode 100644 fsstress/include/mk/config.mk create mode 100644 fsstress/include/mk/config.mk.in create mode 100644 fsstress/include/mk/env_post.mk create mode 100644 fsstress/include/mk/env_pre.mk create mode 100644 fsstress/include/mk/features.mk create mode 100644 fsstress/include/mk/features.mk.in create mode 100644 fsstress/include/mk/functions.mk create mode 100644 fsstress/include/mk/generic_leaf_target.inc create mode 100644 fsstress/include/mk/generic_leaf_target.mk create mode 100644 fsstress/include/mk/generic_trunk_target.inc create mode 100644 fsstress/include/mk/generic_trunk_target.mk create mode 100644 fsstress/include/mk/gitignore.mk create mode 100644 fsstress/include/mk/lib.mk create mode 100644 fsstress/include/mk/man.mk create mode 100644 fsstress/include/mk/module.mk create mode 100644 fsstress/include/mk/testcases.mk create mode 100644 fsstress/include/old/cleanup.c create mode 100644 fsstress/include/old/ltp_cpuid.h create mode 100644 fsstress/include/old/ltp_priv.h create mode 100644 fsstress/include/old/ltp_signal.h create mode 100644 fsstress/include/old/old_checkpoint.h create mode 100644 fsstress/include/old/old_device.h create mode 100644 fsstress/include/old/old_module.h create mode 100644 fsstress/include/old/old_resource.h create mode 100644 fsstress/include/old/old_safe_file_ops.h create mode 100644 fsstress/include/old/old_safe_net.h create mode 100644 fsstress/include/old/old_safe_stdio.h create mode 100644 fsstress/include/old/old_tmpdir.h create mode 100644 fsstress/include/old/random_range.h create mode 100644 fsstress/include/old/safe_macros.h create mode 100644 fsstress/include/old/test.h create mode 100644 fsstress/include/old/tlibio.h create mode 100644 fsstress/include/old/usctest.h create mode 100644 fsstress/include/parse_vdso.h create mode 100644 fsstress/include/safe_file_ops_fn.h create mode 100644 fsstress/include/safe_macros_fn.h create mode 100644 fsstress/include/safe_net_fn.h create mode 100644 fsstress/include/safe_stdio_fn.h create mode 100644 fsstress/include/stamp-h1 create mode 100644 fsstress/include/tst_af_alg.h create mode 100644 fsstress/include/tst_ansi_color.h create mode 100644 fsstress/include/tst_assert.h create mode 100644 fsstress/include/tst_atomic.h create mode 100644 fsstress/include/tst_buffers.h create mode 100644 fsstress/include/tst_capability.h create mode 100644 fsstress/include/tst_cgroup.h create mode 100644 fsstress/include/tst_checkpoint.h create mode 100644 fsstress/include/tst_checkpoint_fn.h create mode 100644 fsstress/include/tst_checksum.h create mode 100644 fsstress/include/tst_clocks.h create mode 100644 fsstress/include/tst_clone.h create mode 100644 fsstress/include/tst_cmd.h create mode 100644 fsstress/include/tst_common.h create mode 100644 fsstress/include/tst_coredump.h create mode 100644 fsstress/include/tst_cpu.h create mode 100644 fsstress/include/tst_crypto.h create mode 100644 fsstress/include/tst_device.h create mode 100644 fsstress/include/tst_fs.h create mode 100644 fsstress/include/tst_fuzzy_sync.h create mode 100644 fsstress/include/tst_get_bad_addr.h create mode 100644 fsstress/include/tst_hugepage.h create mode 100644 fsstress/include/tst_kconfig.h create mode 100644 fsstress/include/tst_kernel.h create mode 100644 fsstress/include/tst_kvercmp.h create mode 100644 fsstress/include/tst_minmax.h create mode 100644 fsstress/include/tst_mkfs.h create mode 100644 fsstress/include/tst_net.h create mode 100644 fsstress/include/tst_netlink.h create mode 100644 fsstress/include/tst_numa.h create mode 100644 fsstress/include/tst_path_has_mnt_flags.h create mode 100644 fsstress/include/tst_pid.h create mode 100644 fsstress/include/tst_private.h create mode 100644 fsstress/include/tst_process_state.h create mode 100644 fsstress/include/tst_res_flags.h create mode 100644 fsstress/include/tst_safe_clocks.h create mode 100644 fsstress/include/tst_safe_file_ops.h create mode 100644 fsstress/include/tst_safe_macros.h create mode 100644 fsstress/include/tst_safe_net.h create mode 100644 fsstress/include/tst_safe_posix_ipc.h create mode 100644 fsstress/include/tst_safe_prw.h create mode 100644 fsstress/include/tst_safe_pthread.h create mode 100644 fsstress/include/tst_safe_stdio.h create mode 100644 fsstress/include/tst_safe_sysv_ipc.h create mode 100644 fsstress/include/tst_safe_timerfd.h create mode 100644 fsstress/include/tst_sig_proc.h create mode 100644 fsstress/include/tst_sys_conf.h create mode 100644 fsstress/include/tst_taint.h create mode 100644 fsstress/include/tst_test.h create mode 100644 fsstress/include/tst_timer.h create mode 100644 fsstress/include/tst_timer_test.h create mode 100644 fsstress/include/tst_uinput.h create mode 100644 fsstress/include/tst_wallclock.h create mode 100644 fsstress/xfscompat.h create mode 100755 scripts/fsstress/compile_fsstress.sh create mode 100755 scripts/fsstress/run_fsstress.sh diff --git a/fsstress/Makefile b/fsstress/Makefile new file mode 100644 index 0000000000..79d15388e8 --- /dev/null +++ b/fsstress/Makefile @@ -0,0 +1,36 @@ +# +# kernel/fs/fsstress testcases Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# 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. +# +# Ngie Cooper, July 2009 +# + +top_srcdir ?= . + +include $(top_srcdir)/include/mk/env_pre.mk + +CPPFLAGS += -DNO_XFS -I$(abs_srcdir) \ + -D_LARGEFILE64_SOURCE -D_GNU_SOURCE + +# if removed -DNO_XFS, you should unmask the following line +#LDLIBS += -lattr + +# XXX (garrcoop): not -Wuninitialized clean. +CPPFLAGS += -Wno-error + +include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/fsstress/fsstress.c b/fsstress/fsstress.c new file mode 100644 index 0000000000..811e6ff141 --- /dev/null +++ b/fsstress/fsstress.c @@ -0,0 +1,2676 @@ +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ + */ + +#include "config.h" +#include "global.h" +#include +#ifdef HAVE_SYS_PRCTL_H +# include +#endif +#include + +#define XFS_ERRTAG_MAX 17 + +typedef enum { +#ifndef NO_XFS + OP_ALLOCSP, + OP_ATTR_REMOVE, + OP_ATTR_SET, + OP_BULKSTAT, + OP_BULKSTAT1, +#endif + OP_CHOWN, + OP_CREAT, + OP_DREAD, + OP_DWRITE, + OP_FDATASYNC, +#ifndef NO_XFS + OP_FREESP, +#endif + OP_FSYNC, + OP_GETDENTS, + OP_LINK, + OP_MKDIR, + OP_MKNOD, + OP_READ, + OP_READLINK, + OP_RENAME, +#ifndef NO_XFS + OP_RESVSP, +#endif + OP_RMDIR, + OP_STAT, + OP_SYMLINK, + OP_SYNC, + OP_TRUNCATE, + OP_UNLINK, +#ifndef NO_XFS + OP_UNRESVSP, +#endif + OP_WRITE, + OP_LAST +} opty_t; + +typedef void (*opfnc_t) (int, long); + +typedef struct opdesc { + opty_t op; + char *name; + opfnc_t func; + int freq; + int iswrite; + int isxfs; +} opdesc_t; + +typedef struct fent { + int id; + int parent; +} fent_t; + +typedef struct flist { + int nfiles; + int nslots; + int tag; + fent_t *fents; +} flist_t; + +typedef struct pathname { + int len; + char *path; +} pathname_t; + +#define FT_DIR 0 +#define FT_DIRm (1 << FT_DIR) +#define FT_REG 1 +#define FT_REGm (1 << FT_REG) +#define FT_SYM 2 +#define FT_SYMm (1 << FT_SYM) +#define FT_DEV 3 +#define FT_DEVm (1 << FT_DEV) +#define FT_RTF 4 +#define FT_RTFm (1 << FT_RTF) +#define FT_nft 5 +#define FT_ANYm ((1 << FT_nft) - 1) +#define FT_REGFILE (FT_REGm | FT_RTFm) +#define FT_NOTDIR (FT_ANYm & ~FT_DIRm) + +#define FLIST_SLOT_INCR 16 +#define NDCACHE 64 + +#define MAXFSIZE ((1ULL << 63) - 1ULL) +#define MAXFSIZE32 ((1ULL << 40) - 1ULL) + +void allocsp_f(int, long); +void attr_remove_f(int, long); +void attr_set_f(int, long); +void bulkstat_f(int, long); +void bulkstat1_f(int, long); +void chown_f(int, long); +void creat_f(int, long); +void dread_f(int, long); +void dwrite_f(int, long); +void fdatasync_f(int, long); +void freesp_f(int, long); +void fsync_f(int, long); +void getdents_f(int, long); +void link_f(int, long); +void mkdir_f(int, long); +void mknod_f(int, long); +void read_f(int, long); +void readlink_f(int, long); +void rename_f(int, long); +void resvsp_f(int, long); +void rmdir_f(int, long); +void stat_f(int, long); +void symlink_f(int, long); +void sync_f(int, long); +void truncate_f(int, long); +void unlink_f(int, long); +void unresvsp_f(int, long); +void write_f(int, long); + +opdesc_t ops[] = { +#ifndef NO_XFS + {OP_ALLOCSP, "allocsp", allocsp_f, 1, 1, 1}, + {OP_ATTR_REMOVE, "attr_remove", attr_remove_f, /* 1 */ 0, 1, 1}, + {OP_ATTR_SET, "attr_set", attr_set_f, /* 2 */ 0, 1, 1}, + {OP_BULKSTAT, "bulkstat", bulkstat_f, 1, 0, 1}, + {OP_BULKSTAT1, "bulkstat1", bulkstat1_f, 1, 0, 1}, +#endif + {OP_CHOWN, "chown", chown_f, 3, 1, 0}, + {OP_CREAT, "creat", creat_f, 4, 1, 0}, + {OP_DREAD, "dread", dread_f, 4, 0, 0}, + {OP_DWRITE, "dwrite", dwrite_f, 4, 1, 0}, + {OP_FDATASYNC, "fdatasync", fdatasync_f, 1, 1, 0}, +#ifndef NO_XFS + {OP_FREESP, "freesp", freesp_f, 1, 1, 1}, +#endif + {OP_FSYNC, "fsync", fsync_f, 1, 1, 0}, + {OP_GETDENTS, "getdents", getdents_f, 1, 0, 0}, + {OP_LINK, "link", link_f, 1, 1, 0}, + {OP_MKDIR, "mkdir", mkdir_f, 2, 1, 0}, + {OP_MKNOD, "mknod", mknod_f, 2, 1, 0}, + {OP_READ, "read", read_f, 1, 0, 0}, + {OP_READLINK, "readlink", readlink_f, 1, 0, 0}, + {OP_RENAME, "rename", rename_f, 2, 1, 0}, +#ifndef NO_XFS + {OP_RESVSP, "resvsp", resvsp_f, 1, 1, 1}, +#endif + {OP_RMDIR, "rmdir", rmdir_f, 1, 1, 0}, + {OP_STAT, "stat", stat_f, 1, 0, 0}, + {OP_SYMLINK, "symlink", symlink_f, 2, 1, 0}, + {OP_SYNC, "sync", sync_f, 1, 0, 0}, + {OP_TRUNCATE, "truncate", truncate_f, 2, 1, 0}, + {OP_UNLINK, "unlink", unlink_f, 1, 1, 0}, +#ifndef NO_XFS + {OP_UNRESVSP, "unresvsp", unresvsp_f, 1, 1, 1}, +#endif + {OP_WRITE, "write", write_f, 4, 1, 0}, +}, *ops_end; + +flist_t flist[FT_nft] = { + {0, 0, 'd', NULL}, + {0, 0, 'f', NULL}, + {0, 0, 'l', NULL}, + {0, 0, 'c', NULL}, + {0, 0, 'r', NULL}, +}; + +int dcache[NDCACHE]; +int errrange; +int errtag; +opty_t *freq_table; +int freq_table_size; +#ifndef NO_XFS +xfs_fsop_geom_t geom; +#endif +char *homedir; +int *ilist; +int ilistlen; +off64_t maxfsize; +char *myprog; +int namerand; +int nameseq; +int nops; +int nproc = 1; +int operations = 1; +int procid; +int rtpct; +unsigned long seed = 0; +ino_t top_ino; +int verbose = 0; +#ifndef NO_XFS +int no_xfs = 0; +#else +int no_xfs = 1; +#endif +sig_atomic_t should_stop = 0; + +void add_to_flist(int, int, int); +void append_pathname(pathname_t *, char *); +#ifndef NO_XFS +int attr_list_path(pathname_t *, char *, const int, int, attrlist_cursor_t *); +int attr_remove_path(pathname_t *, const char *, int); +int attr_set_path(pathname_t *, const char *, const char *, const int, int); +#endif +void check_cwd(void); +int creat_path(pathname_t *, mode_t); +void dcache_enter(int, int); +void dcache_init(void); +fent_t *dcache_lookup(int); +void dcache_purge(int); +void del_from_flist(int, int); +int dirid_to_name(char *, int); +void doproc(void); +void fent_to_name(pathname_t *, flist_t *, fent_t *); +void fix_parent(int, int); +void free_pathname(pathname_t *); +int generate_fname(fent_t *, int, pathname_t *, int *, int *); +int get_fname(int, long, pathname_t *, flist_t **, fent_t **, int *); +void init_pathname(pathname_t *); +int lchown_path(pathname_t *, uid_t, gid_t); +int link_path(pathname_t *, pathname_t *); +int lstat64_path(pathname_t *, struct stat64 *); +void make_freq_table(void); +int mkdir_path(pathname_t *, mode_t); +int mknod_path(pathname_t *, mode_t, dev_t); +void namerandpad(int, char *, int); +int open_path(pathname_t *, int); +DIR *opendir_path(pathname_t *); +void process_freq(char *); +int readlink_path(pathname_t *, char *, size_t); +int rename_path(pathname_t *, pathname_t *); +int rmdir_path(pathname_t *); +void separate_pathname(pathname_t *, char *, pathname_t *); +void show_ops(int, char *); +int stat64_path(pathname_t *, struct stat64 *); +int symlink_path(const char *, pathname_t *); +int truncate64_path(pathname_t *, off64_t); +int unlink_path(pathname_t *); +void usage(void); +void write_freq(void); +void zero_freq(void); + +void sg_handler(int signum) +{ + should_stop = 1; +} + +int main(int argc, char **argv) +{ + char buf[10]; + int c; + char *dirname = NULL; + int fd; + int i; + int cleanup = 0; + int loops = 1; + int loopcntr = 1; + char cmd[256]; +#ifndef NO_XFS + int j; +#endif + char *p; + int stat; + struct timeval t; +#ifndef NO_XFS + ptrdiff_t srval; +#endif + int nousage = 0; +#ifndef NO_XFS + xfs_error_injection_t err_inj; +#endif + struct sigaction action; + + errrange = errtag = 0; + umask(0); + nops = ARRAY_SIZE(ops); + ops_end = &ops[nops]; + myprog = argv[0]; + while ((c = getopt(argc, argv, "cd:e:f:i:l:n:p:rs:vwzHSX")) != -1) { + switch (c) { + case 'c': + /*Don't cleanup */ + cleanup = 1; + break; + case 'd': + dirname = optarg; + break; + case 'e': + sscanf(optarg, "%d", &errtag); + if (errtag < 0) { + errtag = -errtag; + errrange = 1; + } else if (errtag == 0) + errtag = -1; + if (errtag >= XFS_ERRTAG_MAX) { + fprintf(stderr, + "error tag %d too large (max %d)\n", + errtag, XFS_ERRTAG_MAX - 1); + exit(1); + } + break; + case 'f': + process_freq(optarg); + break; + case 'i': + ilist = realloc(ilist, ++ilistlen * sizeof(*ilist)); + ilist[ilistlen - 1] = strtol(optarg, &p, 16); + break; + case 'l': + loops = atoi(optarg); + break; + case 'n': + operations = atoi(optarg); + break; + case 'p': + nproc = atoi(optarg); + break; + case 'r': + namerand = 1; + break; + case 's': + seed = strtoul(optarg, NULL, 0); + break; + case 'v': + verbose = 1; + break; + case 'w': + write_freq(); + break; + case 'z': + zero_freq(); + break; + case 'S': + show_ops(0, NULL); + printf("\n"); + nousage = 1; + break; + case '?': + fprintf(stderr, "%s - invalid parameters\n", myprog); + /* fall through */ + case 'H': + usage(); + exit(1); + case 'X': + no_xfs = 1; + break; + } + } + + if (no_xfs && errtag) { + fprintf(stderr, "error injection only works on XFS\n"); + exit(1); + } + + if (no_xfs) { + int i; + for (i = 0; ops + i < ops_end; ++i) { + if (ops[i].isxfs) + ops[i].freq = 0; + } + } + + make_freq_table(); + + while (((loopcntr <= loops) || (loops == 0)) && !should_stop) { + if (!dirname) { + /* no directory specified */ + if (!nousage) + usage(); + exit(1); + } + + (void)mkdir(dirname, 0777); + if (chdir(dirname) < 0) { + perror(dirname); + exit(1); + } + sprintf(buf, "fss%x", getpid()); + fd = creat(buf, 0666); + if (lseek64(fd, (off64_t) (MAXFSIZE32 + 1ULL), SEEK_SET) < 0) + maxfsize = (off64_t) MAXFSIZE32; + else + maxfsize = (off64_t) MAXFSIZE; + dcache_init(); + setlinebuf(stdout); + if (!seed) { + gettimeofday(&t, NULL); + seed = (int)t.tv_sec ^ (int)t.tv_usec; + printf("seed = %ld\n", seed); + } +#ifndef NO_XFS + if (!no_xfs) { + memset(&geom, 0, sizeof(geom)); + i = ioctl(fd, XFS_IOC_FSGEOMETRY, &geom); + if (i >= 0 && geom.rtblocks) + rtpct = MIN(MAX(geom.rtblocks * 100 / + (geom.rtblocks + + geom.datablocks), 1), 99); + else + rtpct = 0; + } + if (errtag != 0) { + if (errrange == 0) { + if (errtag <= 0) { + srandom(seed); + j = random() % 100; + + for (i = 0; i < j; i++) + (void)random(); + + errtag = + (random() % (XFS_ERRTAG_MAX - 1)) + + 1; + } + } else { + srandom(seed); + j = random() % 100; + + for (i = 0; i < j; i++) + (void)random(); + + errtag += + (random() % (XFS_ERRTAG_MAX - errtag)); + } + printf("Injecting failure on tag #%d\n", errtag); + memset(&err_inj, 0, sizeof(err_inj)); + err_inj.errtag = errtag; + err_inj.fd = fd; + srval = ioctl(fd, XFS_IOC_ERROR_INJECTION, &err_inj); + if (srval < -1) { + perror + ("fsstress - XFS_SYSSGI error injection call"); + close(fd); + unlink(buf); + exit(1); + } + } else +#endif + close(fd); + unlink(buf); + + + if (nproc == 1) { + procid = 0; + doproc(); + } else { + setpgid(0, 0); + action.sa_handler = sg_handler; + sigemptyset(&action.sa_mask); + action.sa_flags = 0; + if (sigaction(SIGTERM, &action, 0)) { + perror("sigaction failed"); + exit(1); + } + + for (i = 0; i < nproc; i++) { + if (fork() == 0) { + + action.sa_handler = SIG_DFL; + sigemptyset(&action.sa_mask); + if (sigaction(SIGTERM, &action, 0)) + return 1; +#ifdef HAVE_SYS_PRCTL_H + prctl(PR_SET_PDEATHSIG, SIGKILL); + if (getppid() == 1) /* parent died already? */ + return 0; +#endif + procid = i; + doproc(); + return 0; + } + } + while (wait(&stat) > 0 && !should_stop) { + continue; + } + if (should_stop) { + action.sa_flags = SA_RESTART; + sigaction(SIGTERM, &action, 0); + kill(-getpid(), SIGTERM); + while (wait(&stat) > 0) + continue; + } + } +#ifndef NO_XFS + if (errtag != 0) { + memset(&err_inj, 0, sizeof(err_inj)); + err_inj.errtag = 0; + err_inj.fd = fd; + if ((srval = + ioctl(fd, XFS_IOC_ERROR_CLEARALL, + &err_inj)) != 0) { + fprintf(stderr, "Bad ej clear on %d (%d).\n", + fd, errno); + perror + ("fsstress - XFS_SYSSGI clear error injection call"); + close(fd); + exit(1); + } + close(fd); + } +#endif + if (cleanup == 0) { + sprintf(cmd, "rm -rf %s/*", dirname); + system(cmd); + for (i = 0; i < FT_nft; i++) { + flist[i].nslots = 0; + flist[i].nfiles = 0; + free(flist[i].fents); + flist[i].fents = NULL; + } + } + loopcntr++; + } + return 0; +} + +void add_to_flist(int ft, int id, int parent) +{ + fent_t *fep; + flist_t *ftp; + + ftp = &flist[ft]; + if (ftp->nfiles == ftp->nslots) { + ftp->nslots += FLIST_SLOT_INCR; + ftp->fents = realloc(ftp->fents, ftp->nslots * sizeof(fent_t)); + } + fep = &ftp->fents[ftp->nfiles++]; + fep->id = id; + fep->parent = parent; +} + +void append_pathname(pathname_t * name, char *str) +{ + int len; + + len = strlen(str); +#ifdef DEBUG + if (len && *str == '/' && name->len == 0) { + fprintf(stderr, "fsstress: append_pathname failure\n"); + chdir(homedir); + abort(); + + } +#endif + name->path = realloc(name->path, name->len + 1 + len); + strcpy(&name->path[name->len], str); + name->len += len; +} + +#ifndef NO_XFS +int +attr_list_path(pathname_t * name, char *buffer, const int buffersize, int flags, + attrlist_cursor_t * cursor) +{ + char buf[MAXNAMELEN]; + pathname_t newname; + int rval; + + rval = attr_list(name->path, buffer, buffersize, flags, cursor); + if (rval >= 0 || errno != ENAMETOOLONG) + return rval; + separate_pathname(name, buf, &newname); + if (chdir(buf) == 0) { + rval = attr_list_path(&newname, buffer, buffersize, flags, + cursor); + chdir(".."); + } + free_pathname(&newname); + return rval; +} + +int attr_remove_path(pathname_t * name, const char *attrname, int flags) +{ + char buf[MAXNAMELEN]; + pathname_t newname; + int rval; + + rval = attr_remove(name->path, attrname, flags); + if (rval >= 0 || errno != ENAMETOOLONG) + return rval; + separate_pathname(name, buf, &newname); + if (chdir(buf) == 0) { + rval = attr_remove_path(&newname, attrname, flags); + chdir(".."); + } + free_pathname(&newname); + return rval; +} + +int +attr_set_path(pathname_t * name, const char *attrname, const char *attrvalue, + const int valuelength, int flags) +{ + char buf[MAXNAMELEN]; + pathname_t newname; + int rval; + + rval = attr_set(name->path, attrname, attrvalue, valuelength, flags); + if (rval >= 0 || errno != ENAMETOOLONG) + return rval; + separate_pathname(name, buf, &newname); + if (chdir(buf) == 0) { + rval = attr_set_path(&newname, attrname, attrvalue, valuelength, + flags); + chdir(".."); + } + free_pathname(&newname); + return rval; +} +#endif + +void check_cwd(void) +{ +#ifdef DEBUG + struct stat64 statbuf; + + if (stat64(".", &statbuf) == 0 && statbuf.st_ino == top_ino) + return; + chdir(homedir); + fprintf(stderr, "fsstress: check_cwd failure\n"); + abort(); + +#endif +} + +int creat_path(pathname_t * name, mode_t mode) +{ + char buf[MAXNAMELEN]; + pathname_t newname; + int rval; + + rval = creat(name->path, mode); + if (rval >= 0 || errno != ENAMETOOLONG) + return rval; + separate_pathname(name, buf, &newname); + if (chdir(buf) == 0) { + rval = creat_path(&newname, mode); + chdir(".."); + } + free_pathname(&newname); + return rval; +} + +void dcache_enter(int dirid, int slot) +{ + dcache[dirid % NDCACHE] = slot; +} + +void dcache_init(void) +{ + int i; + + for (i = 0; i < NDCACHE; i++) + dcache[i] = -1; +} + +fent_t *dcache_lookup(int dirid) +{ + fent_t *fep; + int i; + + i = dcache[dirid % NDCACHE]; + if (i >= 0 && (fep = &flist[FT_DIR].fents[i])->id == dirid) + return fep; + return NULL; +} + +void dcache_purge(int dirid) +{ + int *dcp; + + dcp = &dcache[dirid % NDCACHE]; + if (*dcp >= 0 && flist[FT_DIR].fents[*dcp].id == dirid) + *dcp = -1; +} + +void del_from_flist(int ft, int slot) +{ + flist_t *ftp; + + ftp = &flist[ft]; + if (ft == FT_DIR) + dcache_purge(ftp->fents[slot].id); + if (slot != ftp->nfiles - 1) { + if (ft == FT_DIR) + dcache_purge(ftp->fents[ftp->nfiles - 1].id); + ftp->fents[slot] = ftp->fents[--ftp->nfiles]; + } else + ftp->nfiles--; +} + +fent_t *dirid_to_fent(int dirid) +{ + fent_t *efep; + fent_t *fep; + flist_t *flp; + + if ((fep = dcache_lookup(dirid))) + return fep; + flp = &flist[FT_DIR]; + for (fep = flp->fents, efep = &fep[flp->nfiles]; fep < efep; fep++) { + if (fep->id == dirid) { + dcache_enter(dirid, fep - flp->fents); + return fep; + } + } + return NULL; +} + +void doproc(void) +{ + struct stat64 statbuf; + char buf[10]; + int opno; + int rval; + opdesc_t *p; + + sprintf(buf, "p%x", procid); + (void)mkdir(buf, 0777); + if (chdir(buf) < 0 || stat64(".", &statbuf) < 0) { + perror(buf); + _exit(1); + } + top_ino = statbuf.st_ino; + homedir = getcwd(NULL, -1); + seed += procid; + srandom(seed); + if (namerand) + namerand = random(); + for (opno = 0; opno < operations; opno++) { + p = &ops[freq_table[random() % freq_table_size]]; + if ((unsigned long)p->func < 4096) + abort(); + + p->func(opno, random()); + /* + * test for forced shutdown by stat'ing the test + * directory. If this stat returns EIO, assume + * the forced shutdown happened. + */ + if (errtag != 0 && opno % 100 == 0) { + rval = stat64(".", &statbuf); + if (rval == EIO) { + fprintf(stderr, "Detected EIO\n"); + return; + } + } + } +} + +void fent_to_name(pathname_t * name, flist_t * flp, fent_t * fep) +{ + char buf[MAXNAMELEN]; + int i; + fent_t *pfep; + + if (fep == NULL) + return; + if (fep->parent != -1) { + pfep = dirid_to_fent(fep->parent); + fent_to_name(name, &flist[FT_DIR], pfep); + append_pathname(name, "/"); + } + i = sprintf(buf, "%c%x", flp->tag, fep->id); + namerandpad(fep->id, buf, i); + append_pathname(name, buf); +} + +void fix_parent(int oldid, int newid) +{ + fent_t *fep; + flist_t *flp; + int i; + int j; + + for (i = 0, flp = flist; i < FT_nft; i++, flp++) { + for (j = 0, fep = flp->fents; j < flp->nfiles; j++, fep++) { + if (fep->parent == oldid) + fep->parent = newid; + } + } +} + +void free_pathname(pathname_t * name) +{ + if (name->path) { + free(name->path); + name->path = NULL; + name->len = 0; + } +} + +int generate_fname(fent_t * fep, int ft, pathname_t * name, int *idp, int *v) +{ + char buf[MAXNAMELEN]; + flist_t *flp; + int id; + int j; + int len; + + flp = &flist[ft]; + len = sprintf(buf, "%c%x", flp->tag, id = nameseq++); + namerandpad(id, buf, len); + if (fep) { + fent_to_name(name, &flist[FT_DIR], fep); + append_pathname(name, "/"); + } + append_pathname(name, buf); + *idp = id; + *v = verbose; + for (j = 0; !*v && j < ilistlen; j++) { + if (ilist[j] == id) { + *v = 1; + break; + } + } + return 1; +} + +int +get_fname(int which, long r, pathname_t * name, flist_t ** flpp, fent_t ** fepp, + int *v) +{ + int c; + fent_t *fep; + flist_t *flp; + int i; + int j; + int x; + + for (i = 0, c = 0, flp = flist; i < FT_nft; i++, flp++) { + if (which & (1 << i)) + c += flp->nfiles; + } + if (c == 0) { + if (flpp) + *flpp = NULL; + if (fepp) + *fepp = NULL; + *v = verbose; + return 0; + } + x = (int)(r % c); + for (i = 0, c = 0, flp = flist; i < FT_nft; i++, flp++) { + if (which & (1 << i)) { + if (x < c + flp->nfiles) { + fep = &flp->fents[x - c]; + if (name) + fent_to_name(name, flp, fep); + if (flpp) + *flpp = flp; + if (fepp) + *fepp = fep; + *v = verbose; + for (j = 0; !*v && j < ilistlen; j++) { + if (ilist[j] == fep->id) { + *v = 1; + break; + } + } + return 1; + } + c += flp->nfiles; + } + } +#ifdef DEBUG + fprintf(stderr, "fsstress: get_fname failure\n"); + abort(); +#endif + return -1; + +} + +void init_pathname(pathname_t * name) +{ + name->len = 0; + name->path = NULL; +} + +int lchown_path(pathname_t * name, uid_t owner, gid_t group) +{ + char buf[MAXNAMELEN]; + pathname_t newname; + int rval; + + rval = lchown(name->path, owner, group); + if (rval >= 0 || errno != ENAMETOOLONG) + return rval; + separate_pathname(name, buf, &newname); + if (chdir(buf) == 0) { + rval = lchown_path(&newname, owner, group); + chdir(".."); + } + free_pathname(&newname); + return rval; +} + +int link_path(pathname_t * name1, pathname_t * name2) +{ + char buf1[MAXNAMELEN]; + char buf2[MAXNAMELEN]; + int down1; + pathname_t newname1; + pathname_t newname2; + int rval; + + rval = link(name1->path, name2->path); + if (rval >= 0 || errno != ENAMETOOLONG) + return rval; + separate_pathname(name1, buf1, &newname1); + separate_pathname(name2, buf2, &newname2); + if (strcmp(buf1, buf2) == 0) { + if (chdir(buf1) == 0) { + rval = link_path(&newname1, &newname2); + chdir(".."); + } + } else { + if (strcmp(buf1, "..") == 0) + down1 = 0; + else if (strcmp(buf2, "..") == 0) + down1 = 1; + else if (strlen(buf1) == 0) + down1 = 0; + else if (strlen(buf2) == 0) + down1 = 1; + else + down1 = MAX(newname1.len, 3 + name2->len) <= + MAX(3 + name1->len, newname2.len); + if (down1) { + free_pathname(&newname2); + append_pathname(&newname2, "../"); + append_pathname(&newname2, name2->path); + if (chdir(buf1) == 0) { + rval = link_path(&newname1, &newname2); + chdir(".."); + } + } else { + free_pathname(&newname1); + append_pathname(&newname1, "../"); + append_pathname(&newname1, name1->path); + if (chdir(buf2) == 0) { + rval = link_path(&newname1, &newname2); + chdir(".."); + } + } + } + free_pathname(&newname1); + free_pathname(&newname2); + return rval; +} + +int lstat64_path(pathname_t * name, struct stat64 *sbuf) +{ + char buf[MAXNAMELEN]; + pathname_t newname; + int rval; + + rval = lstat64(name->path, sbuf); + if (rval >= 0 || errno != ENAMETOOLONG) + return rval; + separate_pathname(name, buf, &newname); + if (chdir(buf) == 0) { + rval = lstat64_path(&newname, sbuf); + chdir(".."); + } + free_pathname(&newname); + return rval; +} + +void make_freq_table(void) +{ + int f; + int i; + opdesc_t *p; + + for (p = ops, f = 0; p < ops_end; p++) + f += p->freq; + freq_table = malloc(f * sizeof(*freq_table)); + freq_table_size = f; + for (p = ops, i = 0; p < ops_end; p++) { + for (f = 0; f < p->freq; f++, i++) + freq_table[i] = p->op; + } +} + +int mkdir_path(pathname_t * name, mode_t mode) +{ + char buf[MAXNAMELEN]; + pathname_t newname; + int rval; + + rval = mkdir(name->path, mode); + if (rval >= 0 || errno != ENAMETOOLONG) + return rval; + separate_pathname(name, buf, &newname); + if (chdir(buf) == 0) { + rval = mkdir_path(&newname, mode); + chdir(".."); + } + free_pathname(&newname); + return rval; +} + +int mknod_path(pathname_t * name, mode_t mode, dev_t dev) +{ + char buf[MAXNAMELEN]; + pathname_t newname; + int rval; + + rval = mknod(name->path, mode, dev); + if (rval >= 0 || errno != ENAMETOOLONG) + return rval; + separate_pathname(name, buf, &newname); + if (chdir(buf) == 0) { + rval = mknod_path(&newname, mode, dev); + chdir(".."); + } + free_pathname(&newname); + return rval; +} + +void namerandpad(int id, char *buf, int i) +{ + int bucket; + static int buckets[] = { 2, 4, 8, 16, 32, 64, 128, MAXNAMELEN - 1 }; + int padlen; + int padmod; + + if (namerand == 0) + return; + bucket = (id ^ namerand) % ARRAY_SIZE(buckets); + padmod = buckets[bucket] + 1 - i; + if (padmod <= 0) + return; + padlen = (id ^ namerand) % padmod; + if (padlen) { + memset(&buf[i], 'X', padlen); + buf[i + padlen] = '\0'; + } +} + +int open_path(pathname_t * name, int oflag) +{ + char buf[MAXNAMELEN]; + pathname_t newname; + int rval; + + rval = open(name->path, oflag); + if (rval >= 0 || errno != ENAMETOOLONG) + return rval; + separate_pathname(name, buf, &newname); + if (chdir(buf) == 0) { + rval = open_path(&newname, oflag); + chdir(".."); + } + free_pathname(&newname); + return rval; +} + +DIR *opendir_path(pathname_t * name) +{ + char buf[MAXNAMELEN]; + pathname_t newname; + DIR *rval; + + rval = opendir(name->path); + if (rval || errno != ENAMETOOLONG) + return rval; + separate_pathname(name, buf, &newname); + if (chdir(buf) == 0) { + rval = opendir_path(&newname); + chdir(".."); + } + free_pathname(&newname); + return rval; +} + +void process_freq(char *arg) +{ + opdesc_t *p; + char *s; + + s = strchr(arg, '='); + if (s == NULL) { + fprintf(stderr, "bad argument '%s'\n", arg); + exit(1); + } + *s++ = '\0'; + for (p = ops; p < ops_end; p++) { + if (strcmp(arg, p->name) == 0) { + p->freq = atoi(s); + return; + } + } + fprintf(stderr, "can't find op type %s for -f\n", arg); + exit(1); +} + +int readlink_path(pathname_t * name, char *lbuf, size_t lbufsiz) +{ + char buf[MAXNAMELEN]; + pathname_t newname; + int rval; + + rval = readlink(name->path, lbuf, lbufsiz-1); + if (rval >= 0) + lbuf[rval] = '\0'; + if (rval >= 0 || errno != ENAMETOOLONG) + return rval; + separate_pathname(name, buf, &newname); + if (chdir(buf) == 0) { + rval = readlink_path(&newname, lbuf, lbufsiz); + chdir(".."); + } + free_pathname(&newname); + return rval; +} + +int rename_path(pathname_t * name1, pathname_t * name2) +{ + char buf1[MAXNAMELEN]; + char buf2[MAXNAMELEN]; + int down1; + pathname_t newname1; + pathname_t newname2; + int rval; + + rval = rename(name1->path, name2->path); + if (rval >= 0 || errno != ENAMETOOLONG) + return rval; + separate_pathname(name1, buf1, &newname1); + separate_pathname(name2, buf2, &newname2); + if (strcmp(buf1, buf2) == 0) { + if (chdir(buf1) == 0) { + rval = rename_path(&newname1, &newname2); + chdir(".."); + } + } else { + if (strcmp(buf1, "..") == 0) + down1 = 0; + else if (strcmp(buf2, "..") == 0) + down1 = 1; + else if (strlen(buf1) == 0) + down1 = 0; + else if (strlen(buf2) == 0) + down1 = 1; + else + down1 = MAX(newname1.len, 3 + name2->len) <= + MAX(3 + name1->len, newname2.len); + if (down1) { + free_pathname(&newname2); + append_pathname(&newname2, "../"); + append_pathname(&newname2, name2->path); + if (chdir(buf1) == 0) { + rval = rename_path(&newname1, &newname2); + chdir(".."); + } + } else { + free_pathname(&newname1); + append_pathname(&newname1, "../"); + append_pathname(&newname1, name1->path); + if (chdir(buf2) == 0) { + rval = rename_path(&newname1, &newname2); + chdir(".."); + } + } + } + free_pathname(&newname1); + free_pathname(&newname2); + return rval; +} + +int rmdir_path(pathname_t * name) +{ + char buf[MAXNAMELEN]; + pathname_t newname; + int rval; + + rval = rmdir(name->path); + if (rval >= 0 || errno != ENAMETOOLONG) + return rval; + separate_pathname(name, buf, &newname); + if (chdir(buf) == 0) { + rval = rmdir_path(&newname); + chdir(".."); + } + free_pathname(&newname); + return rval; +} + +void separate_pathname(pathname_t * name, char *buf, pathname_t * newname) +{ + char *slash; + + init_pathname(newname); + slash = strchr(name->path, '/'); + if (slash == NULL) { + buf[0] = '\0'; + return; + } + *slash = '\0'; + strcpy(buf, name->path); + *slash = '/'; + append_pathname(newname, slash + 1); +} + +#define WIDTH 80 + +void show_ops(int flag, char *lead_str) +{ + opdesc_t *p; + + if (flag < 0) { + /* print in list form */ + int x = WIDTH; + + for (p = ops; p < ops_end; p++) { + if (lead_str != NULL + && x + strlen(p->name) >= WIDTH - 5) + x = printf("%s%s", (p == ops) ? "" : "\n", + lead_str); + x += printf("%s ", p->name); + } + printf("\n"); + } else { + int f; + for (f = 0, p = ops; p < ops_end; p++) + f += p->freq; + + if (f == 0) + flag = 1; + + for (p = ops; p < ops_end; p++) { + if (flag != 0 || p->freq > 0) { + if (lead_str != NULL) + printf("%s", lead_str); + printf("%20s %d/%d %s\n", + p->name, p->freq, f, + (p->iswrite == 0) ? " " : "write op"); + } + } + } +} + +int stat64_path(pathname_t * name, struct stat64 *sbuf) +{ + char buf[MAXNAMELEN]; + pathname_t newname; + int rval; + + rval = stat64(name->path, sbuf); + if (rval >= 0 || errno != ENAMETOOLONG) + return rval; + separate_pathname(name, buf, &newname); + if (chdir(buf) == 0) { + rval = stat64_path(&newname, sbuf); + chdir(".."); + } + free_pathname(&newname); + return rval; +} + +int symlink_path(const char *name1, pathname_t * name) +{ + char buf[MAXNAMELEN]; + pathname_t newname; + int rval; + + if (!strcmp(name1, name->path)) { + printf("yikes! %s %s\n", name1, name->path); + return 0; + } + + rval = symlink(name1, name->path); + if (rval >= 0 || errno != ENAMETOOLONG) + return rval; + separate_pathname(name, buf, &newname); + if (chdir(buf) == 0) { + rval = symlink_path(name1, &newname); + chdir(".."); + } + free_pathname(&newname); + return rval; +} + +int truncate64_path(pathname_t * name, off64_t length) +{ + char buf[MAXNAMELEN]; + pathname_t newname; + int rval; + + rval = truncate64(name->path, length); + if (rval >= 0 || errno != ENAMETOOLONG) + return rval; + separate_pathname(name, buf, &newname); + if (chdir(buf) == 0) { + rval = truncate64_path(&newname, length); + chdir(".."); + } + free_pathname(&newname); + return rval; +} + +int unlink_path(pathname_t * name) +{ + char buf[MAXNAMELEN]; + pathname_t newname; + int rval; + + rval = unlink(name->path); + if (rval >= 0 || errno != ENAMETOOLONG) + return rval; + separate_pathname(name, buf, &newname); + if (chdir(buf) == 0) { + rval = unlink_path(&newname); + chdir(".."); + } + free_pathname(&newname); + return rval; +} + +void usage(void) +{ + printf("Usage: %s -H or\n", myprog); + printf + (" %s [-c][-d dir][-e errtg][-f op_name=freq][-l loops][-n nops]\n", + myprog); + printf(" [-p nproc][-r len][-s seed][-v][-w][-z][-S]\n"); + printf("where\n"); + printf + (" -c specifies not to remove files(cleanup) after execution\n"); + printf + (" -d dir specifies the base directory for operations\n"); + printf(" -e errtg specifies error injection stuff\n"); + printf + (" -f op_name=freq changes the frequency of option name to freq\n"); + printf(" the valid operation names are:\n"); + show_ops(-1, " "); + printf + (" -l loops specifies the no. of times the testrun should loop.\n"); + printf(" *use 0 for infinite (default 1)\n"); + printf + (" -n nops specifies the no. of operations per process (default 1)\n"); + printf + (" -p nproc specifies the no. of processes (default 1)\n"); + printf(" -r specifies random name padding\n"); + printf + (" -s seed specifies the seed for the random generator (default random)\n"); + printf(" -v specifies verbose mode\n"); + printf + (" -w zeros frequencies of non-write operations\n"); + printf(" -z zeros frequencies of all operations\n"); + printf + (" -S prints the table of operations (omitting zero frequency)\n"); + printf(" -H prints usage and exits\n"); + printf + (" -X don't do anything XFS specific (default with -DNO_XFS)\n"); +} + +void write_freq(void) +{ + opdesc_t *p; + + for (p = ops; p < ops_end; p++) { + if (!p->iswrite) + p->freq = 0; + } +} + +void zero_freq(void) +{ + opdesc_t *p; + + for (p = ops; p < ops_end; p++) + p->freq = 0; +} + +#ifndef NO_XFS + +void allocsp_f(int opno, long r) +{ + int e; + pathname_t f; + int fd; + struct xfs_flock64 fl; + __s64 lr; + __s64 off; + struct stat64 stb; + int v; + + init_pathname(&f); + if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) { + if (v) + printf("%d/%d: allocsp - no filename\n", procid, opno); + free_pathname(&f); + return; + } + fd = open_path(&f, O_RDWR); + e = fd < 0 ? errno : 0; + check_cwd(); + if (fd < 0) { + if (v) + printf("%d/%d: allocsp - open %s failed %d\n", + procid, opno, f.path, e); + free_pathname(&f); + return; + } + if (fstat64(fd, &stb) < 0) { + if (v) + printf("%d/%d: allocsp - fstat64 %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); + return; + } + lr = ((__s64) random() << 32) + random(); + off = lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE); + off %= maxfsize; + memset(&fl, 0, sizeof(fl)); + fl.l_whence = SEEK_SET; + fl.l_start = off; + fl.l_len = 0; + e = ioctl(fd, XFS_IOC_ALLOCSP64, &fl) < 0 ? errno : 0; + if (v) + printf("%d/%d: ioctl(XFS_IOC_ALLOCSP64) %s %lld 0 %d\n", + procid, opno, f.path, (long long)off, e); + free_pathname(&f); + close(fd); +} + +void attr_remove_f(int opno, long r) +{ + attrlist_ent_t *aep; + attrlist_t *alist; + char *aname; + char buf[4096]; + attrlist_cursor_t cursor; + int e; + int ent; + pathname_t f; + int total; + int v; + int which; + + init_pathname(&f); + if (!get_fname(FT_ANYm, r, &f, NULL, NULL, &v)) + append_pathname(&f, "."); + total = 0; + memset(&cursor, 0x00, sizeof(cursor)); + do { + e = attr_list_path(&f, buf, sizeof(buf), ATTR_DONTFOLLOW, + &cursor); + check_cwd(); + if (e) + break; + alist = (attrlist_t *) buf; + total += alist->al_count; + } while (alist->al_more); + if (total == 0) { + if (v) + printf("%d/%d: attr_remove - no attrs for %s\n", + procid, opno, f.path); + free_pathname(&f); + return; + } + which = (int)(random() % total); + memset(&cursor, 0x00, sizeof(cursor)); + ent = 0; + aname = NULL; + do { + e = attr_list_path(&f, buf, sizeof(buf), ATTR_DONTFOLLOW, + &cursor); + check_cwd(); + if (e) + break; + alist = (attrlist_t *) buf; + if (which < ent + alist->al_count) { + aep = (attrlist_ent_t *) + & buf[alist->al_offset[which - ent]]; + aname = aep->a_name; + break; + } + ent += alist->al_count; + } while (alist->al_more); + if (aname == NULL) { + if (v) + printf("%d/%d: attr_remove - name %d not found at %s\n", + procid, opno, which, f.path); + free_pathname(&f); + return; + } + e = attr_remove_path(&f, aname, ATTR_DONTFOLLOW) < 0 ? errno : 0; + check_cwd(); + if (v) + printf("%d/%d: attr_remove %s %s %d\n", + procid, opno, f.path, aname, e); + free_pathname(&f); +} + +void attr_set_f(int opno, long r) +{ + char aname[10]; + char *aval; + int e; + pathname_t f; + int len; + static int lengths[] = { 10, 100, 1000, 10000 }; + int li; + int v; + + init_pathname(&f); + if (!get_fname(FT_ANYm, r, &f, NULL, NULL, &v)) + append_pathname(&f, "."); + sprintf(aname, "a%x", nameseq++); + li = (int)(random() % ARRAY_SIZE(lengths)); + len = (int)(random() % lengths[li]); + if (len == 0) + len = 1; + aval = malloc(len); + memset(aval, nameseq & 0xff, len); + e = attr_set_path(&f, aname, aval, len, ATTR_DONTFOLLOW) < 0 ? + errno : 0; + check_cwd(); + free(aval); + if (v) + printf("%d/%d: attr_set %s %s %d\n", procid, opno, f.path, + aname, e); + free_pathname(&f); +} + +void bulkstat_f(int opno, long r) +{ + __s32 count; + int fd; + __u64 last; + __s32 nent; + xfs_bstat_t *t; + int64_t total; + xfs_fsop_bulkreq_t bsr; + + last = 0; + nent = (r % 999) + 2; + t = malloc(nent * sizeof(*t)); + fd = open(".", O_RDONLY); + total = 0; + + memset(&bsr, 0, sizeof(bsr)); + bsr.lastip = &last; + bsr.icount = nent; + bsr.ubuffer = t; + bsr.ocount = &count; + + while (ioctl(fd, XFS_IOC_FSBULKSTAT, &bsr) == 0 && count > 0) + total += count; + free(t); + if (verbose) + printf("%d/%d: bulkstat nent %d total %lld\n", + procid, opno, (int)nent, (long long)total); + close(fd); +} + +void bulkstat1_f(int opno, long r) +{ + int e; + pathname_t f; + int fd; + int good; + __u64 ino; + struct stat64 s; + xfs_bstat_t t; + int v; + xfs_fsop_bulkreq_t bsr; + + good = random() & 1; + if (good) { + /* use an inode we know exists */ + init_pathname(&f); + if (!get_fname(FT_ANYm, r, &f, NULL, NULL, &v)) + append_pathname(&f, "."); + ino = stat64_path(&f, &s) < 0 ? (ino64_t) r : s.st_ino; + check_cwd(); + free_pathname(&f); + } else { + /* + * pick a random inode + * + * note this can generate kernel warning messages + * since bulkstat_one will read the disk block that + * would contain a given inode even if that disk + * block doesn't contain inodes. + * + * this is detected later, but not until after the + * warning is displayed. + * + * "XFS: device 0x825- bad inode magic/vsn daddr 0x0 #0" + * + */ + ino = (ino64_t) r; + v = verbose; + } + fd = open(".", O_RDONLY); + + memset(&bsr, 0, sizeof(bsr)); + bsr.lastip = &ino; + bsr.icount = 1; + bsr.ubuffer = &t; + bsr.ocount = NULL; + + e = ioctl(fd, XFS_IOC_FSBULKSTAT_SINGLE, &bsr) < 0 ? errno : 0; + if (v) + printf("%d/%d: bulkstat1 %s ino %lld %d\n", + procid, opno, good ? "real" : "random", + (long long)ino, e); + close(fd); +} + +#endif + +void chown_f(int opno, long r) +{ + int e; + pathname_t f; + int nbits; + uid_t u; + int v; + + init_pathname(&f); + if (!get_fname(FT_ANYm, r, &f, NULL, NULL, &v)) + append_pathname(&f, "."); + u = (uid_t) random(); + nbits = (int)(random() % 32); + u &= (1 << nbits) - 1; + e = lchown_path(&f, u, -1) < 0 ? errno : 0; + check_cwd(); + if (v) + printf("%d/%d: chown %s %d %d\n", procid, opno, f.path, u, e); + free_pathname(&f); +} + +void creat_f(int opno, long r) +{ + int e; + int e1; + int extsize; + pathname_t f; + int fd; + fent_t *fep; + int id; + int parid; + int type; + int v; + int v1; + int esz = 0; + + if (!get_fname(FT_DIRm, r, NULL, NULL, &fep, &v1)) + parid = -1; + else + parid = fep->id; + init_pathname(&f); + type = rtpct ? ((random() % 100) > rtpct ? FT_REG : FT_RTF) : FT_REG; + if (type == FT_RTF) + extsize = (random() % 10) + 1; + else + extsize = 0; + e = generate_fname(fep, type, &f, &id, &v); + v |= v1; + if (!e) { + if (v) { + fent_to_name(&f, &flist[FT_DIR], fep); + printf("%d/%d: creat - no filename from %s\n", + procid, opno, f.path); + } + free_pathname(&f); + return; + } + fd = creat_path(&f, 0666); + e = fd < 0 ? errno : 0; + e1 = 0; + check_cwd(); + esz = 0; + if (fd >= 0) { +#ifndef NO_XFS + struct fsxattr a; + memset(&a, 0, sizeof(a)); + if (extsize && ioctl(fd, XFS_IOC_FSGETXATTR, &a) >= 0) { + a.fsx_xflags |= XFS_XFLAG_REALTIME; + a.fsx_extsize = + geom.rtextsize * geom.blocksize * extsize; + if (ioctl(fd, XFS_IOC_FSSETXATTR, &a) < 0) + e1 = errno; + esz = a.fsx_extsize; + + } +#endif + add_to_flist(type, id, parid); + close(fd); + } + if (v) + printf("%d/%d: creat %s x:%d %d %d\n", procid, opno, f.path, + esz, e, e1); + free_pathname(&f); +} + +int setdirect(int fd) +{ + static int no_direct; + int flags; + + if (no_direct) + return 0; + + flags = fcntl(fd, F_GETFL, 0); + if (flags < 0) + return 0; + + if (fcntl(fd, F_SETFL, flags | O_DIRECT) < 0) { + if (no_xfs) { + no_direct = 1; + return 0; + } + printf("cannot set O_DIRECT: %s\n", strerror(errno)); + return 0; + } + + return 1; +} + +void dread_f(int opno, long r) +{ + int64_t align; + char *buf = NULL; + struct dioattr diob; + int e; + pathname_t f; + int fd; + size_t len; + int64_t lr; + off64_t off; + struct stat64 stb; + int v; + + init_pathname(&f); + if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) { + if (v) + printf("%d/%d: dread - no filename\n", procid, opno); + free_pathname(&f); + return; + } + fd = open_path(&f, O_RDONLY); + + e = fd < 0 ? errno : 0; + check_cwd(); + if (fd < 0) { + if (v) + printf("%d/%d: dread - open %s failed %d\n", + procid, opno, f.path, e); + free_pathname(&f); + return; + } + + if (!setdirect(fd)) { + close(fd); + free_pathname(&f); + return; + } + + if (fstat64(fd, &stb) < 0) { + if (v) + printf("%d/%d: dread - fstat64 %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); + return; + } + if (stb.st_size == 0) { + if (v) + printf("%d/%d: dread - %s zero size\n", procid, opno, + f.path); + free_pathname(&f); + close(fd); + return; + } + + memset(&diob, 0, sizeof(diob)); + if (no_xfs) { + diob.d_miniosz = stb.st_blksize; + diob.d_maxiosz = stb.st_blksize * 256; /* good number ? */ + diob.d_mem = stb.st_blksize; + } +#ifndef NO_XFS + else if (ioctl(fd, XFS_IOC_DIOINFO, &diob) < 0) { + if (v) + printf + ("%d/%d: dread - ioctl(fd, XFS_IOC_DIOINFO) %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); + return; + } +#endif + align = (int64_t) diob.d_miniosz; + lr = ((int64_t) random() << 32) + random(); + off = (off64_t) (lr % stb.st_size); + off -= (off % align); + lseek64(fd, off, SEEK_SET); + len = (random() % (getpagesize() * 32)) + 1; + len -= (len % align); + if (len <= 0) + len = align; + else if (len > diob.d_maxiosz) + len = diob.d_maxiosz; + if ((e = posix_memalign((void **)&buf, diob.d_mem, len)) != 0) { + fprintf(stderr, "posix_memalign: %s\n", strerror(e)); + exit(1); + } + if (buf == NULL) { + fprintf(stderr, "posix_memalign: buf is NULL\n"); + exit(1); + } + e = read(fd, buf, len) < 0 ? errno : 0; + free(buf); + if (v) + printf("%d/%d: dread %s [%lld,%ld] %d\n", + procid, opno, f.path, (long long int)off, (long)len, e); + free_pathname(&f); + close(fd); +} + +void dwrite_f(int opno, long r) +{ + int64_t align; + char *buf = NULL; + struct dioattr diob; + int e; + pathname_t f; + int fd; + size_t len; + int64_t lr; + off64_t off; + struct stat64 stb; + int v; + + init_pathname(&f); + if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) { + if (v) + printf("%d/%d: dwrite - no filename\n", procid, opno); + free_pathname(&f); + return; + } + fd = open_path(&f, O_WRONLY); + e = fd < 0 ? errno : 0; + check_cwd(); + if (fd < 0) { + if (v) + printf("%d/%d: dwrite - open %s failed %d\n", + procid, opno, f.path, e); + free_pathname(&f); + return; + } + + if (!setdirect(fd)) { + close(fd); + free_pathname(&f); + return; + } + if (fstat64(fd, &stb) < 0) { + if (v) + printf("%d/%d: dwrite - fstat64 %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); + return; + } + memset(&diob, 0, sizeof(diob)); + if (no_xfs) { + diob.d_miniosz = stb.st_blksize; + diob.d_maxiosz = stb.st_blksize * 256; /* good number ? */ + diob.d_mem = stb.st_blksize; + } +#ifndef NO_XFS + else if (ioctl(fd, XFS_IOC_DIOINFO, &diob) < 0) { + if (v) + printf + ("%d/%d: dwrite - ioctl(fd, XFS_IOC_DIOINFO) %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); + return; + } +#endif + align = (int64_t) diob.d_miniosz; + lr = ((int64_t) random() << 32) + random(); + off = (off64_t) (lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE)); + off -= (off % align); + lseek64(fd, off, SEEK_SET); + len = (random() % (getpagesize() * 32)) + 1; + len -= (len % align); + if (len <= 0) + len = align; + else if (len > diob.d_maxiosz) + len = diob.d_maxiosz; + if ((e = posix_memalign((void **)&buf, diob.d_mem, len)) != 0) { + fprintf(stderr, "posix_memalign: %s\n", strerror(e)); + exit(1); + } + if (buf == NULL) { + fprintf(stderr, "posix_memalign: buf is NULL\n"); + exit(1); + } + off %= maxfsize; + lseek64(fd, off, SEEK_SET); + memset(buf, nameseq & 0xff, len); + e = write(fd, buf, len) < 0 ? errno : 0; + free(buf); + if (v) + printf("%d/%d: dwrite %s [%lld,%ld] %d\n", + procid, opno, f.path, (long long)off, (long int)len, e); + free_pathname(&f); + close(fd); +} + +void fdatasync_f(int opno, long r) +{ + int e; + pathname_t f; + int fd; + int v; + + init_pathname(&f); + if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) { + if (v) + printf("%d/%d: fdatasync - no filename\n", + procid, opno); + free_pathname(&f); + return; + } + fd = open_path(&f, O_WRONLY); + e = fd < 0 ? errno : 0; + check_cwd(); + if (fd < 0) { + if (v) + printf("%d/%d: fdatasync - open %s failed %d\n", + procid, opno, f.path, e); + free_pathname(&f); + return; + } + e = fdatasync(fd) < 0 ? errno : 0; + if (v) + printf("%d/%d: fdatasync %s %d\n", procid, opno, f.path, e); + free_pathname(&f); + close(fd); +} + +#ifndef NO_XFS +void freesp_f(int opno, long r) +{ + int e; + pathname_t f; + int fd; + struct xfs_flock64 fl; + __s64 lr; + __s64 off; + struct stat64 stb; + int v; + + init_pathname(&f); + if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) { + if (v) + printf("%d/%d: freesp - no filename\n", procid, opno); + free_pathname(&f); + return; + } + fd = open_path(&f, O_RDWR); + e = fd < 0 ? errno : 0; + check_cwd(); + if (fd < 0) { + if (v) + printf("%d/%d: freesp - open %s failed %d\n", + procid, opno, f.path, e); + free_pathname(&f); + return; + } + if (fstat64(fd, &stb) < 0) { + if (v) + printf("%d/%d: freesp - fstat64 %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); + return; + } + lr = ((__s64) random() << 32) + random(); + off = lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE); + off %= maxfsize; + memset(&fl, 0, sizeof(fl)); + fl.l_whence = SEEK_SET; + fl.l_start = off; + fl.l_len = 0; + e = ioctl(fd, XFS_IOC_FREESP64, &fl) < 0 ? errno : 0; + if (v) + printf("%d/%d: ioctl(XFS_IOC_FREESP64) %s %lld 0 %d\n", + procid, opno, f.path, (long long)off, e); + free_pathname(&f); + close(fd); +} + +#endif + +void fsync_f(int opno, long r) +{ + int e; + pathname_t f; + int fd; + int v; + + init_pathname(&f); + if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) { + if (v) + printf("%d/%d: fsync - no filename\n", procid, opno); + free_pathname(&f); + return; + } + fd = open_path(&f, O_WRONLY); + e = fd < 0 ? errno : 0; + check_cwd(); + if (fd < 0) { + if (v) + printf("%d/%d: fsync - open %s failed %d\n", + procid, opno, f.path, e); + free_pathname(&f); + return; + } + e = fsync(fd) < 0 ? errno : 0; + if (v) + printf("%d/%d: fsync %s %d\n", procid, opno, f.path, e); + free_pathname(&f); + close(fd); +} + +void getdents_f(int opno, long r) +{ + DIR *dir; + pathname_t f; + int v; + + init_pathname(&f); + if (!get_fname(FT_DIRm, r, &f, NULL, NULL, &v)) + append_pathname(&f, "."); + dir = opendir_path(&f); + check_cwd(); + if (dir == NULL) { + if (v) + printf("%d/%d: getdents - can't open %s\n", + procid, opno, f.path); + free_pathname(&f); + return; + } + while (readdir64(dir) != NULL) + continue; + if (v) + printf("%d/%d: getdents %s 0\n", procid, opno, f.path); + free_pathname(&f); + closedir(dir); +} + +void link_f(int opno, long r) +{ + int e; + pathname_t f; + fent_t *fep; + flist_t *flp; + int id; + pathname_t l; + int parid; + int v; + int v1; + + init_pathname(&f); + if (!get_fname(FT_NOTDIR, r, &f, &flp, NULL, &v1)) { + if (v1) + printf("%d/%d: link - no file\n", procid, opno); + free_pathname(&f); + return; + } + if (!get_fname(FT_DIRm, random(), NULL, NULL, &fep, &v)) + parid = -1; + else + parid = fep->id; + v |= v1; + init_pathname(&l); + e = generate_fname(fep, flp - flist, &l, &id, &v1); + v |= v1; + if (!e) { + if (v) { + fent_to_name(&l, &flist[FT_DIR], fep); + printf("%d/%d: link - no filename from %s\n", + procid, opno, l.path); + } + free_pathname(&l); + free_pathname(&f); + return; + } + e = link_path(&f, &l) < 0 ? errno : 0; + check_cwd(); + if (e == 0) + add_to_flist(flp - flist, id, parid); + if (v) + printf("%d/%d: link %s %s %d\n", procid, opno, f.path, l.path, + e); + free_pathname(&l); + free_pathname(&f); +} + +void mkdir_f(int opno, long r) +{ + int e; + pathname_t f; + fent_t *fep; + int id; + int parid; + int v; + int v1; + + if (!get_fname(FT_DIRm, r, NULL, NULL, &fep, &v)) + parid = -1; + else + parid = fep->id; + init_pathname(&f); + e = generate_fname(fep, FT_DIR, &f, &id, &v1); + v |= v1; + if (!e) { + if (v) { + fent_to_name(&f, &flist[FT_DIR], fep); + printf("%d/%d: mkdir - no filename from %s\n", + procid, opno, f.path); + } + free_pathname(&f); + return; + } + e = mkdir_path(&f, 0777) < 0 ? errno : 0; + check_cwd(); + if (e == 0) + add_to_flist(FT_DIR, id, parid); + if (v) + printf("%d/%d: mkdir %s %d\n", procid, opno, f.path, e); + free_pathname(&f); +} + +void mknod_f(int opno, long r) +{ + int e; + pathname_t f; + fent_t *fep; + int id; + int parid; + int v; + int v1; + + if (!get_fname(FT_DIRm, r, NULL, NULL, &fep, &v)) + parid = -1; + else + parid = fep->id; + init_pathname(&f); + e = generate_fname(fep, FT_DEV, &f, &id, &v1); + v |= v1; + if (!e) { + if (v) { + fent_to_name(&f, &flist[FT_DIR], fep); + printf("%d/%d: mknod - no filename from %s\n", + procid, opno, f.path); + } + free_pathname(&f); + return; + } + e = mknod_path(&f, S_IFCHR | 0444, 0) < 0 ? errno : 0; + check_cwd(); + if (e == 0) + add_to_flist(FT_DEV, id, parid); + if (v) + printf("%d/%d: mknod %s %d\n", procid, opno, f.path, e); + free_pathname(&f); +} + +void read_f(int opno, long r) +{ + char *buf; + int e; + pathname_t f; + int fd; + size_t len; + int64_t lr; + off64_t off; + struct stat64 stb; + int v; + + init_pathname(&f); + if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) { + if (v) + printf("%d/%d: read - no filename\n", procid, opno); + free_pathname(&f); + return; + } + fd = open_path(&f, O_RDONLY); + e = fd < 0 ? errno : 0; + check_cwd(); + if (fd < 0) { + if (v) + printf("%d/%d: read - open %s failed %d\n", + procid, opno, f.path, e); + free_pathname(&f); + return; + } + if (fstat64(fd, &stb) < 0) { + if (v) + printf("%d/%d: read - fstat64 %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); + return; + } + if (stb.st_size == 0) { + if (v) + printf("%d/%d: read - %s zero size\n", procid, opno, + f.path); + free_pathname(&f); + close(fd); + return; + } + lr = ((int64_t) random() << 32) + random(); + off = (off64_t) (lr % stb.st_size); + lseek64(fd, off, SEEK_SET); + len = (random() % (getpagesize() * 32)) + 1; + buf = malloc(len); + e = read(fd, buf, len) < 0 ? errno : 0; + free(buf); + if (v) + printf("%d/%d: read %s [%lld,%ld] %d\n", + procid, opno, f.path, (long long)off, (long int)len, e); + free_pathname(&f); + close(fd); +} + +void readlink_f(int opno, long r) +{ + char buf[PATH_MAX]; + int e; + pathname_t f; + int v; + + init_pathname(&f); + if (!get_fname(FT_SYMm, r, &f, NULL, NULL, &v)) { + if (v) + printf("%d/%d: readlink - no filename\n", procid, opno); + free_pathname(&f); + return; + } + e = readlink_path(&f, buf, PATH_MAX) < 0 ? errno : 0; + check_cwd(); + if (v) + printf("%d/%d: readlink %s %d\n", procid, opno, f.path, e); + free_pathname(&f); +} + +void rename_f(int opno, long r) +{ + fent_t *dfep; + int e; + pathname_t f; + fent_t *fep; + flist_t *flp; + int id; + pathname_t newf; + int oldid; + int parid; + int v; + int v1; + + init_pathname(&f); + if (!get_fname(FT_ANYm, r, &f, &flp, &fep, &v1)) { + if (v1) + printf("%d/%d: rename - no filename\n", procid, opno); + free_pathname(&f); + return; + } + if (!get_fname(FT_DIRm, random(), NULL, NULL, &dfep, &v)) + parid = -1; + else + parid = dfep->id; + v |= v1; + init_pathname(&newf); + e = generate_fname(dfep, flp - flist, &newf, &id, &v1); + v |= v1; + if (!e) { + if (v) { + fent_to_name(&f, &flist[FT_DIR], dfep); + printf("%d/%d: rename - no filename from %s\n", + procid, opno, f.path); + } + free_pathname(&newf); + free_pathname(&f); + return; + } + e = rename_path(&f, &newf) < 0 ? errno : 0; + check_cwd(); + if (e == 0) { + if (flp - flist == FT_DIR) { + oldid = fep->id; + fix_parent(oldid, id); + } + del_from_flist(flp - flist, fep - flp->fents); + add_to_flist(flp - flist, id, parid); + } + if (v) + printf("%d/%d: rename %s to %s %d\n", procid, opno, f.path, + newf.path, e); + free_pathname(&newf); + free_pathname(&f); +} + +#ifndef NO_XFS +void resvsp_f(int opno, long r) +{ + int e; + pathname_t f; + int fd; + struct xfs_flock64 fl; + __s64 lr; + __s64 off; + struct stat64 stb; + int v; + + init_pathname(&f); + if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) { + if (v) + printf("%d/%d: resvsp - no filename\n", procid, opno); + free_pathname(&f); + return; + } + fd = open_path(&f, O_RDWR); + e = fd < 0 ? errno : 0; + check_cwd(); + if (fd < 0) { + if (v) + printf("%d/%d: resvsp - open %s failed %d\n", + procid, opno, f.path, e); + free_pathname(&f); + return; + } + if (fstat64(fd, &stb) < 0) { + if (v) + printf("%d/%d: resvsp - fstat64 %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); + return; + } + lr = ((__s64) random() << 32) + random(); + off = lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE); + off %= maxfsize; + memset(&fl, 0, sizeof(fl)); + fl.l_whence = SEEK_SET; + fl.l_start = off; + fl.l_len = (__s64) (random() % (1024 * 1024)); + e = ioctl(fd, XFS_IOC_RESVSP64, &fl) < 0 ? errno : 0; + if (v) + printf("%d/%d: ioctl(XFS_IOC_RESVSP64) %s %lld %lld %d\n", + procid, opno, f.path, (long long)off, + (long long)fl.l_len, e); + free_pathname(&f); + close(fd); +} +#endif + +void rmdir_f(int opno, long r) +{ + int e; + pathname_t f; + fent_t *fep; + int v; + + init_pathname(&f); + if (!get_fname(FT_DIRm, r, &f, NULL, &fep, &v)) { + if (v) + printf("%d/%d: rmdir - no directory\n", procid, opno); + free_pathname(&f); + return; + } + e = rmdir_path(&f) < 0 ? errno : 0; + check_cwd(); + if (e == 0) + del_from_flist(FT_DIR, fep - flist[FT_DIR].fents); + if (v) + printf("%d/%d: rmdir %s %d\n", procid, opno, f.path, e); + free_pathname(&f); +} + +void stat_f(int opno, long r) +{ + int e; + pathname_t f; + struct stat64 stb; + int v; + + init_pathname(&f); + if (!get_fname(FT_ANYm, r, &f, NULL, NULL, &v)) { + if (v) + printf("%d/%d: stat - no entries\n", procid, opno); + free_pathname(&f); + return; + } + e = lstat64_path(&f, &stb) < 0 ? errno : 0; + check_cwd(); + if (v) + printf("%d/%d: stat %s %d\n", procid, opno, f.path, e); + free_pathname(&f); +} + +void symlink_f(int opno, long r) +{ + int e; + pathname_t f; + fent_t *fep; + int i; + int id; + int len; + int parid; + int v; + int v1; + char *val; + + if (!get_fname(FT_DIRm, r, NULL, NULL, &fep, &v)) + parid = -1; + else + parid = fep->id; + init_pathname(&f); + e = generate_fname(fep, FT_SYM, &f, &id, &v1); + v |= v1; + if (!e) { + if (v) { + fent_to_name(&f, &flist[FT_DIR], fep); + printf("%d/%d: symlink - no filename from %s\n", + procid, opno, f.path); + } + free_pathname(&f); + return; + } + len = (int)(random() % PATH_MAX); + val = malloc(len + 1); + if (len) + memset(val, 'x', len); + val[len] = '\0'; + for (i = 10; i < len - 1; i += 10) + val[i] = '/'; + e = symlink_path(val, &f) < 0 ? errno : 0; + check_cwd(); + if (e == 0) + add_to_flist(FT_SYM, id, parid); + free(val); + if (v) + printf("%d/%d: symlink %s %d\n", procid, opno, f.path, e); + free_pathname(&f); +} + +/* ARGSUSED */ +void sync_f(int opno, long r) +{ + sync(); + if (verbose) + printf("%d/%d: sync\n", procid, opno); +} + +void truncate_f(int opno, long r) +{ + int e; + pathname_t f; + int64_t lr; + off64_t off; + struct stat64 stb; + int v; + + init_pathname(&f); + if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) { + if (v) + printf("%d/%d: truncate - no filename\n", procid, opno); + free_pathname(&f); + return; + } + e = stat64_path(&f, &stb) < 0 ? errno : 0; + check_cwd(); + if (e > 0) { + if (v) + printf("%d/%d: truncate - stat64 %s failed %d\n", + procid, opno, f.path, e); + free_pathname(&f); + return; + } + lr = ((int64_t) random() << 32) + random(); + off = lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE); + off %= maxfsize; + e = truncate64_path(&f, off) < 0 ? errno : 0; + check_cwd(); + if (v) + printf("%d/%d: truncate %s %lld %d\n", procid, opno, f.path, + (long long)off, e); + free_pathname(&f); +} + +void unlink_f(int opno, long r) +{ + int e; + pathname_t f; + fent_t *fep; + flist_t *flp; + int v; + + init_pathname(&f); + if (!get_fname(FT_NOTDIR, r, &f, &flp, &fep, &v)) { + if (v) + printf("%d/%d: unlink - no file\n", procid, opno); + free_pathname(&f); + return; + } + e = unlink_path(&f) < 0 ? errno : 0; + check_cwd(); + if (e == 0) + del_from_flist(flp - flist, fep - flp->fents); + if (v) + printf("%d/%d: unlink %s %d\n", procid, opno, f.path, e); + free_pathname(&f); +} + +#ifndef NO_XFS +void unresvsp_f(int opno, long r) +{ + int e; + pathname_t f; + int fd; + struct xfs_flock64 fl; + __s64 lr; + __s64 off; + struct stat64 stb; + int v; + + init_pathname(&f); + if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) { + if (v) + printf("%d/%d: unresvsp - no filename\n", procid, opno); + free_pathname(&f); + return; + } + fd = open_path(&f, O_RDWR); + e = fd < 0 ? errno : 0; + check_cwd(); + if (fd < 0) { + if (v) + printf("%d/%d: unresvsp - open %s failed %d\n", + procid, opno, f.path, e); + free_pathname(&f); + return; + } + if (fstat64(fd, &stb) < 0) { + if (v) + printf("%d/%d: unresvsp - fstat64 %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); + return; + } + lr = ((__s64) random() << 32) + random(); + off = lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE); + off %= maxfsize; + memset(&fl, 0, sizeof(fl)); + fl.l_whence = SEEK_SET; + fl.l_start = off; + fl.l_len = (__s64) (random() % (1 << 20)); + e = ioctl(fd, XFS_IOC_UNRESVSP64, &fl) < 0 ? errno : 0; + if (v) + printf("%d/%d: ioctl(XFS_IOC_UNRESVSP64) %s %lld %lld %d\n", + procid, opno, f.path, (long long)off, + (long long)fl.l_len, e); + free_pathname(&f); + close(fd); +} +#endif + +void write_f(int opno, long r) +{ + char *buf; + int e; + pathname_t f; + int fd; + size_t len; + int64_t lr; + off64_t off; + struct stat64 stb; + int v; + + init_pathname(&f); + if (!get_fname(FT_REGm, r, &f, NULL, NULL, &v)) { + if (v) + printf("%d/%d: write - no filename\n", procid, opno); + free_pathname(&f); + return; + } + fd = open_path(&f, O_WRONLY); + e = fd < 0 ? errno : 0; + check_cwd(); + if (fd < 0) { + if (v) + printf("%d/%d: write - open %s failed %d\n", + procid, opno, f.path, e); + free_pathname(&f); + return; + } + if (fstat64(fd, &stb) < 0) { + if (v) + printf("%d/%d: write - fstat64 %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); + return; + } + lr = ((int64_t) random() << 32) + random(); + off = (off64_t) (lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE)); + off %= maxfsize; + lseek64(fd, off, SEEK_SET); + len = (random() % (getpagesize() * 32)) + 1; + buf = malloc(len); + memset(buf, nameseq & 0xff, len); + e = write(fd, buf, len) < 0 ? errno : 0; + free(buf); + if (v) + printf("%d/%d: write %s [%lld,%ld] %d\n", + procid, opno, f.path, (long long)off, (long int)len, e); + free_pathname(&f); + close(fd); +} diff --git a/fsstress/global.h b/fsstress/global.h new file mode 100644 index 0000000000..4ec382426a --- /dev/null +++ b/fsstress/global.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ + */ + +#ifndef GLOBAL_H +#define GLOBAL_H + +/* xfs-specific includes */ + +#if defined(NO_XFS) +# include "xfscompat.h" +#else +# include +# include +#endif + +/* libc includes */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef O_DIRECT +#define O_DIRECT 040000 +#endif + +#endif diff --git a/fsstress/include/Makefile b/fsstress/include/Makefile new file mode 100644 index 0000000000..7588e66003 --- /dev/null +++ b/fsstress/include/Makefile @@ -0,0 +1,45 @@ +# +# include Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# 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. +# +# Ngie Cooper, July 2009 +# + +top_srcdir ?= .. + +include $(top_srcdir)/include/mk/env_pre.mk + +INSTALL_DIR := $(includedir) + +INSTALL_MODE := 00644 + +INSTALL_TARGETS := *.h + +MAKE_TARGETS := + +.PHONY: ac-clean ac-distclean ac-maintainer-clean distclean maintainer-clean +distclean:: clean ac-distclean +maintainer-clean:: distclean ac-maintainer-clean +ac-clean ac-distclean:: + $(RM) -f config.h +ac-maintainer-clean:: + $(RM) -f config.h.in + +vpath %.h $(abs_srcdir) + +include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/fsstress/include/config.h b/fsstress/include/config.h new file mode 100644 index 0000000000..1a0b90cc60 --- /dev/null +++ b/fsstress/include/config.h @@ -0,0 +1,588 @@ +/* include/config.h. Generated from config.h.in by configure. */ +/* include/config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if clone() supports 7 arguments. */ +#define CLONE_SUPPORTS_7_ARGS 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ASM_LDT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ASM_PTRACE_H 1 + +/* Define to 1 if you have the __atomic_* compiler builtins */ +#define HAVE_ATOMIC_MEMORY_MODEL 1 + +/* Define to 1 if you have __builtin___clear_cache */ +#define HAVE_BUILTIN_CLEAR_CACHE 1 + +/* Define to 1 if you have the `clnttcp_create' function. */ +#define HAVE_CLNTTCP_CREATE 1 + +/* Define to 1 if you have the `clone3' function. */ +/* #undef HAVE_CLONE3 */ + +/* Define to 1 if you have the `copy_file_range' function. */ +#define HAVE_COPY_FILE_RANGE 1 + +/* Define to 1 if you have the `daemon' function. */ +#define HAVE_DAEMON 1 + +/* Define to 1 if you have the declaration of `IFLA_NET_NS_PID', and to 0 if + you don't. */ +#define HAVE_DECL_IFLA_NET_NS_PID 1 + +/* Define to 1 if you have the declaration of `MADV_MERGEABLE', and to 0 if + you don't. */ +#define HAVE_DECL_MADV_MERGEABLE 1 + +/* Define to 1 if you have the declaration of `PR_CAPBSET_DROP', and to 0 if + you don't. */ +#define HAVE_DECL_PR_CAPBSET_DROP 1 + +/* Define to 1 if you have the declaration of `PR_CAPBSET_READ', and to 0 if + you don't. */ +#define HAVE_DECL_PR_CAPBSET_READ 1 + +/* Define to 1 if you have the declaration of `PTRACE_GETSIGINFO', and to 0 if + you don't. */ +#define HAVE_DECL_PTRACE_GETSIGINFO 1 + +/* Define to 1 if you have the declaration of `PTRACE_O_TRACEVFORKDONE', and + to 0 if you don't. */ +#define HAVE_DECL_PTRACE_O_TRACEVFORKDONE 1 + +/* Define to 1 if you have the declaration of `PTRACE_SETOPTIONS', and to 0 if + you don't. */ +#define HAVE_DECL_PTRACE_SETOPTIONS 1 + +/* Define to 1 if the system has the type `enum kcmp_type'. */ +#define HAVE_ENUM_KCMP_TYPE 1 + +/* Define to 1 if you have the `epoll_pwait' function. */ +#define HAVE_EPOLL_PWAIT 1 + +/* Define to 1 if you have the `execveat' function. */ +/* #undef HAVE_EXECVEAT */ + +/* Define to 1 if you have the `fallocate' function. */ +#define HAVE_FALLOCATE 1 + +/* Define to 1 if you have the `fchownat' function. */ +#define HAVE_FCHOWNAT 1 + +/* Define to 1 if you have the `fork' function. */ +#define HAVE_FORK 1 + +/* Define to 1 if you have the `fsconfig' function. */ +/* #undef HAVE_FSCONFIG */ + +/* Define to 1 if you have the `fsmount' function. */ +/* #undef HAVE_FSMOUNT */ + +/* Define to 1 if you have the `fsopen' function. */ +/* #undef HAVE_FSOPEN */ + +/* Define to 1 if you have the `fspick' function. */ +/* #undef HAVE_FSPICK */ + +/* Define to 1 if you have the `fstatat' function. */ +#define HAVE_FSTATAT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FTS_H 1 + +/* Define to 1 if you have the `getauxval' function. */ +#define HAVE_GETAUXVAL 1 + +/* Define to 1 if you have the `getdents' function. */ +/* #undef HAVE_GETDENTS */ + +/* Define to 1 if you have the `getdents64' function. */ +/* #undef HAVE_GETDENTS64 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_IFADDRS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `io_pgetevents' function. */ +/* #undef HAVE_IO_PGETEVENTS */ + +/* Define to 1 if you have `io_set_eventfd' function. */ +/* #undef HAVE_IO_SET_EVENTFD */ + +/* Define to 1 if you have the `io_uring_enter' function. */ +/* #undef HAVE_IO_URING_ENTER */ + +/* Define to 1 if you have the `io_uring_register' function. */ +/* #undef HAVE_IO_URING_REGISTER */ + +/* Define to 1 if you have the `io_uring_setup' function. */ +/* #undef HAVE_IO_URING_SETUP */ + +/* Define to 1 if you have the `kcmp' function. */ +/* #undef HAVE_KCMP */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_KEYUTILS_H */ + +/* Define to 1 if you have libacl and it's headers installed */ +/* #undef HAVE_LIBACL */ + +/* Define to 1 if you have libaio and it's headers installed. */ +/* #undef HAVE_LIBAIO */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBAIO_H */ + +/* Define to 1 if you have libcap-2 installed. */ +/* #undef HAVE_LIBCAP */ + +/* Define whether libcrypto and openssl headers are installed */ +#define HAVE_LIBCRYPTO 1 + +/* Define to 1 if you have libkeyutils installed. */ +/* #undef HAVE_LIBKEYUTILS */ + +/* Define to 1 if you have libmnl library and headers */ +/* #undef HAVE_LIBMNL */ + +/* Define to 1 if you have both SELinux libraries and headers. */ +/* #undef HAVE_LIBSELINUX_DEVEL */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_CAN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_CGROUPSTATS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_CRYPTOUSER_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_DCCP_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_FS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_GENETLINK_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_IF_ALG_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_IF_ETHER_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_IF_PACKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_KEYCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_MEMPOLICY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_MODULE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_NETLINK_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_PTRACE_H 1 + +/* Define to 1 if having a valid linux/random.h */ +#define HAVE_LINUX_RANDOM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_SECCOMP_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_SECUREBITS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_SIGNALFD_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_TASKSTATS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_TTY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_USERFAULTFD_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mkdirat' function. */ +#define HAVE_MKDIRAT 1 + +/* Define to 1 if you have the `mkdtemp' function. */ +#define HAVE_MKDTEMP 1 + +/* Define to 1 if you have the `mknodat' function. */ +#define HAVE_MKNODAT 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MM_H */ + +/* Define to 1 if you have the `modify_ldt' function. */ +#define HAVE_MODIFY_LDT 1 + +/* Define to 1 if you have the `move_mount' function. */ +/* #undef HAVE_MOVE_MOUNT */ + +/* Define to 1 if you have MREMAP_FIXED in . */ +#define HAVE_MREMAP_FIXED 1 + +/* Define to 1 if you have the `name_to_handle_at' function. */ +#define HAVE_NAME_TO_HANDLE_AT 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETINET_SCTP_H */ + +/* Define to 1 if you have newer libcap-2 installed. */ +/* #undef HAVE_NEWER_LIBCAP */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NUMAIF_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NUMA_H */ + +/* Define to 1 if you have libnuma and it's headers version >= 2 installed. */ +/* #undef HAVE_NUMA_V2 */ + +/* Define to 1 if you have the `openat' function. */ +#define HAVE_OPENAT 1 + +/* Define to 1 if you have the `openat2' function. */ +/* #undef HAVE_OPENAT2 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_SHA_H 1 + +/* Define to 1 if you have the `open_tree' function. */ +/* #undef HAVE_OPEN_TREE */ + +/* Define to 1 if you have struct perf_event_attr */ +#define HAVE_PERF_EVENT_ATTR 1 + +/* Define to 1 if you have the `pidfd_open' function. */ +/* #undef HAVE_PIDFD_OPEN */ + +/* Define to 1 if you have the `pidfd_send_signal' function. */ +/* #undef HAVE_PIDFD_SEND_SIGNAL */ + +/* Define to 1 if you have the `pkey_mprotect' function. */ +#define HAVE_PKEY_MPROTECT 1 + +/* Define to 1 if you have the `preadv' function. */ +#define HAVE_PREADV 1 + +/* Define to 1 if you have the `preadv2' function. */ +#define HAVE_PREADV2 1 + +/* Define to 1 if you have the `profil' function. */ +#define HAVE_PROFIL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_PTHREAD_H 1 + +/* Define to 1 if you have the `pwritev' function. */ +#define HAVE_PWRITEV 1 + +/* Define to 1 if you have the `pwritev2' function. */ +#define HAVE_PWRITEV2 1 + +/* Define to 1 if you have the `readlinkat' function. */ +#define HAVE_READLINKAT 1 + +/* Define to 1 if you have the `recvmmsg' function. */ +#define HAVE_RECVMMSG 1 + +/* Define to 1 if you have the `renameat' function. */ +#define HAVE_RENAMEAT 1 + +/* Define to 1 if you have the `renameat2' function. */ +/* #undef HAVE_RENAMEAT2 */ + +/* Define to 1 if you have the `sched_getcpu' function. */ +#define HAVE_SCHED_GETCPU 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SELINUX_SELINUX_H */ + +/* Define to 1 if you have the `sendmmsg' function. */ +#define HAVE_SENDMMSG 1 + +/* Define to 1 if you have the `setns' function. */ +#define HAVE_SETNS 1 + +/* Define to 1 if you have the `signalfd' function. */ +#define HAVE_SIGNALFD 1 + +/* Define to 1 if you have the `sigpending' function. */ +#define HAVE_SIGPENDING 1 + +/* Define to 1 if you have the `splice' function. */ +#define HAVE_SPLICE 1 + +/* Define to 1 if you have the `statx' function. */ +/* #undef HAVE_STATX */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `stime' function. */ +#define HAVE_STIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if the system has the type `struct acct_v3'. */ +#define HAVE_STRUCT_ACCT_V3 1 + +/* Define to 1 if the system has the type `struct fanotify_event_info_fid'. */ +/* #undef HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID */ + +/* Define to 1 if `fsid.__val' is a member of `struct + fanotify_event_info_fid'. */ +/* #undef HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID_FSID___VAL */ + +/* Define to 1 if the system has the type `struct fanotify_event_info_header'. + */ +/* #undef HAVE_STRUCT_FANOTIFY_EVENT_INFO_HEADER */ + +/* Define to 1 if the system has the type `struct file_dedupe_range'. */ +#define HAVE_STRUCT_FILE_DEDUPE_RANGE 1 + +/* Define to 1 if the system has the type `struct fs_quota_statv'. */ +/* #undef HAVE_STRUCT_FS_QUOTA_STATV */ + +/* Define to 1 if you have struct f_owner_ex */ +#define HAVE_STRUCT_F_OWNER_EX 1 + +/* Define to 1 if the system has the type `struct if_nextdqblk'. */ +#define HAVE_STRUCT_IF_NEXTDQBLK 1 + +/* Define to 1 if the system has the type `struct iovec'. */ +#define HAVE_STRUCT_IOVEC 1 + +/* Define to 1 if the system has the type `struct ipc64_perm'. */ +/* #undef HAVE_STRUCT_IPC64_PERM */ + +/* Define to 1 if the system has the type `struct loop_config'. */ +/* #undef HAVE_STRUCT_LOOP_CONFIG */ + +/* Define to 1 if the system has the type `struct mmsghdr'. */ +#define HAVE_STRUCT_MMSGHDR 1 + +/* Define to 1 if the system has the type `struct modify_ldt_ldt_s'. */ +/* #undef HAVE_STRUCT_MODIFY_LDT_LDT_S */ + +/* Define to 1 if the system has the type `struct msqid64_ds'. */ +/* #undef HAVE_STRUCT_MSQID64_DS */ + +/* Define to 1 if `aux_head' is a member of `struct perf_event_mmap_page'. */ +#define HAVE_STRUCT_PERF_EVENT_MMAP_PAGE_AUX_HEAD 1 + +/* Define to 1 if the system has the type `struct ptrace_peeksiginfo_args'. */ +/* #undef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS */ + +/* Define to 1 if the system has the type `struct pt_regs'. */ +#define HAVE_STRUCT_PT_REGS 1 + +/* Define to 1 if the system has the type `struct rlimit64'. */ +#define HAVE_STRUCT_RLIMIT64 1 + +/* Define to 1 if the system has the type `struct semid64_ds'. */ +/* #undef HAVE_STRUCT_SEMID64_DS */ + +/* Define to 1 if the system has the type `struct shmid64_ds'. */ +/* #undef HAVE_STRUCT_SHMID64_DS */ + +/* Define to 1 if `sa_sigaction' is a member of `struct sigaction'. */ +#define HAVE_STRUCT_SIGACTION_SA_SIGACTION 1 + +/* Define to 1 if `ssi_signo' is a member of `struct signalfd_siginfo'. */ +#define HAVE_STRUCT_SIGNALFD_SIGINFO_SSI_SIGNO 1 + +/* Define to 1 if the system has the type `struct statx'. */ +/* #undef HAVE_STRUCT_STATX */ + +/* Define to 1 if the system has the type `struct statx_timestamp'. */ +/* #undef HAVE_STRUCT_STATX_TIMESTAMP */ + +/* Define to 1 if `freepages_count' is a member of `struct taskstats'. */ +#define HAVE_STRUCT_TASKSTATS_FREEPAGES_COUNT 1 + +/* Define to 1 if `nvcsw' is a member of `struct taskstats'. */ +#define HAVE_STRUCT_TASKSTATS_NVCSW 1 + +/* Define to 1 if `read_bytes' is a member of `struct taskstats'. */ +#define HAVE_STRUCT_TASKSTATS_READ_BYTES 1 + +/* Define to 1 if the system has the type `struct termio'. */ +#define HAVE_STRUCT_TERMIO 1 + +/* Define to 1 if the system has the type `struct tpacket_req3'. */ +#define HAVE_STRUCT_TPACKET_REQ3 1 + +/* Define to 1 if the system has the type `struct user_desc'. */ +#define HAVE_STRUCT_USER_DESC 1 + +/* Define to 1 if the system has the type `struct user_regs_struct'. */ +/* #undef HAVE_STRUCT_USER_REGS_STRUCT */ + +/* Define to 1 if `domainname' is a member of `struct utsname'. */ +#define HAVE_STRUCT_UTSNAME_DOMAINNAME 1 + +/* Define to 1 if the system has the type `struct xt_entry_match'. */ +#define HAVE_STRUCT_XT_ENTRY_MATCH 1 + +/* Define to 1 if the system has the type `struct xt_entry_target'. */ +#define HAVE_STRUCT_XT_ENTRY_TARGET 1 + +/* Define to 1 if you have the `syncfs' function. */ +#define HAVE_SYNCFS 1 + +/* Define to 1 if you have __sync_add_and_fetch */ +#define HAVE_SYNC_ADD_AND_FETCH 1 + +/* Define to 1 if you have the `sync_file_range' function. */ +#define HAVE_SYNC_FILE_RANGE 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_ACL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_CAPABILITY_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_EPOLL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_FANOTIFY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_INOTIFY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PRCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PTRACE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_REG_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SHM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SIGNALFD_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIMERFD_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_USTAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UTSNAME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_XATTR_H 1 + +/* Define to 1 if you have the `tee' function. */ +#define HAVE_TEE 1 + +/* Define to 1 if you have the `timerfd_create' function. */ +#define HAVE_TIMERFD_CREATE 1 + +/* Define to 1 if you have the `timerfd_gettime' function. */ +#define HAVE_TIMERFD_GETTIME 1 + +/* Define to 1 if you have the `timerfd_settime' function. */ +#define HAVE_TIMERFD_SETTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `unshare' function. */ +#define HAVE_UNSHARE 1 + +/* Define to 1 if you have the `ustat' function. */ +#define HAVE_USTAT 1 + +/* Define to 1 if you have utimensat(2) */ +#define HAVE_UTIMENSAT 1 + +/* Define to 1 if you have the `vfork' function. */ +#define HAVE_VFORK 1 + +/* Define to 1 if you have the `vmsplice' function. */ +#define HAVE_VMSPLICE 1 + +/* Define to 1 if you have the `xdr_char' function. */ +#define HAVE_XDR_CHAR 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_XFS_XQM_H */ + +/* Error message when no NUMA support */ +#define NUMA_ERROR_MSG "test requires libnuma >= 2 and it's development packages" + +/* Name of package */ +#define PACKAGE "ltp" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "ltp@lists.linux.it" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "ltp" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "ltp LTP_VERSION" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "ltp" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "LTP_VERSION" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Target is running Linux w/out an MMU */ +/* #undef UCLINUX */ + +/* Version number of package */ +#define VERSION "LTP_VERSION" + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#define YYTEXT_POINTER 1 diff --git a/fsstress/include/config.h.in b/fsstress/include/config.h.in new file mode 100644 index 0000000000..3e023d6638 --- /dev/null +++ b/fsstress/include/config.h.in @@ -0,0 +1,587 @@ +/* include/config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if clone() supports 7 arguments. */ +#undef CLONE_SUPPORTS_7_ARGS + +/* Define to 1 if you have the header file. */ +#undef HAVE_ASM_LDT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ASM_PTRACE_H + +/* Define to 1 if you have the __atomic_* compiler builtins */ +#undef HAVE_ATOMIC_MEMORY_MODEL + +/* Define to 1 if you have __builtin___clear_cache */ +#undef HAVE_BUILTIN_CLEAR_CACHE + +/* Define to 1 if you have the `clnttcp_create' function. */ +#undef HAVE_CLNTTCP_CREATE + +/* Define to 1 if you have the `clone3' function. */ +#undef HAVE_CLONE3 + +/* Define to 1 if you have the `copy_file_range' function. */ +#undef HAVE_COPY_FILE_RANGE + +/* Define to 1 if you have the `daemon' function. */ +#undef HAVE_DAEMON + +/* Define to 1 if you have the declaration of `IFLA_NET_NS_PID', and to 0 if + you don't. */ +#undef HAVE_DECL_IFLA_NET_NS_PID + +/* Define to 1 if you have the declaration of `MADV_MERGEABLE', and to 0 if + you don't. */ +#undef HAVE_DECL_MADV_MERGEABLE + +/* Define to 1 if you have the declaration of `PR_CAPBSET_DROP', and to 0 if + you don't. */ +#undef HAVE_DECL_PR_CAPBSET_DROP + +/* Define to 1 if you have the declaration of `PR_CAPBSET_READ', and to 0 if + you don't. */ +#undef HAVE_DECL_PR_CAPBSET_READ + +/* Define to 1 if you have the declaration of `PTRACE_GETSIGINFO', and to 0 if + you don't. */ +#undef HAVE_DECL_PTRACE_GETSIGINFO + +/* Define to 1 if you have the declaration of `PTRACE_O_TRACEVFORKDONE', and + to 0 if you don't. */ +#undef HAVE_DECL_PTRACE_O_TRACEVFORKDONE + +/* Define to 1 if you have the declaration of `PTRACE_SETOPTIONS', and to 0 if + you don't. */ +#undef HAVE_DECL_PTRACE_SETOPTIONS + +/* Define to 1 if the system has the type `enum kcmp_type'. */ +#undef HAVE_ENUM_KCMP_TYPE + +/* Define to 1 if you have the `epoll_pwait' function. */ +#undef HAVE_EPOLL_PWAIT + +/* Define to 1 if you have the `execveat' function. */ +#undef HAVE_EXECVEAT + +/* Define to 1 if you have the `fallocate' function. */ +#undef HAVE_FALLOCATE + +/* Define to 1 if you have the `fchownat' function. */ +#undef HAVE_FCHOWNAT + +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + +/* Define to 1 if you have the `fsconfig' function. */ +#undef HAVE_FSCONFIG + +/* Define to 1 if you have the `fsmount' function. */ +#undef HAVE_FSMOUNT + +/* Define to 1 if you have the `fsopen' function. */ +#undef HAVE_FSOPEN + +/* Define to 1 if you have the `fspick' function. */ +#undef HAVE_FSPICK + +/* Define to 1 if you have the `fstatat' function. */ +#undef HAVE_FSTATAT + +/* Define to 1 if you have the header file. */ +#undef HAVE_FTS_H + +/* Define to 1 if you have the `getauxval' function. */ +#undef HAVE_GETAUXVAL + +/* Define to 1 if you have the `getdents' function. */ +#undef HAVE_GETDENTS + +/* Define to 1 if you have the `getdents64' function. */ +#undef HAVE_GETDENTS64 + +/* Define to 1 if you have the header file. */ +#undef HAVE_IFADDRS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `io_pgetevents' function. */ +#undef HAVE_IO_PGETEVENTS + +/* Define to 1 if you have `io_set_eventfd' function. */ +#undef HAVE_IO_SET_EVENTFD + +/* Define to 1 if you have the `io_uring_enter' function. */ +#undef HAVE_IO_URING_ENTER + +/* Define to 1 if you have the `io_uring_register' function. */ +#undef HAVE_IO_URING_REGISTER + +/* Define to 1 if you have the `io_uring_setup' function. */ +#undef HAVE_IO_URING_SETUP + +/* Define to 1 if you have the `kcmp' function. */ +#undef HAVE_KCMP + +/* Define to 1 if you have the header file. */ +#undef HAVE_KEYUTILS_H + +/* Define to 1 if you have libacl and it's headers installed */ +#undef HAVE_LIBACL + +/* Define to 1 if you have libaio and it's headers installed. */ +#undef HAVE_LIBAIO + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBAIO_H + +/* Define to 1 if you have libcap-2 installed. */ +#undef HAVE_LIBCAP + +/* Define whether libcrypto and openssl headers are installed */ +#undef HAVE_LIBCRYPTO + +/* Define to 1 if you have libkeyutils installed. */ +#undef HAVE_LIBKEYUTILS + +/* Define to 1 if you have libmnl library and headers */ +#undef HAVE_LIBMNL + +/* Define to 1 if you have both SELinux libraries and headers. */ +#undef HAVE_LIBSELINUX_DEVEL + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_CAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_CGROUPSTATS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_CRYPTOUSER_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_DCCP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_FS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_GENETLINK_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_IF_ALG_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_IF_ETHER_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_IF_PACKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_KEYCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_MEMPOLICY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_MODULE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_NETLINK_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_PTRACE_H + +/* Define to 1 if having a valid linux/random.h */ +#undef HAVE_LINUX_RANDOM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_SECCOMP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_SECUREBITS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_SIGNALFD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_TASKSTATS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_TTY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_USERFAULTFD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `mkdirat' function. */ +#undef HAVE_MKDIRAT + +/* Define to 1 if you have the `mkdtemp' function. */ +#undef HAVE_MKDTEMP + +/* Define to 1 if you have the `mknodat' function. */ +#undef HAVE_MKNODAT + +/* Define to 1 if you have the header file. */ +#undef HAVE_MM_H + +/* Define to 1 if you have the `modify_ldt' function. */ +#undef HAVE_MODIFY_LDT + +/* Define to 1 if you have the `move_mount' function. */ +#undef HAVE_MOVE_MOUNT + +/* Define to 1 if you have MREMAP_FIXED in . */ +#undef HAVE_MREMAP_FIXED + +/* Define to 1 if you have the `name_to_handle_at' function. */ +#undef HAVE_NAME_TO_HANDLE_AT + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_SCTP_H + +/* Define to 1 if you have newer libcap-2 installed. */ +#undef HAVE_NEWER_LIBCAP + +/* Define to 1 if you have the header file. */ +#undef HAVE_NUMAIF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NUMA_H + +/* Define to 1 if you have libnuma and it's headers version >= 2 installed. */ +#undef HAVE_NUMA_V2 + +/* Define to 1 if you have the `openat' function. */ +#undef HAVE_OPENAT + +/* Define to 1 if you have the `openat2' function. */ +#undef HAVE_OPENAT2 + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_SHA_H + +/* Define to 1 if you have the `open_tree' function. */ +#undef HAVE_OPEN_TREE + +/* Define to 1 if you have struct perf_event_attr */ +#undef HAVE_PERF_EVENT_ATTR + +/* Define to 1 if you have the `pidfd_open' function. */ +#undef HAVE_PIDFD_OPEN + +/* Define to 1 if you have the `pidfd_send_signal' function. */ +#undef HAVE_PIDFD_SEND_SIGNAL + +/* Define to 1 if you have the `pkey_mprotect' function. */ +#undef HAVE_PKEY_MPROTECT + +/* Define to 1 if you have the `preadv' function. */ +#undef HAVE_PREADV + +/* Define to 1 if you have the `preadv2' function. */ +#undef HAVE_PREADV2 + +/* Define to 1 if you have the `profil' function. */ +#undef HAVE_PROFIL + +/* Define to 1 if you have the header file. */ +#undef HAVE_PTHREAD_H + +/* Define to 1 if you have the `pwritev' function. */ +#undef HAVE_PWRITEV + +/* Define to 1 if you have the `pwritev2' function. */ +#undef HAVE_PWRITEV2 + +/* Define to 1 if you have the `readlinkat' function. */ +#undef HAVE_READLINKAT + +/* Define to 1 if you have the `recvmmsg' function. */ +#undef HAVE_RECVMMSG + +/* Define to 1 if you have the `renameat' function. */ +#undef HAVE_RENAMEAT + +/* Define to 1 if you have the `renameat2' function. */ +#undef HAVE_RENAMEAT2 + +/* Define to 1 if you have the `sched_getcpu' function. */ +#undef HAVE_SCHED_GETCPU + +/* Define to 1 if you have the header file. */ +#undef HAVE_SELINUX_SELINUX_H + +/* Define to 1 if you have the `sendmmsg' function. */ +#undef HAVE_SENDMMSG + +/* Define to 1 if you have the `setns' function. */ +#undef HAVE_SETNS + +/* Define to 1 if you have the `signalfd' function. */ +#undef HAVE_SIGNALFD + +/* Define to 1 if you have the `sigpending' function. */ +#undef HAVE_SIGPENDING + +/* Define to 1 if you have the `splice' function. */ +#undef HAVE_SPLICE + +/* Define to 1 if you have the `statx' function. */ +#undef HAVE_STATX + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `stime' function. */ +#undef HAVE_STIME + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if the system has the type `struct acct_v3'. */ +#undef HAVE_STRUCT_ACCT_V3 + +/* Define to 1 if the system has the type `struct fanotify_event_info_fid'. */ +#undef HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID + +/* Define to 1 if `fsid.__val' is a member of `struct + fanotify_event_info_fid'. */ +#undef HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID_FSID___VAL + +/* Define to 1 if the system has the type `struct fanotify_event_info_header'. + */ +#undef HAVE_STRUCT_FANOTIFY_EVENT_INFO_HEADER + +/* Define to 1 if the system has the type `struct file_dedupe_range'. */ +#undef HAVE_STRUCT_FILE_DEDUPE_RANGE + +/* Define to 1 if the system has the type `struct fs_quota_statv'. */ +#undef HAVE_STRUCT_FS_QUOTA_STATV + +/* Define to 1 if you have struct f_owner_ex */ +#undef HAVE_STRUCT_F_OWNER_EX + +/* Define to 1 if the system has the type `struct if_nextdqblk'. */ +#undef HAVE_STRUCT_IF_NEXTDQBLK + +/* Define to 1 if the system has the type `struct iovec'. */ +#undef HAVE_STRUCT_IOVEC + +/* Define to 1 if the system has the type `struct ipc64_perm'. */ +#undef HAVE_STRUCT_IPC64_PERM + +/* Define to 1 if the system has the type `struct loop_config'. */ +#undef HAVE_STRUCT_LOOP_CONFIG + +/* Define to 1 if the system has the type `struct mmsghdr'. */ +#undef HAVE_STRUCT_MMSGHDR + +/* Define to 1 if the system has the type `struct modify_ldt_ldt_s'. */ +#undef HAVE_STRUCT_MODIFY_LDT_LDT_S + +/* Define to 1 if the system has the type `struct msqid64_ds'. */ +#undef HAVE_STRUCT_MSQID64_DS + +/* Define to 1 if `aux_head' is a member of `struct perf_event_mmap_page'. */ +#undef HAVE_STRUCT_PERF_EVENT_MMAP_PAGE_AUX_HEAD + +/* Define to 1 if the system has the type `struct ptrace_peeksiginfo_args'. */ +#undef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS + +/* Define to 1 if the system has the type `struct pt_regs'. */ +#undef HAVE_STRUCT_PT_REGS + +/* Define to 1 if the system has the type `struct rlimit64'. */ +#undef HAVE_STRUCT_RLIMIT64 + +/* Define to 1 if the system has the type `struct semid64_ds'. */ +#undef HAVE_STRUCT_SEMID64_DS + +/* Define to 1 if the system has the type `struct shmid64_ds'. */ +#undef HAVE_STRUCT_SHMID64_DS + +/* Define to 1 if `sa_sigaction' is a member of `struct sigaction'. */ +#undef HAVE_STRUCT_SIGACTION_SA_SIGACTION + +/* Define to 1 if `ssi_signo' is a member of `struct signalfd_siginfo'. */ +#undef HAVE_STRUCT_SIGNALFD_SIGINFO_SSI_SIGNO + +/* Define to 1 if the system has the type `struct statx'. */ +#undef HAVE_STRUCT_STATX + +/* Define to 1 if the system has the type `struct statx_timestamp'. */ +#undef HAVE_STRUCT_STATX_TIMESTAMP + +/* Define to 1 if `freepages_count' is a member of `struct taskstats'. */ +#undef HAVE_STRUCT_TASKSTATS_FREEPAGES_COUNT + +/* Define to 1 if `nvcsw' is a member of `struct taskstats'. */ +#undef HAVE_STRUCT_TASKSTATS_NVCSW + +/* Define to 1 if `read_bytes' is a member of `struct taskstats'. */ +#undef HAVE_STRUCT_TASKSTATS_READ_BYTES + +/* Define to 1 if the system has the type `struct termio'. */ +#undef HAVE_STRUCT_TERMIO + +/* Define to 1 if the system has the type `struct tpacket_req3'. */ +#undef HAVE_STRUCT_TPACKET_REQ3 + +/* Define to 1 if the system has the type `struct user_desc'. */ +#undef HAVE_STRUCT_USER_DESC + +/* Define to 1 if the system has the type `struct user_regs_struct'. */ +#undef HAVE_STRUCT_USER_REGS_STRUCT + +/* Define to 1 if `domainname' is a member of `struct utsname'. */ +#undef HAVE_STRUCT_UTSNAME_DOMAINNAME + +/* Define to 1 if the system has the type `struct xt_entry_match'. */ +#undef HAVE_STRUCT_XT_ENTRY_MATCH + +/* Define to 1 if the system has the type `struct xt_entry_target'. */ +#undef HAVE_STRUCT_XT_ENTRY_TARGET + +/* Define to 1 if you have the `syncfs' function. */ +#undef HAVE_SYNCFS + +/* Define to 1 if you have __sync_add_and_fetch */ +#undef HAVE_SYNC_ADD_AND_FETCH + +/* Define to 1 if you have the `sync_file_range' function. */ +#undef HAVE_SYNC_FILE_RANGE + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_ACL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_CAPABILITY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_EPOLL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_FANOTIFY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_INOTIFY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PRCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PTRACE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_REG_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SHM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SIGNALFD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIMERFD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_USTAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UTSNAME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_XATTR_H + +/* Define to 1 if you have the `tee' function. */ +#undef HAVE_TEE + +/* Define to 1 if you have the `timerfd_create' function. */ +#undef HAVE_TIMERFD_CREATE + +/* Define to 1 if you have the `timerfd_gettime' function. */ +#undef HAVE_TIMERFD_GETTIME + +/* Define to 1 if you have the `timerfd_settime' function. */ +#undef HAVE_TIMERFD_SETTIME + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `unshare' function. */ +#undef HAVE_UNSHARE + +/* Define to 1 if you have the `ustat' function. */ +#undef HAVE_USTAT + +/* Define to 1 if you have utimensat(2) */ +#undef HAVE_UTIMENSAT + +/* Define to 1 if you have the `vfork' function. */ +#undef HAVE_VFORK + +/* Define to 1 if you have the `vmsplice' function. */ +#undef HAVE_VMSPLICE + +/* Define to 1 if you have the `xdr_char' function. */ +#undef HAVE_XDR_CHAR + +/* Define to 1 if you have the header file. */ +#undef HAVE_XFS_XQM_H + +/* Error message when no NUMA support */ +#undef NUMA_ERROR_MSG + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Target is running Linux w/out an MMU */ +#undef UCLINUX + +/* Version number of package */ +#undef VERSION + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#undef YYTEXT_POINTER diff --git a/fsstress/include/ipcmsg.h b/fsstress/include/ipcmsg.h new file mode 100644 index 0000000000..d89894b726 --- /dev/null +++ b/fsstress/include/ipcmsg.h @@ -0,0 +1,68 @@ +/* + * + * Copyright (c) International Business Machines Corp., 2001 + * + * 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 + */ + +/* + * ipcmsg.h - common definitions for the IPC message tests. + */ + +#ifndef __IPCMSG_H +#define __IPCMSG_H 1 + +#include +#include +#include +#include + +#include "test.h" + +void cleanup(void); +void setup(void); + +#define MSG_RD 0400 /* read permission for the queue */ +#define MSG_WR 0200 /* write permission for the queue */ +#define MSG_RW MSG_RD | MSG_WR + +#define MSGSIZE 1024 /* a resonable size for a message */ +#define MSGTYPE 1 /* a type ID for a message */ + +#define NR_MSGQUEUES 16 /* MSGMNI as defined in linux/msg.h */ + +#define min(a, b) (((a) < (b)) ? (a) : (b)) + +typedef struct mbuf { /* a generic message structure */ + long mtype; + char mtext[MSGSIZE + 1]; /* add 1 here so the message can be 1024 */ +} MSGBUF; /* characters long with a '\0' termination */ + +#ifdef LIBIPC +key_t msgkey; /* the ftok() generated message key */ +#else +extern key_t msgkey; /* the ftok() generated message key */ +#endif + +void init_buf(MSGBUF *, int, int); +void rm_queue(int); + +key_t getipckey(); +int getuserid(char *); + +int get_max_msgqueues(void); +int get_used_msgqueues(void); + +#endif /* ipcmsg.h */ diff --git a/fsstress/include/ipcsem.h b/fsstress/include/ipcsem.h new file mode 100644 index 0000000000..6a37672a74 --- /dev/null +++ b/fsstress/include/ipcsem.h @@ -0,0 +1,55 @@ +/* + * + * Copyright (c) International Business Machines Corp., 2001 + * + * 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 + */ + +/* + * ipcsem.h - common definitions for the IPC semaphore tests + */ + +#ifndef __IPCSEM_H +#define __IPCSEM_H + +#include +#include +#include + +#include "test.h" +#include "lapi/semun.h" + +void cleanup(void); +void setup(void); + +#define SEM_RD 0400 +#define SEM_ALT 0200 +#define SEM_RA SEM_RD | SEM_ALT + +#define PSEMS 10 /* a reasonable value for the number of */ + /* "primitive semaphores" per ID */ + +#ifdef LIBIPC +key_t semkey; /* an IPC key generated by ftok() */ +#else +extern key_t semkey; /* an IPC key generated by ftok() */ +#endif + +void rm_sema(int sem_id); + +int getipckey(); +int getuserid(char *); + +#endif /* ipcsem.h */ diff --git a/fsstress/include/ipcshm.h b/fsstress/include/ipcshm.h new file mode 100644 index 0000000000..08307d4ab9 --- /dev/null +++ b/fsstress/include/ipcshm.h @@ -0,0 +1,54 @@ +/* + * + * Copyright (c) International Business Machines Corp., 2001 + * + * 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 + */ + +/* + * ipcshm.h - common definitions for the IPC shared memory tests + */ + +#ifndef __IPCSHM_H +#define __IPCSHM_H + +#include +#include +#include +#include + +#include "test.h" + +void cleanup(void); +void setup(void); + +#define SHM_RD 0400 +#define SHM_WR 0200 +#define SHM_RW SHM_RD | SHM_WR + +#define SHM_SIZE 2048 /* a resonable size for a memory segment */ +#define INT_SIZE 4 /* instead of sizeof(int) */ + +#define MODE_MASK 0x01FF /* to get the lower nine permission bits */ + /* from shmid_ds.ipc_perm.mode */ + +key_t shmkey; /* an IPC key generated by ftok() */ + +void rm_shm(int shm_id); + +int getipckey(); +int getuserid(char*); + +#endif /* ipcshm.h */ diff --git a/fsstress/include/lapi/.gitignore b/fsstress/include/lapi/.gitignore new file mode 100644 index 0000000000..9867b3f254 --- /dev/null +++ b/fsstress/include/lapi/.gitignore @@ -0,0 +1 @@ +syscalls.h diff --git a/fsstress/include/lapi/abisize.h b/fsstress/include/lapi/abisize.h new file mode 100644 index 0000000000..9e6622ca16 --- /dev/null +++ b/fsstress/include/lapi/abisize.h @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2014-2019 Linux Test Project + * Cyril Hrubis + * Petr Vorel + */ + +#ifndef ABISIZE_H__ +#define ABISIZE_H__ + +/* __WORDSIZE replacement */ +#if defined(__LP64__) || defined(_LP64) +# define TST_ABI64 +# define TST_ABI 64 +#else +# define TST_ABI32 +# define TST_ABI 32 +#endif + +/* + * Determines if we have to split up 64 bit arguments or not + * + * Deals with 32bit ABIs that have 64bit syscalls + */ +#define LTP_USE_64_ABI \ + (defined(__mips__) && _MIPS_SIM == _ABIN32) || \ + (defined(__x86_64__) && defined(__ILP32__)) || \ + (defined(__aarch64__) && defined(__ILP32__)) || \ + defined(TST_ABI64) + +#endif /* ABISIZE_H__ */ diff --git a/fsstress/include/lapi/acct.h b/fsstress/include/lapi/acct.h new file mode 100644 index 0000000000..c81b78b442 --- /dev/null +++ b/fsstress/include/lapi/acct.h @@ -0,0 +1,74 @@ +//SPDX-License-Identifier: GPL-2.0-or-later + +#ifndef LAPI_ACCT_H +#define LAPI_ACCT_H + +#include +#include "config.h" + +#ifdef HAVE_STRUCT_ACCT_V3 +#include +#else + +#define ACCT_COMM 16 + +typedef uint16_t comp_t; + +/* Fallback structures to parse the process accounting file */ +struct acct { + char ac_flag; + uint16_t ac_uid; + uint16_t ac_gid; + uint16_t ac_tty; + uint32_t ac_btime; + comp_t ac_utime; + comp_t ac_stime; + comp_t ac_etime; + comp_t ac_mem; + comp_t ac_io; + comp_t ac_rw; + comp_t ac_minflt; + comp_t ac_majflt; + comp_t ac_swaps; + uint32_t ac_exitcode; + char ac_comm[ACCT_COMM+1]; + char ac_pad[10]; +}; + +struct acct_v3 { + char ac_flag; + char ac_version; + uint16_t ac_tty; + uint32_t ac_exitcode; + uint32_t ac_uid; + uint32_t ac_gid; + uint32_t ac_pid; + uint32_t ac_ppid; + uint32_t ac_btime; + float ac_etime; + comp_t ac_utime; + comp_t ac_stime; + comp_t ac_mem; + comp_t ac_io; + comp_t ac_rw; + comp_t ac_minflt; + comp_t ac_majflt; + comp_t ac_swaps; + char ac_comm[ACCT_COMM]; +}; + +/* Possible values for the ac_flag member */ +enum { + AFORK = 0x01, + ASU = 0x02, + ACORE = 0x08, + AXSIG = 0x10 +}; +# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +# define ACCT_BYTEORDER 0x80 +# elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +# define ACCT_BYTEORDER 0x00 +# endif +#endif /* HAVE_STRUCT_ACCT_V3 */ + +#endif /* LAPI_ACCT_H */ diff --git a/fsstress/include/lapi/bpf.h b/fsstress/include/lapi/bpf.h new file mode 100644 index 0000000000..22b13b47ba --- /dev/null +++ b/fsstress/include/lapi/bpf.h @@ -0,0 +1,567 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 Richard Palethorpe + * + * Essential Extended Berkeley Packet Filter (eBPF) headers + * + * Mostly copied/adapted from linux/bpf.h and libbpf so that we can perform + * some eBPF testing without any external dependencies. + */ + +#ifndef BPF_H +# define BPF_H + +#include + +#include "lapi/syscalls.h" + +/* Start copy from linux/bpf_(common).h */ +#define BPF_CLASS(code) ((code) & 0x07) +#define BPF_LD 0x00 +#define BPF_LDX 0x01 +#define BPF_ST 0x02 +#define BPF_STX 0x03 +#define BPF_ALU 0x04 +#define BPF_JMP 0x05 + +#define BPF_JNE 0x50 /* jump != */ + +#define BPF_SIZE(code) ((code) & 0x18) +#define BPF_W 0x00 /* 32-bit */ +#define BPF_DW 0x18 /* double word (64-bit) */ + +#define BPF_MODE(code) ((code) & 0xe0) +#define BPF_IMM 0x00 +#define BPF_MEM 0x60 + +#define BPF_OP(code) ((code) & 0xf0) +#define BPF_ADD 0x00 +#define BPF_SUB 0x10 +#define BPF_LSH 0x60 +#define BPF_RSH 0x70 + +#define BPF_JEQ 0x10 + +#define BPF_SRC(code) ((code) & 0x08) +#define BPF_K 0x00 +#define BPF_X 0x08 + +#define BPF_ALU64 0x07 /* alu mode in double word width */ +#define BPF_MOV 0xb0 /* mov reg to reg */ +#define BPF_CALL 0x80 /* function call */ +#define BPF_EXIT 0x90 /* function return */ + +/* Register numbers */ +enum { + BPF_REG_0 = 0, + BPF_REG_1, + BPF_REG_2, + BPF_REG_3, + BPF_REG_4, + BPF_REG_5, + BPF_REG_6, + BPF_REG_7, + BPF_REG_8, + BPF_REG_9, + BPF_REG_10, + MAX_BPF_REG, +}; + +struct bpf_insn { + uint8_t code; /* opcode */ + uint8_t dst_reg:4; /* dest register */ + uint8_t src_reg:4; /* source register */ + int16_t off; /* signed offset */ + int32_t imm; /* signed immediate constant */ +}; + +enum bpf_cmd { + BPF_MAP_CREATE, + BPF_MAP_LOOKUP_ELEM, + BPF_MAP_UPDATE_ELEM, + BPF_MAP_DELETE_ELEM, + BPF_MAP_GET_NEXT_KEY, + BPF_PROG_LOAD, + BPF_OBJ_PIN, + BPF_OBJ_GET, + BPF_PROG_ATTACH, + BPF_PROG_DETACH, + BPF_PROG_TEST_RUN, + BPF_PROG_GET_NEXT_ID, + BPF_MAP_GET_NEXT_ID, + BPF_PROG_GET_FD_BY_ID, + BPF_MAP_GET_FD_BY_ID, + BPF_OBJ_GET_INFO_BY_FD, + BPF_PROG_QUERY, + BPF_RAW_TRACEPOINT_OPEN, + BPF_BTF_LOAD, + BPF_BTF_GET_FD_BY_ID, + BPF_TASK_FD_QUERY, + BPF_MAP_LOOKUP_AND_DELETE_ELEM, + BPF_MAP_FREEZE, +}; + +enum bpf_map_type { + BPF_MAP_TYPE_UNSPEC, + BPF_MAP_TYPE_HASH, + BPF_MAP_TYPE_ARRAY, + BPF_MAP_TYPE_PROG_ARRAY, + BPF_MAP_TYPE_PERF_EVENT_ARRAY, + BPF_MAP_TYPE_PERCPU_HASH, + BPF_MAP_TYPE_PERCPU_ARRAY, + BPF_MAP_TYPE_STACK_TRACE, + BPF_MAP_TYPE_CGROUP_ARRAY, + BPF_MAP_TYPE_LRU_HASH, + BPF_MAP_TYPE_LRU_PERCPU_HASH, + BPF_MAP_TYPE_LPM_TRIE, + BPF_MAP_TYPE_ARRAY_OF_MAPS, + BPF_MAP_TYPE_HASH_OF_MAPS, + BPF_MAP_TYPE_DEVMAP, + BPF_MAP_TYPE_SOCKMAP, + BPF_MAP_TYPE_CPUMAP, + BPF_MAP_TYPE_XSKMAP, + BPF_MAP_TYPE_SOCKHASH, + BPF_MAP_TYPE_CGROUP_STORAGE, + BPF_MAP_TYPE_REUSEPORT_SOCKARRAY, + BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE, + BPF_MAP_TYPE_QUEUE, + BPF_MAP_TYPE_STACK, + BPF_MAP_TYPE_SK_STORAGE, +}; + +enum bpf_prog_type { + BPF_PROG_TYPE_UNSPEC, + BPF_PROG_TYPE_SOCKET_FILTER, + BPF_PROG_TYPE_KPROBE, + BPF_PROG_TYPE_SCHED_CLS, + BPF_PROG_TYPE_SCHED_ACT, + BPF_PROG_TYPE_TRACEPOINT, + BPF_PROG_TYPE_XDP, + BPF_PROG_TYPE_PERF_EVENT, + BPF_PROG_TYPE_CGROUP_SKB, + BPF_PROG_TYPE_CGROUP_SOCK, + BPF_PROG_TYPE_LWT_IN, + BPF_PROG_TYPE_LWT_OUT, + BPF_PROG_TYPE_LWT_XMIT, + BPF_PROG_TYPE_SOCK_OPS, + BPF_PROG_TYPE_SK_SKB, + BPF_PROG_TYPE_CGROUP_DEVICE, + BPF_PROG_TYPE_SK_MSG, + BPF_PROG_TYPE_RAW_TRACEPOINT, + BPF_PROG_TYPE_CGROUP_SOCK_ADDR, + BPF_PROG_TYPE_LWT_SEG6LOCAL, + BPF_PROG_TYPE_LIRC_MODE2, + BPF_PROG_TYPE_SK_REUSEPORT, + BPF_PROG_TYPE_FLOW_DISSECTOR, + BPF_PROG_TYPE_CGROUP_SYSCTL, + BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, + BPF_PROG_TYPE_CGROUP_SOCKOPT, +}; + +#define BPF_PSEUDO_MAP_FD 1 + +#define BPF_OBJ_NAME_LEN 16U + +#define BPF_ANY 0 /* create new element or update existing */ +#define BPF_NOEXIST 1 /* create new element if it didn't exist */ +#define BPF_EXIST 2 /* update existing element */ +#define BPF_F_LOCK 4 /* spin_lock-ed map_lookup/map_update */ + +#define aligned_uint64_t uint64_t __attribute__((aligned(8))) + +union bpf_attr { + struct { /* anonymous struct used by BPF_MAP_CREATE command */ + uint32_t map_type; /* one of enum bpf_map_type */ + uint32_t key_size; /* size of key in bytes */ + uint32_t value_size; /* size of value in bytes */ + uint32_t max_entries; /* max number of entries in a map */ + uint32_t map_flags; /* BPF_MAP_CREATE related + * flags defined above. + */ + uint32_t inner_map_fd; /* fd pointing to the inner map */ + uint32_t numa_node; /* numa node (effective only if + * BPF_F_NUMA_NODE is set). + */ + char map_name[BPF_OBJ_NAME_LEN]; + uint32_t map_ifindex; /* ifindex of netdev to create on */ + uint32_t btf_fd; /* fd pointing to a BTF type data */ + uint32_t btf_key_type_id; /* BTF type_id of the key */ + uint32_t btf_value_type_id; /* BTF type_id of the value */ + }; + + struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */ + uint32_t map_fd; + aligned_uint64_t key; + union { + aligned_uint64_t value; + aligned_uint64_t next_key; + }; + uint64_t flags; + }; + + struct { /* anonymous struct used by BPF_PROG_LOAD command */ + uint32_t prog_type; /* one of enum bpf_prog_type */ + uint32_t insn_cnt; + aligned_uint64_t insns; + aligned_uint64_t license; + uint32_t log_level; /* verbosity level of verifier */ + uint32_t log_size; /* size of user buffer */ + aligned_uint64_t log_buf; /* user supplied buffer */ + uint32_t kern_version; /* not used */ + uint32_t prog_flags; + char prog_name[BPF_OBJ_NAME_LEN]; + uint32_t prog_ifindex; /* ifindex of netdev to prep for */ + /* For some prog types expected attach type must be known at + * load time to verify attach type specific parts of prog + * (context accesses, allowed helpers, etc). + */ + uint32_t expected_attach_type; + uint32_t prog_btf_fd; /* fd pointing to BTF type data */ + uint32_t func_info_rec_size; /* userspace bpf_func_info size */ + aligned_uint64_t func_info; /* func info */ + uint32_t func_info_cnt; /* number of bpf_func_info records */ + uint32_t line_info_rec_size; /* userspace bpf_line_info size */ + aligned_uint64_t line_info; /* line info */ + uint32_t line_info_cnt; /* number of bpf_line_info records */ + }; + + struct { /* anonymous struct used by BPF_OBJ_* commands */ + aligned_uint64_t pathname; + uint32_t bpf_fd; + uint32_t file_flags; + }; + + struct { /* anonymous struct used by BPF_PROG_ATTACH/DETACH commands */ + uint32_t target_fd; /* container object to attach to */ + uint32_t attach_bpf_fd; /* eBPF program to attach */ + uint32_t attach_type; + uint32_t attach_flags; + }; + + struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */ + uint32_t prog_fd; + uint32_t retval; + uint32_t data_size_in; /* input: len of data_in */ + uint32_t data_size_out; /* input/output: len of data_out + * returns ENOSPC if data_out + * is too small. + */ + aligned_uint64_t data_in; + aligned_uint64_t data_out; + uint32_t repeat; + uint32_t duration; + uint32_t ctx_size_in; /* input: len of ctx_in */ + uint32_t ctx_size_out; /* input/output: len of ctx_out + * returns ENOSPC if ctx_out + * is too small. + */ + aligned_uint64_t ctx_in; + aligned_uint64_t ctx_out; + } test; + + struct { /* anonymous struct used by BPF_*_GET_*_ID */ + union { + uint32_t start_id; + uint32_t prog_id; + uint32_t map_id; + uint32_t btf_id; + }; + uint32_t next_id; + uint32_t open_flags; + }; + + struct { /* anonymous struct used by BPF_OBJ_GET_INFO_BY_FD */ + uint32_t bpf_fd; + uint32_t info_len; + aligned_uint64_t info; + } info; + + struct { /* anonymous struct used by BPF_PROG_QUERY command */ + uint32_t target_fd; /* container object to query */ + uint32_t attach_type; + uint32_t query_flags; + uint32_t attach_flags; + aligned_uint64_t prog_ids; + uint32_t prog_cnt; + } query; + + struct { + uint64_t name; + uint32_t prog_fd; + } raw_tracepoint; + + struct { /* anonymous struct for BPF_BTF_LOAD */ + aligned_uint64_t btf; + aligned_uint64_t btf_log_buf; + uint32_t btf_size; + uint32_t btf_log_size; + uint32_t btf_log_level; + }; + + struct { + uint32_t pid; /* input: pid */ + uint32_t fd; /* input: fd */ + uint32_t flags; /* input: flags */ + uint32_t buf_len; /* input/output: buf len */ + aligned_uint64_t buf; /* input/output: + * tp_name for tracepoint + * symbol for kprobe + * filename for uprobe + */ + uint32_t prog_id; /* output: prod_id */ + uint32_t fd_type; /* output: BPF_FD_TYPE_* */ + uint64_t probe_offset; /* output: probe_offset */ + uint64_t probe_addr; /* output: probe_addr */ + } task_fd_query; +} __attribute__((aligned(8))); + +#define __BPF_FUNC_MAPPER(FN) \ + FN(unspec), \ + FN(map_lookup_elem), \ + FN(map_update_elem), \ + FN(map_delete_elem), \ + FN(probe_read), \ + FN(ktime_get_ns), \ + FN(trace_printk), \ + FN(get_prandom_u32), \ + FN(get_smp_processor_id), \ + FN(skb_store_bytes), \ + FN(l3_csum_replace), \ + FN(l4_csum_replace), \ + FN(tail_call), \ + FN(clone_redirect), \ + FN(get_current_pid_tgid), \ + FN(get_current_uid_gid), \ + FN(get_current_comm), \ + FN(get_cgroup_classid), \ + FN(skb_vlan_push), \ + FN(skb_vlan_pop), \ + FN(skb_get_tunnel_key), \ + FN(skb_set_tunnel_key), \ + FN(perf_event_read), \ + FN(redirect), \ + FN(get_route_realm), \ + FN(perf_event_output), \ + FN(skb_load_bytes), \ + FN(get_stackid), \ + FN(csum_diff), \ + FN(skb_get_tunnel_opt), \ + FN(skb_set_tunnel_opt), \ + FN(skb_change_proto), \ + FN(skb_change_type), \ + FN(skb_under_cgroup), \ + FN(get_hash_recalc), \ + FN(get_current_task), \ + FN(probe_write_user), \ + FN(current_task_under_cgroup), \ + FN(skb_change_tail), \ + FN(skb_pull_data), \ + FN(csum_update), \ + FN(set_hash_invalid), \ + FN(get_numa_node_id), \ + FN(skb_change_head), \ + FN(xdp_adjust_head), \ + FN(probe_read_str), \ + FN(get_socket_cookie), \ + FN(get_socket_uid), \ + FN(set_hash), \ + FN(setsockopt), \ + FN(skb_adjust_room), \ + FN(redirect_map), \ + FN(sk_redirect_map), \ + FN(sock_map_update), \ + FN(xdp_adjust_meta), \ + FN(perf_event_read_value), \ + FN(perf_prog_read_value), \ + FN(getsockopt), \ + FN(override_return), \ + FN(sock_ops_cb_flags_set), \ + FN(msg_redirect_map), \ + FN(msg_apply_bytes), \ + FN(msg_cork_bytes), \ + FN(msg_pull_data), \ + FN(bind), \ + FN(xdp_adjust_tail), \ + FN(skb_get_xfrm_state), \ + FN(get_stack), \ + FN(skb_load_bytes_relative), \ + FN(fib_lookup), \ + FN(sock_hash_update), \ + FN(msg_redirect_hash), \ + FN(sk_redirect_hash), \ + FN(lwt_push_encap), \ + FN(lwt_seg6_store_bytes), \ + FN(lwt_seg6_adjust_srh), \ + FN(lwt_seg6_action), \ + FN(rc_repeat), \ + FN(rc_keydown), \ + FN(skb_cgroup_id), \ + FN(get_current_cgroup_id), \ + FN(get_local_storage), \ + FN(sk_select_reuseport), \ + FN(skb_ancestor_cgroup_id), \ + FN(sk_lookup_tcp), \ + FN(sk_lookup_udp), \ + FN(sk_release), \ + FN(map_push_elem), \ + FN(map_pop_elem), \ + FN(map_peek_elem), \ + FN(msg_push_data), \ + FN(msg_pop_data), \ + FN(rc_pointer_rel), \ + FN(spin_lock), \ + FN(spin_unlock), \ + FN(sk_fullsock), \ + FN(tcp_sock), \ + FN(skb_ecn_set_ce), \ + FN(get_listener_sock), \ + FN(skc_lookup_tcp), \ + FN(tcp_check_syncookie), \ + FN(sysctl_get_name), \ + FN(sysctl_get_current_value), \ + FN(sysctl_get_new_value), \ + FN(sysctl_set_new_value), \ + FN(strtol), \ + FN(strtoul), \ + FN(sk_storage_get), \ + FN(sk_storage_delete), \ + FN(send_signal), + +/* integer value in 'imm' field of BPF_CALL instruction selects which helper + * function eBPF program intends to call + */ +#define __BPF_ENUM_FN(x) BPF_FUNC_ ## x +enum bpf_func_id { + __BPF_FUNC_MAPPER(__BPF_ENUM_FN) + __BPF_FUNC_MAX_ID, +}; +#undef __BPF_ENUM_FN + +/* End copy from linux/bpf.h */ + +/* Start copy from tools/include/filter.h */ + +#define BPF_ALU64_REG(OP, DST, SRC) \ + ((struct bpf_insn) { \ + .code = BPF_ALU64 | BPF_OP(OP) | BPF_X, \ + .dst_reg = DST, \ + .src_reg = SRC, \ + .off = 0, \ + .imm = 0 }) + +#define BPF_ALU64_IMM(OP, DST, IMM) \ + ((struct bpf_insn) { \ + .code = BPF_ALU64 | BPF_OP(OP) | BPF_K, \ + .dst_reg = DST, \ + .src_reg = 0, \ + .off = 0, \ + .imm = IMM }) + +#define BPF_MOV64_REG(DST, SRC) \ + ((struct bpf_insn) { \ + .code = BPF_ALU64 | BPF_MOV | BPF_X, \ + .dst_reg = DST, \ + .src_reg = SRC, \ + .off = 0, \ + .imm = 0 }) + +#define BPF_LD_IMM64(DST, IMM) \ + BPF_LD_IMM64_RAW(DST, 0, IMM) + +#define BPF_LD_IMM64_RAW(DST, SRC, IMM) \ + ((struct bpf_insn) { \ + .code = BPF_LD | BPF_DW | BPF_IMM, \ + .dst_reg = DST, \ + .src_reg = SRC, \ + .off = 0, \ + .imm = (uint32_t) (IMM) }), \ + ((struct bpf_insn) { \ + .code = 0, /* zero is reserved opcode */ \ + .dst_reg = 0, \ + .src_reg = 0, \ + .off = 0, \ + .imm = ((uint64_t) (IMM)) >> 32 }) + +/* pseudo BPF_LD_IMM64 insn used to refer to process-local map_fd */ +#define BPF_LD_MAP_FD(DST, MAP_FD) \ + BPF_LD_IMM64_RAW(DST, BPF_PSEUDO_MAP_FD, MAP_FD) + +#define BPF_ST_MEM(SIZE, DST, OFF, IMM) \ + ((struct bpf_insn) { \ + .code = BPF_ST | BPF_SIZE(SIZE) | BPF_MEM, \ + .dst_reg = DST, \ + .src_reg = 0, \ + .off = OFF, \ + .imm = IMM }) + +#define BPF_LDX_MEM(SIZE, DST, SRC, OFF) \ + ((struct bpf_insn) { \ + .code = BPF_LDX | BPF_SIZE(SIZE) | BPF_MEM, \ + .dst_reg = DST, \ + .src_reg = SRC, \ + .off = OFF, \ + .imm = 0 }) + +#define BPF_STX_MEM(SIZE, DST, SRC, OFF) \ + ((struct bpf_insn) { \ + .code = BPF_STX | BPF_SIZE(SIZE) | BPF_MEM, \ + .dst_reg = DST, \ + .src_reg = SRC, \ + .off = OFF, \ + .imm = 0 }) + +#define BPF_JMP_IMM(OP, DST, IMM, OFF) \ + ((struct bpf_insn) { \ + .code = BPF_JMP | BPF_OP(OP) | BPF_K, \ + .dst_reg = DST, \ + .src_reg = 0, \ + .off = OFF, \ + .imm = IMM }) + +#define BPF_MOV64_IMM(DST, IMM) \ + ((struct bpf_insn) { \ + .code = BPF_ALU64 | BPF_MOV | BPF_K, \ + .dst_reg = DST, \ + .src_reg = 0, \ + .off = 0, \ + .imm = IMM }) + +#define BPF_MOV32_IMM(DST, IMM) \ + ((struct bpf_insn) { \ + .code = BPF_ALU | BPF_MOV | BPF_K, \ + .dst_reg = DST, \ + .src_reg = 0, \ + .off = 0, \ + .imm = IMM }) + +#define BPF_EMIT_CALL(FUNC) \ + ((struct bpf_insn) { \ + .code = BPF_JMP | BPF_CALL, \ + .dst_reg = 0, \ + .src_reg = 0, \ + .off = 0, \ + .imm = ((FUNC) - BPF_FUNC_unspec) }) + +#define BPF_EXIT_INSN() \ + ((struct bpf_insn) { \ + .code = BPF_JMP | BPF_EXIT, \ + .dst_reg = 0, \ + .src_reg = 0, \ + .off = 0, \ + .imm = 0 }) + +/* End copy from tools/include/filter.h */ + +/* Start copy from tools/lib/bpf */ +static inline uint64_t ptr_to_u64(const void *ptr) +{ + return (uint64_t) (unsigned long) ptr; +} + +static inline int bpf(enum bpf_cmd cmd, union bpf_attr *attr, unsigned int size) +{ + return tst_syscall(__NR_bpf, cmd, attr, size); +} +/* End copy from tools/lib/bpf */ + +#endif /* BPF_H */ diff --git a/fsstress/include/lapi/capability.h b/fsstress/include/lapi/capability.h new file mode 100644 index 0000000000..fde27efd36 --- /dev/null +++ b/fsstress/include/lapi/capability.h @@ -0,0 +1,51 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2019 Richard Palethorpe + */ + +#ifndef LAPI_CAPABILITY_H +#define LAPI_CAPABILITY_H + +#include "config.h" + +#ifdef HAVE_SYS_CAPABILITY_H +# include +/** + * Some old libcap-devel(1.96~2.16) define _LINUX_TYPES_H in + * sys/capability.h that makes ltp-lib cann't include linux/types.h + * essentially. Here undefine it if include such old header-file. + */ +# ifndef HAVE_NEWER_LIBCAP +# undef _LINUX_TYPES_H +# endif +#endif + +#ifndef CAP_NET_RAW +# define CAP_NET_RAW 13 +#endif + +#ifndef CAP_SYS_ADMIN +# define CAP_SYS_ADMIN 21 +#endif + +#ifndef CAP_SYS_TIME +# define CAP_SYS_TIME 25 +#endif + +#ifndef CAP_AUDIT_READ +# define CAP_AUDIT_READ 37 +#endif + +#ifndef CAP_SYS_RESOURCE +# define CAP_SYS_RESOURCE 24 +#endif + +#ifndef CAP_TO_INDEX +# define CAP_TO_INDEX(x) ((x) >> 5) +#endif + +#ifndef CAP_TO_MASK +# define CAP_TO_MASK(x) (1 << ((x) & 31)) +#endif + +#endif diff --git a/fsstress/include/lapi/clone.h b/fsstress/include/lapi/clone.h new file mode 100644 index 0000000000..2b8cbdbe08 --- /dev/null +++ b/fsstress/include/lapi/clone.h @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2020 Linaro Limited. All rights reserved. + * Author: Viresh Kumar + */ + +#ifndef LAPI_CLONE_H__ +#define LAPI_CLONE_H__ + +#include +#include +#include + +#include "config.h" +#include "lapi/syscalls.h" + +#ifndef HAVE_CLONE3 +struct clone_args { + uint64_t __attribute__((aligned(8))) flags; + uint64_t __attribute__((aligned(8))) pidfd; + uint64_t __attribute__((aligned(8))) child_tid; + uint64_t __attribute__((aligned(8))) parent_tid; + uint64_t __attribute__((aligned(8))) exit_signal; + uint64_t __attribute__((aligned(8))) stack; + uint64_t __attribute__((aligned(8))) stack_size; + uint64_t __attribute__((aligned(8))) tls; +}; + +int clone3(struct clone_args *args, size_t size) +{ + return tst_syscall(__NR_clone3, args, size); +} +#endif + +#ifndef CLONE_PIDFD +#define CLONE_PIDFD 0x00001000 /* set if a pidfd should be placed in parent */ +#endif + +void clone3_supported_by_kernel(void) +{ + if ((tst_kvercmp(5, 3, 0)) < 0) { + /* Check if the syscall is backported on an older kernel */ + TEST(syscall(__NR_clone3, NULL, 0)); + if (TST_RET == -1 && TST_ERR == ENOSYS) + tst_brk(TCONF, "Test not supported on kernel version < v5.3"); + } +} + +#endif /* LAPI_CLONE_H__ */ diff --git a/fsstress/include/lapi/common_timers.h b/fsstress/include/lapi/common_timers.h new file mode 100644 index 0000000000..b783beff4f --- /dev/null +++ b/fsstress/include/lapi/common_timers.h @@ -0,0 +1,81 @@ +/* + * File: common_timers.h + * + * Keep all the common defines/checks for the timer tests here + */ + +#ifndef __COMMON_TIMERS_H__ +#define __COMMON_TIMERS_H__ + +#include "config.h" +#include "lapi/syscalls.h" +#include "lapi/posix_clocks.h" + +#ifndef NSEC_PER_SEC +#define NSEC_PER_SEC (1000000000L) +#endif + +static const clock_t clock_list[] = { + CLOCK_REALTIME, + CLOCK_MONOTONIC, + CLOCK_PROCESS_CPUTIME_ID, + CLOCK_THREAD_CPUTIME_ID, + CLOCK_BOOTTIME, + CLOCK_BOOTTIME_ALARM, + CLOCK_REALTIME_ALARM, + CLOCK_TAI, +}; +/* CLOCKS_DEFINED is the number of clock sources defined for sure */ +#define CLOCKS_DEFINED (sizeof(clock_list) / sizeof(*clock_list)) +/* MAX_CLOCKS is the maximum number of clock sources supported by kernel */ +#define MAX_CLOCKS 16 + +#define CLOCK_TO_STR(def_name) \ + case def_name: \ + return #def_name; + +static inline const char *get_clock_str(const int clock_id) +{ + switch (clock_id) { + CLOCK_TO_STR(CLOCK_REALTIME); + CLOCK_TO_STR(CLOCK_MONOTONIC); + CLOCK_TO_STR(CLOCK_PROCESS_CPUTIME_ID); + CLOCK_TO_STR(CLOCK_THREAD_CPUTIME_ID); + CLOCK_TO_STR(CLOCK_BOOTTIME); + CLOCK_TO_STR(CLOCK_BOOTTIME_ALARM); + CLOCK_TO_STR(CLOCK_REALTIME_ALARM); + CLOCK_TO_STR(CLOCK_TAI); + default: + return "CLOCK_!?!?!?"; + } +} + +static inline int possibly_unsupported(clock_t clock) +{ + switch (clock) { + case CLOCK_BOOTTIME: + case CLOCK_BOOTTIME_ALARM: + case CLOCK_REALTIME_ALARM: + case CLOCK_TAI: + return 1; + default: + return 0; + } +} + +static inline int have_cputime_timers(void) +{ + return tst_kvercmp(2, 6, 12) >= 0; +} + +#include "lapi/syscalls.h" + +#include +#include + +/* timer_t in kernel(int) is different from Glibc definition(void*). + * Use the kernel definition for syscall tests + */ +typedef int kernel_timer_t; + +#endif diff --git a/fsstress/include/lapi/cpuset.h b/fsstress/include/lapi/cpuset.h new file mode 100644 index 0000000000..8f7136c3b5 --- /dev/null +++ b/fsstress/include/lapi/cpuset.h @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved. + */ + +/* + * Some old libcs (like glibc < 2.7) do not provide interfaces for + * dynamically sized cpu sets, but provide only static cpu_set_t type + * with no more than CPU_SETSIZE cpus in it. + * + * This file is a wrapper of the dynamic interfaces using the static ones. + * + * If the number of cpus available on the system is greater than + * CPU_SETSIZE, this interface will not work. Update libc in this case :) + */ + +#define _GNU_SOURCE +#include + +#ifndef LTP_CPUSET_H +#define LTP_CPUSET_H + +#ifndef CPU_ALLOC +#define CPU_ALLOC(ncpus) malloc(sizeof(cpu_set_t)); \ +if (ncpus > CPU_SETSIZE) { \ + tst_brk(TCONF, \ + "Your libc does not support masks with %ld cpus", (long)ncpus); \ +} +#endif + +#ifndef CPU_FREE +#define CPU_FREE(ptr) free(ptr) +#endif + +#ifndef CPU_ALLOC_SIZE +#define CPU_ALLOC_SIZE(size) sizeof(cpu_set_t) +#endif + +#ifndef CPU_ZERO_S +#define CPU_ZERO_S(size, mask) CPU_ZERO(mask) +#endif + +#ifndef CPU_SET_S +#define CPU_SET_S(cpu, size, mask) CPU_SET(cpu, mask) +#endif + +#ifndef CPU_ISSET_S +#define CPU_ISSET_S(cpu, size, mask) CPU_ISSET(cpu, mask) +#endif + +#endif /* LTP_CPUSET_H */ diff --git a/fsstress/include/lapi/cryptouser.h b/fsstress/include/lapi/cryptouser.h new file mode 100644 index 0000000000..e92fe96fb9 --- /dev/null +++ b/fsstress/include/lapi/cryptouser.h @@ -0,0 +1,182 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2018 Richard Palethorpe + */ + +#ifndef CRYPTOUSER_H__ +#define CRYPTOUSER_H__ + +#ifdef HAVE_LINUX_CRYPTOUSER_H +# include +#else +# include +# define CRYPTO_MAX_NAME 64 + +enum { + CRYPTO_MSG_BASE = 0x10, + CRYPTO_MSG_NEWALG = 0x10, + CRYPTO_MSG_DELALG, + CRYPTO_MSG_UPDATEALG, + CRYPTO_MSG_GETALG, + CRYPTO_MSG_DELRNG, + __CRYPTO_MSG_MAX +}; + +enum crypto_attr_type_t { + CRYPTOCFGA_UNSPEC, + CRYPTOCFGA_PRIORITY_VAL, /* uint32_t */ + CRYPTOCFGA_REPORT_LARVAL, /* struct crypto_report_larval */ + CRYPTOCFGA_REPORT_HASH, /* struct crypto_report_hash */ + CRYPTOCFGA_REPORT_BLKCIPHER, /* struct crypto_report_blkcipher */ + CRYPTOCFGA_REPORT_AEAD, /* struct crypto_report_aead */ + CRYPTOCFGA_REPORT_COMPRESS, /* struct crypto_report_comp */ + CRYPTOCFGA_REPORT_RNG, /* struct crypto_report_rng */ + CRYPTOCFGA_REPORT_CIPHER, /* struct crypto_report_cipher */ + CRYPTOCFGA_REPORT_AKCIPHER, /* struct crypto_report_akcipher */ + CRYPTOCFGA_REPORT_KPP, /* struct crypto_report_kpp */ + CRYPTOCFGA_REPORT_ACOMP, /* struct crypto_report_acomp */ + __CRYPTOCFGA_MAX + +#define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1) +}; + +struct crypto_user_alg { + char cru_name[CRYPTO_MAX_NAME]; + char cru_driver_name[CRYPTO_MAX_NAME]; + char cru_module_name[CRYPTO_MAX_NAME]; + uint32_t cru_type; + uint32_t cru_mask; + uint32_t cru_refcnt; + uint32_t cru_flags; +}; + +struct crypto_report_larval { + char type[CRYPTO_MAX_NAME]; +}; + +struct crypto_report_hash { + char type[CRYPTO_MAX_NAME]; + unsigned int blocksize; + unsigned int digestsize; +}; + +struct crypto_report_cipher { + char type[CRYPTO_MAX_NAME]; + unsigned int blocksize; + unsigned int min_keysize; + unsigned int max_keysize; +}; + +struct crypto_report_blkcipher { + char type[CRYPTO_MAX_NAME]; + char geniv[CRYPTO_MAX_NAME]; + unsigned int blocksize; + unsigned int min_keysize; + unsigned int max_keysize; + unsigned int ivsize; +}; + +struct crypto_report_aead { + char type[CRYPTO_MAX_NAME]; + char geniv[CRYPTO_MAX_NAME]; + unsigned int blocksize; + unsigned int maxauthsize; + unsigned int ivsize; +}; + +struct crypto_report_comp { + char type[CRYPTO_MAX_NAME]; +}; + +struct crypto_report_rng { + char type[CRYPTO_MAX_NAME]; + unsigned int seedsize; +}; + +struct crypto_report_akcipher { + char type[CRYPTO_MAX_NAME]; +}; + +struct crypto_report_kpp { + char type[CRYPTO_MAX_NAME]; +}; + +struct crypto_report_acomp { + char type[CRYPTO_MAX_NAME]; +}; + +#endif /* HAVE_LINUX_CRYPTOUSER_H */ + +/* These are taken from include/crypto.h in the kernel tree. They are not + * currently included in the user API. + */ +#ifndef CRYPTO_MAX_ALG_NAME +# define CRYPTO_MAX_ALG_NAME 128 +#endif + +#ifndef CRYPTO_ALG_TYPE_MASK +# define CRYPTO_ALG_TYPE_MASK 0x0000000f +#endif +#ifndef CRYPTO_ALG_TYPE_CIPHER +# define CRYPTO_ALG_TYPE_CIPHER 0x00000001 +#endif +#ifndef CRYPTO_ALG_TYPE_COMPRESS +# define CRYPTO_ALG_TYPE_COMPRESS 0x00000002 +#endif +#ifndef CRYPTO_ALG_TYPE_AEAD +# define CRYPTO_ALG_TYPE_AEAD 0x00000003 +#endif +#ifndef CRYPTO_ALG_TYPE_BLKCIPHER +# define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004 +#endif +#ifndef CRYPTO_ALG_TYPE_ABLKCIPHER +# define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005 +#endif +#ifndef CRYPTO_ALG_TYPE_SKCIPHER +# define CRYPTO_ALG_TYPE_SKCIPHER 0x00000005 +#endif +#ifndef CRYPTO_ALG_TYPE_GIVCIPHER +# define CRYPTO_ALG_TYPE_GIVCIPHER 0x00000006 +#endif +#ifndef CRYPTO_ALG_TYPE_KPP +# define CRYPTO_ALG_TYPE_KPP 0x00000008 +#endif +#ifndef CRYPTO_ALG_TYPE_ACOMPRESS +# define CRYPTO_ALG_TYPE_ACOMPRESS 0x0000000a +#endif +#ifndef CRYPTO_ALG_TYPE_SCOMPRESS +# define CRYPTO_ALG_TYPE_SCOMPRESS 0x0000000b +#endif +#ifndef CRYPTO_ALG_TYPE_RNG +# define CRYPTO_ALG_TYPE_RNG 0x0000000c +#endif +#ifndef CRYPTO_ALG_TYPE_AKCIPHER +# define CRYPTO_ALG_TYPE_AKCIPHER 0x0000000d +#endif +#ifndef CRYPTO_ALG_TYPE_DIGEST +# define CRYPTO_ALG_TYPE_DIGEST 0x0000000e +#endif +#ifndef CRYPTO_ALG_TYPE_HASH +# define CRYPTO_ALG_TYPE_HASH 0x0000000e +#endif +#ifndef CRYPTO_ALG_TYPE_SHASH +# define CRYPTO_ALG_TYPE_SHASH 0x0000000e +#endif +#ifndef CRYPTO_ALG_TYPE_AHASH +# define CRYPTO_ALG_TYPE_AHASH 0x0000000f +#endif + +#ifndef CRYPTO_ALG_TYPE_HASH_MASK +# define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e +#endif +#ifndef CRYPTO_ALG_TYPE_AHASH_MASK +# define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000e +#endif +#ifndef CRYPTO_ALG_TYPE_BLKCIPHER_MASK +# define CRYPTO_ALG_TYPE_BLKCIPHER_MASK 0x0000000c +#endif +#ifndef CRYPTO_ALG_TYPE_ACOMPRESS_MASK +# define CRYPTO_ALG_TYPE_ACOMPRESS_MASK 0x0000000e +#endif + +#endif /* CRYPTOUSER_H__ */ diff --git a/fsstress/include/lapi/dccp.h b/fsstress/include/lapi/dccp.h new file mode 100644 index 0000000000..a0f0148503 --- /dev/null +++ b/fsstress/include/lapi/dccp.h @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2017 Petr Vorel + */ + +#ifndef LAPI_DCCP_H__ +#define LAPI_DCCP_H__ + +#ifdef HAVE_LINUX_DCCP_H +# include +#endif + +#ifndef DCCP_SOCKOPT_SERVICE +# define DCCP_SOCKOPT_SERVICE 2 +#endif + +#endif /* LAPI_DCCP_H__ */ diff --git a/fsstress/include/lapi/epoll.h b/fsstress/include/lapi/epoll.h new file mode 100644 index 0000000000..899eeb9d42 --- /dev/null +++ b/fsstress/include/lapi/epoll.h @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2016 Cyril Hrubis + */ + +#ifndef LAPI_EPOLL_H__ +#define LAPI_EPOLL_H__ + +#ifndef EPOLL_CLOEXEC +# define EPOLL_CLOEXEC 02000000 +#endif + +#endif /* LAPI_EPOLL_H__ */ diff --git a/fsstress/include/lapi/execveat.h b/fsstress/include/lapi/execveat.h new file mode 100644 index 0000000000..a7406f7c01 --- /dev/null +++ b/fsstress/include/lapi/execveat.h @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2018 MediaTek Inc. All Rights Reserved. + */ + +#ifndef EXECVEAT_H +#define EXECVEAT_H + +#include +#include "config.h" +#include "lapi/syscalls.h" + +#if !defined(HAVE_EXECVEAT) +int execveat(int dirfd, const char *pathname, + char *const argv[], char *const envp[], + int flags) +{ + return tst_syscall(__NR_execveat, dirfd, pathname, argv, envp, flags); +} +#endif + +#endif /* EXECVEAT_H */ diff --git a/fsstress/include/lapi/fallocate.h b/fsstress/include/lapi/fallocate.h new file mode 100644 index 0000000000..72f52c78f5 --- /dev/null +++ b/fsstress/include/lapi/fallocate.h @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) International Business Machines Corp., 2007 + * Copyright (c) 2014 Fujitsu Ltd. + */ + +#ifndef FALLOCATE_H +#define FALLOCATE_H + +#include +#include +#include "config.h" +#include "lapi/abisize.h" +#include "lapi/seek.h" +#include "lapi/syscalls.h" + +#ifndef FALLOC_FL_KEEP_SIZE +# define FALLOC_FL_KEEP_SIZE 0x01 +#endif + +#ifndef FALLOC_FL_PUNCH_HOLE +# define FALLOC_FL_PUNCH_HOLE 0x02 +#endif + +#ifndef FALLOC_FL_COLLAPSE_RANGE +# define FALLOC_FL_COLLAPSE_RANGE 0x08 +#endif + +#ifndef FALLOC_FL_ZERO_RANGE +# define FALLOC_FL_ZERO_RANGE 0x10 +#endif + +#ifndef FALLOC_FL_INSERT_RANGE +# define FALLOC_FL_INSERT_RANGE 0x20 +#endif + +#if !defined(HAVE_FALLOCATE) + +# ifdef __TEST_H__ +# define TST_SYSCALL_WRAPPER ltp_syscall +# else +# define TST_SYSCALL_WRAPPER tst_syscall +# endif /* __TEST_H__ */ + +static inline long fallocate(int fd, int mode, loff_t offset, loff_t len) +{ + /* Deal with 32bit ABIs that have 64bit syscalls. */ +# if LTP_USE_64_ABI + return TST_SYSCALL_WRAPPER(__NR_fallocate, fd, mode, offset, len); +# else + return (long)TST_SYSCALL_WRAPPER(__NR_fallocate, fd, mode, + __LONG_LONG_PAIR((off_t) (offset >> 32), + (off_t) offset), + __LONG_LONG_PAIR((off_t) (len >> 32), + (off_t) len)); +# endif +} +#endif + +#endif /* FALLOCATE_H */ diff --git a/fsstress/include/lapi/fcntl.h b/fsstress/include/lapi/fcntl.h new file mode 100644 index 0000000000..576a18daf1 --- /dev/null +++ b/fsstress/include/lapi/fcntl.h @@ -0,0 +1,139 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2014 Cyril Hrubis + */ + +#ifndef __LAPI_FCNTL_H__ +#define __LAPI_FCNTL_H__ + +#include +#include + +#ifndef O_DIRECT +# define O_DIRECT 040000 +#endif + +#ifndef O_CLOEXEC +# define O_CLOEXEC 02000000 +#endif + +#ifndef SOCK_CLOEXEC +# define SOCK_CLOEXEC O_CLOEXEC +#endif + +#ifndef SOCK_NONBLOCK +# define SOCK_NONBLOCK O_NONBLOCK +#endif + +#ifndef O_TMPFILE +# define O_TMPFILE (020000000 | O_DIRECTORY) +#endif + +#ifndef F_DUPFD_CLOEXEC +# define F_DUPFD_CLOEXEC 1030 +#endif + +#ifndef F_SETPIPE_SZ +# define F_SETPIPE_SZ 1031 +#endif + +#ifndef F_GETPIPE_SZ +# define F_GETPIPE_SZ 1032 +#endif + +/* + * Set/Get seals + */ +#ifndef F_ADD_SEALS +# define F_ADD_SEALS (1033) +#endif + +#ifndef F_GET_SEALS +# define F_GET_SEALS (1034) +#endif + +#ifndef F_SEAL_SEAL +# define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */ +#endif + +#ifndef F_SEAL_SHRINK +# define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */ +#endif +#ifndef F_SEAL_GROW +# define F_SEAL_GROW 0x0004 /* prevent file from growing */ +#endif +#ifndef F_SEAL_WRITE +# define F_SEAL_WRITE 0x0008 /* prevent writes */ +#endif + +#ifndef F_OWNER_PGRP +# define F_OWNER_PGRP 2 +#endif + +#ifndef F_OFD_GETLK +# define F_OFD_GETLK 36 +#endif + +#ifndef F_OFD_SETLK +# define F_OFD_SETLK 37 +#endif + +#ifndef F_OFD_SETLKW +# define F_OFD_SETLKW 38 +#endif + +#ifndef AT_FDCWD +# define AT_FDCWD -100 +#endif + +#ifndef AT_SYMLINK_FOLLOW +# define AT_SYMLINK_FOLLOW 0x400 +#endif + +#ifndef AT_SYMLINK_NOFOLLOW +# define AT_SYMLINK_NOFOLLOW 0x100 +#endif + +#ifndef AT_EMPTY_PATH +# define AT_EMPTY_PATH 0x1000 +#endif + +#ifndef AT_REMOVEDIR +# define AT_REMOVEDIR 0x200 +#endif + +#ifndef O_NOATIME +# define O_NOATIME 01000000 +#endif + +#ifndef O_PATH +# ifdef __sparc__ +# define O_PATH 0x1000000 +# else +# define O_PATH 010000000 +# endif +#endif + +#ifndef FALLOC_FL_KEEP_SIZE +# define FALLOC_FL_KEEP_SIZE 1 +#endif + +#ifndef RENAME_NOREPLACE +# define RENAME_NOREPLACE (1 << 0) +#endif + +#ifndef RENAME_EXCHANGE +# define RENAME_EXCHANGE (1 << 1) +#endif + +#ifndef RENAME_WHITEOUT +# define RENAME_WHITEOUT (1 << 2) +#endif + +/* splice, vmsplice, tee */ + +#ifndef SPLICE_F_NONBLOCK +# define SPLICE_F_NONBLOCK 2 +#endif + +#endif /* __LAPI_FCNTL_H__ */ diff --git a/fsstress/include/lapi/fnmatch.h b/fsstress/include/lapi/fnmatch.h new file mode 100644 index 0000000000..9628ac4407 --- /dev/null +++ b/fsstress/include/lapi/fnmatch.h @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2018 Linaro Limited. All rights reserved. + * Author: Rafael David Tinoco + */ + +#ifndef FNMATCH_H__ +#define FNMATCH_H__ + +#ifndef FNM_EXTMATCH +#define FNM_EXTMATCH 0 +#endif + +#endif diff --git a/fsstress/include/lapi/fs.h b/fsstress/include/lapi/fs.h new file mode 100644 index 0000000000..430d21f271 --- /dev/null +++ b/fsstress/include/lapi/fs.h @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Referred from linux kernel include/uapi/linux/fs.h + * Copyright (c) 2019 Petr Vorel + * Copyright (c) Zilogic Systems Pvt. Ltd., 2018 + * Email: code@zilogic.com + */ + +#ifdef HAVE_LINUX_FS_H +# include +#endif + +#include +#include +#include "lapi/abisize.h" + +#ifndef LAPI_FS_H +#define LAPI_FS_H + +#ifndef FS_IOC_GETFLAGS +#define FS_IOC_GETFLAGS _IOR('f', 1, long) +#endif + +#ifndef FS_IOC_SETFLAGS +#define FS_IOC_SETFLAGS _IOW('f', 2, long) +#endif + +#ifndef FS_COMPR_FL +#define FS_COMPR_FL 0x00000004 /* Compress file */ +#endif + +#ifndef FS_IMMUTABLE_FL +#define FS_IMMUTABLE_FL 0x00000010 /* Immutable file */ +#endif + +#ifndef FS_APPEND_FL +#define FS_APPEND_FL 0x00000020 /* writes to file may only append */ +#endif + +#ifndef FS_NODUMP_FL +#define FS_NODUMP_FL 0x00000040 /* do not dump file */ +#endif + +/* + * Helper function to get MAX_LFS_FILESIZE. + * Missing PAGE_SHIFT on some libc prevents defining MAX_LFS_FILESIZE. + * + * 64 bit: macro taken from kernel from include/linux/fs.h + * 32 bit: own implementation + */ +static inline loff_t tst_max_lfs_filesize(void) +{ +#ifdef TST_ABI64 + return (loff_t)LLONG_MAX; +#else + long page_size = getpagesize(); + loff_t ret = ULONG_MAX; + + while (page_size >>= 1) + ret <<= 1; + + return ret; +#endif +} + +#endif diff --git a/fsstress/include/lapi/fsmount.h b/fsstress/include/lapi/fsmount.h new file mode 100644 index 0000000000..09a2c16118 --- /dev/null +++ b/fsstress/include/lapi/fsmount.h @@ -0,0 +1,145 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2020 Linaro Limited. All rights reserved. + * Author: Viresh Kumar + */ + +#ifndef FSMOUNT_H__ +#define FSMOUNT_H__ + +#include +#include +#include + +#include "config.h" +#include "lapi/fcntl.h" +#include "lapi/syscalls.h" + +#ifndef HAVE_FSOPEN +int fsopen(const char *fsname, unsigned int flags) +{ + return tst_syscall(__NR_fsopen, fsname, flags); +} +#endif /* HAVE_FSOPEN */ + +#ifndef HAVE_FSCONFIG +int fsconfig(int fd, unsigned int cmd, const char *key, + const void *value, int aux) +{ + return tst_syscall(__NR_fsconfig, fd, cmd, key, value, aux); +} +#endif /* HAVE_FSCONFIG */ + +#ifndef HAVE_FSMOUNT +int fsmount(int fd, unsigned int flags, unsigned int mount_attrs) +{ + return tst_syscall(__NR_fsmount, fd, flags, mount_attrs); +} +#endif /* HAVE_FSMOUNT */ + +#ifndef HAVE_FSPICK +int fspick(int dirfd, const char *pathname, unsigned int flags) +{ + return tst_syscall(__NR_fspick, dirfd, pathname, flags); +} +#endif /* HAVE_FSPICK */ + +#ifndef HAVE_MOVE_MOUNT +int move_mount(int from_dirfd, const char *from_pathname, int to_dirfd, + const char *to_pathname, unsigned int flags) +{ + return tst_syscall(__NR_move_mount, from_dirfd, from_pathname, to_dirfd, + to_pathname, flags); +} +#endif /* HAVE_MOVE_MOUNT */ + +#ifndef HAVE_OPEN_TREE +int open_tree(int dirfd, const char *pathname, unsigned int flags) +{ + return tst_syscall(__NR_open_tree, dirfd, pathname, flags); +} +#endif /* HAVE_OPEN_TREE */ + +/* + * New headers added in kernel after 5.2 release, create them for old userspace. +*/ + +#ifndef OPEN_TREE_CLONE + +/* + * open_tree() flags. + */ +#define OPEN_TREE_CLONE 1 /* Clone the target tree and attach the clone */ +#define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */ + +/* + * move_mount() flags. + */ +#define MOVE_MOUNT_F_SYMLINKS 0x00000001 /* Follow symlinks on from path */ +#define MOVE_MOUNT_F_AUTOMOUNTS 0x00000002 /* Follow automounts on from path */ +#define MOVE_MOUNT_F_EMPTY_PATH 0x00000004 /* Empty from path permitted */ +#define MOVE_MOUNT_T_SYMLINKS 0x00000010 /* Follow symlinks on to path */ +#define MOVE_MOUNT_T_AUTOMOUNTS 0x00000020 /* Follow automounts on to path */ +#define MOVE_MOUNT_T_EMPTY_PATH 0x00000040 /* Empty to path permitted */ +#define MOVE_MOUNT__MASK 0x00000077 + +/* + * fsopen() flags. + */ +#define FSOPEN_CLOEXEC 0x00000001 + +/* + * fspick() flags. + */ +#define FSPICK_CLOEXEC 0x00000001 +#define FSPICK_SYMLINK_NOFOLLOW 0x00000002 +#define FSPICK_NO_AUTOMOUNT 0x00000004 +#define FSPICK_EMPTY_PATH 0x00000008 + +/* + * The type of fsconfig() call made. + */ +enum fsconfig_command { + FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ + FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ + FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ + FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ + FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ + FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ + FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ + FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ +}; + +/* + * fsmount() flags. + */ +#define FSMOUNT_CLOEXEC 0x00000001 + +/* + * Mount attributes. + */ +#define MOUNT_ATTR_RDONLY 0x00000001 /* Mount read-only */ +#define MOUNT_ATTR_NOSUID 0x00000002 /* Ignore suid and sgid bits */ +#define MOUNT_ATTR_NODEV 0x00000004 /* Disallow access to device special files */ +#define MOUNT_ATTR_NOEXEC 0x00000008 /* Disallow program execution */ +#define MOUNT_ATTR__ATIME 0x00000070 /* Setting on how atime should be updated */ +#define MOUNT_ATTR_RELATIME 0x00000000 /* - Update atime relative to mtime/ctime. */ +#define MOUNT_ATTR_NOATIME 0x00000010 /* - Do not update access times. */ +#define MOUNT_ATTR_STRICTATIME 0x00000020 /* - Always perform atime updates */ +#define MOUNT_ATTR_NODIRATIME 0x00000080 /* Do not update directory access times */ + +#endif /* OPEN_TREE_CLONE */ + +void fsopen_supported_by_kernel(void) +{ + if ((tst_kvercmp(5, 2, 0)) < 0) { + /* Check if the syscall is backported on an older kernel */ + TEST(syscall(__NR_fsopen, NULL, 0)); + if (TST_RET != -1) + SAFE_CLOSE(TST_RET); + else if (TST_ERR == ENOSYS) + tst_brk(TCONF, "Test not supported on kernel version < v5.2"); + } +} + +#endif /* FSMOUNT_H__ */ diff --git a/fsstress/include/lapi/futex.h b/fsstress/include/lapi/futex.h new file mode 100644 index 0000000000..72209e4c98 --- /dev/null +++ b/fsstress/include/lapi/futex.h @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2015 Linux Test Project + */ + +#ifndef LAPI_FUTEX_H__ +#define LAPI_FUTEX_H__ + +#include + +typedef volatile uint32_t futex_t; + +#endif /* LAPI_FUTEX_H__ */ diff --git a/fsstress/include/lapi/getrandom.h b/fsstress/include/lapi/getrandom.h new file mode 100644 index 0000000000..83e0a0e053 --- /dev/null +++ b/fsstress/include/lapi/getrandom.h @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2015 Linux Test Project + */ + +#ifndef __GETRANDOM_H__ +#define __GETRANDOM_H__ + +#include "config.h" + +#if HAVE_LINUX_RANDOM_H +#include +#endif + +/* + * Flags for getrandom(2) + * + * GRND_NONBLOCK Don't block and return EAGAIN instead + * GRND_RANDOM Use the /dev/random pool instead of /dev/urandom + */ + +#ifndef GRND_NONBLOCK +# define GRND_NONBLOCK 0x0001 +#endif + +#ifndef GRND_RANDOM +# define GRND_RANDOM 0x0002 +#endif + +#endif /* __GETRANDOM_H__ */ diff --git a/fsstress/include/lapi/if_alg.h b/fsstress/include/lapi/if_alg.h new file mode 100644 index 0000000000..5a74df99b8 --- /dev/null +++ b/fsstress/include/lapi/if_alg.h @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright 2019 Google LLC + */ + +#ifndef IF_ALG_H__ +#define IF_ALG_H__ + +#ifdef HAVE_LINUX_IF_ALG_H +# include +#else +# include + +struct sockaddr_alg { + uint16_t salg_family; + uint8_t salg_type[14]; + uint32_t salg_feat; + uint32_t salg_mask; + uint8_t salg_name[64]; +}; + +struct af_alg_iv { + uint32_t ivlen; + uint8_t iv[0]; +}; + +#define ALG_SET_KEY 1 +#define ALG_SET_IV 2 +#define ALG_SET_OP 3 +#define ALG_SET_AEAD_ASSOCLEN 4 +#define ALG_SET_AEAD_AUTHSIZE 5 + +#define ALG_OP_DECRYPT 0 +#define ALG_OP_ENCRYPT 1 + +#endif /* !HAVE_LINUX_IF_ALG_H */ + +#endif /* IF_ALG_H__ */ diff --git a/fsstress/include/lapi/if_ether.h b/fsstress/include/lapi/if_ether.h new file mode 100644 index 0000000000..0e9a4fcc11 --- /dev/null +++ b/fsstress/include/lapi/if_ether.h @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2020 SUSE LLC + */ + +#ifndef __LAPI_IF_ETHER_H__ +#define __LAPI_IF_ETHER_H__ + +#include "config.h" + +#ifdef HAVE_LINUX_IF_ETHER_H +# include +#endif + +#ifndef ETH_P_ALL +# define ETH_P_ALL 0x0003 +#endif + +#endif /* __LAPI_IF_ETHER_H__ */ diff --git a/fsstress/include/lapi/if_packet.h b/fsstress/include/lapi/if_packet.h new file mode 100644 index 0000000000..81110217d8 --- /dev/null +++ b/fsstress/include/lapi/if_packet.h @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. + * Author: Jinhui huang + */ + +#ifndef __LAPI_IF_PACKET_H__ +#define __LAPI_IF_PACKET_H__ + +#include "config.h" + +#ifdef HAVE_LINUX_IF_PACKET_H +# include +#endif + +#ifndef PACKET_RX_RING +# define PACKET_RX_RING 5 +#endif + +#ifndef PACKET_VERSION +# define PACKET_VERSION 10 +#endif + +#ifndef PACKET_RESERVE +# define PACKET_RESERVE 12 +#endif + +#ifndef PACKET_FANOUT +#define PACKET_FANOUT 18 +#endif + +#ifndef PACKET_FANOUT_ROLLOVER +#define PACKET_FANOUT_ROLLOVER 3 +#endif + +#ifndef HAVE_STRUCT_TPACKET_REQ3 +# define TPACKET_V3 2 + +struct tpacket_req3 { + unsigned int tp_block_size; + unsigned int tp_block_nr; + unsigned int tp_frame_size; + unsigned int tp_frame_nr; + unsigned int tp_retire_blk_tov; + unsigned int tp_sizeof_priv; + unsigned int tp_feature_req_word; +}; +#endif + +#endif /* __LAPI_IF_PACKET_H__ */ diff --git a/fsstress/include/lapi/io_pgetevents.h b/fsstress/include/lapi/io_pgetevents.h new file mode 100644 index 0000000000..5bb9a60c35 --- /dev/null +++ b/fsstress/include/lapi/io_pgetevents.h @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2020 Linaro Limited. All rights reserved. + * Author: Viresh Kumar + */ + +#ifndef IO_PGETEVENTS_H +#define IO_PGETEVENTS_H + +#include +#include + +#include "config.h" +#include "lapi/syscalls.h" + +#ifdef HAVE_LIBAIO +#include + +static inline int sys_io_pgetevents(io_context_t ctx, long min_nr, long max_nr, + struct io_event *events, void *timeout, sigset_t *sigmask) +{ + return tst_syscall(__NR_io_pgetevents, ctx, min_nr, max_nr, events, + timeout, sigmask); +} + +static inline int sys_io_pgetevents_time64(io_context_t ctx, long min_nr, long max_nr, + struct io_event *events, void *timeout, sigset_t *sigmask) +{ + return tst_syscall(__NR_io_pgetevents_time64, ctx, min_nr, max_nr, + events, timeout, sigmask); +} + +#endif /* HAVE_LIBAIO */ + +#endif /* IO_PGETEVENTS_H */ diff --git a/fsstress/include/lapi/io_uring.h b/fsstress/include/lapi/io_uring.h new file mode 100644 index 0000000000..5fde58e22c --- /dev/null +++ b/fsstress/include/lapi/io_uring.h @@ -0,0 +1,283 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2020 ARM. All rights reserved. + * Copyright (c) 2020 Petr Vorel + * + * Mostly copied/adapted from + */ + +#ifndef IO_URING_H__ +#define IO_URING_H__ + +#include +#include +#include +#include +#include +#include + +#include "lapi/syscalls.h" + +#ifndef IOSQE_FIXED_FILE + +/* + * IO submission data structure (Submission Queue Entry) + */ +struct io_uring_sqe { + uint8_t opcode; /* type of operation for this sqe */ + uint8_t flags; /* IOSQE_ flags */ + uint16_t ioprio; /* ioprio for the request */ + int32_t fd; /* file descriptor to do IO on */ + union { + uint64_t off; /* offset into file */ + uint64_t addr2; + }; + uint64_t addr; /* pointer to buffer or iovecs */ + uint32_t len; /* buffer size or number of iovecs */ + union { + __kernel_rwf_t rw_flags; + uint32_t fsync_flags; + uint16_t poll_events; + uint32_t sync_range_flags; + uint32_t msg_flags; + uint32_t timeout_flags; + uint32_t accept_flags; + uint32_t cancel_flags; + uint32_t open_flags; + uint32_t statx_flags; + uint32_t fadvise_advice; + }; + uint64_t user_data; /* data to be passed back at completion time */ + union { + struct { + /* index into fixed buffers, if used */ + uint16_t buf_index; + /* personality to use, if used */ + uint16_t personality; + }; + uint64_t __pad2[3]; + }; +}; + +enum { + IOSQE_FIXED_FILE_BIT, + IOSQE_IO_DRAIN_BIT, + IOSQE_IO_LINK_BIT, + IOSQE_IO_HARDLINK_BIT, + IOSQE_ASYNC_BIT, +}; + +/* + * sqe->flags + */ +/* use fixed fileset */ +#define IOSQE_FIXED_FILE (1U << IOSQE_FIXED_FILE_BIT) +/* issue after inflight IO */ +#define IOSQE_IO_DRAIN (1U << IOSQE_IO_DRAIN_BIT) +/* links next sqe */ +#define IOSQE_IO_LINK (1U << IOSQE_IO_LINK_BIT) +/* like LINK, but stronger */ +#define IOSQE_IO_HARDLINK (1U << IOSQE_IO_HARDLINK_BIT) +/* always go async */ +#define IOSQE_ASYNC (1U << IOSQE_ASYNC_BIT) + +/* + * io_uring_setup() flags + */ +#define IORING_SETUP_IOPOLL (1U << 0) /* io_context is polled */ +#define IORING_SETUP_SQPOLL (1U << 1) /* SQ poll thread */ +#define IORING_SETUP_SQ_AFF (1U << 2) /* sq_thread_cpu is valid */ +#define IORING_SETUP_CQSIZE (1U << 3) /* app defines CQ size */ +#define IORING_SETUP_CLAMP (1U << 4) /* clamp SQ/CQ ring sizes */ +#define IORING_SETUP_ATTACH_WQ (1U << 5) /* attach to existing wq */ + +enum { + IORING_OP_NOP, + IORING_OP_READV, + IORING_OP_WRITEV, + IORING_OP_FSYNC, + IORING_OP_READ_FIXED, + IORING_OP_WRITE_FIXED, + IORING_OP_POLL_ADD, + IORING_OP_POLL_REMOVE, + IORING_OP_SYNC_FILE_RANGE, + IORING_OP_SENDMSG, + IORING_OP_RECVMSG, + IORING_OP_TIMEOUT, + IORING_OP_TIMEOUT_REMOVE, + IORING_OP_ACCEPT, + IORING_OP_ASYNC_CANCEL, + IORING_OP_LINK_TIMEOUT, + IORING_OP_CONNECT, + IORING_OP_FALLOCATE, + IORING_OP_OPENAT, + IORING_OP_CLOSE, + IORING_OP_FILES_UPDATE, + IORING_OP_STATX, + IORING_OP_READ, + IORING_OP_WRITE, + IORING_OP_FADVISE, + IORING_OP_MADVISE, + IORING_OP_SEND, + IORING_OP_RECV, + IORING_OP_OPENAT2, + IORING_OP_EPOLL_CTL, + + /* this goes last, obviously */ + IORING_OP_LAST, +}; + +/* + * sqe->fsync_flags + */ +#define IORING_FSYNC_DATASYNC (1U << 0) + +/* + * sqe->timeout_flags + */ +#define IORING_TIMEOUT_ABS (1U << 0) + +/* + * IO completion data structure (Completion Queue Entry) + */ +struct io_uring_cqe { + uint64_t user_data; /* sqe->data submission passed back */ + int32_t res; /* result code for this event */ + uint32_t flags; +}; + +/* + * Magic offsets for the application to mmap the data it needs + */ +#define IORING_OFF_SQ_RING 0ULL +#define IORING_OFF_CQ_RING 0x8000000ULL +#define IORING_OFF_SQES 0x10000000ULL + +/* + * Filled with the offset for mmap(2) + */ +struct io_sqring_offsets { + uint32_t head; + uint32_t tail; + uint32_t ring_mask; + uint32_t ring_entries; + uint32_t flags; + uint32_t dropped; + uint32_t array; + uint32_t resv1; + uint64_t resv2; +}; + +/* + * sq_ring->flags + */ +#define IORING_SQ_NEED_WAKEUP (1U << 0) /* needs io_uring_enter wakeup */ + +struct io_cqring_offsets { + uint32_t head; + uint32_t tail; + uint32_t ring_mask; + uint32_t ring_entries; + uint32_t overflow; + uint32_t cqes; + uint64_t resv[2]; +}; + +/* + * io_uring_enter(2) flags + */ +#define IORING_ENTER_GETEVENTS (1U << 0) +#define IORING_ENTER_SQ_WAKEUP (1U << 1) + +/* + * Passed in for io_uring_setup(2). Copied back with updated info on success + */ +struct io_uring_params { + uint32_t sq_entries; + uint32_t cq_entries; + uint32_t flags; + uint32_t sq_thread_cpu; + uint32_t sq_thread_idle; + uint32_t features; + uint32_t wq_fd; + uint32_t resv[3]; + struct io_sqring_offsets sq_off; + struct io_cqring_offsets cq_off; +}; + +/* + * io_uring_params->features flags + */ +#define IORING_FEAT_SINGLE_MMAP (1U << 0) +#define IORING_FEAT_NODROP (1U << 1) +#define IORING_FEAT_SUBMIT_STABLE (1U << 2) +#define IORING_FEAT_RW_CUR_POS (1U << 3) +#define IORING_FEAT_CUR_PERSONALITY (1U << 4) + +/* + * io_uring_register(2) opcodes and arguments + */ +#define IORING_REGISTER_BUFFERS 0 +#define IORING_UNREGISTER_BUFFERS 1 +#define IORING_REGISTER_FILES 2 +#define IORING_UNREGISTER_FILES 3 +#define IORING_REGISTER_EVENTFD 4 +#define IORING_UNREGISTER_EVENTFD 5 +#define IORING_REGISTER_FILES_UPDATE 6 +#define IORING_REGISTER_EVENTFD_ASYNC 7 +#define IORING_REGISTER_PROBE 8 +#define IORING_REGISTER_PERSONALITY 9 +#define IORING_UNREGISTER_PERSONALITY 10 + +struct io_uring_files_update { + uint32_t offset; + uint32_t resv; + uint64_t __attribute__((aligned(8))) fds; +}; + +#define IO_URING_OP_SUPPORTED (1U << 0) + +struct io_uring_probe_op { + uint8_t op; + uint8_t resv; + uint16_t flags; /* IO_URING_OP_* flags */ + uint32_t resv2; +}; + +struct io_uring_probe { + uint8_t last_op; /* last opcode supported */ + uint8_t ops_len; /* length of ops[] array below */ + uint16_t resv; + uint32_t resv2[3]; + struct io_uring_probe_op ops[0]; +}; + +#endif /* IOSQE_FIXED_FILE */ + + +#ifndef HAVE_IO_URING_REGISTER +int io_uring_register(int fd, unsigned int opcode, void *arg, + unsigned int nr_args) +{ + return tst_syscall(__NR_io_uring_register, fd, opcode, arg, nr_args); +} +#endif /* HAVE_IO_URING_REGISTER */ + + +#ifndef HAVE_IO_URING_SETUP +int io_uring_setup(unsigned int entries, struct io_uring_params *p) +{ + return tst_syscall(__NR_io_uring_setup, entries, p); +} +#endif /* HAVE_IO_URING_SETUP */ + +#ifndef HAVE_IO_URING_ENTER +int io_uring_enter(int fd, unsigned int to_submit, unsigned int min_complete, + unsigned int flags, sigset_t *sig) +{ + return tst_syscall(__NR_io_uring_enter, fd, to_submit, min_complete, + flags, sig, _NSIG / 8); +} +#endif /* HAVE_IO_URING_ENTER */ + +#endif /* IO_URING_H__ */ diff --git a/fsstress/include/lapi/ioctl.h b/fsstress/include/lapi/ioctl.h new file mode 100644 index 0000000000..ecd2502907 --- /dev/null +++ b/fsstress/include/lapi/ioctl.h @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2020 Cyril Hrubis + * Copyright (c) 2020 Petr Vorel + */ + +#ifndef IOCTL_H__ +#define IOCTL_H__ + +#include "config.h" +#include + +/* musl not including it in */ +#include + +#ifndef TIOCVHANGUP +# define TIOCVHANGUP 0x5437 +#endif + +#ifndef HAVE_STRUCT_TERMIO +# ifndef NCC +# ifdef __powerpc__ +# define NCC 10 +# else +# define NCC 8 +# endif +# endif /* NCC */ + +struct termio + { + unsigned short int c_iflag; /* input mode flags */ + unsigned short int c_oflag; /* output mode flags */ + unsigned short int c_cflag; /* control mode flags */ + unsigned short int c_lflag; /* local mode flags */ + unsigned char c_line; /* line discipline */ + unsigned char c_cc[NCC]; /* control characters */ +}; +#endif /* HAVE_STRUCT_TERMIO */ + +#endif /* IOCTL_H__ */ diff --git a/fsstress/include/lapi/ioctl_ns.h b/fsstress/include/lapi/ioctl_ns.h new file mode 100644 index 0000000000..2fb4f4cfb5 --- /dev/null +++ b/fsstress/include/lapi/ioctl_ns.h @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 Federico Bonfiglio fedebonfi95@gmail.com + */ + +#ifndef IOCTL_NS_H__ +#define IOCTL_NS_H__ + +#include + +#ifndef NSIO +#define NSIO 0xb7 +#endif +#ifndef NS_GET_PARENT +#define NS_GET_PARENT _IO(NSIO, 0x2) +#endif +#ifndef NS_GET_OWNER_UID +#define NS_GET_OWNER_UID _IO(NSIO, 0x4) +#endif +#ifndef NS_GET_USERNS +#define NS_GET_USERNS _IO(NSIO, 0x1) +#endif +#ifndef NS_GET_NSTYPE +#define NS_GET_NSTYPE _IO(NSIO, 0x3) +#endif + + +#endif /* IOCTL_NS_H__ */ diff --git a/fsstress/include/lapi/iovec.h b/fsstress/include/lapi/iovec.h new file mode 100644 index 0000000000..d479e9f850 --- /dev/null +++ b/fsstress/include/lapi/iovec.h @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2014 Cyril Hrubis + */ + +#ifndef IOVEC_H +#define IOVEC_H + +#include "config.h" + +#if !defined(HAVE_STRUCT_IOVEC) +struct iovec { + void *iov_base; + size_t iov_len; +}; +#else +# include +#endif + +#endif /* IOVEC_H */ diff --git a/fsstress/include/lapi/ipcbuf.h b/fsstress/include/lapi/ipcbuf.h new file mode 100644 index 0000000000..a0b8e3ce32 --- /dev/null +++ b/fsstress/include/lapi/ipcbuf.h @@ -0,0 +1,195 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2020 Linaro Limited. All rights reserved. + * Author: Viresh Kumar + */ + +#ifndef IPCBUF_H +#define IPCBUF_H + +#include "config.h" +#include "lapi/posix_types.h" + +#ifndef HAVE_IPC64_PERM + +#if defined(__hppa__) +#define HAVE_IPC64_PERM +/* + * The ipc64_perm structure for PA-RISC is almost identical to + * kern_ipc_perm as we have always had 32-bit UIDs and GIDs in the kernel. + * 'seq' has been changed from long to int so that it's the same size + * on 64-bit kernels as on 32-bit ones. + */ + +struct ipc64_perm +{ + __kernel_key_t key; + __kernel_uid_t uid; + __kernel_gid_t gid; + __kernel_uid_t cuid; + __kernel_gid_t cgid; +#if __BITS_PER_LONG != 64 + unsigned short int __pad1; +#endif + __kernel_mode_t mode; + unsigned short int __pad2; + unsigned short int seq; + unsigned int __pad3; + unsigned long long int __unused1; + unsigned long long int __unused2; +}; +#endif /* __hppa__ */ + +#if defined(__powerpc__) || defined(__powerpc64__) +#define HAVE_IPC64_PERM +/* + * The ipc64_perm structure for the powerpc is identical to + * kern_ipc_perm as we have always had 32-bit UIDs and GIDs in the + * kernel. Note extra padding because this structure is passed back + * and forth between kernel and user space. Pad space is left for: + * - 1 32-bit value to fill up for 8-byte alignment + * - 2 miscellaneous 64-bit values + */ + +struct ipc64_perm +{ + __kernel_key_t key; + __kernel_uid_t uid; + __kernel_gid_t gid; + __kernel_uid_t cuid; + __kernel_gid_t cgid; + __kernel_mode_t mode; + unsigned int seq; + unsigned int __pad1; + unsigned long long __unused1; + unsigned long long __unused2; +}; + +#endif /* defined(__powerpc__) || defined(__powerpc64__) */ + +#if defined(__s390__) +#define HAVE_IPC64_PERM +/* + * The user_ipc_perm structure for S/390 architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 32-bit mode_t and seq + * - 2 miscellaneous 32-bit values + */ + +struct ipc64_perm +{ + __kernel_key_t key; + __kernel_uid32_t uid; + __kernel_gid32_t gid; + __kernel_uid32_t cuid; + __kernel_gid32_t cgid; + __kernel_mode_t mode; + unsigned short __pad1; + unsigned short seq; +#ifndef __s390x__ + unsigned short __pad2; +#endif /* ! __s390x__ */ + unsigned long __unused1; + unsigned long __unused2; +}; + +#endif /* defined(__powerpc__) || defined(__powerpc64__) */ + +#if defined(__sparc__) +#define HAVE_IPC64_PERM +/* + * The ipc64_perm structure for sparc/sparc64 architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 32-bit seq + * - on sparc for 32 bit mode (it is 32 bit on sparc64) + * - 2 miscellaneous 64-bit values + */ + +struct ipc64_perm +{ + __kernel_key_t key; + __kernel_uid32_t uid; + __kernel_gid32_t gid; + __kernel_uid32_t cuid; + __kernel_gid32_t cgid; +#ifndef __arch64__ + unsigned short __pad0; +#endif + __kernel_mode_t mode; + unsigned short __pad1; + unsigned short seq; + unsigned long long __unused1; + unsigned long long __unused2; +}; + +#endif /* __sparc__ */ + +#if defined(__xtensa__) +#define HAVE_IPC64_PERM +/* + * Pad space is left for: + * - 32-bit mode_t and seq + * - 2 miscellaneous 32-bit values + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file "COPYING" in the main directory of + * this archive for more details. + */ + +struct ipc64_perm +{ + __kernel_key_t key; + __kernel_uid32_t uid; + __kernel_gid32_t gid; + __kernel_uid32_t cuid; + __kernel_gid32_t cgid; + __kernel_mode_t mode; + unsigned long seq; + unsigned long __unused1; + unsigned long __unused2; +}; + +#endif /* __xtensa__ */ + +#ifndef HAVE_IPC64_PERM +/* + * The generic ipc64_perm structure: + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * ipc64_perm was originally meant to be architecture specific, but + * everyone just ended up making identical copies without specific + * optimizations, so we may just as well all use the same one. + * + * Pad space is left for: + * - 32-bit mode_t on architectures that only had 16 bit + * - 32-bit seq + * - 2 miscellaneous 32-bit values + */ + +struct ipc64_perm { + __kernel_key_t key; + __kernel_uid32_t uid; + __kernel_gid32_t gid; + __kernel_uid32_t cuid; + __kernel_gid32_t cgid; + __kernel_mode_t mode; + /* pad if mode_t is u16: */ + unsigned char __pad1[4 - sizeof(__kernel_mode_t)]; + unsigned short seq; + unsigned short __pad2; + __kernel_ulong_t __unused1; + __kernel_ulong_t __unused2; +}; + +#endif /* ipc64_perm */ + +#endif /* HAVE_IPC64_PERM */ + +#endif /* IPCBUF_H */ diff --git a/fsstress/include/lapi/keyctl.h b/fsstress/include/lapi/keyctl.h new file mode 100644 index 0000000000..c53876e961 --- /dev/null +++ b/fsstress/include/lapi/keyctl.h @@ -0,0 +1,178 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2017 Cyril Hrubis + */ + +#ifndef KEYCTL_H__ +#define KEYCTL_H__ + +#include "config.h" + +#if defined(HAVE_KEYUTILS_H) && defined(HAVE_LIBKEYUTILS) +# include +#else +# ifdef HAVE_LINUX_KEYCTL_H +# include +# endif /* HAVE_LINUX_KEYCTL_H */ + +# include +# include +# include "lapi/syscalls.h" +typedef int32_t key_serial_t; + +static inline key_serial_t add_key(const char *type, + const char *description, + const void *payload, + size_t plen, + key_serial_t ringid) +{ + return tst_syscall(__NR_add_key, + type, description, payload, plen, ringid); +} + +static inline key_serial_t request_key(const char *type, + const char *description, + const char *callout_info, + key_serial_t destringid) +{ + return tst_syscall(__NR_request_key, + type, description, callout_info, destringid); +} + +static inline long keyctl(int cmd, ...) +{ + va_list va; + unsigned long arg2, arg3, arg4, arg5; + + va_start(va, cmd); + arg2 = va_arg(va, unsigned long); + arg3 = va_arg(va, unsigned long); + arg4 = va_arg(va, unsigned long); + arg5 = va_arg(va, unsigned long); + va_end(va); + + return tst_syscall(__NR_keyctl, cmd, arg2, arg3, arg4, arg5); +} + +static inline key_serial_t keyctl_join_session_keyring(const char *name) { + return keyctl(KEYCTL_JOIN_SESSION_KEYRING, name); +} + +#endif /* defined(HAVE_KEYUTILS_H) && defined(HAVE_LIBKEYUTILS) */ + +/* special process keyring shortcut IDs */ +#ifndef KEY_SPEC_THREAD_KEYRING +# define KEY_SPEC_THREAD_KEYRING -1 +#endif + +#ifndef KEY_SPEC_PROCESS_KEYRING +# define KEY_SPEC_PROCESS_KEYRING -2 +#endif + +#ifndef KEY_SPEC_SESSION_KEYRING +# define KEY_SPEC_SESSION_KEYRING -3 +#endif + +#ifndef KEY_SPEC_USER_KEYRING +# define KEY_SPEC_USER_KEYRING -4 +#endif + + +#ifndef KEY_SPEC_USER_SESSION_KEYRING +# define KEY_SPEC_USER_SESSION_KEYRING -5 +#endif + +/* request-key default keyrings */ +#ifndef KEY_REQKEY_DEFL_THREAD_KEYRING +# define KEY_REQKEY_DEFL_THREAD_KEYRING 1 +#endif + +#ifndef KEY_REQKEY_DEFL_SESSION_KEYRING +# define KEY_REQKEY_DEFL_SESSION_KEYRING 3 +#endif + +#ifndef KEY_REQKEY_DEFL_DEFAULT +# define KEY_REQKEY_DEFL_DEFAULT 0 +#endif + +/* keyctl commands */ +#ifndef KEYCTL_GET_KEYRING_ID +# define KEYCTL_GET_KEYRING_ID 0 +#endif + +#ifndef KEYCTL_JOIN_SESSION_KEYRING +# define KEYCTL_JOIN_SESSION_KEYRING 1 +#endif + +#ifndef KEYCTL_UPDATE +# define KEYCTL_UPDATE 2 +#endif + +#ifndef KEYCTL_REVOKE +# define KEYCTL_REVOKE 3 +#endif + +#ifndef KEYCTL_SETPERM +# define KEYCTL_SETPERM 5 +#endif + +#ifndef KEYCTL_CLEAR +# define KEYCTL_CLEAR 7 +#endif + +#ifndef KEYCTL_UNLINK +# define KEYCTL_UNLINK 9 +#endif + +#ifndef KEYCTL_READ +# define KEYCTL_READ 11 +#endif + +#ifndef KEYCTL_SET_REQKEY_KEYRING +# define KEYCTL_SET_REQKEY_KEYRING 14 +#endif + +#ifndef KEYCTL_SET_TIMEOUT +# define KEYCTL_SET_TIMEOUT 15 +#endif + +#ifndef KEYCTL_INVALIDATE +# define KEYCTL_INVALIDATE 21 +#endif + +/* key permissions */ +#ifndef KEY_POS_VIEW +# define KEY_POS_VIEW 0x01000000 +# define KEY_POS_READ 0x02000000 +# define KEY_POS_WRITE 0x04000000 +# define KEY_POS_SEARCH 0x08000000 +# define KEY_POS_LINK 0x10000000 +# define KEY_POS_SETATTR 0x20000000 +# define KEY_POS_ALL 0x3f000000 + +# define KEY_USR_VIEW 0x00010000 +# define KEY_USR_READ 0x00020000 +# define KEY_USR_WRITE 0x00040000 +# define KEY_USR_SEARCH 0x00080000 +# define KEY_USR_LINK 0x00100000 +# define KEY_USR_SETATTR 0x00200000 +# define KEY_USR_ALL 0x003f0000 + +# define KEY_GRP_VIEW 0x00000100 +# define KEY_GRP_READ 0x00000200 +# define KEY_GRP_WRITE 0x00000400 +# define KEY_GRP_SEARCH 0x00000800 +# define KEY_GRP_LINK 0x00001000 +# define KEY_GRP_SETATTR 0x00002000 +# define KEY_GRP_ALL 0x00003f00 + +# define KEY_OTH_VIEW 0x00000001 +# define KEY_OTH_READ 0x00000002 +# define KEY_OTH_WRITE 0x00000004 +# define KEY_OTH_SEARCH 0x00000008 +# define KEY_OTH_LINK 0x00000010 +# define KEY_OTH_SETATTR 0x00000020 +# define KEY_OTH_ALL 0x0000003f +#endif /* !KEY_POS_VIEW */ + +#endif /* KEYCTL_H__ */ diff --git a/fsstress/include/lapi/loop.h b/fsstress/include/lapi/loop.h new file mode 100644 index 0000000000..87a9023175 --- /dev/null +++ b/fsstress/include/lapi/loop.h @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved. + * Author: Yang Xu + */ +#ifndef LAPI_LOOP_H +#define LAPI_LOOP_H + +#include "config.h" +#include +#include + +#ifndef LO_FLAGS_PARTSCAN +# define LO_FLAGS_PARTSCAN 8 +#endif + +#ifndef LO_FLAGS_DIRECT_IO +# define LO_FLAGS_DIRECT_IO 16 +#endif + +#ifndef LOOP_SET_CAPACITY +# define LOOP_SET_CAPACITY 0x4C07 +#endif + +#ifndef LOOP_SET_DIRECT_IO +# define LOOP_SET_DIRECT_IO 0x4C08 +#endif + +#ifndef LOOP_SET_BLOCK_SIZE +# define LOOP_SET_BLOCK_SIZE 0x4C09 +#endif + +#ifndef LOOP_CONFIGURE +# define LOOP_CONFIGURE 0x4C0A +#endif + +#ifndef HAVE_STRUCT_LOOP_CONFIG +/* + * struct loop_config - Complete configuration for a loop device. + * @fd: fd of the file to be used as a backing file for the loop device. + * @block_size: block size to use; ignored if 0. + * @info: struct loop_info64 to configure the loop device with. + * + * This structure is used with the LOOP_CONFIGURE ioctl, and can be used to + * atomically setup and configure all loop device parameters at once. + */ +struct loop_config { + __u32 fd; + __u32 block_size; + struct loop_info64 info; + __u64 __reserved[8]; +}; +#endif + +#endif diff --git a/fsstress/include/lapi/membarrier.h b/fsstress/include/lapi/membarrier.h new file mode 100644 index 0000000000..2b6c57fb35 --- /dev/null +++ b/fsstress/include/lapi/membarrier.h @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2018 Linaro Limited. All rights reserved. + * Author: Rafael David Tinoco + */ + +#ifndef LAPI_MEMBARRIER_H +#define LAPI_MEMBARRIER_H + +/* + * Having is enough to know if the test should run or + * not, but it might not define all needed MEMBARRIER_CMD_* being tested, + * since its first versions included just a few commands. + */ + +enum membarrier_cmd { + MEMBARRIER_CMD_QUERY = 0, + MEMBARRIER_CMD_GLOBAL = (1 << 0), + MEMBARRIER_CMD_GLOBAL_EXPEDITED = (1 << 1), + MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED = (1 << 2), + MEMBARRIER_CMD_PRIVATE_EXPEDITED = (1 << 3), + MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED = (1 << 4), + MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE = (1 << 5), + MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE = (1 << 6), + + /* Alias for header backward compatibility. */ + MEMBARRIER_CMD_SHARED = MEMBARRIER_CMD_GLOBAL, +}; + +#endif diff --git a/fsstress/include/lapi/memfd.h b/fsstress/include/lapi/memfd.h new file mode 100644 index 0000000000..e38e671bb0 --- /dev/null +++ b/fsstress/include/lapi/memfd.h @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2017 Red Hat, Inc. + */ + +#ifndef LAPI_MEMFD_H +#define LAPI_MEMFD_H + +/* flags for memfd_create(2) (unsigned int) */ +#ifndef MFD_CLOEXEC +# define MFD_CLOEXEC 0x0001U +#endif +#ifndef MFD_ALLOW_SEALING +# define MFD_ALLOW_SEALING 0x0002U +#endif + +/* flags for memfd_create(3) and memfd_create(4) */ +#ifndef MFD_HUGETLB +#define MFD_HUGETLB 0x0004U +#endif + +#ifndef MFD_HUGE_64KB +#define MFD_HUGE_64KB (16 << 26) +#endif +#ifndef MFD_HUGE_512KB +#define MFD_HUGE_512KB (19 << 26) +#endif +#ifndef MFD_HUGE_2MB +#define MFD_HUGE_2MB (21 << 26) +#endif +#ifndef MFD_HUGE_8MB +#define MFD_HUGE_8MB (23 << 26) +#endif +#ifndef MFD_HUGE_16MB +#define MFD_HUGE_16MB (24 << 26) +#endif +#ifndef MFD_HUGE_256MB +#define MFD_HUGE_256MB (28 << 26) +#endif +#ifndef MFD_HUGE_1GB +#define MFD_HUGE_1GB (30 << 26) +#endif +#ifndef MFD_HUGE_2GB +#define MFD_HUGE_2GB (31 << 26) +#endif +#ifndef MFD_HUGE_16GB +#define MFD_HUGE_16GB (34 << 26) +#endif + +#endif diff --git a/fsstress/include/lapi/mkdirat.h b/fsstress/include/lapi/mkdirat.h new file mode 100644 index 0000000000..bb8c6d8695 --- /dev/null +++ b/fsstress/include/lapi/mkdirat.h @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2014 Cyril Hrubis + */ + +#ifndef __MKDIRAT_H__ +#define __MKDIRAT_H__ + +#include "config.h" +#include "lapi/syscalls.h" +#include "lapi/fcntl.h" + +#ifndef HAVE_MKDIRAT +int mkdirat(int dirfd, const char *dirname, int mode) +{ + return ltp_syscall(__NR_mkdirat, dirfd, dirname, mode); +} +#endif + +#endif /* __MKDIRAT_H__ */ diff --git a/fsstress/include/lapi/mlock2.h b/fsstress/include/lapi/mlock2.h new file mode 100644 index 0000000000..fa2b2de07c --- /dev/null +++ b/fsstress/include/lapi/mlock2.h @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. + * Author: Xiao Yang + */ + +#ifndef LAPI_MLOCK2_H__ +# define LAPI_MLOCK2_H__ + +#include + +#ifndef MLOCK_ONFAULT +# define MLOCK_ONFAULT 0x01 +#endif + +#endif /* LAPI_MLOCK2_H__ */ diff --git a/fsstress/include/lapi/mmap.h b/fsstress/include/lapi/mmap.h new file mode 100644 index 0000000000..12845b76ed --- /dev/null +++ b/fsstress/include/lapi/mmap.h @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2015 Fujitsu Ltd. + * Author: Guangwen Feng + */ + +#ifndef LAPI_MMAP_H__ +#define LAPI_MMAP_H__ + +#include "config.h" + +#ifndef MAP_HUGETLB +# define MAP_HUGETLB 0x40000 +#endif + +#ifndef MADV_REMOVE +# define MADV_REMOVE 9 +#endif + +#ifndef MADV_DONTFORK +# define MADV_DONTFORK 10 +#endif + +#ifndef MADV_DOFORK +# define MADV_DOFORK 11 +#endif + +#ifndef MADV_HWPOISON +# define MADV_HWPOISON 100 +#endif + +#ifndef MADV_SOFT_OFFLINE +# define MADV_SOFT_OFFLINE 101 +#endif + +#ifndef MADV_MERGEABLE +# define MADV_MERGEABLE 12 +#endif + +#ifndef MADV_UNMERGEABLE +# define MADV_UNMERGEABLE 13 +#endif + +#ifndef MADV_HUGEPAGE +# define MADV_HUGEPAGE 14 +#endif + +#ifndef MADV_NOHUGEPAGE +# define MADV_NOHUGEPAGE 15 +#endif + +#ifndef MADV_DONTDUMP +# define MADV_DONTDUMP 16 +#endif + +#ifndef MADV_DODUMP +# define MADV_DODUMP 17 +#endif + +#ifndef MADV_FREE +# define MADV_FREE 8 +#endif + +#ifndef MADV_WIPEONFORK +# define MADV_WIPEONFORK 18 +# define MADV_KEEPONFORK 19 +#endif + +#ifndef MAP_FIXED_NOREPLACE + +#ifdef __alpha__ +# define MAP_FIXED_NOREPLACE 0x200000 +#else +# define MAP_FIXED_NOREPLACE 0x100000 +#endif + +#endif /* MAP_FIXED_NOREPLACE */ + +#ifdef HAVE_SYS_SHM_H +# include +# define MMAP_GRANULARITY SHMLBA +#else +# include +# define MMAP_GRANULARITY getpagesize() +#endif /* HAVE_SYS_SHM_H */ + +#endif /* LAPI_MMAP_H__ */ diff --git a/fsstress/include/lapi/mount.h b/fsstress/include/lapi/mount.h new file mode 100644 index 0000000000..b8ae1f5946 --- /dev/null +++ b/fsstress/include/lapi/mount.h @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2015 Cui Bixuan + */ + +#ifndef __MOUNT_H__ +#define __MOUNT_H__ + +#ifndef MS_REC +#define MS_REC 16384 +#endif + +#ifndef MS_PRIVATE +#define MS_PRIVATE (1<<18) +#endif + +#ifndef MS_STRICTATIME +#define MS_STRICTATIME (1 << 24) +#endif + +#ifndef MNT_DETACH +#define MNT_DETACH 2 +#endif + +#ifndef MNT_EXPIRE +#define MNT_EXPIRE 4 +#endif + +#ifndef UMOUNT_NOFOLLOW +#define UMOUNT_NOFOLLOW 8 +#endif + +#endif /* __MOUNT_H__ */ diff --git a/fsstress/include/lapi/msgbuf.h b/fsstress/include/lapi/msgbuf.h new file mode 100644 index 0000000000..f3277270dd --- /dev/null +++ b/fsstress/include/lapi/msgbuf.h @@ -0,0 +1,306 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2020 Linaro Limited. All rights reserved. + * Author: Viresh Kumar + */ + +#ifndef IPC_MSGBUF_H +#define IPC_MSGBUF_H + +#include "lapi/posix_types.h" +#include +#include "tst_timer.h" +#include "ipcbuf.h" + +#ifndef HAVE_MSQID64_DS + +#if defined(__mips__) +#define HAVE_MSQID64_DS + +#if defined(__arch64__) +/* + * The msqid64_ds structure for the MIPS architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 2 miscellaneous unsigned long values + */ + +struct msqid64_ds { + struct ipc64_perm msg_perm; + long msg_stime; /* last msgsnd time */ + long msg_rtime; /* last msgrcv time */ + long msg_ctime; /* last change time */ + unsigned long msg_cbytes; /* current number of bytes on queue */ + unsigned long msg_qnum; /* number of messages in queue */ + unsigned long msg_qbytes; /* max number of bytes on queue */ + __kernel_pid_t msg_lspid; /* pid of last msgsnd */ + __kernel_pid_t msg_lrpid; /* last receive pid */ + unsigned long __unused4; + unsigned long __unused5; +}; +#elif defined (__MIPSEB__) +#define HAVE_MSQID64_DS_TIME_HIGH +struct msqid64_ds { + struct ipc64_perm msg_perm; + unsigned long msg_stime_high; + unsigned long msg_stime; /* last msgsnd time */ + unsigned long msg_rtime_high; + unsigned long msg_rtime; /* last msgrcv time */ + unsigned long msg_ctime_high; + unsigned long msg_ctime; /* last change time */ + unsigned long msg_cbytes; /* current number of bytes on queue */ + unsigned long msg_qnum; /* number of messages in queue */ + unsigned long msg_qbytes; /* max number of bytes on queue */ + __kernel_pid_t msg_lspid; /* pid of last msgsnd */ + __kernel_pid_t msg_lrpid; /* last receive pid */ + unsigned long __unused4; + unsigned long __unused5; +}; +#elif defined (__MIPSEL__) +#define HAVE_MSQID64_DS_TIME_HIGH +struct msqid64_ds { + struct ipc64_perm msg_perm; + unsigned long msg_stime; /* last msgsnd time */ + unsigned long msg_stime_high; + unsigned long msg_rtime; /* last msgrcv time */ + unsigned long msg_rtime_high; + unsigned long msg_ctime; /* last change time */ + unsigned long msg_ctime_high; + unsigned long msg_cbytes; /* current number of bytes on queue */ + unsigned long msg_qnum; /* number of messages in queue */ + unsigned long msg_qbytes; /* max number of bytes on queue */ + __kernel_pid_t msg_lspid; /* pid of last msgsnd */ + __kernel_pid_t msg_lrpid; /* last receive pid */ + unsigned long __unused4; + unsigned long __unused5; +}; +#endif + +#endif /* __mips__ */ + +#if defined(__hppa__) +#define HAVE_MSQID64_DS +/* + * The msqid64_ds structure for parisc architecture, copied from sparc. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 2 miscellaneous 32-bit values + */ + +struct msqid64_ds { + struct ipc64_perm msg_perm; +#if __BITS_PER_LONG == 64 + long msg_stime; /* last msgsnd time */ + long msg_rtime; /* last msgrcv time */ + long msg_ctime; /* last change time */ +#else +#define HAVE_MSQID64_DS_TIME_HIGH + unsigned long msg_stime_high; + unsigned long msg_stime; /* last msgsnd time */ + unsigned long msg_rtime_high; + unsigned long msg_rtime; /* last msgrcv time */ + unsigned long msg_ctime_high; + unsigned long msg_ctime; /* last change time */ +#endif + unsigned long msg_cbytes; /* current number of bytes on queue */ + unsigned long msg_qnum; /* number of messages in queue */ + unsigned long msg_qbytes; /* max number of bytes on queue */ + __kernel_pid_t msg_lspid; /* pid of last msgsnd */ + __kernel_pid_t msg_lrpid; /* last receive pid */ + unsigned long __unused1; + unsigned long __unused2; +}; + +#endif /* __hppa__ */ + +#if defined(__powerpc__) || defined(__powerpc64__) +#define HAVE_MSQID64_DS +/* + * The msqid64_ds structure for the PowerPC architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + */ + +struct msqid64_ds { + struct ipc64_perm msg_perm; +#ifdef __powerpc64__ + long msg_stime; /* last msgsnd time */ + long msg_rtime; /* last msgrcv time */ + long msg_ctime; /* last change time */ +#else +#define HAVE_MSQID64_DS_TIME_HIGH + unsigned long msg_stime_high; + unsigned long msg_stime; /* last msgsnd time */ + unsigned long msg_rtime_high; + unsigned long msg_rtime; /* last msgrcv time */ + unsigned long msg_ctime_high; + unsigned long msg_ctime; /* last change time */ +#endif + unsigned long msg_cbytes; /* current number of bytes on queue */ + unsigned long msg_qnum; /* number of messages in queue */ + unsigned long msg_qbytes; /* max number of bytes on queue */ + __kernel_pid_t msg_lspid; /* pid of last msgsnd */ + __kernel_pid_t msg_lrpid; /* last receive pid */ + unsigned long __unused4; + unsigned long __unused5; +}; + +#endif /* defined(__powerpc__) || defined(__powerpc64__) */ + +#if defined(__sparc__) +#define HAVE_MSQID64_DS +/* + * The msqid64_ds structure for sparc64 architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 2 miscellaneous 32-bit values + */ +struct msqid64_ds { + struct ipc64_perm msg_perm; +#if defined(__arch64__) + long msg_stime; /* last msgsnd time */ + long msg_rtime; /* last msgrcv time */ + long msg_ctime; /* last change time */ +#else +#define HAVE_MSQID64_DS_TIME_HIGH + unsigned long msg_stime_high; + unsigned long msg_stime; /* last msgsnd time */ + unsigned long msg_rtime_high; + unsigned long msg_rtime; /* last msgrcv time */ + unsigned long msg_ctime_high; + unsigned long msg_ctime; /* last change time */ +#endif + unsigned long msg_cbytes; /* current number of bytes on queue */ + unsigned long msg_qnum; /* number of messages in queue */ + unsigned long msg_qbytes; /* max number of bytes on queue */ + __kernel_pid_t msg_lspid; /* pid of last msgsnd */ + __kernel_pid_t msg_lrpid; /* last receive pid */ + unsigned long __unused1; + unsigned long __unused2; +}; + +#endif /* __sparc__ */ + +#if defined(__x86_64__) && defined(__ILP32__) +#define HAVE_MSQID64_DS +/* + * The msqid64_ds structure for x86 architecture with x32 ABI. + * + * On x86-32 and x86-64 we can just use the generic definition, but + * x32 uses the same binary layout as x86_64, which is differnet + * from other 32-bit architectures. + */ + +struct msqid64_ds { + struct ipc64_perm msg_perm; + __kernel_long_t msg_stime; /* last msgsnd time */ + __kernel_long_t msg_rtime; /* last msgrcv time */ + __kernel_long_t msg_ctime; /* last change time */ + __kernel_ulong_t msg_cbytes; /* current number of bytes on queue */ + __kernel_ulong_t msg_qnum; /* number of messages in queue */ + __kernel_ulong_t msg_qbytes; /* max number of bytes on queue */ + __kernel_pid_t msg_lspid; /* pid of last msgsnd */ + __kernel_pid_t msg_lrpid; /* last receive pid */ + __kernel_ulong_t __unused4; + __kernel_ulong_t __unused5; +}; + +#endif /* defined(__x86_64__) && defined(__ILP32__) */ + +#if defined(__xtensa__) +#define HAVE_MSQID64_DS +/* + * The msqid64_ds structure for the Xtensa architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 2 miscellaneous 32-bit values + */ + +struct msqid64_ds { + struct ipc64_perm msg_perm; +#ifdef __XTENSA_EB__ +#define HAVE_MSQID64_DS_TIME_HIGH + unsigned long msg_stime_high; + unsigned long msg_stime; /* last msgsnd time */ + unsigned long msg_rtime_high; + unsigned long msg_rtime; /* last msgrcv time */ + unsigned long msg_ctime_high; + unsigned long msg_ctime; /* last change time */ +#elif defined(__XTENSA_EL__) +#define HAVE_MSQID64_DS_TIME_HIGH + unsigned long msg_stime; /* last msgsnd time */ + unsigned long msg_stime_high; + unsigned long msg_rtime; /* last msgrcv time */ + unsigned long msg_rtime_high; + unsigned long msg_ctime; /* last change time */ + unsigned long msg_ctime_high; +#else +# error processor byte order undefined! +#endif + unsigned long msg_cbytes; /* current number of bytes on queue */ + unsigned long msg_qnum; /* number of messages in queue */ + unsigned long msg_qbytes; /* max number of bytes on queue */ + __kernel_pid_t msg_lspid; /* pid of last msgsnd */ + __kernel_pid_t msg_lrpid; /* last receive pid */ + unsigned long __unused4; + unsigned long __unused5; +}; + +#endif /* __xtensa__ */ + +#ifndef HAVE_MSQID64_DS +/* + * generic msqid64_ds structure. + * + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * msqid64_ds was originally meant to be architecture specific, but + * everyone just ended up making identical copies without specific + * optimizations, so we may just as well all use the same one. + * + * 64 bit architectures use a 64-bit long time field here, while + * 32 bit architectures have a pair of unsigned long values. + * On big-endian systems, the lower half is in the wrong place. + * + * Pad space is left for: + * - 2 miscellaneous 32-bit values + */ + +struct msqid64_ds { + struct ipc64_perm msg_perm; +#if __BITS_PER_LONG == 64 + long msg_stime; /* last msgsnd time */ + long msg_rtime; /* last msgrcv time */ + long msg_ctime; /* last change time */ +#else +#define HAVE_MSQID64_DS_TIME_HIGH + unsigned long msg_stime; /* last msgsnd time */ + unsigned long msg_stime_high; + unsigned long msg_rtime; /* last msgrcv time */ + unsigned long msg_rtime_high; + unsigned long msg_ctime; /* last change time */ + unsigned long msg_ctime_high; +#endif + unsigned long msg_cbytes; /* current number of bytes on queue */ + unsigned long msg_qnum; /* number of messages in queue */ + unsigned long msg_qbytes; /* max number of bytes on queue */ + __kernel_pid_t msg_lspid; /* pid of last msgsnd */ + __kernel_pid_t msg_lrpid; /* last receive pid */ + unsigned long __unused4; + unsigned long __unused5; +}; + +#endif /* msqid64_ds */ + +#endif /* HAVE_MSQID64_DS */ + +#endif /* IPC_MSGBUF_H */ diff --git a/fsstress/include/lapi/namespaces_constants.h b/fsstress/include/lapi/namespaces_constants.h new file mode 100644 index 0000000000..8f73c43026 --- /dev/null +++ b/fsstress/include/lapi/namespaces_constants.h @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2015 Red Hat, Inc. + */ + +#ifndef __NAMESPACES_CONSTANTS_H__ +#define __NAMESPACES_CONSTANTS_H__ + +#ifndef CLONE_NEWIPC +# define CLONE_NEWIPC 0x08000000 +#endif +#ifndef CLONE_NEWNS +# define CLONE_NEWNS 0x00020000 +#endif +#ifndef CLONE_NEWNET +# define CLONE_NEWNET 0x40000000 +#endif +#ifndef CLONE_NEWPID +# define CLONE_NEWPID 0x20000000 +#endif +#ifndef CLONE_NEWUSER +# define CLONE_NEWUSER 0x10000000 +#endif +#ifndef CLONE_NEWUTS +# define CLONE_NEWUTS 0x04000000 +#endif +#ifndef CLONE_NEWTIME +# define CLONE_NEWTIME 0x00000080 +#endif + +#endif /* __NAMESPACES_CONSTANTS_H__ */ diff --git a/fsstress/include/lapi/netinet_in.h b/fsstress/include/lapi/netinet_in.h new file mode 100644 index 0000000000..e88485c5ca --- /dev/null +++ b/fsstress/include/lapi/netinet_in.h @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2017 Petr Vorel + */ + +#ifndef LAPI_IN_H__ +#define LAPI_IN_H__ + +#include + +#ifndef IPPROTO_DCCP +#define IPPROTO_DCCP 33 +#endif + +#ifndef IPPROTO_UDPLITE +# define IPPROTO_UDPLITE 136 /* UDP-Lite (RFC 3828) */ +#endif + +#ifndef IP_BIND_ADDRESS_NO_PORT +# define IP_BIND_ADDRESS_NO_PORT 24 +#endif + +#endif /* LAPI_IN_H__ */ diff --git a/fsstress/include/lapi/openat2.h b/fsstress/include/lapi/openat2.h new file mode 100644 index 0000000000..62da1a04c8 --- /dev/null +++ b/fsstress/include/lapi/openat2.h @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2020 Linaro Limited. All rights reserved. + * Author: Viresh Kumar + */ + +#ifndef OPENAT2_H +#define OPENAT2_H + +#include +#include + +#include "lapi/syscalls.h" + +#include "config.h" + +#ifndef HAVE_OPENAT2 +/* + * Arguments for how openat2(2) should open the target path. If only @flags and + * @mode are non-zero, then openat2(2) operates very similarly to openat(2). + * + * However, unlike openat(2), unknown or invalid bits in @flags result in + * -EINVAL rather than being silently ignored. @mode must be zero unless one of + * {O_CREAT, O_TMPFILE} are set. + * + * @flags: O_* flags. + * @mode: O_CREAT/O_TMPFILE file mode. + * @resolve: RESOLVE_* flags. + */ +struct open_how { + uint64_t flags; + uint64_t mode; + uint64_t resolve; +}; + +/* how->resolve flags for openat2(2). */ +#define RESOLVE_NO_XDEV 0x01 /* Block mount-point crossings + (includes bind-mounts). */ +#define RESOLVE_NO_MAGICLINKS 0x02 /* Block traversal through procfs-style + "magic-links". */ +#define RESOLVE_NO_SYMLINKS 0x04 /* Block traversal through all symlinks + (implies OEXT_NO_MAGICLINKS) */ +#define RESOLVE_BENEATH 0x08 /* Block "lexical" trickery like + "..", symlinks, and absolute + paths which escape the dirfd. */ +#define RESOLVE_IN_ROOT 0x10 /* Make all jumps to "/" and ".." + be scoped inside the dirfd + (similar to chroot(2)). */ + +int openat2(int dfd, const char *pathname, struct open_how *how, size_t size) +{ + return tst_syscall(__NR_openat2, dfd, pathname, how, size); +} +#endif + +struct open_how_pad { + /* how should be kept as the first entry here */ + struct open_how how; + uint64_t pad; +}; + +void openat2_supported_by_kernel(void) +{ + if ((tst_kvercmp(5, 6, 0)) < 0) { + /* Check if the syscall is backported on an older kernel */ + TEST(syscall(__NR_openat2, -1, NULL, NULL, 0)); + if (TST_RET == -1 && TST_ERR == ENOSYS) + tst_brk(TCONF, "Test not supported on kernel version < v5.6"); + } +} + +#endif /* OPENAT2_H */ diff --git a/fsstress/include/lapi/personality.h b/fsstress/include/lapi/personality.h new file mode 100644 index 0000000000..6b4b7ebf36 --- /dev/null +++ b/fsstress/include/lapi/personality.h @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2017 Richard Palethorpe + */ + +/* In the Linux kernel and glibc enums are (mostly) used for the constants, + * but in musl macros are used. + */ + +#ifndef PERSONALITY_H +#define PERSONALITY_H + +#include + +#ifndef UNAME26 +# define UNAME26 0x0020000 +#endif + +#ifndef READ_IMPLIES_EXEC +# define READ_IMPLIES_EXEC 0x0400000 +#endif + +#endif /* PERSONALITY_H */ diff --git a/fsstress/include/lapi/pidfd_open.h b/fsstress/include/lapi/pidfd_open.h new file mode 100644 index 0000000000..9f532f86e1 --- /dev/null +++ b/fsstress/include/lapi/pidfd_open.h @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2020 Linaro Limited. All rights reserved. + * Author: Viresh Kumar + */ + +#ifndef PIDFD_OPEN_H +#define PIDFD_OPEN_H + +#include +#include + +#include "lapi/syscalls.h" + +#include "config.h" + +#ifndef HAVE_PIDFD_OPEN +int pidfd_open(pid_t pid, unsigned int flags) +{ + return tst_syscall(__NR_pidfd_open, pid, flags); +} +#endif + +#endif /* PIDFD_OPEN_H */ diff --git a/fsstress/include/lapi/pidfd_send_signal.h b/fsstress/include/lapi/pidfd_send_signal.h new file mode 100644 index 0000000000..8352d2adf7 --- /dev/null +++ b/fsstress/include/lapi/pidfd_send_signal.h @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 SUSE LLC + * Author: Christian Amann + */ + +#ifndef PIDFD_SEND_SIGNAL_H +#define PIDFD_SEND_SIGNAL_H + +#include "tst_test.h" +#include "lapi/syscalls.h" + +static inline void pidfd_send_signal_supported(void) +{ + /* allow the tests to fail early */ + tst_syscall(__NR_pidfd_send_signal); +} + +#ifndef HAVE_PIDFD_SEND_SIGNAL +static int pidfd_send_signal(int pidfd, int sig, siginfo_t *info, + unsigned int flags) +{ + return tst_syscall(__NR_pidfd_send_signal, pidfd, sig, info, flags); +} +#endif /* HAVE_PIDFD_SEND_SIGNAL */ + +#endif /* PIDFD_SEND_SIGNAL_H */ diff --git a/fsstress/include/lapi/posix_clocks.h b/fsstress/include/lapi/posix_clocks.h new file mode 100644 index 0000000000..ae2139fe3a --- /dev/null +++ b/fsstress/include/lapi/posix_clocks.h @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019, Linux Test Project + * Copyright (c) 2013 Cyril Hrubis + */ + +#include + +#ifndef POSIX_CLOCKS_H__ +#define POSIX_CLOCKS_H__ + +#define MAX_CLOCKS 16 + +#ifndef CLOCK_MONOTONIC_RAW +# define CLOCK_MONOTONIC_RAW 4 +#endif + +#ifndef CLOCK_REALTIME_COARSE +# define CLOCK_REALTIME_COARSE 5 +#endif + +#ifndef CLOCK_MONOTONIC_COARSE +# define CLOCK_MONOTONIC_COARSE 6 +#endif + +#ifndef CLOCK_BOOTTIME +# define CLOCK_BOOTTIME 7 +#endif + +#ifndef CLOCK_REALTIME_ALARM +# define CLOCK_REALTIME_ALARM 8 +#endif + +#ifndef CLOCK_BOOTTIME_ALARM +# define CLOCK_BOOTTIME_ALARM 9 +#endif + +#ifndef CLOCK_TAI +#define CLOCK_TAI 11 +#endif + +#endif /* POSIX_CLOCKS_H__ */ diff --git a/fsstress/include/lapi/posix_types.h b/fsstress/include/lapi/posix_types.h new file mode 100644 index 0000000000..9c0947cca6 --- /dev/null +++ b/fsstress/include/lapi/posix_types.h @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) Linux Test Project, 2014-2019 + */ + +#ifndef POSIX_TYPES_H__ +#define POSIX_TYPES_H__ + +#include + +#ifndef __kernel_long_t +# if defined(__x86_64__) && defined(__ILP32__) +typedef long long __kernel_long_t; +typedef unsigned long long __kernel_ulong_t; +# else +typedef long __kernel_long_t; +typedef unsigned long __kernel_ulong_t; +# endif +#endif + +#endif /* POSIX_TYPES_H__ */ diff --git a/fsstress/include/lapi/prctl.h b/fsstress/include/lapi/prctl.h new file mode 100644 index 0000000000..4499df0302 --- /dev/null +++ b/fsstress/include/lapi/prctl.h @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. + * Author: Xiao Yang + */ + +#ifndef LAPI_PRCTL_H__ +# define LAPI_PRCTL_H__ + +#include + +#ifndef PR_SET_NAME +# define PR_SET_NAME 15 +# define PR_GET_NAME 16 +#endif + +#ifndef PR_SET_SECCOMP +# define PR_GET_SECCOMP 21 +# define PR_SET_SECCOMP 22 +#endif + +#ifndef PR_SET_TIMERSLACK +# define PR_SET_TIMERSLACK 29 +# define PR_GET_TIMERSLACK 30 +#endif + +#ifndef PR_SET_CHILD_SUBREAPER +# define PR_SET_CHILD_SUBREAPER 36 +# define PR_GET_CHILD_SUBREAPER 37 +#endif + +#ifndef PR_SET_NO_NEW_PRIVS +# define PR_SET_NO_NEW_PRIVS 38 +# define PR_GET_NO_NEW_PRIVS 39 +#endif + +#ifndef PR_SET_THP_DISABLE +# define PR_SET_THP_DISABLE 41 +# define PR_GET_THP_DISABLE 42 +#endif + +#ifndef PR_CAP_AMBIENT +# define PR_CAP_AMBIENT 47 +# define PR_CAP_AMBIENT_IS_SET 1 +# define PR_CAP_AMBIENT_RAISE 2 +# define PR_CAP_AMBIENT_LOWER 3 +# define PR_CAP_AMBIENT_CLEAR_ALL 4 +#endif + +#ifndef PR_GET_SPECULATION_CTRL +# define PR_GET_SPECULATION_CTRL 52 +# define PR_SET_SPECULATION_CTRL 53 +#endif + +#endif /* LAPI_PRCTL_H__ */ diff --git a/fsstress/include/lapi/preadv2.h b/fsstress/include/lapi/preadv2.h new file mode 100644 index 0000000000..538ed72181 --- /dev/null +++ b/fsstress/include/lapi/preadv2.h @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. + * Author: Xiao Yang + */ + +#ifndef PREADV2_H +#define PREADV2_H + +#include "config.h" +#include "lapi/syscalls.h" + +#ifndef RWF_NOWAIT +# define RWF_NOWAIT 0x00000008 +#endif + +#if !defined(HAVE_PREADV2) + +/* LO_HI_LONG taken from glibc */ +# define LO_HI_LONG(val) (long) (val), (long) (((uint64_t) (val)) >> 32) + +ssize_t preadv2(int fd, const struct iovec *iov, int iovcnt, off_t offset, + int flags) +{ + return tst_syscall(__NR_preadv2, fd, iov, iovcnt, + LO_HI_LONG(offset), flags); +} +#endif + +#endif /* PREADV2_H */ diff --git a/fsstress/include/lapi/pwritev2.h b/fsstress/include/lapi/pwritev2.h new file mode 100644 index 0000000000..305e48e028 --- /dev/null +++ b/fsstress/include/lapi/pwritev2.h @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved. + * Author: Jinhui Huang + */ + +#ifndef PWRITEV2_H +#define PWRITEV2_H + +#include "config.h" +#include "lapi/syscalls.h" + +#if !defined(HAVE_PWRITEV2) + +/* LO_HI_LONG taken from glibc */ +# define LO_HI_LONG(val) (long) (val), (long) (((uint64_t) (val)) >> 32) + +ssize_t pwritev2(int fd, const struct iovec *iov, int iovcnt, off_t offset, + int flags) +{ + return tst_syscall(__NR_pwritev2, fd, iov, iovcnt, + LO_HI_LONG(offset), flags); +} +#endif + +#endif /* PWRITEV2_H */ diff --git a/fsstress/include/lapi/quotactl.h b/fsstress/include/lapi/quotactl.h new file mode 100644 index 0000000000..c1ec9d6e1f --- /dev/null +++ b/fsstress/include/lapi/quotactl.h @@ -0,0 +1,78 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2017-2019 Fujitsu Ltd. + * Author: Xiao Yang + * Author: Yang Xu + */ + +#ifndef LAPI_QUOTACTL_H__ +#define LAPI_QUOTACTL_H__ + +#include + +#ifdef HAVE_STRUCT_IF_NEXTDQBLK +# include +#else +# include +struct if_nextdqblk { + uint64_t dqb_bhardlimit; + uint64_t dqb_bsoftlimit; + uint64_t dqb_curspace; + uint64_t dqb_ihardlimit; + uint64_t dqb_isoftlimit; + uint64_t dqb_curinodes; + uint64_t dqb_btime; + uint64_t dqb_itime; + uint32_t dqb_valid; + uint32_t dqb_id; +}; +#endif /* HAVE_STRUCT_IF_NEXTDQBLK */ + +#ifndef HAVE_STRUCT_FS_QUOTA_STATV +# include +struct fs_qfilestatv { + uint64_t qfs_ino; + uint64_t qfs_nblks; + uint32_t qfs_nextents; + uint32_t qfs_pad; +}; + +struct fs_quota_statv { + int8_t qs_version; + uint8_t qs_pad1; + uint16_t qs_flags; + uint32_t qs_incoredqs; + struct fs_qfilestatv qs_uquota; + struct fs_qfilestatv qs_gquota; + struct fs_qfilestatv qs_pquota; + int32_t qs_btimelimit; + int32_t qs_itimelimit; + int32_t qs_rtbtimelimit; + uint16_t qs_bwarnlimit; + uint16_t qs_iwarnlimit; + uint64_t qs_pad2[8]; +}; +# define FS_QSTATV_VERSION1 1 +#endif /* HAVE_STRUCT_FS_QUOTA_STATV */ + +#ifndef PRJQUOTA +# define PRJQUOTA 2 +#endif + +#ifndef Q_XQUOTARM +# define Q_XQUOTARM XQM_CMD(6) +#endif + +#ifndef Q_XGETQSTATV +# define Q_XGETQSTATV XQM_CMD(8) +#endif + +#ifndef Q_XGETNEXTQUOTA +# define Q_XGETNEXTQUOTA XQM_CMD(9) +#endif + +#ifndef Q_GETNEXTQUOTA +# define Q_GETNEXTQUOTA 0x800009 /* get disk limits and usage >= ID */ +#endif + +#endif /* LAPI_QUOTACTL_H__ */ diff --git a/fsstress/include/lapi/readdir.h b/fsstress/include/lapi/readdir.h new file mode 100644 index 0000000000..84e77ae0ab --- /dev/null +++ b/fsstress/include/lapi/readdir.h @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2014 Fujitsu Ltd. + * Author: Zeng Linggang + */ + +#ifndef READDIR_H +#define READDIR_H + +#include + +struct old_linux_dirent { + long d_ino; /* inode number */ + off_t d_off; /* offset to this old_linux_dirent */ + unsigned short d_reclen; /* length of this d_name */ + char d_name[NAME_MAX+1]; /* filename (null-terminated) */ +}; + +#endif /* READDIR_H */ diff --git a/fsstress/include/lapi/readlinkat.h b/fsstress/include/lapi/readlinkat.h new file mode 100644 index 0000000000..5a3a7b2d60 --- /dev/null +++ b/fsstress/include/lapi/readlinkat.h @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2014 Cyril Hrubis + */ + +#ifndef __READLINKAT_H__ +#define __READLINKAT_H__ + +#include "config.h" +#include "lapi/syscalls.h" +#include "lapi/fcntl.h" + +#ifndef HAVE_READLINKAT +int readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz) +{ + return ltp_syscall(__NR_readlinkat, dirfd, pathname, buf, bufsiz); +} +#endif + +#endif /* __READLINKAT_H__ */ diff --git a/fsstress/include/lapi/renameat.h b/fsstress/include/lapi/renameat.h new file mode 100644 index 0000000000..66d3e21401 --- /dev/null +++ b/fsstress/include/lapi/renameat.h @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) International Business Machines Corp., 2007 + * Copyright (c) 2014 Fujitsu Ltd. + */ + +#ifndef RENAMEAT_H +#define RENAMEAT_H + +#include +#include "config.h" +#include "lapi/syscalls.h" + +#if !defined(HAVE_RENAMEAT) +int renameat(int olddirfd, const char *oldpath, int newdirfd, + const char *newpath) +{ + return ltp_syscall(__NR_renameat, olddirfd, oldpath, newdirfd, + newpath); +} +#endif + +#endif /* RENAMEAT_H */ diff --git a/fsstress/include/lapi/rt_sigaction.h b/fsstress/include/lapi/rt_sigaction.h new file mode 100644 index 0000000000..3af91362f6 --- /dev/null +++ b/fsstress/include/lapi/rt_sigaction.h @@ -0,0 +1,245 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2009 Cisco Systems, Inc. All Rights Reserved. + * Copyright (c) 2009 FUJITSU LIMITED. All Rights Reserved. + * Author: Liu Bo + * Author: Ngie Cooper + */ + +#ifndef LTP_RT_SIGACTION_H +#define LTP_RT_SIGACTION_H + +#include "ltp_signal.h" + +#define INVAL_SA_PTR ((void *)-1) + +#if defined(__mips__) +struct kernel_sigaction { + unsigned int sa_flags; + void (* k_sa_handler)(int); + sigset_t sa_mask; +}; +#else +struct kernel_sigaction { + void (* k_sa_handler)(int); + unsigned long sa_flags; + void (*sa_restorer) (void); + sigset_t sa_mask; +}; +#endif + +/* This macro marks if (struct sigaction) has .sa_restorer member */ +#if !defined(__ia64__) && !defined(__alpha__) && !defined(__hppa__) && !defined(__mips__) +# define HAVE_SA_RESTORER +#endif + +#ifdef __x86_64__ + +/* + * From asm/signal.h -- this value isn't exported anywhere outside of glibc and + * asm/signal.h and is only required for the rt_sig* function family because + * sigaction(2), et all, appends this if necessary to + * (struct sigaction).sa_flags. HEH. + * + * I do #undef though, just in case... + * + * Also, from .../arch/x86/kernel/signal.c:448 for v2.6.30 (something or + * other): + * + * x86-64 should always use SA_RESTORER. + * + * -- thus SA_RESTORER must always be defined along with + * (struct sigaction).sa_restorer for this architecture. + */ +#undef SA_RESTORER +#define SA_RESTORER 0x04000000 + +void (*restore_rt)(void); + +static void handler_h(int signal) +{ + return; +} + +/* Setup an initial signal handler for signal number = sig for x86_64. */ +static inline int sig_initial(int sig) +{ + int ret_code = -1; + struct sigaction act, oact; + + act.sa_handler = handler_h; + act.sa_flags = 0; + /* Clear out the signal set. */ + if (sigemptyset(&act.sa_mask) < 0) { + /* Add the signal to the mask set. */ + } else if (sigaddset(&act.sa_mask, sig) < 0) { + /* Set act.sa_restorer via syscall(2) */ + } else if (sigaction(sig, &act, &oact) < 0) { + /* Copy oact.sa_restorer via syscall(2) */ + } else if (sigaction(sig, &act, &oact) < 0) { + /* And voila -- we just tricked the kernel into giving us our + * restorer function! */ + } else { + restore_rt = oact.sa_restorer; + ret_code = 0; + } + + return ret_code; +} + +#endif /* __x86_64__ */ + +#ifdef __sparc__ +# if defined __arch64__ || defined __sparcv9 + +/* + * Based on glibc/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c + */ + +extern char *__rt_sig_stub; + +static void __attribute__((used)) __rt_sigreturn_stub(void) +{ + __asm__ ("__rt_sig_stub: mov %0, %%g1\n\t" + "ta 0x6d\n\t" + : /* no outputs */ + : "i" (__NR_rt_sigreturn)); +} + +# else /* sparc32 */ + +/* + * Based on glibc/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c + */ + +extern char *__rt_sig_stub, *__sig_stub; + +static void __attribute__((used)) __rt_sigreturn_stub(void) +{ + __asm__ ("__rt_sig_stub: mov %0, %%g1\n\t" + "ta 0x10\n\t" + : /* no outputs */ + : "i" (__NR_rt_sigreturn)); +} + +static void __attribute__((used)) __sigreturn_stub(void) +{ + __asm__ ("__sig_stub: mov %0, %%g1\n\t" + "ta 0x10\n\t" + : /* no outputs */ + : "i" (__NR_sigreturn)); +} + +# endif +#endif /* __sparc__ */ + +#ifdef __arc__ + +#undef SA_RESTORER +#define SA_RESTORER 0x04000000 + +/* + * based on uClibc/libc/sysdeps/linux/arc/sigaction.c + */ +static void +__attribute__ ((optimize("Os"))) __attribute__((used)) restore_rt(void) +{ + __asm__ ( + "mov r8, %0 \n\t" +#ifdef __ARCHS__ + "trap_s 0 \n\t" +#else + "trap0 \n\t" +#endif + : /* no outputs */ + : "i" (__NR_rt_sigreturn) + : "r8"); +} +#endif + +#ifdef TST_TEST_H__ +# define TST_SYSCALL tst_syscall +#else +# define TST_SYSCALL ltp_syscall +#endif + +/* This is a wrapper for __NR_rt_sigaction syscall. + * act/oact values of INVAL_SA_PTR is used to pass + * an invalid pointer to syscall(__NR_rt_sigaction) + * + * Based on glibc/sysdeps/unix/sysv/linux/{...}/sigaction.c + */ + +static int ltp_rt_sigaction(int signum, const struct sigaction *act, + struct sigaction *oact, size_t sigsetsize) +{ + int ret; + struct kernel_sigaction kact, koact; + struct kernel_sigaction *kact_p = NULL; + struct kernel_sigaction *koact_p = NULL; + + if (act == INVAL_SA_PTR) { + kact_p = INVAL_SA_PTR; + } else if (act) { + kact.k_sa_handler = act->sa_handler; + memcpy(&kact.sa_mask, &act->sa_mask, sizeof(sigset_t)); + kact.sa_flags = act->sa_flags; +#ifndef __mips__ + kact.sa_restorer = NULL; +#endif + kact_p = &kact; + } + + if (oact == INVAL_SA_PTR) + koact_p = INVAL_SA_PTR; + else if (oact) + koact_p = &koact; + +#ifdef __x86_64__ + sig_initial(signum); +#endif + +#if defined __x86_64__ || defined __arc__ + kact.sa_flags |= SA_RESTORER; + kact.sa_restorer = restore_rt; +#endif + +#ifdef __sparc__ + unsigned long stub = 0; +# if defined __arch64__ || defined __sparcv9 + stub = ((unsigned long) &__rt_sig_stub) - 8; +# else /* sparc32 */ + if ((kact.sa_flags & SA_SIGINFO) != 0) + stub = ((unsigned long) &__rt_sig_stub) - 8; + else + stub = ((unsigned long) &__sig_stub) - 8; +# endif +#endif + + +#ifdef __sparc__ + ret = TST_SYSCALL(__NR_rt_sigaction, signum, + kact_p, koact_p, + stub, sigsetsize); +#else + ret = TST_SYSCALL(__NR_rt_sigaction, signum, + kact_p, koact_p, + sigsetsize); +#endif + + if (ret >= 0) { + if (oact && (oact != INVAL_SA_PTR)) { + oact->sa_handler = koact.k_sa_handler; + memcpy(&oact->sa_mask, &koact.sa_mask, + sizeof(sigset_t)); + oact->sa_flags = koact.sa_flags; +#ifdef HAVE_SA_RESTORER + oact->sa_restorer = koact.sa_restorer; +#endif + } + } + + return ret; +} + +#endif /* LTP_RT_SIGACTION_H */ diff --git a/fsstress/include/lapi/safe_rt_signal.h b/fsstress/include/lapi/safe_rt_signal.h new file mode 100644 index 0000000000..67fa444174 --- /dev/null +++ b/fsstress/include/lapi/safe_rt_signal.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2018 Cyril Hrubis + */ + +#ifndef SAFE_RT_SIGNAL_H__ +#define SAFE_RT_SIGNAL_H__ + +#include +#include "lapi/rt_sigaction.h" + +static inline int safe_rt_sigaction(const char *file, const int lineno, + int signum, const struct sigaction *act, + struct sigaction *oact, size_t sigsetsize) +{ + int ret; + + ret = ltp_rt_sigaction(signum, act, oact, sigsetsize); + if (ret < 0) { + tst_brk(TBROK | TERRNO, + "%s:%d: ltp_rt_sigaction(%i, %p, %p, %zu) failed", + file, lineno, signum, act, oact, sigsetsize); + } + + return ret; +} + +#define SAFE_RT_SIGACTION(signum, act, oldact, sigsetsize) \ + safe_rt_sigaction(__FILE__, __LINE__, signum, act, oldact, sigsetsize) + + +static inline int safe_rt_sigprocmask(const char *file, const int lineno, + int how, const sigset_t *set, + sigset_t *oldset, size_t sigsetsize) +{ + int ret; + + ret = tst_syscall(__NR_rt_sigprocmask, how, set, oldset, sigsetsize); + if (ret < 0) { + tst_brk(TBROK | TERRNO, + "%s:%d: rt_sigprocmask(%i, %p, %p, %zu) failed", + file, lineno, how, set, oldset, sigsetsize); + } + + return ret; +} + +#define SAFE_RT_SIGPROCMASK(how, set, oldset, sigsetsize) \ + safe_rt_sigprocmask(__FILE__, __LINE__, how, set, oldset, sigsetsize) + +#endif /* SAFE_RT_SIGNAL_H__ */ diff --git a/fsstress/include/lapi/sched.h b/fsstress/include/lapi/sched.h new file mode 100644 index 0000000000..26fe445e95 --- /dev/null +++ b/fsstress/include/lapi/sched.h @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2015 Cui Bixuan + */ + +#ifndef __SCHED_H__ +#define __SCHED_H__ + +#include "lapi/syscalls.h" +#include +#include + +struct sched_attr { + uint32_t size; + + uint32_t sched_policy; + uint64_t sched_flags; + + /* SCHED_NORMAL, SCHED_BATCH */ + int32_t sched_nice; + + /* SCHED_FIFO, SCHED_RR */ + uint32_t sched_priority; + + /* SCHED_DEADLINE (nsec) */ + uint64_t sched_runtime; + uint64_t sched_deadline; + uint64_t sched_period; +}; + +int sched_setattr(pid_t pid, + const struct sched_attr *attr, + unsigned int flags) +{ + return syscall(__NR_sched_setattr, pid, attr, flags); +} + +int sched_getattr(pid_t pid, + struct sched_attr *attr, + unsigned int size, + unsigned int flags) +{ + return syscall(__NR_sched_getattr, pid, attr, size, flags); +} + +#ifndef CLONE_VM +#define CLONE_VM 0x00000100 +#endif + +#ifndef CLONE_FS +#define CLONE_FS 0x00000200 +#endif + +#ifndef CLONE_SYSVSEM +#define CLONE_SYSVSEM 0x00040000 +#endif + +#ifndef CLONE_IO +#define CLONE_IO 0x80000000 +#endif + +#endif /* __SCHED_H__ */ diff --git a/fsstress/include/lapi/sctp.h b/fsstress/include/lapi/sctp.h new file mode 100644 index 0000000000..c4c1cc91fa --- /dev/null +++ b/fsstress/include/lapi/sctp.h @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2018 Oracle and/or its affiliates. + */ + +#ifndef LAPI_SCTP_H__ +#define LAPI_SCTP_H__ + +#ifdef HAVE_NETINET_SCTP_H +# include +#endif + +#ifndef SCTP_SOCKOPT_BINDX_ADD +# define SCTP_SOCKOPT_BINDX_ADD 100 +#endif + +#endif /* LAPI_SCTP_H__ */ diff --git a/fsstress/include/lapi/seccomp.h b/fsstress/include/lapi/seccomp.h new file mode 100644 index 0000000000..fe95cab1b2 --- /dev/null +++ b/fsstress/include/lapi/seccomp.h @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved. + * Author: Yang Xu + */ +#ifndef LAPI_SECCOMP_H +#define LAPI_SECCOMP_H + +#include + +#ifdef HAVE_LINUX_SECCOMP_H +# include +#else +/* Valid values for seccomp.mode and prctl(PR_SET_SECCOMP, ) */ +# define SECCOMP_MODE_DISABLED 0 +# define SECCOMP_MODE_STRICT 1 +# define SECCOMP_MODE_FILTER 2 + +# define SECCOMP_RET_KILL_THREAD 0x00000000U /* kill the thread */ +# define SECCOMP_RET_KILL SECCOMP_RET_KILL_THREAD +# define SECCOMP_RET_ALLOW 0x7fff0000U /* allow */ + +/** + * struct seccomp_data - the format the BPF program executes over. + * @nr: the system call number + * @arch: indicates system call convention as an AUDIT_ARCH_* value + * as defined in . + * @instruction_pointer: at the time of the system call. + * @args: up to 6 system call arguments always stored as 64-bit values + * regardless of the architecture. + */ +struct seccomp_data { + int nr; + uint32_t arch; + uint64_t instruction_pointer; + uint64_t args[6]; +}; + +#endif /* HAVE_LINUX_SECCOMP_H*/ +#endif /* LAPI_SECCOMP_H */ diff --git a/fsstress/include/lapi/securebits.h b/fsstress/include/lapi/securebits.h new file mode 100644 index 0000000000..2da137c3a6 --- /dev/null +++ b/fsstress/include/lapi/securebits.h @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved. + * Author: Yang Xu + */ +#ifndef LAPI_SECUREBITS_H +#define LAPI_SECUREBITS_H + +# ifdef HAVE_LINUX_SECUREBITS_H +# include +# endif + +# ifndef SECBIT_NO_CAP_AMBIENT_RAISE +# define SECBIT_NO_CAP_AMBIENT_RAISE 6 +# endif + +#endif /* LAPI_SECUREBITS_H */ diff --git a/fsstress/include/lapi/seek.h b/fsstress/include/lapi/seek.h new file mode 100644 index 0000000000..1a29ba45dc --- /dev/null +++ b/fsstress/include/lapi/seek.h @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2017 Cyril Hrubis + */ + +#ifndef SEEK_H__ +#define SEEK_H__ + +#include + +#ifndef SEEK_DATA +# define SEEK_DATA 3 +#endif + +#ifndef SEEK_HOLE +# define SEEK_HOLE 4 +#endif + +#endif /* SEEK_H__ */ diff --git a/fsstress/include/lapi/sembuf.h b/fsstress/include/lapi/sembuf.h new file mode 100644 index 0000000000..4ef0483a01 --- /dev/null +++ b/fsstress/include/lapi/sembuf.h @@ -0,0 +1,234 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2020 Linaro Limited. All rights reserved. + * Author: Viresh Kumar + */ + +#ifndef IPC_SEMBUF_H +#define IPC_SEMBUF_H + +#include "lapi/posix_types.h" +#include +#include "tst_timer.h" +#include "ipcbuf.h" + +#ifndef HAVE_SEMID64_DS + +#if defined(__mips__) +#define HAVE_SEMID64_DS +/* + * The semid64_ds structure for the MIPS architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for 2 miscellaneous 64-bit values on mips64, + * but used for the upper 32 bit of the time values on mips32. + */ +#if defined(__arch64__) +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ + long sem_otime; /* last semop time */ + long sem_ctime; /* last change time */ + unsigned long sem_nsems; /* no. of semaphores in array */ + unsigned long __unused1; + unsigned long __unused2; +}; +#else +#define HAVE_SEMID64_DS_TIME_HIGH +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ + unsigned long sem_otime; /* last semop time */ + unsigned long sem_ctime; /* last change time */ + unsigned long sem_nsems; /* no. of semaphores in array */ + unsigned long sem_otime_high; + unsigned long sem_ctime_high; +}; +#endif +#endif /* __mips__ */ + +#if defined(__hppa__) +#define HAVE_SEMID64_DS +/* + * The semid64_ds structure for parisc architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 2 miscellaneous 32-bit values + */ +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ +#if __BITS_PER_LONG == 64 + long sem_otime; /* last semop time */ + long sem_ctime; /* last change time */ +#else +#define HAVE_SEMID64_DS_TIME_HIGH + unsigned long sem_otime_high; + unsigned long sem_otime; /* last semop time */ + unsigned long sem_ctime_high; + unsigned long sem_ctime; /* last change time */ +#endif + unsigned long sem_nsems; /* no. of semaphores in array */ + unsigned long __unused1; + unsigned long __unused2; +}; +#endif /* __hppa__ */ + +#if defined(__powerpc__) || defined(__powerpc64__) +#define HAVE_SEMID64_DS +/* + * The semid64_ds structure for PPC architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 2 miscellaneous 32/64-bit values + */ + +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ +#ifndef __powerpc64__ +#define HAVE_SEMID64_DS_TIME_HIGH + unsigned long sem_otime_high; + unsigned long sem_otime; /* last semop time */ + unsigned long sem_ctime_high; + unsigned long sem_ctime; /* last change time */ +#else + long sem_otime; /* last semop time */ + long sem_ctime; /* last change time */ +#endif + unsigned long sem_nsems; /* no. of semaphores in array */ + unsigned long __unused3; + unsigned long __unused4; +}; +#endif /* defined(__powerpc__) || defined(__powerpc64__) */ + +#if defined(__sparc__) +#define HAVE_SEMID64_DS +/* + * The semid64_ds structure for sparc architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 2 miscellaneous 32-bit values + */ + +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ +#if defined(__arch64__) + long sem_otime; /* last semop time */ + long sem_ctime; /* last change time */ +#else +#define HAVE_SEMID64_DS_TIME_HIGH + unsigned long sem_otime_high; + unsigned long sem_otime; /* last semop time */ + unsigned long sem_ctime_high; + unsigned long sem_ctime; /* last change time */ +#endif + unsigned long sem_nsems; /* no. of semaphores in array */ + unsigned long __unused1; + unsigned long __unused2; +}; +#endif /* __sparc__ */ + +#if defined(__x86_64__) +#define HAVE_SEMID64_DS +/* + * The semid64_ds structure for x86 architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 2 miscellaneous 32-bit values + * + * x86_64 and x32 incorrectly added padding here, so the structures + * are still incompatible with the padding on x86. + */ +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ +#ifdef __i386__ +#define HAVE_SEMID64_DS_TIME_HIGH + unsigned long sem_otime; /* last semop time */ + unsigned long sem_otime_high; + unsigned long sem_ctime; /* last change time */ + unsigned long sem_ctime_high; +#else + __kernel_long_t sem_otime; /* last semop time */ + __kernel_ulong_t __unused1; + __kernel_long_t sem_ctime; /* last change time */ + __kernel_ulong_t __unused2; +#endif + __kernel_ulong_t sem_nsems; /* no. of semaphores in array */ + __kernel_ulong_t __unused3; + __kernel_ulong_t __unused4; +}; +#endif /* defined(__x86_64__) */ + +#if defined(__xtensa__) +#define HAVE_SEMID64_DS +#define HAVE_SEMID64_DS_TIME_HIGH + +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ +#ifdef __XTENSA_EL__ + unsigned long sem_otime; /* last semop time */ + unsigned long sem_otime_high; + unsigned long sem_ctime; /* last change time */ + unsigned long sem_ctime_high; +#else + unsigned long sem_otime_high; + unsigned long sem_otime; /* last semop time */ + unsigned long sem_ctime_high; + unsigned long sem_ctime; /* last change time */ +#endif + unsigned long sem_nsems; /* no. of semaphores in array */ + unsigned long __unused3; + unsigned long __unused4; +}; + +#endif /* __xtensa__ */ + +#ifndef HAVE_SEMID64_DS +/* + * The semid64_ds structure for most architectures (though it came + * from x86_32 originally). Note extra padding because this structure + * is passed back and forth between kernel and user space. + * + * semid64_ds was originally meant to be architecture specific, but + * everyone just ended up making identical copies without specific + * optimizations, so we may just as well all use the same one. + * + * 64 bit architectures use a 64-bit long time field here, while + * 32 bit architectures have a pair of unsigned long values. + * + * On big-endian systems, the padding is in the wrong place for + * historic reasons, so user space has to reconstruct a time_t + * value using + * + * user_semid_ds.sem_otime = kernel_semid64_ds.sem_otime + + * ((long long)kernel_semid64_ds.sem_otime_high << 32) + * + * Pad space is left for 2 miscellaneous 32-bit values + */ +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ +#if __BITS_PER_LONG == 64 + long sem_otime; /* last semop time */ + long sem_ctime; /* last change time */ +#else +#define HAVE_SEMID64_DS_TIME_HIGH + unsigned long sem_otime; /* last semop time */ + unsigned long sem_otime_high; + unsigned long sem_ctime; /* last change time */ + unsigned long sem_ctime_high; +#endif + unsigned long sem_nsems; /* no. of semaphores in array */ + unsigned long __unused3; + unsigned long __unused4; +}; +#endif /* semid64_ds */ + +#endif /* HAVE_SEMID64_DS */ + +#endif /* IPC_SEMBUF_H */ diff --git a/fsstress/include/lapi/semun.h b/fsstress/include/lapi/semun.h new file mode 100644 index 0000000000..1a9dc9803b --- /dev/null +++ b/fsstress/include/lapi/semun.h @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2015 Linux Test Project + */ + +#ifndef SEMUN_H__ +#define SEMUN_H__ + +#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED) +/* union semun is defined by including */ +#else +/* according to X/OPEN we have to define it ourselves */ +union semun { + int val; /* value for SETVAL */ + struct semid_ds *buf; /* buffer for IPC_STAT, IPC_SET */ + unsigned short *array; /* array for GETALL, SETALL */ + /* Linux specific part: */ + struct seminfo *__buf; /* buffer for IPC_INFO */ +}; +#endif + +#endif /* SEMUN_H__ */ diff --git a/fsstress/include/lapi/setns.h b/fsstress/include/lapi/setns.h new file mode 100644 index 0000000000..7b0a7afc47 --- /dev/null +++ b/fsstress/include/lapi/setns.h @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + Copyright (c) 2020 Cyril Hrubis + */ + +#ifndef LAPI_SETNS_H__ +#define LAPI_SETNS_H__ + +#include "config.h" +#include "lapi/syscalls.h" +#include + +#ifndef HAVE_SETNS +int setns(int fd, int nstype) +{ + return tst_syscall(__NR_setns, fd, nstype); +} +#endif + +#endif /* LAPI_SETNS_H__ */ diff --git a/fsstress/include/lapi/shmbuf.h b/fsstress/include/lapi/shmbuf.h new file mode 100644 index 0000000000..28ee336206 --- /dev/null +++ b/fsstress/include/lapi/shmbuf.h @@ -0,0 +1,273 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2020 Linaro Limited. All rights reserved. + * Author: Viresh Kumar + */ + +#ifndef IPC_SHMBUF_H +#define IPC_SHMBUF_H + +#include "lapi/posix_types.h" +#include +#include "tst_timer.h" +#include "ipcbuf.h" + +#ifndef HAVE_SHMID64_DS + +#if defined(__mips__) +#define HAVE_SHMID64_DS +/* + * The shmid64_ds structure for the MIPS architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * As MIPS was lacking proper padding after shm_?time, we use 48 bits + * of the padding at the end to store a few additional bits of the time. + * libc implementations need to take care to convert this into a proper + * data structure when moving to 64-bit time_t. + */ + +#if defined(__arch64__) +struct shmid64_ds { + struct ipc64_perm shm_perm; /* operation perms */ + size_t shm_segsz; /* size of segment (bytes) */ + long shm_atime; /* last attach time */ + long shm_dtime; /* last detach time */ + long shm_ctime; /* last change time */ + __kernel_pid_t shm_cpid; /* pid of creator */ + __kernel_pid_t shm_lpid; /* pid of last operator */ + unsigned long shm_nattch; /* no. of current attaches */ + unsigned long __unused1; + unsigned long __unused2; +}; +#else +#define HAVE_SHMID64_DS_TIME_HIGH +struct shmid64_ds { + struct ipc64_perm shm_perm; /* operation perms */ + size_t shm_segsz; /* size of segment (bytes) */ + unsigned long shm_atime; /* last attach time */ + unsigned long shm_dtime; /* last detach time */ + unsigned long shm_ctime; /* last change time */ + __kernel_pid_t shm_cpid; /* pid of creator */ + __kernel_pid_t shm_lpid; /* pid of last operator */ + unsigned long shm_nattch; /* no. of current attaches */ + unsigned short shm_atime_high; + unsigned short shm_dtime_high; + unsigned short shm_ctime_high; + unsigned short __unused1; +}; +#endif + +#endif /* __mips__ */ + +#if defined(__hppa__) +#define HAVE_SHMID64_DS +/* + * The shmid64_ds structure for parisc architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 2 miscellaneous 32-bit values + */ + +struct shmid64_ds { + struct ipc64_perm shm_perm; /* operation perms */ +#if __BITS_PER_LONG == 64 + long shm_atime; /* last attach time */ + long shm_dtime; /* last detach time */ + long shm_ctime; /* last change time */ +#else +#define HAVE_SHMID64_DS_TIME_HIGH + unsigned long shm_atime_high; + unsigned long shm_atime; /* last attach time */ + unsigned long shm_dtime_high; + unsigned long shm_dtime; /* last detach time */ + unsigned long shm_ctime_high; + unsigned long shm_ctime; /* last change time */ + unsigned int __pad4; +#endif + __kernel_size_t shm_segsz; /* size of segment (bytes) */ + __kernel_pid_t shm_cpid; /* pid of creator */ + __kernel_pid_t shm_lpid; /* pid of last operator */ + unsigned long shm_nattch; /* no. of current attaches */ + unsigned long __unused1; + unsigned long __unused2; +}; +#endif /* __hppa__ */ + +#if defined(__powerpc__) || defined(__powerpc64__) +#define HAVE_SHMID64_DS +/* + * The shmid64_ds structure for PPC architecture. + * + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 2 miscellaneous 32-bit values + */ + +struct shmid64_ds { + struct ipc64_perm shm_perm; /* operation perms */ +#ifdef __powerpc64__ + long shm_atime; /* last attach time */ + long shm_dtime; /* last detach time */ + long shm_ctime; /* last change time */ +#else +#define HAVE_SHMID64_DS_TIME_HIGH + unsigned long shm_atime_high; + unsigned long shm_atime; /* last attach time */ + unsigned long shm_dtime_high; + unsigned long shm_dtime; /* last detach time */ + unsigned long shm_ctime_high; + unsigned long shm_ctime; /* last change time */ + unsigned long __unused4; +#endif + size_t shm_segsz; /* size of segment (bytes) */ + __kernel_pid_t shm_cpid; /* pid of creator */ + __kernel_pid_t shm_lpid; /* pid of last operator */ + unsigned long shm_nattch; /* no. of current attaches */ + unsigned long __unused5; + unsigned long __unused6; +}; + +#endif /* defined(__powerpc__) || defined(__powerpc64__) */ + +#if defined(__sparc__) +#define HAVE_SHMID64_DS +/* + * The shmid64_ds structure for sparc architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 2 miscellaneous 32-bit values + */ + +struct shmid64_ds { + struct ipc64_perm shm_perm; /* operation perms */ +#if defined(__arch64__) + long shm_atime; /* last attach time */ + long shm_dtime; /* last detach time */ + long shm_ctime; /* last change time */ +#else +#define HAVE_SHMID64_DS_TIME_HIGH + unsigned long shm_atime_high; + unsigned long shm_atime; /* last attach time */ + unsigned long shm_dtime_high; + unsigned long shm_dtime; /* last detach time */ + unsigned long shm_ctime_high; + unsigned long shm_ctime; /* last change time */ +#endif + size_t shm_segsz; /* size of segment (bytes) */ + __kernel_pid_t shm_cpid; /* pid of creator */ + __kernel_pid_t shm_lpid; /* pid of last operator */ + unsigned long shm_nattch; /* no. of current attaches */ + unsigned long __unused1; + unsigned long __unused2; +}; + +#endif /* __sparc__ */ + +#if defined(__x86_64__) && defined(__ILP32__) +#define HAVE_SHMID64_DS +/* + * The shmid64_ds structure for x86 architecture with x32 ABI. + * + * On x86-32 and x86-64 we can just use the generic definition, but + * x32 uses the same binary layout as x86_64, which is differnet + * from other 32-bit architectures. + */ + +struct shmid64_ds { + struct ipc64_perm shm_perm; /* operation perms */ + size_t shm_segsz; /* size of segment (bytes) */ + __kernel_long_t shm_atime; /* last attach time */ + __kernel_long_t shm_dtime; /* last detach time */ + __kernel_long_t shm_ctime; /* last change time */ + __kernel_pid_t shm_cpid; /* pid of creator */ + __kernel_pid_t shm_lpid; /* pid of last operator */ + __kernel_ulong_t shm_nattch; /* no. of current attaches */ + __kernel_ulong_t __unused4; + __kernel_ulong_t __unused5; +}; +#endif /* defined(__x86_64__) && defined(__ILP32__) */ + +#if defined(__xtensa__) +#define HAVE_SHMID64_DS +#define HAVE_SHMID64_DS_TIME_HIGH +/* + * The shmid64_ds structure for Xtensa architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space, but the padding is on the wrong + * side for big-endian xtensa, for historic reasons. + * + * Pad space is left for: + * - 2 miscellaneous 32-bit values + */ + +struct shmid64_ds { + struct ipc64_perm shm_perm; /* operation perms */ + size_t shm_segsz; /* size of segment (bytes) */ + unsigned long shm_atime; /* last attach time */ + unsigned long shm_atime_high; + unsigned long shm_dtime; /* last detach time */ + unsigned long shm_dtime_high; + unsigned long shm_ctime; /* last change time */ + unsigned long shm_ctime_high; + __kernel_pid_t shm_cpid; /* pid of creator */ + __kernel_pid_t shm_lpid; /* pid of last operator */ + unsigned long shm_nattch; /* no. of current attaches */ + unsigned long __unused4; + unsigned long __unused5; +}; + +#endif /* __xtensa__ */ + +#ifndef HAVE_SHMID64_DS +/* + * The shmid64_ds structure for most architectures (though it came + * from x86_32 originally). Note extra padding because this structure + * is passed back and forth between kernel and user space. + * + * shmid64_ds was originally meant to be architecture specific, but + * everyone just ended up making identical copies without specific + * optimizations, so we may just as well all use the same one. + * + * 64 bit architectures use a 64-bit long time field here, while + * 32 bit architectures have a pair of unsigned long values. + * On big-endian systems, the lower half is in the wrong place. + * + * + * Pad space is left for: + * - 2 miscellaneous 32-bit values + */ + +struct shmid64_ds { + struct ipc64_perm shm_perm; /* operation perms */ + size_t shm_segsz; /* size of segment (bytes) */ +#if __BITS_PER_LONG == 64 + long shm_atime; /* last attach time */ + long shm_dtime; /* last detach time */ + long shm_ctime; /* last change time */ +#else +#define HAVE_SHMID64_DS_TIME_HIGH + unsigned long shm_atime; /* last attach time */ + unsigned long shm_atime_high; + unsigned long shm_dtime; /* last detach time */ + unsigned long shm_dtime_high; + unsigned long shm_ctime; /* last change time */ + unsigned long shm_ctime_high; +#endif + __kernel_pid_t shm_cpid; /* pid of creator */ + __kernel_pid_t shm_lpid; /* pid of last operator */ + unsigned long shm_nattch; /* no. of current attaches */ + unsigned long __unused4; + unsigned long __unused5; +}; +#endif /* shmid64_ds */ + +#endif /* HAVE_SHMID64_DS */ + +#endif /* IPC_SHMBUF_H */ diff --git a/fsstress/include/lapi/signal.h b/fsstress/include/lapi/signal.h new file mode 100644 index 0000000000..d22965a943 --- /dev/null +++ b/fsstress/include/lapi/signal.h @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 Linaro Limited. All rights reserved. + * Author: Daniel Díaz + */ + +#ifndef LAPI_SIGNAL_H +#define LAPI_SIGNAL_H + +#include + +/* + * Some libc implementations might differ in the definitions they include. This + * covers those differences for all tests to successfully build. + */ + +#ifndef __SIGRTMIN +# define __SIGRTMIN 32 +#endif +#ifndef __SIGRTMAX +# define __SIGRTMAX (_NSIG - 1) +#endif + +#endif diff --git a/fsstress/include/lapi/socket.h b/fsstress/include/lapi/socket.h new file mode 100644 index 0000000000..d6389e5041 --- /dev/null +++ b/fsstress/include/lapi/socket.h @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (c) 2016 Fujitsu Ltd. +* Author: Xiao Yang +*/ + +#ifndef __LAPI_SOCKET_H__ +#define __LAPI_SOCKET_H__ + +#include "config.h" +#include + +#ifndef MSG_ZEROCOPY +# define MSG_ZEROCOPY 0x4000000 /* Use user data in kernel path */ +#endif + +#ifndef MSG_FASTOPEN +# define MSG_FASTOPEN 0x20000000 /* Send data in TCP SYN */ +#endif + +#ifndef SO_REUSEPORT +# define SO_REUSEPORT 15 +#endif + +#ifndef SO_BUSY_POLL +# define SO_BUSY_POLL 46 +#endif + +#ifndef SO_ATTACH_BPF +# define SO_ATTACH_BPF 50 +#endif + +#ifndef SO_ZEROCOPY +# define SO_ZEROCOPY 60 +#endif + +#ifndef SOCK_DCCP +# define SOCK_DCCP 6 +#endif + +#ifndef SOCK_CLOEXEC +# define SOCK_CLOEXEC 02000000 +#endif + +#ifndef AF_ALG +# define AF_ALG 38 +#endif + +#ifndef SOL_SCTP +# define SOL_SCTP 132 +#endif + +#ifndef SOL_UDPLITE +# define SOL_UDPLITE 136 /* UDP-Lite (RFC 3828) */ +#endif + +#ifndef SOL_DCCP +# define SOL_DCCP 269 +#endif + +#ifndef SOL_ALG +# define SOL_ALG 279 +#endif + +#ifndef HAVE_STRUCT_MMSGHDR +struct mmsghdr { + struct msghdr msg_hdr; + unsigned int msg_len; +}; +#endif + +#endif /* __LAPI_SOCKET_H__ */ diff --git a/fsstress/include/lapi/splice.h b/fsstress/include/lapi/splice.h new file mode 100644 index 0000000000..0cd6f55d27 --- /dev/null +++ b/fsstress/include/lapi/splice.h @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) International Business Machines Corp., 2007 + * Copyright (c) 2014 Fujitsu Ltd. + */ + +#ifndef SPLICE_H +#define SPLICE_H + +#include "config.h" +#include "lapi/syscalls.h" + +#if !defined(HAVE_SPLICE) +ssize_t splice(int fd_in, loff_t *off_in, int fd_out, + loff_t *off_out, size_t len, unsigned int flags) +{ + return tst_syscall(__NR_splice, fd_in, off_in, + fd_out, off_out, len, flags); +} +#endif + +#endif /* SPLICE_H */ diff --git a/fsstress/include/lapi/stat.h b/fsstress/include/lapi/stat.h new file mode 100644 index 0000000000..979e42d374 --- /dev/null +++ b/fsstress/include/lapi/stat.h @@ -0,0 +1,257 @@ +//SPDX-License-Identifier: GPL-2.0-or-later +/* + * Referred from linux kernel -github/torvalds/linux/include/uapi/linux/fcntl.h + * Copyright (c) Zilogic Systems Pvt. Ltd., 2018 + * Email: code@zilogic.com + */ +#ifndef LAPI_STAT_H +#define LAPI_STAT_H + +#include +#include +#include "lapi/syscalls.h" +/* + * Timestamp structure for the timestamps in struct statx. + * + * tv_sec holds the number of seconds before (negative) or after (positive) + * 00:00:00 1st January 1970 UTC. + * + * tv_nsec holds a number of nanoseconds (0..999,999,999) after the tv_sec time. + * + * __reserved is held in case we need a yet finer resolution. + */ +#if defined(HAVE_STRUCT_STATX_TIMESTAMP) +#include +#else +struct statx_timestamp { + int64_t tv_sec; + uint32_t tv_nsec; + int32_t __reserved; +}; +#endif +/* + * Structures for the extended file attribute retrieval system call + * (statx()). + * + * The caller passes a mask of what they're specifically interested in as a + * parameter to statx(). What statx() actually got will be indicated in + * st_mask upon return. + * + * For each bit in the mask argument: + * + * - if the datum is not supported: + * + * - the bit will be cleared, and + * + * - the datum will be set to an appropriate fabricated value if one is + * available (eg. CIFS can take a default uid and gid), otherwise + * + * - the field will be cleared; + * + * - otherwise, if explicitly requested: + * + * - the datum will be synchronised to the server if AT_STATX_FORCE_SYNC is + * set or if the datum is considered out of date, and + * + * - the field will be filled in and the bit will be set; + * + * - otherwise, if not requested, but available in approximate form without any + * effort, it will be filled in anyway, and the bit will be set upon return + * (it might not be up to date, however, and no attempt will be made to + * synchronise the internal state first); + * + * - otherwise the field and the bit will be cleared before returning. + * + * Items in STATX_BASIC_STATS may be marked unavailable on return, but they + * will have values installed for compatibility purposes so that stat() and + * co. can be emulated in userspace. + */ +#if defined(HAVE_STRUCT_STATX) +#include +#else +struct statx { + /* 0x00 */ + uint32_t stx_mask; + uint32_t stx_blksize; + uint64_t stx_attributes; + /* 0x10 */ + uint32_t stx_nlink; + uint32_t stx_uid; + uint32_t stx_gid; + uint16_t stx_mode; + uint16_t __spare0[1]; + /* 0x20 */ + uint64_t stx_ino; + uint64_t stx_size; + uint64_t stx_blocks; + uint64_t stx_attributes_mask; + /* 0x40 */ + const struct statx_timestamp stx_atime; + const struct statx_timestamp stx_btime; + const struct statx_timestamp stx_ctime; + const struct statx_timestamp stx_mtime; + /* 0x80 */ + uint32_t stx_rdev_major; + uint32_t stx_rdev_minor; + uint32_t stx_dev_major; + uint32_t stx_dev_minor; + /* 0x90 */ + uint64_t __spare2[14]; + /* 0x100 */ +}; +#endif + +#if !defined(HAVE_STATX) + +/* + * statx: wrapper function of statx + * + * Returns: It returns status of statx syscall + */ +static inline int statx(int dirfd, const char *pathname, unsigned int flags, + unsigned int mask, struct statx *statxbuf) +{ + return tst_syscall(__NR_statx, dirfd, pathname, flags, mask, statxbuf); +} +#endif + +/* + * Flags to be stx_mask + * + * Query request/result mask for statx() and struct statx::stx_mask. + * + * These bits should be set in the mask argument of statx() to request + * particular items when calling statx(). + */ +#ifndef STATX_TYPE +# define STATX_TYPE 0x00000001U +#endif + +#ifndef STATX_MODE +# define STATX_MODE 0x00000002U +#endif + +#ifndef STATX_NLINK +# define STATX_NLINK 0x00000004U +#endif + +#ifndef STATX_UID +# define STATX_UID 0x00000008U +#endif + +#ifndef STATX_GID +# define STATX_GID 0x00000010U +#endif + +#ifndef STATX_ATIME +# define STATX_ATIME 0x00000020U +#endif + +#ifndef STATX_MTIME +# define STATX_MTIME 0x00000040U +#endif + +#ifndef STATX_CTIME +# define STATX_CTIME 0x00000080U +#endif + +#ifndef STATX_INO +# define STATX_INO 0x00000100U +#endif + +#ifndef STATX_SIZE +# define STATX_SIZE 0x00000200U +#endif + +#ifndef STATX_BLOCKS +# define STATX_BLOCKS 0x00000400U +#endif + +#ifndef STATX_BASIC_STATS +# define STATX_BASIC_STATS 0x000007ffU +#endif + +#ifndef STATX_BTIME +# define STATX_BTIME 0x00000800U +#endif + +#ifndef STATX_ALL +# define STATX_ALL 0x00000fffU +#endif + +#ifndef STATX__RESERVED +# define STATX__RESERVED 0x80000000U +#endif + +/* + * Attributes to be found in stx_attributes and masked in stx_attributes_mask. + * + * These give information about the features or the state of a file that might + * be of use to ordinary userspace programs such as GUIs or ls rather than + * specialised tools. + * + * Note that the flags marked [I] correspond to generic FS_IOC_FLAGS + * semantically. Where possible, the numerical value is picked to correspond + * also. + */ +#ifndef STATX_ATTR_COMPRESSED +# define STATX_ATTR_COMPRESSED 0x00000004 +#endif + +#ifndef STATX_ATTR_IMMUTABLE +# define STATX_ATTR_IMMUTABLE 0x00000010 +#endif + +#ifndef STATX_ATTR_APPEND +# define STATX_ATTR_APPEND 0x00000020 +#endif + +#ifndef STATX_ATTR_NODUMP +# define STATX_ATTR_NODUMP 0x00000040 +#endif + +#ifndef STATX_ATTR_ENCRYPTED +# define STATX_ATTR_ENCRYPTED 0x00000800 +#endif + +#ifndef STATX_ATTR_AUTOMOUNT +# define STATX_ATTR_AUTOMOUNT 0x00001000 +#endif + +#ifndef AT_SYMLINK_NOFOLLOW +# define AT_SYMLINK_NOFOLLOW 0x100 +#endif + +#ifndef AT_REMOVEDIR +# define AT_REMOVEDIR 0x200 +#endif + +#ifndef AT_SYMLINK_FOLLOW +# define AT_SYMLINK_FOLLOW 0x400 +#endif + +#ifndef AT_NO_AUTOMOUNT +# define AT_NO_AUTOMOUNT 0x800 +#endif + +#ifndef AT_EMPTY_PATH +# define AT_EMPTY_PATH 0x1000 +#endif + +#ifndef AT_STATX_SYNC_TYPE +# define AT_STATX_SYNC_TYPE 0x6000 +#endif + +#ifndef AT_STATX_SYNC_AS_STAT +# define AT_STATX_SYNC_AS_STAT 0x0000 +#endif + +#ifndef AT_STATX_FORCE_SYNC +# define AT_STATX_FORCE_SYNC 0x2000 +#endif + +#ifndef AT_STATX_DONT_SYNC +# define AT_STATX_DONT_SYNC 0x4000 +#endif + +#endif diff --git a/fsstress/include/lapi/sync_file_range.h b/fsstress/include/lapi/sync_file_range.h new file mode 100644 index 0000000000..86bfe5d6ec --- /dev/null +++ b/fsstress/include/lapi/sync_file_range.h @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) International Business Machines Corp., 2008 + */ + +#ifndef SYNC_FILE_RANGE_H +#define SYNC_FILE_RANGE_H + +#include +#include "config.h" +#include "lapi/syscalls.h" +#include "lapi/abisize.h" + +#if !defined(HAVE_SYNC_FILE_RANGE) + +#ifdef TST_TEST_H__ +# define TST_SYSCALL tst_syscall +#else +# define TST_SYSCALL ltp_syscall +#endif + +/***************************************************************************** + * Wraper function to call sync_file_range system call + ******************************************************************************/ +static inline long sync_file_range(int fd, off64_t offset, off64_t nbytes, + unsigned int flags) +{ +#if (defined(__arm__) || defined(__powerpc__) || defined(__powerpc64__)) +# ifdef TST_ABI32 +# if __BYTE_ORDER == __BIG_ENDIAN + return TST_SYSCALL(__NR_sync_file_range2, fd, flags, + (int)(offset >> 32), (int)offset, (int)(nbytes >> 32), + (int)nbytes); +# elif __BYTE_ORDER == __LITTLE_ENDIAN + return TST_SYSCALL(__NR_sync_file_range2, fd, flags, (int)offset, + (int)(offset >> 32), nbytes, (int)(nbytes >> 32)); +# endif +# else + return TST_SYSCALL(__NR_sync_file_range2, fd, flags, offset, nbytes); +# endif +#elif (defined(__s390__) || defined(__s390x__)) && defined(TST_ABI32) + return TST_SYSCALL(__NR_sync_file_range, fd, (int)(offset >> 32), + (int)offset, (int)(nbytes >> 32), (int)nbytes, flags); +#elif defined(__mips__) && defined(TST_ABI32) +# if __BYTE_ORDER == __BIG_ENDIAN + return TST_SYSCALL(__NR_sync_file_range, fd, 0, (int)(offset >> 32), + (int)offset, (int)(nbytes >> 32), (int)nbytes, flags); +# elif __BYTE_ORDER == __LITTLE_ENDIAN + return TST_SYSCALL(__NR_sync_file_range, fd, 0, (int)offset, + (int)(offset >> 32), (int)nbytes, (int)(nbytes >> 32), flags); +# endif +#else + return TST_SYSCALL(__NR_sync_file_range, fd, offset, nbytes, flags); +#endif +} +#endif + +#endif /* SYNC_FILE_RANGE_H */ diff --git a/fsstress/include/lapi/syncfs.h b/fsstress/include/lapi/syncfs.h new file mode 100644 index 0000000000..e5d29fa96a --- /dev/null +++ b/fsstress/include/lapi/syncfs.h @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 Linaro Limited. All rights reserved. + * Author: Sumit Garg + */ + +#ifndef SYNCFS_H +#define SYNCFS_H + +#include "config.h" +#include +#include "lapi/syscalls.h" + +#if !defined(HAVE_SYNCFS) +int syncfs(int fd) +{ + return tst_syscall(__NR_syncfs, fd); +} +#endif + +#endif /* SYNCFS_H */ diff --git a/fsstress/include/lapi/syscalls/aarch64.in b/fsstress/include/lapi/syscalls/aarch64.in new file mode 100644 index 0000000000..07556933f0 --- /dev/null +++ b/fsstress/include/lapi/syscalls/aarch64.in @@ -0,0 +1,315 @@ +io_setup 0 +io_destroy 1 +io_submit 2 +io_cancel 3 +io_getevents 4 +setxattr 5 +lsetxattr 6 +fsetxattr 7 +getxattr 8 +lgetxattr 9 +fgetxattr 10 +listxattr 11 +llistxattr 12 +flistxattr 13 +removexattr 14 +lremovexattr 15 +fremovexattr 16 +getcwd 17 +lookup_dcookie 18 +eventfd2 19 +epoll_create1 20 +epoll_ctl 21 +epoll_pwait 22 +dup 23 +dup3 24 +fcntl 25 +inotify_init1 26 +inotify_add_watch 27 +inotify_rm_watch 28 +ioctl 29 +ioprio_set 30 +ioprio_get 31 +flock 32 +mknodat 33 +mkdirat 34 +unlinkat 35 +symlinkat 36 +linkat 37 +renameat 38 +umount2 39 +mount 40 +pivot_root 41 +nfsservctl 42 +statfs 43 +fstatfs 44 +truncate 45 +ftruncate 46 +fallocate 47 +faccessat 48 +chdir 49 +fchdir 50 +chroot 51 +fchmod 52 +fchmodat 53 +fchownat 54 +fchown 55 +openat 56 +close 57 +vhangup 58 +pipe2 59 +quotactl 60 +getdents64 61 +lseek 62 +read 63 +write 64 +readv 65 +writev 66 +pread64 67 +pwrite64 68 +preadv 69 +pwritev 70 +sendfile 71 +pselect6 72 +ppoll 73 +signalfd4 74 +vmsplice 75 +splice 76 +tee 77 +readlinkat 78 +fstatat 79 +fstat 80 +sync 81 +fsync 82 +fdatasync 83 +sync_file_range2 84 +sync_file_range 84 +timerfd_create 85 +timerfd_settime 86 +timerfd_gettime 87 +utimensat 88 +acct 89 +capget 90 +capset 91 +personality 92 +exit 93 +exit_group 94 +waitid 95 +set_tid_address 96 +unshare 97 +futex 98 +set_robust_list 99 +get_robust_list 100 +nanosleep 101 +getitimer 102 +setitimer 103 +kexec_load 104 +init_module 105 +delete_module 106 +timer_create 107 +timer_gettime 108 +timer_getoverrun 109 +timer_settime 110 +timer_delete 111 +clock_settime 112 +clock_gettime 113 +clock_getres 114 +clock_nanosleep 115 +syslog 116 +ptrace 117 +sched_setparam 118 +sched_setscheduler 119 +sched_getscheduler 120 +sched_getparam 121 +sched_setaffinity 122 +sched_getaffinity 123 +sched_yield 124 +sched_get_priority_max 125 +sched_get_priority_min 126 +sched_rr_get_interval 127 +restart_syscall 128 +kill 129 +tkill 130 +tgkill 131 +sigaltstack 132 +rt_sigsuspend 133 +rt_sigaction 134 +rt_sigprocmask 135 +rt_sigpending 136 +rt_sigtimedwait 137 +rt_sigqueueinfo 138 +rt_sigreturn 139 +setpriority 140 +getpriority 141 +reboot 142 +setregid 143 +setgid 144 +setreuid 145 +setuid 146 +setresuid 147 +getresuid 148 +setresgid 149 +getresgid 150 +setfsuid 151 +setfsgid 152 +times 153 +setpgid 154 +getpgid 155 +getsid 156 +setsid 157 +getgroups 158 +setgroups 159 +uname 160 +sethostname 161 +setdomainname 162 +getrlimit 163 +setrlimit 164 +getrusage 165 +umask 166 +prctl 167 +getcpu 168 +gettimeofday 169 +settimeofday 170 +adjtimex 171 +getpid 172 +getppid 173 +getuid 174 +geteuid 175 +getgid 176 +getegid 177 +gettid 178 +sysinfo 179 +mq_open 180 +mq_unlink 181 +mq_timedsend 182 +mq_timedreceive 183 +mq_notify 184 +mq_getsetattr 185 +msgget 186 +msgctl 187 +msgrcv 188 +msgsnd 189 +semget 190 +semctl 191 +semtimedop 192 +semop 193 +shmget 194 +shmctl 195 +shmat 196 +shmdt 197 +socket 198 +socketpair 199 +bind 200 +listen 201 +accept 202 +connect 203 +getsockname 204 +getpeername 205 +sendto 206 +recvfrom 207 +setsockopt 208 +getsockopt 209 +shutdown 210 +sendmsg 211 +recvmsg 212 +readahead 213 +brk 214 +munmap 215 +mremap 216 +add_key 217 +request_key 218 +keyctl 219 +clone 220 +execve 221 +mmap 222 +fadvise64 223 +swapon 224 +swapoff 225 +mprotect 226 +msync 227 +mlock 228 +munlock 229 +mlockall 230 +munlockall 231 +mincore 232 +madvise 233 +remap_file_pages 234 +mbind 235 +get_mempolicy 236 +set_mempolicy 237 +migrate_pages 238 +move_pages 239 +rt_tgsigqueueinfo 240 +perf_event_open 241 +accept4 242 +recvmmsg 243 +wait4 260 +prlimit64 261 +fanotify_init 262 +fanotify_mark 263 +name_to_handle_at 264 +open_by_handle_at 265 +clock_adjtime 266 +syncfs 267 +setns 268 +sendmmsg 269 +process_vm_readv 270 +process_vm_writev 271 +kcmp 272 +finit_module 273 +sched_setattr 274 +sched_getattr 275 +renameat2 276 +seccomp 277 +getrandom 278 +memfd_create 279 +bpf 280 +execveat 281 +userfaultfd 282 +membarrier 283 +mlock2 284 +copy_file_range 285 +preadv2 286 +pwritev2 287 +pkey_mprotect 288 +pkey_alloc 289 +pkey_free 290 +statx 291 +io_pgetevents 292 +rseq 293 +kexec_file_load 294 +clock_gettime64 403 +clock_settime64 404 +clock_adjtime64 405 +clock_getres_time64 406 +clock_nanosleep_time64 407 +timer_gettime64 408 +timer_settime64 409 +timerfd_gettime64 410 +timerfd_settime64 411 +utimensat_time64 412 +pselect6_time64 413 +ppoll_time64 414 +io_pgetevents_time64 416 +recvmmsg_time64 417 +mq_timedsend_time64 418 +mq_timedreceive_time64 419 +semtimedop_time64 420 +rt_sigtimedwait_time64 421 +futex_time64 422 +sched_rr_get_interval_time64 423 +pidfd_send_signal 424 +io_uring_setup 425 +io_uring_enter 426 +io_uring_register 427 +open_tree 428 +move_mount 429 +fsopen 430 +fsconfig 431 +fsmount 432 +fspick 433 +pidfd_open 434 +clone3 435 +openat2 437 +pidfd_getfd 438 +_sysctl 1078 diff --git a/fsstress/include/lapi/syscalls/arc.in b/fsstress/include/lapi/syscalls/arc.in new file mode 100644 index 0000000000..0cadb150c7 --- /dev/null +++ b/fsstress/include/lapi/syscalls/arc.in @@ -0,0 +1,314 @@ +io_setup 0 +io_destroy 1 +io_submit 2 +io_cancel 3 +io_getevents 4 +setxattr 5 +lsetxattr 6 +fsetxattr 7 +getxattr 8 +lgetxattr 9 +fgetxattr 10 +listxattr 11 +llistxattr 12 +flistxattr 13 +removexattr 14 +lremovexattr 15 +fremovexattr 16 +getcwd 17 +lookup_dcookie 18 +eventfd2 19 +epoll_create1 20 +epoll_ctl 21 +epoll_pwait 22 +dup 23 +dup3 24 +fcntl 25 +inotify_init1 26 +inotify_add_watch 27 +inotify_rm_watch 28 +ioctl 29 +ioprio_set 30 +ioprio_get 31 +flock 32 +mknodat 33 +mkdirat 34 +unlinkat 35 +symlinkat 36 +linkat 37 +renameat 38 +umount2 39 +mount 40 +pivot_root 41 +nfsservctl 42 +statfs 43 +fstatfs 44 +truncate 45 +ftruncate 46 +fallocate 47 +faccessat 48 +chdir 49 +fchdir 50 +chroot 51 +fchmod 52 +fchmodat 53 +fchownat 54 +fchown 55 +openat 56 +close 57 +vhangup 58 +pipe2 59 +quotactl 60 +getdents64 61 +lseek 62 +read 63 +write 64 +readv 65 +writev 66 +pread64 67 +pwrite64 68 +preadv 69 +pwritev 70 +sendfile 71 +pselect6 72 +ppoll 73 +signalfd4 74 +vmsplice 75 +splice 76 +tee 77 +readlinkat 78 +fstatat 79 +fstat 80 +sync 81 +fsync 82 +fdatasync 83 +sync_file_range2 84 +sync_file_range 84 +timerfd_create 85 +timerfd_settime 86 +timerfd_gettime 87 +utimensat 88 +acct 89 +capget 90 +capset 91 +personality 92 +exit 93 +exit_group 94 +waitid 95 +set_tid_address 96 +unshare 97 +futex 98 +set_robust_list 99 +get_robust_list 100 +nanosleep 101 +getitimer 102 +setitimer 103 +kexec_load 104 +init_module 105 +delete_module 106 +timer_create 107 +timer_gettime 108 +timer_getoverrun 109 +timer_settime 110 +timer_delete 111 +clock_settime 112 +clock_gettime 113 +clock_getres 114 +clock_nanosleep 115 +syslog 116 +ptrace 117 +sched_setparam 118 +sched_setscheduler 119 +sched_getscheduler 120 +sched_getparam 121 +sched_setaffinity 122 +sched_getaffinity 123 +sched_yield 124 +sched_get_priority_max 125 +sched_get_priority_min 126 +sched_rr_get_interval 127 +restart_syscall 128 +kill 129 +tkill 130 +tgkill 131 +sigaltstack 132 +rt_sigsuspend 133 +rt_sigaction 134 +rt_sigprocmask 135 +rt_sigpending 136 +rt_sigtimedwait 137 +rt_sigqueueinfo 138 +rt_sigreturn 139 +setpriority 140 +getpriority 141 +reboot 142 +setregid 143 +setgid 144 +setreuid 145 +setuid 146 +setresuid 147 +getresuid 148 +setresgid 149 +getresgid 150 +setfsuid 151 +setfsgid 152 +times 153 +setpgid 154 +getpgid 155 +getsid 156 +setsid 157 +getgroups 158 +setgroups 159 +uname 160 +sethostname 161 +setdomainname 162 +getrlimit 163 +setrlimit 164 +getrusage 165 +umask 166 +prctl 167 +getcpu 168 +gettimeofday 169 +settimeofday 170 +adjtimex 171 +getpid 172 +getppid 173 +getuid 174 +geteuid 175 +getgid 176 +getegid 177 +gettid 178 +sysinfo 179 +mq_open 180 +mq_unlink 181 +mq_timedsend 182 +mq_timedreceive 183 +mq_notify 184 +mq_getsetattr 185 +msgget 186 +msgctl 187 +msgrcv 188 +msgsnd 189 +semget 190 +semctl 191 +semtimedop 192 +semop 193 +shmget 194 +shmctl 195 +shmat 196 +shmdt 197 +socket 198 +socketpair 199 +bind 200 +listen 201 +accept 202 +connect 203 +getsockname 204 +getpeername 205 +sendto 206 +recvfrom 207 +setsockopt 208 +getsockopt 209 +shutdown 210 +sendmsg 211 +recvmsg 212 +readahead 213 +brk 214 +munmap 215 +mremap 216 +add_key 217 +request_key 218 +keyctl 219 +clone 220 +execve 221 +mmap 222 +fadvise64 223 +swapon 224 +swapoff 225 +mprotect 226 +msync 227 +mlock 228 +munlock 229 +mlockall 230 +munlockall 231 +mincore 232 +madvise 233 +remap_file_pages 234 +mbind 235 +get_mempolicy 236 +set_mempolicy 237 +migrate_pages 238 +move_pages 239 +rt_tgsigqueueinfo 240 +perf_event_open 241 +accept4 242 +recvmmsg 243 +cacheflush 244 +arc_settls 245 +arc_gettls 246 +sysfs 247 +arc_usr_cmpxchg 248 +wait4 260 +prlimit64 261 +fanotify_init 262 +fanotify_mark 263 +name_to_handle_at 264 +open_by_handle_at 265 +clock_adjtime 266 +syncfs 267 +setns 268 +sendmmsg 269 +process_vm_readv 270 +process_vm_writev 271 +kcmp 272 +getrandom 278 +memfd_create 279 +bpf 280 +execveat 281 +userfaultfd 282 +membarrier 283 +mlock2 284 +copy_file_range 285 +preadv2 286 +pwritev2 287 +pkey_mprotect 288 +pkey_alloc 289 +pkey_free 290 +statx 291 +io_pgetevents 292 +rseq 293 +kexec_file_load 294 +clock_gettime64 403 +clock_settime64 404 +clock_adjtime64 405 +clock_getres_time64 406 +clock_nanosleep_time64 407 +timer_gettime64 408 +timer_settime64 409 +timerfd_gettime64 410 +timerfd_settime64 411 +utimensat_time64 412 +pselect6_time64 413 +ppoll_time64 414 +io_pgetevents_time64 416 +recvmmsg_time64 417 +mq_timedsend_time64 418 +mq_timedreceive_time64 419 +semtimedop_time64 420 +rt_sigtimedwait_time64 421 +futex_time64 422 +sched_rr_get_interval_time64 423 +pidfd_send_signal 424 +io_uring_setup 425 +io_uring_enter 426 +io_uring_register 427 +open_tree 428 +move_mount 429 +fsopen 430 +fsconfig 431 +fsmount 432 +fspick 433 +pidfd_open 434 +clone3 435 +openat2 437 +pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/arm.in b/fsstress/include/lapi/syscalls/arm.in new file mode 100644 index 0000000000..395d53a68f --- /dev/null +++ b/fsstress/include/lapi/syscalls/arm.in @@ -0,0 +1,392 @@ +restart_syscall (__NR_SYSCALL_BASE+ 0) +exit (__NR_SYSCALL_BASE+ 1) +fork (__NR_SYSCALL_BASE+ 2) +read (__NR_SYSCALL_BASE+ 3) +write (__NR_SYSCALL_BASE+ 4) +open (__NR_SYSCALL_BASE+ 5) +close (__NR_SYSCALL_BASE+ 6) +creat (__NR_SYSCALL_BASE+ 8) +link (__NR_SYSCALL_BASE+ 9) +unlink (__NR_SYSCALL_BASE+ 10) +execve (__NR_SYSCALL_BASE+ 11) +chdir (__NR_SYSCALL_BASE+ 12) +mknod (__NR_SYSCALL_BASE+ 14) +chmod (__NR_SYSCALL_BASE+ 15) +lchown (__NR_SYSCALL_BASE+ 16) +lseek (__NR_SYSCALL_BASE+ 19) +getpid (__NR_SYSCALL_BASE+ 20) +mount (__NR_SYSCALL_BASE+ 21) +setuid (__NR_SYSCALL_BASE+ 23) +getuid (__NR_SYSCALL_BASE+ 24) +ptrace (__NR_SYSCALL_BASE+ 26) +pause (__NR_SYSCALL_BASE+ 29) +access (__NR_SYSCALL_BASE+ 33) +nice (__NR_SYSCALL_BASE+ 34) +sync (__NR_SYSCALL_BASE+ 36) +kill (__NR_SYSCALL_BASE+ 37) +rename (__NR_SYSCALL_BASE+ 38) +mkdir (__NR_SYSCALL_BASE+ 39) +rmdir (__NR_SYSCALL_BASE+ 40) +dup (__NR_SYSCALL_BASE+ 41) +pipe (__NR_SYSCALL_BASE+ 42) +times (__NR_SYSCALL_BASE+ 43) +brk (__NR_SYSCALL_BASE+ 45) +setgid (__NR_SYSCALL_BASE+ 46) +getgid (__NR_SYSCALL_BASE+ 47) +geteuid (__NR_SYSCALL_BASE+ 49) +getegid (__NR_SYSCALL_BASE+ 50) +acct (__NR_SYSCALL_BASE+ 51) +umount2 (__NR_SYSCALL_BASE+ 52) +ioctl (__NR_SYSCALL_BASE+ 54) +fcntl (__NR_SYSCALL_BASE+ 55) +setpgid (__NR_SYSCALL_BASE+ 57) +umask (__NR_SYSCALL_BASE+ 60) +chroot (__NR_SYSCALL_BASE+ 61) +ustat (__NR_SYSCALL_BASE+ 62) +dup2 (__NR_SYSCALL_BASE+ 63) +getppid (__NR_SYSCALL_BASE+ 64) +getpgrp (__NR_SYSCALL_BASE+ 65) +setsid (__NR_SYSCALL_BASE+ 66) +sigaction (__NR_SYSCALL_BASE+ 67) +setreuid (__NR_SYSCALL_BASE+ 70) +setregid (__NR_SYSCALL_BASE+ 71) +sigsuspend (__NR_SYSCALL_BASE+ 72) +sigpending (__NR_SYSCALL_BASE+ 73) +sethostname (__NR_SYSCALL_BASE+ 74) +setrlimit (__NR_SYSCALL_BASE+ 75) +getrusage (__NR_SYSCALL_BASE+ 77) +gettimeofday (__NR_SYSCALL_BASE+ 78) +settimeofday (__NR_SYSCALL_BASE+ 79) +getgroups (__NR_SYSCALL_BASE+ 80) +setgroups (__NR_SYSCALL_BASE+ 81) +symlink (__NR_SYSCALL_BASE+ 83) +readlink (__NR_SYSCALL_BASE+ 85) +uselib (__NR_SYSCALL_BASE+ 86) +swapon (__NR_SYSCALL_BASE+ 87) +reboot (__NR_SYSCALL_BASE+ 88) +munmap (__NR_SYSCALL_BASE+ 91) +truncate (__NR_SYSCALL_BASE+ 92) +ftruncate (__NR_SYSCALL_BASE+ 93) +fchmod (__NR_SYSCALL_BASE+ 94) +fchown (__NR_SYSCALL_BASE+ 95) +getpriority (__NR_SYSCALL_BASE+ 96) +setpriority (__NR_SYSCALL_BASE+ 97) +statfs (__NR_SYSCALL_BASE+ 99) +fstatfs (__NR_SYSCALL_BASE+100) +syslog (__NR_SYSCALL_BASE+103) +setitimer (__NR_SYSCALL_BASE+104) +getitimer (__NR_SYSCALL_BASE+105) +stat (__NR_SYSCALL_BASE+106) +lstat (__NR_SYSCALL_BASE+107) +fstat (__NR_SYSCALL_BASE+108) +vhangup (__NR_SYSCALL_BASE+111) +wait4 (__NR_SYSCALL_BASE+114) +swapoff (__NR_SYSCALL_BASE+115) +sysinfo (__NR_SYSCALL_BASE+116) +fsync (__NR_SYSCALL_BASE+118) +sigreturn (__NR_SYSCALL_BASE+119) +clone (__NR_SYSCALL_BASE+120) +setdomainname (__NR_SYSCALL_BASE+121) +uname (__NR_SYSCALL_BASE+122) +adjtimex (__NR_SYSCALL_BASE+124) +mprotect (__NR_SYSCALL_BASE+125) +sigprocmask (__NR_SYSCALL_BASE+126) +init_module (__NR_SYSCALL_BASE+128) +delete_module (__NR_SYSCALL_BASE+129) +quotactl (__NR_SYSCALL_BASE+131) +getpgid (__NR_SYSCALL_BASE+132) +fchdir (__NR_SYSCALL_BASE+133) +bdflush (__NR_SYSCALL_BASE+134) +sysfs (__NR_SYSCALL_BASE+135) +personality (__NR_SYSCALL_BASE+136) +setfsuid (__NR_SYSCALL_BASE+138) +setfsgid (__NR_SYSCALL_BASE+139) +_llseek (__NR_SYSCALL_BASE+140) +getdents (__NR_SYSCALL_BASE+141) +_newselect (__NR_SYSCALL_BASE+142) +flock (__NR_SYSCALL_BASE+143) +msync (__NR_SYSCALL_BASE+144) +readv (__NR_SYSCALL_BASE+145) +writev (__NR_SYSCALL_BASE+146) +getsid (__NR_SYSCALL_BASE+147) +fdatasync (__NR_SYSCALL_BASE+148) +_sysctl (__NR_SYSCALL_BASE+149) +mlock (__NR_SYSCALL_BASE+150) +munlock (__NR_SYSCALL_BASE+151) +mlockall (__NR_SYSCALL_BASE+152) +munlockall (__NR_SYSCALL_BASE+153) +sched_setparam (__NR_SYSCALL_BASE+154) +sched_getparam (__NR_SYSCALL_BASE+155) +sched_setscheduler (__NR_SYSCALL_BASE+156) +sched_getscheduler (__NR_SYSCALL_BASE+157) +sched_yield (__NR_SYSCALL_BASE+158) +sched_get_priority_max (__NR_SYSCALL_BASE+159) +sched_get_priority_min (__NR_SYSCALL_BASE+160) +sched_rr_get_interval (__NR_SYSCALL_BASE+161) +nanosleep (__NR_SYSCALL_BASE+162) +mremap (__NR_SYSCALL_BASE+163) +setresuid (__NR_SYSCALL_BASE+164) +getresuid (__NR_SYSCALL_BASE+165) +poll (__NR_SYSCALL_BASE+168) +nfsservctl (__NR_SYSCALL_BASE+169) +setresgid (__NR_SYSCALL_BASE+170) +getresgid (__NR_SYSCALL_BASE+171) +prctl (__NR_SYSCALL_BASE+172) +rt_sigreturn (__NR_SYSCALL_BASE+173) +rt_sigaction (__NR_SYSCALL_BASE+174) +rt_sigprocmask (__NR_SYSCALL_BASE+175) +rt_sigpending (__NR_SYSCALL_BASE+176) +rt_sigtimedwait (__NR_SYSCALL_BASE+177) +rt_sigqueueinfo (__NR_SYSCALL_BASE+178) +rt_sigsuspend (__NR_SYSCALL_BASE+179) +pread64 (__NR_SYSCALL_BASE+180) +pwrite64 (__NR_SYSCALL_BASE+181) +chown (__NR_SYSCALL_BASE+182) +getcwd (__NR_SYSCALL_BASE+183) +capget (__NR_SYSCALL_BASE+184) +capset (__NR_SYSCALL_BASE+185) +sigaltstack (__NR_SYSCALL_BASE+186) +sendfile (__NR_SYSCALL_BASE+187) +vfork (__NR_SYSCALL_BASE+190) +ugetrlimit (__NR_SYSCALL_BASE+191) +mmap2 (__NR_SYSCALL_BASE+192) +truncate64 (__NR_SYSCALL_BASE+193) +ftruncate64 (__NR_SYSCALL_BASE+194) +stat64 (__NR_SYSCALL_BASE+195) +lstat64 (__NR_SYSCALL_BASE+196) +fstat64 (__NR_SYSCALL_BASE+197) +lchown32 (__NR_SYSCALL_BASE+198) +getuid32 (__NR_SYSCALL_BASE+199) +getgid32 (__NR_SYSCALL_BASE+200) +geteuid32 (__NR_SYSCALL_BASE+201) +getegid32 (__NR_SYSCALL_BASE+202) +setreuid32 (__NR_SYSCALL_BASE+203) +setregid32 (__NR_SYSCALL_BASE+204) +getgroups32 (__NR_SYSCALL_BASE+205) +setgroups32 (__NR_SYSCALL_BASE+206) +fchown32 (__NR_SYSCALL_BASE+207) +setresuid32 (__NR_SYSCALL_BASE+208) +getresuid32 (__NR_SYSCALL_BASE+209) +setresgid32 (__NR_SYSCALL_BASE+210) +getresgid32 (__NR_SYSCALL_BASE+211) +chown32 (__NR_SYSCALL_BASE+212) +setuid32 (__NR_SYSCALL_BASE+213) +setgid32 (__NR_SYSCALL_BASE+214) +setfsuid32 (__NR_SYSCALL_BASE+215) +setfsgid32 (__NR_SYSCALL_BASE+216) +getdents64 (__NR_SYSCALL_BASE+217) +pivot_root (__NR_SYSCALL_BASE+218) +mincore (__NR_SYSCALL_BASE+219) +madvise (__NR_SYSCALL_BASE+220) +fcntl64 (__NR_SYSCALL_BASE+221) +gettid (__NR_SYSCALL_BASE+224) +readahead (__NR_SYSCALL_BASE+225) +setxattr (__NR_SYSCALL_BASE+226) +lsetxattr (__NR_SYSCALL_BASE+227) +fsetxattr (__NR_SYSCALL_BASE+228) +getxattr (__NR_SYSCALL_BASE+229) +lgetxattr (__NR_SYSCALL_BASE+230) +fgetxattr (__NR_SYSCALL_BASE+231) +listxattr (__NR_SYSCALL_BASE+232) +llistxattr (__NR_SYSCALL_BASE+233) +flistxattr (__NR_SYSCALL_BASE+234) +removexattr (__NR_SYSCALL_BASE+235) +lremovexattr (__NR_SYSCALL_BASE+236) +fremovexattr (__NR_SYSCALL_BASE+237) +tkill (__NR_SYSCALL_BASE+238) +sendfile64 (__NR_SYSCALL_BASE+239) +futex (__NR_SYSCALL_BASE+240) +sched_setaffinity (__NR_SYSCALL_BASE+241) +sched_getaffinity (__NR_SYSCALL_BASE+242) +io_setup (__NR_SYSCALL_BASE+243) +io_destroy (__NR_SYSCALL_BASE+244) +io_getevents (__NR_SYSCALL_BASE+245) +io_submit (__NR_SYSCALL_BASE+246) +io_cancel (__NR_SYSCALL_BASE+247) +exit_group (__NR_SYSCALL_BASE+248) +lookup_dcookie (__NR_SYSCALL_BASE+249) +epoll_create (__NR_SYSCALL_BASE+250) +epoll_ctl (__NR_SYSCALL_BASE+251) +epoll_wait (__NR_SYSCALL_BASE+252) +remap_file_pages (__NR_SYSCALL_BASE+253) +set_tid_address (__NR_SYSCALL_BASE+256) +timer_create (__NR_SYSCALL_BASE+257) +timer_settime (__NR_SYSCALL_BASE+258) +timer_gettime (__NR_SYSCALL_BASE+259) +timer_getoverrun (__NR_SYSCALL_BASE+260) +timer_delete (__NR_SYSCALL_BASE+261) +clock_settime (__NR_SYSCALL_BASE+262) +clock_gettime (__NR_SYSCALL_BASE+263) +clock_getres (__NR_SYSCALL_BASE+264) +clock_nanosleep (__NR_SYSCALL_BASE+265) +statfs64 (__NR_SYSCALL_BASE+266) +fstatfs64 (__NR_SYSCALL_BASE+267) +tgkill (__NR_SYSCALL_BASE+268) +utimes (__NR_SYSCALL_BASE+269) +arm_fadvise64_64 (__NR_SYSCALL_BASE+270) +pciconfig_iobase (__NR_SYSCALL_BASE+271) +pciconfig_read (__NR_SYSCALL_BASE+272) +pciconfig_write (__NR_SYSCALL_BASE+273) +mq_open (__NR_SYSCALL_BASE+274) +mq_unlink (__NR_SYSCALL_BASE+275) +mq_timedsend (__NR_SYSCALL_BASE+276) +mq_timedreceive (__NR_SYSCALL_BASE+277) +mq_notify (__NR_SYSCALL_BASE+278) +mq_getsetattr (__NR_SYSCALL_BASE+279) +waitid (__NR_SYSCALL_BASE+280) +socket (__NR_SYSCALL_BASE+281) +bind (__NR_SYSCALL_BASE+282) +connect (__NR_SYSCALL_BASE+283) +listen (__NR_SYSCALL_BASE+284) +accept (__NR_SYSCALL_BASE+285) +getsockname (__NR_SYSCALL_BASE+286) +getpeername (__NR_SYSCALL_BASE+287) +socketpair (__NR_SYSCALL_BASE+288) +send (__NR_SYSCALL_BASE+289) +sendto (__NR_SYSCALL_BASE+290) +recv (__NR_SYSCALL_BASE+291) +recvfrom (__NR_SYSCALL_BASE+292) +shutdown (__NR_SYSCALL_BASE+293) +setsockopt (__NR_SYSCALL_BASE+294) +getsockopt (__NR_SYSCALL_BASE+295) +sendmsg (__NR_SYSCALL_BASE+296) +recvmsg (__NR_SYSCALL_BASE+297) +semop (__NR_SYSCALL_BASE+298) +semget (__NR_SYSCALL_BASE+299) +semctl (__NR_SYSCALL_BASE+300) +msgsnd (__NR_SYSCALL_BASE+301) +msgrcv (__NR_SYSCALL_BASE+302) +msgget (__NR_SYSCALL_BASE+303) +msgctl (__NR_SYSCALL_BASE+304) +shmat (__NR_SYSCALL_BASE+305) +shmdt (__NR_SYSCALL_BASE+306) +shmget (__NR_SYSCALL_BASE+307) +shmctl (__NR_SYSCALL_BASE+308) +add_key (__NR_SYSCALL_BASE+309) +request_key (__NR_SYSCALL_BASE+310) +keyctl (__NR_SYSCALL_BASE+311) +semtimedop (__NR_SYSCALL_BASE+312) +vserver (__NR_SYSCALL_BASE+313) +ioprio_set (__NR_SYSCALL_BASE+314) +ioprio_get (__NR_SYSCALL_BASE+315) +inotify_init (__NR_SYSCALL_BASE+316) +inotify_add_watch (__NR_SYSCALL_BASE+317) +inotify_rm_watch (__NR_SYSCALL_BASE+318) +mbind (__NR_SYSCALL_BASE+319) +get_mempolicy (__NR_SYSCALL_BASE+320) +set_mempolicy (__NR_SYSCALL_BASE+321) +openat (__NR_SYSCALL_BASE+322) +mkdirat (__NR_SYSCALL_BASE+323) +mknodat (__NR_SYSCALL_BASE+324) +fchownat (__NR_SYSCALL_BASE+325) +futimesat (__NR_SYSCALL_BASE+326) +fstatat64 (__NR_SYSCALL_BASE+327) +unlinkat (__NR_SYSCALL_BASE+328) +renameat (__NR_SYSCALL_BASE+329) +linkat (__NR_SYSCALL_BASE+330) +symlinkat (__NR_SYSCALL_BASE+331) +readlinkat (__NR_SYSCALL_BASE+332) +fchmodat (__NR_SYSCALL_BASE+333) +faccessat (__NR_SYSCALL_BASE+334) +pselect6 (__NR_SYSCALL_BASE+335) +ppoll (__NR_SYSCALL_BASE+336) +unshare (__NR_SYSCALL_BASE+337) +set_robust_list (__NR_SYSCALL_BASE+338) +get_robust_list (__NR_SYSCALL_BASE+339) +splice (__NR_SYSCALL_BASE+340) +arm_sync_file_range (__NR_SYSCALL_BASE+341) +sync_file_range2 __NR_arm_sync_file_range +tee (__NR_SYSCALL_BASE+342) +vmsplice (__NR_SYSCALL_BASE+343) +move_pages (__NR_SYSCALL_BASE+344) +getcpu (__NR_SYSCALL_BASE+345) +epoll_pwait (__NR_SYSCALL_BASE+346) +kexec_load (__NR_SYSCALL_BASE+347) +utimensat (__NR_SYSCALL_BASE+348) +signalfd (__NR_SYSCALL_BASE+349) +timerfd_create (__NR_SYSCALL_BASE+350) +eventfd (__NR_SYSCALL_BASE+351) +fallocate (__NR_SYSCALL_BASE+352) +timerfd_settime (__NR_SYSCALL_BASE+353) +timerfd_gettime (__NR_SYSCALL_BASE+354) +signalfd4 (__NR_SYSCALL_BASE+355) +eventfd2 (__NR_SYSCALL_BASE+356) +epoll_create1 (__NR_SYSCALL_BASE+357) +dup3 (__NR_SYSCALL_BASE+358) +pipe2 (__NR_SYSCALL_BASE+359) +inotify_init1 (__NR_SYSCALL_BASE+360) +preadv (__NR_SYSCALL_BASE+361) +pwritev (__NR_SYSCALL_BASE+362) +rt_tgsigqueueinfo (__NR_SYSCALL_BASE+363) +perf_event_open (__NR_SYSCALL_BASE+364) +recvmmsg (__NR_SYSCALL_BASE+365) +accept4 (__NR_SYSCALL_BASE+366) +fanotify_init (__NR_SYSCALL_BASE+367) +fanotify_mark (__NR_SYSCALL_BASE+368) +prlimit64 (__NR_SYSCALL_BASE+369) +name_to_handle_at (__NR_SYSCALL_BASE+370) +open_by_handle_at (__NR_SYSCALL_BASE+371) +clock_adjtime (__NR_SYSCALL_BASE+372) +syncfs (__NR_SYSCALL_BASE+373) +sendmmsg (__NR_SYSCALL_BASE+374) +setns (__NR_SYSCALL_BASE+375) +process_vm_readv (__NR_SYSCALL_BASE+376) +process_vm_writev (__NR_SYSCALL_BASE+377) +kcmp (__NR_SYSCALL_BASE+378) +finit_module (__NR_SYSCALL_BASE+379) +sched_setattr (__NR_SYSCALL_BASE+380) +sched_getattr (__NR_SYSCALL_BASE+381) +renameat2 (__NR_SYSCALL_BASE+382) +seccomp (__NR_SYSCALL_BASE+383) +getrandom (__NR_SYSCALL_BASE+384) +memfd_create (__NR_SYSCALL_BASE+385) +bpf (__NR_SYSCALL_BASE+386) +execveat (__NR_SYSCALL_BASE+387) +userfaultfd (__NR_SYSCALL_BASE+388) +membarrier (__NR_SYSCALL_BASE+389) +mlock2 (__NR_SYSCALL_BASE+390) +copy_file_range (__NR_SYSCALL_BASE+391) +preadv2 (__NR_SYSCALL_BASE+392) +pwritev2 (__NR_SYSCALL_BASE+393) +pkey_mprotect (__NR_SYSCALL_BASE+394) +pkey_alloc (__NR_SYSCALL_BASE+395) +pkey_free (__NR_SYSCALL_BASE+396) +statx (__NR_SYSCALL_BASE+397) +rseq (__NR_SYSCALL_BASE+398) +io_pgetevents (__NR_SYSCALL_BASE+399) +migrate_pages (__NR_SYSCALL_BASE+400) +kexec_file_load (__NR_SYSCALL_BASE+401) +clock_gettime64 (__NR_SYSCALL_BASE+403) +clock_settime64 (__NR_SYSCALL_BASE+404) +clock_adjtime64 (__NR_SYSCALL_BASE+405) +clock_getres_time64 (__NR_SYSCALL_BASE+406) +clock_nanosleep_time64 (__NR_SYSCALL_BASE+407) +timer_gettime64 (__NR_SYSCALL_BASE+408) +timer_settime64 (__NR_SYSCALL_BASE+409) +timerfd_gettime64 (__NR_SYSCALL_BASE+410) +timerfd_settime64 (__NR_SYSCALL_BASE+411) +utimensat_time64 (__NR_SYSCALL_BASE+412) +pselect6_time64 (__NR_SYSCALL_BASE+413) +ppoll_time64 (__NR_SYSCALL_BASE+414) +io_pgetevents_time64 (__NR_SYSCALL_BASE+416) +recvmmsg_time64 (__NR_SYSCALL_BASE+417) +mq_timedsend_time64 (__NR_SYSCALL_BASE+418) +mq_timedreceive_time64 (__NR_SYSCALL_BASE+419) +semtimedop_time64 (__NR_SYSCALL_BASE+420) +rt_sigtimedwait_time64 (__NR_SYSCALL_BASE+421) +futex_time64 (__NR_SYSCALL_BASE+422) +sched_rr_get_interval_time64 (__NR_SYSCALL_BASE+423) +pidfd_send_signal (__NR_SYSCALL_BASE+424) +io_uring_setup (__NR_SYSCALL_BASE+425) +io_uring_enter (__NR_SYSCALL_BASE+426) +io_uring_register (__NR_SYSCALL_BASE+427) +open_tree (__NR_SYSCALL_BASE+428) +move_mount (__NR_SYSCALL_BASE+429) +fsopen (__NR_SYSCALL_BASE+430) +fsconfig (__NR_SYSCALL_BASE+431) +fsmount (__NR_SYSCALL_BASE+432) +fspick (__NR_SYSCALL_BASE+433) +pidfd_open (__NR_SYSCALL_BASE+434) +clone3 (__NR_SYSCALL_BASE+435) +openat2 (__NR_SYSCALL_BASE+437) +pidfd_getfd (__NR_SYSCALL_BASE+438) diff --git a/fsstress/include/lapi/syscalls/hppa.in b/fsstress/include/lapi/syscalls/hppa.in new file mode 100644 index 0000000000..7f9b5e0a01 --- /dev/null +++ b/fsstress/include/lapi/syscalls/hppa.in @@ -0,0 +1,41 @@ +_sysctl 149 +openat 275 +mkdirat (__NR_openat + 1) +mknodat (__NR_openat + 2) +fchownat (__NR_openat + 3) +futimesat (__NR_openat + 4) +newfstatat (__NR_openat + 5) +fstatat64 (__NR_openat + 5) +unlinkat (__NR_openat + 6) +renameat (__NR_openat + 7) +linkat (__NR_openat + 8) +symlinkat (__NR_openat + 9) +readlinkat (__NR_openat + 10) +fchmodat (__NR_openat + 11) +faccessat (__NR_openat + 12) +splice 291 +tee 293 +vmsplice 294 +syncfs 327 +setns 328 +process_vm_readv 330 +process_vm_writev 331 +memfd_create 340 +membarrier 343 +execveat 342 +mlock2 345 +copy_file_range 346 +preadv2 347 +pwritev2 348 +io_pgetevents 350 +pidfd_send_signal 424 +io_uring_setup 425 +io_uring_enter 426 +io_uring_register 427 +open_tree 428 +move_mount 429 +fsopen 430 +fsconfig 431 +fsmount 432 +fspick 433 +pidfd_open 434 diff --git a/fsstress/include/lapi/syscalls/i386.in b/fsstress/include/lapi/syscalls/i386.in new file mode 100644 index 0000000000..d6773abcb0 --- /dev/null +++ b/fsstress/include/lapi/syscalls/i386.in @@ -0,0 +1,428 @@ +restart_syscall 0 +exit 1 +fork 2 +read 3 +write 4 +open 5 +close 6 +waitpid 7 +creat 8 +link 9 +unlink 10 +execve 11 +chdir 12 +time 13 +mknod 14 +chmod 15 +lchown 16 +break 17 +oldstat 18 +lseek 19 +getpid 20 +mount 21 +umount 22 +setuid 23 +getuid 24 +stime 25 +ptrace 26 +alarm 27 +oldfstat 28 +pause 29 +utime 30 +stty 31 +gtty 32 +access 33 +nice 34 +ftime 35 +sync 36 +kill 37 +rename 38 +mkdir 39 +rmdir 40 +dup 41 +pipe 42 +times 43 +prof 44 +brk 45 +setgid 46 +getgid 47 +signal 48 +geteuid 49 +getegid 50 +acct 51 +umount2 52 +lock 53 +ioctl 54 +fcntl 55 +mpx 56 +setpgid 57 +ulimit 58 +oldolduname 59 +umask 60 +chroot 61 +ustat 62 +dup2 63 +getppid 64 +getpgrp 65 +setsid 66 +sigaction 67 +sgetmask 68 +ssetmask 69 +setreuid 70 +setregid 71 +sigsuspend 72 +sigpending 73 +sethostname 74 +setrlimit 75 +getrlimit 76 +getrusage 77 +gettimeofday 78 +settimeofday 79 +getgroups 80 +setgroups 81 +select 82 +symlink 83 +oldlstat 84 +readlink 85 +uselib 86 +swapon 87 +reboot 88 +readdir 89 +mmap 90 +munmap 91 +truncate 92 +ftruncate 93 +fchmod 94 +fchown 95 +getpriority 96 +setpriority 97 +profil 98 +statfs 99 +fstatfs 100 +ioperm 101 +socketcall 102 +syslog 103 +setitimer 104 +getitimer 105 +stat 106 +lstat 107 +fstat 108 +olduname 109 +iopl 110 +vhangup 111 +idle 112 +vm86old 113 +wait4 114 +swapoff 115 +sysinfo 116 +ipc 117 +fsync 118 +sigreturn 119 +clone 120 +setdomainname 121 +uname 122 +modify_ldt 123 +adjtimex 124 +mprotect 125 +sigprocmask 126 +create_module 127 +init_module 128 +delete_module 129 +get_kernel_syms 130 +quotactl 131 +getpgid 132 +fchdir 133 +bdflush 134 +sysfs 135 +personality 136 +afs_syscall 137 +setfsuid 138 +setfsgid 139 +_llseek 140 +getdents 141 +_newselect 142 +flock 143 +msync 144 +readv 145 +writev 146 +getsid 147 +fdatasync 148 +_sysctl 149 +mlock 150 +munlock 151 +mlockall 152 +munlockall 153 +sched_setparam 154 +sched_getparam 155 +sched_setscheduler 156 +sched_getscheduler 157 +sched_yield 158 +sched_get_priority_max 159 +sched_get_priority_min 160 +sched_rr_get_interval 161 +nanosleep 162 +mremap 163 +setresuid 164 +getresuid 165 +vm86 166 +query_module 167 +poll 168 +nfsservctl 169 +setresgid 170 +getresgid 171 +prctl 172 +rt_sigreturn 173 +rt_sigaction 174 +rt_sigprocmask 175 +rt_sigpending 176 +rt_sigtimedwait 177 +rt_sigqueueinfo 178 +rt_sigsuspend 179 +pread64 180 +pwrite64 181 +chown 182 +getcwd 183 +capget 184 +capset 185 +sigaltstack 186 +sendfile 187 +getpmsg 188 +putpmsg 189 +vfork 190 +ugetrlimit 191 +mmap2 192 +truncate64 193 +ftruncate64 194 +stat64 195 +lstat64 196 +fstat64 197 +lchown32 198 +getuid32 199 +getgid32 200 +geteuid32 201 +getegid32 202 +setreuid32 203 +setregid32 204 +getgroups32 205 +setgroups32 206 +fchown32 207 +setresuid32 208 +getresuid32 209 +setresgid32 210 +getresgid32 211 +chown32 212 +setuid32 213 +setgid32 214 +setfsuid32 215 +setfsgid32 216 +pivot_root 217 +mincore 218 +madvise 219 +madvise1 219 +getdents64 220 +fcntl64 221 +gettid 224 +readahead 225 +setxattr 226 +lsetxattr 227 +fsetxattr 228 +getxattr 229 +lgetxattr 230 +fgetxattr 231 +listxattr 232 +llistxattr 233 +flistxattr 234 +removexattr 235 +lremovexattr 236 +fremovexattr 237 +tkill 238 +sendfile64 239 +futex 240 +sched_setaffinity 241 +sched_getaffinity 242 +set_thread_area 243 +get_thread_area 244 +io_setup 245 +io_destroy 246 +io_getevents 247 +io_submit 248 +io_cancel 249 +fadvise64 250 +exit_group 252 +lookup_dcookie 253 +epoll_create 254 +epoll_ctl 255 +epoll_wait 256 +remap_file_pages 257 +set_tid_address 258 +timer_create 259 +timer_settime 260 +timer_gettime 261 +timer_getoverrun 262 +timer_delete 263 +clock_settime 264 +clock_gettime 265 +clock_getres 266 +clock_nanosleep 267 +statfs64 268 +fstatfs64 269 +tgkill 270 +utimes 271 +fadvise64_64 272 +vserver 273 +mbind 274 +get_mempolicy 275 +set_mempolicy 276 +mq_open 277 +mq_unlink 278 +mq_timedsend 279 +mq_timedreceive 280 +mq_notify 281 +mq_getsetattr 282 +kexec_load 283 +waitid 284 +add_key 286 +request_key 287 +keyctl 288 +ioprio_set 289 +ioprio_get 290 +inotify_init 291 +inotify_add_watch 292 +inotify_rm_watch 293 +migrate_pages 294 +openat 295 +mkdirat 296 +mknodat 297 +fchownat 298 +futimesat 299 +fstatat64 300 +unlinkat 301 +renameat 302 +linkat 303 +symlinkat 304 +readlinkat 305 +fchmodat 306 +faccessat 307 +pselect6 308 +ppoll 309 +unshare 310 +set_robust_list 311 +get_robust_list 312 +splice 313 +sync_file_range 314 +tee 315 +vmsplice 316 +move_pages 317 +getcpu 318 +epoll_pwait 319 +utimensat 320 +signalfd 321 +timerfd_create 322 +eventfd 323 +fallocate 324 +timerfd_settime 325 +timerfd_gettime 326 +signalfd4 327 +eventfd2 328 +epoll_create1 329 +dup3 330 +pipe2 331 +inotify_init1 332 +preadv 333 +pwritev 334 +rt_tgsigqueueinfo 335 +perf_event_open 336 +recvmmsg 337 +fanotify_init 338 +fanotify_mark 339 +prlimit64 340 +name_to_handle_at 341 +open_by_handle_at 342 +clock_adjtime 343 +syncfs 344 +sendmmsg 345 +setns 346 +process_vm_readv 347 +process_vm_writev 348 +kcmp 349 +finit_module 350 +sched_setattr 351 +sched_getattr 352 +renameat2 353 +seccomp 354 +getrandom 355 +memfd_create 356 +bpf 357 +execveat 358 +socket 359 +socketpair 360 +bind 361 +connect 362 +listen 363 +accept4 364 +getsockopt 365 +setsockopt 366 +getsockname 367 +getpeername 368 +sendto 369 +sendmsg 370 +recvfrom 371 +recvmsg 372 +shutdown 373 +userfaultfd 374 +membarrier 375 +mlock2 376 +copy_file_range 377 +preadv2 378 +pwritev2 379 +pkey_mprotect 380 +pkey_alloc 381 +pkey_free 382 +statx 383 +arch_prctl 384 +io_pgetevents 385 +rseq 386 +semget 393 +semctl 394 +shmget 395 +shmctl 396 +shmat 397 +shmdt 398 +msgget 399 +msgsnd 400 +msgrcv 401 +msgctl 402 +clock_gettime64 403 +clock_settime64 404 +clock_adjtime64 405 +clock_getres_time64 406 +clock_nanosleep_time64 407 +timer_gettime64 408 +timer_settime64 409 +timerfd_gettime64 410 +timerfd_settime64 411 +utimensat_time64 412 +pselect6_time64 413 +ppoll_time64 414 +io_pgetevents_time64 416 +recvmmsg_time64 417 +mq_timedsend_time64 418 +mq_timedreceive_time64 419 +semtimedop_time64 420 +rt_sigtimedwait_time64 421 +futex_time64 422 +sched_rr_get_interval_time64 423 +pidfd_send_signal 424 +io_uring_setup 425 +io_uring_enter 426 +io_uring_register 427 +open_tree 428 +move_mount 429 +fsopen 430 +fsconfig 431 +fsmount 432 +fspick 433 +pidfd_open 434 +clone3 435 +openat2 437 +pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/ia64.in b/fsstress/include/lapi/syscalls/ia64.in new file mode 100644 index 0000000000..427b711b1c --- /dev/null +++ b/fsstress/include/lapi/syscalls/ia64.in @@ -0,0 +1,341 @@ +ni_syscall 1024 +exit 1025 +read 1026 +write 1027 +open 1028 +close 1029 +creat 1030 +link 1031 +unlink 1032 +execve 1033 +chdir 1034 +fchdir 1035 +utimes 1036 +mknod 1037 +chmod 1038 +chown 1039 +lseek 1040 +getpid 1041 +getppid 1042 +mount 1043 +umount2 1044 +setuid 1045 +getuid 1046 +geteuid 1047 +ptrace 1048 +access 1049 +sync 1050 +fsync 1051 +fdatasync 1052 +kill 1053 +rename 1054 +mkdir 1055 +rmdir 1056 +dup 1057 +pipe 1058 +times 1059 +brk 1060 +setgid 1061 +getgid 1062 +getegid 1063 +acct 1064 +ioctl 1065 +fcntl 1066 +umask 1067 +chroot 1068 +ustat 1069 +dup2 1070 +setreuid 1071 +setregid 1072 +getresuid 1073 +setresuid 1074 +getresgid 1075 +setresgid 1076 +getgroups 1077 +setgroups 1078 +getpgid 1079 +setpgid 1080 +setsid 1081 +getsid 1082 +sethostname 1083 +setrlimit 1084 +getrlimit 1085 +getrusage 1086 +gettimeofday 1087 +settimeofday 1088 +select 1089 +poll 1090 +symlink 1091 +readlink 1092 +uselib 1093 +swapon 1094 +swapoff 1095 +reboot 1096 +truncate 1097 +ftruncate 1098 +fchmod 1099 +fchown 1100 +getpriority 1101 +setpriority 1102 +statfs 1103 +fstatfs 1104 +gettid 1105 +semget 1106 +semop 1107 +semctl 1108 +msgget 1109 +msgsnd 1110 +msgrcv 1111 +msgctl 1112 +shmget 1113 +shmat 1114 +shmdt 1115 +shmctl 1116 +syslog 1117 +setitimer 1118 +getitimer 1119 +vhangup 1123 +lchown 1124 +remap_file_pages 1125 +wait4 1126 +sysinfo 1127 +clone 1128 +setdomainname 1129 +uname 1130 +adjtimex 1131 +init_module 1133 +delete_module 1134 +quotactl 1137 +bdflush 1138 +sysfs 1139 +personality 1140 +afs_syscall 1141 +setfsuid 1142 +setfsgid 1143 +getdents 1144 +flock 1145 +readv 1146 +writev 1147 +pread64 1148 +pwrite64 1149 +_sysctl 1150 +mmap 1151 +munmap 1152 +mlock 1153 +mlockall 1154 +mprotect 1155 +mremap 1156 +msync 1157 +munlock 1158 +munlockall 1159 +sched_getparam 1160 +sched_setparam 1161 +sched_getscheduler 1162 +sched_setscheduler 1163 +sched_yield 1164 +sched_get_priority_max 1165 +sched_get_priority_min 1166 +sched_rr_get_interval 1167 +nanosleep 1168 +nfsservctl 1169 +prctl 1170 +old_getpagesize 1171 +mmap2 1172 +pciconfig_read 1173 +pciconfig_write 1174 +perfmonctl 1175 +sigaltstack 1176 +rt_sigaction 1177 +rt_sigpending 1178 +rt_sigprocmask 1179 +rt_sigqueueinfo 1180 +rt_sigreturn 1181 +rt_sigsuspend 1182 +rt_sigtimedwait 1183 +getcwd 1184 +capget 1185 +capset 1186 +sendfile 1187 +getpmsg 1188 +putpmsg 1189 +socket 1190 +bind 1191 +connect 1192 +listen 1193 +accept 1194 +getsockname 1195 +getpeername 1196 +socketpair 1197 +send 1198 +sendto 1199 +recv 1200 +recvfrom 1201 +shutdown 1202 +setsockopt 1203 +getsockopt 1204 +sendmsg 1205 +recvmsg 1206 +pivot_root 1207 +mincore 1208 +madvise 1209 +stat 1210 +lstat 1211 +fstat 1212 +clone2 1213 +getdents64 1214 +getunwind 1215 +readahead 1216 +setxattr 1217 +lsetxattr 1218 +fsetxattr 1219 +getxattr 1220 +lgetxattr 1221 +fgetxattr 1222 +listxattr 1223 +llistxattr 1224 +flistxattr 1225 +removexattr 1226 +lremovexattr 1227 +fremovexattr 1228 +tkill 1229 +futex 1230 +sched_setaffinity 1231 +sched_getaffinity 1232 +set_tid_address 1233 +fadvise64 1234 +tgkill 1235 +exit_group 1236 +lookup_dcookie 1237 +io_setup 1238 +io_destroy 1239 +io_getevents 1240 +io_submit 1241 +io_cancel 1242 +epoll_create 1243 +epoll_ctl 1244 +epoll_wait 1245 +restart_syscall 1246 +semtimedop 1247 +timer_create 1248 +timer_settime 1249 +timer_gettime 1250 +timer_getoverrun 1251 +timer_delete 1252 +clock_settime 1253 +clock_gettime 1254 +clock_getres 1255 +clock_nanosleep 1256 +fstatfs64 1257 +statfs64 1258 +mbind 1259 +get_mempolicy 1260 +set_mempolicy 1261 +mq_open 1262 +mq_unlink 1263 +mq_timedsend 1264 +mq_timedreceive 1265 +mq_notify 1266 +mq_getsetattr 1267 +kexec_load 1268 +vserver 1269 +waitid 1270 +add_key 1271 +request_key 1272 +keyctl 1273 +ioprio_set 1274 +ioprio_get 1275 +move_pages 1276 +inotify_init 1277 +inotify_add_watch 1278 +inotify_rm_watch 1279 +migrate_pages 1280 +openat 1281 +mkdirat 1282 +mknodat 1283 +fchownat 1284 +futimesat 1285 +newfstatat 1286 +unlinkat 1287 +renameat 1288 +linkat 1289 +symlinkat 1290 +readlinkat 1291 +fchmodat 1292 +faccessat 1293 +pselect6 1294 +ppoll 1295 +unshare 1296 +splice 1297 +set_robust_list 1298 +get_robust_list 1299 +sync_file_range 1300 +tee 1301 +vmsplice 1302 +fallocate 1303 +getcpu 1304 +epoll_pwait 1305 +utimensat 1306 +signalfd 1307 +timerfd 1308 +eventfd 1309 +timerfd_create 1310 +timerfd_settime 1311 +timerfd_gettime 1312 +signalfd4 1313 +eventfd2 1314 +epoll_create1 1315 +dup3 1316 +pipe2 1317 +inotify_init1 1318 +preadv 1319 +pwritev 1320 +rt_tgsigqueueinfo 1321 +recvmmsg 1322 +fanotify_init 1323 +fanotify_mark 1324 +prlimit64 1325 +name_to_handle_at 1326 +open_by_handle_at 1327 +clock_adjtime 1328 +syncfs 1329 +setns 1330 +sendmmsg 1331 +process_vm_readv 1332 +process_vm_writev 1333 +accept4 1334 +finit_module 1335 +sched_setattr 1336 +sched_getattr 1337 +renameat2 1338 +getrandom 1339 +memfd_create 1340 +bpf 1341 +execveat 1342 +userfaultfd 1343 +membarrier 1344 +kcmp 1345 +mlock2 1346 +copy_file_range 1347 +preadv2 1348 +pwritev2 1349 +statx 1350 +io_pgetevents 1351 +perf_event_open 1352 +seccomp 1353 +pkey_mprotect 1354 +pkey_alloc 1355 +pkey_free 1356 +rseq 1357 +pidfd_send_signal 1448 +io_uring_setup 1449 +io_uring_enter 1450 +io_uring_register 1451 +open_tree 1452 +move_mount 1453 +fsopen 1454 +fsconfig 1455 +fsmount 1456 +fspick 1457 +pidfd_open 1458 +openat2 1461 +pidfd_getfd 1462 diff --git a/fsstress/include/lapi/syscalls/mips_n32.in b/fsstress/include/lapi/syscalls/mips_n32.in new file mode 100644 index 0000000000..eb6140ebc4 --- /dev/null +++ b/fsstress/include/lapi/syscalls/mips_n32.in @@ -0,0 +1,366 @@ +read 0 +write 1 +open 2 +close 3 +stat 4 +fstat 5 +lstat 6 +poll 7 +lseek 8 +mmap 9 +mprotect 10 +munmap 11 +brk 12 +rt_sigaction 13 +rt_sigprocmask 14 +ioctl 15 +pread64 16 +pwrite64 17 +readv 18 +writev 19 +access 20 +pipe 21 +_newselect 22 +sched_yield 23 +mremap 24 +msync 25 +mincore 26 +madvise 27 +shmget 28 +shmat 29 +shmctl 30 +dup 31 +dup2 32 +pause 33 +nanosleep 34 +getitimer 35 +setitimer 36 +alarm 37 +getpid 38 +sendfile 39 +socket 40 +connect 41 +accept 42 +sendto 43 +recvfrom 44 +sendmsg 45 +recvmsg 46 +shutdown 47 +bind 48 +listen 49 +getsockname 50 +getpeername 51 +socketpair 52 +setsockopt 53 +getsockopt 54 +clone 55 +fork 56 +execve 57 +exit 58 +wait4 59 +kill 60 +uname 61 +semget 62 +semop 63 +semctl 64 +shmdt 65 +msgget 66 +msgsnd 67 +msgrcv 68 +msgctl 69 +fcntl 70 +flock 71 +fsync 72 +fdatasync 73 +truncate 74 +ftruncate 75 +getdents 76 +getcwd 77 +chdir 78 +fchdir 79 +rename 80 +mkdir 81 +rmdir 82 +creat 83 +link 84 +unlink 85 +symlink 86 +readlink 87 +chmod 88 +fchmod 89 +chown 90 +fchown 91 +lchown 92 +umask 93 +gettimeofday 94 +getrlimit 95 +getrusage 96 +sysinfo 97 +times 98 +ptrace 99 +getuid 100 +syslog 101 +getgid 102 +setuid 103 +setgid 104 +geteuid 105 +getegid 106 +setpgid 107 +getppid 108 +getpgrp 109 +setsid 110 +setreuid 111 +setregid 112 +getgroups 113 +setgroups 114 +setresuid 115 +getresuid 116 +setresgid 117 +getresgid 118 +getpgid 119 +setfsuid 120 +setfsgid 121 +getsid 122 +capget 123 +capset 124 +rt_sigpending 125 +rt_sigtimedwait 126 +rt_sigqueueinfo 127 +rt_sigsuspend 128 +sigaltstack 129 +utime 130 +mknod 131 +personality 132 +ustat 133 +statfs 134 +fstatfs 135 +sysfs 136 +getpriority 137 +setpriority 138 +sched_setparam 139 +sched_getparam 140 +sched_setscheduler 141 +sched_getscheduler 142 +sched_get_priority_max 143 +sched_get_priority_min 144 +sched_rr_get_interval 145 +mlock 146 +munlock 147 +mlockall 148 +munlockall 149 +vhangup 150 +pivot_root 151 +_sysctl 152 +prctl 153 +adjtimex 154 +setrlimit 155 +chroot 156 +sync 157 +acct 158 +settimeofday 159 +mount 160 +umount2 161 +swapon 162 +swapoff 163 +reboot 164 +sethostname 165 +setdomainname 166 +create_module 167 +init_module 168 +delete_module 169 +get_kernel_syms 170 +query_module 171 +quotactl 172 +nfsservctl 173 +getpmsg 174 +putpmsg 175 +afs_syscall 176 +reserved177 177 +gettid 178 +readahead 179 +setxattr 180 +lsetxattr 181 +fsetxattr 182 +getxattr 183 +lgetxattr 184 +fgetxattr 185 +listxattr 186 +llistxattr 187 +flistxattr 188 +removexattr 189 +lremovexattr 190 +fremovexattr 191 +tkill 192 +reserved193 193 +futex 194 +sched_setaffinity 195 +sched_getaffinity 196 +cacheflush 197 +cachectl 198 +sysmips 199 +io_setup 200 +io_destroy 201 +io_getevents 202 +io_submit 203 +io_cancel 204 +exit_group 205 +lookup_dcookie 206 +epoll_create 207 +epoll_ctl 208 +epoll_wait 209 +remap_file_pages 210 +rt_sigreturn 211 +fcntl64 212 +set_tid_address 213 +restart_syscall 214 +semtimedop 215 +fadvise64 216 +statfs64 217 +fstatfs64 218 +sendfile64 219 +timer_create 220 +timer_settime 221 +timer_gettime 222 +timer_getoverrun 223 +timer_delete 224 +clock_settime 225 +clock_gettime 226 +clock_getres 227 +clock_nanosleep 228 +tgkill 229 +utimes 230 +mbind 231 +get_mempolicy 232 +set_mempolicy 233 +mq_open 234 +mq_unlink 235 +mq_timedsend 236 +mq_timedreceive 237 +mq_notify 238 +mq_getsetattr 239 +vserver 240 +waitid 241 +add_key 243 +request_key 244 +keyctl 245 +set_thread_area 246 +inotify_init 247 +inotify_add_watch 248 +inotify_rm_watch 249 +migrate_pages 250 +openat 251 +mkdirat 252 +mknodat 253 +fchownat 254 +futimesat 255 +newfstatat 256 +unlinkat 257 +renameat 258 +linkat 259 +symlinkat 260 +readlinkat 261 +fchmodat 262 +faccessat 263 +pselect6 264 +ppoll 265 +unshare 266 +splice 267 +sync_file_range 268 +tee 269 +vmsplice 270 +move_pages 271 +set_robust_list 272 +get_robust_list 273 +kexec_load 274 +getcpu 275 +epoll_pwait 276 +ioprio_set 277 +ioprio_get 278 +utimensat 279 +signalfd 280 +timerfd 281 +eventfd 282 +fallocate 283 +timerfd_create 284 +timerfd_gettime 285 +timerfd_settime 286 +signalfd4 287 +eventfd2 288 +epoll_create1 289 +dup3 290 +pipe2 291 +inotify_init1 292 +preadv 293 +pwritev 294 +rt_tgsigqueueinfo 295 +perf_event_open 296 +accept4 297 +recvmmsg 298 +getdents64 299 +fanotify_init 300 +fanotify_mark 301 +prlimit64 302 +name_to_handle_at 303 +open_by_handle_at 304 +clock_adjtime 305 +syncfs 306 +sendmmsg 307 +setns 308 +process_vm_readv 309 +process_vm_writev 310 +kcmp 311 +finit_module 312 +sched_setattr 313 +sched_getattr 314 +renameat2 315 +seccomp 316 +getrandom 317 +memfd_create 318 +bpf 319 +execveat 320 +userfaultfd 321 +membarrier 322 +mlock2 323 +copy_file_range 324 +preadv2 325 +pwritev2 326 +pkey_mprotect 327 +pkey_alloc 328 +pkey_free 329 +statx 330 +rseq 331 +io_pgetevents 332 +clock_gettime64 403 +clock_settime64 404 +clock_adjtime64 405 +clock_getres_time64 406 +clock_nanosleep_time64 407 +timer_gettime64 408 +timer_settime64 409 +timerfd_gettime64 410 +timerfd_settime64 411 +utimensat_time64 412 +pselect6_time64 413 +ppoll_time64 414 +io_pgetevents_time64 416 +recvmmsg_time64 417 +mq_timedsend_time64 418 +mq_timedreceive_time64 419 +semtimedop_time64 420 +rt_sigtimedwait_time64 421 +futex_time64 422 +sched_rr_get_interval_time64 423 +pidfd_send_signal 424 +io_uring_setup 425 +io_uring_enter 426 +io_uring_register 427 +open_tree 428 +move_mount 429 +fsopen 430 +fsconfig 431 +fsmount 432 +fspick 433 +pidfd_open 434 +clone3 435 +openat2 437 +pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/mips_n64.in b/fsstress/include/lapi/syscalls/mips_n64.in new file mode 100644 index 0000000000..5480aa3c9c --- /dev/null +++ b/fsstress/include/lapi/syscalls/mips_n64.in @@ -0,0 +1,342 @@ +read 0 +write 1 +open 2 +close 3 +stat 4 +fstat 5 +lstat 6 +poll 7 +lseek 8 +mmap 9 +mprotect 10 +munmap 11 +brk 12 +rt_sigaction 13 +rt_sigprocmask 14 +ioctl 15 +pread64 16 +pwrite64 17 +readv 18 +writev 19 +access 20 +pipe 21 +_newselect 22 +sched_yield 23 +mremap 24 +msync 25 +mincore 26 +madvise 27 +shmget 28 +shmat 29 +shmctl 30 +dup 31 +dup2 32 +pause 33 +nanosleep 34 +getitimer 35 +setitimer 36 +alarm 37 +getpid 38 +sendfile 39 +socket 40 +connect 41 +accept 42 +sendto 43 +recvfrom 44 +sendmsg 45 +recvmsg 46 +shutdown 47 +bind 48 +listen 49 +getsockname 50 +getpeername 51 +socketpair 52 +setsockopt 53 +getsockopt 54 +clone 55 +fork 56 +execve 57 +exit 58 +wait4 59 +kill 60 +uname 61 +semget 62 +semop 63 +semctl 64 +shmdt 65 +msgget 66 +msgsnd 67 +msgrcv 68 +msgctl 69 +fcntl 70 +flock 71 +fsync 72 +fdatasync 73 +truncate 74 +ftruncate 75 +getdents 76 +getcwd 77 +chdir 78 +fchdir 79 +rename 80 +mkdir 81 +rmdir 82 +creat 83 +link 84 +unlink 85 +symlink 86 +readlink 87 +chmod 88 +fchmod 89 +chown 90 +fchown 91 +lchown 92 +umask 93 +gettimeofday 94 +getrlimit 95 +getrusage 96 +sysinfo 97 +times 98 +ptrace 99 +getuid 100 +syslog 101 +getgid 102 +setuid 103 +setgid 104 +geteuid 105 +getegid 106 +setpgid 107 +getppid 108 +getpgrp 109 +setsid 110 +setreuid 111 +setregid 112 +getgroups 113 +setgroups 114 +setresuid 115 +getresuid 116 +setresgid 117 +getresgid 118 +getpgid 119 +setfsuid 120 +setfsgid 121 +getsid 122 +capget 123 +capset 124 +rt_sigpending 125 +rt_sigtimedwait 126 +rt_sigqueueinfo 127 +rt_sigsuspend 128 +sigaltstack 129 +utime 130 +mknod 131 +personality 132 +ustat 133 +statfs 134 +fstatfs 135 +sysfs 136 +getpriority 137 +setpriority 138 +sched_setparam 139 +sched_getparam 140 +sched_setscheduler 141 +sched_getscheduler 142 +sched_get_priority_max 143 +sched_get_priority_min 144 +sched_rr_get_interval 145 +mlock 146 +munlock 147 +mlockall 148 +munlockall 149 +vhangup 150 +pivot_root 151 +_sysctl 152 +prctl 153 +adjtimex 154 +setrlimit 155 +chroot 156 +sync 157 +acct 158 +settimeofday 159 +mount 160 +umount2 161 +swapon 162 +swapoff 163 +reboot 164 +sethostname 165 +setdomainname 166 +create_module 167 +init_module 168 +delete_module 169 +get_kernel_syms 170 +query_module 171 +quotactl 172 +nfsservctl 173 +getpmsg 174 +putpmsg 175 +afs_syscall 176 +reserved177 177 +gettid 178 +readahead 179 +setxattr 180 +lsetxattr 181 +fsetxattr 182 +getxattr 183 +lgetxattr 184 +fgetxattr 185 +listxattr 186 +llistxattr 187 +flistxattr 188 +removexattr 189 +lremovexattr 190 +fremovexattr 191 +tkill 192 +reserved193 193 +futex 194 +sched_setaffinity 195 +sched_getaffinity 196 +cacheflush 197 +cachectl 198 +sysmips 199 +io_setup 200 +io_destroy 201 +io_getevents 202 +io_submit 203 +io_cancel 204 +exit_group 205 +lookup_dcookie 206 +epoll_create 207 +epoll_ctl 208 +epoll_wait 209 +remap_file_pages 210 +rt_sigreturn 211 +set_tid_address 212 +restart_syscall 213 +semtimedop 214 +fadvise64 215 +timer_create 216 +timer_settime 217 +timer_gettime 218 +timer_getoverrun 219 +timer_delete 220 +clock_settime 221 +clock_gettime 222 +clock_getres 223 +clock_nanosleep 224 +tgkill 225 +utimes 226 +mbind 227 +get_mempolicy 228 +set_mempolicy 229 +mq_open 230 +mq_unlink 231 +mq_timedsend 232 +mq_timedreceive 233 +mq_notify 234 +mq_getsetattr 235 +vserver 236 +waitid 237 +add_key 239 +request_key 240 +keyctl 241 +set_thread_area 242 +inotify_init 243 +inotify_add_watch 244 +inotify_rm_watch 245 +migrate_pages 246 +openat 247 +mkdirat 248 +mknodat 249 +fchownat 250 +futimesat 251 +newfstatat 252 +unlinkat 253 +renameat 254 +linkat 255 +symlinkat 256 +readlinkat 257 +fchmodat 258 +faccessat 259 +pselect6 260 +ppoll 261 +unshare 262 +splice 263 +sync_file_range 264 +tee 265 +vmsplice 266 +move_pages 267 +set_robust_list 268 +get_robust_list 269 +kexec_load 270 +getcpu 271 +epoll_pwait 272 +ioprio_set 273 +ioprio_get 274 +utimensat 275 +signalfd 276 +timerfd 277 +eventfd 278 +fallocate 279 +timerfd_create 280 +timerfd_gettime 281 +timerfd_settime 282 +signalfd4 283 +eventfd2 284 +epoll_create1 285 +dup3 286 +pipe2 287 +inotify_init1 288 +preadv 289 +pwritev 290 +rt_tgsigqueueinfo 291 +perf_event_open 292 +accept4 293 +recvmmsg 294 +fanotify_init 295 +fanotify_mark 296 +prlimit64 297 +name_to_handle_at 298 +open_by_handle_at 299 +clock_adjtime 300 +syncfs 301 +sendmmsg 302 +setns 303 +process_vm_readv 304 +process_vm_writev 305 +kcmp 306 +finit_module 307 +getdents64 308 +sched_setattr 309 +sched_getattr 310 +renameat2 311 +seccomp 312 +getrandom 313 +memfd_create 314 +bpf 315 +execveat 316 +userfaultfd 317 +membarrier 318 +mlock2 319 +copy_file_range 320 +preadv2 321 +pwritev2 322 +pkey_mprotect 323 +pkey_alloc 324 +pkey_free 325 +statx 326 +rseq 327 +io_pgetevents 328 +pidfd_send_signal 424 +io_uring_setup 425 +io_uring_enter 426 +io_uring_register 427 +open_tree 428 +move_mount 429 +fsopen 430 +fsconfig 431 +fsmount 432 +fspick 433 +pidfd_open 434 +clone3 435 +openat2 437 +pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/mips_o32.in b/fsstress/include/lapi/syscalls/mips_o32.in new file mode 100644 index 0000000000..feee8fbf35 --- /dev/null +++ b/fsstress/include/lapi/syscalls/mips_o32.in @@ -0,0 +1,412 @@ +syscall 0 +exit 1 +fork 2 +read 3 +write 4 +open 5 +close 6 +waitpid 7 +creat 8 +link 9 +unlink 10 +execve 11 +chdir 12 +time 13 +mknod 14 +chmod 15 +lchown 16 +break 17 +unused18 18 +lseek 19 +getpid 20 +mount 21 +umount 22 +setuid 23 +getuid 24 +stime 25 +ptrace 26 +alarm 27 +unused28 28 +pause 29 +utime 30 +stty 31 +gtty 32 +access 33 +nice 34 +ftime 35 +sync 36 +kill 37 +rename 38 +mkdir 39 +rmdir 40 +dup 41 +pipe 42 +times 43 +prof 44 +brk 45 +setgid 46 +getgid 47 +signal 48 +geteuid 49 +getegid 50 +acct 51 +umount2 52 +lock 53 +ioctl 54 +fcntl 55 +mpx 56 +setpgid 57 +ulimit 58 +unused59 59 +umask 60 +chroot 61 +ustat 62 +dup2 63 +getppid 64 +getpgrp 65 +setsid 66 +sigaction 67 +sgetmask 68 +ssetmask 69 +setreuid 70 +setregid 71 +sigsuspend 72 +sigpending 73 +sethostname 74 +setrlimit 75 +getrlimit 76 +getrusage 77 +gettimeofday 78 +settimeofday 79 +getgroups 80 +setgroups 81 +reserved82 82 +symlink 83 +unused84 84 +readlink 85 +uselib 86 +swapon 87 +reboot 88 +readdir 89 +mmap 90 +munmap 91 +truncate 92 +ftruncate 93 +fchmod 94 +fchown 95 +getpriority 96 +setpriority 97 +profil 98 +statfs 99 +fstatfs 100 +ioperm 101 +socketcall 102 +syslog 103 +setitimer 104 +getitimer 105 +stat 106 +lstat 107 +fstat 108 +unused109 109 +iopl 110 +vhangup 111 +idle 112 +vm86 113 +wait4 114 +swapoff 115 +sysinfo 116 +ipc 117 +fsync 118 +sigreturn 119 +clone 120 +setdomainname 121 +uname 122 +modify_ldt 123 +adjtimex 124 +mprotect 125 +sigprocmask 126 +create_module 127 +init_module 128 +delete_module 129 +get_kernel_syms 130 +quotactl 131 +getpgid 132 +fchdir 133 +bdflush 134 +sysfs 135 +personality 136 +afs_syscall 137 +setfsuid 138 +setfsgid 139 +_llseek 140 +getdents 141 +_newselect 142 +flock 143 +msync 144 +readv 145 +writev 146 +cacheflush 147 +cachectl 148 +sysmips 149 +unused150 150 +getsid 151 +fdatasync 152 +_sysctl 153 +mlock 154 +munlock 155 +mlockall 156 +munlockall 157 +sched_setparam 158 +sched_getparam 159 +sched_setscheduler 160 +sched_getscheduler 161 +sched_yield 162 +sched_get_priority_max 163 +sched_get_priority_min 164 +sched_rr_get_interval 165 +nanosleep 166 +mremap 167 +accept 168 +bind 169 +connect 170 +getpeername 171 +getsockname 172 +getsockopt 173 +listen 174 +recv 175 +recvfrom 176 +recvmsg 177 +send 178 +sendmsg 179 +sendto 180 +setsockopt 181 +shutdown 182 +socket 183 +socketpair 184 +setresuid 185 +getresuid 186 +query_module 187 +poll 188 +nfsservctl 189 +setresgid 190 +getresgid 191 +prctl 192 +rt_sigreturn 193 +rt_sigaction 194 +rt_sigprocmask 195 +rt_sigpending 196 +rt_sigtimedwait 197 +rt_sigqueueinfo 198 +rt_sigsuspend 199 +pread64 200 +pwrite64 201 +chown 202 +getcwd 203 +capget 204 +capset 205 +sigaltstack 206 +sendfile 207 +getpmsg 208 +putpmsg 209 +mmap2 210 +truncate64 211 +ftruncate64 212 +stat64 213 +lstat64 214 +fstat64 215 +pivot_root 216 +mincore 217 +madvise 218 +getdents64 219 +fcntl64 220 +reserved221 221 +gettid 222 +readahead 223 +setxattr 224 +lsetxattr 225 +fsetxattr 226 +getxattr 227 +lgetxattr 228 +fgetxattr 229 +listxattr 230 +llistxattr 231 +flistxattr 232 +removexattr 233 +lremovexattr 234 +fremovexattr 235 +tkill 236 +sendfile64 237 +futex 238 +sched_setaffinity 239 +sched_getaffinity 240 +io_setup 241 +io_destroy 242 +io_getevents 243 +io_submit 244 +io_cancel 245 +exit_group 246 +lookup_dcookie 247 +epoll_create 248 +epoll_ctl 249 +epoll_wait 250 +remap_file_pages 251 +set_tid_address 252 +restart_syscall 253 +fadvise64 254 +statfs64 255 +fstatfs64 256 +timer_create 257 +timer_settime 258 +timer_gettime 259 +timer_getoverrun 260 +timer_delete 261 +clock_settime 262 +clock_gettime 263 +clock_getres 264 +clock_nanosleep 265 +tgkill 266 +utimes 267 +mbind 268 +get_mempolicy 269 +set_mempolicy 270 +mq_open 271 +mq_unlink 272 +mq_timedsend 273 +mq_timedreceive 274 +mq_notify 275 +mq_getsetattr 276 +vserver 277 +waitid 278 +add_key 280 +request_key 281 +keyctl 282 +set_thread_area 283 +inotify_init 284 +inotify_add_watch 285 +inotify_rm_watch 286 +migrate_pages 287 +openat 288 +mkdirat 289 +mknodat 290 +fchownat 291 +futimesat 292 +fstatat64 293 +unlinkat 294 +renameat 295 +linkat 296 +symlinkat 297 +readlinkat 298 +fchmodat 299 +faccessat 300 +pselect6 301 +ppoll 302 +unshare 303 +splice 304 +sync_file_range 305 +tee 306 +vmsplice 307 +move_pages 308 +set_robust_list 309 +get_robust_list 310 +kexec_load 311 +getcpu 312 +epoll_pwait 313 +ioprio_set 314 +ioprio_get 315 +utimensat 316 +signalfd 317 +timerfd 318 +eventfd 319 +fallocate 320 +timerfd_create 321 +timerfd_gettime 322 +timerfd_settime 323 +signalfd4 324 +eventfd2 325 +epoll_create1 326 +dup3 327 +pipe2 328 +inotify_init1 329 +preadv 330 +pwritev 331 +rt_tgsigqueueinfo 332 +perf_event_open 333 +accept4 334 +recvmmsg 335 +fanotify_init 336 +fanotify_mark 337 +prlimit64 338 +name_to_handle_at 339 +open_by_handle_at 340 +clock_adjtime 341 +syncfs 342 +sendmmsg 343 +setns 344 +process_vm_readv 345 +process_vm_writev 346 +kcmp 347 +finit_module 348 +sched_setattr 349 +sched_getattr 350 +renameat2 351 +seccomp 352 +getrandom 353 +memfd_create 354 +bpf 355 +execveat 356 +userfaultfd 357 +membarrier 358 +mlock2 359 +copy_file_range 360 +preadv2 361 +pwritev2 362 +pkey_mprotect 363 +pkey_alloc 364 +pkey_free 365 +statx 366 +rseq 367 +io_pgetevents 368 +semget 393 +semctl 394 +shmget 395 +shmctl 396 +shmat 397 +shmdt 398 +msgget 399 +msgsnd 400 +msgrcv 401 +msgctl 402 +clock_gettime64 403 +clock_settime64 404 +clock_adjtime64 405 +clock_getres_time64 406 +clock_nanosleep_time64 407 +timer_gettime64 408 +timer_settime64 409 +timerfd_gettime64 410 +timerfd_settime64 411 +utimensat_time64 412 +pselect6_time64 413 +ppoll_time64 414 +io_pgetevents_time64 416 +recvmmsg_time64 417 +mq_timedsend_time64 418 +mq_timedreceive_time64 419 +semtimedop_time64 420 +rt_sigtimedwait_time64 421 +futex_time64 422 +sched_rr_get_interval_time64 423 +pidfd_send_signal 424 +io_uring_setup 425 +io_uring_enter 426 +io_uring_register 427 +open_tree 428 +move_mount 429 +fsopen 430 +fsconfig 431 +fsmount 432 +fspick 433 +pidfd_open 434 +clone3 435 +openat2 437 +pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/order b/fsstress/include/lapi/syscalls/order new file mode 100644 index 0000000000..5480976813 --- /dev/null +++ b/fsstress/include/lapi/syscalls/order @@ -0,0 +1,17 @@ +aarch64 +arc +arm +hppa +i386 +ia64 +mips_n32 +mips_n64 +mips_o32 +powerpc64 +powerpc +s390x +s390 +sh +sparc64 +sparc +x86_64 diff --git a/fsstress/include/lapi/syscalls/powerpc.in b/fsstress/include/lapi/syscalls/powerpc.in new file mode 100644 index 0000000000..cdbebc62d9 --- /dev/null +++ b/fsstress/include/lapi/syscalls/powerpc.in @@ -0,0 +1,421 @@ +restart_syscall 0 +exit 1 +fork 2 +read 3 +write 4 +open 5 +close 6 +waitpid 7 +creat 8 +link 9 +unlink 10 +execve 11 +chdir 12 +time 13 +mknod 14 +chmod 15 +lchown 16 +break 17 +oldstat 18 +lseek 19 +getpid 20 +mount 21 +umount 22 +setuid 23 +getuid 24 +stime 25 +ptrace 26 +alarm 27 +oldfstat 28 +pause 29 +utime 30 +stty 31 +gtty 32 +access 33 +nice 34 +ftime 35 +sync 36 +kill 37 +rename 38 +mkdir 39 +rmdir 40 +dup 41 +pipe 42 +times 43 +prof 44 +brk 45 +setgid 46 +getgid 47 +signal 48 +geteuid 49 +getegid 50 +acct 51 +umount2 52 +lock 53 +ioctl 54 +fcntl 55 +mpx 56 +setpgid 57 +ulimit 58 +oldolduname 59 +umask 60 +chroot 61 +ustat 62 +dup2 63 +getppid 64 +getpgrp 65 +setsid 66 +sigaction 67 +sgetmask 68 +ssetmask 69 +setreuid 70 +setregid 71 +sigsuspend 72 +sigpending 73 +sethostname 74 +setrlimit 75 +getrlimit 76 +getrusage 77 +gettimeofday 78 +settimeofday 79 +getgroups 80 +setgroups 81 +select 82 +symlink 83 +oldlstat 84 +readlink 85 +uselib 86 +swapon 87 +reboot 88 +readdir 89 +mmap 90 +munmap 91 +truncate 92 +ftruncate 93 +fchmod 94 +fchown 95 +getpriority 96 +setpriority 97 +profil 98 +statfs 99 +fstatfs 100 +ioperm 101 +socketcall 102 +syslog 103 +setitimer 104 +getitimer 105 +stat 106 +lstat 107 +fstat 108 +olduname 109 +iopl 110 +vhangup 111 +idle 112 +vm86 113 +wait4 114 +swapoff 115 +sysinfo 116 +ipc 117 +fsync 118 +sigreturn 119 +clone 120 +setdomainname 121 +uname 122 +modify_ldt 123 +adjtimex 124 +mprotect 125 +sigprocmask 126 +create_module 127 +init_module 128 +delete_module 129 +get_kernel_syms 130 +quotactl 131 +getpgid 132 +fchdir 133 +bdflush 134 +sysfs 135 +personality 136 +afs_syscall 137 +setfsuid 138 +setfsgid 139 +_llseek 140 +getdents 141 +_newselect 142 +flock 143 +msync 144 +readv 145 +writev 146 +getsid 147 +fdatasync 148 +_sysctl 149 +mlock 150 +munlock 151 +mlockall 152 +munlockall 153 +sched_setparam 154 +sched_getparam 155 +sched_setscheduler 156 +sched_getscheduler 157 +sched_yield 158 +sched_get_priority_max 159 +sched_get_priority_min 160 +sched_rr_get_interval 161 +nanosleep 162 +mremap 163 +setresuid 164 +getresuid 165 +query_module 166 +poll 167 +nfsservctl 168 +setresgid 169 +getresgid 170 +prctl 171 +rt_sigreturn 172 +rt_sigaction 173 +rt_sigprocmask 174 +rt_sigpending 175 +rt_sigtimedwait 176 +rt_sigqueueinfo 177 +rt_sigsuspend 178 +pread64 179 +pwrite64 180 +chown 181 +getcwd 182 +capget 183 +capset 184 +sigaltstack 185 +sendfile 186 +getpmsg 187 +putpmsg 188 +vfork 189 +ugetrlimit 190 +readahead 191 +mmap2 192 +truncate64 193 +ftruncate64 194 +stat64 195 +lstat64 196 +fstat64 197 +pciconfig_read 198 +pciconfig_write 199 +pciconfig_iobase 200 +multiplexer 201 +getdents64 202 +pivot_root 203 +fcntl64 204 +madvise 205 +mincore 206 +gettid 207 +tkill 208 +setxattr 209 +lsetxattr 210 +fsetxattr 211 +getxattr 212 +lgetxattr 213 +fgetxattr 214 +listxattr 215 +llistxattr 216 +flistxattr 217 +removexattr 218 +lremovexattr 219 +fremovexattr 220 +futex 221 +sched_setaffinity 222 +sched_getaffinity 223 +tuxcall 225 +sendfile64 226 +io_setup 227 +io_destroy 228 +io_getevents 229 +io_submit 230 +io_cancel 231 +set_tid_address 232 +fadvise64 233 +exit_group 234 +lookup_dcookie 235 +epoll_create 236 +epoll_ctl 237 +epoll_wait 238 +remap_file_pages 239 +timer_create 240 +timer_settime 241 +timer_gettime 242 +timer_getoverrun 243 +timer_delete 244 +clock_settime 245 +clock_gettime 246 +clock_getres 247 +clock_nanosleep 248 +swapcontext 249 +tgkill 250 +utimes 251 +statfs64 252 +fstatfs64 253 +fadvise64_64 254 +rtas 255 +sys_debug_setcontext 256 +migrate_pages 258 +mbind 259 +get_mempolicy 260 +set_mempolicy 261 +mq_open 262 +mq_unlink 263 +mq_timedsend 264 +mq_timedreceive 265 +mq_notify 266 +mq_getsetattr 267 +kexec_load 268 +add_key 269 +request_key 270 +keyctl 271 +waitid 272 +ioprio_set 273 +ioprio_get 274 +inotify_init 275 +inotify_add_watch 276 +inotify_rm_watch 277 +spu_run 278 +spu_create 279 +pselect6 280 +ppoll 281 +unshare 282 +splice 283 +tee 284 +vmsplice 285 +openat 286 +mkdirat 287 +mknodat 288 +fchownat 289 +futimesat 290 +newfstatat 291 +fstatat64 291 +unlinkat 292 +renameat 293 +linkat 294 +symlinkat 295 +readlinkat 296 +fchmodat 297 +faccessat 298 +get_robust_list 299 +set_robust_list 300 +move_pages 301 +getcpu 302 +epoll_pwait 303 +utimensat 304 +signalfd 305 +timerfd_create 306 +eventfd 307 +sync_file_range2 308 +fallocate 309 +subpage_prot 310 +timerfd_settime 311 +timerfd_gettime 312 +signalfd4 313 +eventfd2 314 +epoll_create1 315 +dup3 316 +pipe2 317 +inotify_init1 318 +perf_event_open 319 +preadv 320 +pwritev 321 +rt_tgsigqueueinfo 322 +fanotify_init 323 +fanotify_mark 324 +prlimit64 325 +socket 326 +bind 327 +connect 328 +listen 329 +accept 330 +getsockname 331 +getpeername 332 +socketpair 333 +send 334 +sendto 335 +recv 336 +recvfrom 337 +shutdown 338 +setsockopt 339 +getsockopt 340 +sendmsg 341 +recvmsg 342 +recvmmsg 343 +accept4 344 +name_to_handle_at 345 +open_by_handle_at 346 +clock_adjtime 347 +syncfs 348 +sendmmsg 349 +setns 350 +process_vm_readv 351 +process_vm_writev 352 +finit_module 353 +kcmp 354 +sched_setattr 355 +sched_getattr 356 +renameat2 357 +seccomp 358 +getrandom 359 +memfd_create 360 +bpf 361 +execveat 362 +switch_endian 363 +userfaultfd 364 +membarrier 365 +mlock2 378 +copy_file_range 379 +preadv2 380 +pwritev2 381 +kexec_file_load 382 +statx 383 +pkey_alloc 384 +pkey_free 385 +pkey_mprotect 386 +rseq 387 +io_pgetevents 388 +semtimedop 392 +semget 393 +semctl 394 +shmget 395 +shmctl 396 +shmat 397 +shmdt 398 +msgget 399 +msgsnd 400 +msgrcv 401 +msgctl 402 +clock_gettime64 403 +clock_settime64 404 +clock_adjtime64 405 +clock_getres_time64 406 +clock_nanosleep_time64 407 +timer_gettime64 408 +timer_settime64 409 +timerfd_gettime64 410 +timerfd_settime64 411 +utimensat_time64 412 +pselect6_time64 413 +ppoll_time64 414 +io_pgetevents_time64 416 +recvmmsg_time64 417 +mq_timedsend_time64 418 +mq_timedreceive_time64 419 +semtimedop_time64 420 +rt_sigtimedwait_time64 421 +futex_time64 422 +sched_rr_get_interval_time64 423 +pidfd_send_signal 424 +io_uring_setup 425 +io_uring_enter 426 +io_uring_register 427 +open_tree 428 +move_mount 429 +fsopen 430 +fsconfig 431 +fsmount 432 +fspick 433 +pidfd_open 434 +clone3 435 +openat2 437 +pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/powerpc64.in b/fsstress/include/lapi/syscalls/powerpc64.in new file mode 100644 index 0000000000..cdbebc62d9 --- /dev/null +++ b/fsstress/include/lapi/syscalls/powerpc64.in @@ -0,0 +1,421 @@ +restart_syscall 0 +exit 1 +fork 2 +read 3 +write 4 +open 5 +close 6 +waitpid 7 +creat 8 +link 9 +unlink 10 +execve 11 +chdir 12 +time 13 +mknod 14 +chmod 15 +lchown 16 +break 17 +oldstat 18 +lseek 19 +getpid 20 +mount 21 +umount 22 +setuid 23 +getuid 24 +stime 25 +ptrace 26 +alarm 27 +oldfstat 28 +pause 29 +utime 30 +stty 31 +gtty 32 +access 33 +nice 34 +ftime 35 +sync 36 +kill 37 +rename 38 +mkdir 39 +rmdir 40 +dup 41 +pipe 42 +times 43 +prof 44 +brk 45 +setgid 46 +getgid 47 +signal 48 +geteuid 49 +getegid 50 +acct 51 +umount2 52 +lock 53 +ioctl 54 +fcntl 55 +mpx 56 +setpgid 57 +ulimit 58 +oldolduname 59 +umask 60 +chroot 61 +ustat 62 +dup2 63 +getppid 64 +getpgrp 65 +setsid 66 +sigaction 67 +sgetmask 68 +ssetmask 69 +setreuid 70 +setregid 71 +sigsuspend 72 +sigpending 73 +sethostname 74 +setrlimit 75 +getrlimit 76 +getrusage 77 +gettimeofday 78 +settimeofday 79 +getgroups 80 +setgroups 81 +select 82 +symlink 83 +oldlstat 84 +readlink 85 +uselib 86 +swapon 87 +reboot 88 +readdir 89 +mmap 90 +munmap 91 +truncate 92 +ftruncate 93 +fchmod 94 +fchown 95 +getpriority 96 +setpriority 97 +profil 98 +statfs 99 +fstatfs 100 +ioperm 101 +socketcall 102 +syslog 103 +setitimer 104 +getitimer 105 +stat 106 +lstat 107 +fstat 108 +olduname 109 +iopl 110 +vhangup 111 +idle 112 +vm86 113 +wait4 114 +swapoff 115 +sysinfo 116 +ipc 117 +fsync 118 +sigreturn 119 +clone 120 +setdomainname 121 +uname 122 +modify_ldt 123 +adjtimex 124 +mprotect 125 +sigprocmask 126 +create_module 127 +init_module 128 +delete_module 129 +get_kernel_syms 130 +quotactl 131 +getpgid 132 +fchdir 133 +bdflush 134 +sysfs 135 +personality 136 +afs_syscall 137 +setfsuid 138 +setfsgid 139 +_llseek 140 +getdents 141 +_newselect 142 +flock 143 +msync 144 +readv 145 +writev 146 +getsid 147 +fdatasync 148 +_sysctl 149 +mlock 150 +munlock 151 +mlockall 152 +munlockall 153 +sched_setparam 154 +sched_getparam 155 +sched_setscheduler 156 +sched_getscheduler 157 +sched_yield 158 +sched_get_priority_max 159 +sched_get_priority_min 160 +sched_rr_get_interval 161 +nanosleep 162 +mremap 163 +setresuid 164 +getresuid 165 +query_module 166 +poll 167 +nfsservctl 168 +setresgid 169 +getresgid 170 +prctl 171 +rt_sigreturn 172 +rt_sigaction 173 +rt_sigprocmask 174 +rt_sigpending 175 +rt_sigtimedwait 176 +rt_sigqueueinfo 177 +rt_sigsuspend 178 +pread64 179 +pwrite64 180 +chown 181 +getcwd 182 +capget 183 +capset 184 +sigaltstack 185 +sendfile 186 +getpmsg 187 +putpmsg 188 +vfork 189 +ugetrlimit 190 +readahead 191 +mmap2 192 +truncate64 193 +ftruncate64 194 +stat64 195 +lstat64 196 +fstat64 197 +pciconfig_read 198 +pciconfig_write 199 +pciconfig_iobase 200 +multiplexer 201 +getdents64 202 +pivot_root 203 +fcntl64 204 +madvise 205 +mincore 206 +gettid 207 +tkill 208 +setxattr 209 +lsetxattr 210 +fsetxattr 211 +getxattr 212 +lgetxattr 213 +fgetxattr 214 +listxattr 215 +llistxattr 216 +flistxattr 217 +removexattr 218 +lremovexattr 219 +fremovexattr 220 +futex 221 +sched_setaffinity 222 +sched_getaffinity 223 +tuxcall 225 +sendfile64 226 +io_setup 227 +io_destroy 228 +io_getevents 229 +io_submit 230 +io_cancel 231 +set_tid_address 232 +fadvise64 233 +exit_group 234 +lookup_dcookie 235 +epoll_create 236 +epoll_ctl 237 +epoll_wait 238 +remap_file_pages 239 +timer_create 240 +timer_settime 241 +timer_gettime 242 +timer_getoverrun 243 +timer_delete 244 +clock_settime 245 +clock_gettime 246 +clock_getres 247 +clock_nanosleep 248 +swapcontext 249 +tgkill 250 +utimes 251 +statfs64 252 +fstatfs64 253 +fadvise64_64 254 +rtas 255 +sys_debug_setcontext 256 +migrate_pages 258 +mbind 259 +get_mempolicy 260 +set_mempolicy 261 +mq_open 262 +mq_unlink 263 +mq_timedsend 264 +mq_timedreceive 265 +mq_notify 266 +mq_getsetattr 267 +kexec_load 268 +add_key 269 +request_key 270 +keyctl 271 +waitid 272 +ioprio_set 273 +ioprio_get 274 +inotify_init 275 +inotify_add_watch 276 +inotify_rm_watch 277 +spu_run 278 +spu_create 279 +pselect6 280 +ppoll 281 +unshare 282 +splice 283 +tee 284 +vmsplice 285 +openat 286 +mkdirat 287 +mknodat 288 +fchownat 289 +futimesat 290 +newfstatat 291 +fstatat64 291 +unlinkat 292 +renameat 293 +linkat 294 +symlinkat 295 +readlinkat 296 +fchmodat 297 +faccessat 298 +get_robust_list 299 +set_robust_list 300 +move_pages 301 +getcpu 302 +epoll_pwait 303 +utimensat 304 +signalfd 305 +timerfd_create 306 +eventfd 307 +sync_file_range2 308 +fallocate 309 +subpage_prot 310 +timerfd_settime 311 +timerfd_gettime 312 +signalfd4 313 +eventfd2 314 +epoll_create1 315 +dup3 316 +pipe2 317 +inotify_init1 318 +perf_event_open 319 +preadv 320 +pwritev 321 +rt_tgsigqueueinfo 322 +fanotify_init 323 +fanotify_mark 324 +prlimit64 325 +socket 326 +bind 327 +connect 328 +listen 329 +accept 330 +getsockname 331 +getpeername 332 +socketpair 333 +send 334 +sendto 335 +recv 336 +recvfrom 337 +shutdown 338 +setsockopt 339 +getsockopt 340 +sendmsg 341 +recvmsg 342 +recvmmsg 343 +accept4 344 +name_to_handle_at 345 +open_by_handle_at 346 +clock_adjtime 347 +syncfs 348 +sendmmsg 349 +setns 350 +process_vm_readv 351 +process_vm_writev 352 +finit_module 353 +kcmp 354 +sched_setattr 355 +sched_getattr 356 +renameat2 357 +seccomp 358 +getrandom 359 +memfd_create 360 +bpf 361 +execveat 362 +switch_endian 363 +userfaultfd 364 +membarrier 365 +mlock2 378 +copy_file_range 379 +preadv2 380 +pwritev2 381 +kexec_file_load 382 +statx 383 +pkey_alloc 384 +pkey_free 385 +pkey_mprotect 386 +rseq 387 +io_pgetevents 388 +semtimedop 392 +semget 393 +semctl 394 +shmget 395 +shmctl 396 +shmat 397 +shmdt 398 +msgget 399 +msgsnd 400 +msgrcv 401 +msgctl 402 +clock_gettime64 403 +clock_settime64 404 +clock_adjtime64 405 +clock_getres_time64 406 +clock_nanosleep_time64 407 +timer_gettime64 408 +timer_settime64 409 +timerfd_gettime64 410 +timerfd_settime64 411 +utimensat_time64 412 +pselect6_time64 413 +ppoll_time64 414 +io_pgetevents_time64 416 +recvmmsg_time64 417 +mq_timedsend_time64 418 +mq_timedreceive_time64 419 +semtimedop_time64 420 +rt_sigtimedwait_time64 421 +futex_time64 422 +sched_rr_get_interval_time64 423 +pidfd_send_signal 424 +io_uring_setup 425 +io_uring_enter 426 +io_uring_register 427 +open_tree 428 +move_mount 429 +fsopen 430 +fsconfig 431 +fsmount 432 +fspick 433 +pidfd_open 434 +clone3 435 +openat2 437 +pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/regen.sh b/fsstress/include/lapi/syscalls/regen.sh new file mode 100755 index 0000000000..7a4f0cf443 --- /dev/null +++ b/fsstress/include/lapi/syscalls/regen.sh @@ -0,0 +1,132 @@ +#!/bin/sh + +output="syscalls.h" +rm -f "${output}".[1-9]* +output_pid="${output}.$$" + +max_jobs=$(getconf _NPROCESSORS_ONLN 2>/dev/null) +: ${max_jobs:=1} + +srcdir=${0%/*} + +err() { + echo "$*" 1>&2 + exit 1 +} + +cat << EOF > "${output_pid}" +/************************************************ + * GENERATED FILE: DO NOT EDIT/PATCH THIS FILE * + * change your arch specific .in file instead * + ************************************************/ + +/* + * Here we stick all the ugly *fallback* logic for linux + * system call numbers (those __NR_ thingies). + * + * Licensed under the GPLv2 or later, see the COPYING file. + */ + +#ifndef __LAPI_SYSCALLS_H__ +#define __LAPI_SYSCALLS_H__ + +#include +#include +#include +#include "cleanup.c" + +#define ltp_syscall(NR, ...) ({ \\ + int __ret; \\ + if (NR == __LTP__NR_INVALID_SYSCALL) { \\ + errno = ENOSYS; \\ + __ret = -1; \\ + } else { \\ + __ret = syscall(NR, ##__VA_ARGS__); \\ + } \\ + if (__ret == -1 && errno == ENOSYS) { \\ + tst_brkm(TCONF, CLEANUP, \\ + "syscall(%d) " #NR " not supported on your arch", \\ + NR); \\ + } \\ + __ret; \\ +}) + +#define tst_syscall(NR, ...) ({ \\ + int tst_ret; \\ + if (NR == __LTP__NR_INVALID_SYSCALL) { \\ + errno = ENOSYS; \\ + tst_ret = -1; \\ + } else { \\ + tst_ret = syscall(NR, ##__VA_ARGS__); \\ + } \\ + if (tst_ret == -1 && errno == ENOSYS) { \\ + tst_brk(TCONF, "syscall(%d) " #NR " not supported", NR); \\ + } \\ + tst_ret; \\ +}) + +EOF + +jobs=0 +for arch in $(cat "${srcdir}/order") ; do + ( + echo "Generating data for arch $arch ... " + + ( + echo + case ${arch} in + sparc64) echo "#if defined(__sparc__) && defined(__arch64__)" ;; + sparc) echo "#if defined(__sparc__) && !defined(__arch64__)" ;; + s390) echo "#if defined(__s390__) && !defined(__s390x__)" ;; + mips_n32) echo "#if defined(__mips__) && defined(_ABIN32)" ;; + mips_n64) echo "#if defined(__mips__) && defined(_ABI64)" ;; + mips_o32) echo "#if defined(__mips__) && defined(_ABIO32)" ;; + *) echo "#ifdef __${arch}__" ;; + esac + while read line ; do + set -- ${line} + nr="__NR_$1" + shift + if [ $# -eq 0 ] ; then + err "invalid line found: $line" + fi + echo "# ifndef ${nr}" + echo "# define ${nr} $*" + echo "# endif" + done < "${srcdir}/${arch}.in" + echo "#endif" + echo + ) >> "${output_pid}.${arch}" + + ) & + + jobs=$(( jobs + 1 )) + if [ ${jobs} -ge ${max_jobs} ] ; then + wait || exit 1 + jobs=0 + fi +done + +echo "Generating stub list ... " +( +echo +echo "/* Common stubs */" +echo "#define __LTP__NR_INVALID_SYSCALL -1" >> "${output_pid}" +for nr in $(awk '{print $1}' "${srcdir}/"*.in | sort -u) ; do + nr="__NR_${nr}" + echo "# ifndef ${nr}" + echo "# define ${nr} __LTP__NR_INVALID_SYSCALL" + echo "# endif" +done +echo "#endif" +) >> "${output_pid}._footer" + +wait || exit 1 + +printf "Combining them all ... " +for arch in $(cat "${srcdir}/order") _footer ; do + cat "${output_pid}.${arch}" +done >> "${output_pid}" +mv "${output_pid}" "../${output}" +rm -f "${output_pid}"* +echo "OK!" diff --git a/fsstress/include/lapi/syscalls/s390.in b/fsstress/include/lapi/syscalls/s390.in new file mode 100644 index 0000000000..c3f249aedf --- /dev/null +++ b/fsstress/include/lapi/syscalls/s390.in @@ -0,0 +1,408 @@ +exit 1 +fork 2 +read 3 +write 4 +open 5 +close 6 +restart_syscall 7 +creat 8 +link 9 +unlink 10 +execve 11 +chdir 12 +time 13 +mknod 14 +chmod 15 +lchown 16 +lseek 19 +getpid 20 +mount 21 +umount 22 +setuid 23 +getuid 24 +stime 25 +ptrace 26 +alarm 27 +pause 29 +utime 30 +access 33 +nice 34 +sync 36 +kill 37 +rename 38 +mkdir 39 +rmdir 40 +dup 41 +pipe 42 +times 43 +brk 45 +setgid 46 +getgid 47 +signal 48 +geteuid 49 +getegid 50 +acct 51 +umount2 52 +ioctl 54 +fcntl 55 +setpgid 57 +umask 60 +chroot 61 +ustat 62 +dup2 63 +getppid 64 +getpgrp 65 +setsid 66 +sigaction 67 +setreuid 70 +setregid 71 +sigsuspend 72 +sigpending 73 +sethostname 74 +setrlimit 75 +getrlimit 76 +getrusage 77 +gettimeofday 78 +settimeofday 79 +getgroups 80 +setgroups 81 +symlink 83 +readlink 85 +uselib 86 +swapon 87 +reboot 88 +readdir 89 +mmap 90 +munmap 91 +truncate 92 +ftruncate 93 +fchmod 94 +fchown 95 +getpriority 96 +setpriority 97 +statfs 99 +fstatfs 100 +ioperm 101 +socketcall 102 +syslog 103 +setitimer 104 +getitimer 105 +stat 106 +lstat 107 +fstat 108 +lookup_dcookie 110 +vhangup 111 +idle 112 +wait4 114 +swapoff 115 +sysinfo 116 +ipc 117 +fsync 118 +sigreturn 119 +clone 120 +setdomainname 121 +uname 122 +adjtimex 124 +mprotect 125 +sigprocmask 126 +create_module 127 +init_module 128 +delete_module 129 +get_kernel_syms 130 +quotactl 131 +getpgid 132 +fchdir 133 +bdflush 134 +sysfs 135 +personality 136 +afs_syscall 137 +setfsuid 138 +setfsgid 139 +_llseek 140 +getdents 141 +_newselect 142 +flock 143 +msync 144 +readv 145 +writev 146 +getsid 147 +fdatasync 148 +_sysctl 149 +mlock 150 +munlock 151 +mlockall 152 +munlockall 153 +sched_setparam 154 +sched_getparam 155 +sched_setscheduler 156 +sched_getscheduler 157 +sched_yield 158 +sched_get_priority_max 159 +sched_get_priority_min 160 +sched_rr_get_interval 161 +nanosleep 162 +mremap 163 +setresuid 164 +getresuid 165 +query_module 167 +poll 168 +nfsservctl 169 +setresgid 170 +getresgid 171 +prctl 172 +rt_sigreturn 173 +rt_sigaction 174 +rt_sigprocmask 175 +rt_sigpending 176 +rt_sigtimedwait 177 +rt_sigqueueinfo 178 +rt_sigsuspend 179 +pread64 180 +pwrite64 181 +chown 182 +getcwd 183 +capget 184 +capset 185 +sigaltstack 186 +sendfile 187 +getpmsg 188 +putpmsg 189 +vfork 190 +ugetrlimit 191 +mmap2 192 +truncate64 193 +ftruncate64 194 +stat64 195 +lstat64 196 +fstat64 197 +lchown32 198 +getuid32 199 +getgid32 200 +geteuid32 201 +getegid32 202 +setreuid32 203 +setregid32 204 +getgroups32 205 +setgroups32 206 +fchown32 207 +setresuid32 208 +getresuid32 209 +setresgid32 210 +getresgid32 211 +chown32 212 +setuid32 213 +setgid32 214 +setfsuid32 215 +setfsgid32 216 +pivot_root 217 +mincore 218 +madvise 219 +getdents64 220 +fcntl64 221 +readahead 222 +sendfile64 223 +setxattr 224 +lsetxattr 225 +fsetxattr 226 +getxattr 227 +lgetxattr 228 +fgetxattr 229 +listxattr 230 +llistxattr 231 +flistxattr 232 +removexattr 233 +lremovexattr 234 +fremovexattr 235 +gettid 236 +tkill 237 +futex 238 +sched_setaffinity 239 +sched_getaffinity 240 +tgkill 241 +io_setup 243 +io_destroy 244 +io_getevents 245 +io_submit 246 +io_cancel 247 +exit_group 248 +epoll_create 249 +epoll_ctl 250 +epoll_wait 251 +set_tid_address 252 +fadvise64 253 +timer_create 254 +timer_settime 255 +timer_gettime 256 +timer_getoverrun 257 +timer_delete 258 +clock_settime 259 +clock_gettime 260 +clock_getres 261 +clock_nanosleep 262 +fadvise64_64 264 +statfs64 265 +fstatfs64 266 +remap_file_pages 267 +mbind 268 +get_mempolicy 269 +set_mempolicy 270 +mq_open 271 +mq_unlink 272 +mq_timedsend 273 +mq_timedreceive 274 +mq_notify 275 +mq_getsetattr 276 +kexec_load 277 +add_key 278 +request_key 279 +keyctl 280 +waitid 281 +ioprio_set 282 +ioprio_get 283 +inotify_init 284 +inotify_add_watch 285 +inotify_rm_watch 286 +migrate_pages 287 +openat 288 +mkdirat 289 +mknodat 290 +fchownat 291 +futimesat 292 +fstatat64 293 +unlinkat 294 +renameat 295 +linkat 296 +symlinkat 297 +readlinkat 298 +fchmodat 299 +faccessat 300 +pselect6 301 +ppoll 302 +unshare 303 +set_robust_list 304 +get_robust_list 305 +splice 306 +sync_file_range 307 +tee 308 +vmsplice 309 +move_pages 310 +getcpu 311 +epoll_pwait 312 +utimes 313 +fallocate 314 +utimensat 315 +signalfd 316 +timerfd 317 +eventfd 318 +timerfd_create 319 +timerfd_settime 320 +timerfd_gettime 321 +signalfd4 322 +eventfd2 323 +inotify_init1 324 +pipe2 325 +dup3 326 +epoll_create1 327 +preadv 328 +pwritev 329 +rt_tgsigqueueinfo 330 +perf_event_open 331 +fanotify_init 332 +fanotify_mark 333 +prlimit64 334 +name_to_handle_at 335 +open_by_handle_at 336 +clock_adjtime 337 +syncfs 338 +setns 339 +process_vm_readv 340 +process_vm_writev 341 +s390_runtime_instr 342 +kcmp 343 +finit_module 344 +sched_setattr 345 +sched_getattr 346 +renameat2 347 +seccomp 348 +getrandom 349 +memfd_create 350 +bpf 351 +s390_pci_mmio_write 352 +s390_pci_mmio_read 353 +execveat 354 +userfaultfd 355 +membarrier 356 +recvmmsg 357 +sendmmsg 358 +socket 359 +socketpair 360 +bind 361 +connect 362 +listen 363 +accept4 364 +getsockopt 365 +setsockopt 366 +getsockname 367 +getpeername 368 +sendto 369 +sendmsg 370 +recvfrom 371 +recvmsg 372 +shutdown 373 +mlock2 374 +copy_file_range 375 +preadv2 376 +pwritev2 377 +s390_guarded_storage 378 +statx 379 +s390_sthyi 380 +kexec_file_load 381 +io_pgetevents 382 +rseq 383 +pkey_mprotect 384 +pkey_alloc 385 +pkey_free 386 +semget 393 +semctl 394 +shmget 395 +shmctl 396 +shmat 397 +shmdt 398 +msgget 399 +msgsnd 400 +msgrcv 401 +msgctl 402 +clock_gettime64 403 +clock_settime64 404 +clock_adjtime64 405 +clock_getres_time64 406 +clock_nanosleep_time64 407 +timer_gettime64 408 +timer_settime64 409 +timerfd_gettime64 410 +timerfd_settime64 411 +utimensat_time64 412 +pselect6_time64 413 +ppoll_time64 414 +io_pgetevents_time64 416 +recvmmsg_time64 417 +mq_timedsend_time64 418 +mq_timedreceive_time64 419 +semtimedop_time64 420 +rt_sigtimedwait_time64 421 +futex_time64 422 +sched_rr_get_interval_time64 423 +pidfd_send_signal 424 +io_uring_setup 425 +io_uring_enter 426 +io_uring_register 427 +open_tree 428 +move_mount 429 +fsopen 430 +fsconfig 431 +fsmount 432 +fspick 433 +pidfd_open 434 +clone3 435 +openat2 437 +pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/s390x.in b/fsstress/include/lapi/syscalls/s390x.in new file mode 100644 index 0000000000..88cc9b86bd --- /dev/null +++ b/fsstress/include/lapi/syscalls/s390x.in @@ -0,0 +1,356 @@ +exit 1 +fork 2 +read 3 +write 4 +open 5 +close 6 +restart_syscall 7 +creat 8 +link 9 +unlink 10 +execve 11 +chdir 12 +mknod 14 +chmod 15 +lseek 19 +getpid 20 +mount 21 +umount 22 +ptrace 26 +alarm 27 +pause 29 +utime 30 +access 33 +nice 34 +sync 36 +kill 37 +rename 38 +mkdir 39 +rmdir 40 +dup 41 +pipe 42 +times 43 +brk 45 +signal 48 +acct 51 +umount2 52 +ioctl 54 +fcntl 55 +setpgid 57 +umask 60 +chroot 61 +ustat 62 +dup2 63 +getppid 64 +getpgrp 65 +setsid 66 +sigaction 67 +sigsuspend 72 +sigpending 73 +sethostname 74 +setrlimit 75 +getrusage 77 +gettimeofday 78 +settimeofday 79 +symlink 83 +readlink 85 +uselib 86 +swapon 87 +reboot 88 +readdir 89 +mmap 90 +munmap 91 +truncate 92 +ftruncate 93 +fchmod 94 +getpriority 96 +setpriority 97 +statfs 99 +fstatfs 100 +socketcall 102 +syslog 103 +setitimer 104 +getitimer 105 +stat 106 +lstat 107 +fstat 108 +lookup_dcookie 110 +vhangup 111 +idle 112 +wait4 114 +swapoff 115 +sysinfo 116 +ipc 117 +fsync 118 +sigreturn 119 +clone 120 +setdomainname 121 +uname 122 +adjtimex 124 +mprotect 125 +sigprocmask 126 +create_module 127 +init_module 128 +delete_module 129 +get_kernel_syms 130 +quotactl 131 +getpgid 132 +fchdir 133 +bdflush 134 +sysfs 135 +personality 136 +afs_syscall 137 +getdents 141 +select 142 +flock 143 +msync 144 +readv 145 +writev 146 +getsid 147 +fdatasync 148 +_sysctl 149 +mlock 150 +munlock 151 +mlockall 152 +munlockall 153 +sched_setparam 154 +sched_getparam 155 +sched_setscheduler 156 +sched_getscheduler 157 +sched_yield 158 +sched_get_priority_max 159 +sched_get_priority_min 160 +sched_rr_get_interval 161 +nanosleep 162 +mremap 163 +query_module 167 +poll 168 +nfsservctl 169 +prctl 172 +rt_sigreturn 173 +rt_sigaction 174 +rt_sigprocmask 175 +rt_sigpending 176 +rt_sigtimedwait 177 +rt_sigqueueinfo 178 +rt_sigsuspend 179 +pread64 180 +pwrite64 181 +getcwd 183 +capget 184 +capset 185 +sigaltstack 186 +sendfile 187 +getpmsg 188 +putpmsg 189 +vfork 190 +getrlimit 191 +lchown 198 +getuid 199 +getgid 200 +geteuid 201 +getegid 202 +setreuid 203 +setregid 204 +getgroups 205 +setgroups 206 +fchown 207 +setresuid 208 +getresuid 209 +setresgid 210 +getresgid 211 +chown 212 +setuid 213 +setgid 214 +setfsuid 215 +setfsgid 216 +pivot_root 217 +mincore 218 +madvise 219 +getdents64 220 +readahead 222 +setxattr 224 +lsetxattr 225 +fsetxattr 226 +getxattr 227 +lgetxattr 228 +fgetxattr 229 +listxattr 230 +llistxattr 231 +flistxattr 232 +removexattr 233 +lremovexattr 234 +fremovexattr 235 +gettid 236 +tkill 237 +futex 238 +sched_setaffinity 239 +sched_getaffinity 240 +tgkill 241 +io_setup 243 +io_destroy 244 +io_getevents 245 +io_submit 246 +io_cancel 247 +exit_group 248 +epoll_create 249 +epoll_ctl 250 +epoll_wait 251 +set_tid_address 252 +fadvise64 253 +timer_create 254 +timer_settime 255 +timer_gettime 256 +timer_getoverrun 257 +timer_delete 258 +clock_settime 259 +clock_gettime 260 +clock_getres 261 +clock_nanosleep 262 +statfs64 265 +fstatfs64 266 +remap_file_pages 267 +mbind 268 +get_mempolicy 269 +set_mempolicy 270 +mq_open 271 +mq_unlink 272 +mq_timedsend 273 +mq_timedreceive 274 +mq_notify 275 +mq_getsetattr 276 +kexec_load 277 +add_key 278 +request_key 279 +keyctl 280 +waitid 281 +ioprio_set 282 +ioprio_get 283 +inotify_init 284 +inotify_add_watch 285 +inotify_rm_watch 286 +migrate_pages 287 +openat 288 +mkdirat 289 +mknodat 290 +fchownat 291 +futimesat 292 +newfstatat 293 +unlinkat 294 +renameat 295 +linkat 296 +symlinkat 297 +readlinkat 298 +fchmodat 299 +faccessat 300 +pselect6 301 +ppoll 302 +unshare 303 +set_robust_list 304 +get_robust_list 305 +splice 306 +sync_file_range 307 +tee 308 +vmsplice 309 +move_pages 310 +getcpu 311 +epoll_pwait 312 +utimes 313 +fallocate 314 +utimensat 315 +signalfd 316 +timerfd 317 +eventfd 318 +timerfd_create 319 +timerfd_settime 320 +timerfd_gettime 321 +signalfd4 322 +eventfd2 323 +inotify_init1 324 +pipe2 325 +dup3 326 +epoll_create1 327 +preadv 328 +pwritev 329 +rt_tgsigqueueinfo 330 +perf_event_open 331 +fanotify_init 332 +fanotify_mark 333 +prlimit64 334 +name_to_handle_at 335 +open_by_handle_at 336 +clock_adjtime 337 +syncfs 338 +setns 339 +process_vm_readv 340 +process_vm_writev 341 +s390_runtime_instr 342 +kcmp 343 +finit_module 344 +sched_setattr 345 +sched_getattr 346 +renameat2 347 +seccomp 348 +getrandom 349 +memfd_create 350 +bpf 351 +s390_pci_mmio_write 352 +s390_pci_mmio_read 353 +execveat 354 +userfaultfd 355 +membarrier 356 +recvmmsg 357 +sendmmsg 358 +socket 359 +socketpair 360 +bind 361 +connect 362 +listen 363 +accept4 364 +getsockopt 365 +setsockopt 366 +getsockname 367 +getpeername 368 +sendto 369 +sendmsg 370 +recvfrom 371 +recvmsg 372 +shutdown 373 +mlock2 374 +copy_file_range 375 +preadv2 376 +pwritev2 377 +s390_guarded_storage 378 +statx 379 +s390_sthyi 380 +kexec_file_load 381 +io_pgetevents 382 +rseq 383 +pkey_mprotect 384 +pkey_alloc 385 +pkey_free 386 +semtimedop 392 +semget 393 +semctl 394 +shmget 395 +shmctl 396 +shmat 397 +shmdt 398 +msgget 399 +msgsnd 400 +msgrcv 401 +msgctl 402 +pidfd_send_signal 424 +io_uring_setup 425 +io_uring_enter 426 +io_uring_register 427 +open_tree 428 +move_mount 429 +fsopen 430 +fsconfig 431 +fsmount 432 +fspick 433 +pidfd_open 434 +clone3 435 +openat2 437 +pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/sh.in b/fsstress/include/lapi/syscalls/sh.in new file mode 100644 index 0000000000..06055ed106 --- /dev/null +++ b/fsstress/include/lapi/syscalls/sh.in @@ -0,0 +1,402 @@ +restart_syscall 0 +exit 1 +fork 2 +read 3 +write 4 +open 5 +close 6 +waitpid 7 +creat 8 +link 9 +unlink 10 +execve 11 +chdir 12 +time 13 +mknod 14 +chmod 15 +lchown 16 +oldstat 18 +lseek 19 +getpid 20 +mount 21 +umount 22 +setuid 23 +getuid 24 +stime 25 +ptrace 26 +alarm 27 +oldfstat 28 +pause 29 +utime 30 +access 33 +nice 34 +sync 36 +kill 37 +rename 38 +mkdir 39 +rmdir 40 +dup 41 +pipe 42 +times 43 +brk 45 +setgid 46 +getgid 47 +signal 48 +geteuid 49 +getegid 50 +acct 51 +umount2 52 +ioctl 54 +fcntl 55 +setpgid 57 +umask 60 +chroot 61 +ustat 62 +dup2 63 +getppid 64 +getpgrp 65 +setsid 66 +sigaction 67 +sgetmask 68 +ssetmask 69 +setreuid 70 +setregid 71 +sigsuspend 72 +sigpending 73 +sethostname 74 +setrlimit 75 +getrlimit 76 +getrusage 77 +gettimeofday 78 +settimeofday 79 +getgroups 80 +setgroups 81 +symlink 83 +oldlstat 84 +readlink 85 +uselib 86 +swapon 87 +reboot 88 +readdir 89 +mmap 90 +munmap 91 +truncate 92 +ftruncate 93 +fchmod 94 +fchown 95 +getpriority 96 +setpriority 97 +statfs 99 +fstatfs 100 +socketcall 102 +syslog 103 +setitimer 104 +getitimer 105 +stat 106 +lstat 107 +fstat 108 +olduname 109 +vhangup 111 +wait4 114 +swapoff 115 +sysinfo 116 +ipc 117 +fsync 118 +sigreturn 119 +clone 120 +setdomainname 121 +uname 122 +cacheflush 123 +adjtimex 124 +mprotect 125 +sigprocmask 126 +init_module 128 +delete_module 129 +quotactl 131 +getpgid 132 +fchdir 133 +bdflush 134 +sysfs 135 +personality 136 +setfsuid 138 +setfsgid 139 +_llseek 140 +getdents 141 +_newselect 142 +flock 143 +msync 144 +readv 145 +writev 146 +getsid 147 +fdatasync 148 +_sysctl 149 +mlock 150 +munlock 151 +mlockall 152 +munlockall 153 +sched_setparam 154 +sched_getparam 155 +sched_setscheduler 156 +sched_getscheduler 157 +sched_yield 158 +sched_get_priority_max 159 +sched_get_priority_min 160 +sched_rr_get_interval 161 +nanosleep 162 +mremap 163 +setresuid 164 +getresuid 165 +poll 168 +nfsservctl 169 +setresgid 170 +getresgid 171 +prctl 172 +rt_sigreturn 173 +rt_sigaction 174 +rt_sigprocmask 175 +rt_sigpending 176 +rt_sigtimedwait 177 +rt_sigqueueinfo 178 +rt_sigsuspend 179 +pread64 180 +pwrite64 181 +chown 182 +getcwd 183 +capget 184 +capset 185 +sigaltstack 186 +sendfile 187 +vfork 190 +ugetrlimit 191 +mmap2 192 +truncate64 193 +ftruncate64 194 +stat64 195 +lstat64 196 +fstat64 197 +lchown32 198 +getuid32 199 +getgid32 200 +geteuid32 201 +getegid32 202 +setreuid32 203 +setregid32 204 +getgroups32 205 +setgroups32 206 +fchown32 207 +setresuid32 208 +getresuid32 209 +setresgid32 210 +getresgid32 211 +chown32 212 +setuid32 213 +setgid32 214 +setfsuid32 215 +setfsgid32 216 +pivot_root 217 +mincore 218 +madvise 219 +getdents64 220 +fcntl64 221 +gettid 224 +readahead 225 +setxattr 226 +lsetxattr 227 +fsetxattr 228 +getxattr 229 +lgetxattr 230 +fgetxattr 231 +listxattr 232 +llistxattr 233 +flistxattr 234 +removexattr 235 +lremovexattr 236 +fremovexattr 237 +tkill 238 +sendfile64 239 +futex 240 +sched_setaffinity 241 +sched_getaffinity 242 +io_setup 245 +io_destroy 246 +io_getevents 247 +io_submit 248 +io_cancel 249 +fadvise64 250 +exit_group 252 +lookup_dcookie 253 +epoll_create 254 +epoll_ctl 255 +epoll_wait 256 +remap_file_pages 257 +set_tid_address 258 +timer_create 259 +timer_settime 260 +timer_gettime 261 +timer_getoverrun 262 +timer_delete 263 +clock_settime 264 +clock_gettime 265 +clock_getres 266 +clock_nanosleep 267 +statfs64 268 +fstatfs64 269 +tgkill 270 +utimes 271 +fadvise64_64 272 +mbind 274 +get_mempolicy 275 +set_mempolicy 276 +mq_open 277 +mq_unlink 278 +mq_timedsend 279 +mq_timedreceive 280 +mq_notify 281 +mq_getsetattr 282 +kexec_load 283 +waitid 284 +add_key 285 +request_key 286 +keyctl 287 +ioprio_set 288 +ioprio_get 289 +inotify_init 290 +inotify_add_watch 291 +inotify_rm_watch 292 +migrate_pages 294 +openat 295 +mkdirat 296 +mknodat 297 +fchownat 298 +futimesat 299 +fstatat64 300 +unlinkat 301 +renameat 302 +linkat 303 +symlinkat 304 +readlinkat 305 +fchmodat 306 +faccessat 307 +pselect6 308 +ppoll 309 +unshare 310 +set_robust_list 311 +get_robust_list 312 +splice 313 +sync_file_range 314 +tee 315 +vmsplice 316 +move_pages 317 +getcpu 318 +epoll_pwait 319 +utimensat 320 +signalfd 321 +timerfd_create 322 +eventfd 323 +fallocate 324 +timerfd_settime 325 +timerfd_gettime 326 +signalfd4 327 +eventfd2 328 +epoll_create1 329 +dup3 330 +pipe2 331 +inotify_init1 332 +preadv 333 +pwritev 334 +rt_tgsigqueueinfo 335 +perf_event_open 336 +fanotify_init 337 +fanotify_mark 338 +prlimit64 339 +socket 340 +bind 341 +connect 342 +listen 343 +accept 344 +getsockname 345 +getpeername 346 +socketpair 347 +send 348 +sendto 349 +recv 350 +recvfrom 351 +shutdown 352 +setsockopt 353 +getsockopt 354 +sendmsg 355 +recvmsg 356 +recvmmsg 357 +accept4 358 +name_to_handle_at 359 +open_by_handle_at 360 +clock_adjtime 361 +syncfs 362 +sendmmsg 363 +setns 364 +process_vm_readv 365 +process_vm_writev 366 +kcmp 367 +finit_module 368 +sched_getattr 369 +sched_setattr 370 +renameat2 371 +seccomp 372 +getrandom 373 +memfd_create 374 +bpf 375 +execveat 376 +userfaultfd 377 +membarrier 378 +mlock2 379 +copy_file_range 380 +preadv2 381 +pwritev2 382 +statx 383 +pkey_mprotect 384 +pkey_alloc 385 +pkey_free 386 +rseq 387 +semget 393 +semctl 394 +shmget 395 +shmctl 396 +shmat 397 +shmdt 398 +msgget 399 +msgsnd 400 +msgrcv 401 +msgctl 402 +clock_gettime64 403 +clock_settime64 404 +clock_adjtime64 405 +clock_getres_time64 406 +clock_nanosleep_time64 407 +timer_gettime64 408 +timer_settime64 409 +timerfd_gettime64 410 +timerfd_settime64 411 +utimensat_time64 412 +pselect6_time64 413 +ppoll_time64 414 +io_pgetevents_time64 416 +recvmmsg_time64 417 +mq_timedsend_time64 418 +mq_timedreceive_time64 419 +semtimedop_time64 420 +rt_sigtimedwait_time64 421 +futex_time64 422 +sched_rr_get_interval_time64 423 +pidfd_send_signal 424 +io_uring_setup 425 +io_uring_enter 426 +io_uring_register 427 +open_tree 428 +move_mount 429 +fsopen 430 +fsconfig 431 +fsmount 432 +fspick 433 +pidfd_open 434 +openat2 437 +pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/sparc.in b/fsstress/include/lapi/syscalls/sparc.in new file mode 100644 index 0000000000..522e3c9974 --- /dev/null +++ b/fsstress/include/lapi/syscalls/sparc.in @@ -0,0 +1,407 @@ +restart_syscall 0 +exit 1 +fork 2 +read 3 +write 4 +open 5 +close 6 +wait4 7 +creat 8 +link 9 +unlink 10 +execv 11 +chdir 12 +chown 13 +mknod 14 +chmod 15 +lchown 16 +brk 17 +perfctr 18 +lseek 19 +getpid 20 +capget 21 +capset 22 +setuid 23 +getuid 24 +vmsplice 25 +ptrace 26 +alarm 27 +sigaltstack 28 +pause 29 +utime 30 +lchown32 31 +fchown32 32 +access 33 +nice 34 +chown32 35 +sync 36 +kill 37 +stat 38 +sendfile 39 +lstat 40 +dup 41 +pipe 42 +times 43 +getuid32 44 +umount2 45 +setgid 46 +getgid 47 +signal 48 +geteuid 49 +getegid 50 +acct 51 +getgid32 53 +ioctl 54 +reboot 55 +mmap2 56 +symlink 57 +readlink 58 +execve 59 +umask 60 +chroot 61 +fstat 62 +fstat64 63 +getpagesize 64 +msync 65 +vfork 66 +pread64 67 +pwrite64 68 +geteuid32 69 +getegid32 70 +mmap 71 +setreuid32 72 +munmap 73 +mprotect 74 +madvise 75 +vhangup 76 +truncate64 77 +mincore 78 +getgroups 79 +setgroups 80 +getpgrp 81 +setgroups32 82 +setitimer 83 +ftruncate64 84 +swapon 85 +getitimer 86 +setuid32 87 +sethostname 88 +setgid32 89 +dup2 90 +setfsuid32 91 +fcntl 92 +select 93 +setfsgid32 94 +fsync 95 +setpriority 96 +socket 97 +connect 98 +accept 99 +getpriority 100 +rt_sigreturn 101 +rt_sigaction 102 +rt_sigprocmask 103 +rt_sigpending 104 +rt_sigtimedwait 105 +rt_sigqueueinfo 106 +rt_sigsuspend 107 +setresuid32 108 +getresuid32 109 +setresgid32 110 +getresgid32 111 +setregid32 112 +recvmsg 113 +sendmsg 114 +getgroups32 115 +gettimeofday 116 +getrusage 117 +getsockopt 118 +getcwd 119 +readv 120 +writev 121 +settimeofday 122 +fchown 123 +fchmod 124 +recvfrom 125 +setreuid 126 +setregid 127 +rename 128 +truncate 129 +ftruncate 130 +flock 131 +lstat64 132 +sendto 133 +shutdown 134 +socketpair 135 +mkdir 136 +rmdir 137 +utimes 138 +stat64 139 +sendfile64 140 +getpeername 141 +futex 142 +gettid 143 +getrlimit 144 +setrlimit 145 +pivot_root 146 +prctl 147 +pciconfig_read 148 +pciconfig_write 149 +getsockname 150 +inotify_init 151 +inotify_add_watch 152 +poll 153 +getdents64 154 +fcntl64 155 +inotify_rm_watch 156 +statfs 157 +fstatfs 158 +umount 159 +sched_set_affinity 160 +sched_get_affinity 161 +getdomainname 162 +setdomainname 163 +quotactl 165 +set_tid_address 166 +mount 167 +ustat 168 +setxattr 169 +lsetxattr 170 +fsetxattr 171 +getxattr 172 +lgetxattr 173 +getdents 174 +setsid 175 +fchdir 176 +fgetxattr 177 +listxattr 178 +llistxattr 179 +flistxattr 180 +removexattr 181 +lremovexattr 182 +sigpending 183 +query_module 184 +setpgid 185 +fremovexattr 186 +tkill 187 +exit_group 188 +uname 189 +init_module 190 +personality 191 +remap_file_pages 192 +epoll_create 193 +epoll_ctl 194 +epoll_wait 195 +ioprio_set 196 +getppid 197 +sigaction 198 +sgetmask 199 +ssetmask 200 +sigsuspend 201 +oldlstat 202 +uselib 203 +readdir 204 +readahead 205 +socketcall 206 +syslog 207 +lookup_dcookie 208 +fadvise64 209 +fadvise64_64 210 +tgkill 211 +waitpid 212 +swapoff 213 +sysinfo 214 +ipc 215 +sigreturn 216 +clone 217 +ioprio_get 218 +adjtimex 219 +sigprocmask 220 +create_module 221 +delete_module 222 +get_kernel_syms 223 +getpgid 224 +bdflush 225 +sysfs 226 +afs_syscall 227 +setfsuid 228 +setfsgid 229 +_newselect 230 +time 231 +splice 232 +stime 233 +statfs64 234 +fstatfs64 235 +_llseek 236 +mlock 237 +munlock 238 +mlockall 239 +munlockall 240 +sched_setparam 241 +sched_getparam 242 +sched_setscheduler 243 +sched_getscheduler 244 +sched_yield 245 +sched_get_priority_max 246 +sched_get_priority_min 247 +sched_rr_get_interval 248 +nanosleep 249 +mremap 250 +_sysctl 251 +getsid 252 +fdatasync 253 +nfsservctl 254 +sync_file_range 255 +clock_settime 256 +clock_gettime 257 +clock_getres 258 +clock_nanosleep 259 +sched_getaffinity 260 +sched_setaffinity 261 +timer_settime 262 +timer_gettime 263 +timer_getoverrun 264 +timer_delete 265 +timer_create 266 +vserver 267 +io_setup 268 +io_destroy 269 +io_submit 270 +io_cancel 271 +io_getevents 272 +mq_open 273 +mq_unlink 274 +mq_timedsend 275 +mq_timedreceive 276 +mq_notify 277 +mq_getsetattr 278 +waitid 279 +tee 280 +add_key 281 +request_key 282 +keyctl 283 +openat 284 +mkdirat 285 +mknodat 286 +fchownat 287 +futimesat 288 +fstatat64 289 +unlinkat 290 +renameat 291 +linkat 292 +symlinkat 293 +readlinkat 294 +fchmodat 295 +faccessat 296 +pselect6 297 +ppoll 298 +unshare 299 +set_robust_list 300 +get_robust_list 301 +migrate_pages 302 +mbind 303 +get_mempolicy 304 +set_mempolicy 305 +kexec_load 306 +move_pages 307 +getcpu 308 +epoll_pwait 309 +utimensat 310 +signalfd 311 +timerfd_create 312 +eventfd 313 +fallocate 314 +timerfd_settime 315 +timerfd_gettime 316 +signalfd4 317 +eventfd2 318 +epoll_create1 319 +dup3 320 +pipe2 321 +inotify_init1 322 +accept4 323 +preadv 324 +pwritev 325 +rt_tgsigqueueinfo 326 +perf_event_open 327 +recvmmsg 328 +fanotify_init 329 +fanotify_mark 330 +prlimit64 331 +name_to_handle_at 332 +open_by_handle_at 333 +clock_adjtime 334 +syncfs 335 +sendmmsg 336 +setns 337 +process_vm_readv 338 +process_vm_writev 339 +kern_features 340 +kcmp 341 +finit_module 342 +sched_setattr 343 +sched_getattr 344 +renameat2 345 +seccomp 346 +getrandom 347 +memfd_create 348 +bpf 349 +execveat 350 +membarrier 351 +userfaultfd 352 +bind 353 +listen 354 +setsockopt 355 +mlock2 356 +copy_file_range 357 +preadv2 358 +pwritev2 359 +statx 360 +io_pgetevents 361 +pkey_mprotect 362 +pkey_alloc 363 +pkey_free 364 +rseq 365 +semget 393 +semctl 394 +shmget 395 +shmctl 396 +shmat 397 +shmdt 398 +msgget 399 +msgsnd 400 +msgrcv 401 +msgctl 402 +clock_gettime64 403 +clock_settime64 404 +clock_adjtime64 405 +clock_getres_time64 406 +clock_nanosleep_time64 407 +timer_gettime64 408 +timer_settime64 409 +timerfd_gettime64 410 +timerfd_settime64 411 +utimensat_time64 412 +pselect6_time64 413 +ppoll_time64 414 +io_pgetevents_time64 416 +recvmmsg_time64 417 +mq_timedsend_time64 418 +mq_timedreceive_time64 419 +semtimedop_time64 420 +rt_sigtimedwait_time64 421 +futex_time64 422 +sched_rr_get_interval_time64 423 +pidfd_send_signal 424 +io_uring_setup 425 +io_uring_enter 426 +io_uring_register 427 +open_tree 428 +move_mount 429 +fsopen 430 +fsconfig 431 +fsmount 432 +fspick 433 +pidfd_open 434 +openat2 437 +pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/sparc64.in b/fsstress/include/lapi/syscalls/sparc64.in new file mode 100644 index 0000000000..6f884a7bf7 --- /dev/null +++ b/fsstress/include/lapi/syscalls/sparc64.in @@ -0,0 +1,372 @@ +restart_syscall 0 +exit 1 +fork 2 +read 3 +write 4 +open 5 +close 6 +wait4 7 +creat 8 +link 9 +unlink 10 +execv 11 +chdir 12 +chown 13 +mknod 14 +chmod 15 +lchown 16 +brk 17 +perfctr 18 +lseek 19 +getpid 20 +capget 21 +capset 22 +setuid 23 +getuid 24 +vmsplice 25 +ptrace 26 +alarm 27 +sigaltstack 28 +pause 29 +utime 30 +lchown32 31 +fchown32 32 +access 33 +nice 34 +sync 36 +kill 37 +stat 38 +sendfile 39 +lstat 40 +dup 41 +pipe 42 +times 43 +umount2 45 +setgid 46 +getgid 47 +signal 48 +geteuid 49 +getegid 50 +acct 51 +memory_ordering 52 +ioctl 54 +reboot 55 +symlink 57 +readlink 58 +execve 59 +umask 60 +chroot 61 +fstat 62 +fstat64 63 +getpagesize 64 +msync 65 +vfork 66 +pread64 67 +pwrite64 68 +mmap 71 +munmap 73 +mprotect 74 +madvise 75 +vhangup 76 +mincore 78 +getgroups 79 +setgroups 80 +getpgrp 81 +setitimer 83 +swapon 85 +getitimer 86 +sethostname 88 +dup2 90 +fcntl 92 +select 93 +fsync 95 +setpriority 96 +socket 97 +connect 98 +accept 99 +getpriority 100 +rt_sigreturn 101 +rt_sigaction 102 +rt_sigprocmask 103 +rt_sigpending 104 +rt_sigtimedwait 105 +rt_sigqueueinfo 106 +rt_sigsuspend 107 +setresuid 108 +getresuid 109 +setresgid 110 +getresgid 111 +recvmsg 113 +sendmsg 114 +gettimeofday 116 +getrusage 117 +getsockopt 118 +getcwd 119 +readv 120 +writev 121 +settimeofday 122 +fchown 123 +fchmod 124 +recvfrom 125 +setreuid 126 +setregid 127 +rename 128 +truncate 129 +ftruncate 130 +flock 131 +lstat64 132 +sendto 133 +shutdown 134 +socketpair 135 +mkdir 136 +rmdir 137 +utimes 138 +stat64 139 +sendfile64 140 +getpeername 141 +futex 142 +gettid 143 +getrlimit 144 +setrlimit 145 +pivot_root 146 +prctl 147 +pciconfig_read 148 +pciconfig_write 149 +getsockname 150 +inotify_init 151 +inotify_add_watch 152 +poll 153 +getdents64 154 +inotify_rm_watch 156 +statfs 157 +fstatfs 158 +umount 159 +sched_set_affinity 160 +sched_get_affinity 161 +getdomainname 162 +setdomainname 163 +utrap_install 164 +quotactl 165 +set_tid_address 166 +mount 167 +ustat 168 +setxattr 169 +lsetxattr 170 +fsetxattr 171 +getxattr 172 +lgetxattr 173 +getdents 174 +setsid 175 +fchdir 176 +fgetxattr 177 +listxattr 178 +llistxattr 179 +flistxattr 180 +removexattr 181 +lremovexattr 182 +sigpending 183 +query_module 184 +setpgid 185 +fremovexattr 186 +tkill 187 +exit_group 188 +uname 189 +init_module 190 +personality 191 +remap_file_pages 192 +epoll_create 193 +epoll_ctl 194 +epoll_wait 195 +ioprio_set 196 +getppid 197 +sigaction 198 +sgetmask 199 +ssetmask 200 +sigsuspend 201 +oldlstat 202 +uselib 203 +readdir 204 +readahead 205 +socketcall 206 +syslog 207 +lookup_dcookie 208 +fadvise64 209 +fadvise64_64 210 +tgkill 211 +waitpid 212 +swapoff 213 +sysinfo 214 +ipc 215 +sigreturn 216 +clone 217 +ioprio_get 218 +adjtimex 219 +sigprocmask 220 +create_module 221 +delete_module 222 +get_kernel_syms 223 +getpgid 224 +bdflush 225 +sysfs 226 +afs_syscall 227 +setfsuid 228 +setfsgid 229 +_newselect 230 +splice 232 +stime 233 +statfs64 234 +fstatfs64 235 +_llseek 236 +mlock 237 +munlock 238 +mlockall 239 +munlockall 240 +sched_setparam 241 +sched_getparam 242 +sched_setscheduler 243 +sched_getscheduler 244 +sched_yield 245 +sched_get_priority_max 246 +sched_get_priority_min 247 +sched_rr_get_interval 248 +nanosleep 249 +mremap 250 +_sysctl 251 +getsid 252 +fdatasync 253 +nfsservctl 254 +sync_file_range 255 +clock_settime 256 +clock_gettime 257 +clock_getres 258 +clock_nanosleep 259 +sched_getaffinity 260 +sched_setaffinity 261 +timer_settime 262 +timer_gettime 263 +timer_getoverrun 264 +timer_delete 265 +timer_create 266 +vserver 267 +io_setup 268 +io_destroy 269 +io_submit 270 +io_cancel 271 +io_getevents 272 +mq_open 273 +mq_unlink 274 +mq_timedsend 275 +mq_timedreceive 276 +mq_notify 277 +mq_getsetattr 278 +waitid 279 +tee 280 +add_key 281 +request_key 282 +keyctl 283 +openat 284 +mkdirat 285 +mknodat 286 +fchownat 287 +futimesat 288 +fstatat64 289 +unlinkat 290 +renameat 291 +linkat 292 +symlinkat 293 +readlinkat 294 +fchmodat 295 +faccessat 296 +pselect6 297 +ppoll 298 +unshare 299 +set_robust_list 300 +get_robust_list 301 +migrate_pages 302 +mbind 303 +get_mempolicy 304 +set_mempolicy 305 +kexec_load 306 +move_pages 307 +getcpu 308 +epoll_pwait 309 +utimensat 310 +signalfd 311 +timerfd_create 312 +eventfd 313 +fallocate 314 +timerfd_settime 315 +timerfd_gettime 316 +signalfd4 317 +eventfd2 318 +epoll_create1 319 +dup3 320 +pipe2 321 +inotify_init1 322 +accept4 323 +preadv 324 +pwritev 325 +rt_tgsigqueueinfo 326 +perf_event_open 327 +recvmmsg 328 +fanotify_init 329 +fanotify_mark 330 +prlimit64 331 +name_to_handle_at 332 +open_by_handle_at 333 +clock_adjtime 334 +syncfs 335 +sendmmsg 336 +setns 337 +process_vm_readv 338 +process_vm_writev 339 +kern_features 340 +kcmp 341 +finit_module 342 +sched_setattr 343 +sched_getattr 344 +renameat2 345 +seccomp 346 +getrandom 347 +memfd_create 348 +bpf 349 +execveat 350 +membarrier 351 +userfaultfd 352 +bind 353 +listen 354 +setsockopt 355 +mlock2 356 +copy_file_range 357 +preadv2 358 +pwritev2 359 +statx 360 +io_pgetevents 361 +pkey_mprotect 362 +pkey_alloc 363 +pkey_free 364 +rseq 365 +semtimedop 392 +semget 393 +semctl 394 +shmget 395 +shmctl 396 +shmat 397 +shmdt 398 +msgget 399 +msgsnd 400 +msgrcv 401 +msgctl 402 +pidfd_send_signal 424 +io_uring_setup 425 +io_uring_enter 426 +io_uring_register 427 +open_tree 428 +move_mount 429 +fsopen 430 +fsconfig 431 +fsmount 432 +fspick 433 +pidfd_open 434 +openat2 437 +pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/strip_syscall.awk b/fsstress/include/lapi/syscalls/strip_syscall.awk new file mode 100755 index 0000000000..e8dff422e2 --- /dev/null +++ b/fsstress/include/lapi/syscalls/strip_syscall.awk @@ -0,0 +1,19 @@ +#!/usr/bin/awk -f +# +# Dumb script that can be used to strip all of the syscall information from +# the arch-respective unistd*.h. +# +# Examples: +# +# 1. Grab the i386 32-bit syscalls from unistd_32.h and put them in i386.in +# strip_syscall.awk arch/x86/include/asm/unistd_32.h > i386.in +# + +/^#define[[:space:]]+__NR_[0-9a-z]+/ { + + sub (/#define[[:space:]]+__NR_/, "", $0); + sub (/[[:space:]]*(\/\*.*)/, "", $0); + sub (/[[:space:]]+/, " ", $0); + + print +} diff --git a/fsstress/include/lapi/syscalls/x86_64.in b/fsstress/include/lapi/syscalls/x86_64.in new file mode 100644 index 0000000000..c76328c93a --- /dev/null +++ b/fsstress/include/lapi/syscalls/x86_64.in @@ -0,0 +1,385 @@ +read 0 +write 1 +open 2 +close 3 +stat 4 +fstat 5 +lstat 6 +poll 7 +lseek 8 +mmap 9 +mprotect 10 +munmap 11 +brk 12 +rt_sigaction 13 +rt_sigprocmask 14 +rt_sigreturn 15 +ioctl 16 +pread64 17 +pwrite64 18 +readv 19 +writev 20 +access 21 +pipe 22 +select 23 +sched_yield 24 +mremap 25 +msync 26 +mincore 27 +madvise 28 +shmget 29 +shmat 30 +shmctl 31 +dup 32 +dup2 33 +pause 34 +nanosleep 35 +getitimer 36 +alarm 37 +setitimer 38 +getpid 39 +sendfile 40 +socket 41 +connect 42 +accept 43 +sendto 44 +recvfrom 45 +sendmsg 46 +recvmsg 47 +shutdown 48 +bind 49 +listen 50 +getsockname 51 +getpeername 52 +socketpair 53 +setsockopt 54 +getsockopt 55 +clone 56 +fork 57 +vfork 58 +execve 59 +exit 60 +wait4 61 +kill 62 +uname 63 +semget 64 +semop 65 +semctl 66 +shmdt 67 +msgget 68 +msgsnd 69 +msgrcv 70 +msgctl 71 +fcntl 72 +flock 73 +fsync 74 +fdatasync 75 +truncate 76 +ftruncate 77 +getdents 78 +getcwd 79 +chdir 80 +fchdir 81 +rename 82 +mkdir 83 +rmdir 84 +creat 85 +link 86 +unlink 87 +symlink 88 +readlink 89 +chmod 90 +fchmod 91 +chown 92 +fchown 93 +lchown 94 +umask 95 +gettimeofday 96 +getrlimit 97 +getrusage 98 +sysinfo 99 +times 100 +ptrace 101 +getuid 102 +syslog 103 +getgid 104 +setuid 105 +setgid 106 +geteuid 107 +getegid 108 +setpgid 109 +getppid 110 +getpgrp 111 +setsid 112 +setreuid 113 +setregid 114 +getgroups 115 +setgroups 116 +setresuid 117 +getresuid 118 +setresgid 119 +getresgid 120 +getpgid 121 +setfsuid 122 +setfsgid 123 +getsid 124 +capget 125 +capset 126 +rt_sigpending 127 +rt_sigtimedwait 128 +rt_sigqueueinfo 129 +rt_sigsuspend 130 +sigaltstack 131 +utime 132 +mknod 133 +uselib 134 +personality 135 +ustat 136 +statfs 137 +fstatfs 138 +sysfs 139 +getpriority 140 +setpriority 141 +sched_setparam 142 +sched_getparam 143 +sched_setscheduler 144 +sched_getscheduler 145 +sched_get_priority_max 146 +sched_get_priority_min 147 +sched_rr_get_interval 148 +mlock 149 +munlock 150 +mlockall 151 +munlockall 152 +vhangup 153 +modify_ldt 154 +pivot_root 155 +_sysctl 156 +prctl 157 +arch_prctl 158 +adjtimex 159 +setrlimit 160 +chroot 161 +sync 162 +acct 163 +settimeofday 164 +mount 165 +umount2 166 +swapon 167 +swapoff 168 +reboot 169 +sethostname 170 +setdomainname 171 +iopl 172 +ioperm 173 +create_module 174 +init_module 175 +delete_module 176 +get_kernel_syms 177 +query_module 178 +quotactl 179 +nfsservctl 180 +getpmsg 181 +putpmsg 182 +afs_syscall 183 +tuxcall 184 +security 185 +gettid 186 +readahead 187 +setxattr 188 +lsetxattr 189 +fsetxattr 190 +getxattr 191 +lgetxattr 192 +fgetxattr 193 +listxattr 194 +llistxattr 195 +flistxattr 196 +removexattr 197 +lremovexattr 198 +fremovexattr 199 +tkill 200 +time 201 +futex 202 +sched_setaffinity 203 +sched_getaffinity 204 +set_thread_area 205 +io_setup 206 +io_destroy 207 +io_getevents 208 +io_submit 209 +io_cancel 210 +get_thread_area 211 +lookup_dcookie 212 +epoll_create 213 +epoll_ctl_old 214 +epoll_wait_old 215 +remap_file_pages 216 +getdents64 217 +set_tid_address 218 +restart_syscall 219 +semtimedop 220 +fadvise64 221 +timer_create 222 +timer_settime 223 +timer_gettime 224 +timer_getoverrun 225 +timer_delete 226 +clock_settime 227 +clock_gettime 228 +clock_getres 229 +clock_nanosleep 230 +exit_group 231 +epoll_wait 232 +epoll_ctl 233 +tgkill 234 +utimes 235 +vserver 236 +mbind 237 +set_mempolicy 238 +get_mempolicy 239 +mq_open 240 +mq_unlink 241 +mq_timedsend 242 +mq_timedreceive 243 +mq_notify 244 +mq_getsetattr 245 +kexec_load 246 +waitid 247 +add_key 248 +request_key 249 +keyctl 250 +ioprio_set 251 +ioprio_get 252 +inotify_init 253 +inotify_add_watch 254 +inotify_rm_watch 255 +migrate_pages 256 +openat 257 +mkdirat 258 +mknodat 259 +fchownat 260 +futimesat 261 +newfstatat 262 +unlinkat 263 +renameat 264 +linkat 265 +symlinkat 266 +readlinkat 267 +fchmodat 268 +faccessat 269 +pselect6 270 +ppoll 271 +unshare 272 +set_robust_list 273 +get_robust_list 274 +splice 275 +tee 276 +sync_file_range 277 +vmsplice 278 +move_pages 279 +utimensat 280 +epoll_pwait 281 +signalfd 282 +timerfd_create 283 +eventfd 284 +fallocate 285 +timerfd_settime 286 +timerfd_gettime 287 +accept4 288 +signalfd4 289 +eventfd2 290 +epoll_create1 291 +dup3 292 +pipe2 293 +inotify_init1 294 +preadv 295 +pwritev 296 +rt_tgsigqueueinfo 297 +perf_event_open 298 +recvmmsg 299 +fanotify_init 300 +fanotify_mark 301 +prlimit64 302 +name_to_handle_at 303 +open_by_handle_at 304 +clock_adjtime 305 +syncfs 306 +sendmmsg 307 +setns 308 +getcpu 309 +process_vm_readv 310 +process_vm_writev 311 +kcmp 312 +finit_module 313 +sched_setattr 314 +sched_getattr 315 +renameat2 316 +seccomp 317 +getrandom 318 +memfd_create 319 +kexec_file_load 320 +bpf 321 +execveat 322 +userfaultfd 323 +membarrier 324 +mlock2 325 +copy_file_range 326 +preadv2 327 +pwritev2 328 +pkey_mprotect 329 +pkey_alloc 330 +pkey_free 331 +statx 332 +io_pgetevents 333 +rseq 334 +pidfd_send_signal 424 +io_uring_setup 425 +io_uring_enter 426 +io_uring_register 427 +open_tree 428 +move_mount 429 +fsopen 430 +fsconfig 431 +fsmount 432 +fspick 433 +pidfd_open 434 +clone3 435 +openat2 437 +pidfd_getfd 438 +rt_sigaction 512 +rt_sigreturn 513 +ioctl 514 +readv 515 +writev 516 +recvfrom 517 +sendmsg 518 +recvmsg 519 +execve 520 +ptrace 521 +rt_sigpending 522 +rt_sigtimedwait 523 +rt_sigqueueinfo 524 +sigaltstack 525 +timer_create 526 +mq_notify 527 +kexec_load 528 +waitid 529 +set_robust_list 530 +get_robust_list 531 +vmsplice 532 +move_pages 533 +preadv 534 +pwritev 535 +rt_tgsigqueueinfo 536 +recvmmsg 537 +sendmmsg 538 +process_vm_readv 539 +process_vm_writev 540 +setsockopt 541 +getsockopt 542 +io_setup 543 +io_submit 544 +execveat 545 +preadv2 546 +pwritev2 547 diff --git a/fsstress/include/lapi/tcp.h b/fsstress/include/lapi/tcp.h new file mode 100644 index 0000000000..bb98f28f08 --- /dev/null +++ b/fsstress/include/lapi/tcp.h @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2017 Petr Vorel + */ + +#ifndef LAPI_TCP_H__ +#define LAPI_TCP_H__ + +#include + +#ifndef TCP_FASTOPEN +# define TCP_FASTOPEN 23 +#endif + +#ifndef TCP_FASTOPEN_CONNECT +# define TCP_FASTOPEN_CONNECT 30 /* Attempt FastOpen with connect */ +#endif + +#endif /* LAPI_TCP_H__ */ diff --git a/fsstress/include/lapi/tee.h b/fsstress/include/lapi/tee.h new file mode 100644 index 0000000000..422e811773 --- /dev/null +++ b/fsstress/include/lapi/tee.h @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) International Business Machines Corp., 2007 + * Copyright (c) 2014 Fujitsu Ltd. + */ + +#ifndef TEE_H +#define TEE_H + +#include "config.h" +#include "lapi/syscalls.h" + +#if !defined(HAVE_TEE) +ssize_t tee(int fd_in, int fd_out, size_t len, unsigned int flags) +{ + return tst_syscall(__NR_tee, fd_in, fd_out, len, flags); +} +#endif + +#endif /* TEE_H */ diff --git a/fsstress/include/lapi/termbits.h b/fsstress/include/lapi/termbits.h new file mode 100644 index 0000000000..d79da085b1 --- /dev/null +++ b/fsstress/include/lapi/termbits.h @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2018 Linux Test Project + */ + +#ifndef LAPI_TERMBITS_H__ +#define LAPI_TERMBITS_H__ + +#ifndef EXTPROC +# define EXTPROC 0200000 +#endif + +#endif diff --git a/fsstress/include/lapi/timerfd.h b/fsstress/include/lapi/timerfd.h new file mode 100644 index 0000000000..50e09726be --- /dev/null +++ b/fsstress/include/lapi/timerfd.h @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) International Business Machines Corp., 2007 + * Copyright (c) 2014 Fujitsu Ltd. + */ + +#ifndef TIMERFD_H +#define TIMERFD_H + +#include +#include "config.h" +#include "lapi/syscalls.h" + +#ifdef HAVE_SYS_TIMERFD_H +#include +#endif + +#if !defined(HAVE_TIMERFD_CREATE) +int timerfd_create(int clockid, int flags) +{ + return ltp_syscall(__NR_timerfd_create, clockid, flags); +} +#endif + +#if !defined(HAVE_TIMERFD_GETTIME) +int timerfd_settime(int fd, int flags, const struct itimerspec *new_value, + struct itimerspec *old_value) +{ + return ltp_syscall(__NR_timerfd_settime, fd, flags, new_value, + old_value); +} +#endif + +#if !defined(HAVE_TIMERFD_SETTIME) +int timerfd_gettime(int fd, struct itimerspec *curr_value) +{ + return ltp_syscall(__NR_timerfd_gettime, fd, curr_value); +} +#endif + +#endif /* TIMERFD_H */ diff --git a/fsstress/include/lapi/timex.h b/fsstress/include/lapi/timex.h new file mode 100644 index 0000000000..c2c9e4d8d4 --- /dev/null +++ b/fsstress/include/lapi/timex.h @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved. + * Author: Yang Xu + */ + +#ifndef LAPI_TIMEX_H__ +# define LAPI_TIMEX_H__ + +#define ADJ_ALL (ADJ_OFFSET | ADJ_FREQUENCY | ADJ_MAXERROR | \ + ADJ_ESTERROR | ADJ_STATUS | ADJ_TIMECONST | \ + ADJ_TICK) + +#ifndef ADJ_OFFSET_SS_READ +# define ADJ_OFFSET_SS_READ 0xa001 +#endif + +#ifndef ADJ_NANO +# define ADJ_NANO 0x2000 +#endif + +#ifndef STA_NANO +# define STA_NANO 0x2000 +#endif + +#ifndef ADJ_MICRO +# define ADJ_MICRO 0x1000 +#endif + +#endif/* LAPI_TIMEX_H__ */ diff --git a/fsstress/include/lapi/tty.h b/fsstress/include/lapi/tty.h new file mode 100644 index 0000000000..353a103f12 --- /dev/null +++ b/fsstress/include/lapi/tty.h @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2020 Petr Vorel + */ + +#ifndef LAPI_TTY_H +#define LAPI_TTY_H + +#ifdef HAVE_LINUX_TTY_H +# include +#endif + +#ifndef N_SLCAN +# define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */ +#endif + +#endif /* LAPI_TTY_H */ diff --git a/fsstress/include/lapi/udp.h b/fsstress/include/lapi/udp.h new file mode 100644 index 0000000000..5c73dd3698 --- /dev/null +++ b/fsstress/include/lapi/udp.h @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2018 Oracle and/or its affiliates. + */ + +#ifndef LAPI_UDP_H__ +#define LAPI_UDP_H__ + +#include + +#ifndef UDPLITE_SEND_CSCOV +# define UDPLITE_SEND_CSCOV 10 /* sender partial coverage (as sent) */ +#endif +#ifndef UDPLITE_RECV_CSCOV +# define UDPLITE_RECV_CSCOV 11 /* receiver partial coverage (threshold ) */ +#endif + +#endif /* LAPI_UDP_H__ */ diff --git a/fsstress/include/lapi/ustat.h b/fsstress/include/lapi/ustat.h new file mode 100644 index 0000000000..98633e7494 --- /dev/null +++ b/fsstress/include/lapi/ustat.h @@ -0,0 +1,22 @@ +//SPDX-License-Identifier: GPL-2.0-or-later + +#ifndef LAPI_USTAT_H +#define LAPI_USTAT_H + +#include "config.h" + +#include + +#ifdef HAVE_SYS_USTAT_H +# include +#elif HAVE_LINUX_TYPES_H +# include +struct ustat { + __kernel_daddr_t f_tfree; + ino_t f_tinode; + char f_fname[6]; + char f_fpack[6]; +}; +#endif + +#endif /* LAPI_USTAT_H */ diff --git a/fsstress/include/lapi/utime.h b/fsstress/include/lapi/utime.h new file mode 100644 index 0000000000..dbfaa55be3 --- /dev/null +++ b/fsstress/include/lapi/utime.h @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved. + */ + +#ifndef __UTIME_H__ + +#ifndef UTIME_NOW +# define UTIME_NOW ((1l << 30) - 1l) +#endif + +#ifndef UTIME_OMIT +# define UTIME_OMIT ((1l << 30) - 2l) +#endif + +#endif /* __UTIME_H__ */ diff --git a/fsstress/include/lapi/utsname.h b/fsstress/include/lapi/utsname.h new file mode 100644 index 0000000000..6209eac47b --- /dev/null +++ b/fsstress/include/lapi/utsname.h @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 Petr Vorel + */ + +#ifdef HAVE_SYS_UTSNAME_H +# include +#endif + +#ifndef _UTSNAME_LENGTH +# define _UTSNAME_LENGTH 65 +#endif + +#ifndef _UTSNAME_DOMAIN_LENGTH +# define _UTSNAME_DOMAIN_LENGTH _UTSNAME_LENGTH +#endif diff --git a/fsstress/include/lapi/vmsplice.h b/fsstress/include/lapi/vmsplice.h new file mode 100644 index 0000000000..ba0fcca277 --- /dev/null +++ b/fsstress/include/lapi/vmsplice.h @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) International Business Machines Corp., 2007 + * Copyright (c) 2014 Cyril Hrubis + */ + +#ifndef VMSPLICE_H +#define VMSPLICE_H + +#include "config.h" +#include "lapi/syscalls.h" + +#include "lapi/iovec.h" + +#if !defined(HAVE_VMSPLICE) +ssize_t vmsplice(int fd, const struct iovec *iov, + unsigned long nr_segs, unsigned int flags) +{ + return tst_syscall(__NR_vmsplice, fd, iov, nr_segs, flags); +} +#endif + +#endif /* VMSPLICE_H */ diff --git a/fsstress/include/lapi/xfrm.h b/fsstress/include/lapi/xfrm.h new file mode 100644 index 0000000000..d9051202c1 --- /dev/null +++ b/fsstress/include/lapi/xfrm.h @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2018 Linux Test Project + */ + +#ifndef LAPI_XFRM_H__ +#define LAPI_XFRM_H__ + +#ifndef XFRMNLGRP_NONE +# define XFRMNLGRP_NONE 0 +#endif + +#ifndef XFRM_MSG_GETPOLICY +# define XFRM_MSG_GETPOLICY 21 +#endif + +#endif diff --git a/fsstress/include/libmsgctl.h b/fsstress/include/libmsgctl.h new file mode 100644 index 0000000000..e1afeab5f8 --- /dev/null +++ b/fsstress/include/libmsgctl.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) International Business Machines Corp., 2002 + * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved. + * + * 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 would 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 the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef __LIBMSGCTL_H__ +#define __LIBMSGCTL_H__ + +#define FAIL 1 +#define PASS 0 + +struct mbuffer { + long type; + struct { + char len; + char pbytes[99]; + } data; +}; + +int doreader(long key, int tid, long type, int child, int nreps); +int dowriter(long key, int tid, long type, int child, int nreps); +int fill_buffer(char *buf, char val, int size); +int verify(char *buf, char val, int size, int child); + +#endif /*__LIBMSGCTL_H__ */ diff --git a/fsstress/include/libnewipc.h b/fsstress/include/libnewipc.h new file mode 100644 index 0000000000..30288cd68c --- /dev/null +++ b/fsstress/include/libnewipc.h @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2016 Xiao Yang + * + * 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. + */ + +/* + * common definitions for the IPC system calls. + */ + +#ifndef __LIBNEWIPC_H +#define __LIBNEWIPC_H 1 + +#include + +#define MSG_RD 0400 +#define MSG_WR 0200 +#define MSG_RW (MSG_RD | MSG_WR) +#define MSGSIZE 1024 +#define MSGTYPE 1 +#define NR_MSGQUEUES 16 +#define min(a, b) (((a) < (b)) ? (a) : (b)) + +#define SEM_RD 0400 +#define SEM_ALT 0200 +#define SEM_RA (SEM_RD | SEM_ALT) +#define PSEMS 10 + +#define SHM_RD 0400 +#define SHM_WR 0200 +#define SHM_RW (SHM_RD | SHM_WR) +#define SHM_SIZE 2048 +#define INT_SIZE 4 +#define MODE_MASK 0x01FF + +key_t getipckey(const char *file, const int lineno); +#define GETIPCKEY() \ + getipckey(__FILE__, __LINE__) + +int get_used_queues(const char *file, const int lineno); +#define GET_USED_QUEUES() \ + get_used_queues(__FILE__, __LINE__) + +void *probe_free_addr(const char *file, const int lineno); +#define PROBE_FREE_ADDR() \ + probe_free_addr(__FILE__, __LINE__) + +#endif /* newlibipc.h */ diff --git a/fsstress/include/mk/automake.mk b/fsstress/include/mk/automake.mk new file mode 100644 index 0000000000..219d015d0c --- /dev/null +++ b/fsstress/include/mk/automake.mk @@ -0,0 +1,115 @@ +# +# Autotools include Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# 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. +# +# Ngie Cooper, July 2009 +# + +# Override these variables to use non-system available tools. +ACLOCAL ?= aclocal +AUTOCONF ?= autoconf +AUTOHEADER ?= autoheader +AUTOMAKE ?= automake + +AUTOCONFED_SUBDIRS = \ + testcases/realtime + +# We want to run this every single time to ensure that all of the prereq files +# are there. +.PHONY: testcases/realtime/configure +testcases/realtime/configure: + $(MAKE) -C $(@D) autotools + +.PHONY: autotools +autotools: aclocal autoconf autoheader automake $(addsuffix /configure,$(AUTOCONFED_SUBDIRS)) + +.PHONY: aclocal +aclocal: aclocal.m4 + +aclocal.m4: $(wildcard m4/*.m4) m4/ltp-version.m4 + $(ACLOCAL) -I m4 + +.PHONY: autoconf +autoconf: configure + +configure: configure.ac aclocal.m4 + $(AUTOCONF) + +.PHONY: autoheader +autoheader: configure.ac $(wildcard m4/*.m4) m4/ltp-version.m4 aclocal.m4 + $(AUTOHEADER) + +include: + mkdir -p "$@" + +m4/ltp-version.m4: VERSION + sed -n '1{s:LTP-:m4_define([LTP_VERSION],[:;s:$$:]):;p;q}' $< > $@ + +.PHONY: automake +AUTOMAKE_FILES := config.guess config.sub install-sh missing stamp-h1 +automake: aclocal $(AUTOMAKE_FILES) +$(AUTOMAKE_FILES): m4/Makefile.in +m4/Makefile.in: m4/Makefile.am aclocal.m4 + $(AUTOMAKE) -c -a + +.PHONY: ac-clean ac-distclean ac-maintainer-clean +ac-clean:: + $(RM) -rf autom4te.cache + $(RM) -f config.log config.status + $(RM) -f include/config.h include/stamp-h1 + $(RM) -f m4/Makefile m4/ltp-version.m4 + for d in $(AUTOCONFED_SUBDIRS); do \ + $(MAKE) -C "$(top_srcdir)/$$d" $@; \ + done + +ac-distclean:: ac-clean +ac-maintainer-clean:: ac-distclean + for d in $(AUTOCONFED_SUBDIRS); do \ + $(MAKE) -C "$(top_srcdir)/$$d" $@; \ + done + $(RM) -f aclocal.m4 configure $(AUTOMAKE_FILES) m4/Makefile.in + $(RM) -f include/*config.h.in + +# Don't include config.h, or make will (rightfully) whine about overriding +# rules. +# +# This list should match the files in configure.ac. +# +AUTOGENERATED_FILES = \ + include/mk/config.mk \ + include/mk/features.mk \ + lib/ltp.pc \ + m4/Makefile \ + execltp + +distclean:: %: clean ac-distclean + for d in $(AUTOCONFED_SUBDIRS); do \ + $(MAKE) -C "$(top_srcdir)/$$d" $@; \ + done + $(RM) -f $(AUTOGENERATED_FILES) + +maintainer-clean:: distclean ac-maintainer-clean + +$(AUTOGENERATED_FILES): $(top_builddir)/config.status + $(SHELL) $^ + +# This variable is automatically changed from help to all once someone has +# run configure, or the equivalent steps manually, as described in INSTALL. +$(abs_top_builddir)/include/mk/config.mk \ +$(abs_top_builddir)/include/mk/features.mk: + $(MAKE) -C $(top_srcdir) help; false diff --git a/fsstress/include/mk/config-openposix.mk b/fsstress/include/mk/config-openposix.mk new file mode 100644 index 0000000000..caf7656e17 --- /dev/null +++ b/fsstress/include/mk/config-openposix.mk @@ -0,0 +1,5 @@ +# Parameters from the top level configure +CC= gcc +CFLAGS+= -g -O2 +LDLIBS+= +LDFLAGS+= diff --git a/fsstress/include/mk/config-openposix.mk.in b/fsstress/include/mk/config-openposix.mk.in new file mode 100644 index 0000000000..9a91dcb7ee --- /dev/null +++ b/fsstress/include/mk/config-openposix.mk.in @@ -0,0 +1,5 @@ +# Parameters from the top level configure +CC= @CC@ +CFLAGS+= @CFLAGS@ +LDLIBS+= @LIBS@ +LDFLAGS+= @LDFLAGS@ diff --git a/fsstress/include/mk/config.mk b/fsstress/include/mk/config.mk new file mode 100644 index 0000000000..55ecc68bb5 --- /dev/null +++ b/fsstress/include/mk/config.mk @@ -0,0 +1,85 @@ +# +# config.mk.in. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# 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. +# +# Ngie Cooper, July 2009 +# + +# See this page for more info about LEX*: +# http://www.gnu.org/software/hello/manual/autoconf/Particular-Programs.html + +# Application specifying variables. You should never have to change these. +AR := ar +CC := gcc +LEX := flex +RANLIB := ranlib +STRIP := strip +YACC := bison -y + +AIO_LIBS := +CAP_LIBS := +ACL_LIBS := +CRYPTO_LIBS := -lcrypto +LEXLIB := -lfl +NUMA_LIBS := +SELINUX_LIBS := +HAVE_RPC := 1 +TIRPC_CFLAGS := +TIRPC_LIBS := +KEYUTILS_LIBS := +HAVE_FTS_H := 1 +LIBMNL_LIBS := +LIBMNL_CFLAGS := + +prefix := /opt/ltp + +datarootdir := ${prefix}/share +includedir := ${prefix}/include +exec_prefix := ${prefix} +bindir := ${exec_prefix}/bin +libdir := ${exec_prefix}/lib +mandir := ${datarootdir}/man + +CPPFLAGS := +CFLAGS := -g -O2 +LDLIBS := +LDFLAGS := + +DEBUG_CFLAGS ?= -g + +# for -fstrict-aliasing see doc/build-system-guide.txt +OPT_CFLAGS ?= -O2 -fno-strict-aliasing -pipe + +WCFLAGS ?= -Wall -W -Wold-style-definition + +LDFLAGS += $(WLDFLAGS) +CFLAGS += $(DEBUG_CFLAGS) $(OPT_CFLAGS) $(WCFLAGS) + +LINUX_VERSION := 4.13.0 +LINUX_DIR := /lib/modules/4.13.0/build +LINUX_VERSION_MAJOR := 4 +LINUX_VERSION_PATCH := 13 +WITH_MODULES := yes + +HOST_CPU := x86_64 + +ifeq ($(strip $(prefix)),) +$(error you are using $$(prefix) incorrectly -- set it to $(abs_top_srcdir) if you want to build in the source tree) +endif + +export datarootdir includedir libdir mandir prefix diff --git a/fsstress/include/mk/config.mk.in b/fsstress/include/mk/config.mk.in new file mode 100644 index 0000000000..427608a17b --- /dev/null +++ b/fsstress/include/mk/config.mk.in @@ -0,0 +1,85 @@ +# +# config.mk.in. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# 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. +# +# Ngie Cooper, July 2009 +# + +# See this page for more info about LEX*: +# http://www.gnu.org/software/hello/manual/autoconf/Particular-Programs.html + +# Application specifying variables. You should never have to change these. +AR := @AR@ +CC := @CC@ +LEX := @LEX@ +RANLIB := @RANLIB@ +STRIP := @STRIP@ +YACC := @YACC@ + +AIO_LIBS := @AIO_LIBS@ +CAP_LIBS := @CAP_LIBS@ +ACL_LIBS := @ACL_LIBS@ +CRYPTO_LIBS := @CRYPTO_LIBS@ +LEXLIB := @LEXLIB@ +NUMA_LIBS := @NUMA_LIBS@ +SELINUX_LIBS := @SELINUX_LIBS@ +HAVE_RPC := @HAVE_RPC@ +TIRPC_CFLAGS := @TIRPC_CFLAGS@ +TIRPC_LIBS := @TIRPC_LIBS@ +KEYUTILS_LIBS := @KEYUTILS_LIBS@ +HAVE_FTS_H := @HAVE_FTS_H@ +LIBMNL_LIBS := @LIBMNL_LIBS@ +LIBMNL_CFLAGS := @LIBMNL_CFLAGS@ + +prefix := @prefix@ + +datarootdir := @datarootdir@ +includedir := @includedir@ +exec_prefix := @exec_prefix@ +bindir := @bindir@ +libdir := @libdir@ +mandir := @mandir@ + +CPPFLAGS := @CPPFLAGS@ +CFLAGS := @CFLAGS@ +LDLIBS := @LIBS@ +LDFLAGS := @LDFLAGS@ + +DEBUG_CFLAGS ?= -g + +# for -fstrict-aliasing see doc/build-system-guide.txt +OPT_CFLAGS ?= -O2 -fno-strict-aliasing -pipe + +WCFLAGS ?= -Wall -W @GCC_WARN_OLDSTYLE@ + +LDFLAGS += $(WLDFLAGS) +CFLAGS += $(DEBUG_CFLAGS) $(OPT_CFLAGS) $(WCFLAGS) + +LINUX_VERSION := @LINUX_VERSION@ +LINUX_DIR := @LINUX_DIR@ +LINUX_VERSION_MAJOR := @LINUX_VERSION_MAJOR@ +LINUX_VERSION_PATCH := @LINUX_VERSION_PATCH@ +WITH_MODULES := @WITH_MODULES@ + +HOST_CPU := @HOST_CPU@ + +ifeq ($(strip $(prefix)),) +$(error you are using $$(prefix) incorrectly -- set it to $(abs_top_srcdir) if you want to build in the source tree) +endif + +export datarootdir includedir libdir mandir prefix diff --git a/fsstress/include/mk/env_post.mk b/fsstress/include/mk/env_post.mk new file mode 100644 index 0000000000..f4169ad666 --- /dev/null +++ b/fsstress/include/mk/env_post.mk @@ -0,0 +1,110 @@ +# +# Environment post-setup Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# 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. +# +# Ngie Cooper, July 2009 +# + +ENV_PRE_LOADED ?= $(error You must load env_pre.mk before including this file) + +include $(top_srcdir)/include/mk/functions.mk + +ifndef ENV_POST_LOADED +ENV_POST_LOADED = 1 + +# Default source search path. Modify as necessary, but I would call that +# poor software design if you need more than one search directory, and +# would suggest creating a general purpose static library to that end. +vpath %.c $(abs_srcdir) + +# For config.h, et all. +CPPFLAGS += -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_srcdir)/include/old/ + +LDFLAGS += -L$(top_builddir)/lib + +ifeq ($(UCLINUX),1) +CPPFLAGS += -D__UCLIBC__ -DUCLINUX +endif + +ifeq ($(ANDROID),1) +LDFLAGS += -L$(top_builddir)/lib/android_libpthread +LDFLAGS += -L$(top_builddir)/lib/android_librt +endif + +MAKE_TARGETS ?= $(notdir $(patsubst %.c,%,$(wildcard $(abs_srcdir)/*.c))) + +MAKE_TARGETS := $(filter-out $(FILTER_OUT_MAKE_TARGETS),$(MAKE_TARGETS)) + +# with only *.dwo, .[0-9]+.dwo can not be cleaned +CLEAN_TARGETS += $(MAKE_TARGETS) *.o *.pyc .cache.mk *.dwo .*.dwo + +# Majority of the files end up in testcases/bin... +INSTALL_DIR ?= testcases/bin + +ifneq ($(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS)) + +ifeq ($(strip $(INSTALL_DIR)),) +INSTALL_DIR := $(error You must define INSTALL_DIR before including this file) +endif + +ifneq ($(strip $(prefix)),) +# Value specified by INSTALL_DIR isn't an absolute path, so let's tack on $(prefix). +ifneq ($(patsubst /%,,$(INSTALL_DIR)),) +INSTALL_DIR := $(prefix)/$(INSTALL_DIR) +endif + +# Glob any possible expressions, but make sure to zap the $(abs_srcdir) +# reference at the start of the filename instead of using $(notdir), so that +# way we don't accidentally nuke the relative path from $(abs_srcdir) that +# may have been set in the Makefile. +INSTALL_TARGETS := $(wildcard $(addprefix $(abs_srcdir)/,$(INSTALL_TARGETS))) +INSTALL_TARGETS := $(patsubst $(abs_srcdir)/%,%,$(INSTALL_TARGETS)) + +# The large majority of the files that we install are going to be apps and +# scripts, so let's chmod them like that. +INSTALL_MODE ?= 00775 + +ifdef MAKE_3_80_COMPAT + +INSTALL_PATH := $(call MAKE_3_80_abspath,$(DESTDIR)/$(INSTALL_DIR)) + +INSTALL_TARGETS_ABS := $(call MAKE_3_80_abspath,$(addprefix $(INSTALL_PATH)/,$(INSTALL_TARGETS))) +MAKE_TARGETS_ABS := $(call MAKE_3_80_abspath,$(addprefix $(INSTALL_PATH)/,$(MAKE_TARGETS))) + +INSTALL_FILES := $(INSTALL_TARGETS_ABS) $(MAKE_TARGETS_ABS) + +$(INSTALL_TARGETS_ABS): + test -d "$(@D)" || mkdir -p "$(@D)" + install -m $(INSTALL_MODE) "$(abs_srcdir)/$(subst $(INSTALL_PATH)/,,$@)" "$@" + +$(MAKE_TARGETS_ABS): + test -d "$(@D)" || mkdir -p "$(@D)" + install -m $(INSTALL_MODE) "$(abs_builddir)/$(subst $(INSTALL_PATH)/,,$@)" "$@" +else +$(abspath $(addprefix $(DESTDIR)/$(INSTALL_DIR)/,$(sort $(dir $(INSTALL_TARGETS) $(MAKE_TARGETS))))): + mkdir -p "$@" +$(foreach install_target,$(INSTALL_TARGETS),$(eval $(call generate_install_rule,$(install_target),$(abs_srcdir),$(INSTALL_DIR)))) +$(foreach make_target,$(MAKE_TARGETS),$(eval $(call generate_install_rule,$(make_target),$(abs_builddir),$(INSTALL_DIR)))) +endif + +else # else ! $(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS) +$(error You must define $$(prefix) before executing install) +endif # END $(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS) +endif + +endif diff --git a/fsstress/include/mk/env_pre.mk b/fsstress/include/mk/env_pre.mk new file mode 100644 index 0000000000..c4a1f47081 --- /dev/null +++ b/fsstress/include/mk/env_pre.mk @@ -0,0 +1,155 @@ +# +# Make pre-include environment Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# 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. +# +# Ngie Cooper, September 2009 +# +# This Makefile must be included first. NO IF'S, AND'S, OR BUT'S. +# +# This sets the stage for all operations required within Makefiles. +# + +ifndef ENV_PRE_LOADED +ENV_PRE_LOADED = 1 + +# "out-of-build-tree" build. +BUILD_TREE_BUILDDIR_INSTALL := 1 +# "in-srcdir" build / install. +BUILD_TREE_SRCDIR_INSTALL := 2 +# "in-srcdir" build, non-srcdir install. +BUILD_TREE_NONSRCDIR_INSTALL := 3 +# configure not run. +BUILD_TREE_UNCONFIGURED := 4 + +ifndef MAKE_VERSION_CHECK +export MAKE_VERSION_CHECK = 1 +ifneq ($(firstword $(sort 3.80 $(MAKE_VERSION))),3.80) +$(error Your version of make $(MAKE_VERSION) is too old. Upgrade to at least 3.80; 3.81+ is preferred) +else +ifneq ($(filter 3.80%,$(MAKE_VERSION)),) +export MAKE_3_80_COMPAT := 1 +endif # make 3.80? +endif # At least make 3.80? +endif # MAKE_VERSION_CHECK + +# Get the absolute path for the source directory. +top_srcdir ?= $(error You must define top_srcdir before including this file) + +include $(top_srcdir)/include/mk/functions.mk + +# Where's the root source directory? +ifdef MAKE_3_80_COMPAT +abs_top_srcdir := $(call MAKE_3_80_abspath,$(top_srcdir)) +else +abs_top_srcdir := $(abspath $(top_srcdir)) +endif + +# +# Where's the root object directory? +# +# Just in case it's not specified, set it to the top srcdir (because the user +# must not have wanted out of build tree support)... +# +top_builddir ?= $(top_srcdir) + +# We need the absolute path... +ifdef MAKE_3_80_COMPAT +abs_top_builddir := $(call MAKE_3_80_abspath,$(top_builddir)) +else +abs_top_builddir := $(abspath $(top_builddir)) +endif + +# Where's the root object directory? +builddir := . + +abs_builddir := $(CURDIR) + +cwd_rel_from_top := $(subst $(abs_top_builddir),,$(abs_builddir)) + +# Where's the source located at? Squish all of the / away by using abspath... +ifdef MAKE_3_80_COMPAT +abs_srcdir := $(call MAKE_3_80_abspath,$(abs_top_srcdir)/$(cwd_rel_from_top)) +else +abs_srcdir := $(abspath $(abs_top_srcdir)/$(cwd_rel_from_top)) +endif + +srcdir := $(strip $(subst $(abs_top_srcdir)/,,$(abs_srcdir))) + +ifeq ($(srcdir),) +srcdir := . +endif + +# If config.mk or features.mk doesn't exist it's not an error for some targets +# which are filtered below (e.g. clean). However these config files may be +# needed for those targets (eg. the open posix testsuite is not cleaned even if +# it's enabled by configure) thus it would be wise to do silent inclusion. +ifneq ("$(wildcard $(abs_top_builddir)/include/mk/config.mk)","") +include $(abs_top_builddir)/include/mk/config.mk +endif +ifneq ("$(wildcard $(abs_top_builddir)/include/mk/features.mk)","") +include $(abs_top_builddir)/include/mk/features.mk +endif + +# autotools, *clean, and help don't require config.mk, features.mk, etc... +ifeq ($(filter autotools %clean .gitignore gitignore.% help,$(MAKECMDGOALS)),) + +include $(abs_top_builddir)/include/mk/config.mk +include $(abs_top_builddir)/include/mk/features.mk + +# START out-of-build-tree check. +ifneq ($(abs_builddir),$(abs_srcdir)) +BUILD_TREE_STATE := $(BUILD_TREE_BUILDDIR_INSTALL) +else +# Else, not out of build tree.. + +# START srcdir build-tree install checks +ifeq ($(strip $(DESTDIR)$(prefix)),) +BUILD_TREE_STATE := $(BUILD_TREE_SRCDIR_INSTALL) +else # Empty $(DESTDIR)$(prefix) +ifeq ($(abs_top_srcdir),$(prefix)) +BUILD_TREE_STATE := $(BUILD_TREE_SRCDIR_INSTALL) +endif +# END srcdir build-tree install checks +endif +# END out-of-build-tree check. +endif + +# Is the build-tree configured yet? +ifeq ($(BUILD_TREE_STATE),) +ifneq ($(wildcard $(abs_top_builddir)/include/mk/config.mk),) +BUILD_TREE_STATE := $(BUILD_TREE_NONSRCDIR_INSTALL) +endif +endif + +ifeq ($(MAKE_3_80_COMPAT),1) +# Trick make 3.80 into thinking that the default goal is all. +.PHONY: default +default: all +else +.DEFAULT_GOAL := all +endif + +endif # END autotools, *clean... + +BUILD_TREE_STATE ?= $(BUILD_TREE_UNCONFIGURED) + +# We can piece together where we're located in the source and object trees with +# just these two vars and $(CURDIR). +export abs_top_srcdir abs_top_builddir BUILD_TREE_STATE + +endif diff --git a/fsstress/include/mk/features.mk b/fsstress/include/mk/features.mk new file mode 100644 index 0000000000..cf740c56d8 --- /dev/null +++ b/fsstress/include/mk/features.mk @@ -0,0 +1,49 @@ +# +# features.mk.in - feature tuning include Makefile. +# +# Copyright (C) 2010, Linux Test Project. +# +# 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. +# +# Ngie Cooper, October 2010 +# + +# Tools enable knobs +WITH_EXPECT := no + +WITH_PERL := no + +WITH_PYTHON := no + +# Features knobs + +# Test suite knobs + +# Enable testcases/kernel/power_management's compile and install? +ifeq ($(UCLINUX),1) +WITH_POWER_MANAGEMENT_TESTSUITE := no +else +WITH_POWER_MANAGEMENT_TESTSUITE := yes +endif + +# Enable testcases/open_posix_testsuite's compile and install? +WITH_OPEN_POSIX_TESTSUITE := no + +# Enable testcases/realtime's compile and install? +ifeq ($(UCLINUX),1) +WITH_REALTIME_TESTSUITE := no +else +WITH_REALTIME_TESTSUITE := no +endif diff --git a/fsstress/include/mk/features.mk.in b/fsstress/include/mk/features.mk.in new file mode 100644 index 0000000000..8e561b7384 --- /dev/null +++ b/fsstress/include/mk/features.mk.in @@ -0,0 +1,49 @@ +# +# features.mk.in - feature tuning include Makefile. +# +# Copyright (C) 2010, Linux Test Project. +# +# 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. +# +# Ngie Cooper, October 2010 +# + +# Tools enable knobs +WITH_EXPECT := @WITH_EXPECT@ + +WITH_PERL := @WITH_PERL@ + +WITH_PYTHON := @WITH_PYTHON@ + +# Features knobs + +# Test suite knobs + +# Enable testcases/kernel/power_management's compile and install? +ifeq ($(UCLINUX),1) +WITH_POWER_MANAGEMENT_TESTSUITE := no +else +WITH_POWER_MANAGEMENT_TESTSUITE := yes +endif + +# Enable testcases/open_posix_testsuite's compile and install? +WITH_OPEN_POSIX_TESTSUITE := @WITH_OPEN_POSIX_TESTSUITE@ + +# Enable testcases/realtime's compile and install? +ifeq ($(UCLINUX),1) +WITH_REALTIME_TESTSUITE := no +else +WITH_REALTIME_TESTSUITE := @WITH_REALTIME_TESTSUITE@ +endif diff --git a/fsstress/include/mk/functions.mk b/fsstress/include/mk/functions.mk new file mode 100644 index 0000000000..6f67b5af8c --- /dev/null +++ b/fsstress/include/mk/functions.mk @@ -0,0 +1,76 @@ +# +# A Makefile with a collection of reusable functions. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# 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. +# +# Ngie Cooper, July 2009 +# + +SQUOTE := ' + +# ' # to keep colorized editors from going nuts + +MAKE_3_80_realpath = $(shell $(top_srcdir)/scripts/realpath.sh '$(subst $(SQUOTE),\\$(SQUOTE),$(1))') + +MAKE_3_80_abspath = $(shell $(top_srcdir)/scripts/abspath.sh '$(subst $(SQUOTE),\\$(SQUOTE),$(1))') + +# +# NOTE (garrcoop): +# +# The following functions are (sometimes) split into 3.80 and 3.81+ +# counterparts, and not conditionalized inside of the define(s) to work around +# an issue with how make 3.80 evaluates defines. +# +# SO DO NOT INTERNALIZE CONDITIONALS IN DEFINES OR YOU WILL BREAK MAKE 3.80! +# + +# +# Generate an install rule which also creates the install directory if needed +# to avoid unnecessary bourne shell based for-loops and install errors, as well +# as adhoc install rules. +# +# 1 -> Target basename. +# 2 -> Source directory. +# 3 -> Destination directory. +# +ifdef MAKE_3_80_COMPAT +define generate_install_rule + +INSTALL_FILES += $$(call MAKE_3_80_abspath,$$(DESTDIR)/$(3)/$(1)) + +$$(call MAKE_3_80_abspath,$$(DESTDIR)/$(3)/$(1)): \ + $$(call MAKE_3_80_abspath,$$(dir $$(DESTDIR)/$(3)/$(1))) + install -m $$(INSTALL_MODE) "$(2)/$(1)" "$$@" +endef +else # not MAKE_3_80_COMPAT +define generate_install_rule + +INSTALL_FILES += $$(abspath $$(DESTDIR)/$(3)/$(1)) + +$$(abspath $$(DESTDIR)/$(3)/$(1)): \ + $$(abspath $$(dir $$(DESTDIR)/$(3)/$(1))) + install -m $$(INSTALL_MODE) "$(2)/$(1)" "$$@" +endef +endif # END MAKE_3_80_COMPAT + +# +# Set SUBDIRS to the subdirectories where Makefiles were found. +# +define get_make_dirs +SUBDIRS ?= $$(subst $$(abs_srcdir)/,,$$(patsubst %/Makefile,%,$$(wildcard $$(abs_srcdir)/*/Makefile))) +SUBDIRS := $$(filter-out $$(FILTER_OUT_DIRS),$$(SUBDIRS)) +endef diff --git a/fsstress/include/mk/generic_leaf_target.inc b/fsstress/include/mk/generic_leaf_target.inc new file mode 100644 index 0000000000..dd54d05e96 --- /dev/null +++ b/fsstress/include/mk/generic_leaf_target.inc @@ -0,0 +1,106 @@ +# +# Generic leaf rules include Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# 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. +# +# Ngie Cooper, July 2009 +# + +# +# generic_leaf_target +# +# Generate a set of basic targets (all, clean, install) for a leaf directory +# (no subdirectories). +# +# $(MAKE_DEPS) : What should we execute beforehand as a +# dependency of $(MAKE_TARGETS)? +# +# $(INSTALL_FILES) -> install +# +# Helpful variables are: +# +# $(MAKE_TARGETS) : What to execute as direct dependencies of +# all. +# 1. Defaults to the basename of the targets +# produced by the %.c -> % implicit pattern +# rules, e.g. the MAKE_TARGET in a directory +# like the following: +# +# $$ ls /bar +# foo.c +# +# Would be `foo'. Similarly, the following +# dir structure: +# +# $$ ls /bar +# foo.c zanzibar.c +# +# Would be `foo zanzibar'. +# +# 2. If you define MAKE_TARGETS as an empty +# string, this will override the defaults. +# I did this to avoid providing too much +# rope to hang one's self in the event of +# unwanted behavior. +# +# $(CLEAN_TARGETS) : What targets should be cleaned (must be +# real files). This will automatically append +# adds the .o suffix to all files referenced +# by $(MAKE_TARGETS)) to CLEAN_TARGETS, if +# MAKE_TARGETS wasn't defined (see +# $(MAKE_TARGETS)). +# $(INSTALL_MODE) : What mode should we using when calling +# install(1)? +# +# Also, if you wish to change the installation directory, from the set default +# (testcases/bin) you must do something like either one of the following items: +# +# Method A: +# +# INSTALL_DIR := /path/to/installdir/from/$(DESTDIR)/$(prefix) +# +# e.g. if I wanted to install my binaries in testcases/bin, I would do: +# +# INSTALL_DIR := testcases/bin +# +# in my calling Makefile. +# +# Or Method B: +# +# INSTALL_DIR := /path/to/installdir/from/$(DESTDIR) +# +# e.g. if I wanted to install my binaries in $(libdir) (which may not exist +# outside of $(prefix) right now, but could in the future), I could do the +# following: +# +# INSTALL_DIR := $(libdir) +# + +.PHONY: all clean install + +$(MAKE_TARGETS): | $(MAKE_DEPS) + +all: $(MAKE_TARGETS) + +clean:: $(CLEAN_DEPS) + -$(RM) -f $(CLEAN_TARGETS) + +$(INSTALL_FILES): | $(INSTALL_DEPS) + +install: $(INSTALL_FILES) + +# vim: syntax=make diff --git a/fsstress/include/mk/generic_leaf_target.mk b/fsstress/include/mk/generic_leaf_target.mk new file mode 100644 index 0000000000..908d0b0004 --- /dev/null +++ b/fsstress/include/mk/generic_leaf_target.mk @@ -0,0 +1,24 @@ +# +# Generic leaf include Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# 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. +# +# Ngie Cooper, July 2009 +# + +include $(top_srcdir)/include/mk/env_post.mk +include $(top_srcdir)/include/mk/generic_leaf_target.inc diff --git a/fsstress/include/mk/generic_trunk_target.inc b/fsstress/include/mk/generic_trunk_target.inc new file mode 100644 index 0000000000..cc255c62a8 --- /dev/null +++ b/fsstress/include/mk/generic_trunk_target.inc @@ -0,0 +1,98 @@ +# +# Generic trunk rules include Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# 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. +# +# Ngie Cooper, July 2009 +# + +# +# generic_trunk_target +# +# Generate a set of recursive targets to apply over a trunk directory (has +# directories) -- optionally with a set of trunk-based files. +# +# All variables in this canned define are essentially the same as +# generic_leaf_target, with the exception that the install flow for local +# targets is: +# +# $(INSTALL_FILES) -> trunk-install -> install (recursive) +# +# All recursive targets are traverse SUBDIRS as defined by the user, or if +# undefined, defaults to any subdirectories where Makefile's are contained +# within. +# +# generic_trunk_target specific variables are: +# +# RECURSIVE_TARGETS : a list of targets to apply over an entire +# directory tree. This defaults to +# `all install'. +# +# See generic_leaf_target, generic_target_env_setup, and get_make_dirs for +# more details and design notes. +# + +include $(top_srcdir)/include/mk/functions.mk + +RECURSIVE_TARGETS ?= all install + +$(eval $(get_make_dirs)) + +.PHONY: $(RECURSIVE_TARGETS) $(addprefix trunk-,$(RECURSIVE_TARGETS)) + +$(SUBDIRS): %: + mkdir -m 00755 -p "$@" + +$(MAKE_TARGETS): | $(MAKE_DEPS) + +trunk-all: $(MAKE_TARGETS) + +trunk-clean:: | $(SUBDIRS) + $(if $(strip $(CLEAN_TARGETS)),$(RM) -f $(CLEAN_TARGETS)) + +$(INSTALL_FILES): | $(INSTALL_DEPS) + +trunk-install: $(INSTALL_FILES) + +# Avoid creating duplicate .PHONY references to all, clean, and install. IIRC, +# I've seen some indeterministic behavior when one does this in the past with +# GNU Make... +.PHONY: $(filter-out $(RECURSIVE_TARGETS),all clean install) +all: trunk-all + +clean:: trunk-clean + @set -e; for dir in $(SUBDIRS); do \ + $(MAKE) -C "$$dir" -f "$(abs_srcdir)/$$dir/Makefile" $@; \ + done +ifneq ($(abs_builddir),$(abs_srcdir)) + $(RM) -Rf $(SUBDIRS) +endif + +install: trunk-install + +# Print out CURDIR to check for a recursion issue. +ifeq ($(strip $(SUBDIRS)),) + $(warning CURDIR is: $(CURDIR)) + $(error SUBDIRS empty -- did you want generic_leaf_target instead?) +else +$(RECURSIVE_TARGETS): %: | $(SUBDIRS) + @set -e; for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir -f "$(abs_srcdir)/$$dir/Makefile" $@; \ + done +endif + +# vim: syntax=make diff --git a/fsstress/include/mk/generic_trunk_target.mk b/fsstress/include/mk/generic_trunk_target.mk new file mode 100644 index 0000000000..576b32db39 --- /dev/null +++ b/fsstress/include/mk/generic_trunk_target.mk @@ -0,0 +1,24 @@ +# +# Generic trunk include Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# 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. +# +# Ngie Cooper, July 2009 +# + +include $(top_srcdir)/include/mk/env_post.mk +include $(top_srcdir)/include/mk/generic_trunk_target.inc diff --git a/fsstress/include/mk/gitignore.mk b/fsstress/include/mk/gitignore.mk new file mode 100644 index 0000000000..475206dcd2 --- /dev/null +++ b/fsstress/include/mk/gitignore.mk @@ -0,0 +1,51 @@ +# +# gitignore generation include Makefile. +# +# Copyright (C) 2011, Linux Test Project. +# +# 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. +# +# Ngie Cooper, January 2011 +# + +CLEAN_TARGETS+= gitignore_clean + +BEFORE:= .gitignore-before + +AFTER:= .gitignore-after + +IGNORE_DIR_EXPR:= egrep -v "^$$(echo "$(AUTOCONFED_SUBDIRS)" | tr " " "|")" + +# NOTE: The underscore is used in place of a dash to avoid implicit rule +# evaluation in top-level Makefile. +.PHONY: gitignore_clean +gitignore_clean: + $(RM) -f $(BEFORE) $(AFTER) + +$(BEFORE): + $(MAKE) distclean + $(MAKE) ac-maintainer-clean + find . | $(IGNORE_DIR_EXPR) > $@ + +$(AFTER): + $(MAKE) autotools + ./configure --prefix=/dev/null + $(MAKE) all + find . | $(IGNORE_DIR_EXPR) > $@ + # Set everything in autoconf land back to a sane state. + $(MAKE) distclean + +.gitignore: | $(BEFORE) $(AFTER) + diff -u $(BEFORE) $(AFTER) | grep '^+' | sed -e 's,^\+,,g' > $@ diff --git a/fsstress/include/mk/lib.mk b/fsstress/include/mk/lib.mk new file mode 100644 index 0000000000..36e1ba17b1 --- /dev/null +++ b/fsstress/include/mk/lib.mk @@ -0,0 +1,73 @@ +# +# library include Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# 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. +# +# Ngie Cooper, July 2009 +# +# Copyright (C) Cyril Hrubis 2012 +# + +# Makefile to include for libraries. + +include $(top_srcdir)/include/mk/env_pre.mk + +INSTALL_DIR := $(libdir) + +# An extension of generic_leaf_target, strictly for libraries. +.PHONY: install_headers + +ifndef LIB +ifndef INTERNAL_LIB +$(error You must define LIB or INTERNAL_LIB when including this Makefile) +endif +endif + +install_headers: $(addprefix $(DESTDIR)/$(includedir)/,$(notdir $(HEADER_FILES))) + +INSTALL_MODE ?= 00664 + +# Hide the LIB target for internal libs on install +ifneq ($(MAKECMDGOALS),install) +LIB ?= $(INTERNAL_LIB) +endif + +MAKE_TARGETS += $(LIB) + +LIBSRCS ?= $(wildcard $(abs_srcdir)/*.c) + +ifdef MAKE_3_80_COMPAT +LIBSRCS := $(call MAKE_3_80_abspath,$(LIBSRCS)) +else +LIBSRCS := $(abspath $(LIBSRCS)) +endif + +LIBSRCS := $(subst $(abs_srcdir)/,,$(wildcard $(LIBSRCS))) + +LIBSRCS := $(filter-out $(FILTER_OUT_LIBSRCS),$(LIBSRCS)) + +LIBOBJS := $(LIBSRCS:.c=.o) + +$(LIB): $(notdir $(LIBOBJS)) + if [ -z "$(strip $^)" ] ; then \ + echo "Cowardly refusing to create empty archive"; \ + exit 1; \ + fi + $(if $(AR),$(AR),ar) -rc "$@" $^ + $(if $(RANLIB),$(RANLIB),ranlib) "$@" + +include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/fsstress/include/mk/man.mk b/fsstress/include/mk/man.mk new file mode 100644 index 0000000000..c94af61b11 --- /dev/null +++ b/fsstress/include/mk/man.mk @@ -0,0 +1,37 @@ +# +# Manpage include Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# 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. +# +# Ngie Cooper, July 2009 +# + +ifeq ($(strip $(MANPREFIX)),) +$(error $$(MANPREFIX) not defined) +endif + +include $(top_srcdir)/include/mk/env_pre.mk + +INSTALL_DIR := $(mandir)/man$(MANPREFIX) + +INSTALL_MODE := 00644 + +INSTALL_TARGETS ?= *.$(MANPREFIX) + +MAKE_TARGETS := + +include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/fsstress/include/mk/module.mk b/fsstress/include/mk/module.mk new file mode 100644 index 0000000000..07d8fa89ef --- /dev/null +++ b/fsstress/include/mk/module.mk @@ -0,0 +1,62 @@ +# Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved. +# +# 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 would 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 the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# Author: Alexey Kodanev +# +# Include it to build kernel modules. +# REQ_VERSION_MAJOR and REQ_VERSION_PATCH must be defined beforehand. +# + +$(if $(REQ_VERSION_MAJOR),,$(error You must define REQ_VERSION_MAJOR)) +$(if $(REQ_VERSION_PATCH),,$(error You must define REQ_VERSION_MINOR)) + +ifeq ($(WITH_MODULES),no) +SKIP := 1 +else +ifeq ($(LINUX_VERSION_MAJOR)$(LINUX_VERSION_PATCH),) +SKIP := 1 +else +SKIP ?= $(shell \ + [ "$(LINUX_VERSION_MAJOR)" -gt "$(REQ_VERSION_MAJOR)" ] || \ + [ "$(LINUX_VERSION_MAJOR)" -eq "$(REQ_VERSION_MAJOR)" -a \ + "$(LINUX_VERSION_PATCH)" -ge "$(REQ_VERSION_PATCH)" ]; echo $$?) +endif +endif + +ifneq ($(SKIP),0) +MAKE_TARGETS := $(filter-out %.ko, $(MAKE_TARGETS)) +endif + +ifneq ($(filter install clean,$(MAKECMDGOALS)),) +MAKE_TARGETS := $(filter-out %.ko, $(MAKE_TARGETS)) +MAKE_TARGETS += $(wildcard *.ko) +endif + +CLEAN_TARGETS += .dep_modules + +MODULE_SOURCES := $(patsubst %.ko,%.c,$(filter %.ko, $(MAKE_TARGETS))) + +# Ignoring the exit status of commands is done to be forward compatible with +# kernel internal API changes. The user-space test will return TCONF, if it +# doesn't find the module (i.e. it wasn't built either due to kernel-devel +# missing or module build failure). +%.ko: %.c .dep_modules ; + +.dep_modules: $(MODULE_SOURCES) + @echo "Building modules: $(MODULE_SOURCES)" + -$(MAKE) -C $(LINUX_DIR) M=$(abs_srcdir) + rm -rf *.mod.c *.o *.ko.unsigned modules.order .tmp* .*.ko .*.cmd Module.symvers + @touch .dep_modules diff --git a/fsstress/include/mk/testcases.mk b/fsstress/include/mk/testcases.mk new file mode 100644 index 0000000000..bb22be82eb --- /dev/null +++ b/fsstress/include/mk/testcases.mk @@ -0,0 +1,63 @@ +# +# testcases include Makefile. +# +# Copyright (C) 2009, Cisco Systems Inc. +# +# 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. +# +# Ngie Cooper, July 2009 +# + +include $(top_srcdir)/include/mk/env_pre.mk +include $(top_srcdir)/include/mk/functions.mk + +APICMDS_DIR := $(abs_top_builddir)/tools/apicmds + +LIBLTP_DIR := $(abs_top_builddir)/lib + +LIBLTP := $(LIBLTP_DIR)/libltp.a + +$(APICMDS_DIR)/tst_kvercmp: $(APICMDS_DIR) + $(MAKE) -C "$^" -f "$(abs_top_srcdir)/tools/apicmds/Makefile" all + +$(LIBLTP): $(LIBLTP_DIR) + $(MAKE) -C "$^" -f "$(abs_top_srcdir)/lib/Makefile" all + +MAKE_DEPS := $(LIBLTP) + +INSTALL_DIR := testcases/bin + +LDLIBS += -lltp + +ifdef LTPLIBS + +LTPLIBS_DIRS = $(addprefix $(abs_top_builddir)/libs/lib, $(LTPLIBS)) +LTPLIBS_FILES = $(addsuffix .a, $(addprefix $(abs_top_builddir)/libs/, $(foreach LIB,$(LTPLIBS),lib$(LIB)/lib$(LIB)))) + +MAKE_DEPS += $(LTPLIBS_FILES) + +.PHONY: $(LTPLIBS_FILES) + +$(LTPLIBS_FILES): $(LTPLIBS_DIRS) + +$(LTPLIBS_FILES): %: + $(MAKE) -C "$(dir $@)" -f "$(subst $(abs_top_builddir),$(abs_top_srcdir),$(dir $@))/Makefile" all + +LDFLAGS += $(addprefix -L$(top_builddir)/libs/lib, $(LTPLIBS)) + +endif + +$(LTPLIBS_DIRS) $(APICMDS_DIR) $(LIBLTP_DIR): %: + mkdir -p "$@" diff --git a/fsstress/include/old/cleanup.c b/fsstress/include/old/cleanup.c new file mode 100644 index 0000000000..040dff8523 --- /dev/null +++ b/fsstress/include/old/cleanup.c @@ -0,0 +1,47 @@ +/* + * Default cleanup logic because linux_syscall_numbers.h's need for cleanup + * and binutils bugs suck. + * + * Copyright (c) 2009 Cisco Systems, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#ifndef __CLEANUP_C__ +#define __CLEANUP_C__ + +/* Did the user define a cleanup function? */ +#ifndef CLEANUP +#define USING_DUMMY_CLEANUP 1 +#define CLEANUP dummy_cleanup +#endif + +/* A freebie for defining the function prototype. */ +static void CLEANUP(void) __attribute__ ((unused)); + +#ifdef USING_DUMMY_CLEANUP +/* The stub function. Wewt.. */ +static void dummy_cleanup(void) +{ +} +#endif + +#endif diff --git a/fsstress/include/old/ltp_cpuid.h b/fsstress/include/old/ltp_cpuid.h new file mode 100644 index 0000000000..6bd553708b --- /dev/null +++ b/fsstress/include/old/ltp_cpuid.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2012-2013 The Chromium OS Authors. All rights reserved. + * + * Licensed under the BSD 3-clause. + */ + +#ifndef __LTP_CPUID_H__ +#define __LTP_CPUID_H__ + +static inline void cpuid(unsigned int info, unsigned int *eax, unsigned int *ebx, + unsigned int *ecx, unsigned int *edx) +{ +#if defined(__i386__) || defined(__x86_64__) + unsigned int _eax = info, _ebx, _ecx, _edx; + asm volatile( +# ifdef __i386__ + "xchg %%ebx, %%esi;" /* save ebx (for PIC) */ + "cpuid;" + "xchg %%esi, %%ebx;" /* restore ebx & pass to caller */ + : "=S" (_ebx), +# else + "cpuid;" + : "=b" (_ebx), +# endif + "+a" (_eax), "=c" (_ecx), "=d" (_edx) + : /* inputs: eax is handled above */ + ); + if (eax) *eax = _eax; + if (ebx) *ebx = _ebx; + if (ecx) *ecx = _ecx; + if (edx) *edx = _edx; +#endif +} + +#endif diff --git a/fsstress/include/old/ltp_priv.h b/fsstress/include/old/ltp_priv.h new file mode 100644 index 0000000000..0552457e59 --- /dev/null +++ b/fsstress/include/old/ltp_priv.h @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2013 Cyril Hrubis chrubis@suse.cz + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + */ + +#ifndef __LTP_PRIV_H__ +#define __LTP_PRIV_H__ + +#include + +/* + * This is the default temporary directory used by tst_tmpdir(). + * + * This is used when TMPDIR env variable is not set. + */ +#define TEMPDIR "/tmp" + +/* + * Default filesystem to be used for tests. + */ +#define DEFAULT_FS_TYPE "ext2" + +/* environment variables for controlling tst_res verbosity */ +#define TOUT_VERBOSE_S "VERBOSE" /* All test cases reported */ +#define TOUT_NOPASS_S "NOPASS" /* No pass test cases are reported */ +#define TOUT_DISCARD_S "DISCARD" /* No output is reported */ + +#define USC_ITERATION_ENV "USC_ITERATIONS" +#define USC_LOOP_WALLTIME "USC_LOOP_WALLTIME" +#define USC_NO_FUNC_CHECK "USC_NO_FUNC_CHECK" +#define USC_LOOP_DELAY "USC_LOOP_DELAY" + +const char *parse_opts(int ac, char **av, const option_t *user_optarr, void + (*uhf)(void)); + +/* Interface for rerouting to new lib calls from tst_res.c */ +extern void *tst_test; + +void tst_vbrk_(const char *file, const int lineno, int ttype, + const char *fmt, va_list va) __attribute__((noreturn)); + +void tst_brk_(const char *file, const int lineno, int ttype, + const char *msg, ...); + +void tst_vres_(const char *file, const int lineno, int ttype, + const char *fmt, va_list va); + +void tst_res_(const char *file, const int lineno, int ttype, + const char *msg, ...); + + +#define NO_NEWLIB_ASSERT(file, lineno) \ + if (tst_test) { \ + tst_brk_(file, lineno, TBROK, \ + "%s() executed from newlib!", __FUNCTION__); \ + } + +#endif /* __LTP_PRIV_H__ */ diff --git a/fsstress/include/old/ltp_signal.h b/fsstress/include/old/ltp_signal.h new file mode 100644 index 0000000000..02ee8349a8 --- /dev/null +++ b/fsstress/include/old/ltp_signal.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2009 Cisco Systems, Inc. All Rights Reserved. + * Copyright (c) 2009 FUJITSU LIMITED. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Author: Liu Bo + * Author: Ngie Cooper + * + */ + +#ifndef __LTP_SIGNAL_H +#define __LTP_SIGNAL_H + +#include +#include +#include +#include "config.h" + +/* + * For all but __mips__: + * + * _COMPAT_NSIG / _COMPAT_NSIG_BPW == 2. + * + * For __mips__: + * + * _COMPAT_NSIG / _COMPAT_NSIG_BPW == 4. + * + * See asm/compat.h under the kernel source for more details. + * + * Multiply that by a fudge factor of 4 and you have your SIGSETSIZE. + */ +#if defined __mips__ +#define SIGSETSIZE 16 +#else +#define SIGSETSIZE (_NSIG / 8) +#endif + +#endif diff --git a/fsstress/include/old/old_checkpoint.h b/fsstress/include/old/old_checkpoint.h new file mode 100644 index 0000000000..c8ffc92da7 --- /dev/null +++ b/fsstress/include/old/old_checkpoint.h @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2015-2016 Cyril Hrubis + * + * 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, see . + */ + + /* + + Checkpoint - easy to use parent-child synchronization. + + Checkpoint is based on futexes (man futex). The library allocates a page of + shared memory for futexes and the id is an offset to it which gives the user + up to page_size/sizeof(uint32_t) checkpoint pairs. Up to INT_MAX processes + can sleep on single id and can be woken up by single wake. + + */ + +#ifndef OLD_CHECKPOINT__ +#define OLD_CHECKPOINT__ + +#include "test.h" +#include "tst_checkpoint_fn.h" + +/* + * Checkpoint initializaton, must be done first. + * + * NOTE: tst_tmpdir() must be called beforehand. + */ +#define TST_CHECKPOINT_INIT(cleanup_fn) \ + tst_checkpoint_init(__FILE__, __LINE__, cleanup_fn) + +#define TST_SAFE_CHECKPOINT_WAIT(cleanup_fn, id) \ + tst_safe_checkpoint_wait(__FILE__, __LINE__, cleanup_fn, id, 0); + +#define TST_SAFE_CHECKPOINT_WAIT2(cleanup_fn, id, msec_timeout) \ + tst_safe_checkpoint_wait(__FILE__, __LINE__, cleanup_fn, id, msec_timeout); + +#define TST_SAFE_CHECKPOINT_WAKE(cleanup_fn, id) \ + tst_safe_checkpoint_wake(__FILE__, __LINE__, cleanup_fn, id, 1); + +#define TST_SAFE_CHECKPOINT_WAKE2(cleanup_fn, id, nr_wake) \ + tst_safe_checkpoint_wake(__FILE__, __LINE__, cleanup_fn, id, nr_wake); + +#define TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(cleanup_fn, id) \ + tst_safe_checkpoint_wake(__FILE__, __LINE__, cleanup_fn, id, 1); \ + tst_safe_checkpoint_wait(__FILE__, __LINE__, cleanup_fn, id, 0); + +#endif /* OLD_CHECKPOINT__ */ diff --git a/fsstress/include/old/old_device.h b/fsstress/include/old/old_device.h new file mode 100644 index 0000000000..a6e9fea860 --- /dev/null +++ b/fsstress/include/old/old_device.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2014-2016 Cyril Hrubis + * + * 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, see . + */ + +#ifndef OLD_DEVICE_H__ +#define OLD_DEVICE_H__ + +/* + * Returns filesystem type to be used for the testing. Unless your test is + * designed for specific filesystem you should use this function to the tested + * filesystem. + * + * If TST_DEV_FS_TYPE is set the function returns it's content, + * otherwise default fs type hardcoded in the library is returned. + */ +const char *tst_dev_fs_type(void); + +/* + * Acquires test device. + * + * Can be used only once, i.e. you cannot get two different devices. + * + * Looks for LTP_DEV env variable first (which may be passed by the test + * driver or by a user) and returns just it's value if found. + * + * Otherwise creates a temp file and loop device. + * + * Note that you have to call tst_tmpdir() beforehand. + * + * Returns path to the device or NULL if it cannot be created. + * Call tst_release_device() when you're done. + */ +const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size); + +const char *tst_acquire_device__(unsigned int size); + +static inline const char *tst_acquire_device(void (cleanup_fn)(void)) +{ + return tst_acquire_device_(cleanup_fn, 0); +} + +/* + * Acquire a loop device with specified temp filename. This function allows + * you to acquire multiple devices at the same time. LTP_DEV is ignored. + * If you call this function directly, use tst_detach_device() to release + * the devices. tst_release_device() will not work correctly. + * + * The return value points to a static buffer and additional calls of + * tst_acquire_loop_device() or tst_acquire_device() will overwrite it. + */ +const char *tst_acquire_loop_device(unsigned int size, const char *filename); + +/* + * @dev: device path returned by the tst_acquire_device() + */ +int tst_release_device(const char *dev); + +/* + * Cleanup function for tst_acquire_loop_device(). If you have acquired + * a device using tst_acquire_device(), use tst_release_device() instead. + * @dev: device path returned by the tst_acquire_loop_device() + */ +int tst_detach_device(const char *dev); + +/* + * Just like umount() but retries several times on failure. + * @path: Path to umount + */ +int tst_umount(const char *path); + +#endif /* OLD_DEVICE_H__ */ diff --git a/fsstress/include/old/old_module.h b/fsstress/include/old/old_module.h new file mode 100644 index 0000000000..c50efec762 --- /dev/null +++ b/fsstress/include/old/old_module.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved. + * + * 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 would 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 the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Alexey Kodanev + * + * These functions help to load and unload kernel modules in the tests. + * + * tst_module_load function already includes tst_module_exists function, + * which is checking the following possible module's locations: + * + * 1. Current working directory + * + * 2. LTP installation path (using env LTPROOT, which is usually /opt/ltp) + * + * 3. If tmp directory created, it'll look at the test start working directory + * + */ + +#ifndef TST_MODULE +#define TST_MODULE + +/* + * Check module existence. + * + * @mod_name: module's file name. + * @mod_path: if it is not NULL, then tst_module_exists places the found + * module's path into the location pointed to by *mod_path. It must be freed + * with free() when it is no longer needed. + * + * In case of failure, test'll call cleanup_fn and exit with TCONF return value. + */ +void tst_module_exist(void (cleanup_fn)(void), const char *mod_name, + char **mod_path); + +/* + * Load a module using insmod program. + * + * @mod_name: module's file name. + * @argv: an array of pointers to null-terminated strings that represent the + * additional parameters to the module. The array of pointers must be + * terminated by a NULL pointer. If argv points to NULL, it will be ignored. + * + * In case of insmod failure, test will call cleanup_fn and exit with TBROK + * return value. + */ +void tst_module_load(void (cleanup_fn)(void), + const char *mod_name, char *const argv[]); + +/* + * Unload a module using rmmod program. In case of failure, test will call + * cleanup_fn and exit with TBROK return value. + * + * @mod_name: can be module name or module's file name. + */ +void tst_module_unload(void (cleanup_fn)(void), const char *mod_name); + +#endif /* TST_MODULE */ diff --git a/fsstress/include/old/old_resource.h b/fsstress/include/old/old_resource.h new file mode 100644 index 0000000000..46767f35c4 --- /dev/null +++ b/fsstress/include/old/old_resource.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2012 Cyril Hrubis chrubis@suse.cz + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + + /* + + Small helper for preparing files the test needs to copy before the testing. + + We need to support two scenarios. + + 1. Test is executed in local directory and this is also the place + we should look for files + + + 2. Test is executed after LTP has been installed, in this case we + look for env LTPROOT (usually /opt/ltp/) + + */ + +#ifndef TST_RESOURCE +#define TST_RESOURCE + +const char *tst_dataroot(void); + +/* + * Copy a file to the CWD. The destination is apended to CWD. + */ +#define TST_RESOURCE_COPY(cleanup_fn, filename, dest) \ + tst_resource_copy(__FILE__, __LINE__, (cleanup_fn), \ + (filename), (dest)) + +void tst_resource_copy(const char *file, const int lineno, + void (*cleanup_fn)(void), + const char *filename, const char *dest); + +#endif /* TST_RESOURCE */ diff --git a/fsstress/include/old/old_safe_file_ops.h b/fsstress/include/old/old_safe_file_ops.h new file mode 100644 index 0000000000..d6e2d29a96 --- /dev/null +++ b/fsstress/include/old/old_safe_file_ops.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2012-2016 Cyril Hrubis + * + * 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, see . + */ + + /* + + This code helps with file reading/writing files providing scanf/printf like + interface that opens and closes the file automatically. + + This kind of interface is especially useful for reading/writing values + from/to pseudo filesystems like procfs or sysfs. + + */ + +#ifndef SAFE_FILE_OPS +#define SAFE_FILE_OPS + +#include "safe_file_ops_fn.h" + +#define FILE_SCANF(path, fmt, ...) \ + file_scanf(__FILE__, __LINE__, \ + (path), (fmt), ## __VA_ARGS__) + +#define SAFE_FILE_SCANF(cleanup_fn, path, fmt, ...) \ + safe_file_scanf(__FILE__, __LINE__, (cleanup_fn), \ + (path), (fmt), ## __VA_ARGS__) + +#define FILE_LINES_SCANF(cleanup_fn, path, fmt, ...) \ + file_lines_scanf(__FILE__, __LINE__, (cleanup_fn), 0, \ + (path), (fmt), ## __VA_ARGS__) + +#define SAFE_FILE_LINES_SCANF(cleanup_fn, path, fmt, ...) \ + file_lines_scanf(__FILE__, __LINE__, (cleanup_fn), 1, \ + (path), (fmt), ## __VA_ARGS__) + +#define FILE_PRINTF(path, fmt, ...) \ + file_printf(__FILE__, __LINE__, \ + (path), (fmt), ## __VA_ARGS__) + +#define SAFE_FILE_PRINTF(cleanup_fn, path, fmt, ...) \ + safe_file_printf(__FILE__, __LINE__, (cleanup_fn), \ + (path), (fmt), ## __VA_ARGS__) + +#define SAFE_CP(cleanup_fn, src, dst) \ + safe_cp(__FILE__, __LINE__, (cleanup_fn), (src), (dst)) + +#define SAFE_TOUCH(cleanup_fn, pathname, mode, times) \ + safe_touch(__FILE__, __LINE__, (cleanup_fn), \ + (pathname), (mode), (times)) + +#endif /* SAFE_FILE_OPS */ diff --git a/fsstress/include/old/old_safe_net.h b/fsstress/include/old/old_safe_net.h new file mode 100644 index 0000000000..639094a948 --- /dev/null +++ b/fsstress/include/old/old_safe_net.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2015 Fujitsu Ltd. + * Copyright (c) 2016 Cyril Hrubis + * + * 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, see . + */ + +#ifndef OLD_SAFE_NET_H__ +#define OLD_SAFE_NET_H__ + +#include +#include +#include +#include +#include + +#include "safe_net_fn.h" + +#define SAFE_SOCKET(cleanup_fn, domain, type, protocol) \ + safe_socket(__FILE__, __LINE__, (cleanup_fn), domain, type, protocol) + +#define SAFE_BIND(cleanup_fn, socket, address, address_len) \ + safe_bind(__FILE__, __LINE__, (cleanup_fn), socket, address, \ + address_len) + +#define SAFE_LISTEN(cleanup_fn, socket, backlog) \ + safe_listen(__FILE__, __LINE__, (cleanup_fn), socket, backlog) + +#define SAFE_CONNECT(cleanup_fn, sockfd, addr, addrlen) \ + safe_connect(__FILE__, __LINE__, (cleanup_fn), sockfd, addr, addrlen) + +#define SAFE_GETSOCKNAME(cleanup_fn, sockfd, addr, addrlen) \ + safe_getsockname(__FILE__, __LINE__, (cleanup_fn), sockfd, addr, \ + addrlen) + +#define TST_GET_UNUSED_PORT(cleanup_fn, family, type) \ + tst_get_unused_port(__FILE__, __LINE__, (cleanup_fn), family, type) + +#endif /* OLD_SAFE_NET_H__ */ diff --git a/fsstress/include/old/old_safe_stdio.h b/fsstress/include/old/old_safe_stdio.h new file mode 100644 index 0000000000..3508b2479d --- /dev/null +++ b/fsstress/include/old/old_safe_stdio.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013-2016 Cyril Hrubis + * + * 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, see . + */ + +#ifndef OLD_SAFE_STDIO_H__ +#define OLD_SAFE_STDIO_H__ + +#include + +#include "safe_stdio_fn.h" + +#define SAFE_FOPEN(cleanup_fn, path, mode) \ + safe_fopen(__FILE__, __LINE__, cleanup_fn, path, mode) + +#define SAFE_FCLOSE(cleanup_fn, f) \ + safe_fclose(__FILE__, __LINE__, cleanup_fn, f) + +#define SAFE_ASPRINTF(cleanup_fn, strp, fmt, ...) \ + safe_asprintf(__FILE__, __LINE__, cleanup_fn, strp, fmt, __VA_ARGS__) + +#define SAFE_POPEN(cleanup_fn, command, type) \ + safe_popen(__FILE__, __LINE__, cleanup_fn, command, type) + +#endif /* OLD_SAFE_STDIO_H__ */ diff --git a/fsstress/include/old/old_tmpdir.h b/fsstress/include/old/old_tmpdir.h new file mode 100644 index 0000000000..9c61172fd7 --- /dev/null +++ b/fsstress/include/old/old_tmpdir.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2016 Cyril Hrubis + * + * 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, see . + */ + +#ifndef OLD_TMPDIR_H__ +#define OLD_TMPDIR_H__ + +/* + * Create a unique temporary directory and chdir() to it. It expects the caller + * to have defined/initialized the TCID/TST_TOTAL global variables. + * The TESTDIR global variable will be set to the directory that gets used + * as the testing directory. + * + * NOTE: This function must be called BEFORE any activity that would require + * CLEANUP. If tst_tmpdir() fails, it cleans up afer itself and calls + * tst_exit() (i.e. does not return). + */ +void tst_tmpdir(void); + +/* + * Recursively remove the temporary directory created by tst_tmpdir(). + * This function is intended ONLY as a companion to tst_tmpdir(). + */ +void tst_rmdir(void); + +/* tst_get_tmpdir() + * + * Return a copy of the test temp directory as seen by LTP. This is for + * path-oriented tests like chroot, etc, that may munge the path a bit. + * + * FREE VARIABLE AFTER USE IF IT IS REUSED! + */ +char *tst_get_tmpdir(void); + +/* + * Returns 1 if temp directory was created. + */ +int tst_tmpdir_created(void); + +/* declared in tst_tmpdir.c */ +const char *tst_get_startwd(void); + +#endif /* OLD_TMPDIR_H__ */ diff --git a/fsstress/include/old/random_range.h b/fsstress/include/old/random_range.h new file mode 100644 index 0000000000..22b3f93231 --- /dev/null +++ b/fsstress/include/old/random_range.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ + */ +#ifndef _RANDOM_RANGE_H_ +#define _RANDOM_RANGE_H_ + +int parse_ranges ( char *, int, int, int, int (*)(), char **, char ** ); +int range_min ( char *, int ); +int range_max ( char *, int ); +int range_mult ( char *, int ); +long random_range ( int, int, int, char ** ); +long random_rangel ( long, long, long, char ** ); +long long random_rangell ( long long, long long, long long, char ** ); +void random_range_seed( long ); +long random_bit ( long ); + +#endif diff --git a/fsstress/include/old/safe_macros.h b/fsstress/include/old/safe_macros.h new file mode 100644 index 0000000000..e778d3077e --- /dev/null +++ b/fsstress/include/old/safe_macros.h @@ -0,0 +1,340 @@ +/* + * Safe macros for commonly used syscalls to reduce code duplication in LTP + * testcases, and to ensure all errors are caught in said testcases as + * gracefully as possible. + * + * Also satiates some versions of gcc/glibc when the warn_unused_result + * attribute is applied to the function call. + * + * Licensed under the GPLv2. + */ + +#ifndef __TEST_H__ +#error "you must include test.h before this file" +#else + +#ifndef __SAFE_MACROS_H__ +#define __SAFE_MACROS_H__ + +#include "safe_macros_fn.h" +#include "old_safe_stdio.h" +#include "old_safe_net.h" + +#define SAFE_BASENAME(cleanup_fn, path) \ + safe_basename(__FILE__, __LINE__, (cleanup_fn), (path)) + +#define SAFE_CHDIR(cleanup_fn, path) \ + safe_chdir(__FILE__, __LINE__, (cleanup_fn), (path)) + +#define SAFE_CLOSE(cleanup_fn, fd) ({ \ + int ret = safe_close(__FILE__, __LINE__, (cleanup_fn), (fd)); \ + fd = -1; \ + ret; \ + }) + +#define SAFE_CREAT(cleanup_fn, pathname, mode) \ + safe_creat(__FILE__, __LINE__, cleanup_fn, (pathname), (mode)) + +#define SAFE_DIRNAME(cleanup_fn, path) \ + safe_dirname(__FILE__, __LINE__, (cleanup_fn), (path)) + +#define SAFE_GETCWD(cleanup_fn, buf, size) \ + safe_getcwd(__FILE__, __LINE__, (cleanup_fn), (buf), (size)) + +#define SAFE_GETPWNAM(cleanup_fn, name) \ + safe_getpwnam(__FILE__, __LINE__, cleanup_fn, (name)) + +#define SAFE_GETRUSAGE(cleanup_fn, who, usage) \ + safe_getrusage(__FILE__, __LINE__, (cleanup_fn), (who), (usage)) + +#define SAFE_MALLOC(cleanup_fn, size) \ + safe_malloc(__FILE__, __LINE__, (cleanup_fn), (size)) + +#define SAFE_MKDIR(cleanup_fn, pathname, mode) \ + safe_mkdir(__FILE__, __LINE__, (cleanup_fn), (pathname), (mode)) + +#define SAFE_RMDIR(cleanup_fn, pathname) \ + safe_rmdir(__FILE__, __LINE__, (cleanup_fn), (pathname)) + +#define SAFE_MUNMAP(cleanup_fn, addr, length) \ + safe_munmap(__FILE__, __LINE__, (cleanup_fn), (addr), (length)) + +#define SAFE_OPEN(cleanup_fn, pathname, oflags, ...) \ + safe_open(__FILE__, __LINE__, (cleanup_fn), (pathname), (oflags), \ + ##__VA_ARGS__) + +#define SAFE_PIPE(cleanup_fn, fildes) \ + safe_pipe(__FILE__, __LINE__, cleanup_fn, (fildes)) + +#define SAFE_READ(cleanup_fn, len_strict, fildes, buf, nbyte) \ + safe_read(__FILE__, __LINE__, cleanup_fn, (len_strict), (fildes), \ + (buf), (nbyte)) + +#define SAFE_SETEGID(cleanup_fn, egid) \ + safe_setegid(__FILE__, __LINE__, cleanup_fn, (egid)) + +#define SAFE_SETEUID(cleanup_fn, euid) \ + safe_seteuid(__FILE__, __LINE__, cleanup_fn, (euid)) + +#define SAFE_SETGID(cleanup_fn, gid) \ + safe_setgid(__FILE__, __LINE__, cleanup_fn, (gid)) + +#define SAFE_SETUID(cleanup_fn, uid) \ + safe_setuid(__FILE__, __LINE__, cleanup_fn, (uid)) + +#define SAFE_GETRESUID(cleanup_fn, ruid, euid, suid) \ + safe_getresuid(__FILE__, __LINE__, cleanup_fn, (ruid), (euid), (suid)) + +#define SAFE_GETRESGID(cleanup_fn, rgid, egid, sgid) \ + safe_getresgid(__FILE__, __LINE__, cleanup_fn, (rgid), (egid), (sgid)) + +#define SAFE_UNLINK(cleanup_fn, pathname) \ + safe_unlink(__FILE__, __LINE__, cleanup_fn, (pathname)) + +#define SAFE_LINK(cleanup_fn, oldpath, newpath) \ + safe_link(__FILE__, __LINE__, cleanup_fn, (oldpath), (newpath)) + +#define SAFE_LINKAT(cleanup_fn, olddirfd, oldpath, newdirfd, newpath, flags) \ + safe_linkat(__FILE__, __LINE__, cleanup_fn, (olddirfd), (oldpath), \ + (newdirfd), (newpath), (flags)) + +#define SAFE_READLINK(cleanup_fn, path, buf, bufsize) \ + safe_readlink(__FILE__, __LINE__, cleanup_fn, (path), (buf), (bufsize)) + +#define SAFE_SYMLINK(cleanup_fn, oldpath, newpath) \ + safe_symlink(__FILE__, __LINE__, cleanup_fn, (oldpath), (newpath)) + +#define SAFE_WRITE(cleanup_fn, len_strict, fildes, buf, nbyte) \ + safe_write(__FILE__, __LINE__, cleanup_fn, (len_strict), (fildes), \ + (buf), (nbyte)) + +#define SAFE_STRTOL(cleanup_fn, str, min, max) \ + safe_strtol(__FILE__, __LINE__, cleanup_fn, (str), (min), (max)) + +#define SAFE_STRTOUL(cleanup_fn, str, min, max) \ + safe_strtoul(__FILE__, __LINE__, cleanup_fn, (str), (min), (max)) + +#define SAFE_SYSCONF(cleanup_fn, name) \ + safe_sysconf(__FILE__, __LINE__, cleanup_fn, name) + +#define SAFE_CHMOD(cleanup_fn, path, mode) \ + safe_chmod(__FILE__, __LINE__, (cleanup_fn), (path), (mode)) + +#define SAFE_FCHMOD(cleanup_fn, fd, mode) \ + safe_fchmod(__FILE__, __LINE__, (cleanup_fn), (fd), (mode)) + +#define SAFE_CHOWN(cleanup_fn, path, owner, group) \ + safe_chown(__FILE__, __LINE__, (cleanup_fn), (path), (owner), (group)) + +#define SAFE_FCHOWN(cleanup_fn, fd, owner, group) \ + safe_fchown(__FILE__, __LINE__, (cleanup_fn), (fd), (owner), (group)) + +#define SAFE_WAIT(cleanup_fn, status) \ + safe_wait(__FILE__, __LINE__, (cleanup_fn), (status)) + +#define SAFE_WAITPID(cleanup_fn, pid, status, opts) \ + safe_waitpid(__FILE__, __LINE__, (cleanup_fn), (pid), (status), (opts)) + +#define SAFE_KILL(cleanup_fn, pid, sig) \ + safe_kill(__FILE__, __LINE__, (cleanup_fn), (pid), (sig)) + +#define SAFE_MEMALIGN(cleanup_fn, alignment, size) \ + safe_memalign(__FILE__, __LINE__, (cleanup_fn), (alignment), (size)) + +#define SAFE_MKFIFO(cleanup_fn, pathname, mode) \ + safe_mkfifo(__FILE__, __LINE__, (cleanup_fn), (pathname), (mode)) + +#define SAFE_RENAME(cleanup_fn, oldpath, newpath) \ + safe_rename(__FILE__, __LINE__, (cleanup_fn), (oldpath), (newpath)) + +#define SAFE_MOUNT(cleanup_fn, source, target, filesystemtype, \ + mountflags, data) \ + safe_mount(__FILE__, __LINE__, (cleanup_fn), (source), (target), \ + (filesystemtype), (mountflags), (data)) + +#define SAFE_UMOUNT(cleanup_fn, target) \ + safe_umount(__FILE__, __LINE__, (cleanup_fn), (target)) + +/* + * following functions are inline because the behaviour may depend on + * -D_FILE_OFFSET_BITS=64 -DOFF_T=__off64_t compile flags + */ + +static inline void *safe_mmap(const char *file, const int lineno, + void (*cleanup_fn)(void), void *addr, size_t length, + int prot, int flags, int fd, off_t offset) +{ + void *rval; + + rval = mmap(addr, length, prot, flags, fd, offset); + if (rval == MAP_FAILED) { + tst_brkm(TBROK | TERRNO, cleanup_fn, + "%s:%d: mmap(%p,%zu,%d,%d,%d,%ld) failed", + file, lineno, addr, length, prot, flags, fd, + (long) offset); + } + + return rval; +} +#define SAFE_MMAP(cleanup_fn, addr, length, prot, flags, fd, offset) \ + safe_mmap(__FILE__, __LINE__, (cleanup_fn), (addr), (length), (prot), \ + (flags), (fd), (offset)) + +static inline int safe_ftruncate(const char *file, const int lineno, + void (cleanup_fn) (void), int fd, off_t length) +{ + int rval; + + rval = ftruncate(fd, length); + if (rval == -1) { + tst_brkm(TBROK | TERRNO, cleanup_fn, + "%s:%d: ftruncate(%d,%ld) failed", + file, lineno, fd, (long)length); + } + + return rval; +} +#define SAFE_FTRUNCATE(cleanup_fn, fd, length) \ + safe_ftruncate(__FILE__, __LINE__, cleanup_fn, (fd), (length)) + +static inline int safe_truncate(const char *file, const int lineno, + void (cleanup_fn) (void), const char *path, off_t length) +{ + int rval; + + rval = truncate(path, length); + if (rval == -1) { + tst_brkm(TBROK | TERRNO, cleanup_fn, + "%s:%d: truncate(%s,%ld) failed", + file, lineno, path, (long)length); + } + + return rval; +} +#define SAFE_TRUNCATE(cleanup_fn, path, length) \ + safe_truncate(__FILE__, __LINE__, cleanup_fn, (path), (length)) + +static inline int safe_stat(const char *file, const int lineno, + void (cleanup_fn)(void), const char *path, struct stat *buf) +{ + int rval; + + rval = stat(path, buf); + + if (rval == -1) { + tst_brkm(TBROK | TERRNO, cleanup_fn, + "%s:%d: stat(%s,%p) failed", file, lineno, path, buf); + } + + return rval; +} +#define SAFE_STAT(cleanup_fn, path, buf) \ + safe_stat(__FILE__, __LINE__, (cleanup_fn), (path), (buf)) + +static inline int safe_fstat(const char *file, const int lineno, + void (cleanup_fn)(void), int fd, struct stat *buf) +{ + int rval; + + rval = fstat(fd, buf); + + if (rval == -1) { + tst_brkm(TBROK | TERRNO, cleanup_fn, + "%s:%d: fstat(%d,%p) failed", file, lineno, fd, buf); + } + + return rval; +} +#define SAFE_FSTAT(cleanup_fn, fd, buf) \ + safe_fstat(__FILE__, __LINE__, (cleanup_fn), (fd), (buf)) + +static inline int safe_lstat(const char *file, const int lineno, + void (cleanup_fn)(void), const char *path, struct stat *buf) +{ + int rval; + + rval = lstat(path, buf); + + if (rval == -1) { + tst_brkm(TBROK | TERRNO, cleanup_fn, + "%s:%d: lstat(%s,%p) failed", file, lineno, path, buf); + } + + return rval; +} +#define SAFE_LSTAT(cleanup_fn, path, buf) \ + safe_lstat(__FILE__, __LINE__, (cleanup_fn), (path), (buf)) + +static inline off_t safe_lseek(const char *file, const int lineno, + void (cleanup_fn)(void), int fd, off_t offset, int whence) +{ + off_t rval; + + rval = lseek(fd, offset, whence); + + if (rval == (off_t) -1) { + tst_brkm(TBROK | TERRNO, cleanup_fn, + "%s:%d: lseek(%d,%ld,%d) failed", + file, lineno, fd, (long)offset, whence); + } + + return rval; +} +#define SAFE_LSEEK(cleanup_fn, fd, offset, whence) \ + safe_lseek(__FILE__, __LINE__, cleanup_fn, (fd), (offset), (whence)) + +static inline int safe_getrlimit(const char *file, const int lineno, + void (cleanup_fn)(void), int resource, struct rlimit *rlim) +{ + int rval; + + rval = getrlimit(resource, rlim); + + if (rval == -1) { + tst_brkm(TBROK | TERRNO, cleanup_fn, + "%s:%d: getrlimit(%d,%p) failed", + file, lineno, resource, rlim); + } + + return rval; +} +#define SAFE_GETRLIMIT(cleanup_fn, resource, rlim) \ + safe_getrlimit(__FILE__, __LINE__, (cleanup_fn), (resource), (rlim)) + +static inline int safe_setrlimit(const char *file, const int lineno, + void (cleanup_fn)(void), int resource, const struct rlimit *rlim) +{ + int rval; + + rval = setrlimit(resource, rlim); + + if (rval == -1) { + tst_brkm(TBROK | TERRNO, cleanup_fn, + "%s:%d: setrlimit(%d,%p) failed", + file, lineno, resource, rlim); + } + + return rval; +} +#define SAFE_SETRLIMIT(cleanup_fn, resource, rlim) \ + safe_setrlimit(__FILE__, __LINE__, (cleanup_fn), (resource), (rlim)) + +#define SAFE_OPENDIR(cleanup_fn, name) \ + safe_opendir(__FILE__, __LINE__, (cleanup_fn), (name)) + +#define SAFE_CLOSEDIR(cleanup_fn, dirp) \ + safe_closedir(__FILE__, __LINE__, (cleanup_fn), (dirp)) + +#define SAFE_READDIR(cleanup_fn, dirp) \ + safe_readdir(__FILE__, __LINE__, (cleanup_fn), (dirp)) + + +#define SAFE_IOCTL(cleanup_fn, fd, request, ...) \ + ({int ret = ioctl(fd, request, __VA_ARGS__); \ + if (ret < 0) \ + tst_brkm(TBROK | TERRNO, cleanup_fn, \ + "ioctl(%i,%s,...) failed", fd, #request); \ + ret;}) + +#endif /* __SAFE_MACROS_H__ */ +#endif /* __TEST_H__ */ diff --git a/fsstress/include/old/test.h b/fsstress/include/old/test.h new file mode 100644 index 0000000000..604254eea6 --- /dev/null +++ b/fsstress/include/old/test.h @@ -0,0 +1,214 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2009-2013 Cyril Hrubis chrubis@suse.cz + */ + +#ifndef __TEST_H__ +#define __TEST_H__ + +#ifdef TST_TEST_H__ +# error Newlib tst_test.h already included +#endif /* TST_TEST_H__ */ + +#include +#include +#include +#include +#include +#include + +#include "usctest.h" + +#include "tst_common.h" +#include "old_safe_file_ops.h" +#include "old_checkpoint.h" +#include "tst_process_state.h" +#include "old_resource.h" +#include "tst_res_flags.h" +#include "tst_kvercmp.h" +#include "tst_fs.h" +#include "tst_pid.h" +#include "tst_cmd.h" +#include "tst_cpu.h" +#include "tst_clone.h" +#include "old_device.h" +#include "old_tmpdir.h" +#include "tst_minmax.h" +#include "tst_get_bad_addr.h" +#include "tst_path_has_mnt_flags.h" + +/* + * Ensure that NUMSIGS is defined. + * It should be defined in signal.h or sys/signal.h on + * UNICOS/mk and IRIX systems. On UNICOS systems, + * it is not defined, thus it is being set to UNICOS's NSIG. + * Note: IRIX's NSIG (signals are 1-(NSIG-1)) + * is not same meaning as UNICOS/UMK's NSIG (signals 1-NSIG) + */ +#ifndef NUMSIGS +#define NUMSIGS NSIG +#endif + + +/* defines for unexpected signal setup routine (set_usig.c) */ +#define FORK 1 /* SIGCHLD is to be ignored */ +#define NOFORK 0 /* SIGCHLD is to be caught */ +#define DEF_HANDLER SIG_ERR /* tells set_usig() to use default signal handler */ + +/* + * The following defines are used to control tst_res and t_result reporting. + */ + +#define TOUTPUT "TOUTPUT" /* The name of the environment variable */ + /* that can be set to one of the following */ + /* strings to control tst_res output */ + /* If not set, TOUT_VERBOSE_S is assumed */ + +/* + * fork() can't be used on uClinux systems, so use FORK_OR_VFORK instead, + * which will run vfork() on uClinux. + * mmap() doesn't support MAP_PRIVATE on uClinux systems, so use + * MAP_PRIVATE_EXCEPT_UCLINUX instead, which will skip the option on uClinux. + * If MAP_PRIVATE really is required, the test can not be run on uClinux. + */ +#ifdef UCLINUX +# define FORK_OR_VFORK tst_vfork +# define MAP_PRIVATE_EXCEPT_UCLINUX 0 +/* tst_old_flush() + vfork() */ +pid_t tst_vfork(void); +#else +# define FORK_OR_VFORK tst_fork +# define MAP_PRIVATE_EXCEPT_UCLINUX MAP_PRIVATE +#endif + +/* + * Macro to use for making functions called only once in + * multi-threaded tests such as init or cleanup function. + * The first call to @name_fn function by any thread shall + * call the @exec_fn. Subsequent calls shall not call @exec_fn. + * *_fn functions must not take any arguments. + */ +#define TST_DECLARE_ONCE_FN(name_fn, exec_fn) \ + void name_fn(void) \ + { \ + static pthread_once_t ltp_once = PTHREAD_ONCE_INIT; \ + pthread_once(<p_once, exec_fn); \ + } + +/* + * lib/forker.c + */ +extern int Forker_pids[]; +extern int Forker_npids; + +typedef struct { + char *option; /* Valid option string (one option only) like "a:" */ + int *flag; /* Pointer to location to set true if option given */ + char **arg; /* Pointer to location to place argument, if needed */ +} option_t; + +/* lib/tst_parse_opts.c */ +void tst_parse_opts(int argc, char *argv[], const option_t *user_optarg, + void (*user_help)(void)); + +/* lib/tst_res.c */ +const char *strttype(int ttype); + +void tst_resm_(const char *file, const int lineno, int ttype, + const char *arg_fmt, ...) + __attribute__ ((format (printf, 4, 5))); +#define tst_resm(ttype, arg_fmt, ...) \ + tst_resm_(__FILE__, __LINE__, (ttype), \ + (arg_fmt), ##__VA_ARGS__) + +void tst_resm_hexd_(const char *file, const int lineno, int ttype, + const void *buf, size_t size, const char *arg_fmt, ...) + __attribute__ ((format (printf, 6, 7))); +#define tst_resm_hexd(ttype, buf, size, arg_fmt, ...) \ + tst_resm_hexd_(__FILE__, __LINE__, (ttype), (buf), (size), \ + (arg_fmt), ##__VA_ARGS__) + +void tst_brkm_(const char *file, const int lineno, int ttype, + void (*func)(void), const char *arg_fmt, ...) + __attribute__ ((format (printf, 5, 6))) LTP_ATTRIBUTE_NORETURN; + +#ifdef LTPLIB +# include "ltp_priv.h" +# define tst_brkm(flags, cleanup, fmt, ...) do { \ + if (tst_test) \ + tst_brk_(__FILE__, __LINE__, flags, fmt, ##__VA_ARGS__); \ + else \ + tst_brkm_(__FILE__, __LINE__, flags, cleanup, fmt, ##__VA_ARGS__); \ + } while (0) +#else +# define tst_brkm(flags, cleanup, fmt, ...) do { \ + tst_brkm_(__FILE__, __LINE__, flags, cleanup, fmt, ##__VA_ARGS__); \ + } while (0) +#endif + +void tst_require_root(void); +void tst_exit(void) LTP_ATTRIBUTE_NORETURN; +void tst_old_flush(void); + +/* + * tst_old_flush() + fork + * NOTE: tst_fork() will reset T_exitval to 0 for child process. + */ +pid_t tst_fork(void); + +/* lib/tst_res.c */ +/* + * In case we need do real test work in child process parent process can use + * tst_record_childstatus() to make child process's test results propagated to + * parent process correctly. + * + * The child can use tst_resm(), tst_brkm() followed by the tst_exit() or + * plain old exit() (with TPASS, TFAIL and TBROK). + * + * WARNING: Be wary that the child cleanup function passed to tst_brkm() + * must clean only resources the child has allocated. E.g. the + * child cleanup is different function from the parent cleanup. + */ +void tst_record_childstatus(void (*cleanup)(void), pid_t child); + +extern int tst_count; + +/* lib/tst_sig.c */ +void tst_sig(int fork_flag, void (*handler)(), void (*cleanup)()); + +/* lib/self_exec.c */ +void maybe_run_child(void (*child)(), const char *fmt, ...); +int self_exec(const char *argv0, const char *fmt, ...); + +/* lib/tst_mkfs.c + * + * @dev: path to a device + * @fs_type: filesystem type + * @fs_opts: NULL or NULL terminated array of mkfs options + * @extra_opt: extra mkfs option which is passed after the device name + */ +#define tst_mkfs(cleanup, dev, fs_type, fs_opts, extra_opts) \ + tst_mkfs_(__FILE__, __LINE__, cleanup, dev, fs_type, \ + fs_opts, extra_opts) +void tst_mkfs_(const char *file, const int lineno, void (cleanup_fn)(void), + const char *dev, const char *fs_type, + const char *const fs_opts[], const char *const extra_opts[]); + +/* lib/tst_res.c + * tst_strsig converts signal's value to corresponding string. + * tst_strerrno converts errno to corresponding string. + */ +const char *tst_strsig(int sig); +const char *tst_strerrno(int err); + +#ifdef TST_USE_COMPAT16_SYSCALL +#define TCID_BIT_SUFFIX "_16" +#elif TST_USE_NEWER64_SYSCALL +#define TCID_BIT_SUFFIX "_64" +#else +#define TCID_BIT_SUFFIX "" +#endif +#define TCID_DEFINE(ID) char *TCID = (#ID TCID_BIT_SUFFIX) + +#endif /* __TEST_H__ */ diff --git a/fsstress/include/old/tlibio.h b/fsstress/include/old/tlibio.h new file mode 100644 index 0000000000..0fe9ce9deb --- /dev/null +++ b/fsstress/include/old/tlibio.h @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ + */ + +#define LIO_IO_SYNC 00001 /* read/write */ +#define LIO_IO_ASYNC 00002 /* reada/writea/aio_write/aio_read */ +#define LIO_IO_SLISTIO 00004 /* single stride sync listio */ +#define LIO_IO_ALISTIO 00010 /* single stride async listio */ +#define LIO_IO_SYNCV 00020 /* single-buffer readv/writev */ +#define LIO_IO_SYNCP 00040 /* pread/pwrite */ + +#ifdef sgi +#define LIO_IO_ATYPES 00077 /* all io types */ +#define LIO_IO_TYPES 00061 /* all io types, non-async */ +#endif /* sgi */ +#if defined(__linux__) && !defined(__UCLIBC__) +#define LIO_IO_TYPES 00061 /* all io types */ +#define LIO_IO_ATYPES 00077 /* all io types */ +#endif +#if defined(__sun) || defined(__hpux) || defined(_AIX) || defined(__UCLIBC__) +#define LIO_IO_TYPES 00021 /* all io types except pread/pwrite */ +#endif /* linux */ +#ifdef CRAY +#define LIO_IO_TYPES 00017 /* all io types */ +#endif /* CRAY */ + +#ifndef LIO_IO_ATYPES +#define LIO_IO_ATYPES LIO_IO_TYPES +#endif + +#define LIO_WAIT_NONE 00010000 /* return asap -- use with care */ +#define LIO_WAIT_ACTIVE 00020000 /* spin looking at iosw fields, or EINPROGRESS */ +#define LIO_WAIT_RECALL 00040000 /* call recall(2)/aio_suspend(3) */ +#define LIO_WAIT_SIGPAUSE 00100000 /* call pause */ +#define LIO_WAIT_SIGACTIVE 00200000 /* spin waiting for signal */ +#if defined(sgi) || defined(__linux__) +#define LIO_WAIT_CBSUSPEND 00400000 /* aio_suspend waiting for callback */ +#define LIO_WAIT_SIGSUSPEND 01000000 /* aio_suspend waiting for signal */ +#define LIO_WAIT_ATYPES 01760000 /* all async wait types, except nowait */ +#define LIO_WAIT_TYPES 00020000 /* all sync wait types (sorta) */ +#endif /* sgi */ +#if defined(__sun) || defined(__hpux) || defined(_AIX) +#define LIO_WAIT_TYPES 00300000 /* all wait types, except nowait */ +#endif /* linux */ +#ifdef CRAY +#define LIO_WAIT_TYPES 00360000 /* all wait types, except nowait */ +#endif /* CRAY */ + +/* meta wait io */ +/* 00 000 0000 */ + +#if defined(sgi) || defined(__linux__) +/* all callback wait types */ +#define LIO_WAIT_CBTYPES (LIO_WAIT_CBSUSPEND) +/* all signal wait types */ +#define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE|LIO_WAIT_SIGACTIVE|LIO_WAIT_SIGSUSPEND) +/* all aio_{read,write} or lio_listio */ +#define LIO_IO_ASYNC_TYPES (LIO_IO_ASYNC|LIO_IO_SLISTIO|LIO_IO_ALISTIO) +#endif /* sgi */ +#if defined(__sun) || defined(__hpux) || defined(_AIX) +/* all signal wait types */ +#define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE) +#endif /* linux */ +#ifdef CRAY +/* all signal wait types */ +#define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE|LIO_WAIT_SIGACTIVE) +#endif /* CRAY */ + +/* + * This bit provides a way to randomly pick an io type and wait method. + * lio_read_buffer() and lio_write_buffer() functions will call + * lio_random_methods() with the given method. + */ +#define LIO_RANDOM 010000000 + +/* + * This bit provides a way for the programmer to use async i/o with + * signals and to use their own signal handler. By default, + * the signal will only be given to the system call if the wait + * method is LIO_WAIT_SIGPAUSE or LIO_WAIT_SIGACTIVE. + * Whenever these wait methods are used, libio signal handler + * will be used. + */ +#define LIO_USE_SIGNAL 020000000 + +/* + * prototypes/structures for functions in the libio.c module. See comments + * in that module, or man page entries for information on the individual + * functions. + */ + +int stride_bounds(int offset, int stride, int nstrides, + int bytes_per_stride, int *min_byte, int *max_byte); + +int lio_set_debug(int level); +int lio_parse_io_arg1(char *string); +void lio_help1(char *prefex); +int lio_parse_io_arg2(char *string, char **badtoken); +void lio_help2(char *prefex); +int lio_write_buffer(int fd, int method, char *buffer, int size, + int sig, char **errmsg, long wrd); + +int lio_read_buffer(int fd, int method, char *buffer, int size, + int sig, char **errmsg, long wrd); +int lio_random_methods(long mask); + +#if CRAY +#include +int lio_wait4asyncio(int method, int fd, struct iosw **statptr); +int lio_check_asyncio(char *io_type, int size, struct iosw *status); +#endif /* CRAY */ +#if defined (sgi) +#include +int lio_wait4asyncio(int method, int fd, aiocb_t *aiocbp); +int lio_check_asyncio(char *io_type, int size, aiocb_t *aiocbp, int method); +#endif /* sgi */ +#if defined(__linux__) && !defined(__UCLIBC__) +#include +int lio_wait4asyncio(int method, int fd, struct aiocb *aiocbp); +int lio_check_asyncio(char *io_type, int size, struct aiocb *aiocbp, int method); +#endif + +/* + * Define the structure that contains the infomation that is used + * by the parsing and help functions. + */ +struct lio_info_type { + char *token; + int bits; + char *desc; +}; + + diff --git a/fsstress/include/old/usctest.h b/fsstress/include/old/usctest.h new file mode 100644 index 0000000000..9b9446d70a --- /dev/null +++ b/fsstress/include/old/usctest.h @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * Author: William Roske + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ + */ + +#ifndef __USCTEST_H__ +#define __USCTEST_H__ + +/* + * Ensure that PATH_MAX is defined + */ +#ifndef PATH_MAX +#ifdef MAXPATHLEN +#define PATH_MAX MAXPATHLEN +#else +#define PATH_MAX 1024 +#endif +#endif + +/*********************************************************************** + * The following globals are defined in parse_opts.c but must be + * externed here because they are used in the macros defined below. + ***********************************************************************/ +extern int STD_LOOP_COUNT; /* changed by -in to set loop count to n */ + +extern long TEST_RETURN; +extern int TEST_ERRNO; + +/*********************************************************************** + * TEST: calls a system call + * + * parameters: + * SCALL = system call and parameters to execute + * + ***********************************************************************/ +#define TEST(SCALL) \ + do { \ + errno = 0; \ + TEST_RETURN = SCALL; \ + TEST_ERRNO = errno; \ + } while (0) + +/*********************************************************************** + * TEST_VOID: calls a system call + * + * parameters: + * SCALL = system call and parameters to execute + * + * Note: This is IDENTICAL to the TEST() macro except that it is intended + * for use with syscalls returning no values (void syscall()). The + * Typecasting nothing (void) into an unsigned integer causes compilation + * errors. + * + ***********************************************************************/ +#define TEST_VOID(SCALL) do { errno = 0; SCALL; TEST_ERRNO = errno; } while (0) + +/*********************************************************************** + * TEST_PAUSE: Pause for SIGUSR1 if the pause flag is set. + * Just continue when signal comes in. + * + * parameters: + * none + * + ***********************************************************************/ +#define TEST_PAUSE usc_global_setup_hook(); +int usc_global_setup_hook(); + +/*********************************************************************** + * TEST_LOOPING now call the usc_test_looping function. + * The function will return 1 if the test should continue + * iterating. + * + ***********************************************************************/ +#define TEST_LOOPING usc_test_looping +int usc_test_looping(int counter); + +#endif /* __USCTEST_H__ */ diff --git a/fsstress/include/parse_vdso.h b/fsstress/include/parse_vdso.h new file mode 100644 index 0000000000..5212fc659e --- /dev/null +++ b/fsstress/include/parse_vdso.h @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2020 Linaro Limited. All rights reserved. + * Author: Viresh Kumar + */ + +#ifndef PARSE_VDSO_H__ +#define PARSE_VDSO_H__ + +#include + +/* + * To use this vDSO parser, first call one of the vdso_init_* functions. + * If you've already parsed auxv, then pass the value of AT_SYSINFO_EHDR + * to vdso_init_from_sysinfo_ehdr. Otherwise pass auxv to vdso_init_from_auxv. + * Then call vdso_sym for each symbol you want. For example, to look up + * gettimeofday on x86_64, use: + * + * = vdso_sym("LINUX_2.6", "gettimeofday"); + * or + * = vdso_sym("LINUX_2.6", "__vdso_gettimeofday"); + * + * vdso_sym will return 0 if the symbol doesn't exist or if the init function + * failed or was not called. vdso_sym is a little slow, so its return value + * should be cached. + * + * vdso_sym is threadsafe; the init functions are not. + * + * These are the prototypes: + */ + +#include + +extern void vdso_init_from_auxv(void *auxv); +extern void vdso_init_from_sysinfo_ehdr(uintptr_t base); +extern void *vdso_sym(const char *version, const char *name); + +typedef int (*gettime_t)(clockid_t clk_id, void *ts); +void find_clock_gettime_vdso(gettime_t *ptr_vdso_gettime, + gettime_t *ptr_vdso_gettime64); +#endif /* PARSE_VDSO_H__ */ diff --git a/fsstress/include/safe_file_ops_fn.h b/fsstress/include/safe_file_ops_fn.h new file mode 100644 index 0000000000..052fb1b9a4 --- /dev/null +++ b/fsstress/include/safe_file_ops_fn.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2012-2016 Cyril Hrubis + * + * 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, see . + */ + +#ifndef SAFE_FILE_OPS_FN +#define SAFE_FILE_OPS_FN + +#include +#include + +#include "lapi/utime.h" + +/* + * All-in-one function to scanf value(s) from a file. + */ +int file_scanf(const char *file, const int lineno, + const char *path, const char *fmt, ...) + __attribute__ ((format (scanf, 4, 5))); + +void safe_file_scanf(const char *file, const int lineno, + void (*cleanup_fn)(void), + const char *path, const char *fmt, ...) + __attribute__ ((format (scanf, 5, 6))); + +int file_lines_scanf(const char *file, const int lineno, + void (*cleanup_fn)(void), int strict, + const char *path, const char *fmt, ...) + __attribute__ ((format (scanf, 6, 7))); + +/* + * All-in-one function that lets you printf directly into a file. + */ +int file_printf(const char *file, const int lineno, + const char *path, const char *fmt, ...) + __attribute__ ((format (printf, 4, 5))); + +void safe_file_printf(const char *file, const int lineno, + void (*cleanup_fn)(void), + const char *path, const char *fmt, ...) + __attribute__ ((format (printf, 5, 6))); + +/* + * Safe function to copy files, no more system("cp ...") please. + */ +void safe_cp(const char *file, const int lineno, + void (*cleanup_fn)(void), + const char *src, const char *dst); + +/* + * Safe function to touch a file. + * + * If the file (pathname) does not exist It will be created with + * the specified permission (mode) and the access/modification times (times). + * + * If mode is 0 then the file is created with (0666 & ~umask) + * permission or (if the file exists) the permission is not changed. + * + * times is a timespec[2] (as for utimensat(2)). If times is NULL then + * the access/modification times of the file is set to the current time. + */ +void safe_touch(const char *file, const int lineno, + void (*cleanup_fn)(void), + const char *pathname, + mode_t mode, const struct timespec times[2]); + +/* helper functions to setup overlayfs mountpoint */ +void create_overlay_dirs(void); +int mount_overlay(const char *file, const int lineno, int skip); + +#endif /* SAFE_FILE_OPS_FN */ diff --git a/fsstress/include/safe_macros_fn.h b/fsstress/include/safe_macros_fn.h new file mode 100644 index 0000000000..3df952811b --- /dev/null +++ b/fsstress/include/safe_macros_fn.h @@ -0,0 +1,187 @@ +/* + * Safe macros for commonly used syscalls to reduce code duplication in LTP + * testcases, and to ensure all errors are caught in said testcases as + * gracefully as possible. + * + * Also satiates some versions of gcc/glibc when the warn_unused_result + * attribute is applied to the function call. + * + * Licensed under the GPLv2. + */ + +#ifndef SAFE_MACROS_FN_H__ +#define SAFE_MACROS_FN_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +char* safe_basename(const char *file, const int lineno, + void (*cleanup_fn)(void), char *path); + +int safe_chdir(const char *file, const int lineno, + void (*cleanup_fn)(void), const char *path); + +int safe_close(const char *file, const int lineno, + void (*cleanup_fn)(void), int fildes); + +int safe_creat(const char *file, const int lineno, + void (*cleanup_fn)(void), const char *pathname, mode_t mode); + +char* safe_dirname(const char *file, const int lineno, + void (*cleanup_fn)(void), char *path); + +char* safe_getcwd(const char *file, const int lineno, + void (*cleanup_fn)(void), char *buf, size_t size); + +struct passwd* safe_getpwnam(const char *file, const int lineno, + void (*cleanup_fn)(void), const char *name); + +int safe_getrusage(const char *file, const int lineno, + void (*cleanup_fn)(void), int who, struct rusage *usage); + +void* safe_malloc(const char *file, const int lineno, + void (*cleanup_fn)(void), size_t size); + +int safe_mkdir(const char *file, const int lineno, + void (*cleanup_fn)(void), const char *pathname, mode_t mode); + +int safe_rmdir(const char *file, const int lineno, + void (*cleanup_fn)(void), const char *pathname); + + +int safe_munmap(const char *file, const int lineno, + void (*cleanup_fn)(void), void *addr, size_t length); + +int safe_open(const char *file, const int lineno, + void (*cleanup_fn)(void), const char *pathname, int oflags, ...); + +int safe_pipe(const char *file, const int lineno, + void (*cleanup_fn)(void), int fildes[2]); + +ssize_t safe_read(const char *file, const int lineno, + void (*cleanup_fn)(void), char len_strict, int fildes, + void *buf, size_t nbyte); + +int safe_setegid(const char *file, const int lineno, + void (*cleanup_fn)(void), gid_t egid); + +int safe_seteuid(const char *file, const int lineno, + void (*cleanup_fn)(void), uid_t euid); + +int safe_setgid(const char *file, const int lineno, + void (*cleanup_fn)(void), gid_t gid); + +int safe_setuid(const char *file, const int lineno, + void (*cleanup_fn)(void), uid_t uid); + +int safe_getresuid(const char *file, const int lineno, + void (*cleanup_fn)(void), + uid_t *ruid, uid_t *euid, uid_t *suid); + +int safe_getresgid(const char *file, const int lineno, + void (*cleanup_fn)(void), + gid_t *rgid, gid_t *egid, gid_t *sgid); + +int safe_unlink(const char *file, const int lineno, + void (*cleanup_fn)(void), const char *pathname); + +int safe_link(const char *file, const int lineno, + void (cleanup_fn)(void), const char *oldpath, + const char *newpath); + +int safe_linkat(const char *file, const int lineno, + void (cleanup_fn)(void), int olddirfd, const char *oldpath, + int newdirfd, const char *newpath, int flags); + +ssize_t safe_readlink(const char *file, const int lineno, + void (cleanup_fn)(void), const char *path, + char *buf, size_t bufsize); + +int safe_symlink(const char *file, const int lineno, + void (cleanup_fn)(void), const char *oldpath, + const char *newpath); + +ssize_t safe_write(const char *file, const int lineno, + void (cleanup_fn)(void), char len_strict, int fildes, + const void *buf, size_t nbyte); + +long safe_strtol(const char *file, const int lineno, + void (cleanup_fn)(void), char *str, long min, long max); + +unsigned long safe_strtoul(const char *file, const int lineno, + void (cleanup_fn)(void), + char *str, unsigned long min, unsigned long max); + +long safe_sysconf(const char *file, const int lineno, + void (cleanup_fn)(void), int name); + +int safe_chmod(const char *file, const int lineno, void (cleanup_fn)(void), + const char *path, mode_t mode); + +int safe_fchmod(const char *file, const int lineno, void (cleanup_fn)(void), + int fd, mode_t mode); + +int safe_chown(const char *file, const int lineno, void (cleanup_fn)(void), + const char *path, uid_t owner, gid_t group); + +int safe_fchown(const char *file, const int lineno, void (cleanup_fn)(void), + int fd, uid_t owner, gid_t group); + +pid_t safe_wait(const char *file, const int lineno, void (cleanup_fn)(void), + int *status); + +pid_t safe_waitpid(const char *file, const int lineno, void (cleanup_fn)(void), + pid_t pid, int *status, int opts); + +int safe_kill(const char *file, const int lineno, void (cleanup_fn)(void), + pid_t pid, int sig); + +void *safe_memalign(const char *file, const int lineno, + void (*cleanup_fn)(void), size_t alignment, size_t size); + +int safe_mkfifo(const char *file, const int lineno, + void (*cleanup_fn)(void), const char *pathname, mode_t mode); + +int safe_rename(const char *file, const int lineno, void (*cleanup_fn)(void), + const char *oldpath, const char *newpath); + +int safe_mount(const char *file, const int lineno, void (*cleanup_fn)(void), + const char *source, const char *target, + const char *filesystemtype, unsigned long mountflags, + const void *data); + +int safe_umount(const char *file, const int lineno, void (*cleanup_fn)(void), + const char *target); + +DIR* safe_opendir(const char *file, const int lineno, void (cleanup_fn)(void), + const char *name); + +int safe_closedir(const char *file, const int lineno, void (cleanup_fn)(void), + DIR *dirp); + +struct dirent *safe_readdir(const char *file, const int lineno, + void (cleanup_fn)(void), + DIR *dirp); + +DIR* safe_opendir(const char *file, const int lineno, + void (cleanup_fn)(void), + const char *name); + +struct dirent *safe_readdir(const char *file, const int lineno, + void (cleanup_fn)(void), + DIR *dirp); + +int safe_closedir(const char *file, const int lineno, + void (cleanup_fn)(void), + DIR *dirp); + +#endif /* SAFE_MACROS_FN_H__ */ diff --git a/fsstress/include/safe_net_fn.h b/fsstress/include/safe_net_fn.h new file mode 100644 index 0000000000..2fda11fab7 --- /dev/null +++ b/fsstress/include/safe_net_fn.h @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2016 Cyril Hrubis + * Copyright (c) 2015 Fujitsu Ltd. + * + * 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, see . + */ + +#ifndef SAFE_NET_FN_H__ +#define SAFE_NET_FN_H__ + +#include +#include +#include +#include +#include + +int safe_socket(const char *file, const int lineno, void (cleanup_fn)(void), + int domain, int type, int protocol); + +int safe_socketpair(const char *file, const int lineno, int domain, int type, + int protocol, int sv[]); + +int safe_getsockopt(const char *file, const int lineno, int sockfd, int level, + int optname, void *optval, socklen_t *optlen); + +int safe_setsockopt(const char *file, const int lineno, int sockfd, int level, + int optname, const void *optval, socklen_t optlen); + +ssize_t safe_send(const char *file, const int lineno, char len_strict, + int sockfd, const void *buf, size_t len, int flags); + +ssize_t safe_sendto(const char *file, const int lineno, char len_strict, + int sockfd, const void *buf, size_t len, int flags, + const struct sockaddr *dest_addr, socklen_t addrlen); + +ssize_t safe_sendmsg(const char *file, const int lineno, size_t msg_len, + int sockfd, const struct msghdr *msg, int flags); + +ssize_t safe_recvmsg(const char *file, const int lineno, size_t msg_len, + int sockfd, struct msghdr *msg, int flags); + +int safe_bind(const char *file, const int lineno, void (cleanup_fn)(void), + int socket, const struct sockaddr *address, + socklen_t address_len); + +int safe_listen(const char *file, const int lineno, void (cleanup_fn)(void), + int socket, int backlog); + +int safe_accept(const char *file, const int lineno, void (cleanup_fn)(void), + int sockfd, struct sockaddr *addr, socklen_t *addrlen); + +int safe_connect(const char *file, const int lineno, void (cleanup_fn)(void), + int sockfd, const struct sockaddr *addr, socklen_t addrlen); + +int safe_getsockname(const char *file, const int lineno, + void (cleanup_fn)(void), int sockfd, struct sockaddr *addr, + socklen_t *addrlen); + +int safe_gethostname(const char *file, const int lineno, + char *name, size_t size); + +int tst_getsockport(const char *file, const int lineno, int sockfd); + +unsigned short tst_get_unused_port(const char *file, const int lineno, + void (cleanup_fn)(void), unsigned short family, int type); + +char *tst_sock_addr(const struct sockaddr *sa, socklen_t salen, char *res, + size_t len); + +#endif /* SAFE_NET_FN_H__ */ diff --git a/fsstress/include/safe_stdio_fn.h b/fsstress/include/safe_stdio_fn.h new file mode 100644 index 0000000000..3818a86571 --- /dev/null +++ b/fsstress/include/safe_stdio_fn.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2013-2016 Cyril Hrubis + * + * 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, see . + */ + +#ifndef SAFE_STDIO_FN_H__ +#define SAFE_STDIO_FN_H__ + +#include + +FILE *safe_fopen(const char *file, const int lineno, void (cleanup_fn)(void), + const char *path, const char *mode); + +int safe_fclose(const char *file, const int lineno, void (cleanup_fn)(void), + FILE *f); + +int safe_asprintf(const char *file, const int lineno, void (cleanup_fn)(void), + char **strp, const char *fmt, ...); + +FILE *safe_popen(const char *file, const int lineno, void (cleanup_fn)(void), + const char *command, const char *type); + +#endif /* SAFE_STDIO_FN_H__ */ diff --git a/fsstress/include/stamp-h1 b/fsstress/include/stamp-h1 new file mode 100644 index 0000000000..b330768e9b --- /dev/null +++ b/fsstress/include/stamp-h1 @@ -0,0 +1 @@ +timestamp for include/config.h diff --git a/fsstress/include/tst_af_alg.h b/fsstress/include/tst_af_alg.h new file mode 100644 index 0000000000..fc4b1989a2 --- /dev/null +++ b/fsstress/include/tst_af_alg.h @@ -0,0 +1,136 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright 2019 Google LLC + */ +/** + * @file tst_af_alg.h + * + * Library for accessing kernel crypto algorithms via AF_ALG. + * + * See https://www.kernel.org/doc/html/latest/crypto/userspace-if.html + * for more information about AF_ALG. + */ + +#ifndef TST_AF_ALG_H +#define TST_AF_ALG_H + +#include "lapi/if_alg.h" +#include + +/** + * Create an AF_ALG algorithm socket. + * + * This creates an AF_ALG algorithm socket that is initially not bound to any + * particular algorithm. On failure, tst_brk() is called with TCONF if the + * kernel doesn't support AF_ALG, otherwise TBROK. + * + * @return a new AF_ALG algorithm socket + */ +int tst_alg_create(void); + +/** + * Bind an AF_ALG algorithm socket to an algorithm. + * + * @param algfd An AF_ALG algorithm socket + * @param addr A structure which specifies the algorithm to use + * + * On failure, tst_brk() is called with TCONF if the kernel doesn't support the + * specified algorithm, otherwise TBROK. + */ +void tst_alg_bind_addr(int algfd, const struct sockaddr_alg *addr); + +/** + * Bind an AF_ALG algorithm socket to an algorithm. + * + * @param algfd An AF_ALG algorithm socket + * @param algtype The type of algorithm, such as "hash" or "skcipher" + * @param algname The name of the algorithm, such as "sha256" or "xts(aes)" + * + * Like tst_alg_bind_addr(), except this just takes in the algorithm type and + * name. The 'feat' and 'mask' fields are left 0. + * + * On failure, tst_brk() is called with TCONF if the kernel doesn't support the + * specified algorithm, otherwise TBROK. + */ +void tst_alg_bind(int algfd, const char *algtype, const char *algname); + +/** + * Check for the availability of an algorithm. + * + * @param algtype The type of algorithm, such as "hash" or "skcipher" + * @param algname The name of the algorithm, such as "sha256" or "xts(aes)" + * + * Return true if the algorithm is available, or false if unavailable. + * If another error occurs, tst_brk() is called with TBROK. + */ +bool tst_have_alg(const char *algtype, const char *algname); + +/** + * Require the availability of an algorithm. + * + * @param algtype The type of algorithm, such as "hash" or "skcipher" + * @param algname The name of the algorithm, such as "sha256" or "xts(aes)" + * + * If the algorithm is unavailable, tst_brk() is called with TCONF. + * If another error occurs, tst_brk() is called with TBROK. + */ +void tst_require_alg(const char *algtype, const char *algname); + +/** + * Assign a cryptographic key to an AF_ALG algorithm socket. + * + * @param algfd An AF_ALG algorithm socket + * @param key Pointer to the key. If NULL, a random key is generated. + * @param keylen Length of the key in bytes + * + * On failure, tst_brk() is called with TBROK. + */ +void tst_alg_setkey(int algfd, const uint8_t *key, unsigned int keylen); + +/** + * Create an AF_ALG request socket for the given algorithm socket. + * + * @param algfd An AF_ALG algorithm socket + * + * This creates a request socket for the given algorithm socket, which must be + * bound to an algorithm. The same algorithm socket can have many request + * sockets used concurrently to perform independent cryptographic operations, + * e.g. hashing or encryption/decryption. But the key, if any, that has been + * assigned to the algorithm is shared by all request sockets. + * + * On failure, tst_brk() is called with TBROK. + * + * @return a new AF_ALG request socket + */ +int tst_alg_accept(int algfd); + +/** + * Set up an AF_ALG algorithm socket for the given algorithm w/ given key. + * + * @param algtype The type of algorithm, such as "hash" or "skcipher" + * @param algname The name of the algorithm, such as "sha256" or "xts(aes)" + * @param key The key to use (optional) + * @param keylen The length of the key in bytes (optional) + * + * This is a helper function which creates an AF_ALG algorithm socket, binds it + * to the specified algorithm, and optionally sets a key. If keylen is 0 then + * no key is set; otherwise if key is NULL a key of the given length is randomly + * generated and set; otherwise the given key is set. + * + * @return the AF_ALG algorithm socket that was set up + */ +int tst_alg_setup(const char *algtype, const char *algname, + const uint8_t *key, unsigned int keylen); + +/** + * Set up an AF_ALG request socket for the given algorithm w/ given key. + * + * This is like tst_alg_setup(), except this returns a request fd instead of the + * alg fd. The alg fd is closed, so it doesn't need to be kept track of. + * + * @return the AF_ALG request socket that was set up + */ +int tst_alg_setup_reqfd(const char *algtype, const char *algname, + const uint8_t *key, unsigned int keylen); + +#endif /* TST_AF_ALG_H */ diff --git a/fsstress/include/tst_ansi_color.h b/fsstress/include/tst_ansi_color.h new file mode 100644 index 0000000000..770bf46d96 --- /dev/null +++ b/fsstress/include/tst_ansi_color.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2017 Petr Vorel + */ + +#ifndef TST_ANSI_COLOR_H__ +#define TST_ANSI_COLOR_H__ +/* + * NOTE: these colors should match colors defined in tst_flag2color() in + * testcases/lib/tst_ansi_color.sh + */ +#define ANSI_COLOR_BLUE "\033[1;34m" +#define ANSI_COLOR_GREEN "\033[1;32m" +#define ANSI_COLOR_MAGENTA "\033[1;35m" +#define ANSI_COLOR_RED "\033[1;31m" +#define ANSI_COLOR_YELLOW "\033[1;33m" + +#define ANSI_COLOR_RESET "\033[0m" + +char* tst_ttype2color(int ttype); +int tst_color_enabled(int fd); + +#endif /* TST_ANSI_COLOR_H__ */ diff --git a/fsstress/include/tst_assert.h b/fsstress/include/tst_assert.h new file mode 100644 index 0000000000..9969a81690 --- /dev/null +++ b/fsstress/include/tst_assert.h @@ -0,0 +1,56 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved. + * Author: Yang Xu + * Copyright (c) 2020 Cyril Hrubis + */ +#ifndef TST_ASSERT_H__ +#define TST_ASSERT_H__ + +#define TST_ASSERT_INT(path, val) \ + tst_assert_int(__FILE__, __LINE__, path, val) + +/* + * Asserts that integer value stored in file pointed by path equals to the + * value passed to this function. This is mostly useful for asserting correct + * values in sysfs, procfs, etc. + */ +void tst_assert_int(const char *file, const int lineno, + const char *path, int val); + +#define TST_ASSERT_FILE_INT(path, prefix, val) \ + tst_assert_file_int(__FILE__, __LINE__, path, prefix, val) + +/* + * Asserts that integer value stored in the prefix field of file pointed by path + * equals to the value passed to this function. This is mostly useful for + * asserting correct field values in sysfs, procfs, etc. + */ + +void tst_assert_file_int(const char *file, const int lineno, + const char *path, const char *prefix, int val); + + +#define TST_ASSERT_STR(path, val) \ + tst_assert_str(__FILE__, __LINE__, path, val) + +/* + * Asserts that a string value stored in file pointed by path equals to the + * value passed to this function. This is mostly useful for asserting correct + * values in sysfs, procfs, etc. + */ +void tst_assert_str(const char *file, const int lineno, + const char *path, const char *val); + +#define TST_ASSERT_FILE_STR(path, prefix, val) \ + tst_assert_file_str(__FILE__, __LINE__, path, prefix, val) + +/* + * Asserts that a string value stored in the prefix field of file pointed by path + * equals to the value passed to this function. This is mostly useful for + * asserting correct field values in sysfs, procfs, etc. + */ +void tst_assert_file_str(const char *file, const int lineno, + const char *path, const char *prefix, const char *val); + +#endif /* TST_ASSERT_H__ */ diff --git a/fsstress/include/tst_atomic.h b/fsstress/include/tst_atomic.h new file mode 100644 index 0000000000..061cd3dc63 --- /dev/null +++ b/fsstress/include/tst_atomic.h @@ -0,0 +1,334 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2016 Cyril Hrubis + */ + +/* The LTP library has some of its own atomic synchronisation primitives + * contained in this file. Generally speaking these should not be used + * directly in tests for synchronisation, instead use tst_checkpoint.h, + * tst_fuzzy_sync.h or the POSIX library. + * + * Notes on compile and runtime memory barriers and atomics. + * + * Within the LTP library we have three concerns when accessing variables + * shared by multiple threads or processes: + * + * (1) Removal or reordering of accesses by the compiler. + * (2) Atomicity of addition. + * (3) LOAD-STORE ordering between threads. + * + * The first (1) is the most likely to cause an error if not properly + * handled. We avoid it by using volatile variables and statements which will + * not be removed or reordered by the compiler during optimisation. This includes + * the __atomic and __sync intrinsics and volatile asm statements marked with + * "memory" as well as variables marked with volatile. + * + * On any platform Linux is likely to run on, a LOAD (fetch) or STORE of a + * 32-bit integer will be atomic. However fetching and adding to a variable is + * quite likely not; so for (2) we need to ensure we use atomic addition. + * + * Finally, for tst_fuzzy_sync at least, we need to ensure that LOADs and + * STOREs of any shared variables (including non-atomics) that are made + * between calls to tst_fzsync_wait are completed (globally visible) before + * tst_fzsync_wait completes. For this, runtime memory and instruction + * barriers are required in addition to compile time. + * + * We use full sequential ordering (__ATOMIC_SEQ_CST) for the sake of + * simplicity. LTP tests tend to be syscall heavy so any performance gain from + * using a weaker memory model is unlikely to result in a relatively large + * performance improvement while at the same time being a potent source of + * confusion. + * + * Likewise, for the fallback ASM, the simplest "definitely will work, always" + * approach is preferred over anything more performant. + * + * Also see Documentation/memory-barriers.txt in the kernel tree and + * https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html + * terminology may vary between sources. + */ + +#ifndef TST_ATOMIC_H__ +#define TST_ATOMIC_H__ + +#include "config.h" + +#if HAVE_ATOMIC_MEMORY_MODEL == 1 +static inline int tst_atomic_add_return(int i, int *v) +{ + return __atomic_add_fetch(v, i, __ATOMIC_SEQ_CST); +} + +static inline int tst_atomic_load(int *v) +{ + return __atomic_load_n(v, __ATOMIC_SEQ_CST); +} + +static inline void tst_atomic_store(int i, int *v) +{ + __atomic_store_n(v, i, __ATOMIC_SEQ_CST); +} + +#elif HAVE_SYNC_ADD_AND_FETCH == 1 +static inline int tst_atomic_add_return(int i, int *v) +{ + return __sync_add_and_fetch(v, i); +} + +static inline int tst_atomic_load(int *v) +{ + int ret; + + __sync_synchronize(); + ret = *v; + __sync_synchronize(); + return ret; +} + +static inline void tst_atomic_store(int i, int *v) +{ + __sync_synchronize(); + *v = i; + __sync_synchronize(); +} + +#elif defined(__i386__) || defined(__x86_64__) +# define LTP_USE_GENERIC_LOAD_STORE_ASM 1 + +static inline int tst_atomic_add_return(int i, int *v) +{ + int __ret = i; + + /* + * taken from arch/x86/include/asm/cmpxchg.h + */ + asm volatile ("lock; xaddl %0, %1\n" + : "+r" (__ret), "+m" (*v) : : "memory", "cc"); + + return i + __ret; +} + +#elif defined(__powerpc__) || defined(__powerpc64__) +static inline int tst_atomic_add_return(int i, int *v) +{ + int t; + + /* taken from arch/powerpc/include/asm/atomic.h */ + asm volatile( + " sync\n" + "1: lwarx %0,0,%2 # atomic_add_return\n" + " add %0,%1,%0\n" + " stwcx. %0,0,%2 \n" + " bne- 1b\n" + " sync\n" + : "=&r" (t) + : "r" (i), "r" (v) + : "cc", "memory"); + + return t; +} + +static inline int tst_atomic_load(int *v) +{ + int ret; + + asm volatile("sync\n" : : : "memory"); + ret = *v; + asm volatile("sync\n" : : : "memory"); + + return ret; +} + +static inline void tst_atomic_store(int i, int *v) +{ + asm volatile("sync\n" : : : "memory"); + *v = i; + asm volatile("sync\n" : : : "memory"); +} + +#elif defined(__s390__) || defined(__s390x__) +# define LTP_USE_GENERIC_LOAD_STORE_ASM 1 + +static inline int tst_atomic_add_return(int i, int *v) +{ + int old_val, new_val; + + /* taken from arch/s390/include/asm/atomic.h */ + asm volatile( + " l %0,%2\n" + "0: lr %1,%0\n" + " ar %1,%3\n" + " cs %0,%1,%2\n" + " jl 0b" + : "=&d" (old_val), "=&d" (new_val), "+Q" (*v) + : "d" (i) + : "cc", "memory"); + + return old_val + i; +} + +#elif defined(__arc__) + +/*ARCv2 defines the smp barriers */ +#ifdef __ARC700__ +#define smp_mb() asm volatile("" : : : "memory") +#else +#define smp_mb() asm volatile("dmb 3\n" : : : "memory") +#endif + +static inline int tst_atomic_add_return(int i, int *v) +{ + unsigned int val; + + smp_mb(); + + asm volatile( + "1: llock %[val], [%[ctr]] \n" + " add %[val], %[val], %[i] \n" + " scond %[val], [%[ctr]] \n" + " bnz 1b \n" + : [val] "=&r" (val) + : [ctr] "r" (v), + [i] "ir" (i) + : "cc", "memory"); + + smp_mb(); + + return val; +} + +static inline int tst_atomic_load(int *v) +{ + int ret; + + smp_mb(); + ret = *v; + smp_mb(); + + return ret; +} + +static inline void tst_atomic_store(int i, int *v) +{ + smp_mb(); + *v = i; + smp_mb(); +} + +#elif defined (__aarch64__) +static inline int tst_atomic_add_return(int i, int *v) +{ + unsigned long tmp; + int result; + + __asm__ __volatile__( +" prfm pstl1strm, %2 \n" +"1: ldaxr %w0, %2 \n" +" add %w0, %w0, %w3 \n" +" stlxr %w1, %w0, %2 \n" +" cbnz %w1, 1b \n" +" dmb ish \n" + : "=&r" (result), "=&r" (tmp), "+Q" (*v) + : "Ir" (i) + : "memory"); + + return result; +} + +/* We are using load and store exclusive (ldaxr & stlxr) instructions to try + * and help prevent the tst_atomic_load and, more likely, tst_atomic_store + * functions from interfering with tst_atomic_add_return which takes advantage + * of exclusivity. It is not clear if this is a good idea or not, but does + * mean that all three functions are very similar. + */ +static inline int tst_atomic_load(int *v) +{ + int ret; + unsigned long tmp; + + asm volatile("//atomic_load \n" + " prfm pstl1strm, %[v] \n" + "1: ldaxr %w[ret], %[v] \n" + " stlxr %w[tmp], %w[ret], %[v] \n" + " cbnz %w[tmp], 1b \n" + " dmb ish \n" + : [tmp] "=&r" (tmp), [ret] "=&r" (ret), [v] "+Q" (*v) + : : "memory"); + + return ret; +} + +static inline void tst_atomic_store(int i, int *v) +{ + unsigned long tmp; + + asm volatile("//atomic_store \n" + " prfm pstl1strm, %[v] \n" + "1: ldaxr %w[tmp], %[v] \n" + " stlxr %w[tmp], %w[i], %[v] \n" + " cbnz %w[tmp], 1b \n" + " dmb ish \n" + : [tmp] "=&r" (tmp), [v] "+Q" (*v) + : [i] "r" (i) + : "memory"); +} + +#elif defined(__sparc__) && defined(__arch64__) +# define LTP_USE_GENERIC_LOAD_STORE_ASM 1 +static inline int tst_atomic_add_return(int i, int *v) +{ + int ret, tmp; + + /* Based on arch/sparc/lib/atomic_64.S with the exponential backoff + * function removed because we are unlikely to have a large (>= 16?) + * number of cores continuously trying to update one variable. + */ + asm volatile("/*atomic_add_return*/ \n" + "1: ldsw [%[v]], %[ret]; \n" + " add %[ret], %[i], %[tmp]; \n" + " cas [%[v]], %[ret], %[tmp]; \n" + " cmp %[ret], %[tmp]; \n" + " bne,pn %%icc, 1b; \n" + " nop; \n" + " add %[ret], %[i], %[ret]; \n" + : [ret] "=r&" (ret), [tmp] "=r&" (tmp) + : [i] "r" (i), [v] "r" (v) + : "memory", "cc"); + + return ret; +} + +#else /* HAVE_SYNC_ADD_AND_FETCH == 1 */ +# error Your compiler does not provide __atomic_add_fetch, __sync_add_and_fetch \ + and an LTP implementation is missing for your architecture. +#endif + +#ifdef LTP_USE_GENERIC_LOAD_STORE_ASM +static inline int tst_atomic_load(int *v) +{ + int ret; + + asm volatile("" : : : "memory"); + ret = *v; + asm volatile("" : : : "memory"); + + return ret; +} + +static inline void tst_atomic_store(int i, int *v) +{ + asm volatile("" : : : "memory"); + *v = i; + asm volatile("" : : : "memory"); +} +#endif + +static inline int tst_atomic_inc(int *v) +{ + return tst_atomic_add_return(1, v); +} + +static inline int tst_atomic_dec(int *v) +{ + return tst_atomic_add_return(-1, v); +} + +#endif /* TST_ATOMIC_H__ */ diff --git a/fsstress/include/tst_buffers.h b/fsstress/include/tst_buffers.h new file mode 100644 index 0000000000..d19ac8cf07 --- /dev/null +++ b/fsstress/include/tst_buffers.h @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 Cyril Hrubis + */ + +#ifndef TST_BUFFERS_H__ +#define TST_BUFFERS_H__ + +/* + * Buffer description consist of a pointer to a pointer and buffer type/size + * encoded as a different structure members. + * + * Only one of the size and iov_sizes can be set at a time. + */ +struct tst_buffers { + /* + * This pointer points to a buffer pointer. + */ + void *ptr; + /* + * Buffer size. + */ + size_t size; + /* + * Array of iov buffer sizes terminated by -1. + */ + int *iov_sizes; +}; + +/* + * Allocates buffers based on the tst_buffers structure. + * + * @bufs NULL terminated array of test buffer descriptions. + * + * This is called from the test library if the tst_test->bufs pointer is set. + */ +void tst_buffers_alloc(struct tst_buffers bufs[]); + +/* + * strdup() that callls tst_alloc(). + */ +char *tst_strdup(const char *str); + +/* + * Allocates size bytes, returns pointer to the allocated buffer. + */ +void *tst_alloc(size_t size); + +/* + * Allocates iovec structure including the buffers. + * + * @sizes -1 terminated array of buffer sizes. + */ +struct iovec *tst_iovec_alloc(int sizes[]); + +/* + * Frees all allocated buffers. + * + * This is called at the end of the test automatically. + */ +void tst_free_all(void); + +#endif /* TST_BUFFERS_H__ */ diff --git a/fsstress/include/tst_capability.h b/fsstress/include/tst_capability.h new file mode 100644 index 0000000000..6067804a36 --- /dev/null +++ b/fsstress/include/tst_capability.h @@ -0,0 +1,83 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2019 Richard Palethorpe + */ +/** + * @file tst_capability.h + * + * Limited capability operations without libcap. + */ + +#ifndef TST_CAPABILITY_H +#define TST_CAPABILITY_H + +#include + +#include "lapi/capability.h" + +#define TST_CAP_DROP 1 +#define TST_CAP_REQ (1 << 1) + +#define TST_CAP(action, capability) {action, capability, #capability} + +struct tst_cap_user_header { + uint32_t version; + int pid; +}; + +struct tst_cap_user_data { + uint32_t effective; + uint32_t permitted; + uint32_t inheritable; +}; + +struct tst_cap { + uint32_t action; + uint32_t id; + char *name; +}; + +/** + * Get the capabilities as decided by hdr. + * + * Note that the memory pointed to by data should be large enough to store two + * structs. + */ +int tst_capget(struct tst_cap_user_header *hdr, + struct tst_cap_user_data *data); + +/** + * Set the capabilities as decided by hdr and data + * + * Note that the memory pointed to by data should be large enough to store two + * structs. + */ +int tst_capset(struct tst_cap_user_header *hdr, + const struct tst_cap_user_data *data); + +/** + * Add, check or remove a capability + * + * It will attempt to drop or add capability to the effective set. It will + * try to detect if this is needed and whether it can or can't be done. If it + * clearly can not add a privilege to the effective set then it will return + * TCONF. However it may fail for some other reason and return TBROK. + * + * This only tries to change the effective set. Some tests may need to change + * the inheritable and ambient sets, so that child processes retain some + * capability. + */ +void tst_cap_action(struct tst_cap *cap); + + +/** + * Add, check or remove a capabilities + * + * Takes a NULL terminated array of structs which describe whether some + * capabilities are needed or not and mask that determines subset of the + * actions to be performed. Loops over the array and if mask matches the + * element action it's passed to tst_cap_action(). + */ +void tst_cap_setup(struct tst_cap *cap, unsigned int action_mask); + +#endif /* TST_CAPABILITY_H */ diff --git a/fsstress/include/tst_cgroup.h b/fsstress/include/tst_cgroup.h new file mode 100644 index 0000000000..77780e0d64 --- /dev/null +++ b/fsstress/include/tst_cgroup.h @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2020 Red Hat, Inc. + * Copyright (c) 2020 Li Wang + */ + +#ifndef TST_CGROUP_H +#define TST_CGROUP_H + +#define PATH_TMP_CG_MEM "/tmp/cgroup_mem" +#define PATH_TMP_CG_CST "/tmp/cgroup_cst" + +enum tst_cgroup_ver { + TST_CGROUP_V1 = 1, + TST_CGROUP_V2 = 2, +}; + +enum tst_cgroup_ctrl { + TST_CGROUP_MEMCG = 1, + TST_CGROUP_CPUSET = 2, + /* add cgroup controller */ +}; + +enum tst_cgroup_ver tst_cgroup_version(void); + +/* To mount/umount specified cgroup controller on 'cgroup_dir' path */ +void tst_cgroup_mount(enum tst_cgroup_ctrl ctrl, const char *cgroup_dir); +void tst_cgroup_umount(const char *cgroup_dir); + +/* To move current process PID to the mounted cgroup tasks */ +void tst_cgroup_move_current(const char *cgroup_dir); + +/* To set cgroup controller knob with new value */ +void tst_cgroup_set_knob(const char *cgroup_dir, const char *knob, long value); + +/* Set of functions to set knobs under the memory controller */ +void tst_cgroup_mem_set_maxbytes(const char *cgroup_dir, long memsz); +int tst_cgroup_mem_swapacct_enabled(const char *cgroup_dir); +void tst_cgroup_mem_set_maxswap(const char *cgroup_dir, long memsz); + +/* Set of functions to read/write cpuset controller files content */ +void tst_cgroup_cpuset_read_files(const char *cgroup_dir, const char *filename, char *retbuf); +void tst_cgroup_cpuset_write_files(const char *cgroup_dir, const char *filename, const char *buf); + +#endif /* TST_CGROUP_H */ diff --git a/fsstress/include/tst_checkpoint.h b/fsstress/include/tst_checkpoint.h new file mode 100644 index 0000000000..5c8067d0dc --- /dev/null +++ b/fsstress/include/tst_checkpoint.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2016 Cyril Hrubis + */ + +#ifndef TST_CHECKPOINT__ +#define TST_CHECKPOINT__ + +#include "tst_checkpoint_fn.h" + +#define TST_CHECKPOINT_WAIT(id) \ + tst_safe_checkpoint_wait(__FILE__, __LINE__, NULL, id, 0); + +#define TST_CHECKPOINT_WAIT2(id, msec_timeout) \ + tst_safe_checkpoint_wait(__FILE__, __LINE__, NULL, id, msec_timeout); + +#define TST_CHECKPOINT_WAKE(id) \ + tst_safe_checkpoint_wake(__FILE__, __LINE__, NULL, id, 1); + +#define TST_CHECKPOINT_WAKE2(id, nr_wake) \ + tst_safe_checkpoint_wake(__FILE__, __LINE__, NULL, id, nr_wake); + +#define TST_CHECKPOINT_WAKE_AND_WAIT(id) \ + tst_safe_checkpoint_wake(__FILE__, __LINE__, NULL, id, 1); \ + tst_safe_checkpoint_wait(__FILE__, __LINE__, NULL, id, 0); + +extern const char *tst_ipc_path; + +#endif /* TST_CHECKPOINT__ */ diff --git a/fsstress/include/tst_checkpoint_fn.h b/fsstress/include/tst_checkpoint_fn.h new file mode 100644 index 0000000000..57db905c83 --- /dev/null +++ b/fsstress/include/tst_checkpoint_fn.h @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2015-2016 Cyril Hrubis + */ + +#ifndef TST_CHECKPOINT_FN__ +#define TST_CHECKPOINT_FN__ + +/* + * Checkpoint initializaton, must be done first. + * + * NOTE: tst_tmpdir() must be called beforehand. + */ +void tst_checkpoint_init(const char *file, const int lineno, + void (*cleanup_fn)(void)); + +/* + * Waits for wakeup. + * + * @id: Checkpoint id, possitive number + * @msec_timeout: Timeout in milliseconds, 0 == no timeout + */ +int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout); + +/* + * Wakes up sleeping process(es)/thread(s). + * + * @id: Checkpoint id, possitive number + * @nr_wake: Number of processes/threads to wake up + * @msec_timeout: Timeout in milliseconds, 0 == no timeout + */ +int tst_checkpoint_wake(unsigned int id, unsigned int nr_wake, + unsigned int msec_timeout); + +void tst_safe_checkpoint_wait(const char *file, const int lineno, + void (*cleanup_fn)(void), unsigned int id, + unsigned int msec_timeout); + +void tst_safe_checkpoint_wake(const char *file, const int lineno, + void (*cleanup_fn)(void), unsigned int id, + unsigned int nr_wake); + +#endif /* TST_CHECKPOINT_FN__ */ diff --git a/fsstress/include/tst_checksum.h b/fsstress/include/tst_checksum.h new file mode 100644 index 0000000000..f062869de8 --- /dev/null +++ b/fsstress/include/tst_checksum.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2018 Oracle and/or its affiliates. All Rights Reserved. + */ + +#ifndef TST_CHECKSUM_H__ +#define TST_CHECKSUM_H__ + +#include +#include + +/* + * Generates CRC32c checksum. + */ +uint32_t tst_crc32c(uint8_t *buf, size_t buf_len); + +#endif diff --git a/fsstress/include/tst_clocks.h b/fsstress/include/tst_clocks.h new file mode 100644 index 0000000000..80030c6b0c --- /dev/null +++ b/fsstress/include/tst_clocks.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2017 Cyril Hrubis + */ + +/* + * clock_gettime() and clock_getres() functions + */ + +#ifndef TST_CLOCKS__ +#define TST_CLOCKS__ + +int tst_clock_getres(clockid_t clk_id, struct timespec *res); + +int tst_clock_gettime(clockid_t clk_id, struct timespec *ts); + +int tst_clock_settime(clockid_t clk_id, struct timespec *ts); + +/* + * Converts clock id to a readable name. + */ +const char *tst_clock_name(clockid_t clk_id); + +#endif /* TST_CLOCKS__ */ diff --git a/fsstress/include/tst_clone.h b/fsstress/include/tst_clone.h new file mode 100644 index 0000000000..88188525d0 --- /dev/null +++ b/fsstress/include/tst_clone.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2016 Xiao Yang + */ + +#ifndef TST_CLONE_H__ +#define TST_CLONE_H__ + +/* Functions from lib/cloner.c */ +int ltp_clone(unsigned long flags, int (*fn)(void *arg), void *arg, + size_t stack_size, void *stack); +int ltp_clone7(unsigned long flags, int (*fn)(void *arg), void *arg, + size_t stack_size, void *stack, ...); +int ltp_clone_alloc(unsigned long clone_flags, int (*fn)(void *arg), + void *arg, size_t stacksize); +int ltp_clone_quick(unsigned long clone_flags, int (*fn)(void *arg), + void *arg); +void *ltp_alloc_stack(size_t size); + +#define clone(...) (use_the_ltp_clone_functions__do_not_use_clone) + +#endif /* TST_CLONE_H__ */ diff --git a/fsstress/include/tst_cmd.h b/fsstress/include/tst_cmd.h new file mode 100644 index 0000000000..1f39f690f3 --- /dev/null +++ b/fsstress/include/tst_cmd.h @@ -0,0 +1,94 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2015-2016 Cyril Hrubis + */ + +#ifndef TST_CMD_H__ +#define TST_CMD_H__ + +enum tst_cmd_flags { + /* + * return the program exit code, otherwise it will call cleanup_fn() if the + * program exit code is not zero. + */ + TST_CMD_PASS_RETVAL = 1, + + /* exit with TCONF if program is not in path */ + TST_CMD_TCONF_ON_MISSING = 2, +}; + +/* + * vfork() + execvp() specified program. + * @argv: a list of two (at least program name + NULL) or more pointers that + * represent the argument list to the new program. The array of pointers + * must be terminated by a NULL pointer. + * @stdout_fd: file descriptor where to redirect stdout. Set -1 if + * redirection is not needed. + * @stderr_fd: file descriptor where to redirect stderr. Set -1 if + * redirection is not needed. + * @flags: enum tst_cmd_flags + */ +int tst_cmd_fds_(void (cleanup_fn)(void), + const char *const argv[], + int stdout_fd, + int stderr_fd, + enum tst_cmd_flags flags); + +/* Executes tst_cmd_fds() and redirects its output to a file + * @stdout_path: path where to redirect stdout. Set NULL if redirection is + * not needed. + * @stderr_path: path where to redirect stderr. Set NULL if redirection is + * not needed. + * @flags: enum tst_cmd_flags + */ +int tst_cmd_(void (cleanup_fn)(void), + const char *const argv[], + const char *stdout_path, + const char *stderr_path, + enum tst_cmd_flags flags); + +#ifdef TST_TEST_H__ +static inline int tst_cmd_fds(const char *const argv[], + int stdout_fd, + int stderr_fd, + enum tst_cmd_flags flags) +{ + return tst_cmd_fds_(NULL, argv, + stdout_fd, stderr_fd, flags); +} + +static inline int tst_cmd(const char *const argv[], + const char *stdout_path, + const char *stderr_path, + enum tst_cmd_flags flags) +{ + return tst_cmd_(NULL, argv, + stdout_path, stderr_path, flags); +} +#else +static inline int tst_cmd_fds(void (cleanup_fn)(void), + const char *const argv[], + int stdout_fd, + int stderr_fd, + enum tst_cmd_flags flags) +{ + return tst_cmd_fds_(cleanup_fn, argv, + stdout_fd, stderr_fd, flags); +} + +static inline int tst_cmd(void (cleanup_fn)(void), + const char *const argv[], + const char *stdout_path, + const char *stderr_path, + enum tst_cmd_flags flags) +{ + return tst_cmd_(cleanup_fn, argv, + stdout_path, stderr_path, flags); +} +#endif + +/* Wrapper function for system(3), ignorcing SIGCHLD signal. + * @command: the command to be run. + */ +int tst_system(const char *command); + +#endif /* TST_CMD_H__ */ diff --git a/fsstress/include/tst_common.h b/fsstress/include/tst_common.h new file mode 100644 index 0000000000..fd7a900d4a --- /dev/null +++ b/fsstress/include/tst_common.h @@ -0,0 +1,86 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2016 Cyril Hrubis + * Copyright (c) 2013 Stanislav Kholmanskikh + * Copyright (c) 2010 Ngie Cooper + * Copyright (c) 2008 Mike Frysinger + */ + +#ifndef TST_COMMON_H__ +#define TST_COMMON_H__ + +#define LTP_ATTRIBUTE_NORETURN __attribute__((noreturn)) +#define LTP_ATTRIBUTE_UNUSED __attribute__((unused)) +#define LTP_ATTRIBUTE_UNUSED_RESULT __attribute__((warn_unused_result)) + +#ifndef ARRAY_SIZE +# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) +#endif + +/* Round x to the next multiple of a. + * a should be a power of 2. + */ +#define LTP_ALIGN(x, a) __LTP_ALIGN_MASK(x, (typeof(x))(a) - 1) +#define __LTP_ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask)) + +/** + * TST_RETRY_FUNC() - Repeatedly retry a function with an increasing delay. + * @FUNC - The function which will be retried + * @ECHCK - Function/macro for validating @FUNC return value + * + * This macro will call @FUNC in a loop with a delay between retries. + * If ECHCK(ret) evaluates to non-zero, the loop ends. The delay between + * retries starts at one microsecond and is then doubled each iteration until + * it exceeds one second (the total time sleeping will be approximately one + * second as well). When the delay exceeds one second, the loop will end. + * The TST_RETRY_FUNC() macro returns the last value returned by @FUNC. + */ +#define TST_RETRY_FUNC(FUNC, ECHCK) \ + TST_RETRY_FN_EXP_BACKOFF(FUNC, ECHCK, 1) + +#define TST_RETRY_FN_EXP_BACKOFF(FUNC, ECHCK, MAX_DELAY) \ +({ unsigned int tst_delay_, tst_max_delay_; \ + typeof(FUNC) tst_ret_; \ + tst_delay_ = 1; \ + tst_max_delay_ = tst_multiply_timeout(MAX_DELAY * 1000000); \ + for (;;) { \ + errno = 0; \ + tst_ret_ = FUNC; \ + if (ECHCK(tst_ret_)) \ + break; \ + if (tst_delay_ < tst_max_delay_) { \ + usleep(tst_delay_); \ + tst_delay_ *= 2; \ + } else { \ + break; \ + } \ + } \ + tst_ret_; \ +}) + +/* + * Return value validation macros for TST_RETRY_FUNC(): + * TST_RETVAL_EQ0() - Check that value is equal to zero + */ +#define TST_RETVAL_EQ0(x) (!(x)) + +/* + * TST_RETVAL_NOTNULL() - Check that value is not equal to zero/NULL + */ +#define TST_RETVAL_NOTNULL(x) (!!(x)) + +/* + * TST_RETVAL_GE0() - Check that value is greater than or equal to zero + */ +#define TST_RETVAL_GE0(x) ((x) >= 0) + +#define TST_BUILD_BUG_ON(condition) \ + do { ((void)sizeof(char[1 - 2 * !!(condition)])); } while (0) + +#define TST_BRK_SUPPORTS_ONLY_TCONF_TBROK(condition) \ + TST_BUILD_BUG_ON(condition) + +#define TST_RES_SUPPORTS_TCONF_TFAIL_TINFO_TPASS_TWARN(condition) \ + TST_BUILD_BUG_ON(condition) + +#endif /* TST_COMMON_H__ */ diff --git a/fsstress/include/tst_coredump.h b/fsstress/include/tst_coredump.h new file mode 100644 index 0000000000..e1f892544a --- /dev/null +++ b/fsstress/include/tst_coredump.h @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 Red Hat, Inc. + */ + +#ifndef TST_COREDUMP__ +#define TST_COREDUMP__ + +/* + * If crash is expected, avoid dumping corefile. + * 1 is a special value, that disables core-to-pipe. + * At the same time it is small enough value for + * core-to-file, so it skips creating cores as well. + */ +void tst_no_corefile(int verbose); + +#endif /* TST_COREDUMP_H */ + diff --git a/fsstress/include/tst_cpu.h b/fsstress/include/tst_cpu.h new file mode 100644 index 0000000000..c83a582600 --- /dev/null +++ b/fsstress/include/tst_cpu.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2015-2016 Cyril Hrubis + */ + +#ifndef TST_CPU_H__ +#define TST_CPU_H__ + +long tst_ncpus(void); +long tst_ncpus_conf(void); +long tst_ncpus_max(void); + +#define VIRT_ANY 0 /* catch-all argument for tst_is_virt() */ +#define VIRT_XEN 1 /* xen dom0/domU */ +#define VIRT_KVM 2 /* only default virtual CPU */ +#define VIRT_OTHER 0xffff /* unrecognized hypervisor */ + +int tst_is_virt(int virt_type); + +#endif /* TST_CPU_H__ */ diff --git a/fsstress/include/tst_crypto.h b/fsstress/include/tst_crypto.h new file mode 100644 index 0000000000..ae406bd04a --- /dev/null +++ b/fsstress/include/tst_crypto.h @@ -0,0 +1,112 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2018 Richard Palethorpe + */ + +/** + * @file tst_crypto.h + * + * Library for interacting with kernel's crypto layer using the netlink + * interface. + */ + +#ifndef TST_CRYPTO_H +#define TST_CRYPTO_H + +#include "lapi/cryptouser.h" + +/** + * A reference to a crypto session and associated state. + * + * Holds state relevant to a netlink crypto connection. The seq_num is used + * to tag each message sent to the netlink layer and is automatically + * incremented by the tst_crypto_ functions. When the netlink layer sends a + * response (ack) it will use the sequences number from the request. + * + * Some functions, such as delete ALG, may return EBUSY in which case it is + * safe to retry them. The retries field allows you to set the number of + * times this should be done. If set to zero the operation will only be tried + * once. For operations which do not return EBUSY, the field is ignored. + * + * Use TST_CRYPTO_SESSION_INIT to statically initialize this struct with sane + * defaults. + */ +struct tst_crypto_session { + /** File descriptor for the netlink socket */ + int fd; + /** A sequence number used to identify responses from the kernel. */ + uint32_t seq_num; + /** Number of times some operations will be retried. */ + uint32_t retries; +}; + +/** + * Default static definition of tst_crypto_session. + * + * @relates tst_crypto_session + */ +#define TST_CRYPTO_SESSION_INIT {\ + .fd = 0, \ + .seq_num = 0, \ + .retries = 1000 \ +} + +/** + * Creates a crypto session. + * + * @relates tst_crypto_session + * @param ses Session structure to use, it can be uninitialized. + * + * If some necessary feature is missing then it will call tst_brk() with + * TCONF, for any other error it will use TBROK. + */ +void tst_crypto_open(struct tst_crypto_session *ses); + +/** + * Close a crypto session. + * + * @relates tst_crypto_session + * @param ses The session to close. + */ +void tst_crypto_close(struct tst_crypto_session *ses); + +/** + * Add a crypto algorithm to a session. + * + * @relates tst_crypto_session + * @param ses An open session. + * @param alg The crypto algorithm or module to add. + * + * This requests a new crypto algorithm/engine/module to be initialized by the + * kernel. It sends the request contained in alg and then waits for a + * response. If sending the message or receiving the ack fails at the netlink + * level then tst_brk() with TBROK will be called. + * + * @return On success it will return 0 otherwise it will return an inverted + * error code from the crypto layer. + */ +int tst_crypto_add_alg(struct tst_crypto_session *ses, + const struct crypto_user_alg *alg); + +/** + * Delete a crypto algorithm from a session. + * + * @relates tst_crypto_session + * @param ses An open session. + * @param alg The crypto algorithm to delete. + * + * Request that the kernel remove an existing crypto algorithm. This behaves + * in a similar way to tst_crypto_add_alg() except that it is the inverse + * operation and that it is not unusual for the crypto layer to return + * EBUSY. If EBUSY is returned then the function will internally retry the + * operation tst_crypto_session::retries times before giving up and returning + * EBUSY. + * + * Return: Either 0 or an inverted error code from the crypto layer. If called + * during cleanup it may return a positive ENODATA value from the LTP + * library, you don't need to log this error as it will already have + * been printed by tst_brk(). + */ +int tst_crypto_del_alg(struct tst_crypto_session *ses, + const struct crypto_user_alg *alg); + +#endif /* TST_CRYPTO_H */ diff --git a/fsstress/include/tst_device.h b/fsstress/include/tst_device.h new file mode 100644 index 0000000000..6a1fc5186a --- /dev/null +++ b/fsstress/include/tst_device.h @@ -0,0 +1,94 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2016-2019 Cyril Hrubis + */ + +#ifndef TST_DEVICE_H__ +#define TST_DEVICE_H__ + +#include + +struct tst_device { + const char *dev; + const char *fs_type; +}; + +/* + * Automatically initialized if test.needs_device is set. + */ +extern struct tst_device *tst_device; + +/* + * Just like umount() but retries several times on failure. + * @path: Path to umount + */ +int tst_umount(const char *path); + +/* + * Verifies if an earlier mount is successful or not. + * @path: Mount path to verify + */ +int tst_is_mounted(const char *path); +int tst_is_mounted_at_tmpdir(const char *path); + +/* + * Clears a first few blocks of the device. This is needed when device has + * already been formatted with a filesystems, subset of mkfs.foo utils aborts + * the operation if it finds a filesystem signature there. + * + * Note that this is called from tst_mkfs() automatically, so you probably will + * not need to use this from the test yourself. + */ +int tst_clear_device(const char *dev); + +/* + * Finds a free loop device for use and returns the free loopdev minor(-1 for no + * free loopdev). If path is non-NULL, it will be filled with free loopdev path. + * + */ +int tst_find_free_loopdev(const char *path, size_t path_len); + +/* + * Attaches a file to a loop device. + * + * @dev_path Path to the loop device e.g. /dev/loop0 + * @file_path Path to a file e.g. disk.img + * @return Zero on success, non-zero otherwise. + */ +int tst_attach_device(const char *dev_path, const char *file_path); + +/* + * Detaches a file from a loop device. + * + * @dev_path Path to the loop device e.g. /dev/loop0 + * @return Zero on succes, non-zero otherwise. + */ +int tst_detach_device(const char *dev_path); + +/* + * To avoid FS deferred IO metadata/cache interference, so we do syncfs + * simply before the tst_dev_bytes_written invocation. For easy to use, + * we create this inline function tst_dev_sync. + */ +int tst_dev_sync(int fd); + +/* + * Reads test block device stat file and returns the bytes written since the + * last call of this function. + * @dev: test block device + */ +unsigned long tst_dev_bytes_written(const char *dev); + +/* + * Wipe the contents of given directory but keep the directory itself + */ +void tst_purge_dir(const char *path); + +/* + * Find the file or path belongs to which block dev + * @path Path to find the backing dev + * @dev The block dev + */ +void tst_find_backing_dev(const char *path, char *dev); + +#endif /* TST_DEVICE_H__ */ diff --git a/fsstress/include/tst_fs.h b/fsstress/include/tst_fs.h new file mode 100644 index 0000000000..fc03905820 --- /dev/null +++ b/fsstress/include/tst_fs.h @@ -0,0 +1,246 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2015-2016 Cyril Hrubis + */ + +#ifndef TST_FS_H__ +#define TST_FS_H__ + +/* man 2 statfs or kernel-source/include/linux/magic.h */ +#define TST_BTRFS_MAGIC 0x9123683E +#define TST_NFS_MAGIC 0x6969 +#define TST_RAMFS_MAGIC 0x858458f6 +#define TST_TMPFS_MAGIC 0x01021994 +#define TST_V9FS_MAGIC 0x01021997 +#define TST_XFS_MAGIC 0x58465342 +#define TST_EXT2_OLD_MAGIC 0xEF51 +/* ext2, ext3, ext4 have the same magic number */ +#define TST_EXT234_MAGIC 0xEF53 +#define TST_MINIX_MAGIC 0x137F +#define TST_MINIX_MAGIC2 0x138F +#define TST_MINIX2_MAGIC 0x2468 +#define TST_MINIX2_MAGIC2 0x2478 +#define TST_MINIX3_MAGIC 0x4D5A +#define TST_UDF_MAGIC 0x15013346 +#define TST_SYSV2_MAGIC 0x012FF7B6 +#define TST_SYSV4_MAGIC 0x012FF7B5 +#define TST_UFS_MAGIC 0x00011954 +#define TST_UFS2_MAGIC 0x19540119 +#define TST_F2FS_MAGIC 0xF2F52010 +#define TST_NILFS_MAGIC 0x3434 +#define TST_EXOFS_MAGIC 0x5DF5 +#define TST_OVERLAYFS_MAGIC 0x794c7630 + +enum { + TST_BYTES = 1, + TST_KB = 1024, + TST_MB = 1048576, + TST_GB = 1073741824, +}; + +#define OVL_BASE_MNTPOINT "mntpoint" +#define OVL_LOWER OVL_BASE_MNTPOINT"/lower" +#define OVL_UPPER OVL_BASE_MNTPOINT"/upper" +#define OVL_WORK OVL_BASE_MNTPOINT"/work" +#define OVL_MNT OVL_BASE_MNTPOINT"/ovl" + +/* + * @path: path is the pathname of any file within the mounted file system + * @mult: mult should be TST_KB, TST_MB or TST_GB + * the required free space is calculated by @size * @mult + */ +int tst_fs_has_free_(void (*cleanup)(void), const char *path, + unsigned int size, unsigned int mult); + +/* + * Returns filesystem magick for a given path. + * + * The expected usage is: + * + * if (tst_fs_type(cleanup, ".") == TST_NFS_MAGIC) { + * tst_brkm(TCONF, cleanup, + * "Test not supported on NFS filesystem"); + * } + * + * Or: + * + * long type; + * + * swtich ((type = tst_fs_type(cleanup, "."))) { + * case TST_NFS_MAGIC: + * case TST_TMPFS_MAGIC: + * case TST_RAMFS_MAGIC: + * tst_brkm(TCONF, cleanup, "Test not supported on %s filesystem", + * tst_fs_type_name(type)); + * break; + * } + */ +long tst_fs_type_(void (*cleanup)(void), const char *path); + +/* + * Returns filesystem name given magic. + */ +const char *tst_fs_type_name(long f_type); + +/* + * Try to get maximum number of hard links to a regular file inside the @dir. + * + * Note: This number depends on the filesystem @dir is on. + * + * The code uses link(2) to create hard links to a single file until it gets + * EMLINK or creates 65535 links. + * + * If limit is hit maximal number of hardlinks is returned and the the @dir is + * filled with hardlinks in format "testfile%i" where i belongs to [0, limit) + * interval. + * + * If no limit is hit (succed to create 65535 without error) or if link() + * failed with ENOSPC or EDQUOT zero is returned previously created files are + * removed. + */ +int tst_fs_fill_hardlinks_(void (*cleanup) (void), const char *dir); + +/* + * Try to get maximum number of subdirectories in directory. + * + * Note: This number depends on the filesystem @dir is on. + * + * The code uses mkdir(2) to create directories in @dir until it gets EMLINK + * or creates 65535 directories. + * + * If limit is hit the maximal number of subdirectories is returned and the + * @dir is filled with subdirectories in format "testdir%i" where i belongs to + * [0, limit - 2) interval (because each newly created dir has two links + * already the '.' and link from parent dir). + * + * If no limit is hit or mkdir() failed with ENOSPC or EDQUOT zero is returned + * previously created directories are removed. + * + */ +int tst_fs_fill_subdirs_(void (*cleanup) (void), const char *dir); + +/* + * Checks if a given directory contains any entities, + * returns 1 if directory is empty, 0 otherwise + */ +int tst_dir_is_empty_(void (*cleanup)(void), const char *name, int verbose); + +/* + * Search $PATH for prog_name and fills buf with absolute path if found. + * + * Returns -1 on failure, either command was not found or buffer was too small. + */ +int tst_get_path(const char *prog_name, char *buf, size_t buf_len); + +/* + * Fill a file with specified pattern + * @fd: file descriptor + * @pattern: pattern + * @bs: block size + * @bcount: blocks count + */ +int tst_fill_fd(int fd, char pattern, size_t bs, size_t bcount); + +/* + * Preallocate space in open file. If fallocate() fails, falls back to + * using tst_fill_fd(). + * @fd: file descriptor + * @bs: block size + * @bcount: blocks count + */ +int tst_prealloc_size_fd(int fd, size_t bs, size_t bcount); + +/* + * Creates/ovewrites a file with specified pattern + * @path: path to file + * @pattern: pattern + * @bs: block size + * @bcount: blocks amount + */ +int tst_fill_file(const char *path, char pattern, size_t bs, size_t bcount); + +/* + * Creates file of specified size. Space will be only preallocated if possible. + * @path: path to file + * @bs: block size + * @bcount: blocks amount + */ +int tst_prealloc_file(const char *path, size_t bs, size_t bcount); + +#define TST_FS_SKIP_FUSE 0x01 + +/* + * Return 1 if a specified fiilsystem is supported + * Return 0 if a specified fiilsystem isn't supported + */ +int tst_fs_is_supported(const char *fs_type, int flags); + +/* + * Returns NULL-terminated array of kernel-supported filesystems. + */ +const char **tst_get_supported_fs_types(int flags); + +/* + * Creates and writes to files on given path until write fails with ENOSPC + */ +void tst_fill_fs(const char *path, int verbose); + +/* + * test if FIBMAP ioctl is supported + */ +int tst_fibmap(const char *filename); + +#ifdef TST_TEST_H__ +static inline long tst_fs_type(const char *path) +{ + return tst_fs_type_(NULL, path); +} + +static inline int tst_fs_has_free(const char *path, unsigned int size, + unsigned int mult) +{ + return tst_fs_has_free_(NULL, path, size, mult); +} + +static inline int tst_fs_fill_hardlinks(const char *dir) +{ + return tst_fs_fill_hardlinks_(NULL, dir); +} + +static inline int tst_fs_fill_subdirs(const char *dir) +{ + return tst_fs_fill_subdirs_(NULL, dir); +} + +static inline int tst_dir_is_empty(const char *name, int verbose) +{ + return tst_dir_is_empty_(NULL, name, verbose); +} +#else +static inline long tst_fs_type(void (*cleanup)(void), const char *path) +{ + return tst_fs_type_(cleanup, path); +} + +static inline int tst_fs_has_free(void (*cleanup)(void), const char *path, + unsigned int size, unsigned int mult) +{ + return tst_fs_has_free_(cleanup, path, size, mult); +} + +static inline int tst_fs_fill_hardlinks(void (*cleanup)(void), const char *dir) +{ + return tst_fs_fill_hardlinks_(cleanup, dir); +} + +static inline int tst_fs_fill_subdirs(void (*cleanup)(void), const char *dir) +{ + return tst_fs_fill_subdirs_(cleanup, dir); +} + +static inline int tst_dir_is_empty(void (*cleanup)(void), const char *name, int verbose) +{ + return tst_dir_is_empty_(cleanup, name, verbose); +} +#endif + +#endif /* TST_FS_H__ */ diff --git a/fsstress/include/tst_fuzzy_sync.h b/fsstress/include/tst_fuzzy_sync.h new file mode 100644 index 0000000000..4141f5c646 --- /dev/null +++ b/fsstress/include/tst_fuzzy_sync.h @@ -0,0 +1,776 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2017-2018 Richard Palethorpe + */ +/** + * @file tst_fuzzy_sync.h + * Fuzzy Synchronisation - abbreviated to fzsync + * + * This library is intended to help reproduce race conditions by synchronising + * two threads at a given place by marking the range a race may occur + * in. Because the exact place where any race occurs is within the kernel, + * and therefore impossible to mark accurately, the library may add randomised + * delays to either thread in order to help find the exact race timing. + * + * Currently only two way races are explicitly supported, that is races + * involving two threads or processes. We refer to the main test thread as + * thread A and the child thread as thread B. + * + * In each thread you need a simple while- or for-loop which the tst_fzsync_* + * functions are called in. In the simplest case thread A will look something + * like: + * + * tst_fzsync_pair_reset(&pair, run_thread_b); + * while (tst_fzsync_run_a(&pair)) { + * // Perform some setup which must happen before the race + * tst_fzsync_start_race_a(&pair); + * // Do some dodgy syscall + * tst_fzsync_end_race_a(&pair); + * } + * + * Then in thread B (run_thread_b): + * + * while (tst_fzsync_run_b(&pair)) { + * tst_fzsync_start_race_b(&pair); + * // Do something which can race with the dodgy syscall in A + * tst_fzsync_end_race_b(&pair) + * } + * + * The calls to tst_fzsync_start/end_race and tst_fzsync_run_a/b block (at + * least) until both threads have enter them. These functions can only be + * called once for each iteration, but further synchronisation points can be + * added by calling tst_fzsync_wait_a() and tst_fzsync_wait_b() in each + * thread. + * + * The execution of the loops in threads A and B are bounded by both iteration + * count and time. A slow machine is likely to be limited by time and a fast + * one by iteration count. The user can use the -i parameter to run the test + * multiple times or LTP_TIMEOUT_MUL to give the test more time. + * + * It is possible to use the library just for tst_fzsync_pair_wait() to get a + * basic spin wait. However if you are actually testing a race condition then + * it is recommended to use tst_fzsync_start_race_a/b even if the + * randomisation is not needed. It provides some semantic information which + * may be useful in the future. + * + * For a usage example see testcases/cve/cve-2016-7117.c or just run + * 'git grep tst_fuzzy_sync.h' + * + * @sa tst_fzsync_pair + */ + +#include +#include +#include +#include +#include +#include "tst_atomic.h" +#include "tst_timer.h" +#include "tst_safe_pthread.h" + +#ifndef TST_FUZZY_SYNC_H__ +#define TST_FUZZY_SYNC_H__ + +/* how much of exec time is sampling allowed to take */ +#define SAMPLING_SLICE 0.5f + +/** Some statistics for a variable */ +struct tst_fzsync_stat { + float avg; + float avg_dev; + float dev_ratio; +}; + +/** + * The state of a two way synchronisation or race. + * + * This contains all the necessary state for approximately synchronising two + * sections of code in different threads. + * + * Some of the fields can be configured before calling + * tst_fzsync_pair_reset(), however this is mainly for debugging purposes. If + * a test requires one of the parameters to be modified, we should consider + * finding a way of automatically selecting an appropriate value at runtime. + * + * Internal fields should only be accessed by library functions. + */ +struct tst_fzsync_pair { + /** + * The rate at which old diff samples are forgotten + * + * Defaults to 0.25. + */ + float avg_alpha; + /** Internal; Thread A start time */ + struct timespec a_start; + /** Internal; Thread B start time */ + struct timespec b_start; + /** Internal; Thread A end time */ + struct timespec a_end; + /** Internal; Thread B end time */ + struct timespec b_end; + /** Internal; Avg. difference between a_start and b_start */ + struct tst_fzsync_stat diff_ss; + /** Internal; Avg. difference between a_start and a_end */ + struct tst_fzsync_stat diff_sa; + /** Internal; Avg. difference between b_start and b_end */ + struct tst_fzsync_stat diff_sb; + /** Internal; Avg. difference between a_end and b_end */ + struct tst_fzsync_stat diff_ab; + /** Internal; Number of spins while waiting for the slower thread */ + int spins; + struct tst_fzsync_stat spins_avg; + /** + * Internal; Number of spins to use in the delay. + * + * A negative value delays thread A and a positive delays thread B. + */ + int delay; + int delay_bias; + /** + * Internal; The number of samples left or the sampling state. + * + * A positive value is the number of remaining mandatory + * samples. Zero or a negative indicate some other state. + */ + int sampling; + /** + * The Minimum number of statistical samples which must be collected. + * + * The minimum number of iterations which must be performed before a + * random delay can be calculated. Defaults to 1024. + */ + int min_samples; + /** + * The maximum allowed proportional average deviation. + * + * A value in the range (0, 1) which gives the maximum average + * deviation which must be attained before random delays can be + * calculated. + * + * It is a ratio of (average_deviation / total_time). The default is + * 0.1, so this allows an average deviation of at most 10%. + */ + float max_dev_ratio; + + /** Internal; Atomic counter used by fzsync_pair_wait() */ + int a_cntr; + /** Internal; Atomic counter used by fzsync_pair_wait() */ + int b_cntr; + /** Internal; Used by tst_fzsync_pair_exit() and fzsync_pair_wait() */ + int exit; + /** + * The maximum desired execution time as a proportion of the timeout + * + * A value x so that 0 < x < 1 which decides how long the test should + * be run for (assuming the loop limit is not exceeded first). + * + * Defaults to 0.5 (~150 seconds with default timeout). + */ + float exec_time_p; + /** Internal; The test time remaining on tst_fzsync_pair_reset() */ + float exec_time_start; + /** + * The maximum number of iterations to execute during the test + * + * Defaults to a large number, but not too large. + */ + int exec_loops; + /** Internal; The current loop index */ + int exec_loop; + /** Internal; The second thread or 0 */ + pthread_t thread_b; +}; + +#define CHK(param, low, hi, def) do { \ + pair->param = (pair->param ? pair->param : def); \ + if (pair->param < low) \ + tst_brk(TBROK, #param " is less than the lower bound " #low); \ + if (pair->param > hi) \ + tst_brk(TBROK, #param " is more than the upper bound " #hi); \ + } while (0) +/** + * Ensures that any Fuzzy Sync parameters are properly set + * + * @relates tst_fzsync_pair + * + * Usually called from the setup function, it sets default parameter values or + * validates any existing non-defaults. + * + * @sa tst_fzsync_pair_reset() + */ +static void tst_fzsync_pair_init(struct tst_fzsync_pair *pair) +{ + CHK(avg_alpha, 0, 1, 0.25); + CHK(min_samples, 20, INT_MAX, 1024); + CHK(max_dev_ratio, 0, 1, 0.1); + CHK(exec_time_p, 0, 1, 0.5); + CHK(exec_loops, 20, INT_MAX, 3000000); +} +#undef CHK + +/** + * Exit and join thread B if necessary. + * + * @relates tst_fzsync_pair + * + * Call this from your cleanup function. + */ +static void tst_fzsync_pair_cleanup(struct tst_fzsync_pair *pair) +{ + if (pair->thread_b) { + /* Revoke thread B if parent hits accidental break */ + if (!pair->exit) { + tst_atomic_store(1, &pair->exit); + usleep(100000); + pthread_cancel(pair->thread_b); + } + SAFE_PTHREAD_JOIN(pair->thread_b, NULL); + pair->thread_b = 0; + } +} + +/** To store the run_b pointer and pass to tst_fzsync_thread_wrapper */ +struct tst_fzsync_run_thread { + void *(*func)(void *); + void *arg; +}; + +/** + * Wrap run_b for tst_fzsync_pair_reset to enable pthread cancel + * at the start of the thread B. + */ +static void *tst_fzsync_thread_wrapper(void *run_thread) +{ + struct tst_fzsync_run_thread t = *(struct tst_fzsync_run_thread *)run_thread; + + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + return t.func(t.arg); +} + +/** + * Zero some stat fields + * + * @relates tst_fzsync_stat + */ +static void tst_init_stat(struct tst_fzsync_stat *s) +{ + s->avg = 0; + s->avg_dev = 0; +} + +/** + * Reset or initialise fzsync. + * + * @relates tst_fzsync_pair + * @param pair The state structure initialised with TST_FZSYNC_PAIR_INIT. + * @param run_b The function defining thread B or NULL. + * + * Call this from your main test function (thread A), just before entering the + * main loop. It will (re)set any variables needed by fzsync and (re)start + * thread B using the function provided. + * + * If you need to use fork or clone to start the second thread/process then + * you can pass NULL to run_b and handle starting and stopping thread B + * yourself. You may need to place tst_fzsync_pair in some shared memory as + * well. + * + * @sa tst_fzsync_pair_init() + */ +static void tst_fzsync_pair_reset(struct tst_fzsync_pair *pair, + void *(*run_b)(void *)) +{ + tst_fzsync_pair_cleanup(pair); + + tst_init_stat(&pair->diff_ss); + tst_init_stat(&pair->diff_sa); + tst_init_stat(&pair->diff_sb); + tst_init_stat(&pair->diff_ab); + tst_init_stat(&pair->spins_avg); + pair->delay = 0; + pair->sampling = pair->min_samples; + + pair->exec_loop = 0; + + pair->a_cntr = 0; + pair->b_cntr = 0; + pair->exit = 0; + if (run_b) { + static struct tst_fzsync_run_thread wrap_run_b; + + wrap_run_b.func = run_b; + wrap_run_b.arg = NULL; + SAFE_PTHREAD_CREATE(&pair->thread_b, 0, tst_fzsync_thread_wrapper, &wrap_run_b); + } + + pair->exec_time_start = (float)tst_timeout_remaining(); +} + +/** + * Print stat + * + * @relates tst_fzsync_stat + */ +static inline void tst_fzsync_stat_info(struct tst_fzsync_stat stat, + char *unit, char *name) +{ + tst_res(TINFO, + "%1$-17s: { avg = %3$5.0f%2$s, avg_dev = %4$5.0f%2$s, dev_ratio = %5$.2f }", + name, unit, stat.avg, stat.avg_dev, stat.dev_ratio); +} + +/** + * Print some synchronisation statistics + * + * @relates tst_fzsync_pair + */ +static void tst_fzsync_pair_info(struct tst_fzsync_pair *pair) +{ + tst_res(TINFO, "loop = %d, delay_bias = %d", + pair->exec_loop, pair->delay_bias); + tst_fzsync_stat_info(pair->diff_ss, "ns", "start_a - start_b"); + tst_fzsync_stat_info(pair->diff_sa, "ns", "end_a - start_a"); + tst_fzsync_stat_info(pair->diff_sb, "ns", "end_b - start_b"); + tst_fzsync_stat_info(pair->diff_ab, "ns", "end_a - end_b"); + tst_fzsync_stat_info(pair->spins_avg, " ", "spins"); +} + +/** Wraps clock_gettime */ +static inline void tst_fzsync_time(struct timespec *t) +{ +#ifdef CLOCK_MONOTONIC_RAW + clock_gettime(CLOCK_MONOTONIC_RAW, t); +#else + clock_gettime(CLOCK_MONOTONIC, t); +#endif +} + +/** + * Exponential moving average + * + * @param alpha The preference for recent samples over old ones. + * @param sample The current sample + * @param prev_avg The average of the all the previous samples + * + * @return The average including the current sample. + */ +static inline float tst_exp_moving_avg(float alpha, + float sample, + float prev_avg) +{ + return alpha * sample + (1.0 - alpha) * prev_avg; +} + +/** + * Update a stat with a new sample + * + * @relates tst_fzsync_stat + */ +static inline void tst_upd_stat(struct tst_fzsync_stat *s, + float alpha, + float sample) +{ + s->avg = tst_exp_moving_avg(alpha, sample, s->avg); + s->avg_dev = tst_exp_moving_avg(alpha, + fabs(s->avg - sample), s->avg_dev); + s->dev_ratio = fabs(s->avg ? s->avg_dev / s->avg : 0); +} + +/** + * Update a stat with a new diff sample + * + * @relates tst_fzsync_stat + */ +static inline void tst_upd_diff_stat(struct tst_fzsync_stat *s, + float alpha, + struct timespec t1, + struct timespec t2) +{ + tst_upd_stat(s, alpha, tst_timespec_diff_ns(t1, t2)); +} + +/** + * Calculate various statistics and the delay + * + * This function helps create the fuzz in fuzzy sync. Imagine we have the + * following timelines in threads A and B: + * + * start_race_a + * ^ end_race_a (a) + * | ^ + * | | + * - --+------------------------+-- - - + * | Syscall A | Thread A + * - --+------------------------+-- - - + * - --+----------------+-------+-- - - + * | Syscall B | spin | Thread B + * - --+----------------+-------+-- - - + * | | + * ^ ^ + * start_race_b end_race_b + * + * Here we have synchronised the calls to syscall A and B with start_race_{a, + * b} so that they happen at approximately the same time in threads A and + * B. If the race condition occurs during the entry code for these two + * functions then we will quickly hit it. If it occurs during the exit code of + * B and mid way through A, then we will quickly hit it. + * + * However if the exit paths of A and B need to be aligned and (end_race_a - + * end_race_b) is large relative to the variation in call times, the + * probability of hitting the race condition is close to zero. To solve this + * scenario (and others) a randomised delay is introduced before the syscalls + * in A and B. Given enough time the following should happen where the exit + * paths are now synchronised: + * + * start_race_a + * ^ end_race_a (a) + * | ^ + * | | + * - --+------------------------+-- - - + * | Syscall A | Thread A + * - --+------------------------+-- - - + * - --+-------+----------------+-- - - + * | delay | Syscall B | Thread B + * - --+-------+----------------+-- - - + * | | + * ^ ^ + * start_race_b end_race_b + * + * The delay is not introduced immediately and the delay range is only + * calculated once the average relative deviation has dropped below some + * percentage of the total time. + * + * The delay range is chosen so that any point in Syscall A could be + * synchronised with any point in Syscall B using a value from the + * range. Because the delay range may be too large for a linear search, we use + * an evenly distributed random function to pick a value from it. + * + * The delay range goes from positive to negative. A negative delay will delay + * thread A and a positive one will delay thread B. The range is bounded by + * the point where the entry code to Syscall A is synchronised with the exit + * to Syscall B and the entry code to Syscall B is synchronised with the exit + * of A. + * + * In order to calculate the lower bound (the max delay of A) we can simply + * negate the execution time of Syscall B and convert it to a spin count. For + * the upper bound (the max delay of B), we just take the execution time of A + * and convert it to a spin count. + * + * In order to calculate spin count we need to know approximately how long a + * spin takes and divide the delay time with it. We find this by first + * counting how many spins one thread spends waiting for the other during + * end_race[1]. We also know when each syscall exits so we can take the + * difference between the exit times and divide it with the number of spins + * spent waiting. + * + * All the times and counts we use in the calculation are averaged over a + * variable number of iterations. There is an initial sampling period where we + * simply collect time and count samples then calculate their averages. When a + * minimum number of samples have been collected, and if the average deviation + * is below some proportion of the average sample magnitude, then the sampling + * period is ended. On all further iterations a random delay is calculated and + * applied, but the averages are not updated. + * + * [1] This assumes there is always a significant difference. The algorithm + * may fail to introduce a delay (when one is needed) in situations where + * Syscall A and B finish at approximately the same time. + * + * @relates tst_fzsync_pair + */ +static void tst_fzsync_pair_update(struct tst_fzsync_pair *pair) +{ + float alpha = pair->avg_alpha; + float per_spin_time, time_delay; + float max_dev = pair->max_dev_ratio; + int over_max_dev; + + pair->delay = pair->delay_bias; + + over_max_dev = pair->diff_ss.dev_ratio > max_dev + || pair->diff_sa.dev_ratio > max_dev + || pair->diff_sb.dev_ratio > max_dev + || pair->diff_ab.dev_ratio > max_dev + || pair->spins_avg.dev_ratio > max_dev; + + if (pair->sampling > 0 || over_max_dev) { + tst_upd_diff_stat(&pair->diff_ss, alpha, + pair->a_start, pair->b_start); + tst_upd_diff_stat(&pair->diff_sa, alpha, + pair->a_end, pair->a_start); + tst_upd_diff_stat(&pair->diff_sb, alpha, + pair->b_end, pair->b_start); + tst_upd_diff_stat(&pair->diff_ab, alpha, + pair->a_end, pair->b_end); + tst_upd_stat(&pair->spins_avg, alpha, pair->spins); + if (pair->sampling > 0 && --pair->sampling == 0) { + tst_res(TINFO, "Minimum sampling period ended"); + tst_fzsync_pair_info(pair); + } + } else if (fabsf(pair->diff_ab.avg) >= 1) { + per_spin_time = fabsf(pair->diff_ab.avg) / MAX(pair->spins_avg.avg, 1.0f); + time_delay = drand48() * (pair->diff_sa.avg + pair->diff_sb.avg) + - pair->diff_sb.avg; + pair->delay += (int)(1.1 * time_delay / per_spin_time); + + if (!pair->sampling) { + tst_res(TINFO, + "Reached deviation ratios < %.2f, introducing randomness", + pair->max_dev_ratio); + tst_res(TINFO, "Delay range is [-%d, %d]", + (int)(pair->diff_sb.avg / per_spin_time) + pair->delay_bias, + (int)(pair->diff_sa.avg / per_spin_time) - pair->delay_bias); + tst_fzsync_pair_info(pair); + pair->sampling = -1; + } + } else if (!pair->sampling) { + tst_res(TWARN, "Can't calculate random delay"); + tst_fzsync_pair_info(pair); + pair->sampling = -1; + } + + pair->spins = 0; +} + +/** + * Wait for the other thread + * + * @relates tst_fzsync_pair + * @param our_cntr The counter for the thread we are on + * @param other_cntr The counter for the thread we are synchronising with + * @param spins A pointer to the spin counter or NULL + * + * Used by tst_fzsync_pair_wait_a(), tst_fzsync_pair_wait_b(), + * tst_fzsync_start_race_a(), etc. If the calling thread is ahead of the other + * thread, then it will spin wait. Unlike pthread_barrier_wait it will never + * use futex and can count the number of spins spent waiting. + * + * @return A non-zero value if the thread should continue otherwise the + * calling thread should exit. + */ +static inline void tst_fzsync_pair_wait(int *our_cntr, + int *other_cntr, + int *spins) +{ + if (tst_atomic_inc(other_cntr) == INT_MAX) { + /* + * We are about to break the invariant that the thread with + * the lowest count is in front of the other. So we must wait + * here to ensure the other thread has at least reached the + * line above before doing that. If we are in rear position + * then our counter may already have been set to zero. + */ + while (tst_atomic_load(our_cntr) > 0 + && tst_atomic_load(our_cntr) < INT_MAX) { + if (spins) + (*spins)++; + } + + tst_atomic_store(0, other_cntr); + /* + * Once both counters have been set to zero the invariant + * is restored and we can continue. + */ + while (tst_atomic_load(our_cntr) > 1) + ; + } else { + /* + * If our counter is less than the other thread's we are ahead + * of it and need to wait. + */ + while (tst_atomic_load(our_cntr) < tst_atomic_load(other_cntr)) { + if (spins) + (*spins)++; + } + } +} + +/** + * Wait in thread A + * + * @relates tst_fzsync_pair + * @sa tst_fzsync_pair_wait + */ +static inline void tst_fzsync_wait_a(struct tst_fzsync_pair *pair) +{ + tst_fzsync_pair_wait(&pair->a_cntr, &pair->b_cntr, NULL); +} + +/** + * Wait in thread B + * + * @relates tst_fzsync_pair + * @sa tst_fzsync_pair_wait + */ +static inline void tst_fzsync_wait_b(struct tst_fzsync_pair *pair) +{ + tst_fzsync_pair_wait(&pair->b_cntr, &pair->a_cntr, NULL); +} + +/** + * Decide whether to continue running thread A + * + * @relates tst_fzsync_pair + * + * Checks some values and decides whether it is time to break the loop of + * thread A. + * + * @return True to continue and false to break. + * @sa tst_fzsync_run_a + */ +static inline int tst_fzsync_run_a(struct tst_fzsync_pair *pair) +{ + int exit = 0; + float rem_p = 1 - tst_timeout_remaining() / pair->exec_time_start; + + if ((pair->exec_time_p * SAMPLING_SLICE < rem_p) + && (pair->sampling > 0)) { + tst_res(TINFO, "Stopped sampling at %d (out of %d) samples, " + "sampling time reached 50%% of the total time limit", + pair->exec_loop, pair->min_samples); + pair->sampling = 0; + tst_fzsync_pair_info(pair); + } + + if (pair->exec_time_p < rem_p) { + tst_res(TINFO, + "Exceeded execution time, requesting exit"); + exit = 1; + } + + if (++pair->exec_loop > pair->exec_loops) { + tst_res(TINFO, + "Exceeded execution loops, requesting exit"); + exit = 1; + } + + tst_atomic_store(exit, &pair->exit); + tst_fzsync_wait_a(pair); + + if (exit) { + tst_fzsync_pair_cleanup(pair); + return 0; + } + + return 1; +} + +/** + * Decide whether to continue running thread B + * + * @relates tst_fzsync_pair + * @sa tst_fzsync_run_a + */ +static inline int tst_fzsync_run_b(struct tst_fzsync_pair *pair) +{ + tst_fzsync_wait_b(pair); + return !tst_atomic_load(&pair->exit); +} + +/** + * Marks the start of a race region in thread A + * + * @relates tst_fzsync_pair + * + * This should be placed just before performing whatever action can cause a + * race condition. Usually it is placed just before a syscall and + * tst_fzsync_end_race_a() is placed just afterwards. + * + * A corresponding call to tst_fzsync_start_race_b() should be made in thread + * B. + * + * @return A non-zero value if the calling thread should continue to loop. If + * it returns zero then tst_fzsync_exit() has been called and you must exit + * the thread. + * + * @sa tst_fzsync_pair_update + */ +static inline void tst_fzsync_start_race_a(struct tst_fzsync_pair *pair) +{ + volatile int delay; + + tst_fzsync_pair_update(pair); + + tst_fzsync_wait_a(pair); + + delay = pair->delay; + while (delay < 0) + delay++; + + tst_fzsync_time(&pair->a_start); +} + +/** + * Marks the end of a race region in thread A + * + * @relates tst_fzsync_pair + * @sa tst_fzsync_start_race_a + */ +static inline void tst_fzsync_end_race_a(struct tst_fzsync_pair *pair) +{ + tst_fzsync_time(&pair->a_end); + tst_fzsync_pair_wait(&pair->a_cntr, &pair->b_cntr, &pair->spins); +} + +/** + * Marks the start of a race region in thread B + * + * @relates tst_fzsync_pair + * @sa tst_fzsync_start_race_a + */ +static inline void tst_fzsync_start_race_b(struct tst_fzsync_pair *pair) +{ + volatile int delay; + + tst_fzsync_wait_b(pair); + + delay = pair->delay; + while (delay > 0) + delay--; + + tst_fzsync_time(&pair->b_start); +} + +/** + * Marks the end of a race region in thread B + * + * @relates tst_fzsync_pair + * @sa tst_fzsync_start_race_a + */ +static inline void tst_fzsync_end_race_b(struct tst_fzsync_pair *pair) +{ + tst_fzsync_time(&pair->b_end); + tst_fzsync_pair_wait(&pair->b_cntr, &pair->a_cntr, &pair->spins); +} + +/** + * Add some amount to the delay bias + * + * @relates tst_fzsync_pair + * @param change The amount to add, can be negative + * + * A positive change delays thread B and a negative one delays thread + * A. + * + * It is intended to be used in tests where the time taken by syscall A and/or + * B are significantly affected by their chronological order. To the extent + * that the delay range will not include the correct values if too many of the + * initial samples are taken when the syscalls (or operations within the + * syscalls) happen in the wrong order. + * + * An example of this is cve/cve-2016-7117.c where a call to close() is racing + * with a call to recvmmsg(). If close() happens before recvmmsg() has chance + * to check if the file descriptor is open then recvmmsg() completes very + * quickly. If the call to close() happens once recvmmsg() has already checked + * the descriptor it takes much longer. The sample where recvmmsg() completes + * quickly is essentially invalid for our purposes. The test uses the simple + * heuristic of whether recvmmsg() returns EBADF, to decide if it should call + * tst_fzsync_pair_add_bias() to further delay syscall B. + */ +static inline void tst_fzsync_pair_add_bias(struct tst_fzsync_pair *pair, int change) +{ + if (pair->sampling > 0) + pair->delay_bias += change; +} + +#endif /* TST_FUZZY_SYNC_H__ */ diff --git a/fsstress/include/tst_get_bad_addr.h b/fsstress/include/tst_get_bad_addr.h new file mode 100644 index 0000000000..69d7402098 --- /dev/null +++ b/fsstress/include/tst_get_bad_addr.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. + * Author: Xiao Yang + */ + +#ifndef TST_GET_BAD_ADDR_H__ +#define TST_GET_BAD_ADDR_H__ + +/* Functions from lib/tst_get_bad_addr.c */ +void *tst_get_bad_addr(void (*cleanup_fn) (void)); + +#endif /* TST_GET_BAD_ADDR_H__ */ diff --git a/fsstress/include/tst_hugepage.h b/fsstress/include/tst_hugepage.h new file mode 100644 index 0000000000..e08a2daa24 --- /dev/null +++ b/fsstress/include/tst_hugepage.h @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 Red Hat, Inc. + */ + +#ifndef TST_HUGEPAGE__ +#define TST_HUGEPAGE__ + +#define PATH_HUGEPAGES "/sys/kernel/mm/hugepages/" +#define PATH_NR_HPAGES "/proc/sys/vm/nr_hugepages" + +extern char *nr_opt; /* -s num Set the number of the been allocated hugepages */ +extern char *Hopt; /* -H /.. Location of hugetlbfs, i.e. -H /var/hugetlbfs */ + +/* + * Get the default hugepage size. Returns 0 if hugepages are not supported. + */ +size_t tst_get_hugepage_size(void); + +/* + * Try the best to request a specified number of huge pages from system, + * it will store the reserved hpage number in tst_hugepages. + * + * Note: this depend on the status of system memory fragmentation. + */ +unsigned long tst_request_hugepages(unsigned long hpages); + +/* + * This variable is used for recording the number of hugepages which system can + * provides. It will be equal to 'hpages' if tst_request_hugepages on success, + * otherwise set it to a number of hugepages that we were able to reserve. + * + * If system does not support hugetlb, then it will be set to 0. + */ +extern unsigned long tst_hugepages; + +#endif /* TST_HUGEPAGE_H */ diff --git a/fsstress/include/tst_kconfig.h b/fsstress/include/tst_kconfig.h new file mode 100644 index 0000000000..2d2cfd782f --- /dev/null +++ b/fsstress/include/tst_kconfig.h @@ -0,0 +1,56 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2018 Cyril Hrubis + */ + +#ifndef TST_KCONFIG_H__ +#define TST_KCONFIG_H__ + +struct tst_kconfig_res { + char match; + char *value; +}; + +/** + * Reads a kernel config and parses it for values defined in kconfigs array. + * + * The path to the kernel config should be autodetected in most of the cases as + * the code looks for know locations. It can be explicitely set/overrided with + * the KCONFIG_PATH environment variable as well. + * + * The kcofings array is expected to contain strings in a format "CONFIG_FOO" + * or "CONFIG_FOO=bar". The result array has to be suitably sized to fit the + * results. + * + * @param kconfigs array of config strings to look for + * @param results array to store results to + * @param cnt size of the arrays + * + * The match in the tst_kconfig_res structure is set as follows: + * + * 'm' - config option set to m + * 'y' - config option set to y + * 'v' - config option set to other value + * 'n' - config option is not set + * 0 - config option not found + * + * In the case that match is set to 'v' the value points to a newly allocated + * string that holds the value. + */ +void tst_kconfig_read(const char *const kconfigs[], + struct tst_kconfig_res results[], size_t cnt); + +/** + * Checks if required kernel configuration options are set in the kernel + * config and exits the test with TCONF if at least one is missing. + * + * The config options can be passed in two different formats, either + * "CONFIG_FOO" in which case the option has to be set in order to continue the + * test or with an explicit value "CONFIG_FOO=bar" in which case the value has + * to match. + * + * @param kconfigs NULL-terminated array of config strings needed for the testrun. + */ +void tst_kconfig_check(const char *const kconfigs[]); + +#endif /* TST_KCONFIG_H__ */ diff --git a/fsstress/include/tst_kernel.h b/fsstress/include/tst_kernel.h new file mode 100644 index 0000000000..71ab9466b0 --- /dev/null +++ b/fsstress/include/tst_kernel.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2017 Cyril Hrubis + */ + +#ifndef TST_KERNEL_H__ +#define TST_KERNEL_H__ + +/* + * Returns 32 if we are running on 32bit kernel and 64 if on 64bit kernel. + */ +int tst_kernel_bits(void); + +/** + * Checks support for the kernel driver. + * + * @param name The name of the driver. + * @return Returns 0 if the kernel has the driver or modprobe is missing. + */ +int tst_check_driver(const char *name); + +#endif /* TST_KERNEL_H__ */ diff --git a/fsstress/include/tst_kvercmp.h b/fsstress/include/tst_kvercmp.h new file mode 100644 index 0000000000..5bf1169f90 --- /dev/null +++ b/fsstress/include/tst_kvercmp.h @@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2009-2016 Cyril Hrubis chrubis@suse.cz + */ + +#ifndef TST_KVERCMP_H__ +#define TST_KVERCMP_H__ + +/* + * The same as tst_kvercmp() but running kernel version is passed as parameter + * instead of utilizing uname(). + */ +int tst_kvcmp(const char *cur_kver, int r1, int r2, int r3); + +/* + * Parsers string into three integer version. + */ +int tst_parse_kver(const char *str_kver, int *v1, int *v2, int *v3); + +/* + * Returns distribution name parsed from kernel version string or NULL. + */ +const char *tst_kvcmp_distname(const char *cur_kver); + +/* + * Compares versions up to five version numbers long. + */ +int tst_kvexcmp(const char *tst_exv, const char *cur_kver); + +/* + * Compare given kernel version with currently running kernel. + * + * Returns negative if older, 0 if the smame and possitive if newer. + */ +int tst_kvercmp(int r1, int r2, int r3); + +struct tst_kern_exv { + char *dist_name; + char *extra_ver; +}; + +int tst_kvercmp2(int r1, int r2, int r3, struct tst_kern_exv *vers); + +#endif /* TST_KVERCMP_H__ */ diff --git a/fsstress/include/tst_minmax.h b/fsstress/include/tst_minmax.h new file mode 100644 index 0000000000..6417dd703e --- /dev/null +++ b/fsstress/include/tst_minmax.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2017 Cyril Hrubis + */ + +#ifndef TST_MINMAX_H__ +#define TST_MINMAX_H__ + +#ifndef MIN +# define MIN(a, b) ({ \ + typeof(a) _a = (a); \ + typeof(b) _b = (b); \ + _a < _b ? _a : _b; \ +}) +#endif /* MIN */ + +#ifndef MAX +# define MAX(a, b) ({ \ + typeof(a) _a = (a); \ + typeof(b) _b = (b); \ + _a > _b ? _a : _b; \ +}) +#endif /* MAX */ + +#endif /* TST_MINMAX_H__ */ diff --git a/fsstress/include/tst_mkfs.h b/fsstress/include/tst_mkfs.h new file mode 100644 index 0000000000..b89bf812f6 --- /dev/null +++ b/fsstress/include/tst_mkfs.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2016 Cyril Hrubis + */ + +#ifndef TST_MKFS_H__ +#define TST_MKFS_H__ + +/* + * @dev: path to a device + * @fs_type: filesystem type + * @fs_opts: NULL or NULL terminated array of extra mkfs options + * @extra_opts: NULL or NULL terminated array of extra mkfs options + */ +void tst_mkfs_(const char *file, const int lineno, void (cleanup_fn)(void), + const char *dev, const char *fs_type, + const char *const fs_opts[], const char *const extra_opts[]); + +#define SAFE_MKFS(device, fs_type, fs_opts, extra_opts) \ + tst_mkfs_(__FILE__, __LINE__, NULL, device, fs_type, \ + fs_opts, extra_opts) + +#endif /* TST_MKFS_H__ */ diff --git a/fsstress/include/tst_net.h b/fsstress/include/tst_net.h new file mode 100644 index 0000000000..daefdd9d9e --- /dev/null +++ b/fsstress/include/tst_net.h @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2017-2019 Petr Vorel + */ + +#ifndef TST_NET_H_ +#define TST_NET_H_ + +#include +#include +#include +#include +#include + +void tst_get_in_addr(const char *ip_str, struct in_addr *ip); +void tst_get_in6_addr(const char *ip_str, struct in6_addr *ip6); + +/* + * Find valid connection address for a given bound socket + */ +socklen_t tst_get_connect_address(int sock, struct sockaddr_storage *addr); + +/* + * Initialize AF_INET/AF_INET6 socket address structure with address and port + */ +void tst_init_sockaddr_inet(struct sockaddr_in *sa, const char *ip_str, uint16_t port); +void tst_init_sockaddr_inet_bin(struct sockaddr_in *sa, uint32_t ip_val, uint16_t port); +void tst_init_sockaddr_inet6(struct sockaddr_in6 *sa, const char *ip_str, uint16_t port); +void tst_init_sockaddr_inet6_bin(struct sockaddr_in6 *sa, const struct in6_addr *ip_val, uint16_t port); + +void safe_getaddrinfo(const char *file, const int lineno, const char *src_addr, + const char *port, const struct addrinfo *hints, + struct addrinfo **addr_info); + +#endif /* TST_NET_H_ */ diff --git a/fsstress/include/tst_netlink.h b/fsstress/include/tst_netlink.h new file mode 100644 index 0000000000..2030ac30b2 --- /dev/null +++ b/fsstress/include/tst_netlink.h @@ -0,0 +1,88 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2018 Richard Palethorpe + */ + +/** + * @file tst_netlink.h + * + * Library for communicating with the kernel over the netlink interface. + */ + +#ifndef TST_NETLINK_H +#define TST_NETLINK_H + +#include + +#ifndef NETLINK_CRYPTO +/** + * The netlink-crypto socket protocol. + */ +#define NETLINK_CRYPTO 21 +#endif + +/** @private */ +static inline ssize_t safe_netlink_send(const char *file, const int lineno, + int fd, const struct nlmsghdr *nh, + const void *payload) +{ + struct sockaddr_nl sa = { .nl_family = AF_NETLINK }; + struct iovec iov[2] = { + {(struct nlmsghdr *)nh, sizeof(*nh)}, + {(void *)payload, nh->nlmsg_len - sizeof(*nh)} + }; + struct msghdr msg = { + .msg_name = &sa, + .msg_namelen = sizeof(sa), + .msg_iov = iov, + .msg_iovlen = 2 + }; + + return safe_sendmsg(file, lineno, nh->nlmsg_len, fd, &msg, 0); +} + +/** + * Sends a netlink message using safe_sendmsg(). + * + * @param fd netlink socket file descriptor. + * @param nl_header netlink header structure describing the message. + * @param payload an opaque object containing the message data. + * + * You should set the message length, type and flags to appropriate values + * within the nl_header object. See lib/tst_crypto.c for an example. + * + * @return The number of bytes sent. + */ +#define SAFE_NETLINK_SEND(fd, nl_header, payload) \ + safe_netlink_send(__FILE__, __LINE__, fd, nl_header, payload) + +/** @private */ +static inline ssize_t safe_netlink_recv(const char *file, const int lineno, + int fd, char *nl_headers_buf, + size_t buf_len) +{ + struct iovec iov = { nl_headers_buf, buf_len }; + struct sockaddr_nl sa; + struct msghdr msg = { + .msg_name = &sa, + .msg_namelen = sizeof(sa), + .msg_iov = &iov, + .msg_iovlen = 1 + }; + + return safe_recvmsg(file, lineno, 0, fd, &msg, 0); +} + +/** + * Receives a netlink message using safe_recvmsg(). + * + * @param fd netlink socket file descriptor. + * @param nl_header_buf buffer to contain the received netlink header structure. + * @param buf_len The length of the header buffer. Must be greater than the page + * size. + * + * @return The number of bytes received. + */ +#define SAFE_NETLINK_RECV(fd, nl_header_buf, buf_len) \ + safe_netlink_recv(__FILE__, __LINE__, fd, nl_header_buf, buf_len) + +#endif /* TST_NETLINK_H */ diff --git a/fsstress/include/tst_numa.h b/fsstress/include/tst_numa.h new file mode 100644 index 0000000000..846e093a91 --- /dev/null +++ b/fsstress/include/tst_numa.h @@ -0,0 +1,112 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2018 Cyril Hrubis + */ + +#ifndef TST_NUMA_H__ +#define TST_NUMA_H__ + +#include + +/** + * Numa nodemap. + */ +struct tst_nodemap { + /** Number of nodes in map */ + unsigned int cnt; + /** Page allocation counters */ + unsigned int *counters; + /** Array of numa ids */ + unsigned int map[]; +}; + +/** + * Clears numa counters. The counters are lazy-allocated on first call of this function. + * + * @nodes Numa nodemap. + */ +void tst_nodemap_reset_counters(struct tst_nodemap *nodes); + +/** + * Prints pages allocated per each node. + * + * @nodes Numa nodemap. + */ +void tst_nodemap_print_counters(struct tst_nodemap *nodes); + +/** + * Returns a name for a mempolicy/mbind mode. + * + * @mode Numa mempolicy mode. + */ +const char *tst_numa_mode_name(int mode); + +/** + * Maps pages into memory, if path is NULL the mapping is anonymous otherwise is backed by the file. + * + * @path Path to a file, if not NULL mapping is file based. + * @size Mapping size. + */ +void *tst_numa_map(const char *path, size_t size); + +/* + * Writes to memory in order to get the pages faulted. + * + * @ptr Start of the mapping. + * @size Size of the mapping. + */ +static inline void tst_numa_fault(void *ptr, size_t size) +{ + memset(ptr, 'a', size); +} + +/* + * Frees the memory. + * + * @ptr Start of the mapping. + * @size Size of the mapping. + */ +static inline void tst_numa_unmap(void *ptr, size_t size) +{ + SAFE_MUNMAP(ptr, size); +} + +/** + * Check on which numa node resides each page of the mapping starting at ptr + * and continuing pages long and increases nodemap counters accordingly. + * + * @nodes Nodemap with initialized counters. + * @ptr Pointer to start of a mapping. + * @size Size of the mapping. + */ +void tst_nodemap_count_pages(struct tst_nodemap *nodes, void *ptr, size_t size); + +/** + * Frees nodemap. + * + * @nodes Numa nodemap to be freed. + */ +void tst_nodemap_free(struct tst_nodemap *nodes); + +/** + * Bitflags for tst_get_nodemap() function. + */ +enum tst_numa_types { + TST_NUMA_ANY = 0x00, + TST_NUMA_MEM = 0x01, +}; + +/** + * Allocates and returns numa node map, which is an array of numa nodes which + * contain desired resources e.g. memory. + * + * @type Bitflags of enum tst_numa_types specifying desired resources. + * @min_mem_kb Minimal free RAM on memory nodes, if given node has less than + * requested amount of free+buffers memory it's not included in + * the resulting list of nodes. + * + * @return On success returns allocated and initialized struct tst_nodemap which contains + * array of numa node ids that contains desired resources. + */ +struct tst_nodemap *tst_get_nodemap(int type, size_t min_mem_kb); + +#endif /* TST_NUMA_H__ */ diff --git a/fsstress/include/tst_path_has_mnt_flags.h b/fsstress/include/tst_path_has_mnt_flags.h new file mode 100644 index 0000000000..a9e1f40505 --- /dev/null +++ b/fsstress/include/tst_path_has_mnt_flags.h @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. + * Copyright (c) 2018 Cyril Hrubis + * Author: Xiao Yang + */ + +#ifndef TST_PATH_HAS_MNT_FLAGS_H__ +#define TST_PATH_HAS_MNT_FLAGS_H__ + +#ifdef TST_TEST_H__ +# define tst_path_has_mnt_flags(...) tst_path_has_mnt_flags_(NULL, __VA_ARGS__) +#else +# define tst_path_has_mnt_flags tst_path_has_mnt_flags_ +#endif + +/* lib/tst_path_has_mnt_flags.c + * + * Check whether a path is on a filesystem that is mounted with + * specified flags + * @path: path to file, if path is NULL tst_tmpdir is used. + * @flags: NULL or NULL terminated array of mount flags + * + * Return: 0..n - number of flags matched + */ +int tst_path_has_mnt_flags_(void (*cleanup_fn)(void), + const char *path, const char *flags[]); + +#endif /* TST_PATH_HAS_MNT_FLAGS_H__ */ diff --git a/fsstress/include/tst_pid.h b/fsstress/include/tst_pid.h new file mode 100644 index 0000000000..9ba1abb27b --- /dev/null +++ b/fsstress/include/tst_pid.h @@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2015-2016 Cyril Hrubis + */ + +#ifndef TST_PID_H__ +#define TST_PID_H__ + +#include + +/* + * Get a pid value not used by the OS + */ +pid_t tst_get_unused_pid_(void (*cleanup_fn)(void)); + +/* + * Returns number of free pids by substarction of the number of pids + * currently used ('ps -eT') from max_pids + */ +int tst_get_free_pids_(void (*cleanup_fn)(void)); + +#ifdef TST_TEST_H__ +static inline pid_t tst_get_unused_pid(void) +{ + return tst_get_unused_pid_(NULL); +} + +static inline int tst_get_free_pids(void) +{ + return tst_get_free_pids_(NULL); +} +#else +static inline pid_t tst_get_unused_pid(void (*cleanup_fn)(void)) +{ + return tst_get_unused_pid_(cleanup_fn); +} + +static inline int tst_get_free_pids(void (*cleanup_fn)(void)) +{ + return tst_get_free_pids_(cleanup_fn); +} +#endif + +#endif /* TST_PID_H__ */ diff --git a/fsstress/include/tst_private.h b/fsstress/include/tst_private.h new file mode 100644 index 0000000000..e30d347401 --- /dev/null +++ b/fsstress/include/tst_private.h @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2017-2019 Petr Vorel + * + * Internal helper functions for the shell library. Do not use directly + * in test programs. + */ + +#ifndef TST_PRIVATE_H_ +#define TST_PRIVATE_H_ + +#include +#include + +#define MAX_IPV4_PREFIX 32 +#define MAX_IPV6_PREFIX 128 + +#define tst_res_comment(...) { \ + fprintf(stderr, "# "); \ + tst_res(__VA_ARGS__); } \ + + +#define tst_brk_comment(...) { \ + fprintf(stderr, "# "); \ + tst_brk(TCONF, __VA_ARGS__); } \ + +void tst_print_svar(const char *name, const char *val); +void tst_print_svar_change(const char *name, const char *val); + +int tst_get_prefix(const char *ip_str, int is_ipv6); + +#endif diff --git a/fsstress/include/tst_process_state.h b/fsstress/include/tst_process_state.h new file mode 100644 index 0000000000..c32aa58e68 --- /dev/null +++ b/fsstress/include/tst_process_state.h @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (C) 2012-2014 Cyril Hrubis chrubis@suse.cz + */ + + /* + + These functions helps you wait till a process with given pid changes state. + This is for example useful when you need to wait in parent until child + blocks. + + */ + +#ifndef TST_PROCESS_STATE__ +#define TST_PROCESS_STATE__ + +#include + +/* + * Waits for process state change. + * + * The state is one of the following: + * + * R - process is running + * S - process is sleeping + * D - process sleeping uninterruptibly + * Z - zombie process + * T - process is traced + */ +#ifdef TST_TEST_H__ + +#define TST_PROCESS_STATE_WAIT(pid, state, msec_timeout) \ + tst_process_state_wait(__FILE__, __LINE__, NULL, \ + (pid), (state), (msec_timeout)) +#else +/* + * The same as above but does not use tst_brkm() interface. + * + * This function is intended to be used from child processes. + * + * Returns zero on success, non-zero on failure. + */ +int tst_process_state_wait2(pid_t pid, const char state); + +# define TST_PROCESS_STATE_WAIT(cleanup_fn, pid, state) \ + tst_process_state_wait(__FILE__, __LINE__, (cleanup_fn), \ + (pid), (state), 0) +#endif + +int tst_process_state_wait(const char *file, const int lineno, + void (*cleanup_fn)(void), pid_t pid, + const char state, unsigned int msec_timeout); + +#endif /* TST_PROCESS_STATE__ */ diff --git a/fsstress/include/tst_res_flags.h b/fsstress/include/tst_res_flags.h new file mode 100644 index 0000000000..8eda2f8b81 --- /dev/null +++ b/fsstress/include/tst_res_flags.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) Linux Test Project, 2014 + */ + +#ifndef TST_RES_FLAGS_H +#define TST_RES_FLAGS_H + +/* Use low 6 bits to encode test type */ +#define TTYPE_MASK 0x3f +#define TPASS 0 /* Test passed flag */ +#define TFAIL 1 /* Test failed flag */ +#define TBROK 2 /* Test broken flag */ +#define TWARN 4 /* Test warning flag */ +#define TINFO 16 /* Test information flag */ +#define TCONF 32 /* Test not appropriate for configuration flag */ +#define TTYPE_RESULT(ttype) ((ttype) & TTYPE_MASK) + +#define TERRNO 0x100 /* Append errno information to output */ +#define TTERRNO 0x200 /* Append TEST_ERRNO information to output */ +#define TRERRNO 0x400 /* Capture errno information from TEST_RETURN to + output; useful for pthread-like APIs :). */ + +#endif /* TST_RES_FLAGS_H */ diff --git a/fsstress/include/tst_safe_clocks.h b/fsstress/include/tst_safe_clocks.h new file mode 100644 index 0000000000..4cb5f41ed8 --- /dev/null +++ b/fsstress/include/tst_safe_clocks.h @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019, Linux Test Project + * Copyright (c) Zilogic Systems Pvt. Ltd., 2018 + * Email : code@zilogic.com + */ + +#ifndef TST_SAFE_CLOCKS_H__ +#define TST_SAFE_CLOCKS_H__ + +#include +#include +#include "tst_test.h" +#include "tst_clocks.h" +#include "lapi/syscalls.h" +#include "lapi/posix_clocks.h" + +static inline void safe_clock_getres(const char *file, const int lineno, + clockid_t clk_id, struct timespec *res) +{ + int rval; + + rval = clock_getres(clk_id, res); + if (rval != 0) { + tst_brk(TBROK | TERRNO, + "%s:%d clock_getres(%s) failed", + file, lineno, tst_clock_name(clk_id)); + } +} + +static inline void safe_clock_gettime(const char *file, const int lineno, + clockid_t clk_id, struct timespec *tp) +{ + int rval; + + rval = clock_gettime(clk_id, tp); + if (rval != 0) { + tst_brk(TBROK | TERRNO, + "%s:%d clock_gettime(%s) failed", + file, lineno, tst_clock_name(clk_id)); + } +} + + +static inline void safe_clock_settime(const char *file, const int lineno, + clockid_t clk_id, struct timespec *tp) +{ + int rval; + + rval = clock_settime(clk_id, tp); + if (rval != 0) { + tst_brk(TBROK | TERRNO, + "%s:%d clock_gettime(%s) failed", + file, lineno, tst_clock_name(clk_id)); + } +} + +#define SAFE_CLOCK_GETRES(clk_id, res)\ + safe_clock_getres(__FILE__, __LINE__, (clk_id), (res)) + +#define SAFE_CLOCK_GETTIME(clk_id, tp)\ + safe_clock_gettime(__FILE__, __LINE__, (clk_id), (tp)) + +#define SAFE_CLOCK_SETTIME(clk_id, tp)\ + safe_clock_settime(__FILE__, __LINE__, (clk_id), (tp)) + +#endif /* SAFE_CLOCKS_H__ */ diff --git a/fsstress/include/tst_safe_file_ops.h b/fsstress/include/tst_safe_file_ops.h new file mode 100644 index 0000000000..894c16123d --- /dev/null +++ b/fsstress/include/tst_safe_file_ops.h @@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (C) 2012 Cyril Hrubis chrubis@suse.cz + */ + +#ifndef TST_SAFE_FILE_OPS +#define TST_SAFE_FILE_OPS + +#include "safe_file_ops_fn.h" + +#define SAFE_FILE_SCANF(path, fmt, ...) \ + safe_file_scanf(__FILE__, __LINE__, NULL, \ + (path), (fmt), ## __VA_ARGS__) + +#define FILE_LINES_SCANF(path, fmt, ...) \ + file_lines_scanf(__FILE__, __LINE__, NULL, 0,\ + (path), (fmt), ## __VA_ARGS__) + +#define SAFE_FILE_LINES_SCANF(path, fmt, ...) \ + file_lines_scanf(__FILE__, __LINE__, NULL, 1,\ + (path), (fmt), ## __VA_ARGS__) + +#define SAFE_READ_MEMINFO(item) \ + ({long tst_rval; \ + SAFE_FILE_LINES_SCANF("/proc/meminfo", item " %ld", \ + &tst_rval); \ + tst_rval;}) + +#define FILE_PRINTF(path, fmt, ...) \ + file_printf(__FILE__, __LINE__, \ + (path), (fmt), ## __VA_ARGS__) + +#define SAFE_FILE_PRINTF(path, fmt, ...) \ + safe_file_printf(__FILE__, __LINE__, NULL, \ + (path), (fmt), ## __VA_ARGS__) + +#define SAFE_CP(src, dst) \ + safe_cp(__FILE__, __LINE__, NULL, (src), (dst)) + +#define SAFE_TOUCH(pathname, mode, times) \ + safe_touch(__FILE__, __LINE__, NULL, \ + (pathname), (mode), (times)) + +#define SAFE_MOUNT_OVERLAY() \ + ((void) mount_overlay(__FILE__, __LINE__, 1)) + +#define TST_MOUNT_OVERLAY() \ + (mount_overlay(__FILE__, __LINE__, 0) == 0) + +#endif /* TST_SAFE_FILE_OPS */ diff --git a/fsstress/include/tst_safe_macros.h b/fsstress/include/tst_safe_macros.h new file mode 100644 index 0000000000..c39d8768b1 --- /dev/null +++ b/fsstress/include/tst_safe_macros.h @@ -0,0 +1,571 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2010-2018 Linux Test Project + * Copyright (c) 2011-2015 Cyril Hrubis + */ + +#ifndef TST_SAFE_MACROS_H__ +#define TST_SAFE_MACROS_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "safe_macros_fn.h" +#include "tst_cmd.h" + +#define SAFE_BASENAME(path) \ + safe_basename(__FILE__, __LINE__, NULL, (path)) + +#define SAFE_CHDIR(path) \ + safe_chdir(__FILE__, __LINE__, NULL, (path)) + +#define SAFE_CLOSE(fd) do { \ + safe_close(__FILE__, __LINE__, NULL, (fd)); \ + fd = -1; \ + } while (0) + +#define SAFE_CREAT(pathname, mode) \ + safe_creat(__FILE__, __LINE__, NULL, (pathname), (mode)) + +#define SAFE_CHROOT(path) \ + safe_chroot(__FILE__, __LINE__, (path)) +int safe_chroot(const char *file, const int lineno, const char *path); + +#define SAFE_DIRNAME(path) \ + safe_dirname(__FILE__, __LINE__, NULL, (path)) + +static inline int safe_dup(const char *file, const int lineno, + int oldfd) +{ + int rval; + + rval = dup(oldfd); + if (rval == -1) { + tst_brk_(file, lineno, TBROK | TERRNO, + "dup(%i) failed", oldfd); + } + + return rval; +} +#define SAFE_DUP(oldfd) \ + safe_dup(__FILE__, __LINE__, (oldfd)) + +#define SAFE_GETCWD(buf, size) \ + safe_getcwd(__FILE__, __LINE__, NULL, (buf), (size)) + +#define SAFE_GETPWNAM(name) \ + safe_getpwnam(__FILE__, __LINE__, NULL, (name)) + +#define SAFE_GETRUSAGE(who, usage) \ + safe_getrusage(__FILE__, __LINE__, NULL, (who), (usage)) + +#define SAFE_MALLOC(size) \ + safe_malloc(__FILE__, __LINE__, NULL, (size)) + +#define SAFE_MKDIR(pathname, mode) \ + safe_mkdir(__FILE__, __LINE__, NULL, (pathname), (mode)) + +#define SAFE_RMDIR(pathname) \ + safe_rmdir(__FILE__, __LINE__, NULL, (pathname)) + +#define SAFE_MUNMAP(addr, length) \ + safe_munmap(__FILE__, __LINE__, NULL, (addr), (length)) + +#define SAFE_OPEN(pathname, oflags, ...) \ + safe_open(__FILE__, __LINE__, NULL, (pathname), (oflags), \ + ##__VA_ARGS__) + +#define SAFE_PIPE(fildes) \ + safe_pipe(__FILE__, __LINE__, NULL, (fildes)) + +int safe_pipe2(const char *file, const int lineno, int fildes[2], int flags); + +#define SAFE_PIPE2(fildes, flags) \ + safe_pipe2(__FILE__, __LINE__, (fildes), (flags)) + +#define SAFE_READ(len_strict, fildes, buf, nbyte) \ + safe_read(__FILE__, __LINE__, NULL, (len_strict), (fildes), (buf), (nbyte)) + +#define SAFE_SETEGID(egid) \ + safe_setegid(__FILE__, __LINE__, NULL, (egid)) + +#define SAFE_SETEUID(euid) \ + safe_seteuid(__FILE__, __LINE__, NULL, (euid)) + +#define SAFE_SETGID(gid) \ + safe_setgid(__FILE__, __LINE__, NULL, (gid)) + +#define SAFE_SETUID(uid) \ + safe_setuid(__FILE__, __LINE__, NULL, (uid)) + +int safe_setregid(const char *file, const int lineno, + gid_t rgid, gid_t egid); + +#define SAFE_SETREGID(rgid, egid) \ + safe_setregid(__FILE__, __LINE__, (rgid), (egid)) + +int safe_setreuid(const char *file, const int lineno, + uid_t ruid, uid_t euid); + +#define SAFE_SETREUID(ruid, euid) \ + safe_setreuid(__FILE__, __LINE__, (ruid), (euid)) + +#define SAFE_GETRESUID(ruid, euid, suid) \ + safe_getresuid(__FILE__, __LINE__, NULL, (ruid), (euid), (suid)) + +#define SAFE_GETRESGID(rgid, egid, sgid) \ + safe_getresgid(__FILE__, __LINE__, NULL, (rgid), (egid), (sgid)) + +int safe_setpgid(const char *file, const int lineno, pid_t pid, pid_t pgid); + +#define SAFE_SETPGID(pid, pgid) \ + safe_setpgid(__FILE__, __LINE__, (pid), (pgid)); + +pid_t safe_getpgid(const char *file, const int lineno, pid_t pid); + +#define SAFE_GETPGID(pid) \ + safe_getpgid(__FILE__, __LINE__, (pid)) + +#define SAFE_UNLINK(pathname) \ + safe_unlink(__FILE__, __LINE__, NULL, (pathname)) + +#define SAFE_LINK(oldpath, newpath) \ + safe_link(__FILE__, __LINE__, NULL, (oldpath), (newpath)) + +#define SAFE_LINKAT(olddirfd, oldpath, newdirfd, newpath, flags) \ + safe_linkat(__FILE__, __LINE__, NULL, (olddirfd), (oldpath), \ + (newdirfd), (newpath), (flags)) + +#define SAFE_READLINK(path, buf, bufsize) \ + safe_readlink(__FILE__, __LINE__, NULL, (path), (buf), (bufsize)) + +#define SAFE_SYMLINK(oldpath, newpath) \ + safe_symlink(__FILE__, __LINE__, NULL, (oldpath), (newpath)) + +#define SAFE_WRITE(len_strict, fildes, buf, nbyte) \ + safe_write(__FILE__, __LINE__, NULL, (len_strict), (fildes), (buf), (nbyte)) + +#define SAFE_STRTOL(str, min, max) \ + safe_strtol(__FILE__, __LINE__, NULL, (str), (min), (max)) + +#define SAFE_STRTOUL(str, min, max) \ + safe_strtoul(__FILE__, __LINE__, NULL, (str), (min), (max)) + +#define SAFE_SYSCONF(name) \ + safe_sysconf(__FILE__, __LINE__, NULL, name) + +#define SAFE_CHMOD(path, mode) \ + safe_chmod(__FILE__, __LINE__, NULL, (path), (mode)) + +#define SAFE_FCHMOD(fd, mode) \ + safe_fchmod(__FILE__, __LINE__, NULL, (fd), (mode)) + +#define SAFE_CHOWN(path, owner, group) \ + safe_chown(__FILE__, __LINE__, NULL, (path), (owner), (group)) + +#define SAFE_FCHOWN(fd, owner, group) \ + safe_fchown(__FILE__, __LINE__, NULL, (fd), (owner), (group)) + +#define SAFE_WAIT(status) \ + safe_wait(__FILE__, __LINE__, NULL, (status)) + +#define SAFE_WAITPID(pid, status, opts) \ + safe_waitpid(__FILE__, __LINE__, NULL, (pid), (status), (opts)) + +#define SAFE_KILL(pid, sig) \ + safe_kill(__FILE__, __LINE__, NULL, (pid), (sig)) + +#define SAFE_MEMALIGN(alignment, size) \ + safe_memalign(__FILE__, __LINE__, NULL, (alignment), (size)) + +#define SAFE_MKFIFO(pathname, mode) \ + safe_mkfifo(__FILE__, __LINE__, NULL, (pathname), (mode)) + +#define SAFE_RENAME(oldpath, newpath) \ + safe_rename(__FILE__, __LINE__, NULL, (oldpath), (newpath)) + +#define SAFE_MOUNT(source, target, filesystemtype, \ + mountflags, data) \ + safe_mount(__FILE__, __LINE__, NULL, (source), (target), \ + (filesystemtype), (mountflags), (data)) + +#define SAFE_UMOUNT(target) \ + safe_umount(__FILE__, __LINE__, NULL, (target)) + +#define SAFE_OPENDIR(name) \ + safe_opendir(__FILE__, __LINE__, NULL, (name)) + +#define SAFE_CLOSEDIR(dirp) \ + safe_closedir(__FILE__, __LINE__, NULL, (dirp)) + +#define SAFE_READDIR(dirp) \ + safe_readdir(__FILE__, __LINE__, NULL, (dirp)) + +#define SAFE_IOCTL(fd, request, ...) \ + ({int tst_ret_ = ioctl(fd, request, ##__VA_ARGS__); \ + tst_ret_ < 0 ? \ + tst_brk(TBROK | TERRNO, \ + "ioctl(%i,%s,...) failed", fd, #request), 0 \ + : tst_ret_;}) + +#define SAFE_FCNTL(fd, cmd, ...) \ + ({int tst_ret_ = fcntl(fd, cmd, ##__VA_ARGS__); \ + tst_ret_ == -1 ? \ + tst_brk(TBROK | TERRNO, \ + "fcntl(%i,%s,...) failed", fd, #cmd), 0 \ + : tst_ret_;}) + +/* + * following functions are inline because the behaviour may depend on + * -D_FILE_OFFSET_BITS=64 -DOFF_T=off64_t compile flags + */ + +static inline void *safe_mmap(const char *file, const int lineno, + void *addr, size_t length, + int prot, int flags, int fd, off_t offset) +{ + void *rval; + + rval = mmap(addr, length, prot, flags, fd, offset); + if (rval == MAP_FAILED) { + tst_brk_(file, lineno, TBROK | TERRNO, + "mmap(%p,%zu,%d,%d,%d,%ld) failed", + addr, length, prot, flags, fd, (long) offset); + } + + return rval; +} +#define SAFE_MMAP(addr, length, prot, flags, fd, offset) \ + safe_mmap(__FILE__, __LINE__, (addr), (length), (prot), \ + (flags), (fd), (offset)) + +static inline int safe_ftruncate(const char *file, const int lineno, + int fd, off_t length) +{ + int rval; + + rval = ftruncate(fd, length); + if (rval == -1) { + tst_brk_(file, lineno, TBROK | TERRNO, + "ftruncate(%d,%ld) failed", + fd, (long)length); + } + + return rval; +} +#define SAFE_FTRUNCATE(fd, length) \ + safe_ftruncate(__FILE__, __LINE__, (fd), (length)) + +static inline int safe_truncate(const char *file, const int lineno, + const char *path, off_t length) +{ + int rval; + + rval = truncate(path, length); + if (rval == -1) { + tst_brk_(file, lineno, TBROK | TERRNO, + "truncate(%s,%ld) failed", + path, (long)length); + } + + return rval; +} +#define SAFE_TRUNCATE(path, length) \ + safe_truncate(__FILE__, __LINE__, (path), (length)) + +static inline int safe_stat(const char *file, const int lineno, + const char *path, struct stat *buf) +{ + int rval; + + rval = stat(path, buf); + + if (rval == -1) { + tst_brk_(file, lineno, TBROK | TERRNO, + "stat(%s,%p) failed", path, buf); + } + + return rval; +} +#define SAFE_STAT(path, buf) \ + safe_stat(__FILE__, __LINE__, (path), (buf)) + +static inline int safe_fstat(const char *file, const int lineno, + int fd, struct stat *buf) +{ + int rval; + + rval = fstat(fd, buf); + + if (rval == -1) { + tst_brk_(file, lineno, TBROK | TERRNO, + "fstat(%d,%p) failed", fd, buf); + } + + return rval; +} +#define SAFE_FSTAT(fd, buf) \ + safe_fstat(__FILE__, __LINE__, (fd), (buf)) + +static inline int safe_lstat(const char *file, const int lineno, + const char *path, struct stat *buf) +{ + int rval; + + rval = lstat(path, buf); + + if (rval == -1) { + tst_brk_(file, lineno, TBROK | TERRNO, + "lstat(%s,%p) failed", path, buf); + } + + return rval; +} +#define SAFE_LSTAT(path, buf) \ + safe_lstat(__FILE__, __LINE__, (path), (buf)) + +static inline int safe_statfs(const char *file, const int lineno, + const char *path, struct statfs *buf) +{ + int rval; + + rval = statfs(path, buf); + + if (rval == -1) { + tst_brk_(file, lineno, TBROK | TERRNO, + "statfs(%s,%p) failed", path, buf); + } + + return rval; +} +#define SAFE_STATFS(path, buf) \ + safe_statfs(__FILE__, __LINE__, (path), (buf)) + +static inline off_t safe_lseek(const char *file, const int lineno, + int fd, off_t offset, int whence) +{ + off_t rval; + + rval = lseek(fd, offset, whence); + + if (rval == (off_t) -1) { + tst_brk_(file, lineno, TBROK | TERRNO, + "lseek(%d,%ld,%d) failed", + fd, (long)offset, whence); + } + + return rval; +} +#define SAFE_LSEEK(fd, offset, whence) \ + safe_lseek(__FILE__, __LINE__, (fd), (offset), (whence)) + +static inline int safe_getrlimit(const char *file, const int lineno, + int resource, struct rlimit *rlim) +{ + int rval; + + rval = getrlimit(resource, rlim); + + if (rval == -1) { + tst_brk_(file, lineno, TBROK | TERRNO, + "getrlimit(%d,%p) failed", + resource, rlim); + } + + return rval; +} +#define SAFE_GETRLIMIT(resource, rlim) \ + safe_getrlimit(__FILE__, __LINE__, (resource), (rlim)) + +static inline int safe_setrlimit(const char *file, const int lineno, + int resource, const struct rlimit *rlim) +{ + int rval; + + rval = setrlimit(resource, rlim); + + if (rval == -1) { + tst_brk_(file, lineno, TBROK | TERRNO, + "setrlimit(%d,%p) failed", + resource, rlim); + } + + return rval; +} +#define SAFE_SETRLIMIT(resource, rlim) \ + safe_setrlimit(__FILE__, __LINE__, (resource), (rlim)) + +typedef void (*sighandler_t)(int); +static inline sighandler_t safe_signal(const char *file, const int lineno, + int signum, sighandler_t handler) +{ + sighandler_t rval; + + rval = signal(signum, handler); + + if (rval == SIG_ERR) { + tst_brk_(file, lineno, TBROK | TERRNO, + "signal(%d,%p) failed", + signum, handler); + } + + return rval; +} + +#define SAFE_SIGNAL(signum, handler) \ + safe_signal(__FILE__, __LINE__, (signum), (handler)) + +int safe_sigaction(const char *file, const int lineno, + int signum, const struct sigaction *act, + struct sigaction *oldact); +#define SAFE_SIGACTION(signum, act, oldact) \ + safe_sigaction(__FILE__, __LINE__, (signum), (act), (oldact)) + +#define SAFE_EXECLP(file, arg, ...) do { \ + execlp((file), (arg), ##__VA_ARGS__); \ + tst_brk_(__FILE__, __LINE__, TBROK | TERRNO, \ + "execlp(%s, %s, ...) failed", file, arg); \ + } while (0) + +#define SAFE_EXECL(file, arg, ...) do { \ + execl((file), (arg), ##__VA_ARGS__); \ + tst_brk_(__FILE__, __LINE__, TBROK | TERRNO, \ + "execl(%s, %s, ...) failed", file, arg); \ + } while (0) + +int safe_getpriority(const char *file, const int lineno, int which, id_t who); +#define SAFE_GETPRIORITY(which, who) \ + safe_getpriority(__FILE__, __LINE__, (which), (who)) + +struct group *safe_getgrnam(const char *file, const int lineno, + const char *name); +#define SAFE_GETGRNAM(name) \ + safe_getgrnam(__FILE__, __LINE__, (name)) + +struct group *safe_getgrnam_fallback(const char *file, const int lineno, + const char *name, const char *fallback); +#define SAFE_GETGRNAM_FALLBACK(name, fallback) \ + safe_getgrnam_fallback(__FILE__, __LINE__, (name), (fallback)) + +struct group *safe_getgrgid(const char *file, const int lineno, gid_t gid); +#define SAFE_GETGRGID(gid) \ + safe_getgrgid(__FILE__, __LINE__, (gid)) + +ssize_t safe_getxattr(const char *file, const int lineno, const char *path, + const char *name, void *value, size_t size); +#define SAFE_GETXATTR(path, name, value, size) \ + safe_getxattr(__FILE__, __LINE__, (path), (name), (value), (size)) + +int safe_setxattr(const char *file, const int lineno, const char *path, + const char *name, const void *value, size_t size, int flags); +#define SAFE_SETXATTR(path, name, value, size, flags) \ + safe_setxattr(__FILE__, __LINE__, (path), (name), (value), (size), (flags)) + +int safe_lsetxattr(const char *file, const int lineno, const char *path, + const char *name, const void *value, size_t size, int flags); +#define SAFE_LSETXATTR(path, name, value, size, flags) \ + safe_lsetxattr(__FILE__, __LINE__, (path), (name), (value), (size), (flags)) + +int safe_fsetxattr(const char *file, const int lineno, int fd, const char *name, + const void *value, size_t size, int flags); +#define SAFE_FSETXATTR(fd, name, value, size, flags) \ + safe_fsetxattr(__FILE__, __LINE__, (fd), (name), (value), (size), (flags)) + +int safe_removexattr(const char *file, const int lineno, const char *path, + const char *name); +#define SAFE_REMOVEXATTR(path, name) \ + safe_removexattr(__FILE__, __LINE__, (path), (name)) + +int safe_lremovexattr(const char *file, const int lineno, const char *path, + const char *name); +#define SAFE_LREMOVEXATTR(path, name) \ + safe_lremovexattr(__FILE__, __LINE__, (path), (name)) + +int safe_fremovexattr(const char *file, const int lineno, int fd, + const char *name); +#define SAFE_FREMOVEXATTR(fd, name) \ + safe_fremovexattr(__FILE__, __LINE__, (fd), (name)) + +int safe_fsync(const char *file, const int lineno, int fd); +#define SAFE_FSYNC(fd) safe_fsync(__FILE__, __LINE__, (fd)) + +int safe_setsid(const char *file, const int lineno); +#define SAFE_SETSID() safe_setsid(__FILE__, __LINE__) + +int safe_mknod(const char *file, const int lineno, const char *pathname, + mode_t mode, dev_t dev); +#define SAFE_MKNOD(pathname, mode, dev) \ + safe_mknod(__FILE__, __LINE__, (pathname), (mode), (dev)) + +int safe_mlock(const char *file, const int lineno, const char *addr, + size_t len); +#define SAFE_MLOCK(addr, len) safe_mlock(__FILE__, __LINE__, (addr), (len)) + +int safe_munlock(const char *file, const int lineno, const char *addr, + size_t len); +#define SAFE_MUNLOCK(addr, len) safe_munlock(__FILE__, __LINE__, (addr), (len)) + +int safe_mincore(const char *file, const int lineno, void *start, + size_t length, unsigned char *vec); +#define SAFE_MINCORE(start, length, vec) \ + safe_mincore(__FILE__, __LINE__, (start), (length), (vec)) + +int safe_fanotify_init(const char *file, const int lineno, + unsigned int flags, unsigned int event_f_flags); +#define SAFE_FANOTIFY_INIT(fan, mode) \ + safe_fanotify_init(__FILE__, __LINE__, (fan), (mode)) + +int safe_personality(const char *filename, unsigned int lineno, + unsigned long persona); +#define SAFE_PERSONALITY(persona) safe_personality(__FILE__, __LINE__, persona) + +#define SAFE_SETENV(name, value, overwrite) do { \ + if (setenv(name, value, overwrite)) { \ + tst_brk_(__FILE__, __LINE__, TBROK | TERRNO, \ + "setenv(%s, %s, %d) failed", \ + name, value, overwrite); \ + } \ + } while (0) + +void safe_unshare(const char *file, const int lineno, int flags); +#define SAFE_UNSHARE(flags) safe_unshare(__FILE__, __LINE__, (flags)) + +void safe_setns(const char *file, const int lineno, int fd, int nstype); +#define SAFE_SETNS(fd, nstype) safe_setns(__FILE__, __LINE__, (fd), (nstype)); + +static inline void safe_cmd(const char *file, const int lineno, const char *const argv[], + const char *stdout_path, const char *stderr_path) +{ + int rval; + + switch ((rval = tst_cmd(argv, stdout_path, stderr_path, + TST_CMD_PASS_RETVAL | TST_CMD_TCONF_ON_MISSING))) { + case 0: + break; + default: + tst_brk(TBROK, "%s:%d: %s failed (%d)", file, lineno, argv[0], rval); + } +} +#define SAFE_CMD(argv, stdout_path, stderr_path) \ + safe_cmd(__FILE__, __LINE__, (argv), (stdout_path), (stderr_path)) +/* + * SAFE_PTRACE() treats any non-zero return value as error. Don't use it + * for requests like PTRACE_PEEK* or PTRACE_SECCOMP_GET_FILTER which use + * the return value to pass arbitrary data. + */ +long tst_safe_ptrace(const char *file, const int lineno, int req, pid_t pid, + void *addr, void *data); +#define SAFE_PTRACE(req, pid, addr, data) \ + tst_safe_ptrace(__FILE__, __LINE__, req, pid, addr, data) + +#endif /* SAFE_MACROS_H__ */ diff --git a/fsstress/include/tst_safe_net.h b/fsstress/include/tst_safe_net.h new file mode 100644 index 0000000000..78a488a18d --- /dev/null +++ b/fsstress/include/tst_safe_net.h @@ -0,0 +1,79 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2016 Cyril Hrubis + */ + +#ifndef TST_SAFE_NET_H__ +#define TST_SAFE_NET_H__ + +#include +#include +#include +#include +#include + +#include "safe_net_fn.h" +#include "tst_net.h" + +#define SAFE_SOCKET(domain, type, protocol) \ + safe_socket(__FILE__, __LINE__, NULL, domain, type, protocol) + +#define SAFE_SOCKETPAIR(domain, type, protocol, sv) \ + safe_socketpair(__FILE__, __LINE__, domain, type, protocol, sv) + +#define SAFE_GETSOCKOPT(fd, level, optname, optval, optlen) \ + safe_getsockopt(__FILE__, __LINE__, fd, level, optname, optval, optlen) + +#define SAFE_SETSOCKOPT(fd, level, optname, optval, optlen) \ + safe_setsockopt(__FILE__, __LINE__, fd, level, optname, optval, optlen) + +#define SAFE_SETSOCKOPT_INT(fd, l, n, val) \ + do { \ + int v = val; \ + safe_setsockopt(__FILE__, __LINE__, fd, l, n, &v, sizeof(v)); \ + } while (0) + +#define SAFE_SEND(strict, sockfd, buf, len, flags) \ + safe_send(__FILE__, __LINE__, strict, sockfd, buf, len, flags) + +#define SAFE_SENDTO(strict, fd, buf, len, flags, dest_addr, addrlen) \ + safe_sendto(__FILE__, __LINE__, strict, fd, buf, len, flags, \ + dest_addr, addrlen) + +#define SAFE_SENDMSG(msg_len, fd, msg, flags) \ + safe_sendmsg(__FILE__, __LINE__, msg_len, fd, msg, flags) + +#define SAFE_RECVMSG(msg_len, fd, msg, flags) \ + safe_recvmsg(__FILE__, __LINE__, msg_len, fd, msg, flags) + +#define SAFE_BIND(socket, address, address_len) \ + safe_bind(__FILE__, __LINE__, NULL, socket, address, \ + address_len) + +#define SAFE_LISTEN(socket, backlog) \ + safe_listen(__FILE__, __LINE__, NULL, socket, backlog) + +#define SAFE_ACCEPT(sockfd, addr, addrlen) \ + safe_accept(__FILE__, __LINE__, NULL, sockfd, addr, addrlen) + +#define SAFE_CONNECT(sockfd, addr, addrlen) \ + safe_connect(__FILE__, __LINE__, NULL, sockfd, addr, addrlen) + +#define SAFE_GETSOCKNAME(sockfd, addr, addrlen) \ + safe_getsockname(__FILE__, __LINE__, NULL, sockfd, addr, \ + addrlen) + +#define SAFE_GETHOSTNAME(name, size) \ + safe_gethostname(__FILE__, __LINE__, name, size) + +#define TST_GETSOCKPORT(sockfd) \ + tst_getsockport(__FILE__, __LINE__, sockfd) + +#define TST_GET_UNUSED_PORT(family, type) \ + tst_get_unused_port(__FILE__, __LINE__, NULL, family, type) + +/* new API only */ + +#define SAFE_GETADDRINFO(src_addr, port, hints, addr_info) \ + safe_getaddrinfo(__FILE__, __LINE__, src_addr, port, hints, addr_info) + +#endif /* TST_SAFE_NET_H__ */ diff --git a/fsstress/include/tst_safe_posix_ipc.h b/fsstress/include/tst_safe_posix_ipc.h new file mode 100644 index 0000000000..d74ef4ee89 --- /dev/null +++ b/fsstress/include/tst_safe_posix_ipc.h @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2017-2019 Petr Vorel pvorel@suse.cz + */ + +#ifndef TST_SAFE_POSIX_IPC_H__ +#define TST_SAFE_POSIX_IPC_H__ + +#include +#include + +#define SAFE_MQ_OPEN(pathname, oflags, ...) \ + safe_mq_open(__FILE__, __LINE__, (pathname), (oflags), ##__VA_ARGS__) + +static inline int safe_mq_open(const char *file, const int lineno, + const char *pathname, int oflags, ...) +{ + va_list ap; + int rval; + mode_t mode; + struct mq_attr *attr; + + va_start(ap, oflags); + + /* Android's NDK's mode_t is smaller than an int, which results in + * SIGILL here when passing the mode_t type. + */ +#ifndef __ANDROID__ + mode = va_arg(ap, mode_t); +#else + mode = va_arg(ap, int); +#endif + + attr = va_arg(ap, struct mq_attr *); + + va_end(ap); + + rval = mq_open(pathname, oflags, mode, attr); + if (rval == -1) { + tst_brk(TBROK | TERRNO, "%s:%d: mq_open(%s,%d,0%o,%p) failed", + file, lineno, pathname, oflags, mode, attr); + } + + return rval; +} + +#endif /* TST_SAFE_POSIX_IPC_H__ */ diff --git a/fsstress/include/tst_safe_prw.h b/fsstress/include/tst_safe_prw.h new file mode 100644 index 0000000000..01a684da31 --- /dev/null +++ b/fsstress/include/tst_safe_prw.h @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2010-2017 Linux Test Project + */ + +#ifndef TST_SAFE_PRW_H__ +#define TST_SAFE_PRW_H__ + +static inline ssize_t safe_pread(const char *file, const int lineno, + char len_strict, int fildes, void *buf, size_t nbyte, + off_t offset) +{ + ssize_t rval; + + rval = pread(fildes, buf, nbyte, offset); + + if (rval == -1 || (len_strict && (size_t)rval != nbyte)) { + tst_brk_(file, lineno, TBROK | TERRNO, + "pread(%d,%p,%zu,%lld) failed", + fildes, buf, nbyte, (long long)offset); + } + + return rval; +} +#define SAFE_PREAD(len_strict, fildes, buf, nbyte, offset) \ + safe_pread(__FILE__, __LINE__, (len_strict), (fildes), \ + (buf), (nbyte), (offset)) + +static inline ssize_t safe_pwrite(const char *file, const int lineno, + char len_strict, int fildes, const void *buf, size_t nbyte, + off_t offset) +{ + ssize_t rval; + + rval = pwrite(fildes, buf, nbyte, offset); + if (rval == -1 || (len_strict && (size_t)rval != nbyte)) { + tst_brk_(file, lineno, TBROK | TERRNO, + "pwrite(%d,%p,%zu,%lld) failed", + fildes, buf, nbyte, (long long)offset); + } + + return rval; +} +#define SAFE_PWRITE(len_strict, fildes, buf, nbyte, offset) \ + safe_pwrite(__FILE__, __LINE__, (len_strict), (fildes), \ + (buf), (nbyte), (offset)) + +#endif /* SAFE_PRW_H__ */ diff --git a/fsstress/include/tst_safe_pthread.h b/fsstress/include/tst_safe_pthread.h new file mode 100644 index 0000000000..0c6d4d2010 --- /dev/null +++ b/fsstress/include/tst_safe_pthread.h @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2016 Oracle and/or its affiliates. All Rights Reserved. + */ + +#ifndef TST_SAFE_PTHREAD_H__ +#define TST_SAFE_PTHREAD_H__ + +/* + * Macro to use for making functions called only once in + * multi-threaded tests such as init or cleanup function. + * The first call to @name_fn function by any thread shall + * call the @exec_fn. Subsequent calls shall not call @exec_fn. + * *_fn functions must not take any arguments. + */ +#define TST_DECLARE_ONCE_FN(name_fn, exec_fn) \ + void name_fn(void) \ + { \ + static pthread_once_t ltp_once = PTHREAD_ONCE_INIT; \ + pthread_once(<p_once, exec_fn); \ + } + +int safe_pthread_create(const char *file, const int lineno, + pthread_t *thread_id, const pthread_attr_t *attr, + void *(*thread_fn)(void *), void *arg); +#define SAFE_PTHREAD_CREATE(thread_id, attr, thread_fn, arg) \ + safe_pthread_create(__FILE__, __LINE__, thread_id, attr, thread_fn, arg) + +int safe_pthread_join(const char *file, const int lineno, + pthread_t thread_id, void **retval); +#define SAFE_PTHREAD_JOIN(thread_id, retval) \ + safe_pthread_join(__FILE__, __LINE__, thread_id, retval) + +#endif /* TST_SAFE_PTHREAD_H__ */ diff --git a/fsstress/include/tst_safe_stdio.h b/fsstress/include/tst_safe_stdio.h new file mode 100644 index 0000000000..e4bff34da1 --- /dev/null +++ b/fsstress/include/tst_safe_stdio.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2013-2016 Cyril Hrubis + */ + +#ifndef TST_SAFE_STDIO_H__ +#define TST_SAFE_STDIO_H__ + +#include + +#include "safe_stdio_fn.h" + +#define SAFE_FOPEN(path, mode) \ + safe_fopen(__FILE__, __LINE__, NULL, path, mode) + +#define SAFE_FCLOSE(f) \ + safe_fclose(__FILE__, __LINE__, NULL, f) + +#define SAFE_ASPRINTF(strp, fmt, ...) \ + safe_asprintf(__FILE__, __LINE__, NULL, strp, fmt, __VA_ARGS__) + +#define SAFE_POPEN(command, type) \ + safe_popen(__FILE__, __LINE__, NULL, command, type) + +#endif /* TST_SAFE_STDIO_H__ */ diff --git a/fsstress/include/tst_safe_sysv_ipc.h b/fsstress/include/tst_safe_sysv_ipc.h new file mode 100644 index 0000000000..3e0e50e8de --- /dev/null +++ b/fsstress/include/tst_safe_sysv_ipc.h @@ -0,0 +1,54 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2017 Xiao yang + */ + +#ifndef TST_SAFE_SYSV_IPC_H__ +#define TST_SAFE_SYSV_IPC_H__ + +#include +#include +#include +#include + +int safe_msgget(const char *file, const int lineno, key_t key, int msgflg); +#define SAFE_MSGGET(key, msgflg) \ + safe_msgget(__FILE__, __LINE__, (key), (msgflg)) + +int safe_msgsnd(const char *file, const int lineno, int msqid, const void *msgp, + size_t msgsz, int msgflg); +#define SAFE_MSGSND(msqid, msgp, msgsz, msgflg) \ + safe_msgsnd(__FILE__, __LINE__, (msqid), (msgp), (msgsz), (msgflg)) + +ssize_t safe_msgrcv(const char *file, const int lineno, int msqid, void *msgp, + size_t msgsz, long msgtyp, int msgflg); +#define SAFE_MSGRCV(msqid, msgp, msgsz, msgtyp, msgflg) \ + safe_msgrcv(__FILE__, __LINE__, (msqid), (msgp), (msgsz), (msgtyp), (msgflg)) + +int safe_msgctl(const char *file, const int lineno, int msqid, int cmd, + struct msqid_ds *buf); +#define SAFE_MSGCTL(msqid, cmd, buf) ({ \ + int tst_ret_ = safe_msgctl(__FILE__, __LINE__, (msqid), (cmd), (buf)); \ + (msqid) = ((cmd) == IPC_RMID ? -1 : (msqid)); \ + tst_ret_;}) + +int safe_shmget(const char *file, const int lineno, key_t key, size_t size, + int shmflg); +#define SAFE_SHMGET(key, size, shmflg) \ + safe_shmget(__FILE__, __LINE__, (key), (size), (shmflg)) + +void *safe_shmat(const char *file, const int lineno, int shmid, + const void *shmaddr, int shmflg); +#define SAFE_SHMAT(shmid, shmaddr, shmflg) \ + safe_shmat(__FILE__, __LINE__, (shmid), (shmaddr), (shmflg)) + +int safe_shmdt(const char *file, const int lineno, const void *shmaddr); +#define SAFE_SHMDT(shmaddr) safe_shmdt(__FILE__, __LINE__, (shmaddr)) + +int safe_shmctl(const char *file, const int lineno, int shmid, int cmd, + struct shmid_ds *buf); +#define SAFE_SHMCTL(shmid, cmd, buf) ({ \ + int tst_ret_ = safe_shmctl(__FILE__, __LINE__, (shmid), (cmd), (buf)); \ + (shmid) = ((cmd) == IPC_RMID ? -1 : (shmid)); \ + tst_ret_;}) + +#endif /* TST_SAFE_SYSV_IPC_H__ */ diff --git a/fsstress/include/tst_safe_timerfd.h b/fsstress/include/tst_safe_timerfd.h new file mode 100644 index 0000000000..526f128389 --- /dev/null +++ b/fsstress/include/tst_safe_timerfd.h @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2020 Petr Vorel + */ + +#ifndef TST_SAFE_TIMERFD_H__ +#define TST_SAFE_TIMERFD_H__ + +#include "lapi/timerfd.h" + +int safe_timerfd_create(const char *file, const int lineno, + int clockid, int flags); + +#define SAFE_TIMERFD_CREATE(clockid, flags)\ + safe_timerfd_create(__FILE__, __LINE__, (clockid), (flags)) + +int safe_timerfd_gettime(const char *file, const int lineno, + int fd, struct itimerspec *curr_value); + +#define SAFE_TIMERFD_GETTIME(fd, curr_value)\ + safe_timerfd_gettime(__FILE__, __LINE__, (fd), (curr_value)) + +int safe_timerfd_settime(const char *file, const int lineno, + int fd, int flags, + const struct itimerspec *new_value, + struct itimerspec *old_value); + +#define SAFE_TIMERFD_SETTIME(fd, flags, new_value, old_value)\ + safe_timerfd_settime(__FILE__, __LINE__, (fd), (flags), (new_value), \ + (old_value)) + +#endif /* SAFE_TIMERFD_H__ */ diff --git a/fsstress/include/tst_sig_proc.h b/fsstress/include/tst_sig_proc.h new file mode 100644 index 0000000000..b85981e772 --- /dev/null +++ b/fsstress/include/tst_sig_proc.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2016 Linux Test Project + */ + +#ifndef TST_SIG_PROC_H__ +#define TST_SIG_PROC_H__ + +#include + +pid_t create_sig_proc(int sig, int count, unsigned int usec); + +#endif /* TST_SIG_PROC_H__ */ diff --git a/fsstress/include/tst_sys_conf.h b/fsstress/include/tst_sys_conf.h new file mode 100644 index 0000000000..323e29a278 --- /dev/null +++ b/fsstress/include/tst_sys_conf.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2018 Jan Stancek + */ + +#ifndef TST_SYS_CONF_H__ +#define TST_SYS_CONF_H__ + +struct tst_sys_conf { + char path[PATH_MAX]; + char value[PATH_MAX]; + struct tst_sys_conf *next; +}; + +int tst_sys_conf_save_str(const char *path, const char *value); +int tst_sys_conf_save(const char *path); +void tst_sys_conf_restore(int verbose); +void tst_sys_conf_dump(void); + +#endif diff --git a/fsstress/include/tst_taint.h b/fsstress/include/tst_taint.h new file mode 100644 index 0000000000..cfa84dded2 --- /dev/null +++ b/fsstress/include/tst_taint.h @@ -0,0 +1,93 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2018 Michael Moese + */ + +/* Usage example + * + * ... + * #include "tst_test.h" + * #include "tst_taint.h" + * .. + * void setup(void) + * { + * ... + * tst_taint_init(TST_TAINT_W | TST_TAINT_D)); + * ... + * } + * + * void run(void) + * { + * ... + * . test code here + * ... + * if (tst_taint_check() != 0) + * tst_res(TFAIL, "kernel has issues"); + * else + * tst_res(TPASS, "kernel seems to be fine"); + * } + * + * + * + * The above code checks, if the kernel issued a warning (TST_TAINT_W) + * or even died (TST_TAINT_D) during test execution. + * If these are set after running a test case, we most likely + * triggered a kernel bug. + */ + +#ifndef TST_TAINTED_H__ +#define TST_TAINTED_H__ + +/* + * This are all 17 flags that are present in kernel 4.15 + * see kernel/panic.c in kernel sources + * + * Not all of them are valid in all kernel versions. + */ +#define TST_TAINT_G (1 << 0) /* a module with non-GPL license loaded */ +#define TST_TAINT_F (1 << 1) /* a module was force-loaded */ +#define TST_TAINT_S (1 << 2) /* SMP with Non-SMP kernel */ +#define TST_TAINT_R (1 << 3) /* module force unloaded */ +#define TST_TAINT_M (1 << 4) /* machine check error occurred */ +#define TST_TAINT_B (1 << 5) /* page-release function found bad page */ +#define TST_TAINT_U (1 << 6) /* user requested taint flag */ +#define TST_TAINT_D (1 << 7) /* kernel died recently - OOPS or BUG */ +#define TST_TAINT_A (1 << 8) /* ACPI table has been overwritten */ +#define TST_TAINT_W (1 << 9) /* a warning has been issued by kernel */ +#define TST_TAINT_C (1 << 10) /* driver from drivers/staging was loaded */ +#define TST_TAINT_I (1 << 11) /* working around BIOS/Firmware bug */ +#define TST_TAINT_O (1 << 12) /* out of tree module loaded */ +#define TST_TAINT_E (1 << 13) /* unsigned module was loaded */ +#define TST_TAINT_L (1 << 14) /* A soft lock-up has previously occurred */ +#define TST_TAINT_K (1 << 15) /* kernel has been live-patched */ +#define TST_TAINT_X (1 << 16) /* auxiliary taint, for distro's use */ +#define TST_TAINT_T (1 << 17) /* kernel was built with the struct randomization plugin */ + +/* + * Initialize and prepare support for checking tainted kernel. + * + * supply the mask of TAINT-flags you want to check, for example + * (TST_TAINT_W | TST_TAINT_D) when you want to check if the kernel issued + * a warning or even reported it died. + * + * This function tests if the requested flags are supported on the + * locally running kernel. In case the tainted-flags are already set by + * the kernel, there is no reason to continue and TCONF is generated. + * + * The mask must not be zero. + */ +void tst_taint_init(unsigned int mask); + + +/* + * check if the tainted flags handed to tst_taint_init() are still not set + * during or after running the test. + * Calling this function is only allowed after tst_taint_init() was called, + * otherwise TBROK will be generated. + * + * returns 0 or a bitmask of the flags that currently tainted the kernel. + */ +unsigned int tst_taint_check(void); + + +#endif /* TST_TAINTED_H__ */ diff --git a/fsstress/include/tst_test.h b/fsstress/include/tst_test.h new file mode 100644 index 0000000000..b84f7b9dd5 --- /dev/null +++ b/fsstress/include/tst_test.h @@ -0,0 +1,325 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2015-2016 Cyril Hrubis + * Copyright (c) Linux Test Project, 2016-2019 + */ + +#ifndef TST_TEST_H__ +#define TST_TEST_H__ + +#ifdef __TEST_H__ +# error Oldlib test.h already included +#endif /* __TEST_H__ */ + +#include +#include +#include +#include + +#include "tst_common.h" +#include "tst_res_flags.h" +#include "tst_checkpoint.h" +#include "tst_device.h" +#include "tst_mkfs.h" +#include "tst_fs.h" +#include "tst_pid.h" +#include "tst_cmd.h" +#include "tst_cpu.h" +#include "tst_process_state.h" +#include "tst_atomic.h" +#include "tst_kvercmp.h" +#include "tst_clone.h" +#include "tst_kernel.h" +#include "tst_minmax.h" +#include "tst_get_bad_addr.h" +#include "tst_path_has_mnt_flags.h" +#include "tst_sys_conf.h" +#include "tst_coredump.h" +#include "tst_buffers.h" +#include "tst_capability.h" +#include "tst_hugepage.h" +#include "tst_assert.h" +#include "tst_cgroup.h" + +/* + * Reports testcase result. + */ +void tst_res_(const char *file, const int lineno, int ttype, + const char *fmt, ...) + __attribute__ ((format (printf, 4, 5))); + +#define tst_res(ttype, arg_fmt, ...) \ + ({ \ + TST_RES_SUPPORTS_TCONF_TFAIL_TINFO_TPASS_TWARN(!((TTYPE_RESULT(ttype) ?: TCONF) & \ + (TCONF | TFAIL | TINFO | TPASS | TWARN))); \ + tst_res_(__FILE__, __LINE__, (ttype), (arg_fmt), ##__VA_ARGS__);\ + }) + +void tst_resm_hexd_(const char *file, const int lineno, int ttype, + const void *buf, size_t size, const char *arg_fmt, ...) + __attribute__ ((format (printf, 6, 7))); + +#define tst_res_hexd(ttype, buf, size, arg_fmt, ...) \ + tst_resm_hexd_(__FILE__, __LINE__, (ttype), (buf), (size), \ + (arg_fmt), ##__VA_ARGS__) + +/* + * Reports result and exits a test. + */ +void tst_brk_(const char *file, const int lineno, int ttype, + const char *fmt, ...) + __attribute__ ((format (printf, 4, 5))); + +#define tst_brk(ttype, arg_fmt, ...) \ + ({ \ + TST_BRK_SUPPORTS_ONLY_TCONF_TBROK(!((ttype) & \ + (TBROK | TCONF | TFAIL))); \ + tst_brk_(__FILE__, __LINE__, (ttype), (arg_fmt), ##__VA_ARGS__);\ + }) + +/* flush stderr and stdout */ +void tst_flush(void); + +pid_t safe_fork(const char *filename, unsigned int lineno); +#define SAFE_FORK() \ + safe_fork(__FILE__, __LINE__) + +#define TST_TRACE(expr) \ + ({int ret = expr; \ + ret != 0 ? tst_res(TINFO, #expr " failed"), ret : ret; }) \ + +#include "tst_safe_macros.h" +#include "tst_safe_file_ops.h" +#include "tst_safe_net.h" + +/* + * Wait for all children and exit with TBROK if + * any of them returned a non-zero exit status. + */ +void tst_reap_children(void); + +struct tst_option { + char *optstr; + char **arg; + char *help; +}; + +/* + * Options parsing helpers. + * + * If str is NULL these are No-op. + * + * On failure non-zero (errno) is returned. + */ +int tst_parse_int(const char *str, int *val, int min, int max); +int tst_parse_long(const char *str, long *val, long min, long max); +int tst_parse_float(const char *str, float *val, float min, float max); + +struct tst_tag { + const char *name; + const char *value; +}; + +extern unsigned int tst_variant; + +struct tst_test { + /* number of tests available in test() function */ + unsigned int tcnt; + + struct tst_option *options; + + const char *min_kver; + + /* If set the test is compiled out */ + const char *tconf_msg; + + int needs_tmpdir:1; + int needs_root:1; + int forks_child:1; + int needs_device:1; + int needs_checkpoints:1; + int needs_overlay:1; + int format_device:1; + int mount_device:1; + int needs_rofs:1; + int child_needs_reinit:1; + int needs_devfs:1; + int restore_wallclock:1; + /* + * If set the test function will be executed for all available + * filesystems and the current filesytem type would be set in the + * tst_device->fs_type. + * + * The test setup and cleanup are executed before/after __EACH__ call + * to the test function. + */ + int all_filesystems:1; + + /* + * If set non-zero number of request_hugepages, test will try to reserve the + * expected number of hugepage for testing in setup phase. If system does not + * have enough hpage for using, it will try the best to reserve 80% available + * number of hpages. With success test stores the reserved hugepage number in + * 'tst_hugepages. For the system without hugetlb supporting, variable + * 'tst_hugepages' will be set to 0. + * + * Also, we do cleanup and restore work for the hpages resetting automatically. + */ + unsigned long request_hugepages; + + /* + * If set non-zero denotes number of test variant, the test is executed + * variants times each time with tst_variant set to different number. + * + * This allows us to run the same test for different settings. The + * intended use is to test different syscall wrappers/variants but the + * API is generic and does not limit the usage in any way. + */ + unsigned int test_variants; + + /* Minimal device size in megabytes */ + unsigned int dev_min_size; + + /* Device filesystem type override NULL == default */ + const char *dev_fs_type; + /* Flags to be passed to tst_get_supported_fs_types() */ + int dev_fs_flags; + + /* Options passed to SAFE_MKFS() when format_device is set */ + const char *const *dev_fs_opts; + const char *const *dev_extra_opts; + + /* Device mount options, used if mount_device is set */ + const char *mntpoint; + unsigned int mnt_flags; + void *mnt_data; + + /* override default timeout per test run, disabled == -1 */ + int timeout; + + void (*setup)(void); + void (*cleanup)(void); + + void (*test)(unsigned int test_nr); + void (*test_all)(void); + + /* Syscall name used by the timer measurement library */ + const char *scall; + + /* Sampling function for timer measurement testcases */ + int (*sample)(int clk_id, long long usec); + + /* NULL terminated array of resource file names */ + const char *const *resource_files; + + /* NULL terminated array of needed kernel drivers */ + const char * const *needs_drivers; + + /* + * NULL terminated array of (/proc, /sys) files to save + * before setup and restore after cleanup + */ + const char * const *save_restore; + + /* + * NULL terminated array of kernel config options required for the + * test. + */ + const char *const *needs_kconfigs; + + /* + * NULL-terminated array to be allocated buffers. + */ + struct tst_buffers *bufs; + + /* + * NULL-terminated array of capability settings + */ + struct tst_cap *caps; + + /* + * {NULL, NULL} terminated array of tags. + */ + const struct tst_tag *tags; + + /* NULL terminated array of required commands */ + const char *const *needs_cmds; +}; + +/* + * Runs tests. + */ +void tst_run_tcases(int argc, char *argv[], struct tst_test *self) + __attribute__ ((noreturn)); + +/* + * Does library initialization for child processes started by exec() + * + * The LTP_IPC_PATH variable must be passed to the program environment. + */ +void tst_reinit(void); + +//TODO Clean? +#define TEST(SCALL) \ + do { \ + errno = 0; \ + TST_RET = SCALL; \ + TST_ERR = errno; \ + } while (0) + +#define TEST_VOID(SCALL) \ + do { \ + errno = 0; \ + SCALL; \ + TST_ERR = errno; \ + } while (0) + +extern long TST_RET; +extern int TST_ERR; + +extern void *TST_RET_PTR; + +#define TESTPTR(SCALL) \ + do { \ + errno = 0; \ + TST_RET_PTR = (void*)SCALL; \ + TST_ERR = errno; \ + } while (0) + +/* + * Functions to convert ERRNO to its name and SIGNAL to its name. + */ +const char *tst_strerrno(int err); +const char *tst_strsig(int sig); +/* + * Returns string describing status as returned by wait(). + * + * BEWARE: Not thread safe. + */ +const char *tst_strstatus(int status); + +unsigned int tst_timeout_remaining(void); +unsigned int tst_multiply_timeout(unsigned int timeout); +void tst_set_timeout(int timeout); + + +/* + * Returns path to the test temporary directory in a newly allocated buffer. + */ +char *tst_get_tmpdir(void); + +#ifndef TST_NO_DEFAULT_MAIN + +static struct tst_test test; + +int main(int argc, char *argv[]) +{ + tst_run_tcases(argc, argv, &test); +} + +#endif /* TST_NO_DEFAULT_MAIN */ + +#define TST_TEST_TCONF(message) \ + static struct tst_test test = { .tconf_msg = message } \ + +#endif /* TST_TEST_H__ */ diff --git a/fsstress/include/tst_timer.h b/fsstress/include/tst_timer.h new file mode 100644 index 0000000000..e42b54f0e9 --- /dev/null +++ b/fsstress/include/tst_timer.h @@ -0,0 +1,1055 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (C) 2015-2020 Cyril Hrubis + */ + + /* + + Timer - struct timespec conversion runtimes and easy to use functions to + measure elapsed time. + + */ + +#ifndef TST_TIMER +#define TST_TIMER + +#include +#include +#include +#include +#include "tst_test.h" +#include "lapi/common_timers.h" +#include "lapi/posix_types.h" +#include "lapi/syscalls.h" + +/* + * Converts timeval to microseconds. + */ +static inline long long tst_timeval_to_us(struct timeval t) +{ + return t.tv_sec * 1000000 + t.tv_usec; +} + +/* + * Converts timeval to milliseconds. + */ +static inline long long tst_timeval_to_ms(struct timeval t) +{ + return t.tv_sec * 1000 + (t.tv_usec + 500) / 1000; +} + +/* + * Converts milliseconds to struct timeval + */ +static inline struct timeval tst_ms_to_timeval(long long ms) +{ + struct timeval ret; + + ret.tv_sec = ms / 1000; + ret.tv_usec = (ms % 1000) * 1000; + + return ret; +} + +/* + * Converts microseconds to struct timeval + */ +static inline struct timeval tst_us_to_timeval(long long us) +{ + struct timeval ret; + + ret.tv_sec = us / 1000000; + ret.tv_usec = us % 1000000; + + return ret; +} + +/* + * Returns difference between two timeval structures. + */ +static inline struct timeval tst_timeval_diff(struct timeval t1, + struct timeval t2) +{ + struct timeval res; + + res.tv_sec = t1.tv_sec - t2.tv_sec; + + if (t1.tv_usec < t2.tv_usec) { + res.tv_sec--; + res.tv_usec = 1000000 - (t2.tv_usec - t1.tv_usec); + } else { + res.tv_usec = t1.tv_usec - t2.tv_usec; + } + + return res; +} + +static inline long long tst_timeval_diff_us(struct timeval t1, + struct timeval t2) +{ + return tst_timeval_to_us(tst_timeval_diff(t1, t2)); +} + +static inline long long tst_timeval_diff_ms(struct timeval t1, + struct timeval t2) +{ + return tst_timeval_to_ms(tst_timeval_diff(t1, t2)); +} + +#ifndef __kernel_timespec + +typedef __kernel_long_t __kernel_old_time_t; + +struct __kernel_old_timeval { + __kernel_old_time_t tv_sec; /* seconds */ + __kernel_suseconds_t tv_usec; /* microseconds */ +}; + +struct __kernel_old_timespec { + __kernel_old_time_t tv_sec; /* seconds */ + __kernel_old_time_t tv_nsec; /* nanoseconds */ +}; + +typedef long long __kernel_time64_t; + +struct __kernel_timespec { + __kernel_time64_t tv_sec; /* seconds */ + long long tv_nsec; /* nanoseconds */ +}; + +struct __kernel_old_itimerspec { + struct __kernel_old_timespec it_interval; /* timer period */ + struct __kernel_old_timespec it_value; /* timer expiration */ +}; + +struct __kernel_itimerspec { + struct __kernel_timespec it_interval; /* timer period */ + struct __kernel_timespec it_value; /* timer expiration */ +}; +#endif + +enum tst_ts_type { + TST_LIBC_TIMESPEC, + TST_KERN_OLD_TIMESPEC, + TST_KERN_TIMESPEC +}; + +struct tst_ts { + enum tst_ts_type type; + union ts { + struct timespec libc_ts; + struct __kernel_old_timespec kern_old_ts; + struct __kernel_timespec kern_ts; + } ts; +}; + +struct tst_its { + enum tst_ts_type type; + union { + struct __kernel_old_itimerspec kern_old_its; + struct __kernel_itimerspec kern_its; + } ts; +}; + +static inline void *tst_ts_get(struct tst_ts *t) +{ + if (!t) + return NULL; + + switch (t->type) { + case TST_LIBC_TIMESPEC: + return &t->ts.libc_ts; + case TST_KERN_OLD_TIMESPEC: + return &t->ts.kern_old_ts; + case TST_KERN_TIMESPEC: + return &t->ts.kern_ts; + default: + tst_brk(TBROK, "Invalid type: %d", t->type); + return NULL; + } +} + +static inline void *tst_its_get(struct tst_its *t) +{ + if (!t) + return NULL; + + switch (t->type) { + case TST_KERN_OLD_TIMESPEC: + return &t->ts.kern_old_its; + case TST_KERN_TIMESPEC: + return &t->ts.kern_its; + default: + tst_brk(TBROK, "Invalid type: %d", t->type); + return NULL; + } +} + +static inline int libc_clock_getres(clockid_t clk_id, void *ts) +{ + return clock_getres(clk_id, ts); +} + +static inline int sys_clock_getres(clockid_t clk_id, void *ts) +{ + return tst_syscall(__NR_clock_getres, clk_id, ts); +} + +static inline int sys_clock_getres64(clockid_t clk_id, void *ts) +{ + return tst_syscall(__NR_clock_getres_time64, clk_id, ts); +} + +static inline int libc_clock_gettime(clockid_t clk_id, void *ts) +{ + return clock_gettime(clk_id, ts); +} + +static inline int sys_clock_gettime(clockid_t clk_id, void *ts) +{ + return tst_syscall(__NR_clock_gettime, clk_id, ts); +} + +static inline int sys_clock_gettime64(clockid_t clk_id, void *ts) +{ + return tst_syscall(__NR_clock_gettime64, clk_id, ts); +} + +static inline int libc_clock_settime(clockid_t clk_id, void *ts) +{ + return clock_settime(clk_id, ts); +} + +static inline int sys_clock_settime(clockid_t clk_id, void *ts) +{ + return tst_syscall(__NR_clock_settime, clk_id, ts); +} + +static inline int sys_clock_settime64(clockid_t clk_id, void *ts) +{ + return tst_syscall(__NR_clock_settime64, clk_id, ts); +} + +static inline int libc_clock_nanosleep(clockid_t clk_id, int flags, + void *request, void *remain) +{ + return clock_nanosleep(clk_id, flags, request, remain); +} + +static inline int sys_clock_nanosleep(clockid_t clk_id, int flags, + void *request, void *remain) +{ + return tst_syscall(__NR_clock_nanosleep, clk_id, flags, + request, remain); +} + +static inline int sys_clock_nanosleep64(clockid_t clk_id, int flags, + void *request, void *remain) +{ + return tst_syscall(__NR_clock_nanosleep_time64, clk_id, flags, + request, remain); +} + +static inline int sys_futex(int *uaddr, int futex_op, int val, void *to, + int *uaddr2, int val3) +{ + return tst_syscall(__NR_futex, uaddr, futex_op, val, to, uaddr2, val3); +} + +static inline int sys_futex_time64(int *uaddr, int futex_op, int val, void *to, + int *uaddr2, int val3) +{ + return tst_syscall(__NR_futex_time64, uaddr, futex_op, val, to, uaddr2, val3); +} + +static inline int libc_mq_timedsend(mqd_t mqdes, const char *msg_ptr, + size_t msg_len, unsigned int msg_prio, void *abs_timeout) +{ + return mq_timedsend(mqdes, msg_ptr, msg_len, msg_prio, abs_timeout); +} + +static inline int sys_mq_timedsend(mqd_t mqdes, const char *msg_ptr, + size_t msg_len, unsigned int msg_prio, void *abs_timeout) +{ + return tst_syscall(__NR_mq_timedsend, mqdes, msg_ptr, msg_len, msg_prio, + abs_timeout); +} + +static inline int sys_mq_timedsend64(mqd_t mqdes, const char *msg_ptr, + size_t msg_len, unsigned int msg_prio, void *abs_timeout) +{ + return tst_syscall(__NR_mq_timedsend_time64, mqdes, msg_ptr, msg_len, + msg_prio, abs_timeout); +} + +static inline ssize_t libc_mq_timedreceive(mqd_t mqdes, char *msg_ptr, + size_t msg_len, unsigned int *msg_prio, void *abs_timeout) +{ + return mq_timedreceive(mqdes, msg_ptr, msg_len, msg_prio, abs_timeout); +} + +static inline ssize_t sys_mq_timedreceive(mqd_t mqdes, char *msg_ptr, + size_t msg_len, unsigned int *msg_prio, void *abs_timeout) +{ + return tst_syscall(__NR_mq_timedreceive, mqdes, msg_ptr, msg_len, + msg_prio, abs_timeout); +} + +static inline ssize_t sys_mq_timedreceive64(mqd_t mqdes, char *msg_ptr, + size_t msg_len, unsigned int *msg_prio, void *abs_timeout) +{ + return tst_syscall(__NR_mq_timedreceive_time64, mqdes, msg_ptr, msg_len, + msg_prio, abs_timeout); +} + +static inline int libc_sched_rr_get_interval(pid_t pid, void *ts) +{ + return sched_rr_get_interval(pid, ts); +} + +static inline int sys_sched_rr_get_interval(pid_t pid, void *ts) +{ + return tst_syscall(__NR_sched_rr_get_interval, pid, ts); +} + +static inline int sys_sched_rr_get_interval64(pid_t pid, void *ts) +{ + return tst_syscall(__NR_sched_rr_get_interval_time64, pid, ts); +} + +static inline int sys_timer_gettime(timer_t timerid, void *its) +{ + return tst_syscall(__NR_timer_gettime, timerid, its); +} + +static inline int sys_timer_gettime64(timer_t timerid, void *its) +{ + return tst_syscall(__NR_timer_gettime64, timerid, its); +} + +static inline int sys_timer_settime(timer_t timerid, int flags, void *its, + void *old_its) +{ + return tst_syscall(__NR_timer_settime, timerid, flags, its, old_its); +} + +static inline int sys_timer_settime64(timer_t timerid, int flags, void *its, + void *old_its) +{ + return tst_syscall(__NR_timer_settime64, timerid, flags, its, old_its); +} + +static inline int sys_timerfd_gettime(int fd, void *its) +{ + return tst_syscall(__NR_timerfd_gettime, fd, its); +} + +static inline int sys_timerfd_gettime64(int fd, void *its) +{ + return tst_syscall(__NR_timerfd_gettime64, fd, its); +} + +static inline int sys_timerfd_settime(int fd, int flags, void *its, + void *old_its) +{ + return tst_syscall(__NR_timerfd_settime, fd, flags, its, old_its); +} + +static inline int sys_timerfd_settime64(int fd, int flags, void *its, + void *old_its) +{ + return tst_syscall(__NR_timerfd_settime64, fd, flags, its, old_its); +} + +/* + * Returns tst_ts seconds. + */ +static inline long long tst_ts_get_sec(struct tst_ts ts) +{ + switch (ts.type) { + case TST_LIBC_TIMESPEC: + return ts.ts.libc_ts.tv_sec; + case TST_KERN_OLD_TIMESPEC: + return ts.ts.kern_old_ts.tv_sec; + case TST_KERN_TIMESPEC: + return ts.ts.kern_ts.tv_sec; + default: + tst_brk(TBROK, "Invalid type: %d", ts.type); + return -1; + } +} + +/* + * Returns tst_ts nanoseconds. + */ +static inline long long tst_ts_get_nsec(struct tst_ts ts) +{ + switch (ts.type) { + case TST_LIBC_TIMESPEC: + return ts.ts.libc_ts.tv_nsec; + case TST_KERN_OLD_TIMESPEC: + return ts.ts.kern_old_ts.tv_nsec; + case TST_KERN_TIMESPEC: + return ts.ts.kern_ts.tv_nsec; + default: + tst_brk(TBROK, "Invalid type: %d", ts.type); + return -1; + } +} + +/* + * Sets tst_ts seconds. + */ +static inline void tst_ts_set_sec(struct tst_ts *ts, long long sec) +{ + switch (ts->type) { + case TST_LIBC_TIMESPEC: + ts->ts.libc_ts.tv_sec = sec; + break; + case TST_KERN_OLD_TIMESPEC: + ts->ts.kern_old_ts.tv_sec = sec; + break; + case TST_KERN_TIMESPEC: + ts->ts.kern_ts.tv_sec = sec; + break; + default: + tst_brk(TBROK, "Invalid type: %d", ts->type); + } +} + +/* + * Sets tst_ts nanoseconds. + */ +static inline void tst_ts_set_nsec(struct tst_ts *ts, long long nsec) +{ + switch (ts->type) { + case TST_LIBC_TIMESPEC: + ts->ts.libc_ts.tv_nsec = nsec; + break; + case TST_KERN_OLD_TIMESPEC: + ts->ts.kern_old_ts.tv_nsec = nsec; + break; + case TST_KERN_TIMESPEC: + ts->ts.kern_ts.tv_nsec = nsec; + break; + default: + tst_brk(TBROK, "Invalid type: %d", ts->type); + } +} + +/* + * Returns tst_its it_interval seconds. + */ +static inline long long tst_its_get_interval_sec(struct tst_its its) +{ + switch (its.type) { + case TST_KERN_OLD_TIMESPEC: + return its.ts.kern_old_its.it_interval.tv_sec; + case TST_KERN_TIMESPEC: + return its.ts.kern_its.it_interval.tv_sec; + default: + tst_brk(TBROK, "Invalid type: %d", its.type); + return -1; + } +} + +/* + * Returns tst_its it_interval nanoseconds. + */ +static inline long long tst_its_get_interval_nsec(struct tst_its its) +{ + switch (its.type) { + case TST_KERN_OLD_TIMESPEC: + return its.ts.kern_old_its.it_interval.tv_nsec; + case TST_KERN_TIMESPEC: + return its.ts.kern_its.it_interval.tv_nsec; + default: + tst_brk(TBROK, "Invalid type: %d", its.type); + return -1; + } +} + +/* + * Sets tst_its it_interval seconds. + */ +static inline void tst_its_set_interval_sec(struct tst_its *its, long long sec) +{ + switch (its->type) { + break; + case TST_KERN_OLD_TIMESPEC: + its->ts.kern_old_its.it_interval.tv_sec = sec; + break; + case TST_KERN_TIMESPEC: + its->ts.kern_its.it_interval.tv_sec = sec; + break; + default: + tst_brk(TBROK, "Invalid type: %d", its->type); + } +} + +/* + * Sets tst_its it_interval nanoseconds. + */ +static inline void tst_its_set_interval_nsec(struct tst_its *its, long long nsec) +{ + switch (its->type) { + break; + case TST_KERN_OLD_TIMESPEC: + its->ts.kern_old_its.it_interval.tv_nsec = nsec; + break; + case TST_KERN_TIMESPEC: + its->ts.kern_its.it_interval.tv_nsec = nsec; + break; + default: + tst_brk(TBROK, "Invalid type: %d", its->type); + } +} + +/* + * Returns tst_its it_value seconds. + */ +static inline long long tst_its_get_value_sec(struct tst_its its) +{ + switch (its.type) { + case TST_KERN_OLD_TIMESPEC: + return its.ts.kern_old_its.it_value.tv_sec; + case TST_KERN_TIMESPEC: + return its.ts.kern_its.it_value.tv_sec; + default: + tst_brk(TBROK, "Invalid type: %d", its.type); + return -1; + } +} + +/* + * Returns tst_its it_value nanoseconds. + */ +static inline long long tst_its_get_value_nsec(struct tst_its its) +{ + switch (its.type) { + case TST_KERN_OLD_TIMESPEC: + return its.ts.kern_old_its.it_value.tv_nsec; + case TST_KERN_TIMESPEC: + return its.ts.kern_its.it_value.tv_nsec; + default: + tst_brk(TBROK, "Invalid type: %d", its.type); + return -1; + } +} + +/* + * Sets tst_its it_value seconds. + */ +static inline void tst_its_set_value_sec(struct tst_its *its, long long sec) +{ + switch (its->type) { + break; + case TST_KERN_OLD_TIMESPEC: + its->ts.kern_old_its.it_value.tv_sec = sec; + break; + case TST_KERN_TIMESPEC: + its->ts.kern_its.it_value.tv_sec = sec; + break; + default: + tst_brk(TBROK, "Invalid type: %d", its->type); + } +} + +/* + * Sets tst_its it_value nanoseconds. + */ +static inline void tst_its_set_value_nsec(struct tst_its *its, long long nsec) +{ + switch (its->type) { + break; + case TST_KERN_OLD_TIMESPEC: + its->ts.kern_old_its.it_value.tv_nsec = nsec; + break; + case TST_KERN_TIMESPEC: + its->ts.kern_its.it_value.tv_nsec = nsec; + break; + default: + tst_brk(TBROK, "Invalid type: %d", its->type); + } +} + +/* + * Checks that timespec is valid, i.e. that the timestamp is not zero and that + * the nanoseconds are normalized i.e. in <0, 1s) interval. + * + * 0: On success, i.e. timespec updated correctly. + * -1: Error, timespec not updated. + * -2: Error, tv_nsec is corrupted. + */ +static inline int tst_ts_valid(struct tst_ts *t) +{ + long long nsec = tst_ts_get_nsec(*t); + + if (nsec < 0 || nsec >= 1000000000) + return -2; + + if (tst_ts_get_sec(*t) == 0 && tst_ts_get_nsec(*t) == 0) + return -1; + + return 0; +} + +/* + * Converts timespec to tst_ts. + */ +static inline struct tst_ts tst_ts_from_timespec(struct timespec ts) +{ + struct tst_ts t = { + .type = TST_LIBC_TIMESPEC, + .ts.libc_ts.tv_sec = ts.tv_sec, + .ts.libc_ts.tv_nsec = ts.tv_nsec, + }; + + return t; +} + +/* + * Converst tst_ts into timespec. + */ +static inline struct timespec tst_ts_to_timespec(struct tst_ts t) +{ + return t.ts.libc_ts; +} + +/* + * Converts tst_ts to nanoseconds. + */ +static inline long long tst_ts_to_ns(struct tst_ts t) +{ + return tst_ts_get_sec(t) * 1000000000 + tst_ts_get_nsec(t); +} + +/* + * Converts tst_ts to microseconds and rounds the value. + */ +static inline long long tst_ts_to_us(struct tst_ts t) +{ + return tst_ts_get_sec(t) * 1000000 + + (tst_ts_get_nsec(t) + 500) / 1000; +} + +/* + * Converts timespec to microseconds and rounds the value. + */ +static inline long long tst_timespec_to_us(struct timespec ts) +{ + return tst_ts_to_us(tst_ts_from_timespec(ts)); +} + +/* + * Converts tst_ts to milliseconds and rounds the value. + */ +static inline long long tst_ts_to_ms(struct tst_ts t) +{ + return tst_ts_get_sec(t) * 1000 + + (tst_ts_get_nsec(t) + 500000) / 1000000; +} + +/* + * Converts timespec to milliseconds and rounds the value. + */ +static inline long long tst_timespec_to_ms(struct timespec ts) +{ + return tst_ts_to_ms(tst_ts_from_timespec(ts)); +} + +/* + * Converts nanoseconds to tst_ts + */ +static inline struct tst_ts +tst_ts_from_ns(enum tst_ts_type type, long long ns) +{ + struct tst_ts ret = {.type = type}; + + tst_ts_set_sec(&ret, ns / 1000000000); + tst_ts_set_nsec(&ret, ns % 1000000000); + + return ret; +} + +/* + * Converts microseconds to tst_ts + */ +static inline struct tst_ts +tst_ts_from_us(enum tst_ts_type type, long long us) +{ + struct tst_ts ret = {.type = type}; + + tst_ts_set_sec(&ret, us / 1000000); + tst_ts_set_nsec(&ret, (us % 1000000) * 1000); + + return ret; +} + +/* + * Converts microseconds to timespec + */ +static inline struct timespec +tst_timespec_from_us(long long us) +{ + return tst_ts_to_timespec(tst_ts_from_us(TST_LIBC_TIMESPEC, us)); +} + +/* + * Converts miliseconds to tst_ts + */ +static inline struct tst_ts +tst_ts_from_ms(enum tst_ts_type type, long long ms) +{ + struct tst_ts ret = {.type = type}; + + tst_ts_set_sec(&ret, ms / 1000); + tst_ts_set_nsec(&ret, (ms % 1000) * 1000000); + + return ret; +} + +/* + * Converts miliseconds to timespec + */ +static inline struct timespec +tst_timespec_from_ms(long long ms) +{ + return tst_ts_to_timespec(tst_ts_from_ms(TST_LIBC_TIMESPEC, ms)); +} + +/* + * Sets tst_its it_value from microseconds. + */ +static inline void tst_its_set_interval_from_us(struct tst_its *its, long long usec) +{ + struct timespec tp = tst_timespec_from_us(usec); + + tst_its_set_interval_sec(its, tp.tv_sec); + tst_its_set_interval_nsec(its, tp.tv_nsec); +} + +/* + * Sets tst_its it_value from microseconds. + */ +static inline void tst_its_set_value_from_us(struct tst_its *its, long long usec) +{ + struct timespec tp = tst_timespec_from_us(usec); + + tst_its_set_value_sec(its, tp.tv_sec); + tst_its_set_value_nsec(its, tp.tv_nsec); +} + +/* + * Sets tst_its it_interval from tst_ts. + */ +static inline void tst_its_set_interval_from_ts(struct tst_its *its, struct tst_ts ts) +{ + tst_its_set_interval_sec(its, tst_ts_get_sec(ts)); + tst_its_set_interval_nsec(its, tst_ts_get_nsec(ts)); +} + +/* + * Sets tst_its it_value from tst_ts. + */ +static inline void tst_its_set_value_from_ts(struct tst_its *its, struct tst_ts ts) +{ + tst_its_set_value_sec(its, tst_ts_get_sec(ts)); + tst_its_set_value_nsec(its, tst_ts_get_nsec(ts)); +} + +/* + * Returns if t1 less than t2. Both t1 and t2 must be normalized. + */ +static inline int tst_ts_lt(struct tst_ts t1, struct tst_ts t2) +{ + if (tst_ts_get_sec(t1) == tst_ts_get_sec(t2)) + return tst_ts_get_nsec(t1) < tst_ts_get_nsec(t2); + + return tst_ts_get_sec(t1) < tst_ts_get_sec(t2); +} + +/* + * Returns if ts1 less than ts2. Both ts1 and ts2 must be normalized. + */ +static inline int tst_timespec_lt(struct timespec ts1, struct timespec ts2) +{ + return tst_ts_lt(tst_ts_from_timespec(ts1), tst_ts_from_timespec(ts2)); +} + +/* + * Returns normalized tst_ts, i.e. 0 <= nsec < 1000000000. + */ +static inline struct tst_ts tst_ts_normalize(struct tst_ts t) +{ + long long sec = tst_ts_get_sec(t); + long long nsec = tst_ts_get_nsec(t); + + if (nsec >= 1000000000) { + tst_ts_set_sec(&t, sec + 1); + tst_ts_set_nsec(&t, nsec - 1000000000); + } + + if (nsec < 0) { + tst_ts_set_sec(&t, sec - 1); + tst_ts_set_nsec(&t, nsec + 1000000000); + } + + return t; +} + +/* + * Adds us microseconds to tst_ts. + */ +static inline struct tst_ts +tst_ts_add_us(struct tst_ts t, long long us) +{ + struct tst_ts res = {.type = t.type}; + + tst_ts_set_sec(&res, tst_ts_get_sec(t) + us / 1000000); + tst_ts_set_nsec(&res, tst_ts_get_nsec(t) + (us % 1000000) * 1000); + + return tst_ts_normalize(res); +} + +/* + * Adds us microseconds to struct timespec. + */ +static inline struct timespec +tst_timespec_add_us(struct timespec ts, long long us) +{ + struct tst_ts res; + + res = tst_ts_add_us(tst_ts_from_timespec(ts), us); + + return tst_ts_to_timespec(res); +} + +/* + * Substracts us microseconds from tst_ts. + */ +static inline struct tst_ts +tst_ts_sub_us(struct tst_ts t, long long us) +{ + struct tst_ts res = {.type = t.type}; + + tst_ts_set_sec(&res, tst_ts_get_sec(t) - us / 1000000); + tst_ts_set_nsec(&res, tst_ts_get_nsec(t) - (us % 1000000) * 1000); + + return tst_ts_normalize(res); +} + +/* + * Substracts us microseconds from timespec. + */ +static inline struct timespec +tst_timespec_sub_us(struct timespec ts, long long us) +{ + struct tst_ts res; + + res = tst_ts_sub_us(tst_ts_from_timespec(ts), us); + + return tst_ts_to_timespec(res); +} + +/* + * Adds two tst_ts structures. + */ +static inline struct tst_ts +tst_ts_add(struct tst_ts t1, struct tst_ts t2) +{ + struct tst_ts res = {.type = t1.type}; + + tst_ts_set_sec(&res, tst_ts_get_sec(t1) + tst_ts_get_sec(t2)); + tst_ts_set_nsec(&res, tst_ts_get_nsec(t1) + tst_ts_get_nsec(t2)); + + return tst_ts_normalize(res); +} + +/* + * Adds two timespec structures. + */ +static inline struct timespec +tst_timespec_add(struct timespec ts1, struct timespec ts2) +{ + struct tst_ts res; + + res = tst_ts_add(tst_ts_from_timespec(ts1), tst_ts_from_timespec(ts2)); + + return tst_ts_to_timespec(res); +} + +/* + * Substract two tst_ts structures. + */ +static inline struct tst_ts +tst_ts_diff(struct tst_ts t1, struct tst_ts t2) +{ + struct tst_ts res = {.type = t1.type}; + + tst_ts_set_sec(&res, tst_ts_get_sec(t1) - tst_ts_get_sec(t2)); + tst_ts_set_nsec(&res, tst_ts_get_nsec(t1) - tst_ts_get_nsec(t2)); + + return tst_ts_normalize(res); +} + +/* + * Substract two timespec structures. + */ +static inline struct timespec +tst_timespec_diff(struct timespec ts1, struct timespec ts2) +{ + struct tst_ts res; + + res = tst_ts_diff(tst_ts_from_timespec(ts1), tst_ts_from_timespec(ts2)); + + return tst_ts_to_timespec(res); +} + +/* + * Substract two tst_ts structures returns number of nanoseconds. + */ +static inline long long +tst_ts_diff_ns(struct tst_ts t1, struct tst_ts t2) +{ + return tst_ts_to_ns(tst_ts_diff(t1, t2)); +} + +/* + * Substract two timespec structures returns number of nanoseconds. + */ +static inline long long +tst_timespec_diff_ns(struct timespec ts1, struct timespec ts2) +{ + return tst_ts_diff_ns(tst_ts_from_timespec(ts1), tst_ts_from_timespec(ts2)); +} + +/* + * Substract two tst_ts structures returns number of microseconds. + */ +static inline long long +tst_ts_diff_us(struct tst_ts t1, struct tst_ts t2) +{ + return tst_ts_to_us(tst_ts_diff(t1, t2)); +} + +/* + * Substract two timespec structures returns number of microseconds. + */ +static inline long long +tst_timespec_diff_us(struct timespec ts1, struct timespec ts2) +{ + return tst_ts_diff_us(tst_ts_from_timespec(ts1), tst_ts_from_timespec(ts2)); +} + +/* + * Substract two tst_ts structures returns number of milliseconds. + */ +static inline long long +tst_ts_diff_ms(struct tst_ts t1, struct tst_ts t2) +{ + return tst_ts_to_ms(tst_ts_diff(t1, t2)); +} + +/* + * Substract two timespec structures returns number of milliseconds. + */ +static inline long long +tst_timespec_diff_ms(struct timespec ts1, struct timespec ts2) +{ + return tst_ts_diff_ms(tst_ts_from_timespec(ts1), tst_ts_from_timespec(ts2)); +} + +/* + * Returns absolute value of difference between two timespec structures. + */ +static inline struct tst_ts +tst_ts_abs_diff(struct tst_ts t1, struct tst_ts t2) +{ + if (tst_ts_lt(t1, t2)) + return tst_ts_diff(t2, t1); + else + return tst_ts_diff(t1, t2); +} + +/* + * Returns absolute value of difference between two tst_ts structures in + * microseconds. + */ +static inline long long +tst_ts_abs_diff_us(struct tst_ts t1, struct tst_ts t2) +{ + return tst_ts_to_us(tst_ts_abs_diff(t1, t2)); +} + +/* + * Returns absolute value of difference between two timespec structures in + * microseconds. + */ +static inline long long +tst_timespec_abs_diff_us(struct timespec ts1, struct timespec ts2) +{ + return tst_ts_abs_diff_us(tst_ts_from_timespec(ts1), tst_ts_from_timespec(ts2)); +} + +/* + * Returns absolute value of difference between two timespec structures in + * milliseconds. + */ +static inline long long +tst_ts_abs_diff_ms(struct tst_ts t1, struct tst_ts t2) +{ + return tst_ts_to_ms(tst_ts_abs_diff(t1, t2)); +} + +/* + * Exits the test with TCONF if particular timer is not supported. This is + * intended to be used in test setup. There is no cleanup callback parameter as + * you are expected to call it before initializing any resources that has to be + * cleaned up later. + * + * @clk_id: Posix clock to use. + */ +void tst_timer_check(clockid_t clk_id); + +/* + * Marks a start time for given clock type. + * + * @clk_id: Posix clock to use. + */ +void tst_timer_start(clockid_t clk_id); + +/* + * Returns true if timer started by tst_timer_start() has been running for + * longer than ms seconds. + * + * @ms: Time interval in milliseconds. + */ +int tst_timer_expired_ms(long long ms); + +/* + * Marks timer end time. + */ +void tst_timer_stop(void); + +/* + * Retuns elapsed time in struct timespec. + */ +struct timespec tst_timer_elapsed(void); + +/* + * Returns elapsed time in milliseconds. + */ +static inline long long tst_timer_elapsed_ms(void) +{ + return tst_timespec_to_ms(tst_timer_elapsed()); +} + +/* + * Returns elapsed time in microseconds. + */ +static inline long long tst_timer_elapsed_us(void) +{ + return tst_timespec_to_us(tst_timer_elapsed()); +} + +#endif /* TST_TIMER */ diff --git a/fsstress/include/tst_timer_test.h b/fsstress/include/tst_timer_test.h new file mode 100644 index 0000000000..b825a4d1aa --- /dev/null +++ b/fsstress/include/tst_timer_test.h @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2017 Cyril Hrubis + */ + + /* + + Timer measuring library. + + The test is supposed to define sampling function and set it in the tst_test + structure the rest of the work is then done by the library. + + int sample(int clk_id, long long usec) + { + // Any setup done here + + tst_timer_start(clk_id); + // Call that is being measured sleeps for usec + tst_timer_stop(); + tst_timer_sample(); + + // Any cleanup done here + + // Non-zero return exits the test + } + + struct tst_test test = { + .scall = "syscall_name()", + .sample = sample, + }; + + */ + +#ifndef TST_TIMER_TEST__ +#define TST_TIMER_TEST__ + +#include "tst_test.h" +#include "tst_timer.h" + +void tst_timer_sample(void); + +# ifdef TST_NO_DEFAULT_MAIN +struct tst_test *tst_timer_test_setup(struct tst_test *test); +# endif /* TST_NO_DEFAULT_MAIN */ +#endif /* TST_TIMER_TEST__ */ diff --git a/fsstress/include/tst_uinput.h b/fsstress/include/tst_uinput.h new file mode 100644 index 0000000000..cf351cdfbd --- /dev/null +++ b/fsstress/include/tst_uinput.h @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 Cyril Hrubis + */ + +#ifndef TST_UINPUT_H__ +#define TST_UINPUT_H__ + +/** + * Tries to open the uinput device. + * + * Returns file descriptor on success, -1 on failure. + */ +int open_uinput(void); + +/** + * Creates virtual input device. + * + * @fd File descriptor returned by open_uinput(). + */ +void create_input_device(int fd); + +/** + * Parses /proc/bus/input/devices and returns the strings for our virtual device. + * If passing 'H' to it, it returns HANDLERS string. If passing 'S' to it, it + * returns SYSFS string. + * + * Returns newly allocated string, or NULL in a case of failure. + */ +char *get_input_field_value(char field); + +/** + * Sets up the virtual device to appear as a mouse, this must be called before + * the call to create_input_device(). + * + * @fd File descriptor as returned by open_uinput(). + */ +void setup_mouse_events(int fd); + +/** + * Destroys virtual input device. + * + * @fd File descriptor returned by open_uinput(). + */ +void destroy_input_device(int fd); + +#endif /* TST_UINPUT_H__ */ diff --git a/fsstress/include/tst_wallclock.h b/fsstress/include/tst_wallclock.h new file mode 100644 index 0000000000..7d6723a7ac --- /dev/null +++ b/fsstress/include/tst_wallclock.h @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 Linaro Limited. All rights reserved. + * Author: Rafael David Tinoco + */ + + +#ifndef TST_WALLCLK_H__ +#define TST_WALLCLK_H__ + +void tst_wallclock_save(void); + +void tst_wallclock_restore(void); + +#endif /* TST_WALLCLK_H__ */ diff --git a/fsstress/xfscompat.h b/fsstress/xfscompat.h new file mode 100644 index 0000000000..61550a8f71 --- /dev/null +++ b/fsstress/xfscompat.h @@ -0,0 +1,7 @@ +#define MAXNAMELEN 1024 +struct dioattr { + int d_miniosz, d_maxiosz, d_mem; +}; + +#define MIN(a,b) ((a)<(b) ? (a):(b)) +#define MAX(a,b) ((a)>(b) ? (a):(b)) diff --git a/micro/rw_expt b/micro/rw_expt index b9db0a98e91908155d4b1dee9a89cfeb69dbb3bc..f13cb32c294f288f861042ae92be168ebca5470f 100755 GIT binary patch literal 13480 zcmeHOdvILUc|R-3SopCk+cFpo_zuX_7`&3OF)|>~%94FW*N@l|CJk`C)?P_lR=djX zU62WFL}W2sl%+~1Lrg}-q#}b+0 z6~is7SFBzYOecd^%W{)_l3l;CM|z_6R;FZnJ$S+>z3_MUJ-Pg&jawes`^xT-+`=0# zzwG*oYMAC>Sdm~mXnGl1KIO4$jhGD=G{ibEb2F+w&G_q6l#*=ANB!|p| zw4dr7+9}-|M(=RM=!+#H@z_147`i(ZvrIUFPtFZxoU)X%jKN4OA=Zbx+SeLa2UiAH z730&ftAp1FqpN#^5j9h0e=Kd8sqPJH~C9oZ2#;k|z_nNao&N3^UU>XF88HGcVz z5a+K3W18cPIxXRY2AWdvd}Cb@JC|n0Un;CV7Mn{}f2;V+g_K?;rodC+`I+a{Hb_%w zQS&h4LgBTVCes;b{_qk9r#X_!!C}gU&twoZ=faVpVmRW$X%6FX(uJSLAgHczvQ72C zVY3UTd62`cE}Z9fO55(j-S58v7w(?_hg>+<1=$&P;j;)(VZ?>gnCI|-3s*}5nKa?T zRn<#;w+r{P5zsv@JmA8A;KI3&Q1VkQe4a~wuM2mN>q!^Bz$O0+7p|5DGWC!PKi?&< zkA6_AkI(q`^E9E4OZd!ZlS$DlDzRZ(vCqV#E(ndVZ>au=LY~;Hjze zha~^s#8a2cPfGrM;;G5=Pf7lF#8Xq}_elO#;;D)A6Ow<4cxu}Gh~$4sJawo1kmR2y zo|-tnUGmQmPhB>@S@Qo#JT-N`P4Z6?PfeU}lKkHgPfeTGB>xx0Q(5cQ&Z-J z2$lmsOc+IKId*in? z)Q!Dn)n~UBezpZh!}bY%^m$)yF_}hYk-z$|{c)!~WxttQjS@A#L~DUsJ$p?PS}%0s zSYP0y$!DpfAo9Y|!177-yPwvh-(5N507z`Itvw*Fobf#3)iZvC-=lh9`7id8#?inX z&m9f?(PVA~ymi>`<^JUqatQ;d#i+j0snZOqc>l7m-5$CvbbIKIkg+ef2~y)NIbBxS z!WU6x$jxC?i*7$BbJ9GSdyOm=a`jTCbpvE_CjpKAx{wpVa*M(A1p`ZVAsa$WG=JD- zzj%jk|4tu$=g8*naCXLpWG_4SF?4CP%N*zw7T&c$6Q2Z@bV%qCFg<#9#&zKV2-Rt+695ow!2^ue5_J7cj3E7|bY?aMqAGKfUun*|>eeeVL>a>53`o~bJ zQA250!*0N6%a1-I+p62OejNokakTk(2qVZuO6S-+nW4_Hg4I0sVPMxkk;;b?x}DeU zSHt%44*R3rTaeP%91e^H(dj~?`+d6ajm|aiWnM)qEP%D<$@{E4&%S@8jpODuq<-hrz<`21jO8f_;|9ye6w;|^CpZ^9bT-JX$yY%UK znh0gL70?y49Sx}48zx-+#a$l9-r>xS(D+piU8DPJHlQ$X72IrIqbdZjGd(z^tpc}k?g_@CVceSC4giLqL^qO(tj4t3%SRoSnGUJu^p9mN9Aj* z(q-qKrm+vbYau}clJs*A{*QY=qW|gk$*sD5tjqp4-Tn<`*`e_GdQ3a5`=DJi;SMyv z@HD+x!uElqPXxaA{K%_f*Gqx19|AhqDOW4u@it7ot>1;_(-_Yl$z8Mp$i{X7gy<2@o|I};;{ z8b-1{-qA2n>|B}knAV1Pe8Bz3uym&Tz}QWwSd@c8ekJ0vzZ|TF3z6@qO5c1EuI2dp zPa0on`b*}>sc8k#ts(nVmwh~Z#k+D%@Z72D+*>D*nXwNot@$C2(OF_?`Z_Jy*M}{I)~YRy$1}5p z+yoQ_Bqw!5+WfkZTb0Jagw;5Norqx$X5x*OnYMz~uqBOc!X`s02er;rip-{qOFweA z#k4Z1gc;TDio`P}rALF>rqVog513jc)t?zO6INOqiloz!kEBdw7W*W*j{ zrS3M;*u@ZsQaGU}9qETsurU%$W-RRnDtn_W(v8{;P;I30ASxlLexp>JwT*T{nl+G0 zX8H$)GS+q4(x%|meH%0>nQly*z2rk~iIguQ$Xs7CHP|_f2zFly3z%w-)-u!h;*WIA>UV9nzUeJp$MC&0#!FSIV z;Tx{=EuJ&8cEUHaj_`}{97bQek_1#JFE2y`(n)^zu|lB<_JzN0oqy5If!TN0j)387SgZ$Itj{_~HZo@N-{BIzz-Cy_Zs*r!t{ndZy*G6l;;a?Q;*R}ge zN5}I3o<|{jIm$q?e^%A*U-VFQr(es~wELHRdq#)9>Hc#<{+7|1Tm4hMs=uD)ZwdLE zLjGm#ehs2ffw7L+O;CRs&j_Y$neS=89pra|f5KPw@+`lGtT-9ym`(nvPCr0de@^P0X~1`^JZGMP+-buq;=}hc&?KyEOm%^f#UgGd$Hna zJx1X|hZN7ZX)Q>B(~q4lB#Gax7ALgrqHwatp|qc)uvew?y1Q9rkk5AMy9*^mQ5oTUPbxW8ErR`DqHvbO@==x#?j(fewdA)e zd)T*ey3{3X5tmqSp{#eliivCv7 z|5Eh0qUWfFJWtWf6&`kY1I`D`bG9Aoxc3=cYU`!eM92!;iY)Bu(-py66ljW_jeZz`!kCDyc9pDI37yz znS%RCDPAkMf0g3r3hu|H_$lJ~T`J{& zzm%UZ8oU!b@N(sS3AliLZ~Oips1I)kZ~K0r(#dwFiZ55_jV6-wbfg4XF6_aHN&# zpWl&o{9=!?FV9J!^BC|t$k%D5)~=QEXO7b+C4Q#k0~PS83iw+vLG`v-bNtpRlb=+O zpNVquSa5r%a+Jf@0H<=HhU-0{eo!lkuPtRj& zIU~j@*!jN1G4519k!L>{K)e4RgfPhd9;f+|GR(}EwClf zzp7y8pMhWMlH=&(vL4QSKmLKlS;|Fmcx)CAZG-Y2O(xN67{N8ot5?#k8s^qqEqYT{ z+RF6xL2UY(i(w5KxMq_u(~yoPjsAFYMc-H9uC=8p@@5YpT#Pe1b!9>C*dmPe;Z5zKu(4^~x~-kvMt7(^+-ZnNG)h;Lm2;s9c`LcyZOz#}D zB0E5FeNNH=j^Xm1nHmzoMA9;Yq4us7R-|8X{fSI)M<#}Arm?695;qV@4~SrNX9D&d zYNec%yUbLYF5XEo#TZCSnehlIsMt{45<%H;K}3W7NwAiQk7Yp`>kvxHZXGlS)aV|- z2rF`qsx!b-vJDts*>!V_j61+|GYlu^&p$w zhzOlsu>M{ZVM^;03UmxW^~Cyo&TtDbyqb#od|tw|nUq|?!-_kQMrRM~pZAeW>H8N2 z&OggBy%TA4mccylH<`APGJ-e%4l2Ywh)|uf{vLJS!E{myvVU*+cPagLCCB?$rhL9b z`gDKMtN#!%suSh5xXlmA6zK|?3e95=F#W#Jf`05y|?^7RQlY0BWm5sG*zMe?EfD;`riK!=w?Ah zz5bu|==1)c>6FJm*BhIC0THaW>lmWv&pzdw%zP+>djw?tAb0;kNMF8kb9Osu8yd;#;cYWY`KRVc7Bna`Ov4r|n6lno(4%^O*3_T`JCwg_ z{c>8hkEvos(?ERd@?}i}(ZvJtM0VTaZ7Y^9UcStqN&1(_c9VUQz5ULO(i8Wi29D}H z7Z=3XoOgfT?ic~C}PNq?uF(WvY8p>HsmP>3OJ54X3hF_!q3`j?gR zles1S8_@$bm?Jf%KjN*wTFfEN6Q#N0mh*+@wRu&12FEHYac?L-do`8U zh?C$cotxh+DXk&Ah7r)HbrTWOanXF_q}g!t&uO6zcQXjuY{PlYqT&@c+`g^{ZMc11 z(``7_iPHufj)s-e-8Ot?2^FH-hEwcw>bK#u83aw)aCBrTZL{H?5-P+_8}7B?kK1q_ zD=OY&!`0F+wf5R@`+RuDhO3`EDgSL7PHQYDedxVVyjVc}#EX~Db1Qz#TpNd7m(QwS8sCI2SzZsPYz{x#xh z$P3R%{uSbBs0(`}|0CjQhzmOG={5R%_PJPldl^aTJ5(!|qH6;4Y2UgBwp z3MVALm3SJO!nowWb%iE+_kfovv?;Vv&z%l+ZS2GlG)MK3WeXOfM9-PNg@H3eMfb5* zpO3oF`$U+AWHjv4^ik92(?`2}*XX%p`2sp`U+H(zIOKPgm=-23GbXP z-|Tz=ZV&try6w4_54J!gFg~`mAt>_H-r@03?uhsCdK8aQr_=9FeSQ~IM&Ky$nx6Za ze)c0oMAJ~-rC;}x&_V6bx>1W8hJB#Dd-C&O1Y&#JhmO|jXD33rP3PNJevo}<eTFfM0E3CZVr7Zv^lip@K`;32I3bFqfCg4VW@i>S+bk3va-oAexjhmcyb2g7rLGdJnA0tp~K1{Q$*U$Vx zD&MF-@_{sP=z<#t5I_2%{A%5GRDbn?d3nj&EVkyI4?C9sowpX|YC>e^AnM-ECop)M zkJh~b$TcB7jcM4x>O-qVw(iu|pjR^X5h)Z;Y%c78&SZTMxc`P~)>EY9JN2_?5h_b% zsC@b&MM`+oCnJUHpFefpiWhz8FyiHtT<7`l%HL-5G$^Qm2z?>6sXh1ap^c%gQ11N3 z&fM#{2{{O@xug0c?@@KyaxYWtH(;*Rs=4x*@7pNA&|D&|lT>}+%-M-CfhvSBN3wq? z7Tbp3%5G~LE}AQc-}gTDFJvk3R^WZBU-Vo-&%GJWooUT|m_G|?edS^Aum_Pn+BrsxmMRZx!@D6_-;`$>;$UO&H$Uv(w?xCUcuIxB@e{uMI zbG!6RBU|RTiTxgi1-suCqqi4BFHz41-VcwiQhn>NbCYE!+YuVM!Ph=?q;?%D z|I5N{7`e}+{}2Bw+n-%Msec~&7idEGXyrHq0W~!W2X@lb2v}3&AE^LtiuvDCu9fCO zuGLqcKSCx)kPG}+Dz@kHmf~I#L0|vPAq-!lr2hBF<^TEj#iH!JvUt;T=Q{P=f9knU z+H*gBfqogVa;Ef=4fTkKRVpGL^z{ddV;$1}8xzlaho6Pqu{OC!(MM7ZJ8#QmGdmx0 z#j=AtAFBCswr}S{Zjp@~bJJo1fyM(-%3vXR1(gV#IY7T4#C`>AC|BznnH9>7k8DKH z9UO-j*{J+Kp^#eHUkZxsdMr6972Sw~vCR;EfmYgy=d)iw=0--GdUCRTV|R18o|E-n zkIqEBDHYaG$3A_oZ2n=sgmOiiFX7PzTRa*Thtb7EJKJ+-+HJv2{G8({oO@RWeKAy=`wPrTm%j2;_Feknw?*)t$@)zoG^IUAP?Wl`N2Cq2MqB7u zbf#F4xmip0_G0U--Ks4Z7|6~Pa_?Ibket*Jay#BMm@u1C*lioJ!R$bj8OxY{bDJp* zt;a@MDf+dxbec?N4TELDdJCNO>Gsmxk)zVHfLdG1?uP}=l7c&1o<3iPLEi$xQ$yBiTmk-Ho7=OxfzfW8NM9t-0t zl+VT-ehKtJ&|3WJ@*dE&qeHm1HMr)@o?gGlHNAmwdbgs%-Xc&=mF0!-L4f2>eo`z3 zX%2ZB)_NN6@XmUmey3P{^(~8*`u?13+<*(yKpcnNbp*6{8g|!&JdL~DpZ91(wO{cx zhCB@|9%>tgjezT{ETskj;Nc`X@WB@T+4yV#rr)k528; zsXgmF!E~j@$Z^{ZJ1N+qZn>B)_Q1s+xYz?1d*EUZTc;5G4t@uV&PR|yUxcrj~#U$~2 zYl1{d-+cGgT0DOf*k5Du{EYP;WGTtbIB28fgt%N$Ci20Y7_D1EyvIJS8pzK<{EgvC zDFyLqL78K`Uh!OS_Q&5Kn8)LoY|rsJOCL}AlIQ+Bt@v-Ka^>!iPWU^v)6uo{Ry~(1 zx>nImiuNjczoNSo{aZz!SM-O99#!-WMSrL08AYezJu0Ou6unl_<%+IVR0`Q{x35`q zv$k;K)@;JeYB&0C^fxaKEXhhX@K9j6zj@hp7OX944%`%I4m8`8t7Pd*+KQUslv4T@ z*HsaB3$r3#TZ&)1F*l-le?|Feg5$efe!8d>7jDcJj;C_@8G_@o9G_W=-*S9bX&#s3 zvqgg%pK|;Xv7y3vxP?d1`*3G+3$NgH!CvOZmq|^n7v=bz(z%Cn{8DieFC(4FEiNmq zGxjn!o}zhuDaS7t^cvim+~NwH^QeShDfs)SUB^wUi&{U*@vFqXiul!nUh6xPTkz^Q zSwibVt@x-oiC8&WcU@S`ob{*mwg&yb!Le?WWy1G3a5~OIxO1JS_ZKcPSx;V{Iwd}} zKX)iQrycfpN%^Vc@*MC=?fO?K-yrB^Go?%AU5LY=F2o6apP^JI@7C{7B|ER8+y(7@ zmj#uiMSdmmsr^Q!mF%37YL`ukA9_dRst_l2vZJQ9w^8C# z|E{bBeksO_zCKan->Xdu-{Y}x`OXXF-3r%cTey4|2RtQlWE|-U;F<#?md-C}_%(ON z^LM2kk4P!|^4%Te>D^-kfzvqBmp7GUyT4Y&&T}M> z@p887dsXcJq>7z`vfrlu{syb`r|3zW88h44>!%}1cdY3!!tI@1h9RP{bgVC)F=J`N z95irFDG|#+BAPV%29jGN14h(LrZYw)yG`^Y2U7zvGZyvVbmK}oM^!<{=#3}hMkJk% zY&Y;#BE4PorXzzfBbpr?+zu5RXF$>{6U7IXSm}d?tY~jG(PJ3?n*vLgkuq~DR)SmG z5n9(~wB6Z?R#;8qe3{{>Fj~KOXJ}pf8c5knB^ek+98bF!|Pi@VPpN; zwViEUMpvjM+-8VKG)iZ~htn9GaBu=iZ<7(xYJdIWk zsg_M1J1Z}iC*;Z@3_ogR9ZN&q%Fd`+N9Lx;XOc!gK8K-^M*DhbM&k)1iw|#tkHI-L zO1(|vrcT&7Wvt_NP82mzXY3|R=)|01Y|Ug;rPb-W$RzG$UIiP2)8?N&BDd{`)h*W@O@MPd@i5fr%>BjzmbHHHsQigS4p3rPxq;c^7|H& zrR40tEx_nq2m9ye*l(x`^ZtSB&vH!fgFd}GVV<9Nk1K^B$|*VPZ=pia^9faz_4&ED zUcEr#cCvqG`yW&KEy|!aEhuxE(&zU@q))b-`cD9(K2hSO=j=QM1rompvpB1+oF|&Y zW!LBD@do86=;(0Xe=>c_q0i6l8)lI8$@*H{RQ{VNu>0rzTDQ{wJ~vDmV83kdS%*Hq z2bik_l^GV7V^w01`Hs@(@#B54ru5TQ+Rrw==g{Z>qu~Fq2(zG~Dy&QBm_wi6Kb)Ln ziTsztKaW2f_%SjbTr`I$@%vEze+#F)lYbpLUR+|#5KFw0$da?o5WBvj%gmL?Mzdx>765Wm|t6-}TcRFuI{+mmPm0|s* z4xD5uF{LnL-?Bj6{%Wz6nazRn#0W JI|`lt{|^`^aXA10 diff --git a/scripts/fsstress/compile_fsstress.sh b/scripts/fsstress/compile_fsstress.sh new file mode 100755 index 0000000000..9f7159d688 --- /dev/null +++ b/scripts/fsstress/compile_fsstress.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -x + +cur_dir=$(pwd) +root_dir=`readlink -f ../..` +fsstress_dir=$root_dir/fsstress + +cd $fsstress_dir +rm fsstress +make + +cd $cur_dir diff --git a/scripts/fsstress/run_fsstress.sh b/scripts/fsstress/run_fsstress.sh new file mode 100755 index 0000000000..24c40ef555 --- /dev/null +++ b/scripts/fsstress/run_fsstress.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -x + +cur_dir=$(pwd) +root_dir=`readlink -f ../..` +fsstress_dir=$root_dir/fsstress + +cd $fsstress_dir +sudo LD_PRELOAD=$root_dir/splitfs/libnvp.so ./fsstress -d /mnt/pmem_emul -n $1 -v + +cd $cur_dir From 4bc105bbd01521b8bbd815657938a93f13191d49 Mon Sep 17 00:00:00 2001 From: Krishnan Date: Sat, 15 Aug 2020 09:49:45 -0700 Subject: [PATCH 3/7] changes due to fsstress licence made to download through compile script --- README.md | 3 +-- scripts/fsstress/compile_fsstress.sh | 15 ++++++++++++++- scripts/fsstress/run_fsstress.sh | 4 ++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4a68c8262d..19ca2c1ee9 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ The kernel patch for the implementation of relink() system call for linux v4.13 ## Limitations SplitFS is under active development. 1. The current implementation of SplitFS handles the following system calls: `open, openat, close, read, pread64, write, pwrite64, fsync, unlink, ftruncate, fallocate, stat, fstat, lstat, dup, dup2, execve and clone`. The rest of the calls are passed through to the kernel. -2. The current implementation of SplitFS works correctly for the following applictions: `LevelDB running YCSB, SQLite running TPCC, tar, git, rsync, fsstress`. This limitation is purely due to the state of the implementation, and we aim to increase the coverage of applications by supporting more system calls in the future. +2. The current implementation of SplitFS works correctly for the following applictions: `LevelDB running YCSB, SQLite running TPCC, tar, git, rsync`. This limitation is purely due to the state of the implementation, and we aim to increase the coverage of applications by supporting more system calls in the future. ## Applications currently supported 1. LevelDB (with YCSB) @@ -120,7 +120,6 @@ SplitFS is under active development. 3. git 4. tar 5. rsync -6. fsstress ## Testing [PJD POSIX Test Suite](https://www.tuxera.com/community/posix-test-suite/) that tests primarily the metadata operations was run on SplitFS successfully. SplitFS passes all tests. diff --git a/scripts/fsstress/compile_fsstress.sh b/scripts/fsstress/compile_fsstress.sh index 9f7159d688..bfa6c25666 100755 --- a/scripts/fsstress/compile_fsstress.sh +++ b/scripts/fsstress/compile_fsstress.sh @@ -4,8 +4,21 @@ set -x cur_dir=$(pwd) root_dir=`readlink -f ../..` -fsstress_dir=$root_dir/fsstress +ltp_dir=$root_dir/ltp-master +fsstress_dir=$ltp_dir/testcases/kernel/fs/fsstress +#get ltp with wget +cd $root_dir +wget https://github.com/linux-test-project/ltp/archive/master.zip +unzip master.zip +rm master.zip + +#prepare for installing fsstress +cd $ltp_dir +make autotools +./configure + +#installing fsstress cd $fsstress_dir rm fsstress make diff --git a/scripts/fsstress/run_fsstress.sh b/scripts/fsstress/run_fsstress.sh index 24c40ef555..e0510378a3 100755 --- a/scripts/fsstress/run_fsstress.sh +++ b/scripts/fsstress/run_fsstress.sh @@ -4,9 +4,9 @@ set -x cur_dir=$(pwd) root_dir=`readlink -f ../..` -fsstress_dir=$root_dir/fsstress +fsstress_dir=$root_dir/ltp-master/testcases/kernel/fs/fsstress cd $fsstress_dir -sudo LD_PRELOAD=$root_dir/splitfs/libnvp.so ./fsstress -d /mnt/pmem_emul -n $1 -v +LD_PRELOAD=$root_dir/splitfs/libnvp.so ./fsstress -c -d /mnt/pmem_emul -n $1 -v cd $cur_dir From f850b66dde69dbcbdaaf81be84a1ecc64213f145 Mon Sep 17 00:00:00 2001 From: Krishnan Date: Sat, 15 Aug 2020 09:55:56 -0700 Subject: [PATCH 4/7] removed fsstress directory due to licence issue --- fsstress/Makefile | 36 - fsstress/fsstress.c | 2676 ----------------- fsstress/global.h | 66 - fsstress/include/Makefile | 45 - fsstress/include/config.h | 588 ---- fsstress/include/config.h.in | 587 ---- fsstress/include/ipcmsg.h | 68 - fsstress/include/ipcsem.h | 55 - fsstress/include/ipcshm.h | 54 - fsstress/include/lapi/.gitignore | 1 - fsstress/include/lapi/abisize.h | 31 - fsstress/include/lapi/acct.h | 74 - fsstress/include/lapi/bpf.h | 567 ---- fsstress/include/lapi/capability.h | 51 - fsstress/include/lapi/clone.h | 49 - fsstress/include/lapi/common_timers.h | 81 - fsstress/include/lapi/cpuset.h | 51 - fsstress/include/lapi/cryptouser.h | 182 -- fsstress/include/lapi/dccp.h | 17 - fsstress/include/lapi/epoll.h | 13 - fsstress/include/lapi/execveat.h | 22 - fsstress/include/lapi/fallocate.h | 60 - fsstress/include/lapi/fcntl.h | 139 - fsstress/include/lapi/fnmatch.h | 14 - fsstress/include/lapi/fs.h | 66 - fsstress/include/lapi/fsmount.h | 145 - fsstress/include/lapi/futex.h | 13 - fsstress/include/lapi/getrandom.h | 30 - fsstress/include/lapi/if_alg.h | 38 - fsstress/include/lapi/if_ether.h | 19 - fsstress/include/lapi/if_packet.h | 50 - fsstress/include/lapi/io_pgetevents.h | 35 - fsstress/include/lapi/io_uring.h | 283 -- fsstress/include/lapi/ioctl.h | 40 - fsstress/include/lapi/ioctl_ns.h | 28 - fsstress/include/lapi/iovec.h | 20 - fsstress/include/lapi/ipcbuf.h | 195 -- fsstress/include/lapi/keyctl.h | 178 -- fsstress/include/lapi/loop.h | 55 - fsstress/include/lapi/membarrier.h | 30 - fsstress/include/lapi/memfd.h | 50 - fsstress/include/lapi/mkdirat.h | 20 - fsstress/include/lapi/mlock2.h | 16 - fsstress/include/lapi/mmap.h | 87 - fsstress/include/lapi/mount.h | 33 - fsstress/include/lapi/msgbuf.h | 306 -- fsstress/include/lapi/namespaces_constants.h | 31 - fsstress/include/lapi/netinet_in.h | 23 - fsstress/include/lapi/openat2.h | 72 - fsstress/include/lapi/personality.h | 23 - fsstress/include/lapi/pidfd_open.h | 24 - fsstress/include/lapi/pidfd_send_signal.h | 27 - fsstress/include/lapi/posix_clocks.h | 42 - fsstress/include/lapi/posix_types.h | 21 - fsstress/include/lapi/prctl.h | 55 - fsstress/include/lapi/preadv2.h | 30 - fsstress/include/lapi/pwritev2.h | 26 - fsstress/include/lapi/quotactl.h | 78 - fsstress/include/lapi/readdir.h | 19 - fsstress/include/lapi/readlinkat.h | 20 - fsstress/include/lapi/renameat.h | 23 - fsstress/include/lapi/rt_sigaction.h | 245 -- fsstress/include/lapi/safe_rt_signal.h | 50 - fsstress/include/lapi/sched.h | 62 - fsstress/include/lapi/sctp.h | 17 - fsstress/include/lapi/seccomp.h | 40 - fsstress/include/lapi/securebits.h | 17 - fsstress/include/lapi/seek.h | 19 - fsstress/include/lapi/sembuf.h | 234 -- fsstress/include/lapi/semun.h | 22 - fsstress/include/lapi/setns.h | 20 - fsstress/include/lapi/shmbuf.h | 273 -- fsstress/include/lapi/signal.h | 24 - fsstress/include/lapi/socket.h | 72 - fsstress/include/lapi/splice.h | 22 - fsstress/include/lapi/stat.h | 257 -- fsstress/include/lapi/sync_file_range.h | 58 - fsstress/include/lapi/syncfs.h | 21 - fsstress/include/lapi/syscalls/aarch64.in | 315 -- fsstress/include/lapi/syscalls/arc.in | 314 -- fsstress/include/lapi/syscalls/arm.in | 392 --- fsstress/include/lapi/syscalls/hppa.in | 41 - fsstress/include/lapi/syscalls/i386.in | 428 --- fsstress/include/lapi/syscalls/ia64.in | 341 --- fsstress/include/lapi/syscalls/mips_n32.in | 366 --- fsstress/include/lapi/syscalls/mips_n64.in | 342 --- fsstress/include/lapi/syscalls/mips_o32.in | 412 --- fsstress/include/lapi/syscalls/order | 17 - fsstress/include/lapi/syscalls/powerpc.in | 421 --- fsstress/include/lapi/syscalls/powerpc64.in | 421 --- fsstress/include/lapi/syscalls/regen.sh | 132 - fsstress/include/lapi/syscalls/s390.in | 408 --- fsstress/include/lapi/syscalls/s390x.in | 356 --- fsstress/include/lapi/syscalls/sh.in | 402 --- fsstress/include/lapi/syscalls/sparc.in | 407 --- fsstress/include/lapi/syscalls/sparc64.in | 372 --- .../include/lapi/syscalls/strip_syscall.awk | 19 - fsstress/include/lapi/syscalls/x86_64.in | 385 --- fsstress/include/lapi/tcp.h | 19 - fsstress/include/lapi/tee.h | 20 - fsstress/include/lapi/termbits.h | 13 - fsstress/include/lapi/timerfd.h | 41 - fsstress/include/lapi/timex.h | 30 - fsstress/include/lapi/tty.h | 17 - fsstress/include/lapi/udp.h | 18 - fsstress/include/lapi/ustat.h | 22 - fsstress/include/lapi/utime.h | 16 - fsstress/include/lapi/utsname.h | 16 - fsstress/include/lapi/vmsplice.h | 23 - fsstress/include/lapi/xfrm.h | 17 - fsstress/include/libmsgctl.h | 39 - fsstress/include/libnewipc.h | 59 - fsstress/include/mk/automake.mk | 115 - fsstress/include/mk/config-openposix.mk | 5 - fsstress/include/mk/config-openposix.mk.in | 5 - fsstress/include/mk/config.mk | 85 - fsstress/include/mk/config.mk.in | 85 - fsstress/include/mk/env_post.mk | 110 - fsstress/include/mk/env_pre.mk | 155 - fsstress/include/mk/features.mk | 49 - fsstress/include/mk/features.mk.in | 49 - fsstress/include/mk/functions.mk | 76 - fsstress/include/mk/generic_leaf_target.inc | 106 - fsstress/include/mk/generic_leaf_target.mk | 24 - fsstress/include/mk/generic_trunk_target.inc | 98 - fsstress/include/mk/generic_trunk_target.mk | 24 - fsstress/include/mk/gitignore.mk | 51 - fsstress/include/mk/lib.mk | 73 - fsstress/include/mk/man.mk | 37 - fsstress/include/mk/module.mk | 62 - fsstress/include/mk/testcases.mk | 63 - fsstress/include/old/cleanup.c | 47 - fsstress/include/old/ltp_cpuid.h | 35 - fsstress/include/old/ltp_priv.h | 74 - fsstress/include/old/ltp_signal.h | 56 - fsstress/include/old/old_checkpoint.h | 59 - fsstress/include/old/old_device.h | 84 - fsstress/include/old/old_module.h | 72 - fsstress/include/old/old_resource.h | 55 - fsstress/include/old/old_safe_file_ops.h | 64 - fsstress/include/old/old_safe_net.h | 50 - fsstress/include/old/old_safe_stdio.h | 37 - fsstress/include/old/old_tmpdir.h | 56 - fsstress/include/old/random_range.h | 45 - fsstress/include/old/safe_macros.h | 340 --- fsstress/include/old/test.h | 214 -- fsstress/include/old/tlibio.h | 161 - fsstress/include/old/usctest.h | 105 - fsstress/include/parse_vdso.h | 41 - fsstress/include/safe_file_ops_fn.h | 83 - fsstress/include/safe_macros_fn.h | 187 -- fsstress/include/safe_net_fn.h | 81 - fsstress/include/safe_stdio_fn.h | 35 - fsstress/include/stamp-h1 | 1 - fsstress/include/tst_af_alg.h | 136 - fsstress/include/tst_ansi_color.h | 22 - fsstress/include/tst_assert.h | 56 - fsstress/include/tst_atomic.h | 334 -- fsstress/include/tst_buffers.h | 63 - fsstress/include/tst_capability.h | 83 - fsstress/include/tst_cgroup.h | 45 - fsstress/include/tst_checkpoint.h | 28 - fsstress/include/tst_checkpoint_fn.h | 42 - fsstress/include/tst_checksum.h | 16 - fsstress/include/tst_clocks.h | 23 - fsstress/include/tst_clone.h | 21 - fsstress/include/tst_cmd.h | 94 - fsstress/include/tst_common.h | 86 - fsstress/include/tst_coredump.h | 18 - fsstress/include/tst_cpu.h | 19 - fsstress/include/tst_crypto.h | 112 - fsstress/include/tst_device.h | 94 - fsstress/include/tst_fs.h | 246 -- fsstress/include/tst_fuzzy_sync.h | 776 ----- fsstress/include/tst_get_bad_addr.h | 12 - fsstress/include/tst_hugepage.h | 37 - fsstress/include/tst_kconfig.h | 56 - fsstress/include/tst_kernel.h | 21 - fsstress/include/tst_kvercmp.h | 44 - fsstress/include/tst_minmax.h | 24 - fsstress/include/tst_mkfs.h | 22 - fsstress/include/tst_net.h | 35 - fsstress/include/tst_netlink.h | 88 - fsstress/include/tst_numa.h | 112 - fsstress/include/tst_path_has_mnt_flags.h | 29 - fsstress/include/tst_pid.h | 43 - fsstress/include/tst_private.h | 32 - fsstress/include/tst_process_state.h | 53 - fsstress/include/tst_res_flags.h | 23 - fsstress/include/tst_safe_clocks.h | 67 - fsstress/include/tst_safe_file_ops.h | 49 - fsstress/include/tst_safe_macros.h | 571 ---- fsstress/include/tst_safe_net.h | 79 - fsstress/include/tst_safe_posix_ipc.h | 47 - fsstress/include/tst_safe_prw.h | 47 - fsstress/include/tst_safe_pthread.h | 33 - fsstress/include/tst_safe_stdio.h | 24 - fsstress/include/tst_safe_sysv_ipc.h | 54 - fsstress/include/tst_safe_timerfd.h | 32 - fsstress/include/tst_sig_proc.h | 12 - fsstress/include/tst_sys_conf.h | 19 - fsstress/include/tst_taint.h | 93 - fsstress/include/tst_test.h | 325 -- fsstress/include/tst_timer.h | 1055 ------- fsstress/include/tst_timer_test.h | 45 - fsstress/include/tst_uinput.h | 47 - fsstress/include/tst_wallclock.h | 15 - fsstress/xfscompat.h | 7 - 208 files changed, 24692 deletions(-) delete mode 100644 fsstress/Makefile delete mode 100644 fsstress/fsstress.c delete mode 100644 fsstress/global.h delete mode 100644 fsstress/include/Makefile delete mode 100644 fsstress/include/config.h delete mode 100644 fsstress/include/config.h.in delete mode 100644 fsstress/include/ipcmsg.h delete mode 100644 fsstress/include/ipcsem.h delete mode 100644 fsstress/include/ipcshm.h delete mode 100644 fsstress/include/lapi/.gitignore delete mode 100644 fsstress/include/lapi/abisize.h delete mode 100644 fsstress/include/lapi/acct.h delete mode 100644 fsstress/include/lapi/bpf.h delete mode 100644 fsstress/include/lapi/capability.h delete mode 100644 fsstress/include/lapi/clone.h delete mode 100644 fsstress/include/lapi/common_timers.h delete mode 100644 fsstress/include/lapi/cpuset.h delete mode 100644 fsstress/include/lapi/cryptouser.h delete mode 100644 fsstress/include/lapi/dccp.h delete mode 100644 fsstress/include/lapi/epoll.h delete mode 100644 fsstress/include/lapi/execveat.h delete mode 100644 fsstress/include/lapi/fallocate.h delete mode 100644 fsstress/include/lapi/fcntl.h delete mode 100644 fsstress/include/lapi/fnmatch.h delete mode 100644 fsstress/include/lapi/fs.h delete mode 100644 fsstress/include/lapi/fsmount.h delete mode 100644 fsstress/include/lapi/futex.h delete mode 100644 fsstress/include/lapi/getrandom.h delete mode 100644 fsstress/include/lapi/if_alg.h delete mode 100644 fsstress/include/lapi/if_ether.h delete mode 100644 fsstress/include/lapi/if_packet.h delete mode 100644 fsstress/include/lapi/io_pgetevents.h delete mode 100644 fsstress/include/lapi/io_uring.h delete mode 100644 fsstress/include/lapi/ioctl.h delete mode 100644 fsstress/include/lapi/ioctl_ns.h delete mode 100644 fsstress/include/lapi/iovec.h delete mode 100644 fsstress/include/lapi/ipcbuf.h delete mode 100644 fsstress/include/lapi/keyctl.h delete mode 100644 fsstress/include/lapi/loop.h delete mode 100644 fsstress/include/lapi/membarrier.h delete mode 100644 fsstress/include/lapi/memfd.h delete mode 100644 fsstress/include/lapi/mkdirat.h delete mode 100644 fsstress/include/lapi/mlock2.h delete mode 100644 fsstress/include/lapi/mmap.h delete mode 100644 fsstress/include/lapi/mount.h delete mode 100644 fsstress/include/lapi/msgbuf.h delete mode 100644 fsstress/include/lapi/namespaces_constants.h delete mode 100644 fsstress/include/lapi/netinet_in.h delete mode 100644 fsstress/include/lapi/openat2.h delete mode 100644 fsstress/include/lapi/personality.h delete mode 100644 fsstress/include/lapi/pidfd_open.h delete mode 100644 fsstress/include/lapi/pidfd_send_signal.h delete mode 100644 fsstress/include/lapi/posix_clocks.h delete mode 100644 fsstress/include/lapi/posix_types.h delete mode 100644 fsstress/include/lapi/prctl.h delete mode 100644 fsstress/include/lapi/preadv2.h delete mode 100644 fsstress/include/lapi/pwritev2.h delete mode 100644 fsstress/include/lapi/quotactl.h delete mode 100644 fsstress/include/lapi/readdir.h delete mode 100644 fsstress/include/lapi/readlinkat.h delete mode 100644 fsstress/include/lapi/renameat.h delete mode 100644 fsstress/include/lapi/rt_sigaction.h delete mode 100644 fsstress/include/lapi/safe_rt_signal.h delete mode 100644 fsstress/include/lapi/sched.h delete mode 100644 fsstress/include/lapi/sctp.h delete mode 100644 fsstress/include/lapi/seccomp.h delete mode 100644 fsstress/include/lapi/securebits.h delete mode 100644 fsstress/include/lapi/seek.h delete mode 100644 fsstress/include/lapi/sembuf.h delete mode 100644 fsstress/include/lapi/semun.h delete mode 100644 fsstress/include/lapi/setns.h delete mode 100644 fsstress/include/lapi/shmbuf.h delete mode 100644 fsstress/include/lapi/signal.h delete mode 100644 fsstress/include/lapi/socket.h delete mode 100644 fsstress/include/lapi/splice.h delete mode 100644 fsstress/include/lapi/stat.h delete mode 100644 fsstress/include/lapi/sync_file_range.h delete mode 100644 fsstress/include/lapi/syncfs.h delete mode 100644 fsstress/include/lapi/syscalls/aarch64.in delete mode 100644 fsstress/include/lapi/syscalls/arc.in delete mode 100644 fsstress/include/lapi/syscalls/arm.in delete mode 100644 fsstress/include/lapi/syscalls/hppa.in delete mode 100644 fsstress/include/lapi/syscalls/i386.in delete mode 100644 fsstress/include/lapi/syscalls/ia64.in delete mode 100644 fsstress/include/lapi/syscalls/mips_n32.in delete mode 100644 fsstress/include/lapi/syscalls/mips_n64.in delete mode 100644 fsstress/include/lapi/syscalls/mips_o32.in delete mode 100644 fsstress/include/lapi/syscalls/order delete mode 100644 fsstress/include/lapi/syscalls/powerpc.in delete mode 100644 fsstress/include/lapi/syscalls/powerpc64.in delete mode 100755 fsstress/include/lapi/syscalls/regen.sh delete mode 100644 fsstress/include/lapi/syscalls/s390.in delete mode 100644 fsstress/include/lapi/syscalls/s390x.in delete mode 100644 fsstress/include/lapi/syscalls/sh.in delete mode 100644 fsstress/include/lapi/syscalls/sparc.in delete mode 100644 fsstress/include/lapi/syscalls/sparc64.in delete mode 100755 fsstress/include/lapi/syscalls/strip_syscall.awk delete mode 100644 fsstress/include/lapi/syscalls/x86_64.in delete mode 100644 fsstress/include/lapi/tcp.h delete mode 100644 fsstress/include/lapi/tee.h delete mode 100644 fsstress/include/lapi/termbits.h delete mode 100644 fsstress/include/lapi/timerfd.h delete mode 100644 fsstress/include/lapi/timex.h delete mode 100644 fsstress/include/lapi/tty.h delete mode 100644 fsstress/include/lapi/udp.h delete mode 100644 fsstress/include/lapi/ustat.h delete mode 100644 fsstress/include/lapi/utime.h delete mode 100644 fsstress/include/lapi/utsname.h delete mode 100644 fsstress/include/lapi/vmsplice.h delete mode 100644 fsstress/include/lapi/xfrm.h delete mode 100644 fsstress/include/libmsgctl.h delete mode 100644 fsstress/include/libnewipc.h delete mode 100644 fsstress/include/mk/automake.mk delete mode 100644 fsstress/include/mk/config-openposix.mk delete mode 100644 fsstress/include/mk/config-openposix.mk.in delete mode 100644 fsstress/include/mk/config.mk delete mode 100644 fsstress/include/mk/config.mk.in delete mode 100644 fsstress/include/mk/env_post.mk delete mode 100644 fsstress/include/mk/env_pre.mk delete mode 100644 fsstress/include/mk/features.mk delete mode 100644 fsstress/include/mk/features.mk.in delete mode 100644 fsstress/include/mk/functions.mk delete mode 100644 fsstress/include/mk/generic_leaf_target.inc delete mode 100644 fsstress/include/mk/generic_leaf_target.mk delete mode 100644 fsstress/include/mk/generic_trunk_target.inc delete mode 100644 fsstress/include/mk/generic_trunk_target.mk delete mode 100644 fsstress/include/mk/gitignore.mk delete mode 100644 fsstress/include/mk/lib.mk delete mode 100644 fsstress/include/mk/man.mk delete mode 100644 fsstress/include/mk/module.mk delete mode 100644 fsstress/include/mk/testcases.mk delete mode 100644 fsstress/include/old/cleanup.c delete mode 100644 fsstress/include/old/ltp_cpuid.h delete mode 100644 fsstress/include/old/ltp_priv.h delete mode 100644 fsstress/include/old/ltp_signal.h delete mode 100644 fsstress/include/old/old_checkpoint.h delete mode 100644 fsstress/include/old/old_device.h delete mode 100644 fsstress/include/old/old_module.h delete mode 100644 fsstress/include/old/old_resource.h delete mode 100644 fsstress/include/old/old_safe_file_ops.h delete mode 100644 fsstress/include/old/old_safe_net.h delete mode 100644 fsstress/include/old/old_safe_stdio.h delete mode 100644 fsstress/include/old/old_tmpdir.h delete mode 100644 fsstress/include/old/random_range.h delete mode 100644 fsstress/include/old/safe_macros.h delete mode 100644 fsstress/include/old/test.h delete mode 100644 fsstress/include/old/tlibio.h delete mode 100644 fsstress/include/old/usctest.h delete mode 100644 fsstress/include/parse_vdso.h delete mode 100644 fsstress/include/safe_file_ops_fn.h delete mode 100644 fsstress/include/safe_macros_fn.h delete mode 100644 fsstress/include/safe_net_fn.h delete mode 100644 fsstress/include/safe_stdio_fn.h delete mode 100644 fsstress/include/stamp-h1 delete mode 100644 fsstress/include/tst_af_alg.h delete mode 100644 fsstress/include/tst_ansi_color.h delete mode 100644 fsstress/include/tst_assert.h delete mode 100644 fsstress/include/tst_atomic.h delete mode 100644 fsstress/include/tst_buffers.h delete mode 100644 fsstress/include/tst_capability.h delete mode 100644 fsstress/include/tst_cgroup.h delete mode 100644 fsstress/include/tst_checkpoint.h delete mode 100644 fsstress/include/tst_checkpoint_fn.h delete mode 100644 fsstress/include/tst_checksum.h delete mode 100644 fsstress/include/tst_clocks.h delete mode 100644 fsstress/include/tst_clone.h delete mode 100644 fsstress/include/tst_cmd.h delete mode 100644 fsstress/include/tst_common.h delete mode 100644 fsstress/include/tst_coredump.h delete mode 100644 fsstress/include/tst_cpu.h delete mode 100644 fsstress/include/tst_crypto.h delete mode 100644 fsstress/include/tst_device.h delete mode 100644 fsstress/include/tst_fs.h delete mode 100644 fsstress/include/tst_fuzzy_sync.h delete mode 100644 fsstress/include/tst_get_bad_addr.h delete mode 100644 fsstress/include/tst_hugepage.h delete mode 100644 fsstress/include/tst_kconfig.h delete mode 100644 fsstress/include/tst_kernel.h delete mode 100644 fsstress/include/tst_kvercmp.h delete mode 100644 fsstress/include/tst_minmax.h delete mode 100644 fsstress/include/tst_mkfs.h delete mode 100644 fsstress/include/tst_net.h delete mode 100644 fsstress/include/tst_netlink.h delete mode 100644 fsstress/include/tst_numa.h delete mode 100644 fsstress/include/tst_path_has_mnt_flags.h delete mode 100644 fsstress/include/tst_pid.h delete mode 100644 fsstress/include/tst_private.h delete mode 100644 fsstress/include/tst_process_state.h delete mode 100644 fsstress/include/tst_res_flags.h delete mode 100644 fsstress/include/tst_safe_clocks.h delete mode 100644 fsstress/include/tst_safe_file_ops.h delete mode 100644 fsstress/include/tst_safe_macros.h delete mode 100644 fsstress/include/tst_safe_net.h delete mode 100644 fsstress/include/tst_safe_posix_ipc.h delete mode 100644 fsstress/include/tst_safe_prw.h delete mode 100644 fsstress/include/tst_safe_pthread.h delete mode 100644 fsstress/include/tst_safe_stdio.h delete mode 100644 fsstress/include/tst_safe_sysv_ipc.h delete mode 100644 fsstress/include/tst_safe_timerfd.h delete mode 100644 fsstress/include/tst_sig_proc.h delete mode 100644 fsstress/include/tst_sys_conf.h delete mode 100644 fsstress/include/tst_taint.h delete mode 100644 fsstress/include/tst_test.h delete mode 100644 fsstress/include/tst_timer.h delete mode 100644 fsstress/include/tst_timer_test.h delete mode 100644 fsstress/include/tst_uinput.h delete mode 100644 fsstress/include/tst_wallclock.h delete mode 100644 fsstress/xfscompat.h diff --git a/fsstress/Makefile b/fsstress/Makefile deleted file mode 100644 index 79d15388e8..0000000000 --- a/fsstress/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# -# kernel/fs/fsstress testcases Makefile. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# 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. -# -# Ngie Cooper, July 2009 -# - -top_srcdir ?= . - -include $(top_srcdir)/include/mk/env_pre.mk - -CPPFLAGS += -DNO_XFS -I$(abs_srcdir) \ - -D_LARGEFILE64_SOURCE -D_GNU_SOURCE - -# if removed -DNO_XFS, you should unmask the following line -#LDLIBS += -lattr - -# XXX (garrcoop): not -Wuninitialized clean. -CPPFLAGS += -Wno-error - -include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/fsstress/fsstress.c b/fsstress/fsstress.c deleted file mode 100644 index 811e6ff141..0000000000 --- a/fsstress/fsstress.c +++ /dev/null @@ -1,2676 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ - */ - -#include "config.h" -#include "global.h" -#include -#ifdef HAVE_SYS_PRCTL_H -# include -#endif -#include - -#define XFS_ERRTAG_MAX 17 - -typedef enum { -#ifndef NO_XFS - OP_ALLOCSP, - OP_ATTR_REMOVE, - OP_ATTR_SET, - OP_BULKSTAT, - OP_BULKSTAT1, -#endif - OP_CHOWN, - OP_CREAT, - OP_DREAD, - OP_DWRITE, - OP_FDATASYNC, -#ifndef NO_XFS - OP_FREESP, -#endif - OP_FSYNC, - OP_GETDENTS, - OP_LINK, - OP_MKDIR, - OP_MKNOD, - OP_READ, - OP_READLINK, - OP_RENAME, -#ifndef NO_XFS - OP_RESVSP, -#endif - OP_RMDIR, - OP_STAT, - OP_SYMLINK, - OP_SYNC, - OP_TRUNCATE, - OP_UNLINK, -#ifndef NO_XFS - OP_UNRESVSP, -#endif - OP_WRITE, - OP_LAST -} opty_t; - -typedef void (*opfnc_t) (int, long); - -typedef struct opdesc { - opty_t op; - char *name; - opfnc_t func; - int freq; - int iswrite; - int isxfs; -} opdesc_t; - -typedef struct fent { - int id; - int parent; -} fent_t; - -typedef struct flist { - int nfiles; - int nslots; - int tag; - fent_t *fents; -} flist_t; - -typedef struct pathname { - int len; - char *path; -} pathname_t; - -#define FT_DIR 0 -#define FT_DIRm (1 << FT_DIR) -#define FT_REG 1 -#define FT_REGm (1 << FT_REG) -#define FT_SYM 2 -#define FT_SYMm (1 << FT_SYM) -#define FT_DEV 3 -#define FT_DEVm (1 << FT_DEV) -#define FT_RTF 4 -#define FT_RTFm (1 << FT_RTF) -#define FT_nft 5 -#define FT_ANYm ((1 << FT_nft) - 1) -#define FT_REGFILE (FT_REGm | FT_RTFm) -#define FT_NOTDIR (FT_ANYm & ~FT_DIRm) - -#define FLIST_SLOT_INCR 16 -#define NDCACHE 64 - -#define MAXFSIZE ((1ULL << 63) - 1ULL) -#define MAXFSIZE32 ((1ULL << 40) - 1ULL) - -void allocsp_f(int, long); -void attr_remove_f(int, long); -void attr_set_f(int, long); -void bulkstat_f(int, long); -void bulkstat1_f(int, long); -void chown_f(int, long); -void creat_f(int, long); -void dread_f(int, long); -void dwrite_f(int, long); -void fdatasync_f(int, long); -void freesp_f(int, long); -void fsync_f(int, long); -void getdents_f(int, long); -void link_f(int, long); -void mkdir_f(int, long); -void mknod_f(int, long); -void read_f(int, long); -void readlink_f(int, long); -void rename_f(int, long); -void resvsp_f(int, long); -void rmdir_f(int, long); -void stat_f(int, long); -void symlink_f(int, long); -void sync_f(int, long); -void truncate_f(int, long); -void unlink_f(int, long); -void unresvsp_f(int, long); -void write_f(int, long); - -opdesc_t ops[] = { -#ifndef NO_XFS - {OP_ALLOCSP, "allocsp", allocsp_f, 1, 1, 1}, - {OP_ATTR_REMOVE, "attr_remove", attr_remove_f, /* 1 */ 0, 1, 1}, - {OP_ATTR_SET, "attr_set", attr_set_f, /* 2 */ 0, 1, 1}, - {OP_BULKSTAT, "bulkstat", bulkstat_f, 1, 0, 1}, - {OP_BULKSTAT1, "bulkstat1", bulkstat1_f, 1, 0, 1}, -#endif - {OP_CHOWN, "chown", chown_f, 3, 1, 0}, - {OP_CREAT, "creat", creat_f, 4, 1, 0}, - {OP_DREAD, "dread", dread_f, 4, 0, 0}, - {OP_DWRITE, "dwrite", dwrite_f, 4, 1, 0}, - {OP_FDATASYNC, "fdatasync", fdatasync_f, 1, 1, 0}, -#ifndef NO_XFS - {OP_FREESP, "freesp", freesp_f, 1, 1, 1}, -#endif - {OP_FSYNC, "fsync", fsync_f, 1, 1, 0}, - {OP_GETDENTS, "getdents", getdents_f, 1, 0, 0}, - {OP_LINK, "link", link_f, 1, 1, 0}, - {OP_MKDIR, "mkdir", mkdir_f, 2, 1, 0}, - {OP_MKNOD, "mknod", mknod_f, 2, 1, 0}, - {OP_READ, "read", read_f, 1, 0, 0}, - {OP_READLINK, "readlink", readlink_f, 1, 0, 0}, - {OP_RENAME, "rename", rename_f, 2, 1, 0}, -#ifndef NO_XFS - {OP_RESVSP, "resvsp", resvsp_f, 1, 1, 1}, -#endif - {OP_RMDIR, "rmdir", rmdir_f, 1, 1, 0}, - {OP_STAT, "stat", stat_f, 1, 0, 0}, - {OP_SYMLINK, "symlink", symlink_f, 2, 1, 0}, - {OP_SYNC, "sync", sync_f, 1, 0, 0}, - {OP_TRUNCATE, "truncate", truncate_f, 2, 1, 0}, - {OP_UNLINK, "unlink", unlink_f, 1, 1, 0}, -#ifndef NO_XFS - {OP_UNRESVSP, "unresvsp", unresvsp_f, 1, 1, 1}, -#endif - {OP_WRITE, "write", write_f, 4, 1, 0}, -}, *ops_end; - -flist_t flist[FT_nft] = { - {0, 0, 'd', NULL}, - {0, 0, 'f', NULL}, - {0, 0, 'l', NULL}, - {0, 0, 'c', NULL}, - {0, 0, 'r', NULL}, -}; - -int dcache[NDCACHE]; -int errrange; -int errtag; -opty_t *freq_table; -int freq_table_size; -#ifndef NO_XFS -xfs_fsop_geom_t geom; -#endif -char *homedir; -int *ilist; -int ilistlen; -off64_t maxfsize; -char *myprog; -int namerand; -int nameseq; -int nops; -int nproc = 1; -int operations = 1; -int procid; -int rtpct; -unsigned long seed = 0; -ino_t top_ino; -int verbose = 0; -#ifndef NO_XFS -int no_xfs = 0; -#else -int no_xfs = 1; -#endif -sig_atomic_t should_stop = 0; - -void add_to_flist(int, int, int); -void append_pathname(pathname_t *, char *); -#ifndef NO_XFS -int attr_list_path(pathname_t *, char *, const int, int, attrlist_cursor_t *); -int attr_remove_path(pathname_t *, const char *, int); -int attr_set_path(pathname_t *, const char *, const char *, const int, int); -#endif -void check_cwd(void); -int creat_path(pathname_t *, mode_t); -void dcache_enter(int, int); -void dcache_init(void); -fent_t *dcache_lookup(int); -void dcache_purge(int); -void del_from_flist(int, int); -int dirid_to_name(char *, int); -void doproc(void); -void fent_to_name(pathname_t *, flist_t *, fent_t *); -void fix_parent(int, int); -void free_pathname(pathname_t *); -int generate_fname(fent_t *, int, pathname_t *, int *, int *); -int get_fname(int, long, pathname_t *, flist_t **, fent_t **, int *); -void init_pathname(pathname_t *); -int lchown_path(pathname_t *, uid_t, gid_t); -int link_path(pathname_t *, pathname_t *); -int lstat64_path(pathname_t *, struct stat64 *); -void make_freq_table(void); -int mkdir_path(pathname_t *, mode_t); -int mknod_path(pathname_t *, mode_t, dev_t); -void namerandpad(int, char *, int); -int open_path(pathname_t *, int); -DIR *opendir_path(pathname_t *); -void process_freq(char *); -int readlink_path(pathname_t *, char *, size_t); -int rename_path(pathname_t *, pathname_t *); -int rmdir_path(pathname_t *); -void separate_pathname(pathname_t *, char *, pathname_t *); -void show_ops(int, char *); -int stat64_path(pathname_t *, struct stat64 *); -int symlink_path(const char *, pathname_t *); -int truncate64_path(pathname_t *, off64_t); -int unlink_path(pathname_t *); -void usage(void); -void write_freq(void); -void zero_freq(void); - -void sg_handler(int signum) -{ - should_stop = 1; -} - -int main(int argc, char **argv) -{ - char buf[10]; - int c; - char *dirname = NULL; - int fd; - int i; - int cleanup = 0; - int loops = 1; - int loopcntr = 1; - char cmd[256]; -#ifndef NO_XFS - int j; -#endif - char *p; - int stat; - struct timeval t; -#ifndef NO_XFS - ptrdiff_t srval; -#endif - int nousage = 0; -#ifndef NO_XFS - xfs_error_injection_t err_inj; -#endif - struct sigaction action; - - errrange = errtag = 0; - umask(0); - nops = ARRAY_SIZE(ops); - ops_end = &ops[nops]; - myprog = argv[0]; - while ((c = getopt(argc, argv, "cd:e:f:i:l:n:p:rs:vwzHSX")) != -1) { - switch (c) { - case 'c': - /*Don't cleanup */ - cleanup = 1; - break; - case 'd': - dirname = optarg; - break; - case 'e': - sscanf(optarg, "%d", &errtag); - if (errtag < 0) { - errtag = -errtag; - errrange = 1; - } else if (errtag == 0) - errtag = -1; - if (errtag >= XFS_ERRTAG_MAX) { - fprintf(stderr, - "error tag %d too large (max %d)\n", - errtag, XFS_ERRTAG_MAX - 1); - exit(1); - } - break; - case 'f': - process_freq(optarg); - break; - case 'i': - ilist = realloc(ilist, ++ilistlen * sizeof(*ilist)); - ilist[ilistlen - 1] = strtol(optarg, &p, 16); - break; - case 'l': - loops = atoi(optarg); - break; - case 'n': - operations = atoi(optarg); - break; - case 'p': - nproc = atoi(optarg); - break; - case 'r': - namerand = 1; - break; - case 's': - seed = strtoul(optarg, NULL, 0); - break; - case 'v': - verbose = 1; - break; - case 'w': - write_freq(); - break; - case 'z': - zero_freq(); - break; - case 'S': - show_ops(0, NULL); - printf("\n"); - nousage = 1; - break; - case '?': - fprintf(stderr, "%s - invalid parameters\n", myprog); - /* fall through */ - case 'H': - usage(); - exit(1); - case 'X': - no_xfs = 1; - break; - } - } - - if (no_xfs && errtag) { - fprintf(stderr, "error injection only works on XFS\n"); - exit(1); - } - - if (no_xfs) { - int i; - for (i = 0; ops + i < ops_end; ++i) { - if (ops[i].isxfs) - ops[i].freq = 0; - } - } - - make_freq_table(); - - while (((loopcntr <= loops) || (loops == 0)) && !should_stop) { - if (!dirname) { - /* no directory specified */ - if (!nousage) - usage(); - exit(1); - } - - (void)mkdir(dirname, 0777); - if (chdir(dirname) < 0) { - perror(dirname); - exit(1); - } - sprintf(buf, "fss%x", getpid()); - fd = creat(buf, 0666); - if (lseek64(fd, (off64_t) (MAXFSIZE32 + 1ULL), SEEK_SET) < 0) - maxfsize = (off64_t) MAXFSIZE32; - else - maxfsize = (off64_t) MAXFSIZE; - dcache_init(); - setlinebuf(stdout); - if (!seed) { - gettimeofday(&t, NULL); - seed = (int)t.tv_sec ^ (int)t.tv_usec; - printf("seed = %ld\n", seed); - } -#ifndef NO_XFS - if (!no_xfs) { - memset(&geom, 0, sizeof(geom)); - i = ioctl(fd, XFS_IOC_FSGEOMETRY, &geom); - if (i >= 0 && geom.rtblocks) - rtpct = MIN(MAX(geom.rtblocks * 100 / - (geom.rtblocks + - geom.datablocks), 1), 99); - else - rtpct = 0; - } - if (errtag != 0) { - if (errrange == 0) { - if (errtag <= 0) { - srandom(seed); - j = random() % 100; - - for (i = 0; i < j; i++) - (void)random(); - - errtag = - (random() % (XFS_ERRTAG_MAX - 1)) + - 1; - } - } else { - srandom(seed); - j = random() % 100; - - for (i = 0; i < j; i++) - (void)random(); - - errtag += - (random() % (XFS_ERRTAG_MAX - errtag)); - } - printf("Injecting failure on tag #%d\n", errtag); - memset(&err_inj, 0, sizeof(err_inj)); - err_inj.errtag = errtag; - err_inj.fd = fd; - srval = ioctl(fd, XFS_IOC_ERROR_INJECTION, &err_inj); - if (srval < -1) { - perror - ("fsstress - XFS_SYSSGI error injection call"); - close(fd); - unlink(buf); - exit(1); - } - } else -#endif - close(fd); - unlink(buf); - - - if (nproc == 1) { - procid = 0; - doproc(); - } else { - setpgid(0, 0); - action.sa_handler = sg_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = 0; - if (sigaction(SIGTERM, &action, 0)) { - perror("sigaction failed"); - exit(1); - } - - for (i = 0; i < nproc; i++) { - if (fork() == 0) { - - action.sa_handler = SIG_DFL; - sigemptyset(&action.sa_mask); - if (sigaction(SIGTERM, &action, 0)) - return 1; -#ifdef HAVE_SYS_PRCTL_H - prctl(PR_SET_PDEATHSIG, SIGKILL); - if (getppid() == 1) /* parent died already? */ - return 0; -#endif - procid = i; - doproc(); - return 0; - } - } - while (wait(&stat) > 0 && !should_stop) { - continue; - } - if (should_stop) { - action.sa_flags = SA_RESTART; - sigaction(SIGTERM, &action, 0); - kill(-getpid(), SIGTERM); - while (wait(&stat) > 0) - continue; - } - } -#ifndef NO_XFS - if (errtag != 0) { - memset(&err_inj, 0, sizeof(err_inj)); - err_inj.errtag = 0; - err_inj.fd = fd; - if ((srval = - ioctl(fd, XFS_IOC_ERROR_CLEARALL, - &err_inj)) != 0) { - fprintf(stderr, "Bad ej clear on %d (%d).\n", - fd, errno); - perror - ("fsstress - XFS_SYSSGI clear error injection call"); - close(fd); - exit(1); - } - close(fd); - } -#endif - if (cleanup == 0) { - sprintf(cmd, "rm -rf %s/*", dirname); - system(cmd); - for (i = 0; i < FT_nft; i++) { - flist[i].nslots = 0; - flist[i].nfiles = 0; - free(flist[i].fents); - flist[i].fents = NULL; - } - } - loopcntr++; - } - return 0; -} - -void add_to_flist(int ft, int id, int parent) -{ - fent_t *fep; - flist_t *ftp; - - ftp = &flist[ft]; - if (ftp->nfiles == ftp->nslots) { - ftp->nslots += FLIST_SLOT_INCR; - ftp->fents = realloc(ftp->fents, ftp->nslots * sizeof(fent_t)); - } - fep = &ftp->fents[ftp->nfiles++]; - fep->id = id; - fep->parent = parent; -} - -void append_pathname(pathname_t * name, char *str) -{ - int len; - - len = strlen(str); -#ifdef DEBUG - if (len && *str == '/' && name->len == 0) { - fprintf(stderr, "fsstress: append_pathname failure\n"); - chdir(homedir); - abort(); - - } -#endif - name->path = realloc(name->path, name->len + 1 + len); - strcpy(&name->path[name->len], str); - name->len += len; -} - -#ifndef NO_XFS -int -attr_list_path(pathname_t * name, char *buffer, const int buffersize, int flags, - attrlist_cursor_t * cursor) -{ - char buf[MAXNAMELEN]; - pathname_t newname; - int rval; - - rval = attr_list(name->path, buffer, buffersize, flags, cursor); - if (rval >= 0 || errno != ENAMETOOLONG) - return rval; - separate_pathname(name, buf, &newname); - if (chdir(buf) == 0) { - rval = attr_list_path(&newname, buffer, buffersize, flags, - cursor); - chdir(".."); - } - free_pathname(&newname); - return rval; -} - -int attr_remove_path(pathname_t * name, const char *attrname, int flags) -{ - char buf[MAXNAMELEN]; - pathname_t newname; - int rval; - - rval = attr_remove(name->path, attrname, flags); - if (rval >= 0 || errno != ENAMETOOLONG) - return rval; - separate_pathname(name, buf, &newname); - if (chdir(buf) == 0) { - rval = attr_remove_path(&newname, attrname, flags); - chdir(".."); - } - free_pathname(&newname); - return rval; -} - -int -attr_set_path(pathname_t * name, const char *attrname, const char *attrvalue, - const int valuelength, int flags) -{ - char buf[MAXNAMELEN]; - pathname_t newname; - int rval; - - rval = attr_set(name->path, attrname, attrvalue, valuelength, flags); - if (rval >= 0 || errno != ENAMETOOLONG) - return rval; - separate_pathname(name, buf, &newname); - if (chdir(buf) == 0) { - rval = attr_set_path(&newname, attrname, attrvalue, valuelength, - flags); - chdir(".."); - } - free_pathname(&newname); - return rval; -} -#endif - -void check_cwd(void) -{ -#ifdef DEBUG - struct stat64 statbuf; - - if (stat64(".", &statbuf) == 0 && statbuf.st_ino == top_ino) - return; - chdir(homedir); - fprintf(stderr, "fsstress: check_cwd failure\n"); - abort(); - -#endif -} - -int creat_path(pathname_t * name, mode_t mode) -{ - char buf[MAXNAMELEN]; - pathname_t newname; - int rval; - - rval = creat(name->path, mode); - if (rval >= 0 || errno != ENAMETOOLONG) - return rval; - separate_pathname(name, buf, &newname); - if (chdir(buf) == 0) { - rval = creat_path(&newname, mode); - chdir(".."); - } - free_pathname(&newname); - return rval; -} - -void dcache_enter(int dirid, int slot) -{ - dcache[dirid % NDCACHE] = slot; -} - -void dcache_init(void) -{ - int i; - - for (i = 0; i < NDCACHE; i++) - dcache[i] = -1; -} - -fent_t *dcache_lookup(int dirid) -{ - fent_t *fep; - int i; - - i = dcache[dirid % NDCACHE]; - if (i >= 0 && (fep = &flist[FT_DIR].fents[i])->id == dirid) - return fep; - return NULL; -} - -void dcache_purge(int dirid) -{ - int *dcp; - - dcp = &dcache[dirid % NDCACHE]; - if (*dcp >= 0 && flist[FT_DIR].fents[*dcp].id == dirid) - *dcp = -1; -} - -void del_from_flist(int ft, int slot) -{ - flist_t *ftp; - - ftp = &flist[ft]; - if (ft == FT_DIR) - dcache_purge(ftp->fents[slot].id); - if (slot != ftp->nfiles - 1) { - if (ft == FT_DIR) - dcache_purge(ftp->fents[ftp->nfiles - 1].id); - ftp->fents[slot] = ftp->fents[--ftp->nfiles]; - } else - ftp->nfiles--; -} - -fent_t *dirid_to_fent(int dirid) -{ - fent_t *efep; - fent_t *fep; - flist_t *flp; - - if ((fep = dcache_lookup(dirid))) - return fep; - flp = &flist[FT_DIR]; - for (fep = flp->fents, efep = &fep[flp->nfiles]; fep < efep; fep++) { - if (fep->id == dirid) { - dcache_enter(dirid, fep - flp->fents); - return fep; - } - } - return NULL; -} - -void doproc(void) -{ - struct stat64 statbuf; - char buf[10]; - int opno; - int rval; - opdesc_t *p; - - sprintf(buf, "p%x", procid); - (void)mkdir(buf, 0777); - if (chdir(buf) < 0 || stat64(".", &statbuf) < 0) { - perror(buf); - _exit(1); - } - top_ino = statbuf.st_ino; - homedir = getcwd(NULL, -1); - seed += procid; - srandom(seed); - if (namerand) - namerand = random(); - for (opno = 0; opno < operations; opno++) { - p = &ops[freq_table[random() % freq_table_size]]; - if ((unsigned long)p->func < 4096) - abort(); - - p->func(opno, random()); - /* - * test for forced shutdown by stat'ing the test - * directory. If this stat returns EIO, assume - * the forced shutdown happened. - */ - if (errtag != 0 && opno % 100 == 0) { - rval = stat64(".", &statbuf); - if (rval == EIO) { - fprintf(stderr, "Detected EIO\n"); - return; - } - } - } -} - -void fent_to_name(pathname_t * name, flist_t * flp, fent_t * fep) -{ - char buf[MAXNAMELEN]; - int i; - fent_t *pfep; - - if (fep == NULL) - return; - if (fep->parent != -1) { - pfep = dirid_to_fent(fep->parent); - fent_to_name(name, &flist[FT_DIR], pfep); - append_pathname(name, "/"); - } - i = sprintf(buf, "%c%x", flp->tag, fep->id); - namerandpad(fep->id, buf, i); - append_pathname(name, buf); -} - -void fix_parent(int oldid, int newid) -{ - fent_t *fep; - flist_t *flp; - int i; - int j; - - for (i = 0, flp = flist; i < FT_nft; i++, flp++) { - for (j = 0, fep = flp->fents; j < flp->nfiles; j++, fep++) { - if (fep->parent == oldid) - fep->parent = newid; - } - } -} - -void free_pathname(pathname_t * name) -{ - if (name->path) { - free(name->path); - name->path = NULL; - name->len = 0; - } -} - -int generate_fname(fent_t * fep, int ft, pathname_t * name, int *idp, int *v) -{ - char buf[MAXNAMELEN]; - flist_t *flp; - int id; - int j; - int len; - - flp = &flist[ft]; - len = sprintf(buf, "%c%x", flp->tag, id = nameseq++); - namerandpad(id, buf, len); - if (fep) { - fent_to_name(name, &flist[FT_DIR], fep); - append_pathname(name, "/"); - } - append_pathname(name, buf); - *idp = id; - *v = verbose; - for (j = 0; !*v && j < ilistlen; j++) { - if (ilist[j] == id) { - *v = 1; - break; - } - } - return 1; -} - -int -get_fname(int which, long r, pathname_t * name, flist_t ** flpp, fent_t ** fepp, - int *v) -{ - int c; - fent_t *fep; - flist_t *flp; - int i; - int j; - int x; - - for (i = 0, c = 0, flp = flist; i < FT_nft; i++, flp++) { - if (which & (1 << i)) - c += flp->nfiles; - } - if (c == 0) { - if (flpp) - *flpp = NULL; - if (fepp) - *fepp = NULL; - *v = verbose; - return 0; - } - x = (int)(r % c); - for (i = 0, c = 0, flp = flist; i < FT_nft; i++, flp++) { - if (which & (1 << i)) { - if (x < c + flp->nfiles) { - fep = &flp->fents[x - c]; - if (name) - fent_to_name(name, flp, fep); - if (flpp) - *flpp = flp; - if (fepp) - *fepp = fep; - *v = verbose; - for (j = 0; !*v && j < ilistlen; j++) { - if (ilist[j] == fep->id) { - *v = 1; - break; - } - } - return 1; - } - c += flp->nfiles; - } - } -#ifdef DEBUG - fprintf(stderr, "fsstress: get_fname failure\n"); - abort(); -#endif - return -1; - -} - -void init_pathname(pathname_t * name) -{ - name->len = 0; - name->path = NULL; -} - -int lchown_path(pathname_t * name, uid_t owner, gid_t group) -{ - char buf[MAXNAMELEN]; - pathname_t newname; - int rval; - - rval = lchown(name->path, owner, group); - if (rval >= 0 || errno != ENAMETOOLONG) - return rval; - separate_pathname(name, buf, &newname); - if (chdir(buf) == 0) { - rval = lchown_path(&newname, owner, group); - chdir(".."); - } - free_pathname(&newname); - return rval; -} - -int link_path(pathname_t * name1, pathname_t * name2) -{ - char buf1[MAXNAMELEN]; - char buf2[MAXNAMELEN]; - int down1; - pathname_t newname1; - pathname_t newname2; - int rval; - - rval = link(name1->path, name2->path); - if (rval >= 0 || errno != ENAMETOOLONG) - return rval; - separate_pathname(name1, buf1, &newname1); - separate_pathname(name2, buf2, &newname2); - if (strcmp(buf1, buf2) == 0) { - if (chdir(buf1) == 0) { - rval = link_path(&newname1, &newname2); - chdir(".."); - } - } else { - if (strcmp(buf1, "..") == 0) - down1 = 0; - else if (strcmp(buf2, "..") == 0) - down1 = 1; - else if (strlen(buf1) == 0) - down1 = 0; - else if (strlen(buf2) == 0) - down1 = 1; - else - down1 = MAX(newname1.len, 3 + name2->len) <= - MAX(3 + name1->len, newname2.len); - if (down1) { - free_pathname(&newname2); - append_pathname(&newname2, "../"); - append_pathname(&newname2, name2->path); - if (chdir(buf1) == 0) { - rval = link_path(&newname1, &newname2); - chdir(".."); - } - } else { - free_pathname(&newname1); - append_pathname(&newname1, "../"); - append_pathname(&newname1, name1->path); - if (chdir(buf2) == 0) { - rval = link_path(&newname1, &newname2); - chdir(".."); - } - } - } - free_pathname(&newname1); - free_pathname(&newname2); - return rval; -} - -int lstat64_path(pathname_t * name, struct stat64 *sbuf) -{ - char buf[MAXNAMELEN]; - pathname_t newname; - int rval; - - rval = lstat64(name->path, sbuf); - if (rval >= 0 || errno != ENAMETOOLONG) - return rval; - separate_pathname(name, buf, &newname); - if (chdir(buf) == 0) { - rval = lstat64_path(&newname, sbuf); - chdir(".."); - } - free_pathname(&newname); - return rval; -} - -void make_freq_table(void) -{ - int f; - int i; - opdesc_t *p; - - for (p = ops, f = 0; p < ops_end; p++) - f += p->freq; - freq_table = malloc(f * sizeof(*freq_table)); - freq_table_size = f; - for (p = ops, i = 0; p < ops_end; p++) { - for (f = 0; f < p->freq; f++, i++) - freq_table[i] = p->op; - } -} - -int mkdir_path(pathname_t * name, mode_t mode) -{ - char buf[MAXNAMELEN]; - pathname_t newname; - int rval; - - rval = mkdir(name->path, mode); - if (rval >= 0 || errno != ENAMETOOLONG) - return rval; - separate_pathname(name, buf, &newname); - if (chdir(buf) == 0) { - rval = mkdir_path(&newname, mode); - chdir(".."); - } - free_pathname(&newname); - return rval; -} - -int mknod_path(pathname_t * name, mode_t mode, dev_t dev) -{ - char buf[MAXNAMELEN]; - pathname_t newname; - int rval; - - rval = mknod(name->path, mode, dev); - if (rval >= 0 || errno != ENAMETOOLONG) - return rval; - separate_pathname(name, buf, &newname); - if (chdir(buf) == 0) { - rval = mknod_path(&newname, mode, dev); - chdir(".."); - } - free_pathname(&newname); - return rval; -} - -void namerandpad(int id, char *buf, int i) -{ - int bucket; - static int buckets[] = { 2, 4, 8, 16, 32, 64, 128, MAXNAMELEN - 1 }; - int padlen; - int padmod; - - if (namerand == 0) - return; - bucket = (id ^ namerand) % ARRAY_SIZE(buckets); - padmod = buckets[bucket] + 1 - i; - if (padmod <= 0) - return; - padlen = (id ^ namerand) % padmod; - if (padlen) { - memset(&buf[i], 'X', padlen); - buf[i + padlen] = '\0'; - } -} - -int open_path(pathname_t * name, int oflag) -{ - char buf[MAXNAMELEN]; - pathname_t newname; - int rval; - - rval = open(name->path, oflag); - if (rval >= 0 || errno != ENAMETOOLONG) - return rval; - separate_pathname(name, buf, &newname); - if (chdir(buf) == 0) { - rval = open_path(&newname, oflag); - chdir(".."); - } - free_pathname(&newname); - return rval; -} - -DIR *opendir_path(pathname_t * name) -{ - char buf[MAXNAMELEN]; - pathname_t newname; - DIR *rval; - - rval = opendir(name->path); - if (rval || errno != ENAMETOOLONG) - return rval; - separate_pathname(name, buf, &newname); - if (chdir(buf) == 0) { - rval = opendir_path(&newname); - chdir(".."); - } - free_pathname(&newname); - return rval; -} - -void process_freq(char *arg) -{ - opdesc_t *p; - char *s; - - s = strchr(arg, '='); - if (s == NULL) { - fprintf(stderr, "bad argument '%s'\n", arg); - exit(1); - } - *s++ = '\0'; - for (p = ops; p < ops_end; p++) { - if (strcmp(arg, p->name) == 0) { - p->freq = atoi(s); - return; - } - } - fprintf(stderr, "can't find op type %s for -f\n", arg); - exit(1); -} - -int readlink_path(pathname_t * name, char *lbuf, size_t lbufsiz) -{ - char buf[MAXNAMELEN]; - pathname_t newname; - int rval; - - rval = readlink(name->path, lbuf, lbufsiz-1); - if (rval >= 0) - lbuf[rval] = '\0'; - if (rval >= 0 || errno != ENAMETOOLONG) - return rval; - separate_pathname(name, buf, &newname); - if (chdir(buf) == 0) { - rval = readlink_path(&newname, lbuf, lbufsiz); - chdir(".."); - } - free_pathname(&newname); - return rval; -} - -int rename_path(pathname_t * name1, pathname_t * name2) -{ - char buf1[MAXNAMELEN]; - char buf2[MAXNAMELEN]; - int down1; - pathname_t newname1; - pathname_t newname2; - int rval; - - rval = rename(name1->path, name2->path); - if (rval >= 0 || errno != ENAMETOOLONG) - return rval; - separate_pathname(name1, buf1, &newname1); - separate_pathname(name2, buf2, &newname2); - if (strcmp(buf1, buf2) == 0) { - if (chdir(buf1) == 0) { - rval = rename_path(&newname1, &newname2); - chdir(".."); - } - } else { - if (strcmp(buf1, "..") == 0) - down1 = 0; - else if (strcmp(buf2, "..") == 0) - down1 = 1; - else if (strlen(buf1) == 0) - down1 = 0; - else if (strlen(buf2) == 0) - down1 = 1; - else - down1 = MAX(newname1.len, 3 + name2->len) <= - MAX(3 + name1->len, newname2.len); - if (down1) { - free_pathname(&newname2); - append_pathname(&newname2, "../"); - append_pathname(&newname2, name2->path); - if (chdir(buf1) == 0) { - rval = rename_path(&newname1, &newname2); - chdir(".."); - } - } else { - free_pathname(&newname1); - append_pathname(&newname1, "../"); - append_pathname(&newname1, name1->path); - if (chdir(buf2) == 0) { - rval = rename_path(&newname1, &newname2); - chdir(".."); - } - } - } - free_pathname(&newname1); - free_pathname(&newname2); - return rval; -} - -int rmdir_path(pathname_t * name) -{ - char buf[MAXNAMELEN]; - pathname_t newname; - int rval; - - rval = rmdir(name->path); - if (rval >= 0 || errno != ENAMETOOLONG) - return rval; - separate_pathname(name, buf, &newname); - if (chdir(buf) == 0) { - rval = rmdir_path(&newname); - chdir(".."); - } - free_pathname(&newname); - return rval; -} - -void separate_pathname(pathname_t * name, char *buf, pathname_t * newname) -{ - char *slash; - - init_pathname(newname); - slash = strchr(name->path, '/'); - if (slash == NULL) { - buf[0] = '\0'; - return; - } - *slash = '\0'; - strcpy(buf, name->path); - *slash = '/'; - append_pathname(newname, slash + 1); -} - -#define WIDTH 80 - -void show_ops(int flag, char *lead_str) -{ - opdesc_t *p; - - if (flag < 0) { - /* print in list form */ - int x = WIDTH; - - for (p = ops; p < ops_end; p++) { - if (lead_str != NULL - && x + strlen(p->name) >= WIDTH - 5) - x = printf("%s%s", (p == ops) ? "" : "\n", - lead_str); - x += printf("%s ", p->name); - } - printf("\n"); - } else { - int f; - for (f = 0, p = ops; p < ops_end; p++) - f += p->freq; - - if (f == 0) - flag = 1; - - for (p = ops; p < ops_end; p++) { - if (flag != 0 || p->freq > 0) { - if (lead_str != NULL) - printf("%s", lead_str); - printf("%20s %d/%d %s\n", - p->name, p->freq, f, - (p->iswrite == 0) ? " " : "write op"); - } - } - } -} - -int stat64_path(pathname_t * name, struct stat64 *sbuf) -{ - char buf[MAXNAMELEN]; - pathname_t newname; - int rval; - - rval = stat64(name->path, sbuf); - if (rval >= 0 || errno != ENAMETOOLONG) - return rval; - separate_pathname(name, buf, &newname); - if (chdir(buf) == 0) { - rval = stat64_path(&newname, sbuf); - chdir(".."); - } - free_pathname(&newname); - return rval; -} - -int symlink_path(const char *name1, pathname_t * name) -{ - char buf[MAXNAMELEN]; - pathname_t newname; - int rval; - - if (!strcmp(name1, name->path)) { - printf("yikes! %s %s\n", name1, name->path); - return 0; - } - - rval = symlink(name1, name->path); - if (rval >= 0 || errno != ENAMETOOLONG) - return rval; - separate_pathname(name, buf, &newname); - if (chdir(buf) == 0) { - rval = symlink_path(name1, &newname); - chdir(".."); - } - free_pathname(&newname); - return rval; -} - -int truncate64_path(pathname_t * name, off64_t length) -{ - char buf[MAXNAMELEN]; - pathname_t newname; - int rval; - - rval = truncate64(name->path, length); - if (rval >= 0 || errno != ENAMETOOLONG) - return rval; - separate_pathname(name, buf, &newname); - if (chdir(buf) == 0) { - rval = truncate64_path(&newname, length); - chdir(".."); - } - free_pathname(&newname); - return rval; -} - -int unlink_path(pathname_t * name) -{ - char buf[MAXNAMELEN]; - pathname_t newname; - int rval; - - rval = unlink(name->path); - if (rval >= 0 || errno != ENAMETOOLONG) - return rval; - separate_pathname(name, buf, &newname); - if (chdir(buf) == 0) { - rval = unlink_path(&newname); - chdir(".."); - } - free_pathname(&newname); - return rval; -} - -void usage(void) -{ - printf("Usage: %s -H or\n", myprog); - printf - (" %s [-c][-d dir][-e errtg][-f op_name=freq][-l loops][-n nops]\n", - myprog); - printf(" [-p nproc][-r len][-s seed][-v][-w][-z][-S]\n"); - printf("where\n"); - printf - (" -c specifies not to remove files(cleanup) after execution\n"); - printf - (" -d dir specifies the base directory for operations\n"); - printf(" -e errtg specifies error injection stuff\n"); - printf - (" -f op_name=freq changes the frequency of option name to freq\n"); - printf(" the valid operation names are:\n"); - show_ops(-1, " "); - printf - (" -l loops specifies the no. of times the testrun should loop.\n"); - printf(" *use 0 for infinite (default 1)\n"); - printf - (" -n nops specifies the no. of operations per process (default 1)\n"); - printf - (" -p nproc specifies the no. of processes (default 1)\n"); - printf(" -r specifies random name padding\n"); - printf - (" -s seed specifies the seed for the random generator (default random)\n"); - printf(" -v specifies verbose mode\n"); - printf - (" -w zeros frequencies of non-write operations\n"); - printf(" -z zeros frequencies of all operations\n"); - printf - (" -S prints the table of operations (omitting zero frequency)\n"); - printf(" -H prints usage and exits\n"); - printf - (" -X don't do anything XFS specific (default with -DNO_XFS)\n"); -} - -void write_freq(void) -{ - opdesc_t *p; - - for (p = ops; p < ops_end; p++) { - if (!p->iswrite) - p->freq = 0; - } -} - -void zero_freq(void) -{ - opdesc_t *p; - - for (p = ops; p < ops_end; p++) - p->freq = 0; -} - -#ifndef NO_XFS - -void allocsp_f(int opno, long r) -{ - int e; - pathname_t f; - int fd; - struct xfs_flock64 fl; - __s64 lr; - __s64 off; - struct stat64 stb; - int v; - - init_pathname(&f); - if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) { - if (v) - printf("%d/%d: allocsp - no filename\n", procid, opno); - free_pathname(&f); - return; - } - fd = open_path(&f, O_RDWR); - e = fd < 0 ? errno : 0; - check_cwd(); - if (fd < 0) { - if (v) - printf("%d/%d: allocsp - open %s failed %d\n", - procid, opno, f.path, e); - free_pathname(&f); - return; - } - if (fstat64(fd, &stb) < 0) { - if (v) - printf("%d/%d: allocsp - fstat64 %s failed %d\n", - procid, opno, f.path, errno); - free_pathname(&f); - close(fd); - return; - } - lr = ((__s64) random() << 32) + random(); - off = lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE); - off %= maxfsize; - memset(&fl, 0, sizeof(fl)); - fl.l_whence = SEEK_SET; - fl.l_start = off; - fl.l_len = 0; - e = ioctl(fd, XFS_IOC_ALLOCSP64, &fl) < 0 ? errno : 0; - if (v) - printf("%d/%d: ioctl(XFS_IOC_ALLOCSP64) %s %lld 0 %d\n", - procid, opno, f.path, (long long)off, e); - free_pathname(&f); - close(fd); -} - -void attr_remove_f(int opno, long r) -{ - attrlist_ent_t *aep; - attrlist_t *alist; - char *aname; - char buf[4096]; - attrlist_cursor_t cursor; - int e; - int ent; - pathname_t f; - int total; - int v; - int which; - - init_pathname(&f); - if (!get_fname(FT_ANYm, r, &f, NULL, NULL, &v)) - append_pathname(&f, "."); - total = 0; - memset(&cursor, 0x00, sizeof(cursor)); - do { - e = attr_list_path(&f, buf, sizeof(buf), ATTR_DONTFOLLOW, - &cursor); - check_cwd(); - if (e) - break; - alist = (attrlist_t *) buf; - total += alist->al_count; - } while (alist->al_more); - if (total == 0) { - if (v) - printf("%d/%d: attr_remove - no attrs for %s\n", - procid, opno, f.path); - free_pathname(&f); - return; - } - which = (int)(random() % total); - memset(&cursor, 0x00, sizeof(cursor)); - ent = 0; - aname = NULL; - do { - e = attr_list_path(&f, buf, sizeof(buf), ATTR_DONTFOLLOW, - &cursor); - check_cwd(); - if (e) - break; - alist = (attrlist_t *) buf; - if (which < ent + alist->al_count) { - aep = (attrlist_ent_t *) - & buf[alist->al_offset[which - ent]]; - aname = aep->a_name; - break; - } - ent += alist->al_count; - } while (alist->al_more); - if (aname == NULL) { - if (v) - printf("%d/%d: attr_remove - name %d not found at %s\n", - procid, opno, which, f.path); - free_pathname(&f); - return; - } - e = attr_remove_path(&f, aname, ATTR_DONTFOLLOW) < 0 ? errno : 0; - check_cwd(); - if (v) - printf("%d/%d: attr_remove %s %s %d\n", - procid, opno, f.path, aname, e); - free_pathname(&f); -} - -void attr_set_f(int opno, long r) -{ - char aname[10]; - char *aval; - int e; - pathname_t f; - int len; - static int lengths[] = { 10, 100, 1000, 10000 }; - int li; - int v; - - init_pathname(&f); - if (!get_fname(FT_ANYm, r, &f, NULL, NULL, &v)) - append_pathname(&f, "."); - sprintf(aname, "a%x", nameseq++); - li = (int)(random() % ARRAY_SIZE(lengths)); - len = (int)(random() % lengths[li]); - if (len == 0) - len = 1; - aval = malloc(len); - memset(aval, nameseq & 0xff, len); - e = attr_set_path(&f, aname, aval, len, ATTR_DONTFOLLOW) < 0 ? - errno : 0; - check_cwd(); - free(aval); - if (v) - printf("%d/%d: attr_set %s %s %d\n", procid, opno, f.path, - aname, e); - free_pathname(&f); -} - -void bulkstat_f(int opno, long r) -{ - __s32 count; - int fd; - __u64 last; - __s32 nent; - xfs_bstat_t *t; - int64_t total; - xfs_fsop_bulkreq_t bsr; - - last = 0; - nent = (r % 999) + 2; - t = malloc(nent * sizeof(*t)); - fd = open(".", O_RDONLY); - total = 0; - - memset(&bsr, 0, sizeof(bsr)); - bsr.lastip = &last; - bsr.icount = nent; - bsr.ubuffer = t; - bsr.ocount = &count; - - while (ioctl(fd, XFS_IOC_FSBULKSTAT, &bsr) == 0 && count > 0) - total += count; - free(t); - if (verbose) - printf("%d/%d: bulkstat nent %d total %lld\n", - procid, opno, (int)nent, (long long)total); - close(fd); -} - -void bulkstat1_f(int opno, long r) -{ - int e; - pathname_t f; - int fd; - int good; - __u64 ino; - struct stat64 s; - xfs_bstat_t t; - int v; - xfs_fsop_bulkreq_t bsr; - - good = random() & 1; - if (good) { - /* use an inode we know exists */ - init_pathname(&f); - if (!get_fname(FT_ANYm, r, &f, NULL, NULL, &v)) - append_pathname(&f, "."); - ino = stat64_path(&f, &s) < 0 ? (ino64_t) r : s.st_ino; - check_cwd(); - free_pathname(&f); - } else { - /* - * pick a random inode - * - * note this can generate kernel warning messages - * since bulkstat_one will read the disk block that - * would contain a given inode even if that disk - * block doesn't contain inodes. - * - * this is detected later, but not until after the - * warning is displayed. - * - * "XFS: device 0x825- bad inode magic/vsn daddr 0x0 #0" - * - */ - ino = (ino64_t) r; - v = verbose; - } - fd = open(".", O_RDONLY); - - memset(&bsr, 0, sizeof(bsr)); - bsr.lastip = &ino; - bsr.icount = 1; - bsr.ubuffer = &t; - bsr.ocount = NULL; - - e = ioctl(fd, XFS_IOC_FSBULKSTAT_SINGLE, &bsr) < 0 ? errno : 0; - if (v) - printf("%d/%d: bulkstat1 %s ino %lld %d\n", - procid, opno, good ? "real" : "random", - (long long)ino, e); - close(fd); -} - -#endif - -void chown_f(int opno, long r) -{ - int e; - pathname_t f; - int nbits; - uid_t u; - int v; - - init_pathname(&f); - if (!get_fname(FT_ANYm, r, &f, NULL, NULL, &v)) - append_pathname(&f, "."); - u = (uid_t) random(); - nbits = (int)(random() % 32); - u &= (1 << nbits) - 1; - e = lchown_path(&f, u, -1) < 0 ? errno : 0; - check_cwd(); - if (v) - printf("%d/%d: chown %s %d %d\n", procid, opno, f.path, u, e); - free_pathname(&f); -} - -void creat_f(int opno, long r) -{ - int e; - int e1; - int extsize; - pathname_t f; - int fd; - fent_t *fep; - int id; - int parid; - int type; - int v; - int v1; - int esz = 0; - - if (!get_fname(FT_DIRm, r, NULL, NULL, &fep, &v1)) - parid = -1; - else - parid = fep->id; - init_pathname(&f); - type = rtpct ? ((random() % 100) > rtpct ? FT_REG : FT_RTF) : FT_REG; - if (type == FT_RTF) - extsize = (random() % 10) + 1; - else - extsize = 0; - e = generate_fname(fep, type, &f, &id, &v); - v |= v1; - if (!e) { - if (v) { - fent_to_name(&f, &flist[FT_DIR], fep); - printf("%d/%d: creat - no filename from %s\n", - procid, opno, f.path); - } - free_pathname(&f); - return; - } - fd = creat_path(&f, 0666); - e = fd < 0 ? errno : 0; - e1 = 0; - check_cwd(); - esz = 0; - if (fd >= 0) { -#ifndef NO_XFS - struct fsxattr a; - memset(&a, 0, sizeof(a)); - if (extsize && ioctl(fd, XFS_IOC_FSGETXATTR, &a) >= 0) { - a.fsx_xflags |= XFS_XFLAG_REALTIME; - a.fsx_extsize = - geom.rtextsize * geom.blocksize * extsize; - if (ioctl(fd, XFS_IOC_FSSETXATTR, &a) < 0) - e1 = errno; - esz = a.fsx_extsize; - - } -#endif - add_to_flist(type, id, parid); - close(fd); - } - if (v) - printf("%d/%d: creat %s x:%d %d %d\n", procid, opno, f.path, - esz, e, e1); - free_pathname(&f); -} - -int setdirect(int fd) -{ - static int no_direct; - int flags; - - if (no_direct) - return 0; - - flags = fcntl(fd, F_GETFL, 0); - if (flags < 0) - return 0; - - if (fcntl(fd, F_SETFL, flags | O_DIRECT) < 0) { - if (no_xfs) { - no_direct = 1; - return 0; - } - printf("cannot set O_DIRECT: %s\n", strerror(errno)); - return 0; - } - - return 1; -} - -void dread_f(int opno, long r) -{ - int64_t align; - char *buf = NULL; - struct dioattr diob; - int e; - pathname_t f; - int fd; - size_t len; - int64_t lr; - off64_t off; - struct stat64 stb; - int v; - - init_pathname(&f); - if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) { - if (v) - printf("%d/%d: dread - no filename\n", procid, opno); - free_pathname(&f); - return; - } - fd = open_path(&f, O_RDONLY); - - e = fd < 0 ? errno : 0; - check_cwd(); - if (fd < 0) { - if (v) - printf("%d/%d: dread - open %s failed %d\n", - procid, opno, f.path, e); - free_pathname(&f); - return; - } - - if (!setdirect(fd)) { - close(fd); - free_pathname(&f); - return; - } - - if (fstat64(fd, &stb) < 0) { - if (v) - printf("%d/%d: dread - fstat64 %s failed %d\n", - procid, opno, f.path, errno); - free_pathname(&f); - close(fd); - return; - } - if (stb.st_size == 0) { - if (v) - printf("%d/%d: dread - %s zero size\n", procid, opno, - f.path); - free_pathname(&f); - close(fd); - return; - } - - memset(&diob, 0, sizeof(diob)); - if (no_xfs) { - diob.d_miniosz = stb.st_blksize; - diob.d_maxiosz = stb.st_blksize * 256; /* good number ? */ - diob.d_mem = stb.st_blksize; - } -#ifndef NO_XFS - else if (ioctl(fd, XFS_IOC_DIOINFO, &diob) < 0) { - if (v) - printf - ("%d/%d: dread - ioctl(fd, XFS_IOC_DIOINFO) %s failed %d\n", - procid, opno, f.path, errno); - free_pathname(&f); - close(fd); - return; - } -#endif - align = (int64_t) diob.d_miniosz; - lr = ((int64_t) random() << 32) + random(); - off = (off64_t) (lr % stb.st_size); - off -= (off % align); - lseek64(fd, off, SEEK_SET); - len = (random() % (getpagesize() * 32)) + 1; - len -= (len % align); - if (len <= 0) - len = align; - else if (len > diob.d_maxiosz) - len = diob.d_maxiosz; - if ((e = posix_memalign((void **)&buf, diob.d_mem, len)) != 0) { - fprintf(stderr, "posix_memalign: %s\n", strerror(e)); - exit(1); - } - if (buf == NULL) { - fprintf(stderr, "posix_memalign: buf is NULL\n"); - exit(1); - } - e = read(fd, buf, len) < 0 ? errno : 0; - free(buf); - if (v) - printf("%d/%d: dread %s [%lld,%ld] %d\n", - procid, opno, f.path, (long long int)off, (long)len, e); - free_pathname(&f); - close(fd); -} - -void dwrite_f(int opno, long r) -{ - int64_t align; - char *buf = NULL; - struct dioattr diob; - int e; - pathname_t f; - int fd; - size_t len; - int64_t lr; - off64_t off; - struct stat64 stb; - int v; - - init_pathname(&f); - if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) { - if (v) - printf("%d/%d: dwrite - no filename\n", procid, opno); - free_pathname(&f); - return; - } - fd = open_path(&f, O_WRONLY); - e = fd < 0 ? errno : 0; - check_cwd(); - if (fd < 0) { - if (v) - printf("%d/%d: dwrite - open %s failed %d\n", - procid, opno, f.path, e); - free_pathname(&f); - return; - } - - if (!setdirect(fd)) { - close(fd); - free_pathname(&f); - return; - } - if (fstat64(fd, &stb) < 0) { - if (v) - printf("%d/%d: dwrite - fstat64 %s failed %d\n", - procid, opno, f.path, errno); - free_pathname(&f); - close(fd); - return; - } - memset(&diob, 0, sizeof(diob)); - if (no_xfs) { - diob.d_miniosz = stb.st_blksize; - diob.d_maxiosz = stb.st_blksize * 256; /* good number ? */ - diob.d_mem = stb.st_blksize; - } -#ifndef NO_XFS - else if (ioctl(fd, XFS_IOC_DIOINFO, &diob) < 0) { - if (v) - printf - ("%d/%d: dwrite - ioctl(fd, XFS_IOC_DIOINFO) %s failed %d\n", - procid, opno, f.path, errno); - free_pathname(&f); - close(fd); - return; - } -#endif - align = (int64_t) diob.d_miniosz; - lr = ((int64_t) random() << 32) + random(); - off = (off64_t) (lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE)); - off -= (off % align); - lseek64(fd, off, SEEK_SET); - len = (random() % (getpagesize() * 32)) + 1; - len -= (len % align); - if (len <= 0) - len = align; - else if (len > diob.d_maxiosz) - len = diob.d_maxiosz; - if ((e = posix_memalign((void **)&buf, diob.d_mem, len)) != 0) { - fprintf(stderr, "posix_memalign: %s\n", strerror(e)); - exit(1); - } - if (buf == NULL) { - fprintf(stderr, "posix_memalign: buf is NULL\n"); - exit(1); - } - off %= maxfsize; - lseek64(fd, off, SEEK_SET); - memset(buf, nameseq & 0xff, len); - e = write(fd, buf, len) < 0 ? errno : 0; - free(buf); - if (v) - printf("%d/%d: dwrite %s [%lld,%ld] %d\n", - procid, opno, f.path, (long long)off, (long int)len, e); - free_pathname(&f); - close(fd); -} - -void fdatasync_f(int opno, long r) -{ - int e; - pathname_t f; - int fd; - int v; - - init_pathname(&f); - if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) { - if (v) - printf("%d/%d: fdatasync - no filename\n", - procid, opno); - free_pathname(&f); - return; - } - fd = open_path(&f, O_WRONLY); - e = fd < 0 ? errno : 0; - check_cwd(); - if (fd < 0) { - if (v) - printf("%d/%d: fdatasync - open %s failed %d\n", - procid, opno, f.path, e); - free_pathname(&f); - return; - } - e = fdatasync(fd) < 0 ? errno : 0; - if (v) - printf("%d/%d: fdatasync %s %d\n", procid, opno, f.path, e); - free_pathname(&f); - close(fd); -} - -#ifndef NO_XFS -void freesp_f(int opno, long r) -{ - int e; - pathname_t f; - int fd; - struct xfs_flock64 fl; - __s64 lr; - __s64 off; - struct stat64 stb; - int v; - - init_pathname(&f); - if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) { - if (v) - printf("%d/%d: freesp - no filename\n", procid, opno); - free_pathname(&f); - return; - } - fd = open_path(&f, O_RDWR); - e = fd < 0 ? errno : 0; - check_cwd(); - if (fd < 0) { - if (v) - printf("%d/%d: freesp - open %s failed %d\n", - procid, opno, f.path, e); - free_pathname(&f); - return; - } - if (fstat64(fd, &stb) < 0) { - if (v) - printf("%d/%d: freesp - fstat64 %s failed %d\n", - procid, opno, f.path, errno); - free_pathname(&f); - close(fd); - return; - } - lr = ((__s64) random() << 32) + random(); - off = lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE); - off %= maxfsize; - memset(&fl, 0, sizeof(fl)); - fl.l_whence = SEEK_SET; - fl.l_start = off; - fl.l_len = 0; - e = ioctl(fd, XFS_IOC_FREESP64, &fl) < 0 ? errno : 0; - if (v) - printf("%d/%d: ioctl(XFS_IOC_FREESP64) %s %lld 0 %d\n", - procid, opno, f.path, (long long)off, e); - free_pathname(&f); - close(fd); -} - -#endif - -void fsync_f(int opno, long r) -{ - int e; - pathname_t f; - int fd; - int v; - - init_pathname(&f); - if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) { - if (v) - printf("%d/%d: fsync - no filename\n", procid, opno); - free_pathname(&f); - return; - } - fd = open_path(&f, O_WRONLY); - e = fd < 0 ? errno : 0; - check_cwd(); - if (fd < 0) { - if (v) - printf("%d/%d: fsync - open %s failed %d\n", - procid, opno, f.path, e); - free_pathname(&f); - return; - } - e = fsync(fd) < 0 ? errno : 0; - if (v) - printf("%d/%d: fsync %s %d\n", procid, opno, f.path, e); - free_pathname(&f); - close(fd); -} - -void getdents_f(int opno, long r) -{ - DIR *dir; - pathname_t f; - int v; - - init_pathname(&f); - if (!get_fname(FT_DIRm, r, &f, NULL, NULL, &v)) - append_pathname(&f, "."); - dir = opendir_path(&f); - check_cwd(); - if (dir == NULL) { - if (v) - printf("%d/%d: getdents - can't open %s\n", - procid, opno, f.path); - free_pathname(&f); - return; - } - while (readdir64(dir) != NULL) - continue; - if (v) - printf("%d/%d: getdents %s 0\n", procid, opno, f.path); - free_pathname(&f); - closedir(dir); -} - -void link_f(int opno, long r) -{ - int e; - pathname_t f; - fent_t *fep; - flist_t *flp; - int id; - pathname_t l; - int parid; - int v; - int v1; - - init_pathname(&f); - if (!get_fname(FT_NOTDIR, r, &f, &flp, NULL, &v1)) { - if (v1) - printf("%d/%d: link - no file\n", procid, opno); - free_pathname(&f); - return; - } - if (!get_fname(FT_DIRm, random(), NULL, NULL, &fep, &v)) - parid = -1; - else - parid = fep->id; - v |= v1; - init_pathname(&l); - e = generate_fname(fep, flp - flist, &l, &id, &v1); - v |= v1; - if (!e) { - if (v) { - fent_to_name(&l, &flist[FT_DIR], fep); - printf("%d/%d: link - no filename from %s\n", - procid, opno, l.path); - } - free_pathname(&l); - free_pathname(&f); - return; - } - e = link_path(&f, &l) < 0 ? errno : 0; - check_cwd(); - if (e == 0) - add_to_flist(flp - flist, id, parid); - if (v) - printf("%d/%d: link %s %s %d\n", procid, opno, f.path, l.path, - e); - free_pathname(&l); - free_pathname(&f); -} - -void mkdir_f(int opno, long r) -{ - int e; - pathname_t f; - fent_t *fep; - int id; - int parid; - int v; - int v1; - - if (!get_fname(FT_DIRm, r, NULL, NULL, &fep, &v)) - parid = -1; - else - parid = fep->id; - init_pathname(&f); - e = generate_fname(fep, FT_DIR, &f, &id, &v1); - v |= v1; - if (!e) { - if (v) { - fent_to_name(&f, &flist[FT_DIR], fep); - printf("%d/%d: mkdir - no filename from %s\n", - procid, opno, f.path); - } - free_pathname(&f); - return; - } - e = mkdir_path(&f, 0777) < 0 ? errno : 0; - check_cwd(); - if (e == 0) - add_to_flist(FT_DIR, id, parid); - if (v) - printf("%d/%d: mkdir %s %d\n", procid, opno, f.path, e); - free_pathname(&f); -} - -void mknod_f(int opno, long r) -{ - int e; - pathname_t f; - fent_t *fep; - int id; - int parid; - int v; - int v1; - - if (!get_fname(FT_DIRm, r, NULL, NULL, &fep, &v)) - parid = -1; - else - parid = fep->id; - init_pathname(&f); - e = generate_fname(fep, FT_DEV, &f, &id, &v1); - v |= v1; - if (!e) { - if (v) { - fent_to_name(&f, &flist[FT_DIR], fep); - printf("%d/%d: mknod - no filename from %s\n", - procid, opno, f.path); - } - free_pathname(&f); - return; - } - e = mknod_path(&f, S_IFCHR | 0444, 0) < 0 ? errno : 0; - check_cwd(); - if (e == 0) - add_to_flist(FT_DEV, id, parid); - if (v) - printf("%d/%d: mknod %s %d\n", procid, opno, f.path, e); - free_pathname(&f); -} - -void read_f(int opno, long r) -{ - char *buf; - int e; - pathname_t f; - int fd; - size_t len; - int64_t lr; - off64_t off; - struct stat64 stb; - int v; - - init_pathname(&f); - if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) { - if (v) - printf("%d/%d: read - no filename\n", procid, opno); - free_pathname(&f); - return; - } - fd = open_path(&f, O_RDONLY); - e = fd < 0 ? errno : 0; - check_cwd(); - if (fd < 0) { - if (v) - printf("%d/%d: read - open %s failed %d\n", - procid, opno, f.path, e); - free_pathname(&f); - return; - } - if (fstat64(fd, &stb) < 0) { - if (v) - printf("%d/%d: read - fstat64 %s failed %d\n", - procid, opno, f.path, errno); - free_pathname(&f); - close(fd); - return; - } - if (stb.st_size == 0) { - if (v) - printf("%d/%d: read - %s zero size\n", procid, opno, - f.path); - free_pathname(&f); - close(fd); - return; - } - lr = ((int64_t) random() << 32) + random(); - off = (off64_t) (lr % stb.st_size); - lseek64(fd, off, SEEK_SET); - len = (random() % (getpagesize() * 32)) + 1; - buf = malloc(len); - e = read(fd, buf, len) < 0 ? errno : 0; - free(buf); - if (v) - printf("%d/%d: read %s [%lld,%ld] %d\n", - procid, opno, f.path, (long long)off, (long int)len, e); - free_pathname(&f); - close(fd); -} - -void readlink_f(int opno, long r) -{ - char buf[PATH_MAX]; - int e; - pathname_t f; - int v; - - init_pathname(&f); - if (!get_fname(FT_SYMm, r, &f, NULL, NULL, &v)) { - if (v) - printf("%d/%d: readlink - no filename\n", procid, opno); - free_pathname(&f); - return; - } - e = readlink_path(&f, buf, PATH_MAX) < 0 ? errno : 0; - check_cwd(); - if (v) - printf("%d/%d: readlink %s %d\n", procid, opno, f.path, e); - free_pathname(&f); -} - -void rename_f(int opno, long r) -{ - fent_t *dfep; - int e; - pathname_t f; - fent_t *fep; - flist_t *flp; - int id; - pathname_t newf; - int oldid; - int parid; - int v; - int v1; - - init_pathname(&f); - if (!get_fname(FT_ANYm, r, &f, &flp, &fep, &v1)) { - if (v1) - printf("%d/%d: rename - no filename\n", procid, opno); - free_pathname(&f); - return; - } - if (!get_fname(FT_DIRm, random(), NULL, NULL, &dfep, &v)) - parid = -1; - else - parid = dfep->id; - v |= v1; - init_pathname(&newf); - e = generate_fname(dfep, flp - flist, &newf, &id, &v1); - v |= v1; - if (!e) { - if (v) { - fent_to_name(&f, &flist[FT_DIR], dfep); - printf("%d/%d: rename - no filename from %s\n", - procid, opno, f.path); - } - free_pathname(&newf); - free_pathname(&f); - return; - } - e = rename_path(&f, &newf) < 0 ? errno : 0; - check_cwd(); - if (e == 0) { - if (flp - flist == FT_DIR) { - oldid = fep->id; - fix_parent(oldid, id); - } - del_from_flist(flp - flist, fep - flp->fents); - add_to_flist(flp - flist, id, parid); - } - if (v) - printf("%d/%d: rename %s to %s %d\n", procid, opno, f.path, - newf.path, e); - free_pathname(&newf); - free_pathname(&f); -} - -#ifndef NO_XFS -void resvsp_f(int opno, long r) -{ - int e; - pathname_t f; - int fd; - struct xfs_flock64 fl; - __s64 lr; - __s64 off; - struct stat64 stb; - int v; - - init_pathname(&f); - if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) { - if (v) - printf("%d/%d: resvsp - no filename\n", procid, opno); - free_pathname(&f); - return; - } - fd = open_path(&f, O_RDWR); - e = fd < 0 ? errno : 0; - check_cwd(); - if (fd < 0) { - if (v) - printf("%d/%d: resvsp - open %s failed %d\n", - procid, opno, f.path, e); - free_pathname(&f); - return; - } - if (fstat64(fd, &stb) < 0) { - if (v) - printf("%d/%d: resvsp - fstat64 %s failed %d\n", - procid, opno, f.path, errno); - free_pathname(&f); - close(fd); - return; - } - lr = ((__s64) random() << 32) + random(); - off = lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE); - off %= maxfsize; - memset(&fl, 0, sizeof(fl)); - fl.l_whence = SEEK_SET; - fl.l_start = off; - fl.l_len = (__s64) (random() % (1024 * 1024)); - e = ioctl(fd, XFS_IOC_RESVSP64, &fl) < 0 ? errno : 0; - if (v) - printf("%d/%d: ioctl(XFS_IOC_RESVSP64) %s %lld %lld %d\n", - procid, opno, f.path, (long long)off, - (long long)fl.l_len, e); - free_pathname(&f); - close(fd); -} -#endif - -void rmdir_f(int opno, long r) -{ - int e; - pathname_t f; - fent_t *fep; - int v; - - init_pathname(&f); - if (!get_fname(FT_DIRm, r, &f, NULL, &fep, &v)) { - if (v) - printf("%d/%d: rmdir - no directory\n", procid, opno); - free_pathname(&f); - return; - } - e = rmdir_path(&f) < 0 ? errno : 0; - check_cwd(); - if (e == 0) - del_from_flist(FT_DIR, fep - flist[FT_DIR].fents); - if (v) - printf("%d/%d: rmdir %s %d\n", procid, opno, f.path, e); - free_pathname(&f); -} - -void stat_f(int opno, long r) -{ - int e; - pathname_t f; - struct stat64 stb; - int v; - - init_pathname(&f); - if (!get_fname(FT_ANYm, r, &f, NULL, NULL, &v)) { - if (v) - printf("%d/%d: stat - no entries\n", procid, opno); - free_pathname(&f); - return; - } - e = lstat64_path(&f, &stb) < 0 ? errno : 0; - check_cwd(); - if (v) - printf("%d/%d: stat %s %d\n", procid, opno, f.path, e); - free_pathname(&f); -} - -void symlink_f(int opno, long r) -{ - int e; - pathname_t f; - fent_t *fep; - int i; - int id; - int len; - int parid; - int v; - int v1; - char *val; - - if (!get_fname(FT_DIRm, r, NULL, NULL, &fep, &v)) - parid = -1; - else - parid = fep->id; - init_pathname(&f); - e = generate_fname(fep, FT_SYM, &f, &id, &v1); - v |= v1; - if (!e) { - if (v) { - fent_to_name(&f, &flist[FT_DIR], fep); - printf("%d/%d: symlink - no filename from %s\n", - procid, opno, f.path); - } - free_pathname(&f); - return; - } - len = (int)(random() % PATH_MAX); - val = malloc(len + 1); - if (len) - memset(val, 'x', len); - val[len] = '\0'; - for (i = 10; i < len - 1; i += 10) - val[i] = '/'; - e = symlink_path(val, &f) < 0 ? errno : 0; - check_cwd(); - if (e == 0) - add_to_flist(FT_SYM, id, parid); - free(val); - if (v) - printf("%d/%d: symlink %s %d\n", procid, opno, f.path, e); - free_pathname(&f); -} - -/* ARGSUSED */ -void sync_f(int opno, long r) -{ - sync(); - if (verbose) - printf("%d/%d: sync\n", procid, opno); -} - -void truncate_f(int opno, long r) -{ - int e; - pathname_t f; - int64_t lr; - off64_t off; - struct stat64 stb; - int v; - - init_pathname(&f); - if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) { - if (v) - printf("%d/%d: truncate - no filename\n", procid, opno); - free_pathname(&f); - return; - } - e = stat64_path(&f, &stb) < 0 ? errno : 0; - check_cwd(); - if (e > 0) { - if (v) - printf("%d/%d: truncate - stat64 %s failed %d\n", - procid, opno, f.path, e); - free_pathname(&f); - return; - } - lr = ((int64_t) random() << 32) + random(); - off = lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE); - off %= maxfsize; - e = truncate64_path(&f, off) < 0 ? errno : 0; - check_cwd(); - if (v) - printf("%d/%d: truncate %s %lld %d\n", procid, opno, f.path, - (long long)off, e); - free_pathname(&f); -} - -void unlink_f(int opno, long r) -{ - int e; - pathname_t f; - fent_t *fep; - flist_t *flp; - int v; - - init_pathname(&f); - if (!get_fname(FT_NOTDIR, r, &f, &flp, &fep, &v)) { - if (v) - printf("%d/%d: unlink - no file\n", procid, opno); - free_pathname(&f); - return; - } - e = unlink_path(&f) < 0 ? errno : 0; - check_cwd(); - if (e == 0) - del_from_flist(flp - flist, fep - flp->fents); - if (v) - printf("%d/%d: unlink %s %d\n", procid, opno, f.path, e); - free_pathname(&f); -} - -#ifndef NO_XFS -void unresvsp_f(int opno, long r) -{ - int e; - pathname_t f; - int fd; - struct xfs_flock64 fl; - __s64 lr; - __s64 off; - struct stat64 stb; - int v; - - init_pathname(&f); - if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) { - if (v) - printf("%d/%d: unresvsp - no filename\n", procid, opno); - free_pathname(&f); - return; - } - fd = open_path(&f, O_RDWR); - e = fd < 0 ? errno : 0; - check_cwd(); - if (fd < 0) { - if (v) - printf("%d/%d: unresvsp - open %s failed %d\n", - procid, opno, f.path, e); - free_pathname(&f); - return; - } - if (fstat64(fd, &stb) < 0) { - if (v) - printf("%d/%d: unresvsp - fstat64 %s failed %d\n", - procid, opno, f.path, errno); - free_pathname(&f); - close(fd); - return; - } - lr = ((__s64) random() << 32) + random(); - off = lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE); - off %= maxfsize; - memset(&fl, 0, sizeof(fl)); - fl.l_whence = SEEK_SET; - fl.l_start = off; - fl.l_len = (__s64) (random() % (1 << 20)); - e = ioctl(fd, XFS_IOC_UNRESVSP64, &fl) < 0 ? errno : 0; - if (v) - printf("%d/%d: ioctl(XFS_IOC_UNRESVSP64) %s %lld %lld %d\n", - procid, opno, f.path, (long long)off, - (long long)fl.l_len, e); - free_pathname(&f); - close(fd); -} -#endif - -void write_f(int opno, long r) -{ - char *buf; - int e; - pathname_t f; - int fd; - size_t len; - int64_t lr; - off64_t off; - struct stat64 stb; - int v; - - init_pathname(&f); - if (!get_fname(FT_REGm, r, &f, NULL, NULL, &v)) { - if (v) - printf("%d/%d: write - no filename\n", procid, opno); - free_pathname(&f); - return; - } - fd = open_path(&f, O_WRONLY); - e = fd < 0 ? errno : 0; - check_cwd(); - if (fd < 0) { - if (v) - printf("%d/%d: write - open %s failed %d\n", - procid, opno, f.path, e); - free_pathname(&f); - return; - } - if (fstat64(fd, &stb) < 0) { - if (v) - printf("%d/%d: write - fstat64 %s failed %d\n", - procid, opno, f.path, errno); - free_pathname(&f); - close(fd); - return; - } - lr = ((int64_t) random() << 32) + random(); - off = (off64_t) (lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE)); - off %= maxfsize; - lseek64(fd, off, SEEK_SET); - len = (random() % (getpagesize() * 32)) + 1; - buf = malloc(len); - memset(buf, nameseq & 0xff, len); - e = write(fd, buf, len) < 0 ? errno : 0; - free(buf); - if (v) - printf("%d/%d: write %s [%lld,%ld] %d\n", - procid, opno, f.path, (long long)off, (long int)len, e); - free_pathname(&f); - close(fd); -} diff --git a/fsstress/global.h b/fsstress/global.h deleted file mode 100644 index 4ec382426a..0000000000 --- a/fsstress/global.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ - */ - -#ifndef GLOBAL_H -#define GLOBAL_H - -/* xfs-specific includes */ - -#if defined(NO_XFS) -# include "xfscompat.h" -#else -# include -# include -#endif - -/* libc includes */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef O_DIRECT -#define O_DIRECT 040000 -#endif - -#endif diff --git a/fsstress/include/Makefile b/fsstress/include/Makefile deleted file mode 100644 index 7588e66003..0000000000 --- a/fsstress/include/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# -# include Makefile. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# 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. -# -# Ngie Cooper, July 2009 -# - -top_srcdir ?= .. - -include $(top_srcdir)/include/mk/env_pre.mk - -INSTALL_DIR := $(includedir) - -INSTALL_MODE := 00644 - -INSTALL_TARGETS := *.h - -MAKE_TARGETS := - -.PHONY: ac-clean ac-distclean ac-maintainer-clean distclean maintainer-clean -distclean:: clean ac-distclean -maintainer-clean:: distclean ac-maintainer-clean -ac-clean ac-distclean:: - $(RM) -f config.h -ac-maintainer-clean:: - $(RM) -f config.h.in - -vpath %.h $(abs_srcdir) - -include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/fsstress/include/config.h b/fsstress/include/config.h deleted file mode 100644 index 1a0b90cc60..0000000000 --- a/fsstress/include/config.h +++ /dev/null @@ -1,588 +0,0 @@ -/* include/config.h. Generated from config.h.in by configure. */ -/* include/config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if clone() supports 7 arguments. */ -#define CLONE_SUPPORTS_7_ARGS 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_ASM_LDT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_ASM_PTRACE_H 1 - -/* Define to 1 if you have the __atomic_* compiler builtins */ -#define HAVE_ATOMIC_MEMORY_MODEL 1 - -/* Define to 1 if you have __builtin___clear_cache */ -#define HAVE_BUILTIN_CLEAR_CACHE 1 - -/* Define to 1 if you have the `clnttcp_create' function. */ -#define HAVE_CLNTTCP_CREATE 1 - -/* Define to 1 if you have the `clone3' function. */ -/* #undef HAVE_CLONE3 */ - -/* Define to 1 if you have the `copy_file_range' function. */ -#define HAVE_COPY_FILE_RANGE 1 - -/* Define to 1 if you have the `daemon' function. */ -#define HAVE_DAEMON 1 - -/* Define to 1 if you have the declaration of `IFLA_NET_NS_PID', and to 0 if - you don't. */ -#define HAVE_DECL_IFLA_NET_NS_PID 1 - -/* Define to 1 if you have the declaration of `MADV_MERGEABLE', and to 0 if - you don't. */ -#define HAVE_DECL_MADV_MERGEABLE 1 - -/* Define to 1 if you have the declaration of `PR_CAPBSET_DROP', and to 0 if - you don't. */ -#define HAVE_DECL_PR_CAPBSET_DROP 1 - -/* Define to 1 if you have the declaration of `PR_CAPBSET_READ', and to 0 if - you don't. */ -#define HAVE_DECL_PR_CAPBSET_READ 1 - -/* Define to 1 if you have the declaration of `PTRACE_GETSIGINFO', and to 0 if - you don't. */ -#define HAVE_DECL_PTRACE_GETSIGINFO 1 - -/* Define to 1 if you have the declaration of `PTRACE_O_TRACEVFORKDONE', and - to 0 if you don't. */ -#define HAVE_DECL_PTRACE_O_TRACEVFORKDONE 1 - -/* Define to 1 if you have the declaration of `PTRACE_SETOPTIONS', and to 0 if - you don't. */ -#define HAVE_DECL_PTRACE_SETOPTIONS 1 - -/* Define to 1 if the system has the type `enum kcmp_type'. */ -#define HAVE_ENUM_KCMP_TYPE 1 - -/* Define to 1 if you have the `epoll_pwait' function. */ -#define HAVE_EPOLL_PWAIT 1 - -/* Define to 1 if you have the `execveat' function. */ -/* #undef HAVE_EXECVEAT */ - -/* Define to 1 if you have the `fallocate' function. */ -#define HAVE_FALLOCATE 1 - -/* Define to 1 if you have the `fchownat' function. */ -#define HAVE_FCHOWNAT 1 - -/* Define to 1 if you have the `fork' function. */ -#define HAVE_FORK 1 - -/* Define to 1 if you have the `fsconfig' function. */ -/* #undef HAVE_FSCONFIG */ - -/* Define to 1 if you have the `fsmount' function. */ -/* #undef HAVE_FSMOUNT */ - -/* Define to 1 if you have the `fsopen' function. */ -/* #undef HAVE_FSOPEN */ - -/* Define to 1 if you have the `fspick' function. */ -/* #undef HAVE_FSPICK */ - -/* Define to 1 if you have the `fstatat' function. */ -#define HAVE_FSTATAT 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FTS_H 1 - -/* Define to 1 if you have the `getauxval' function. */ -#define HAVE_GETAUXVAL 1 - -/* Define to 1 if you have the `getdents' function. */ -/* #undef HAVE_GETDENTS */ - -/* Define to 1 if you have the `getdents64' function. */ -/* #undef HAVE_GETDENTS64 */ - -/* Define to 1 if you have the header file. */ -#define HAVE_IFADDRS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the `io_pgetevents' function. */ -/* #undef HAVE_IO_PGETEVENTS */ - -/* Define to 1 if you have `io_set_eventfd' function. */ -/* #undef HAVE_IO_SET_EVENTFD */ - -/* Define to 1 if you have the `io_uring_enter' function. */ -/* #undef HAVE_IO_URING_ENTER */ - -/* Define to 1 if you have the `io_uring_register' function. */ -/* #undef HAVE_IO_URING_REGISTER */ - -/* Define to 1 if you have the `io_uring_setup' function. */ -/* #undef HAVE_IO_URING_SETUP */ - -/* Define to 1 if you have the `kcmp' function. */ -/* #undef HAVE_KCMP */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_KEYUTILS_H */ - -/* Define to 1 if you have libacl and it's headers installed */ -/* #undef HAVE_LIBACL */ - -/* Define to 1 if you have libaio and it's headers installed. */ -/* #undef HAVE_LIBAIO */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LIBAIO_H */ - -/* Define to 1 if you have libcap-2 installed. */ -/* #undef HAVE_LIBCAP */ - -/* Define whether libcrypto and openssl headers are installed */ -#define HAVE_LIBCRYPTO 1 - -/* Define to 1 if you have libkeyutils installed. */ -/* #undef HAVE_LIBKEYUTILS */ - -/* Define to 1 if you have libmnl library and headers */ -/* #undef HAVE_LIBMNL */ - -/* Define to 1 if you have both SELinux libraries and headers. */ -/* #undef HAVE_LIBSELINUX_DEVEL */ - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_CAN_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_CGROUPSTATS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_CRYPTOUSER_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_DCCP_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_FS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_GENETLINK_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_IF_ALG_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_IF_ETHER_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_IF_PACKET_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_KEYCTL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_MEMPOLICY_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_MODULE_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_NETLINK_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_PTRACE_H 1 - -/* Define to 1 if having a valid linux/random.h */ -#define HAVE_LINUX_RANDOM_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_SECCOMP_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_SECUREBITS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_SIGNALFD_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_TASKSTATS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_TTY_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_USERFAULTFD_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `mkdirat' function. */ -#define HAVE_MKDIRAT 1 - -/* Define to 1 if you have the `mkdtemp' function. */ -#define HAVE_MKDTEMP 1 - -/* Define to 1 if you have the `mknodat' function. */ -#define HAVE_MKNODAT 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MM_H */ - -/* Define to 1 if you have the `modify_ldt' function. */ -#define HAVE_MODIFY_LDT 1 - -/* Define to 1 if you have the `move_mount' function. */ -/* #undef HAVE_MOVE_MOUNT */ - -/* Define to 1 if you have MREMAP_FIXED in . */ -#define HAVE_MREMAP_FIXED 1 - -/* Define to 1 if you have the `name_to_handle_at' function. */ -#define HAVE_NAME_TO_HANDLE_AT 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NETINET_SCTP_H */ - -/* Define to 1 if you have newer libcap-2 installed. */ -/* #undef HAVE_NEWER_LIBCAP */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NUMAIF_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NUMA_H */ - -/* Define to 1 if you have libnuma and it's headers version >= 2 installed. */ -/* #undef HAVE_NUMA_V2 */ - -/* Define to 1 if you have the `openat' function. */ -#define HAVE_OPENAT 1 - -/* Define to 1 if you have the `openat2' function. */ -/* #undef HAVE_OPENAT2 */ - -/* Define to 1 if you have the header file. */ -#define HAVE_OPENSSL_SHA_H 1 - -/* Define to 1 if you have the `open_tree' function. */ -/* #undef HAVE_OPEN_TREE */ - -/* Define to 1 if you have struct perf_event_attr */ -#define HAVE_PERF_EVENT_ATTR 1 - -/* Define to 1 if you have the `pidfd_open' function. */ -/* #undef HAVE_PIDFD_OPEN */ - -/* Define to 1 if you have the `pidfd_send_signal' function. */ -/* #undef HAVE_PIDFD_SEND_SIGNAL */ - -/* Define to 1 if you have the `pkey_mprotect' function. */ -#define HAVE_PKEY_MPROTECT 1 - -/* Define to 1 if you have the `preadv' function. */ -#define HAVE_PREADV 1 - -/* Define to 1 if you have the `preadv2' function. */ -#define HAVE_PREADV2 1 - -/* Define to 1 if you have the `profil' function. */ -#define HAVE_PROFIL 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_PTHREAD_H 1 - -/* Define to 1 if you have the `pwritev' function. */ -#define HAVE_PWRITEV 1 - -/* Define to 1 if you have the `pwritev2' function. */ -#define HAVE_PWRITEV2 1 - -/* Define to 1 if you have the `readlinkat' function. */ -#define HAVE_READLINKAT 1 - -/* Define to 1 if you have the `recvmmsg' function. */ -#define HAVE_RECVMMSG 1 - -/* Define to 1 if you have the `renameat' function. */ -#define HAVE_RENAMEAT 1 - -/* Define to 1 if you have the `renameat2' function. */ -/* #undef HAVE_RENAMEAT2 */ - -/* Define to 1 if you have the `sched_getcpu' function. */ -#define HAVE_SCHED_GETCPU 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SELINUX_SELINUX_H */ - -/* Define to 1 if you have the `sendmmsg' function. */ -#define HAVE_SENDMMSG 1 - -/* Define to 1 if you have the `setns' function. */ -#define HAVE_SETNS 1 - -/* Define to 1 if you have the `signalfd' function. */ -#define HAVE_SIGNALFD 1 - -/* Define to 1 if you have the `sigpending' function. */ -#define HAVE_SIGPENDING 1 - -/* Define to 1 if you have the `splice' function. */ -#define HAVE_SPLICE 1 - -/* Define to 1 if you have the `statx' function. */ -/* #undef HAVE_STATX */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `stime' function. */ -#define HAVE_STIME 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if the system has the type `struct acct_v3'. */ -#define HAVE_STRUCT_ACCT_V3 1 - -/* Define to 1 if the system has the type `struct fanotify_event_info_fid'. */ -/* #undef HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID */ - -/* Define to 1 if `fsid.__val' is a member of `struct - fanotify_event_info_fid'. */ -/* #undef HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID_FSID___VAL */ - -/* Define to 1 if the system has the type `struct fanotify_event_info_header'. - */ -/* #undef HAVE_STRUCT_FANOTIFY_EVENT_INFO_HEADER */ - -/* Define to 1 if the system has the type `struct file_dedupe_range'. */ -#define HAVE_STRUCT_FILE_DEDUPE_RANGE 1 - -/* Define to 1 if the system has the type `struct fs_quota_statv'. */ -/* #undef HAVE_STRUCT_FS_QUOTA_STATV */ - -/* Define to 1 if you have struct f_owner_ex */ -#define HAVE_STRUCT_F_OWNER_EX 1 - -/* Define to 1 if the system has the type `struct if_nextdqblk'. */ -#define HAVE_STRUCT_IF_NEXTDQBLK 1 - -/* Define to 1 if the system has the type `struct iovec'. */ -#define HAVE_STRUCT_IOVEC 1 - -/* Define to 1 if the system has the type `struct ipc64_perm'. */ -/* #undef HAVE_STRUCT_IPC64_PERM */ - -/* Define to 1 if the system has the type `struct loop_config'. */ -/* #undef HAVE_STRUCT_LOOP_CONFIG */ - -/* Define to 1 if the system has the type `struct mmsghdr'. */ -#define HAVE_STRUCT_MMSGHDR 1 - -/* Define to 1 if the system has the type `struct modify_ldt_ldt_s'. */ -/* #undef HAVE_STRUCT_MODIFY_LDT_LDT_S */ - -/* Define to 1 if the system has the type `struct msqid64_ds'. */ -/* #undef HAVE_STRUCT_MSQID64_DS */ - -/* Define to 1 if `aux_head' is a member of `struct perf_event_mmap_page'. */ -#define HAVE_STRUCT_PERF_EVENT_MMAP_PAGE_AUX_HEAD 1 - -/* Define to 1 if the system has the type `struct ptrace_peeksiginfo_args'. */ -/* #undef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS */ - -/* Define to 1 if the system has the type `struct pt_regs'. */ -#define HAVE_STRUCT_PT_REGS 1 - -/* Define to 1 if the system has the type `struct rlimit64'. */ -#define HAVE_STRUCT_RLIMIT64 1 - -/* Define to 1 if the system has the type `struct semid64_ds'. */ -/* #undef HAVE_STRUCT_SEMID64_DS */ - -/* Define to 1 if the system has the type `struct shmid64_ds'. */ -/* #undef HAVE_STRUCT_SHMID64_DS */ - -/* Define to 1 if `sa_sigaction' is a member of `struct sigaction'. */ -#define HAVE_STRUCT_SIGACTION_SA_SIGACTION 1 - -/* Define to 1 if `ssi_signo' is a member of `struct signalfd_siginfo'. */ -#define HAVE_STRUCT_SIGNALFD_SIGINFO_SSI_SIGNO 1 - -/* Define to 1 if the system has the type `struct statx'. */ -/* #undef HAVE_STRUCT_STATX */ - -/* Define to 1 if the system has the type `struct statx_timestamp'. */ -/* #undef HAVE_STRUCT_STATX_TIMESTAMP */ - -/* Define to 1 if `freepages_count' is a member of `struct taskstats'. */ -#define HAVE_STRUCT_TASKSTATS_FREEPAGES_COUNT 1 - -/* Define to 1 if `nvcsw' is a member of `struct taskstats'. */ -#define HAVE_STRUCT_TASKSTATS_NVCSW 1 - -/* Define to 1 if `read_bytes' is a member of `struct taskstats'. */ -#define HAVE_STRUCT_TASKSTATS_READ_BYTES 1 - -/* Define to 1 if the system has the type `struct termio'. */ -#define HAVE_STRUCT_TERMIO 1 - -/* Define to 1 if the system has the type `struct tpacket_req3'. */ -#define HAVE_STRUCT_TPACKET_REQ3 1 - -/* Define to 1 if the system has the type `struct user_desc'. */ -#define HAVE_STRUCT_USER_DESC 1 - -/* Define to 1 if the system has the type `struct user_regs_struct'. */ -/* #undef HAVE_STRUCT_USER_REGS_STRUCT */ - -/* Define to 1 if `domainname' is a member of `struct utsname'. */ -#define HAVE_STRUCT_UTSNAME_DOMAINNAME 1 - -/* Define to 1 if the system has the type `struct xt_entry_match'. */ -#define HAVE_STRUCT_XT_ENTRY_MATCH 1 - -/* Define to 1 if the system has the type `struct xt_entry_target'. */ -#define HAVE_STRUCT_XT_ENTRY_TARGET 1 - -/* Define to 1 if you have the `syncfs' function. */ -#define HAVE_SYNCFS 1 - -/* Define to 1 if you have __sync_add_and_fetch */ -#define HAVE_SYNC_ADD_AND_FETCH 1 - -/* Define to 1 if you have the `sync_file_range' function. */ -#define HAVE_SYNC_FILE_RANGE 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_ACL_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_CAPABILITY_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_EPOLL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_FANOTIFY_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_INOTIFY_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_PRCTL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_PTRACE_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_REG_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SHM_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SIGNALFD_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIMERFD_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_USTAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_UTSNAME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_XATTR_H 1 - -/* Define to 1 if you have the `tee' function. */ -#define HAVE_TEE 1 - -/* Define to 1 if you have the `timerfd_create' function. */ -#define HAVE_TIMERFD_CREATE 1 - -/* Define to 1 if you have the `timerfd_gettime' function. */ -#define HAVE_TIMERFD_GETTIME 1 - -/* Define to 1 if you have the `timerfd_settime' function. */ -#define HAVE_TIMERFD_SETTIME 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the `unshare' function. */ -#define HAVE_UNSHARE 1 - -/* Define to 1 if you have the `ustat' function. */ -#define HAVE_USTAT 1 - -/* Define to 1 if you have utimensat(2) */ -#define HAVE_UTIMENSAT 1 - -/* Define to 1 if you have the `vfork' function. */ -#define HAVE_VFORK 1 - -/* Define to 1 if you have the `vmsplice' function. */ -#define HAVE_VMSPLICE 1 - -/* Define to 1 if you have the `xdr_char' function. */ -#define HAVE_XDR_CHAR 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_XFS_XQM_H */ - -/* Error message when no NUMA support */ -#define NUMA_ERROR_MSG "test requires libnuma >= 2 and it's development packages" - -/* Name of package */ -#define PACKAGE "ltp" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "ltp@lists.linux.it" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "ltp" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "ltp LTP_VERSION" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "ltp" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "LTP_VERSION" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Target is running Linux w/out an MMU */ -/* #undef UCLINUX */ - -/* Version number of package */ -#define VERSION "LTP_VERSION" - -/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a - `char[]'. */ -#define YYTEXT_POINTER 1 diff --git a/fsstress/include/config.h.in b/fsstress/include/config.h.in deleted file mode 100644 index 3e023d6638..0000000000 --- a/fsstress/include/config.h.in +++ /dev/null @@ -1,587 +0,0 @@ -/* include/config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if clone() supports 7 arguments. */ -#undef CLONE_SUPPORTS_7_ARGS - -/* Define to 1 if you have the header file. */ -#undef HAVE_ASM_LDT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_ASM_PTRACE_H - -/* Define to 1 if you have the __atomic_* compiler builtins */ -#undef HAVE_ATOMIC_MEMORY_MODEL - -/* Define to 1 if you have __builtin___clear_cache */ -#undef HAVE_BUILTIN_CLEAR_CACHE - -/* Define to 1 if you have the `clnttcp_create' function. */ -#undef HAVE_CLNTTCP_CREATE - -/* Define to 1 if you have the `clone3' function. */ -#undef HAVE_CLONE3 - -/* Define to 1 if you have the `copy_file_range' function. */ -#undef HAVE_COPY_FILE_RANGE - -/* Define to 1 if you have the `daemon' function. */ -#undef HAVE_DAEMON - -/* Define to 1 if you have the declaration of `IFLA_NET_NS_PID', and to 0 if - you don't. */ -#undef HAVE_DECL_IFLA_NET_NS_PID - -/* Define to 1 if you have the declaration of `MADV_MERGEABLE', and to 0 if - you don't. */ -#undef HAVE_DECL_MADV_MERGEABLE - -/* Define to 1 if you have the declaration of `PR_CAPBSET_DROP', and to 0 if - you don't. */ -#undef HAVE_DECL_PR_CAPBSET_DROP - -/* Define to 1 if you have the declaration of `PR_CAPBSET_READ', and to 0 if - you don't. */ -#undef HAVE_DECL_PR_CAPBSET_READ - -/* Define to 1 if you have the declaration of `PTRACE_GETSIGINFO', and to 0 if - you don't. */ -#undef HAVE_DECL_PTRACE_GETSIGINFO - -/* Define to 1 if you have the declaration of `PTRACE_O_TRACEVFORKDONE', and - to 0 if you don't. */ -#undef HAVE_DECL_PTRACE_O_TRACEVFORKDONE - -/* Define to 1 if you have the declaration of `PTRACE_SETOPTIONS', and to 0 if - you don't. */ -#undef HAVE_DECL_PTRACE_SETOPTIONS - -/* Define to 1 if the system has the type `enum kcmp_type'. */ -#undef HAVE_ENUM_KCMP_TYPE - -/* Define to 1 if you have the `epoll_pwait' function. */ -#undef HAVE_EPOLL_PWAIT - -/* Define to 1 if you have the `execveat' function. */ -#undef HAVE_EXECVEAT - -/* Define to 1 if you have the `fallocate' function. */ -#undef HAVE_FALLOCATE - -/* Define to 1 if you have the `fchownat' function. */ -#undef HAVE_FCHOWNAT - -/* Define to 1 if you have the `fork' function. */ -#undef HAVE_FORK - -/* Define to 1 if you have the `fsconfig' function. */ -#undef HAVE_FSCONFIG - -/* Define to 1 if you have the `fsmount' function. */ -#undef HAVE_FSMOUNT - -/* Define to 1 if you have the `fsopen' function. */ -#undef HAVE_FSOPEN - -/* Define to 1 if you have the `fspick' function. */ -#undef HAVE_FSPICK - -/* Define to 1 if you have the `fstatat' function. */ -#undef HAVE_FSTATAT - -/* Define to 1 if you have the header file. */ -#undef HAVE_FTS_H - -/* Define to 1 if you have the `getauxval' function. */ -#undef HAVE_GETAUXVAL - -/* Define to 1 if you have the `getdents' function. */ -#undef HAVE_GETDENTS - -/* Define to 1 if you have the `getdents64' function. */ -#undef HAVE_GETDENTS64 - -/* Define to 1 if you have the header file. */ -#undef HAVE_IFADDRS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `io_pgetevents' function. */ -#undef HAVE_IO_PGETEVENTS - -/* Define to 1 if you have `io_set_eventfd' function. */ -#undef HAVE_IO_SET_EVENTFD - -/* Define to 1 if you have the `io_uring_enter' function. */ -#undef HAVE_IO_URING_ENTER - -/* Define to 1 if you have the `io_uring_register' function. */ -#undef HAVE_IO_URING_REGISTER - -/* Define to 1 if you have the `io_uring_setup' function. */ -#undef HAVE_IO_URING_SETUP - -/* Define to 1 if you have the `kcmp' function. */ -#undef HAVE_KCMP - -/* Define to 1 if you have the header file. */ -#undef HAVE_KEYUTILS_H - -/* Define to 1 if you have libacl and it's headers installed */ -#undef HAVE_LIBACL - -/* Define to 1 if you have libaio and it's headers installed. */ -#undef HAVE_LIBAIO - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBAIO_H - -/* Define to 1 if you have libcap-2 installed. */ -#undef HAVE_LIBCAP - -/* Define whether libcrypto and openssl headers are installed */ -#undef HAVE_LIBCRYPTO - -/* Define to 1 if you have libkeyutils installed. */ -#undef HAVE_LIBKEYUTILS - -/* Define to 1 if you have libmnl library and headers */ -#undef HAVE_LIBMNL - -/* Define to 1 if you have both SELinux libraries and headers. */ -#undef HAVE_LIBSELINUX_DEVEL - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_CAN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_CGROUPSTATS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_CRYPTOUSER_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_DCCP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_FS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_GENETLINK_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_IF_ALG_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_IF_ETHER_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_IF_PACKET_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_KEYCTL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_MEMPOLICY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_MODULE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_NETLINK_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_PTRACE_H - -/* Define to 1 if having a valid linux/random.h */ -#undef HAVE_LINUX_RANDOM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_SECCOMP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_SECUREBITS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_SIGNALFD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_TASKSTATS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_TTY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_USERFAULTFD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `mkdirat' function. */ -#undef HAVE_MKDIRAT - -/* Define to 1 if you have the `mkdtemp' function. */ -#undef HAVE_MKDTEMP - -/* Define to 1 if you have the `mknodat' function. */ -#undef HAVE_MKNODAT - -/* Define to 1 if you have the header file. */ -#undef HAVE_MM_H - -/* Define to 1 if you have the `modify_ldt' function. */ -#undef HAVE_MODIFY_LDT - -/* Define to 1 if you have the `move_mount' function. */ -#undef HAVE_MOVE_MOUNT - -/* Define to 1 if you have MREMAP_FIXED in . */ -#undef HAVE_MREMAP_FIXED - -/* Define to 1 if you have the `name_to_handle_at' function. */ -#undef HAVE_NAME_TO_HANDLE_AT - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_SCTP_H - -/* Define to 1 if you have newer libcap-2 installed. */ -#undef HAVE_NEWER_LIBCAP - -/* Define to 1 if you have the header file. */ -#undef HAVE_NUMAIF_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NUMA_H - -/* Define to 1 if you have libnuma and it's headers version >= 2 installed. */ -#undef HAVE_NUMA_V2 - -/* Define to 1 if you have the `openat' function. */ -#undef HAVE_OPENAT - -/* Define to 1 if you have the `openat2' function. */ -#undef HAVE_OPENAT2 - -/* Define to 1 if you have the header file. */ -#undef HAVE_OPENSSL_SHA_H - -/* Define to 1 if you have the `open_tree' function. */ -#undef HAVE_OPEN_TREE - -/* Define to 1 if you have struct perf_event_attr */ -#undef HAVE_PERF_EVENT_ATTR - -/* Define to 1 if you have the `pidfd_open' function. */ -#undef HAVE_PIDFD_OPEN - -/* Define to 1 if you have the `pidfd_send_signal' function. */ -#undef HAVE_PIDFD_SEND_SIGNAL - -/* Define to 1 if you have the `pkey_mprotect' function. */ -#undef HAVE_PKEY_MPROTECT - -/* Define to 1 if you have the `preadv' function. */ -#undef HAVE_PREADV - -/* Define to 1 if you have the `preadv2' function. */ -#undef HAVE_PREADV2 - -/* Define to 1 if you have the `profil' function. */ -#undef HAVE_PROFIL - -/* Define to 1 if you have the header file. */ -#undef HAVE_PTHREAD_H - -/* Define to 1 if you have the `pwritev' function. */ -#undef HAVE_PWRITEV - -/* Define to 1 if you have the `pwritev2' function. */ -#undef HAVE_PWRITEV2 - -/* Define to 1 if you have the `readlinkat' function. */ -#undef HAVE_READLINKAT - -/* Define to 1 if you have the `recvmmsg' function. */ -#undef HAVE_RECVMMSG - -/* Define to 1 if you have the `renameat' function. */ -#undef HAVE_RENAMEAT - -/* Define to 1 if you have the `renameat2' function. */ -#undef HAVE_RENAMEAT2 - -/* Define to 1 if you have the `sched_getcpu' function. */ -#undef HAVE_SCHED_GETCPU - -/* Define to 1 if you have the header file. */ -#undef HAVE_SELINUX_SELINUX_H - -/* Define to 1 if you have the `sendmmsg' function. */ -#undef HAVE_SENDMMSG - -/* Define to 1 if you have the `setns' function. */ -#undef HAVE_SETNS - -/* Define to 1 if you have the `signalfd' function. */ -#undef HAVE_SIGNALFD - -/* Define to 1 if you have the `sigpending' function. */ -#undef HAVE_SIGPENDING - -/* Define to 1 if you have the `splice' function. */ -#undef HAVE_SPLICE - -/* Define to 1 if you have the `statx' function. */ -#undef HAVE_STATX - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `stime' function. */ -#undef HAVE_STIME - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if the system has the type `struct acct_v3'. */ -#undef HAVE_STRUCT_ACCT_V3 - -/* Define to 1 if the system has the type `struct fanotify_event_info_fid'. */ -#undef HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID - -/* Define to 1 if `fsid.__val' is a member of `struct - fanotify_event_info_fid'. */ -#undef HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID_FSID___VAL - -/* Define to 1 if the system has the type `struct fanotify_event_info_header'. - */ -#undef HAVE_STRUCT_FANOTIFY_EVENT_INFO_HEADER - -/* Define to 1 if the system has the type `struct file_dedupe_range'. */ -#undef HAVE_STRUCT_FILE_DEDUPE_RANGE - -/* Define to 1 if the system has the type `struct fs_quota_statv'. */ -#undef HAVE_STRUCT_FS_QUOTA_STATV - -/* Define to 1 if you have struct f_owner_ex */ -#undef HAVE_STRUCT_F_OWNER_EX - -/* Define to 1 if the system has the type `struct if_nextdqblk'. */ -#undef HAVE_STRUCT_IF_NEXTDQBLK - -/* Define to 1 if the system has the type `struct iovec'. */ -#undef HAVE_STRUCT_IOVEC - -/* Define to 1 if the system has the type `struct ipc64_perm'. */ -#undef HAVE_STRUCT_IPC64_PERM - -/* Define to 1 if the system has the type `struct loop_config'. */ -#undef HAVE_STRUCT_LOOP_CONFIG - -/* Define to 1 if the system has the type `struct mmsghdr'. */ -#undef HAVE_STRUCT_MMSGHDR - -/* Define to 1 if the system has the type `struct modify_ldt_ldt_s'. */ -#undef HAVE_STRUCT_MODIFY_LDT_LDT_S - -/* Define to 1 if the system has the type `struct msqid64_ds'. */ -#undef HAVE_STRUCT_MSQID64_DS - -/* Define to 1 if `aux_head' is a member of `struct perf_event_mmap_page'. */ -#undef HAVE_STRUCT_PERF_EVENT_MMAP_PAGE_AUX_HEAD - -/* Define to 1 if the system has the type `struct ptrace_peeksiginfo_args'. */ -#undef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS - -/* Define to 1 if the system has the type `struct pt_regs'. */ -#undef HAVE_STRUCT_PT_REGS - -/* Define to 1 if the system has the type `struct rlimit64'. */ -#undef HAVE_STRUCT_RLIMIT64 - -/* Define to 1 if the system has the type `struct semid64_ds'. */ -#undef HAVE_STRUCT_SEMID64_DS - -/* Define to 1 if the system has the type `struct shmid64_ds'. */ -#undef HAVE_STRUCT_SHMID64_DS - -/* Define to 1 if `sa_sigaction' is a member of `struct sigaction'. */ -#undef HAVE_STRUCT_SIGACTION_SA_SIGACTION - -/* Define to 1 if `ssi_signo' is a member of `struct signalfd_siginfo'. */ -#undef HAVE_STRUCT_SIGNALFD_SIGINFO_SSI_SIGNO - -/* Define to 1 if the system has the type `struct statx'. */ -#undef HAVE_STRUCT_STATX - -/* Define to 1 if the system has the type `struct statx_timestamp'. */ -#undef HAVE_STRUCT_STATX_TIMESTAMP - -/* Define to 1 if `freepages_count' is a member of `struct taskstats'. */ -#undef HAVE_STRUCT_TASKSTATS_FREEPAGES_COUNT - -/* Define to 1 if `nvcsw' is a member of `struct taskstats'. */ -#undef HAVE_STRUCT_TASKSTATS_NVCSW - -/* Define to 1 if `read_bytes' is a member of `struct taskstats'. */ -#undef HAVE_STRUCT_TASKSTATS_READ_BYTES - -/* Define to 1 if the system has the type `struct termio'. */ -#undef HAVE_STRUCT_TERMIO - -/* Define to 1 if the system has the type `struct tpacket_req3'. */ -#undef HAVE_STRUCT_TPACKET_REQ3 - -/* Define to 1 if the system has the type `struct user_desc'. */ -#undef HAVE_STRUCT_USER_DESC - -/* Define to 1 if the system has the type `struct user_regs_struct'. */ -#undef HAVE_STRUCT_USER_REGS_STRUCT - -/* Define to 1 if `domainname' is a member of `struct utsname'. */ -#undef HAVE_STRUCT_UTSNAME_DOMAINNAME - -/* Define to 1 if the system has the type `struct xt_entry_match'. */ -#undef HAVE_STRUCT_XT_ENTRY_MATCH - -/* Define to 1 if the system has the type `struct xt_entry_target'. */ -#undef HAVE_STRUCT_XT_ENTRY_TARGET - -/* Define to 1 if you have the `syncfs' function. */ -#undef HAVE_SYNCFS - -/* Define to 1 if you have __sync_add_and_fetch */ -#undef HAVE_SYNC_ADD_AND_FETCH - -/* Define to 1 if you have the `sync_file_range' function. */ -#undef HAVE_SYNC_FILE_RANGE - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_ACL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_CAPABILITY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_EPOLL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_FANOTIFY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_INOTIFY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PRCTL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PTRACE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_REG_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SHM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SIGNALFD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIMERFD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_USTAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_UTSNAME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_XATTR_H - -/* Define to 1 if you have the `tee' function. */ -#undef HAVE_TEE - -/* Define to 1 if you have the `timerfd_create' function. */ -#undef HAVE_TIMERFD_CREATE - -/* Define to 1 if you have the `timerfd_gettime' function. */ -#undef HAVE_TIMERFD_GETTIME - -/* Define to 1 if you have the `timerfd_settime' function. */ -#undef HAVE_TIMERFD_SETTIME - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `unshare' function. */ -#undef HAVE_UNSHARE - -/* Define to 1 if you have the `ustat' function. */ -#undef HAVE_USTAT - -/* Define to 1 if you have utimensat(2) */ -#undef HAVE_UTIMENSAT - -/* Define to 1 if you have the `vfork' function. */ -#undef HAVE_VFORK - -/* Define to 1 if you have the `vmsplice' function. */ -#undef HAVE_VMSPLICE - -/* Define to 1 if you have the `xdr_char' function. */ -#undef HAVE_XDR_CHAR - -/* Define to 1 if you have the header file. */ -#undef HAVE_XFS_XQM_H - -/* Error message when no NUMA support */ -#undef NUMA_ERROR_MSG - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Target is running Linux w/out an MMU */ -#undef UCLINUX - -/* Version number of package */ -#undef VERSION - -/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a - `char[]'. */ -#undef YYTEXT_POINTER diff --git a/fsstress/include/ipcmsg.h b/fsstress/include/ipcmsg.h deleted file mode 100644 index d89894b726..0000000000 --- a/fsstress/include/ipcmsg.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * ipcmsg.h - common definitions for the IPC message tests. - */ - -#ifndef __IPCMSG_H -#define __IPCMSG_H 1 - -#include -#include -#include -#include - -#include "test.h" - -void cleanup(void); -void setup(void); - -#define MSG_RD 0400 /* read permission for the queue */ -#define MSG_WR 0200 /* write permission for the queue */ -#define MSG_RW MSG_RD | MSG_WR - -#define MSGSIZE 1024 /* a resonable size for a message */ -#define MSGTYPE 1 /* a type ID for a message */ - -#define NR_MSGQUEUES 16 /* MSGMNI as defined in linux/msg.h */ - -#define min(a, b) (((a) < (b)) ? (a) : (b)) - -typedef struct mbuf { /* a generic message structure */ - long mtype; - char mtext[MSGSIZE + 1]; /* add 1 here so the message can be 1024 */ -} MSGBUF; /* characters long with a '\0' termination */ - -#ifdef LIBIPC -key_t msgkey; /* the ftok() generated message key */ -#else -extern key_t msgkey; /* the ftok() generated message key */ -#endif - -void init_buf(MSGBUF *, int, int); -void rm_queue(int); - -key_t getipckey(); -int getuserid(char *); - -int get_max_msgqueues(void); -int get_used_msgqueues(void); - -#endif /* ipcmsg.h */ diff --git a/fsstress/include/ipcsem.h b/fsstress/include/ipcsem.h deleted file mode 100644 index 6a37672a74..0000000000 --- a/fsstress/include/ipcsem.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * ipcsem.h - common definitions for the IPC semaphore tests - */ - -#ifndef __IPCSEM_H -#define __IPCSEM_H - -#include -#include -#include - -#include "test.h" -#include "lapi/semun.h" - -void cleanup(void); -void setup(void); - -#define SEM_RD 0400 -#define SEM_ALT 0200 -#define SEM_RA SEM_RD | SEM_ALT - -#define PSEMS 10 /* a reasonable value for the number of */ - /* "primitive semaphores" per ID */ - -#ifdef LIBIPC -key_t semkey; /* an IPC key generated by ftok() */ -#else -extern key_t semkey; /* an IPC key generated by ftok() */ -#endif - -void rm_sema(int sem_id); - -int getipckey(); -int getuserid(char *); - -#endif /* ipcsem.h */ diff --git a/fsstress/include/ipcshm.h b/fsstress/include/ipcshm.h deleted file mode 100644 index 08307d4ab9..0000000000 --- a/fsstress/include/ipcshm.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * 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 - */ - -/* - * ipcshm.h - common definitions for the IPC shared memory tests - */ - -#ifndef __IPCSHM_H -#define __IPCSHM_H - -#include -#include -#include -#include - -#include "test.h" - -void cleanup(void); -void setup(void); - -#define SHM_RD 0400 -#define SHM_WR 0200 -#define SHM_RW SHM_RD | SHM_WR - -#define SHM_SIZE 2048 /* a resonable size for a memory segment */ -#define INT_SIZE 4 /* instead of sizeof(int) */ - -#define MODE_MASK 0x01FF /* to get the lower nine permission bits */ - /* from shmid_ds.ipc_perm.mode */ - -key_t shmkey; /* an IPC key generated by ftok() */ - -void rm_shm(int shm_id); - -int getipckey(); -int getuserid(char*); - -#endif /* ipcshm.h */ diff --git a/fsstress/include/lapi/.gitignore b/fsstress/include/lapi/.gitignore deleted file mode 100644 index 9867b3f254..0000000000 --- a/fsstress/include/lapi/.gitignore +++ /dev/null @@ -1 +0,0 @@ -syscalls.h diff --git a/fsstress/include/lapi/abisize.h b/fsstress/include/lapi/abisize.h deleted file mode 100644 index 9e6622ca16..0000000000 --- a/fsstress/include/lapi/abisize.h +++ /dev/null @@ -1,31 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2014-2019 Linux Test Project - * Cyril Hrubis - * Petr Vorel - */ - -#ifndef ABISIZE_H__ -#define ABISIZE_H__ - -/* __WORDSIZE replacement */ -#if defined(__LP64__) || defined(_LP64) -# define TST_ABI64 -# define TST_ABI 64 -#else -# define TST_ABI32 -# define TST_ABI 32 -#endif - -/* - * Determines if we have to split up 64 bit arguments or not - * - * Deals with 32bit ABIs that have 64bit syscalls - */ -#define LTP_USE_64_ABI \ - (defined(__mips__) && _MIPS_SIM == _ABIN32) || \ - (defined(__x86_64__) && defined(__ILP32__)) || \ - (defined(__aarch64__) && defined(__ILP32__)) || \ - defined(TST_ABI64) - -#endif /* ABISIZE_H__ */ diff --git a/fsstress/include/lapi/acct.h b/fsstress/include/lapi/acct.h deleted file mode 100644 index c81b78b442..0000000000 --- a/fsstress/include/lapi/acct.h +++ /dev/null @@ -1,74 +0,0 @@ -//SPDX-License-Identifier: GPL-2.0-or-later - -#ifndef LAPI_ACCT_H -#define LAPI_ACCT_H - -#include -#include "config.h" - -#ifdef HAVE_STRUCT_ACCT_V3 -#include -#else - -#define ACCT_COMM 16 - -typedef uint16_t comp_t; - -/* Fallback structures to parse the process accounting file */ -struct acct { - char ac_flag; - uint16_t ac_uid; - uint16_t ac_gid; - uint16_t ac_tty; - uint32_t ac_btime; - comp_t ac_utime; - comp_t ac_stime; - comp_t ac_etime; - comp_t ac_mem; - comp_t ac_io; - comp_t ac_rw; - comp_t ac_minflt; - comp_t ac_majflt; - comp_t ac_swaps; - uint32_t ac_exitcode; - char ac_comm[ACCT_COMM+1]; - char ac_pad[10]; -}; - -struct acct_v3 { - char ac_flag; - char ac_version; - uint16_t ac_tty; - uint32_t ac_exitcode; - uint32_t ac_uid; - uint32_t ac_gid; - uint32_t ac_pid; - uint32_t ac_ppid; - uint32_t ac_btime; - float ac_etime; - comp_t ac_utime; - comp_t ac_stime; - comp_t ac_mem; - comp_t ac_io; - comp_t ac_rw; - comp_t ac_minflt; - comp_t ac_majflt; - comp_t ac_swaps; - char ac_comm[ACCT_COMM]; -}; - -/* Possible values for the ac_flag member */ -enum { - AFORK = 0x01, - ASU = 0x02, - ACORE = 0x08, - AXSIG = 0x10 -}; -# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ -# define ACCT_BYTEORDER 0x80 -# elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -# define ACCT_BYTEORDER 0x00 -# endif -#endif /* HAVE_STRUCT_ACCT_V3 */ - -#endif /* LAPI_ACCT_H */ diff --git a/fsstress/include/lapi/bpf.h b/fsstress/include/lapi/bpf.h deleted file mode 100644 index 22b13b47ba..0000000000 --- a/fsstress/include/lapi/bpf.h +++ /dev/null @@ -1,567 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2019 Richard Palethorpe - * - * Essential Extended Berkeley Packet Filter (eBPF) headers - * - * Mostly copied/adapted from linux/bpf.h and libbpf so that we can perform - * some eBPF testing without any external dependencies. - */ - -#ifndef BPF_H -# define BPF_H - -#include - -#include "lapi/syscalls.h" - -/* Start copy from linux/bpf_(common).h */ -#define BPF_CLASS(code) ((code) & 0x07) -#define BPF_LD 0x00 -#define BPF_LDX 0x01 -#define BPF_ST 0x02 -#define BPF_STX 0x03 -#define BPF_ALU 0x04 -#define BPF_JMP 0x05 - -#define BPF_JNE 0x50 /* jump != */ - -#define BPF_SIZE(code) ((code) & 0x18) -#define BPF_W 0x00 /* 32-bit */ -#define BPF_DW 0x18 /* double word (64-bit) */ - -#define BPF_MODE(code) ((code) & 0xe0) -#define BPF_IMM 0x00 -#define BPF_MEM 0x60 - -#define BPF_OP(code) ((code) & 0xf0) -#define BPF_ADD 0x00 -#define BPF_SUB 0x10 -#define BPF_LSH 0x60 -#define BPF_RSH 0x70 - -#define BPF_JEQ 0x10 - -#define BPF_SRC(code) ((code) & 0x08) -#define BPF_K 0x00 -#define BPF_X 0x08 - -#define BPF_ALU64 0x07 /* alu mode in double word width */ -#define BPF_MOV 0xb0 /* mov reg to reg */ -#define BPF_CALL 0x80 /* function call */ -#define BPF_EXIT 0x90 /* function return */ - -/* Register numbers */ -enum { - BPF_REG_0 = 0, - BPF_REG_1, - BPF_REG_2, - BPF_REG_3, - BPF_REG_4, - BPF_REG_5, - BPF_REG_6, - BPF_REG_7, - BPF_REG_8, - BPF_REG_9, - BPF_REG_10, - MAX_BPF_REG, -}; - -struct bpf_insn { - uint8_t code; /* opcode */ - uint8_t dst_reg:4; /* dest register */ - uint8_t src_reg:4; /* source register */ - int16_t off; /* signed offset */ - int32_t imm; /* signed immediate constant */ -}; - -enum bpf_cmd { - BPF_MAP_CREATE, - BPF_MAP_LOOKUP_ELEM, - BPF_MAP_UPDATE_ELEM, - BPF_MAP_DELETE_ELEM, - BPF_MAP_GET_NEXT_KEY, - BPF_PROG_LOAD, - BPF_OBJ_PIN, - BPF_OBJ_GET, - BPF_PROG_ATTACH, - BPF_PROG_DETACH, - BPF_PROG_TEST_RUN, - BPF_PROG_GET_NEXT_ID, - BPF_MAP_GET_NEXT_ID, - BPF_PROG_GET_FD_BY_ID, - BPF_MAP_GET_FD_BY_ID, - BPF_OBJ_GET_INFO_BY_FD, - BPF_PROG_QUERY, - BPF_RAW_TRACEPOINT_OPEN, - BPF_BTF_LOAD, - BPF_BTF_GET_FD_BY_ID, - BPF_TASK_FD_QUERY, - BPF_MAP_LOOKUP_AND_DELETE_ELEM, - BPF_MAP_FREEZE, -}; - -enum bpf_map_type { - BPF_MAP_TYPE_UNSPEC, - BPF_MAP_TYPE_HASH, - BPF_MAP_TYPE_ARRAY, - BPF_MAP_TYPE_PROG_ARRAY, - BPF_MAP_TYPE_PERF_EVENT_ARRAY, - BPF_MAP_TYPE_PERCPU_HASH, - BPF_MAP_TYPE_PERCPU_ARRAY, - BPF_MAP_TYPE_STACK_TRACE, - BPF_MAP_TYPE_CGROUP_ARRAY, - BPF_MAP_TYPE_LRU_HASH, - BPF_MAP_TYPE_LRU_PERCPU_HASH, - BPF_MAP_TYPE_LPM_TRIE, - BPF_MAP_TYPE_ARRAY_OF_MAPS, - BPF_MAP_TYPE_HASH_OF_MAPS, - BPF_MAP_TYPE_DEVMAP, - BPF_MAP_TYPE_SOCKMAP, - BPF_MAP_TYPE_CPUMAP, - BPF_MAP_TYPE_XSKMAP, - BPF_MAP_TYPE_SOCKHASH, - BPF_MAP_TYPE_CGROUP_STORAGE, - BPF_MAP_TYPE_REUSEPORT_SOCKARRAY, - BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE, - BPF_MAP_TYPE_QUEUE, - BPF_MAP_TYPE_STACK, - BPF_MAP_TYPE_SK_STORAGE, -}; - -enum bpf_prog_type { - BPF_PROG_TYPE_UNSPEC, - BPF_PROG_TYPE_SOCKET_FILTER, - BPF_PROG_TYPE_KPROBE, - BPF_PROG_TYPE_SCHED_CLS, - BPF_PROG_TYPE_SCHED_ACT, - BPF_PROG_TYPE_TRACEPOINT, - BPF_PROG_TYPE_XDP, - BPF_PROG_TYPE_PERF_EVENT, - BPF_PROG_TYPE_CGROUP_SKB, - BPF_PROG_TYPE_CGROUP_SOCK, - BPF_PROG_TYPE_LWT_IN, - BPF_PROG_TYPE_LWT_OUT, - BPF_PROG_TYPE_LWT_XMIT, - BPF_PROG_TYPE_SOCK_OPS, - BPF_PROG_TYPE_SK_SKB, - BPF_PROG_TYPE_CGROUP_DEVICE, - BPF_PROG_TYPE_SK_MSG, - BPF_PROG_TYPE_RAW_TRACEPOINT, - BPF_PROG_TYPE_CGROUP_SOCK_ADDR, - BPF_PROG_TYPE_LWT_SEG6LOCAL, - BPF_PROG_TYPE_LIRC_MODE2, - BPF_PROG_TYPE_SK_REUSEPORT, - BPF_PROG_TYPE_FLOW_DISSECTOR, - BPF_PROG_TYPE_CGROUP_SYSCTL, - BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, - BPF_PROG_TYPE_CGROUP_SOCKOPT, -}; - -#define BPF_PSEUDO_MAP_FD 1 - -#define BPF_OBJ_NAME_LEN 16U - -#define BPF_ANY 0 /* create new element or update existing */ -#define BPF_NOEXIST 1 /* create new element if it didn't exist */ -#define BPF_EXIST 2 /* update existing element */ -#define BPF_F_LOCK 4 /* spin_lock-ed map_lookup/map_update */ - -#define aligned_uint64_t uint64_t __attribute__((aligned(8))) - -union bpf_attr { - struct { /* anonymous struct used by BPF_MAP_CREATE command */ - uint32_t map_type; /* one of enum bpf_map_type */ - uint32_t key_size; /* size of key in bytes */ - uint32_t value_size; /* size of value in bytes */ - uint32_t max_entries; /* max number of entries in a map */ - uint32_t map_flags; /* BPF_MAP_CREATE related - * flags defined above. - */ - uint32_t inner_map_fd; /* fd pointing to the inner map */ - uint32_t numa_node; /* numa node (effective only if - * BPF_F_NUMA_NODE is set). - */ - char map_name[BPF_OBJ_NAME_LEN]; - uint32_t map_ifindex; /* ifindex of netdev to create on */ - uint32_t btf_fd; /* fd pointing to a BTF type data */ - uint32_t btf_key_type_id; /* BTF type_id of the key */ - uint32_t btf_value_type_id; /* BTF type_id of the value */ - }; - - struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */ - uint32_t map_fd; - aligned_uint64_t key; - union { - aligned_uint64_t value; - aligned_uint64_t next_key; - }; - uint64_t flags; - }; - - struct { /* anonymous struct used by BPF_PROG_LOAD command */ - uint32_t prog_type; /* one of enum bpf_prog_type */ - uint32_t insn_cnt; - aligned_uint64_t insns; - aligned_uint64_t license; - uint32_t log_level; /* verbosity level of verifier */ - uint32_t log_size; /* size of user buffer */ - aligned_uint64_t log_buf; /* user supplied buffer */ - uint32_t kern_version; /* not used */ - uint32_t prog_flags; - char prog_name[BPF_OBJ_NAME_LEN]; - uint32_t prog_ifindex; /* ifindex of netdev to prep for */ - /* For some prog types expected attach type must be known at - * load time to verify attach type specific parts of prog - * (context accesses, allowed helpers, etc). - */ - uint32_t expected_attach_type; - uint32_t prog_btf_fd; /* fd pointing to BTF type data */ - uint32_t func_info_rec_size; /* userspace bpf_func_info size */ - aligned_uint64_t func_info; /* func info */ - uint32_t func_info_cnt; /* number of bpf_func_info records */ - uint32_t line_info_rec_size; /* userspace bpf_line_info size */ - aligned_uint64_t line_info; /* line info */ - uint32_t line_info_cnt; /* number of bpf_line_info records */ - }; - - struct { /* anonymous struct used by BPF_OBJ_* commands */ - aligned_uint64_t pathname; - uint32_t bpf_fd; - uint32_t file_flags; - }; - - struct { /* anonymous struct used by BPF_PROG_ATTACH/DETACH commands */ - uint32_t target_fd; /* container object to attach to */ - uint32_t attach_bpf_fd; /* eBPF program to attach */ - uint32_t attach_type; - uint32_t attach_flags; - }; - - struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */ - uint32_t prog_fd; - uint32_t retval; - uint32_t data_size_in; /* input: len of data_in */ - uint32_t data_size_out; /* input/output: len of data_out - * returns ENOSPC if data_out - * is too small. - */ - aligned_uint64_t data_in; - aligned_uint64_t data_out; - uint32_t repeat; - uint32_t duration; - uint32_t ctx_size_in; /* input: len of ctx_in */ - uint32_t ctx_size_out; /* input/output: len of ctx_out - * returns ENOSPC if ctx_out - * is too small. - */ - aligned_uint64_t ctx_in; - aligned_uint64_t ctx_out; - } test; - - struct { /* anonymous struct used by BPF_*_GET_*_ID */ - union { - uint32_t start_id; - uint32_t prog_id; - uint32_t map_id; - uint32_t btf_id; - }; - uint32_t next_id; - uint32_t open_flags; - }; - - struct { /* anonymous struct used by BPF_OBJ_GET_INFO_BY_FD */ - uint32_t bpf_fd; - uint32_t info_len; - aligned_uint64_t info; - } info; - - struct { /* anonymous struct used by BPF_PROG_QUERY command */ - uint32_t target_fd; /* container object to query */ - uint32_t attach_type; - uint32_t query_flags; - uint32_t attach_flags; - aligned_uint64_t prog_ids; - uint32_t prog_cnt; - } query; - - struct { - uint64_t name; - uint32_t prog_fd; - } raw_tracepoint; - - struct { /* anonymous struct for BPF_BTF_LOAD */ - aligned_uint64_t btf; - aligned_uint64_t btf_log_buf; - uint32_t btf_size; - uint32_t btf_log_size; - uint32_t btf_log_level; - }; - - struct { - uint32_t pid; /* input: pid */ - uint32_t fd; /* input: fd */ - uint32_t flags; /* input: flags */ - uint32_t buf_len; /* input/output: buf len */ - aligned_uint64_t buf; /* input/output: - * tp_name for tracepoint - * symbol for kprobe - * filename for uprobe - */ - uint32_t prog_id; /* output: prod_id */ - uint32_t fd_type; /* output: BPF_FD_TYPE_* */ - uint64_t probe_offset; /* output: probe_offset */ - uint64_t probe_addr; /* output: probe_addr */ - } task_fd_query; -} __attribute__((aligned(8))); - -#define __BPF_FUNC_MAPPER(FN) \ - FN(unspec), \ - FN(map_lookup_elem), \ - FN(map_update_elem), \ - FN(map_delete_elem), \ - FN(probe_read), \ - FN(ktime_get_ns), \ - FN(trace_printk), \ - FN(get_prandom_u32), \ - FN(get_smp_processor_id), \ - FN(skb_store_bytes), \ - FN(l3_csum_replace), \ - FN(l4_csum_replace), \ - FN(tail_call), \ - FN(clone_redirect), \ - FN(get_current_pid_tgid), \ - FN(get_current_uid_gid), \ - FN(get_current_comm), \ - FN(get_cgroup_classid), \ - FN(skb_vlan_push), \ - FN(skb_vlan_pop), \ - FN(skb_get_tunnel_key), \ - FN(skb_set_tunnel_key), \ - FN(perf_event_read), \ - FN(redirect), \ - FN(get_route_realm), \ - FN(perf_event_output), \ - FN(skb_load_bytes), \ - FN(get_stackid), \ - FN(csum_diff), \ - FN(skb_get_tunnel_opt), \ - FN(skb_set_tunnel_opt), \ - FN(skb_change_proto), \ - FN(skb_change_type), \ - FN(skb_under_cgroup), \ - FN(get_hash_recalc), \ - FN(get_current_task), \ - FN(probe_write_user), \ - FN(current_task_under_cgroup), \ - FN(skb_change_tail), \ - FN(skb_pull_data), \ - FN(csum_update), \ - FN(set_hash_invalid), \ - FN(get_numa_node_id), \ - FN(skb_change_head), \ - FN(xdp_adjust_head), \ - FN(probe_read_str), \ - FN(get_socket_cookie), \ - FN(get_socket_uid), \ - FN(set_hash), \ - FN(setsockopt), \ - FN(skb_adjust_room), \ - FN(redirect_map), \ - FN(sk_redirect_map), \ - FN(sock_map_update), \ - FN(xdp_adjust_meta), \ - FN(perf_event_read_value), \ - FN(perf_prog_read_value), \ - FN(getsockopt), \ - FN(override_return), \ - FN(sock_ops_cb_flags_set), \ - FN(msg_redirect_map), \ - FN(msg_apply_bytes), \ - FN(msg_cork_bytes), \ - FN(msg_pull_data), \ - FN(bind), \ - FN(xdp_adjust_tail), \ - FN(skb_get_xfrm_state), \ - FN(get_stack), \ - FN(skb_load_bytes_relative), \ - FN(fib_lookup), \ - FN(sock_hash_update), \ - FN(msg_redirect_hash), \ - FN(sk_redirect_hash), \ - FN(lwt_push_encap), \ - FN(lwt_seg6_store_bytes), \ - FN(lwt_seg6_adjust_srh), \ - FN(lwt_seg6_action), \ - FN(rc_repeat), \ - FN(rc_keydown), \ - FN(skb_cgroup_id), \ - FN(get_current_cgroup_id), \ - FN(get_local_storage), \ - FN(sk_select_reuseport), \ - FN(skb_ancestor_cgroup_id), \ - FN(sk_lookup_tcp), \ - FN(sk_lookup_udp), \ - FN(sk_release), \ - FN(map_push_elem), \ - FN(map_pop_elem), \ - FN(map_peek_elem), \ - FN(msg_push_data), \ - FN(msg_pop_data), \ - FN(rc_pointer_rel), \ - FN(spin_lock), \ - FN(spin_unlock), \ - FN(sk_fullsock), \ - FN(tcp_sock), \ - FN(skb_ecn_set_ce), \ - FN(get_listener_sock), \ - FN(skc_lookup_tcp), \ - FN(tcp_check_syncookie), \ - FN(sysctl_get_name), \ - FN(sysctl_get_current_value), \ - FN(sysctl_get_new_value), \ - FN(sysctl_set_new_value), \ - FN(strtol), \ - FN(strtoul), \ - FN(sk_storage_get), \ - FN(sk_storage_delete), \ - FN(send_signal), - -/* integer value in 'imm' field of BPF_CALL instruction selects which helper - * function eBPF program intends to call - */ -#define __BPF_ENUM_FN(x) BPF_FUNC_ ## x -enum bpf_func_id { - __BPF_FUNC_MAPPER(__BPF_ENUM_FN) - __BPF_FUNC_MAX_ID, -}; -#undef __BPF_ENUM_FN - -/* End copy from linux/bpf.h */ - -/* Start copy from tools/include/filter.h */ - -#define BPF_ALU64_REG(OP, DST, SRC) \ - ((struct bpf_insn) { \ - .code = BPF_ALU64 | BPF_OP(OP) | BPF_X, \ - .dst_reg = DST, \ - .src_reg = SRC, \ - .off = 0, \ - .imm = 0 }) - -#define BPF_ALU64_IMM(OP, DST, IMM) \ - ((struct bpf_insn) { \ - .code = BPF_ALU64 | BPF_OP(OP) | BPF_K, \ - .dst_reg = DST, \ - .src_reg = 0, \ - .off = 0, \ - .imm = IMM }) - -#define BPF_MOV64_REG(DST, SRC) \ - ((struct bpf_insn) { \ - .code = BPF_ALU64 | BPF_MOV | BPF_X, \ - .dst_reg = DST, \ - .src_reg = SRC, \ - .off = 0, \ - .imm = 0 }) - -#define BPF_LD_IMM64(DST, IMM) \ - BPF_LD_IMM64_RAW(DST, 0, IMM) - -#define BPF_LD_IMM64_RAW(DST, SRC, IMM) \ - ((struct bpf_insn) { \ - .code = BPF_LD | BPF_DW | BPF_IMM, \ - .dst_reg = DST, \ - .src_reg = SRC, \ - .off = 0, \ - .imm = (uint32_t) (IMM) }), \ - ((struct bpf_insn) { \ - .code = 0, /* zero is reserved opcode */ \ - .dst_reg = 0, \ - .src_reg = 0, \ - .off = 0, \ - .imm = ((uint64_t) (IMM)) >> 32 }) - -/* pseudo BPF_LD_IMM64 insn used to refer to process-local map_fd */ -#define BPF_LD_MAP_FD(DST, MAP_FD) \ - BPF_LD_IMM64_RAW(DST, BPF_PSEUDO_MAP_FD, MAP_FD) - -#define BPF_ST_MEM(SIZE, DST, OFF, IMM) \ - ((struct bpf_insn) { \ - .code = BPF_ST | BPF_SIZE(SIZE) | BPF_MEM, \ - .dst_reg = DST, \ - .src_reg = 0, \ - .off = OFF, \ - .imm = IMM }) - -#define BPF_LDX_MEM(SIZE, DST, SRC, OFF) \ - ((struct bpf_insn) { \ - .code = BPF_LDX | BPF_SIZE(SIZE) | BPF_MEM, \ - .dst_reg = DST, \ - .src_reg = SRC, \ - .off = OFF, \ - .imm = 0 }) - -#define BPF_STX_MEM(SIZE, DST, SRC, OFF) \ - ((struct bpf_insn) { \ - .code = BPF_STX | BPF_SIZE(SIZE) | BPF_MEM, \ - .dst_reg = DST, \ - .src_reg = SRC, \ - .off = OFF, \ - .imm = 0 }) - -#define BPF_JMP_IMM(OP, DST, IMM, OFF) \ - ((struct bpf_insn) { \ - .code = BPF_JMP | BPF_OP(OP) | BPF_K, \ - .dst_reg = DST, \ - .src_reg = 0, \ - .off = OFF, \ - .imm = IMM }) - -#define BPF_MOV64_IMM(DST, IMM) \ - ((struct bpf_insn) { \ - .code = BPF_ALU64 | BPF_MOV | BPF_K, \ - .dst_reg = DST, \ - .src_reg = 0, \ - .off = 0, \ - .imm = IMM }) - -#define BPF_MOV32_IMM(DST, IMM) \ - ((struct bpf_insn) { \ - .code = BPF_ALU | BPF_MOV | BPF_K, \ - .dst_reg = DST, \ - .src_reg = 0, \ - .off = 0, \ - .imm = IMM }) - -#define BPF_EMIT_CALL(FUNC) \ - ((struct bpf_insn) { \ - .code = BPF_JMP | BPF_CALL, \ - .dst_reg = 0, \ - .src_reg = 0, \ - .off = 0, \ - .imm = ((FUNC) - BPF_FUNC_unspec) }) - -#define BPF_EXIT_INSN() \ - ((struct bpf_insn) { \ - .code = BPF_JMP | BPF_EXIT, \ - .dst_reg = 0, \ - .src_reg = 0, \ - .off = 0, \ - .imm = 0 }) - -/* End copy from tools/include/filter.h */ - -/* Start copy from tools/lib/bpf */ -static inline uint64_t ptr_to_u64(const void *ptr) -{ - return (uint64_t) (unsigned long) ptr; -} - -static inline int bpf(enum bpf_cmd cmd, union bpf_attr *attr, unsigned int size) -{ - return tst_syscall(__NR_bpf, cmd, attr, size); -} -/* End copy from tools/lib/bpf */ - -#endif /* BPF_H */ diff --git a/fsstress/include/lapi/capability.h b/fsstress/include/lapi/capability.h deleted file mode 100644 index fde27efd36..0000000000 --- a/fsstress/include/lapi/capability.h +++ /dev/null @@ -1,51 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Copyright (c) 2019 Richard Palethorpe - */ - -#ifndef LAPI_CAPABILITY_H -#define LAPI_CAPABILITY_H - -#include "config.h" - -#ifdef HAVE_SYS_CAPABILITY_H -# include -/** - * Some old libcap-devel(1.96~2.16) define _LINUX_TYPES_H in - * sys/capability.h that makes ltp-lib cann't include linux/types.h - * essentially. Here undefine it if include such old header-file. - */ -# ifndef HAVE_NEWER_LIBCAP -# undef _LINUX_TYPES_H -# endif -#endif - -#ifndef CAP_NET_RAW -# define CAP_NET_RAW 13 -#endif - -#ifndef CAP_SYS_ADMIN -# define CAP_SYS_ADMIN 21 -#endif - -#ifndef CAP_SYS_TIME -# define CAP_SYS_TIME 25 -#endif - -#ifndef CAP_AUDIT_READ -# define CAP_AUDIT_READ 37 -#endif - -#ifndef CAP_SYS_RESOURCE -# define CAP_SYS_RESOURCE 24 -#endif - -#ifndef CAP_TO_INDEX -# define CAP_TO_INDEX(x) ((x) >> 5) -#endif - -#ifndef CAP_TO_MASK -# define CAP_TO_MASK(x) (1 << ((x) & 31)) -#endif - -#endif diff --git a/fsstress/include/lapi/clone.h b/fsstress/include/lapi/clone.h deleted file mode 100644 index 2b8cbdbe08..0000000000 --- a/fsstress/include/lapi/clone.h +++ /dev/null @@ -1,49 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2020 Linaro Limited. All rights reserved. - * Author: Viresh Kumar - */ - -#ifndef LAPI_CLONE_H__ -#define LAPI_CLONE_H__ - -#include -#include -#include - -#include "config.h" -#include "lapi/syscalls.h" - -#ifndef HAVE_CLONE3 -struct clone_args { - uint64_t __attribute__((aligned(8))) flags; - uint64_t __attribute__((aligned(8))) pidfd; - uint64_t __attribute__((aligned(8))) child_tid; - uint64_t __attribute__((aligned(8))) parent_tid; - uint64_t __attribute__((aligned(8))) exit_signal; - uint64_t __attribute__((aligned(8))) stack; - uint64_t __attribute__((aligned(8))) stack_size; - uint64_t __attribute__((aligned(8))) tls; -}; - -int clone3(struct clone_args *args, size_t size) -{ - return tst_syscall(__NR_clone3, args, size); -} -#endif - -#ifndef CLONE_PIDFD -#define CLONE_PIDFD 0x00001000 /* set if a pidfd should be placed in parent */ -#endif - -void clone3_supported_by_kernel(void) -{ - if ((tst_kvercmp(5, 3, 0)) < 0) { - /* Check if the syscall is backported on an older kernel */ - TEST(syscall(__NR_clone3, NULL, 0)); - if (TST_RET == -1 && TST_ERR == ENOSYS) - tst_brk(TCONF, "Test not supported on kernel version < v5.3"); - } -} - -#endif /* LAPI_CLONE_H__ */ diff --git a/fsstress/include/lapi/common_timers.h b/fsstress/include/lapi/common_timers.h deleted file mode 100644 index b783beff4f..0000000000 --- a/fsstress/include/lapi/common_timers.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * File: common_timers.h - * - * Keep all the common defines/checks for the timer tests here - */ - -#ifndef __COMMON_TIMERS_H__ -#define __COMMON_TIMERS_H__ - -#include "config.h" -#include "lapi/syscalls.h" -#include "lapi/posix_clocks.h" - -#ifndef NSEC_PER_SEC -#define NSEC_PER_SEC (1000000000L) -#endif - -static const clock_t clock_list[] = { - CLOCK_REALTIME, - CLOCK_MONOTONIC, - CLOCK_PROCESS_CPUTIME_ID, - CLOCK_THREAD_CPUTIME_ID, - CLOCK_BOOTTIME, - CLOCK_BOOTTIME_ALARM, - CLOCK_REALTIME_ALARM, - CLOCK_TAI, -}; -/* CLOCKS_DEFINED is the number of clock sources defined for sure */ -#define CLOCKS_DEFINED (sizeof(clock_list) / sizeof(*clock_list)) -/* MAX_CLOCKS is the maximum number of clock sources supported by kernel */ -#define MAX_CLOCKS 16 - -#define CLOCK_TO_STR(def_name) \ - case def_name: \ - return #def_name; - -static inline const char *get_clock_str(const int clock_id) -{ - switch (clock_id) { - CLOCK_TO_STR(CLOCK_REALTIME); - CLOCK_TO_STR(CLOCK_MONOTONIC); - CLOCK_TO_STR(CLOCK_PROCESS_CPUTIME_ID); - CLOCK_TO_STR(CLOCK_THREAD_CPUTIME_ID); - CLOCK_TO_STR(CLOCK_BOOTTIME); - CLOCK_TO_STR(CLOCK_BOOTTIME_ALARM); - CLOCK_TO_STR(CLOCK_REALTIME_ALARM); - CLOCK_TO_STR(CLOCK_TAI); - default: - return "CLOCK_!?!?!?"; - } -} - -static inline int possibly_unsupported(clock_t clock) -{ - switch (clock) { - case CLOCK_BOOTTIME: - case CLOCK_BOOTTIME_ALARM: - case CLOCK_REALTIME_ALARM: - case CLOCK_TAI: - return 1; - default: - return 0; - } -} - -static inline int have_cputime_timers(void) -{ - return tst_kvercmp(2, 6, 12) >= 0; -} - -#include "lapi/syscalls.h" - -#include -#include - -/* timer_t in kernel(int) is different from Glibc definition(void*). - * Use the kernel definition for syscall tests - */ -typedef int kernel_timer_t; - -#endif diff --git a/fsstress/include/lapi/cpuset.h b/fsstress/include/lapi/cpuset.h deleted file mode 100644 index 8f7136c3b5..0000000000 --- a/fsstress/include/lapi/cpuset.h +++ /dev/null @@ -1,51 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved. - */ - -/* - * Some old libcs (like glibc < 2.7) do not provide interfaces for - * dynamically sized cpu sets, but provide only static cpu_set_t type - * with no more than CPU_SETSIZE cpus in it. - * - * This file is a wrapper of the dynamic interfaces using the static ones. - * - * If the number of cpus available on the system is greater than - * CPU_SETSIZE, this interface will not work. Update libc in this case :) - */ - -#define _GNU_SOURCE -#include - -#ifndef LTP_CPUSET_H -#define LTP_CPUSET_H - -#ifndef CPU_ALLOC -#define CPU_ALLOC(ncpus) malloc(sizeof(cpu_set_t)); \ -if (ncpus > CPU_SETSIZE) { \ - tst_brk(TCONF, \ - "Your libc does not support masks with %ld cpus", (long)ncpus); \ -} -#endif - -#ifndef CPU_FREE -#define CPU_FREE(ptr) free(ptr) -#endif - -#ifndef CPU_ALLOC_SIZE -#define CPU_ALLOC_SIZE(size) sizeof(cpu_set_t) -#endif - -#ifndef CPU_ZERO_S -#define CPU_ZERO_S(size, mask) CPU_ZERO(mask) -#endif - -#ifndef CPU_SET_S -#define CPU_SET_S(cpu, size, mask) CPU_SET(cpu, mask) -#endif - -#ifndef CPU_ISSET_S -#define CPU_ISSET_S(cpu, size, mask) CPU_ISSET(cpu, mask) -#endif - -#endif /* LTP_CPUSET_H */ diff --git a/fsstress/include/lapi/cryptouser.h b/fsstress/include/lapi/cryptouser.h deleted file mode 100644 index e92fe96fb9..0000000000 --- a/fsstress/include/lapi/cryptouser.h +++ /dev/null @@ -1,182 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2018 Richard Palethorpe - */ - -#ifndef CRYPTOUSER_H__ -#define CRYPTOUSER_H__ - -#ifdef HAVE_LINUX_CRYPTOUSER_H -# include -#else -# include -# define CRYPTO_MAX_NAME 64 - -enum { - CRYPTO_MSG_BASE = 0x10, - CRYPTO_MSG_NEWALG = 0x10, - CRYPTO_MSG_DELALG, - CRYPTO_MSG_UPDATEALG, - CRYPTO_MSG_GETALG, - CRYPTO_MSG_DELRNG, - __CRYPTO_MSG_MAX -}; - -enum crypto_attr_type_t { - CRYPTOCFGA_UNSPEC, - CRYPTOCFGA_PRIORITY_VAL, /* uint32_t */ - CRYPTOCFGA_REPORT_LARVAL, /* struct crypto_report_larval */ - CRYPTOCFGA_REPORT_HASH, /* struct crypto_report_hash */ - CRYPTOCFGA_REPORT_BLKCIPHER, /* struct crypto_report_blkcipher */ - CRYPTOCFGA_REPORT_AEAD, /* struct crypto_report_aead */ - CRYPTOCFGA_REPORT_COMPRESS, /* struct crypto_report_comp */ - CRYPTOCFGA_REPORT_RNG, /* struct crypto_report_rng */ - CRYPTOCFGA_REPORT_CIPHER, /* struct crypto_report_cipher */ - CRYPTOCFGA_REPORT_AKCIPHER, /* struct crypto_report_akcipher */ - CRYPTOCFGA_REPORT_KPP, /* struct crypto_report_kpp */ - CRYPTOCFGA_REPORT_ACOMP, /* struct crypto_report_acomp */ - __CRYPTOCFGA_MAX - -#define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1) -}; - -struct crypto_user_alg { - char cru_name[CRYPTO_MAX_NAME]; - char cru_driver_name[CRYPTO_MAX_NAME]; - char cru_module_name[CRYPTO_MAX_NAME]; - uint32_t cru_type; - uint32_t cru_mask; - uint32_t cru_refcnt; - uint32_t cru_flags; -}; - -struct crypto_report_larval { - char type[CRYPTO_MAX_NAME]; -}; - -struct crypto_report_hash { - char type[CRYPTO_MAX_NAME]; - unsigned int blocksize; - unsigned int digestsize; -}; - -struct crypto_report_cipher { - char type[CRYPTO_MAX_NAME]; - unsigned int blocksize; - unsigned int min_keysize; - unsigned int max_keysize; -}; - -struct crypto_report_blkcipher { - char type[CRYPTO_MAX_NAME]; - char geniv[CRYPTO_MAX_NAME]; - unsigned int blocksize; - unsigned int min_keysize; - unsigned int max_keysize; - unsigned int ivsize; -}; - -struct crypto_report_aead { - char type[CRYPTO_MAX_NAME]; - char geniv[CRYPTO_MAX_NAME]; - unsigned int blocksize; - unsigned int maxauthsize; - unsigned int ivsize; -}; - -struct crypto_report_comp { - char type[CRYPTO_MAX_NAME]; -}; - -struct crypto_report_rng { - char type[CRYPTO_MAX_NAME]; - unsigned int seedsize; -}; - -struct crypto_report_akcipher { - char type[CRYPTO_MAX_NAME]; -}; - -struct crypto_report_kpp { - char type[CRYPTO_MAX_NAME]; -}; - -struct crypto_report_acomp { - char type[CRYPTO_MAX_NAME]; -}; - -#endif /* HAVE_LINUX_CRYPTOUSER_H */ - -/* These are taken from include/crypto.h in the kernel tree. They are not - * currently included in the user API. - */ -#ifndef CRYPTO_MAX_ALG_NAME -# define CRYPTO_MAX_ALG_NAME 128 -#endif - -#ifndef CRYPTO_ALG_TYPE_MASK -# define CRYPTO_ALG_TYPE_MASK 0x0000000f -#endif -#ifndef CRYPTO_ALG_TYPE_CIPHER -# define CRYPTO_ALG_TYPE_CIPHER 0x00000001 -#endif -#ifndef CRYPTO_ALG_TYPE_COMPRESS -# define CRYPTO_ALG_TYPE_COMPRESS 0x00000002 -#endif -#ifndef CRYPTO_ALG_TYPE_AEAD -# define CRYPTO_ALG_TYPE_AEAD 0x00000003 -#endif -#ifndef CRYPTO_ALG_TYPE_BLKCIPHER -# define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004 -#endif -#ifndef CRYPTO_ALG_TYPE_ABLKCIPHER -# define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005 -#endif -#ifndef CRYPTO_ALG_TYPE_SKCIPHER -# define CRYPTO_ALG_TYPE_SKCIPHER 0x00000005 -#endif -#ifndef CRYPTO_ALG_TYPE_GIVCIPHER -# define CRYPTO_ALG_TYPE_GIVCIPHER 0x00000006 -#endif -#ifndef CRYPTO_ALG_TYPE_KPP -# define CRYPTO_ALG_TYPE_KPP 0x00000008 -#endif -#ifndef CRYPTO_ALG_TYPE_ACOMPRESS -# define CRYPTO_ALG_TYPE_ACOMPRESS 0x0000000a -#endif -#ifndef CRYPTO_ALG_TYPE_SCOMPRESS -# define CRYPTO_ALG_TYPE_SCOMPRESS 0x0000000b -#endif -#ifndef CRYPTO_ALG_TYPE_RNG -# define CRYPTO_ALG_TYPE_RNG 0x0000000c -#endif -#ifndef CRYPTO_ALG_TYPE_AKCIPHER -# define CRYPTO_ALG_TYPE_AKCIPHER 0x0000000d -#endif -#ifndef CRYPTO_ALG_TYPE_DIGEST -# define CRYPTO_ALG_TYPE_DIGEST 0x0000000e -#endif -#ifndef CRYPTO_ALG_TYPE_HASH -# define CRYPTO_ALG_TYPE_HASH 0x0000000e -#endif -#ifndef CRYPTO_ALG_TYPE_SHASH -# define CRYPTO_ALG_TYPE_SHASH 0x0000000e -#endif -#ifndef CRYPTO_ALG_TYPE_AHASH -# define CRYPTO_ALG_TYPE_AHASH 0x0000000f -#endif - -#ifndef CRYPTO_ALG_TYPE_HASH_MASK -# define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e -#endif -#ifndef CRYPTO_ALG_TYPE_AHASH_MASK -# define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000e -#endif -#ifndef CRYPTO_ALG_TYPE_BLKCIPHER_MASK -# define CRYPTO_ALG_TYPE_BLKCIPHER_MASK 0x0000000c -#endif -#ifndef CRYPTO_ALG_TYPE_ACOMPRESS_MASK -# define CRYPTO_ALG_TYPE_ACOMPRESS_MASK 0x0000000e -#endif - -#endif /* CRYPTOUSER_H__ */ diff --git a/fsstress/include/lapi/dccp.h b/fsstress/include/lapi/dccp.h deleted file mode 100644 index a0f0148503..0000000000 --- a/fsstress/include/lapi/dccp.h +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2017 Petr Vorel - */ - -#ifndef LAPI_DCCP_H__ -#define LAPI_DCCP_H__ - -#ifdef HAVE_LINUX_DCCP_H -# include -#endif - -#ifndef DCCP_SOCKOPT_SERVICE -# define DCCP_SOCKOPT_SERVICE 2 -#endif - -#endif /* LAPI_DCCP_H__ */ diff --git a/fsstress/include/lapi/epoll.h b/fsstress/include/lapi/epoll.h deleted file mode 100644 index 899eeb9d42..0000000000 --- a/fsstress/include/lapi/epoll.h +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2016 Cyril Hrubis - */ - -#ifndef LAPI_EPOLL_H__ -#define LAPI_EPOLL_H__ - -#ifndef EPOLL_CLOEXEC -# define EPOLL_CLOEXEC 02000000 -#endif - -#endif /* LAPI_EPOLL_H__ */ diff --git a/fsstress/include/lapi/execveat.h b/fsstress/include/lapi/execveat.h deleted file mode 100644 index a7406f7c01..0000000000 --- a/fsstress/include/lapi/execveat.h +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (C) 2018 MediaTek Inc. All Rights Reserved. - */ - -#ifndef EXECVEAT_H -#define EXECVEAT_H - -#include -#include "config.h" -#include "lapi/syscalls.h" - -#if !defined(HAVE_EXECVEAT) -int execveat(int dirfd, const char *pathname, - char *const argv[], char *const envp[], - int flags) -{ - return tst_syscall(__NR_execveat, dirfd, pathname, argv, envp, flags); -} -#endif - -#endif /* EXECVEAT_H */ diff --git a/fsstress/include/lapi/fallocate.h b/fsstress/include/lapi/fallocate.h deleted file mode 100644 index 72f52c78f5..0000000000 --- a/fsstress/include/lapi/fallocate.h +++ /dev/null @@ -1,60 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) International Business Machines Corp., 2007 - * Copyright (c) 2014 Fujitsu Ltd. - */ - -#ifndef FALLOCATE_H -#define FALLOCATE_H - -#include -#include -#include "config.h" -#include "lapi/abisize.h" -#include "lapi/seek.h" -#include "lapi/syscalls.h" - -#ifndef FALLOC_FL_KEEP_SIZE -# define FALLOC_FL_KEEP_SIZE 0x01 -#endif - -#ifndef FALLOC_FL_PUNCH_HOLE -# define FALLOC_FL_PUNCH_HOLE 0x02 -#endif - -#ifndef FALLOC_FL_COLLAPSE_RANGE -# define FALLOC_FL_COLLAPSE_RANGE 0x08 -#endif - -#ifndef FALLOC_FL_ZERO_RANGE -# define FALLOC_FL_ZERO_RANGE 0x10 -#endif - -#ifndef FALLOC_FL_INSERT_RANGE -# define FALLOC_FL_INSERT_RANGE 0x20 -#endif - -#if !defined(HAVE_FALLOCATE) - -# ifdef __TEST_H__ -# define TST_SYSCALL_WRAPPER ltp_syscall -# else -# define TST_SYSCALL_WRAPPER tst_syscall -# endif /* __TEST_H__ */ - -static inline long fallocate(int fd, int mode, loff_t offset, loff_t len) -{ - /* Deal with 32bit ABIs that have 64bit syscalls. */ -# if LTP_USE_64_ABI - return TST_SYSCALL_WRAPPER(__NR_fallocate, fd, mode, offset, len); -# else - return (long)TST_SYSCALL_WRAPPER(__NR_fallocate, fd, mode, - __LONG_LONG_PAIR((off_t) (offset >> 32), - (off_t) offset), - __LONG_LONG_PAIR((off_t) (len >> 32), - (off_t) len)); -# endif -} -#endif - -#endif /* FALLOCATE_H */ diff --git a/fsstress/include/lapi/fcntl.h b/fsstress/include/lapi/fcntl.h deleted file mode 100644 index 576a18daf1..0000000000 --- a/fsstress/include/lapi/fcntl.h +++ /dev/null @@ -1,139 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2014 Cyril Hrubis - */ - -#ifndef __LAPI_FCNTL_H__ -#define __LAPI_FCNTL_H__ - -#include -#include - -#ifndef O_DIRECT -# define O_DIRECT 040000 -#endif - -#ifndef O_CLOEXEC -# define O_CLOEXEC 02000000 -#endif - -#ifndef SOCK_CLOEXEC -# define SOCK_CLOEXEC O_CLOEXEC -#endif - -#ifndef SOCK_NONBLOCK -# define SOCK_NONBLOCK O_NONBLOCK -#endif - -#ifndef O_TMPFILE -# define O_TMPFILE (020000000 | O_DIRECTORY) -#endif - -#ifndef F_DUPFD_CLOEXEC -# define F_DUPFD_CLOEXEC 1030 -#endif - -#ifndef F_SETPIPE_SZ -# define F_SETPIPE_SZ 1031 -#endif - -#ifndef F_GETPIPE_SZ -# define F_GETPIPE_SZ 1032 -#endif - -/* - * Set/Get seals - */ -#ifndef F_ADD_SEALS -# define F_ADD_SEALS (1033) -#endif - -#ifndef F_GET_SEALS -# define F_GET_SEALS (1034) -#endif - -#ifndef F_SEAL_SEAL -# define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */ -#endif - -#ifndef F_SEAL_SHRINK -# define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */ -#endif -#ifndef F_SEAL_GROW -# define F_SEAL_GROW 0x0004 /* prevent file from growing */ -#endif -#ifndef F_SEAL_WRITE -# define F_SEAL_WRITE 0x0008 /* prevent writes */ -#endif - -#ifndef F_OWNER_PGRP -# define F_OWNER_PGRP 2 -#endif - -#ifndef F_OFD_GETLK -# define F_OFD_GETLK 36 -#endif - -#ifndef F_OFD_SETLK -# define F_OFD_SETLK 37 -#endif - -#ifndef F_OFD_SETLKW -# define F_OFD_SETLKW 38 -#endif - -#ifndef AT_FDCWD -# define AT_FDCWD -100 -#endif - -#ifndef AT_SYMLINK_FOLLOW -# define AT_SYMLINK_FOLLOW 0x400 -#endif - -#ifndef AT_SYMLINK_NOFOLLOW -# define AT_SYMLINK_NOFOLLOW 0x100 -#endif - -#ifndef AT_EMPTY_PATH -# define AT_EMPTY_PATH 0x1000 -#endif - -#ifndef AT_REMOVEDIR -# define AT_REMOVEDIR 0x200 -#endif - -#ifndef O_NOATIME -# define O_NOATIME 01000000 -#endif - -#ifndef O_PATH -# ifdef __sparc__ -# define O_PATH 0x1000000 -# else -# define O_PATH 010000000 -# endif -#endif - -#ifndef FALLOC_FL_KEEP_SIZE -# define FALLOC_FL_KEEP_SIZE 1 -#endif - -#ifndef RENAME_NOREPLACE -# define RENAME_NOREPLACE (1 << 0) -#endif - -#ifndef RENAME_EXCHANGE -# define RENAME_EXCHANGE (1 << 1) -#endif - -#ifndef RENAME_WHITEOUT -# define RENAME_WHITEOUT (1 << 2) -#endif - -/* splice, vmsplice, tee */ - -#ifndef SPLICE_F_NONBLOCK -# define SPLICE_F_NONBLOCK 2 -#endif - -#endif /* __LAPI_FCNTL_H__ */ diff --git a/fsstress/include/lapi/fnmatch.h b/fsstress/include/lapi/fnmatch.h deleted file mode 100644 index 9628ac4407..0000000000 --- a/fsstress/include/lapi/fnmatch.h +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2018 Linaro Limited. All rights reserved. - * Author: Rafael David Tinoco - */ - -#ifndef FNMATCH_H__ -#define FNMATCH_H__ - -#ifndef FNM_EXTMATCH -#define FNM_EXTMATCH 0 -#endif - -#endif diff --git a/fsstress/include/lapi/fs.h b/fsstress/include/lapi/fs.h deleted file mode 100644 index 430d21f271..0000000000 --- a/fsstress/include/lapi/fs.h +++ /dev/null @@ -1,66 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Referred from linux kernel include/uapi/linux/fs.h - * Copyright (c) 2019 Petr Vorel - * Copyright (c) Zilogic Systems Pvt. Ltd., 2018 - * Email: code@zilogic.com - */ - -#ifdef HAVE_LINUX_FS_H -# include -#endif - -#include -#include -#include "lapi/abisize.h" - -#ifndef LAPI_FS_H -#define LAPI_FS_H - -#ifndef FS_IOC_GETFLAGS -#define FS_IOC_GETFLAGS _IOR('f', 1, long) -#endif - -#ifndef FS_IOC_SETFLAGS -#define FS_IOC_SETFLAGS _IOW('f', 2, long) -#endif - -#ifndef FS_COMPR_FL -#define FS_COMPR_FL 0x00000004 /* Compress file */ -#endif - -#ifndef FS_IMMUTABLE_FL -#define FS_IMMUTABLE_FL 0x00000010 /* Immutable file */ -#endif - -#ifndef FS_APPEND_FL -#define FS_APPEND_FL 0x00000020 /* writes to file may only append */ -#endif - -#ifndef FS_NODUMP_FL -#define FS_NODUMP_FL 0x00000040 /* do not dump file */ -#endif - -/* - * Helper function to get MAX_LFS_FILESIZE. - * Missing PAGE_SHIFT on some libc prevents defining MAX_LFS_FILESIZE. - * - * 64 bit: macro taken from kernel from include/linux/fs.h - * 32 bit: own implementation - */ -static inline loff_t tst_max_lfs_filesize(void) -{ -#ifdef TST_ABI64 - return (loff_t)LLONG_MAX; -#else - long page_size = getpagesize(); - loff_t ret = ULONG_MAX; - - while (page_size >>= 1) - ret <<= 1; - - return ret; -#endif -} - -#endif diff --git a/fsstress/include/lapi/fsmount.h b/fsstress/include/lapi/fsmount.h deleted file mode 100644 index 09a2c16118..0000000000 --- a/fsstress/include/lapi/fsmount.h +++ /dev/null @@ -1,145 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2020 Linaro Limited. All rights reserved. - * Author: Viresh Kumar - */ - -#ifndef FSMOUNT_H__ -#define FSMOUNT_H__ - -#include -#include -#include - -#include "config.h" -#include "lapi/fcntl.h" -#include "lapi/syscalls.h" - -#ifndef HAVE_FSOPEN -int fsopen(const char *fsname, unsigned int flags) -{ - return tst_syscall(__NR_fsopen, fsname, flags); -} -#endif /* HAVE_FSOPEN */ - -#ifndef HAVE_FSCONFIG -int fsconfig(int fd, unsigned int cmd, const char *key, - const void *value, int aux) -{ - return tst_syscall(__NR_fsconfig, fd, cmd, key, value, aux); -} -#endif /* HAVE_FSCONFIG */ - -#ifndef HAVE_FSMOUNT -int fsmount(int fd, unsigned int flags, unsigned int mount_attrs) -{ - return tst_syscall(__NR_fsmount, fd, flags, mount_attrs); -} -#endif /* HAVE_FSMOUNT */ - -#ifndef HAVE_FSPICK -int fspick(int dirfd, const char *pathname, unsigned int flags) -{ - return tst_syscall(__NR_fspick, dirfd, pathname, flags); -} -#endif /* HAVE_FSPICK */ - -#ifndef HAVE_MOVE_MOUNT -int move_mount(int from_dirfd, const char *from_pathname, int to_dirfd, - const char *to_pathname, unsigned int flags) -{ - return tst_syscall(__NR_move_mount, from_dirfd, from_pathname, to_dirfd, - to_pathname, flags); -} -#endif /* HAVE_MOVE_MOUNT */ - -#ifndef HAVE_OPEN_TREE -int open_tree(int dirfd, const char *pathname, unsigned int flags) -{ - return tst_syscall(__NR_open_tree, dirfd, pathname, flags); -} -#endif /* HAVE_OPEN_TREE */ - -/* - * New headers added in kernel after 5.2 release, create them for old userspace. -*/ - -#ifndef OPEN_TREE_CLONE - -/* - * open_tree() flags. - */ -#define OPEN_TREE_CLONE 1 /* Clone the target tree and attach the clone */ -#define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */ - -/* - * move_mount() flags. - */ -#define MOVE_MOUNT_F_SYMLINKS 0x00000001 /* Follow symlinks on from path */ -#define MOVE_MOUNT_F_AUTOMOUNTS 0x00000002 /* Follow automounts on from path */ -#define MOVE_MOUNT_F_EMPTY_PATH 0x00000004 /* Empty from path permitted */ -#define MOVE_MOUNT_T_SYMLINKS 0x00000010 /* Follow symlinks on to path */ -#define MOVE_MOUNT_T_AUTOMOUNTS 0x00000020 /* Follow automounts on to path */ -#define MOVE_MOUNT_T_EMPTY_PATH 0x00000040 /* Empty to path permitted */ -#define MOVE_MOUNT__MASK 0x00000077 - -/* - * fsopen() flags. - */ -#define FSOPEN_CLOEXEC 0x00000001 - -/* - * fspick() flags. - */ -#define FSPICK_CLOEXEC 0x00000001 -#define FSPICK_SYMLINK_NOFOLLOW 0x00000002 -#define FSPICK_NO_AUTOMOUNT 0x00000004 -#define FSPICK_EMPTY_PATH 0x00000008 - -/* - * The type of fsconfig() call made. - */ -enum fsconfig_command { - FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ - FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ - FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ - FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ - FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ - FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ - FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ - FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ -}; - -/* - * fsmount() flags. - */ -#define FSMOUNT_CLOEXEC 0x00000001 - -/* - * Mount attributes. - */ -#define MOUNT_ATTR_RDONLY 0x00000001 /* Mount read-only */ -#define MOUNT_ATTR_NOSUID 0x00000002 /* Ignore suid and sgid bits */ -#define MOUNT_ATTR_NODEV 0x00000004 /* Disallow access to device special files */ -#define MOUNT_ATTR_NOEXEC 0x00000008 /* Disallow program execution */ -#define MOUNT_ATTR__ATIME 0x00000070 /* Setting on how atime should be updated */ -#define MOUNT_ATTR_RELATIME 0x00000000 /* - Update atime relative to mtime/ctime. */ -#define MOUNT_ATTR_NOATIME 0x00000010 /* - Do not update access times. */ -#define MOUNT_ATTR_STRICTATIME 0x00000020 /* - Always perform atime updates */ -#define MOUNT_ATTR_NODIRATIME 0x00000080 /* Do not update directory access times */ - -#endif /* OPEN_TREE_CLONE */ - -void fsopen_supported_by_kernel(void) -{ - if ((tst_kvercmp(5, 2, 0)) < 0) { - /* Check if the syscall is backported on an older kernel */ - TEST(syscall(__NR_fsopen, NULL, 0)); - if (TST_RET != -1) - SAFE_CLOSE(TST_RET); - else if (TST_ERR == ENOSYS) - tst_brk(TCONF, "Test not supported on kernel version < v5.2"); - } -} - -#endif /* FSMOUNT_H__ */ diff --git a/fsstress/include/lapi/futex.h b/fsstress/include/lapi/futex.h deleted file mode 100644 index 72209e4c98..0000000000 --- a/fsstress/include/lapi/futex.h +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2015 Linux Test Project - */ - -#ifndef LAPI_FUTEX_H__ -#define LAPI_FUTEX_H__ - -#include - -typedef volatile uint32_t futex_t; - -#endif /* LAPI_FUTEX_H__ */ diff --git a/fsstress/include/lapi/getrandom.h b/fsstress/include/lapi/getrandom.h deleted file mode 100644 index 83e0a0e053..0000000000 --- a/fsstress/include/lapi/getrandom.h +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2015 Linux Test Project - */ - -#ifndef __GETRANDOM_H__ -#define __GETRANDOM_H__ - -#include "config.h" - -#if HAVE_LINUX_RANDOM_H -#include -#endif - -/* - * Flags for getrandom(2) - * - * GRND_NONBLOCK Don't block and return EAGAIN instead - * GRND_RANDOM Use the /dev/random pool instead of /dev/urandom - */ - -#ifndef GRND_NONBLOCK -# define GRND_NONBLOCK 0x0001 -#endif - -#ifndef GRND_RANDOM -# define GRND_RANDOM 0x0002 -#endif - -#endif /* __GETRANDOM_H__ */ diff --git a/fsstress/include/lapi/if_alg.h b/fsstress/include/lapi/if_alg.h deleted file mode 100644 index 5a74df99b8..0000000000 --- a/fsstress/include/lapi/if_alg.h +++ /dev/null @@ -1,38 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright 2019 Google LLC - */ - -#ifndef IF_ALG_H__ -#define IF_ALG_H__ - -#ifdef HAVE_LINUX_IF_ALG_H -# include -#else -# include - -struct sockaddr_alg { - uint16_t salg_family; - uint8_t salg_type[14]; - uint32_t salg_feat; - uint32_t salg_mask; - uint8_t salg_name[64]; -}; - -struct af_alg_iv { - uint32_t ivlen; - uint8_t iv[0]; -}; - -#define ALG_SET_KEY 1 -#define ALG_SET_IV 2 -#define ALG_SET_OP 3 -#define ALG_SET_AEAD_ASSOCLEN 4 -#define ALG_SET_AEAD_AUTHSIZE 5 - -#define ALG_OP_DECRYPT 0 -#define ALG_OP_ENCRYPT 1 - -#endif /* !HAVE_LINUX_IF_ALG_H */ - -#endif /* IF_ALG_H__ */ diff --git a/fsstress/include/lapi/if_ether.h b/fsstress/include/lapi/if_ether.h deleted file mode 100644 index 0e9a4fcc11..0000000000 --- a/fsstress/include/lapi/if_ether.h +++ /dev/null @@ -1,19 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2020 SUSE LLC - */ - -#ifndef __LAPI_IF_ETHER_H__ -#define __LAPI_IF_ETHER_H__ - -#include "config.h" - -#ifdef HAVE_LINUX_IF_ETHER_H -# include -#endif - -#ifndef ETH_P_ALL -# define ETH_P_ALL 0x0003 -#endif - -#endif /* __LAPI_IF_ETHER_H__ */ diff --git a/fsstress/include/lapi/if_packet.h b/fsstress/include/lapi/if_packet.h deleted file mode 100644 index 81110217d8..0000000000 --- a/fsstress/include/lapi/if_packet.h +++ /dev/null @@ -1,50 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. - * Author: Jinhui huang - */ - -#ifndef __LAPI_IF_PACKET_H__ -#define __LAPI_IF_PACKET_H__ - -#include "config.h" - -#ifdef HAVE_LINUX_IF_PACKET_H -# include -#endif - -#ifndef PACKET_RX_RING -# define PACKET_RX_RING 5 -#endif - -#ifndef PACKET_VERSION -# define PACKET_VERSION 10 -#endif - -#ifndef PACKET_RESERVE -# define PACKET_RESERVE 12 -#endif - -#ifndef PACKET_FANOUT -#define PACKET_FANOUT 18 -#endif - -#ifndef PACKET_FANOUT_ROLLOVER -#define PACKET_FANOUT_ROLLOVER 3 -#endif - -#ifndef HAVE_STRUCT_TPACKET_REQ3 -# define TPACKET_V3 2 - -struct tpacket_req3 { - unsigned int tp_block_size; - unsigned int tp_block_nr; - unsigned int tp_frame_size; - unsigned int tp_frame_nr; - unsigned int tp_retire_blk_tov; - unsigned int tp_sizeof_priv; - unsigned int tp_feature_req_word; -}; -#endif - -#endif /* __LAPI_IF_PACKET_H__ */ diff --git a/fsstress/include/lapi/io_pgetevents.h b/fsstress/include/lapi/io_pgetevents.h deleted file mode 100644 index 5bb9a60c35..0000000000 --- a/fsstress/include/lapi/io_pgetevents.h +++ /dev/null @@ -1,35 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2020 Linaro Limited. All rights reserved. - * Author: Viresh Kumar - */ - -#ifndef IO_PGETEVENTS_H -#define IO_PGETEVENTS_H - -#include -#include - -#include "config.h" -#include "lapi/syscalls.h" - -#ifdef HAVE_LIBAIO -#include - -static inline int sys_io_pgetevents(io_context_t ctx, long min_nr, long max_nr, - struct io_event *events, void *timeout, sigset_t *sigmask) -{ - return tst_syscall(__NR_io_pgetevents, ctx, min_nr, max_nr, events, - timeout, sigmask); -} - -static inline int sys_io_pgetevents_time64(io_context_t ctx, long min_nr, long max_nr, - struct io_event *events, void *timeout, sigset_t *sigmask) -{ - return tst_syscall(__NR_io_pgetevents_time64, ctx, min_nr, max_nr, - events, timeout, sigmask); -} - -#endif /* HAVE_LIBAIO */ - -#endif /* IO_PGETEVENTS_H */ diff --git a/fsstress/include/lapi/io_uring.h b/fsstress/include/lapi/io_uring.h deleted file mode 100644 index 5fde58e22c..0000000000 --- a/fsstress/include/lapi/io_uring.h +++ /dev/null @@ -1,283 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2020 ARM. All rights reserved. - * Copyright (c) 2020 Petr Vorel - * - * Mostly copied/adapted from - */ - -#ifndef IO_URING_H__ -#define IO_URING_H__ - -#include -#include -#include -#include -#include -#include - -#include "lapi/syscalls.h" - -#ifndef IOSQE_FIXED_FILE - -/* - * IO submission data structure (Submission Queue Entry) - */ -struct io_uring_sqe { - uint8_t opcode; /* type of operation for this sqe */ - uint8_t flags; /* IOSQE_ flags */ - uint16_t ioprio; /* ioprio for the request */ - int32_t fd; /* file descriptor to do IO on */ - union { - uint64_t off; /* offset into file */ - uint64_t addr2; - }; - uint64_t addr; /* pointer to buffer or iovecs */ - uint32_t len; /* buffer size or number of iovecs */ - union { - __kernel_rwf_t rw_flags; - uint32_t fsync_flags; - uint16_t poll_events; - uint32_t sync_range_flags; - uint32_t msg_flags; - uint32_t timeout_flags; - uint32_t accept_flags; - uint32_t cancel_flags; - uint32_t open_flags; - uint32_t statx_flags; - uint32_t fadvise_advice; - }; - uint64_t user_data; /* data to be passed back at completion time */ - union { - struct { - /* index into fixed buffers, if used */ - uint16_t buf_index; - /* personality to use, if used */ - uint16_t personality; - }; - uint64_t __pad2[3]; - }; -}; - -enum { - IOSQE_FIXED_FILE_BIT, - IOSQE_IO_DRAIN_BIT, - IOSQE_IO_LINK_BIT, - IOSQE_IO_HARDLINK_BIT, - IOSQE_ASYNC_BIT, -}; - -/* - * sqe->flags - */ -/* use fixed fileset */ -#define IOSQE_FIXED_FILE (1U << IOSQE_FIXED_FILE_BIT) -/* issue after inflight IO */ -#define IOSQE_IO_DRAIN (1U << IOSQE_IO_DRAIN_BIT) -/* links next sqe */ -#define IOSQE_IO_LINK (1U << IOSQE_IO_LINK_BIT) -/* like LINK, but stronger */ -#define IOSQE_IO_HARDLINK (1U << IOSQE_IO_HARDLINK_BIT) -/* always go async */ -#define IOSQE_ASYNC (1U << IOSQE_ASYNC_BIT) - -/* - * io_uring_setup() flags - */ -#define IORING_SETUP_IOPOLL (1U << 0) /* io_context is polled */ -#define IORING_SETUP_SQPOLL (1U << 1) /* SQ poll thread */ -#define IORING_SETUP_SQ_AFF (1U << 2) /* sq_thread_cpu is valid */ -#define IORING_SETUP_CQSIZE (1U << 3) /* app defines CQ size */ -#define IORING_SETUP_CLAMP (1U << 4) /* clamp SQ/CQ ring sizes */ -#define IORING_SETUP_ATTACH_WQ (1U << 5) /* attach to existing wq */ - -enum { - IORING_OP_NOP, - IORING_OP_READV, - IORING_OP_WRITEV, - IORING_OP_FSYNC, - IORING_OP_READ_FIXED, - IORING_OP_WRITE_FIXED, - IORING_OP_POLL_ADD, - IORING_OP_POLL_REMOVE, - IORING_OP_SYNC_FILE_RANGE, - IORING_OP_SENDMSG, - IORING_OP_RECVMSG, - IORING_OP_TIMEOUT, - IORING_OP_TIMEOUT_REMOVE, - IORING_OP_ACCEPT, - IORING_OP_ASYNC_CANCEL, - IORING_OP_LINK_TIMEOUT, - IORING_OP_CONNECT, - IORING_OP_FALLOCATE, - IORING_OP_OPENAT, - IORING_OP_CLOSE, - IORING_OP_FILES_UPDATE, - IORING_OP_STATX, - IORING_OP_READ, - IORING_OP_WRITE, - IORING_OP_FADVISE, - IORING_OP_MADVISE, - IORING_OP_SEND, - IORING_OP_RECV, - IORING_OP_OPENAT2, - IORING_OP_EPOLL_CTL, - - /* this goes last, obviously */ - IORING_OP_LAST, -}; - -/* - * sqe->fsync_flags - */ -#define IORING_FSYNC_DATASYNC (1U << 0) - -/* - * sqe->timeout_flags - */ -#define IORING_TIMEOUT_ABS (1U << 0) - -/* - * IO completion data structure (Completion Queue Entry) - */ -struct io_uring_cqe { - uint64_t user_data; /* sqe->data submission passed back */ - int32_t res; /* result code for this event */ - uint32_t flags; -}; - -/* - * Magic offsets for the application to mmap the data it needs - */ -#define IORING_OFF_SQ_RING 0ULL -#define IORING_OFF_CQ_RING 0x8000000ULL -#define IORING_OFF_SQES 0x10000000ULL - -/* - * Filled with the offset for mmap(2) - */ -struct io_sqring_offsets { - uint32_t head; - uint32_t tail; - uint32_t ring_mask; - uint32_t ring_entries; - uint32_t flags; - uint32_t dropped; - uint32_t array; - uint32_t resv1; - uint64_t resv2; -}; - -/* - * sq_ring->flags - */ -#define IORING_SQ_NEED_WAKEUP (1U << 0) /* needs io_uring_enter wakeup */ - -struct io_cqring_offsets { - uint32_t head; - uint32_t tail; - uint32_t ring_mask; - uint32_t ring_entries; - uint32_t overflow; - uint32_t cqes; - uint64_t resv[2]; -}; - -/* - * io_uring_enter(2) flags - */ -#define IORING_ENTER_GETEVENTS (1U << 0) -#define IORING_ENTER_SQ_WAKEUP (1U << 1) - -/* - * Passed in for io_uring_setup(2). Copied back with updated info on success - */ -struct io_uring_params { - uint32_t sq_entries; - uint32_t cq_entries; - uint32_t flags; - uint32_t sq_thread_cpu; - uint32_t sq_thread_idle; - uint32_t features; - uint32_t wq_fd; - uint32_t resv[3]; - struct io_sqring_offsets sq_off; - struct io_cqring_offsets cq_off; -}; - -/* - * io_uring_params->features flags - */ -#define IORING_FEAT_SINGLE_MMAP (1U << 0) -#define IORING_FEAT_NODROP (1U << 1) -#define IORING_FEAT_SUBMIT_STABLE (1U << 2) -#define IORING_FEAT_RW_CUR_POS (1U << 3) -#define IORING_FEAT_CUR_PERSONALITY (1U << 4) - -/* - * io_uring_register(2) opcodes and arguments - */ -#define IORING_REGISTER_BUFFERS 0 -#define IORING_UNREGISTER_BUFFERS 1 -#define IORING_REGISTER_FILES 2 -#define IORING_UNREGISTER_FILES 3 -#define IORING_REGISTER_EVENTFD 4 -#define IORING_UNREGISTER_EVENTFD 5 -#define IORING_REGISTER_FILES_UPDATE 6 -#define IORING_REGISTER_EVENTFD_ASYNC 7 -#define IORING_REGISTER_PROBE 8 -#define IORING_REGISTER_PERSONALITY 9 -#define IORING_UNREGISTER_PERSONALITY 10 - -struct io_uring_files_update { - uint32_t offset; - uint32_t resv; - uint64_t __attribute__((aligned(8))) fds; -}; - -#define IO_URING_OP_SUPPORTED (1U << 0) - -struct io_uring_probe_op { - uint8_t op; - uint8_t resv; - uint16_t flags; /* IO_URING_OP_* flags */ - uint32_t resv2; -}; - -struct io_uring_probe { - uint8_t last_op; /* last opcode supported */ - uint8_t ops_len; /* length of ops[] array below */ - uint16_t resv; - uint32_t resv2[3]; - struct io_uring_probe_op ops[0]; -}; - -#endif /* IOSQE_FIXED_FILE */ - - -#ifndef HAVE_IO_URING_REGISTER -int io_uring_register(int fd, unsigned int opcode, void *arg, - unsigned int nr_args) -{ - return tst_syscall(__NR_io_uring_register, fd, opcode, arg, nr_args); -} -#endif /* HAVE_IO_URING_REGISTER */ - - -#ifndef HAVE_IO_URING_SETUP -int io_uring_setup(unsigned int entries, struct io_uring_params *p) -{ - return tst_syscall(__NR_io_uring_setup, entries, p); -} -#endif /* HAVE_IO_URING_SETUP */ - -#ifndef HAVE_IO_URING_ENTER -int io_uring_enter(int fd, unsigned int to_submit, unsigned int min_complete, - unsigned int flags, sigset_t *sig) -{ - return tst_syscall(__NR_io_uring_enter, fd, to_submit, min_complete, - flags, sig, _NSIG / 8); -} -#endif /* HAVE_IO_URING_ENTER */ - -#endif /* IO_URING_H__ */ diff --git a/fsstress/include/lapi/ioctl.h b/fsstress/include/lapi/ioctl.h deleted file mode 100644 index ecd2502907..0000000000 --- a/fsstress/include/lapi/ioctl.h +++ /dev/null @@ -1,40 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2020 Cyril Hrubis - * Copyright (c) 2020 Petr Vorel - */ - -#ifndef IOCTL_H__ -#define IOCTL_H__ - -#include "config.h" -#include - -/* musl not including it in */ -#include - -#ifndef TIOCVHANGUP -# define TIOCVHANGUP 0x5437 -#endif - -#ifndef HAVE_STRUCT_TERMIO -# ifndef NCC -# ifdef __powerpc__ -# define NCC 10 -# else -# define NCC 8 -# endif -# endif /* NCC */ - -struct termio - { - unsigned short int c_iflag; /* input mode flags */ - unsigned short int c_oflag; /* output mode flags */ - unsigned short int c_cflag; /* control mode flags */ - unsigned short int c_lflag; /* local mode flags */ - unsigned char c_line; /* line discipline */ - unsigned char c_cc[NCC]; /* control characters */ -}; -#endif /* HAVE_STRUCT_TERMIO */ - -#endif /* IOCTL_H__ */ diff --git a/fsstress/include/lapi/ioctl_ns.h b/fsstress/include/lapi/ioctl_ns.h deleted file mode 100644 index 2fb4f4cfb5..0000000000 --- a/fsstress/include/lapi/ioctl_ns.h +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2019 Federico Bonfiglio fedebonfi95@gmail.com - */ - -#ifndef IOCTL_NS_H__ -#define IOCTL_NS_H__ - -#include - -#ifndef NSIO -#define NSIO 0xb7 -#endif -#ifndef NS_GET_PARENT -#define NS_GET_PARENT _IO(NSIO, 0x2) -#endif -#ifndef NS_GET_OWNER_UID -#define NS_GET_OWNER_UID _IO(NSIO, 0x4) -#endif -#ifndef NS_GET_USERNS -#define NS_GET_USERNS _IO(NSIO, 0x1) -#endif -#ifndef NS_GET_NSTYPE -#define NS_GET_NSTYPE _IO(NSIO, 0x3) -#endif - - -#endif /* IOCTL_NS_H__ */ diff --git a/fsstress/include/lapi/iovec.h b/fsstress/include/lapi/iovec.h deleted file mode 100644 index d479e9f850..0000000000 --- a/fsstress/include/lapi/iovec.h +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2014 Cyril Hrubis - */ - -#ifndef IOVEC_H -#define IOVEC_H - -#include "config.h" - -#if !defined(HAVE_STRUCT_IOVEC) -struct iovec { - void *iov_base; - size_t iov_len; -}; -#else -# include -#endif - -#endif /* IOVEC_H */ diff --git a/fsstress/include/lapi/ipcbuf.h b/fsstress/include/lapi/ipcbuf.h deleted file mode 100644 index a0b8e3ce32..0000000000 --- a/fsstress/include/lapi/ipcbuf.h +++ /dev/null @@ -1,195 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2020 Linaro Limited. All rights reserved. - * Author: Viresh Kumar - */ - -#ifndef IPCBUF_H -#define IPCBUF_H - -#include "config.h" -#include "lapi/posix_types.h" - -#ifndef HAVE_IPC64_PERM - -#if defined(__hppa__) -#define HAVE_IPC64_PERM -/* - * The ipc64_perm structure for PA-RISC is almost identical to - * kern_ipc_perm as we have always had 32-bit UIDs and GIDs in the kernel. - * 'seq' has been changed from long to int so that it's the same size - * on 64-bit kernels as on 32-bit ones. - */ - -struct ipc64_perm -{ - __kernel_key_t key; - __kernel_uid_t uid; - __kernel_gid_t gid; - __kernel_uid_t cuid; - __kernel_gid_t cgid; -#if __BITS_PER_LONG != 64 - unsigned short int __pad1; -#endif - __kernel_mode_t mode; - unsigned short int __pad2; - unsigned short int seq; - unsigned int __pad3; - unsigned long long int __unused1; - unsigned long long int __unused2; -}; -#endif /* __hppa__ */ - -#if defined(__powerpc__) || defined(__powerpc64__) -#define HAVE_IPC64_PERM -/* - * The ipc64_perm structure for the powerpc is identical to - * kern_ipc_perm as we have always had 32-bit UIDs and GIDs in the - * kernel. Note extra padding because this structure is passed back - * and forth between kernel and user space. Pad space is left for: - * - 1 32-bit value to fill up for 8-byte alignment - * - 2 miscellaneous 64-bit values - */ - -struct ipc64_perm -{ - __kernel_key_t key; - __kernel_uid_t uid; - __kernel_gid_t gid; - __kernel_uid_t cuid; - __kernel_gid_t cgid; - __kernel_mode_t mode; - unsigned int seq; - unsigned int __pad1; - unsigned long long __unused1; - unsigned long long __unused2; -}; - -#endif /* defined(__powerpc__) || defined(__powerpc64__) */ - -#if defined(__s390__) -#define HAVE_IPC64_PERM -/* - * The user_ipc_perm structure for S/390 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 32-bit mode_t and seq - * - 2 miscellaneous 32-bit values - */ - -struct ipc64_perm -{ - __kernel_key_t key; - __kernel_uid32_t uid; - __kernel_gid32_t gid; - __kernel_uid32_t cuid; - __kernel_gid32_t cgid; - __kernel_mode_t mode; - unsigned short __pad1; - unsigned short seq; -#ifndef __s390x__ - unsigned short __pad2; -#endif /* ! __s390x__ */ - unsigned long __unused1; - unsigned long __unused2; -}; - -#endif /* defined(__powerpc__) || defined(__powerpc64__) */ - -#if defined(__sparc__) -#define HAVE_IPC64_PERM -/* - * The ipc64_perm structure for sparc/sparc64 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 32-bit seq - * - on sparc for 32 bit mode (it is 32 bit on sparc64) - * - 2 miscellaneous 64-bit values - */ - -struct ipc64_perm -{ - __kernel_key_t key; - __kernel_uid32_t uid; - __kernel_gid32_t gid; - __kernel_uid32_t cuid; - __kernel_gid32_t cgid; -#ifndef __arch64__ - unsigned short __pad0; -#endif - __kernel_mode_t mode; - unsigned short __pad1; - unsigned short seq; - unsigned long long __unused1; - unsigned long long __unused2; -}; - -#endif /* __sparc__ */ - -#if defined(__xtensa__) -#define HAVE_IPC64_PERM -/* - * Pad space is left for: - * - 32-bit mode_t and seq - * - 2 miscellaneous 32-bit values - * - * This file is subject to the terms and conditions of the GNU General - * Public License. See the file "COPYING" in the main directory of - * this archive for more details. - */ - -struct ipc64_perm -{ - __kernel_key_t key; - __kernel_uid32_t uid; - __kernel_gid32_t gid; - __kernel_uid32_t cuid; - __kernel_gid32_t cgid; - __kernel_mode_t mode; - unsigned long seq; - unsigned long __unused1; - unsigned long __unused2; -}; - -#endif /* __xtensa__ */ - -#ifndef HAVE_IPC64_PERM -/* - * The generic ipc64_perm structure: - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * ipc64_perm was originally meant to be architecture specific, but - * everyone just ended up making identical copies without specific - * optimizations, so we may just as well all use the same one. - * - * Pad space is left for: - * - 32-bit mode_t on architectures that only had 16 bit - * - 32-bit seq - * - 2 miscellaneous 32-bit values - */ - -struct ipc64_perm { - __kernel_key_t key; - __kernel_uid32_t uid; - __kernel_gid32_t gid; - __kernel_uid32_t cuid; - __kernel_gid32_t cgid; - __kernel_mode_t mode; - /* pad if mode_t is u16: */ - unsigned char __pad1[4 - sizeof(__kernel_mode_t)]; - unsigned short seq; - unsigned short __pad2; - __kernel_ulong_t __unused1; - __kernel_ulong_t __unused2; -}; - -#endif /* ipc64_perm */ - -#endif /* HAVE_IPC64_PERM */ - -#endif /* IPCBUF_H */ diff --git a/fsstress/include/lapi/keyctl.h b/fsstress/include/lapi/keyctl.h deleted file mode 100644 index c53876e961..0000000000 --- a/fsstress/include/lapi/keyctl.h +++ /dev/null @@ -1,178 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2017 Cyril Hrubis - */ - -#ifndef KEYCTL_H__ -#define KEYCTL_H__ - -#include "config.h" - -#if defined(HAVE_KEYUTILS_H) && defined(HAVE_LIBKEYUTILS) -# include -#else -# ifdef HAVE_LINUX_KEYCTL_H -# include -# endif /* HAVE_LINUX_KEYCTL_H */ - -# include -# include -# include "lapi/syscalls.h" -typedef int32_t key_serial_t; - -static inline key_serial_t add_key(const char *type, - const char *description, - const void *payload, - size_t plen, - key_serial_t ringid) -{ - return tst_syscall(__NR_add_key, - type, description, payload, plen, ringid); -} - -static inline key_serial_t request_key(const char *type, - const char *description, - const char *callout_info, - key_serial_t destringid) -{ - return tst_syscall(__NR_request_key, - type, description, callout_info, destringid); -} - -static inline long keyctl(int cmd, ...) -{ - va_list va; - unsigned long arg2, arg3, arg4, arg5; - - va_start(va, cmd); - arg2 = va_arg(va, unsigned long); - arg3 = va_arg(va, unsigned long); - arg4 = va_arg(va, unsigned long); - arg5 = va_arg(va, unsigned long); - va_end(va); - - return tst_syscall(__NR_keyctl, cmd, arg2, arg3, arg4, arg5); -} - -static inline key_serial_t keyctl_join_session_keyring(const char *name) { - return keyctl(KEYCTL_JOIN_SESSION_KEYRING, name); -} - -#endif /* defined(HAVE_KEYUTILS_H) && defined(HAVE_LIBKEYUTILS) */ - -/* special process keyring shortcut IDs */ -#ifndef KEY_SPEC_THREAD_KEYRING -# define KEY_SPEC_THREAD_KEYRING -1 -#endif - -#ifndef KEY_SPEC_PROCESS_KEYRING -# define KEY_SPEC_PROCESS_KEYRING -2 -#endif - -#ifndef KEY_SPEC_SESSION_KEYRING -# define KEY_SPEC_SESSION_KEYRING -3 -#endif - -#ifndef KEY_SPEC_USER_KEYRING -# define KEY_SPEC_USER_KEYRING -4 -#endif - - -#ifndef KEY_SPEC_USER_SESSION_KEYRING -# define KEY_SPEC_USER_SESSION_KEYRING -5 -#endif - -/* request-key default keyrings */ -#ifndef KEY_REQKEY_DEFL_THREAD_KEYRING -# define KEY_REQKEY_DEFL_THREAD_KEYRING 1 -#endif - -#ifndef KEY_REQKEY_DEFL_SESSION_KEYRING -# define KEY_REQKEY_DEFL_SESSION_KEYRING 3 -#endif - -#ifndef KEY_REQKEY_DEFL_DEFAULT -# define KEY_REQKEY_DEFL_DEFAULT 0 -#endif - -/* keyctl commands */ -#ifndef KEYCTL_GET_KEYRING_ID -# define KEYCTL_GET_KEYRING_ID 0 -#endif - -#ifndef KEYCTL_JOIN_SESSION_KEYRING -# define KEYCTL_JOIN_SESSION_KEYRING 1 -#endif - -#ifndef KEYCTL_UPDATE -# define KEYCTL_UPDATE 2 -#endif - -#ifndef KEYCTL_REVOKE -# define KEYCTL_REVOKE 3 -#endif - -#ifndef KEYCTL_SETPERM -# define KEYCTL_SETPERM 5 -#endif - -#ifndef KEYCTL_CLEAR -# define KEYCTL_CLEAR 7 -#endif - -#ifndef KEYCTL_UNLINK -# define KEYCTL_UNLINK 9 -#endif - -#ifndef KEYCTL_READ -# define KEYCTL_READ 11 -#endif - -#ifndef KEYCTL_SET_REQKEY_KEYRING -# define KEYCTL_SET_REQKEY_KEYRING 14 -#endif - -#ifndef KEYCTL_SET_TIMEOUT -# define KEYCTL_SET_TIMEOUT 15 -#endif - -#ifndef KEYCTL_INVALIDATE -# define KEYCTL_INVALIDATE 21 -#endif - -/* key permissions */ -#ifndef KEY_POS_VIEW -# define KEY_POS_VIEW 0x01000000 -# define KEY_POS_READ 0x02000000 -# define KEY_POS_WRITE 0x04000000 -# define KEY_POS_SEARCH 0x08000000 -# define KEY_POS_LINK 0x10000000 -# define KEY_POS_SETATTR 0x20000000 -# define KEY_POS_ALL 0x3f000000 - -# define KEY_USR_VIEW 0x00010000 -# define KEY_USR_READ 0x00020000 -# define KEY_USR_WRITE 0x00040000 -# define KEY_USR_SEARCH 0x00080000 -# define KEY_USR_LINK 0x00100000 -# define KEY_USR_SETATTR 0x00200000 -# define KEY_USR_ALL 0x003f0000 - -# define KEY_GRP_VIEW 0x00000100 -# define KEY_GRP_READ 0x00000200 -# define KEY_GRP_WRITE 0x00000400 -# define KEY_GRP_SEARCH 0x00000800 -# define KEY_GRP_LINK 0x00001000 -# define KEY_GRP_SETATTR 0x00002000 -# define KEY_GRP_ALL 0x00003f00 - -# define KEY_OTH_VIEW 0x00000001 -# define KEY_OTH_READ 0x00000002 -# define KEY_OTH_WRITE 0x00000004 -# define KEY_OTH_SEARCH 0x00000008 -# define KEY_OTH_LINK 0x00000010 -# define KEY_OTH_SETATTR 0x00000020 -# define KEY_OTH_ALL 0x0000003f -#endif /* !KEY_POS_VIEW */ - -#endif /* KEYCTL_H__ */ diff --git a/fsstress/include/lapi/loop.h b/fsstress/include/lapi/loop.h deleted file mode 100644 index 87a9023175..0000000000 --- a/fsstress/include/lapi/loop.h +++ /dev/null @@ -1,55 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved. - * Author: Yang Xu - */ -#ifndef LAPI_LOOP_H -#define LAPI_LOOP_H - -#include "config.h" -#include -#include - -#ifndef LO_FLAGS_PARTSCAN -# define LO_FLAGS_PARTSCAN 8 -#endif - -#ifndef LO_FLAGS_DIRECT_IO -# define LO_FLAGS_DIRECT_IO 16 -#endif - -#ifndef LOOP_SET_CAPACITY -# define LOOP_SET_CAPACITY 0x4C07 -#endif - -#ifndef LOOP_SET_DIRECT_IO -# define LOOP_SET_DIRECT_IO 0x4C08 -#endif - -#ifndef LOOP_SET_BLOCK_SIZE -# define LOOP_SET_BLOCK_SIZE 0x4C09 -#endif - -#ifndef LOOP_CONFIGURE -# define LOOP_CONFIGURE 0x4C0A -#endif - -#ifndef HAVE_STRUCT_LOOP_CONFIG -/* - * struct loop_config - Complete configuration for a loop device. - * @fd: fd of the file to be used as a backing file for the loop device. - * @block_size: block size to use; ignored if 0. - * @info: struct loop_info64 to configure the loop device with. - * - * This structure is used with the LOOP_CONFIGURE ioctl, and can be used to - * atomically setup and configure all loop device parameters at once. - */ -struct loop_config { - __u32 fd; - __u32 block_size; - struct loop_info64 info; - __u64 __reserved[8]; -}; -#endif - -#endif diff --git a/fsstress/include/lapi/membarrier.h b/fsstress/include/lapi/membarrier.h deleted file mode 100644 index 2b6c57fb35..0000000000 --- a/fsstress/include/lapi/membarrier.h +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2018 Linaro Limited. All rights reserved. - * Author: Rafael David Tinoco - */ - -#ifndef LAPI_MEMBARRIER_H -#define LAPI_MEMBARRIER_H - -/* - * Having is enough to know if the test should run or - * not, but it might not define all needed MEMBARRIER_CMD_* being tested, - * since its first versions included just a few commands. - */ - -enum membarrier_cmd { - MEMBARRIER_CMD_QUERY = 0, - MEMBARRIER_CMD_GLOBAL = (1 << 0), - MEMBARRIER_CMD_GLOBAL_EXPEDITED = (1 << 1), - MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED = (1 << 2), - MEMBARRIER_CMD_PRIVATE_EXPEDITED = (1 << 3), - MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED = (1 << 4), - MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE = (1 << 5), - MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE = (1 << 6), - - /* Alias for header backward compatibility. */ - MEMBARRIER_CMD_SHARED = MEMBARRIER_CMD_GLOBAL, -}; - -#endif diff --git a/fsstress/include/lapi/memfd.h b/fsstress/include/lapi/memfd.h deleted file mode 100644 index e38e671bb0..0000000000 --- a/fsstress/include/lapi/memfd.h +++ /dev/null @@ -1,50 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (C) 2017 Red Hat, Inc. - */ - -#ifndef LAPI_MEMFD_H -#define LAPI_MEMFD_H - -/* flags for memfd_create(2) (unsigned int) */ -#ifndef MFD_CLOEXEC -# define MFD_CLOEXEC 0x0001U -#endif -#ifndef MFD_ALLOW_SEALING -# define MFD_ALLOW_SEALING 0x0002U -#endif - -/* flags for memfd_create(3) and memfd_create(4) */ -#ifndef MFD_HUGETLB -#define MFD_HUGETLB 0x0004U -#endif - -#ifndef MFD_HUGE_64KB -#define MFD_HUGE_64KB (16 << 26) -#endif -#ifndef MFD_HUGE_512KB -#define MFD_HUGE_512KB (19 << 26) -#endif -#ifndef MFD_HUGE_2MB -#define MFD_HUGE_2MB (21 << 26) -#endif -#ifndef MFD_HUGE_8MB -#define MFD_HUGE_8MB (23 << 26) -#endif -#ifndef MFD_HUGE_16MB -#define MFD_HUGE_16MB (24 << 26) -#endif -#ifndef MFD_HUGE_256MB -#define MFD_HUGE_256MB (28 << 26) -#endif -#ifndef MFD_HUGE_1GB -#define MFD_HUGE_1GB (30 << 26) -#endif -#ifndef MFD_HUGE_2GB -#define MFD_HUGE_2GB (31 << 26) -#endif -#ifndef MFD_HUGE_16GB -#define MFD_HUGE_16GB (34 << 26) -#endif - -#endif diff --git a/fsstress/include/lapi/mkdirat.h b/fsstress/include/lapi/mkdirat.h deleted file mode 100644 index bb8c6d8695..0000000000 --- a/fsstress/include/lapi/mkdirat.h +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2014 Cyril Hrubis - */ - -#ifndef __MKDIRAT_H__ -#define __MKDIRAT_H__ - -#include "config.h" -#include "lapi/syscalls.h" -#include "lapi/fcntl.h" - -#ifndef HAVE_MKDIRAT -int mkdirat(int dirfd, const char *dirname, int mode) -{ - return ltp_syscall(__NR_mkdirat, dirfd, dirname, mode); -} -#endif - -#endif /* __MKDIRAT_H__ */ diff --git a/fsstress/include/lapi/mlock2.h b/fsstress/include/lapi/mlock2.h deleted file mode 100644 index fa2b2de07c..0000000000 --- a/fsstress/include/lapi/mlock2.h +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. - * Author: Xiao Yang - */ - -#ifndef LAPI_MLOCK2_H__ -# define LAPI_MLOCK2_H__ - -#include - -#ifndef MLOCK_ONFAULT -# define MLOCK_ONFAULT 0x01 -#endif - -#endif /* LAPI_MLOCK2_H__ */ diff --git a/fsstress/include/lapi/mmap.h b/fsstress/include/lapi/mmap.h deleted file mode 100644 index 12845b76ed..0000000000 --- a/fsstress/include/lapi/mmap.h +++ /dev/null @@ -1,87 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2015 Fujitsu Ltd. - * Author: Guangwen Feng - */ - -#ifndef LAPI_MMAP_H__ -#define LAPI_MMAP_H__ - -#include "config.h" - -#ifndef MAP_HUGETLB -# define MAP_HUGETLB 0x40000 -#endif - -#ifndef MADV_REMOVE -# define MADV_REMOVE 9 -#endif - -#ifndef MADV_DONTFORK -# define MADV_DONTFORK 10 -#endif - -#ifndef MADV_DOFORK -# define MADV_DOFORK 11 -#endif - -#ifndef MADV_HWPOISON -# define MADV_HWPOISON 100 -#endif - -#ifndef MADV_SOFT_OFFLINE -# define MADV_SOFT_OFFLINE 101 -#endif - -#ifndef MADV_MERGEABLE -# define MADV_MERGEABLE 12 -#endif - -#ifndef MADV_UNMERGEABLE -# define MADV_UNMERGEABLE 13 -#endif - -#ifndef MADV_HUGEPAGE -# define MADV_HUGEPAGE 14 -#endif - -#ifndef MADV_NOHUGEPAGE -# define MADV_NOHUGEPAGE 15 -#endif - -#ifndef MADV_DONTDUMP -# define MADV_DONTDUMP 16 -#endif - -#ifndef MADV_DODUMP -# define MADV_DODUMP 17 -#endif - -#ifndef MADV_FREE -# define MADV_FREE 8 -#endif - -#ifndef MADV_WIPEONFORK -# define MADV_WIPEONFORK 18 -# define MADV_KEEPONFORK 19 -#endif - -#ifndef MAP_FIXED_NOREPLACE - -#ifdef __alpha__ -# define MAP_FIXED_NOREPLACE 0x200000 -#else -# define MAP_FIXED_NOREPLACE 0x100000 -#endif - -#endif /* MAP_FIXED_NOREPLACE */ - -#ifdef HAVE_SYS_SHM_H -# include -# define MMAP_GRANULARITY SHMLBA -#else -# include -# define MMAP_GRANULARITY getpagesize() -#endif /* HAVE_SYS_SHM_H */ - -#endif /* LAPI_MMAP_H__ */ diff --git a/fsstress/include/lapi/mount.h b/fsstress/include/lapi/mount.h deleted file mode 100644 index b8ae1f5946..0000000000 --- a/fsstress/include/lapi/mount.h +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2015 Cui Bixuan - */ - -#ifndef __MOUNT_H__ -#define __MOUNT_H__ - -#ifndef MS_REC -#define MS_REC 16384 -#endif - -#ifndef MS_PRIVATE -#define MS_PRIVATE (1<<18) -#endif - -#ifndef MS_STRICTATIME -#define MS_STRICTATIME (1 << 24) -#endif - -#ifndef MNT_DETACH -#define MNT_DETACH 2 -#endif - -#ifndef MNT_EXPIRE -#define MNT_EXPIRE 4 -#endif - -#ifndef UMOUNT_NOFOLLOW -#define UMOUNT_NOFOLLOW 8 -#endif - -#endif /* __MOUNT_H__ */ diff --git a/fsstress/include/lapi/msgbuf.h b/fsstress/include/lapi/msgbuf.h deleted file mode 100644 index f3277270dd..0000000000 --- a/fsstress/include/lapi/msgbuf.h +++ /dev/null @@ -1,306 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2020 Linaro Limited. All rights reserved. - * Author: Viresh Kumar - */ - -#ifndef IPC_MSGBUF_H -#define IPC_MSGBUF_H - -#include "lapi/posix_types.h" -#include -#include "tst_timer.h" -#include "ipcbuf.h" - -#ifndef HAVE_MSQID64_DS - -#if defined(__mips__) -#define HAVE_MSQID64_DS - -#if defined(__arch64__) -/* - * The msqid64_ds structure for the MIPS architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 2 miscellaneous unsigned long values - */ - -struct msqid64_ds { - struct ipc64_perm msg_perm; - long msg_stime; /* last msgsnd time */ - long msg_rtime; /* last msgrcv time */ - long msg_ctime; /* last change time */ - unsigned long msg_cbytes; /* current number of bytes on queue */ - unsigned long msg_qnum; /* number of messages in queue */ - unsigned long msg_qbytes; /* max number of bytes on queue */ - __kernel_pid_t msg_lspid; /* pid of last msgsnd */ - __kernel_pid_t msg_lrpid; /* last receive pid */ - unsigned long __unused4; - unsigned long __unused5; -}; -#elif defined (__MIPSEB__) -#define HAVE_MSQID64_DS_TIME_HIGH -struct msqid64_ds { - struct ipc64_perm msg_perm; - unsigned long msg_stime_high; - unsigned long msg_stime; /* last msgsnd time */ - unsigned long msg_rtime_high; - unsigned long msg_rtime; /* last msgrcv time */ - unsigned long msg_ctime_high; - unsigned long msg_ctime; /* last change time */ - unsigned long msg_cbytes; /* current number of bytes on queue */ - unsigned long msg_qnum; /* number of messages in queue */ - unsigned long msg_qbytes; /* max number of bytes on queue */ - __kernel_pid_t msg_lspid; /* pid of last msgsnd */ - __kernel_pid_t msg_lrpid; /* last receive pid */ - unsigned long __unused4; - unsigned long __unused5; -}; -#elif defined (__MIPSEL__) -#define HAVE_MSQID64_DS_TIME_HIGH -struct msqid64_ds { - struct ipc64_perm msg_perm; - unsigned long msg_stime; /* last msgsnd time */ - unsigned long msg_stime_high; - unsigned long msg_rtime; /* last msgrcv time */ - unsigned long msg_rtime_high; - unsigned long msg_ctime; /* last change time */ - unsigned long msg_ctime_high; - unsigned long msg_cbytes; /* current number of bytes on queue */ - unsigned long msg_qnum; /* number of messages in queue */ - unsigned long msg_qbytes; /* max number of bytes on queue */ - __kernel_pid_t msg_lspid; /* pid of last msgsnd */ - __kernel_pid_t msg_lrpid; /* last receive pid */ - unsigned long __unused4; - unsigned long __unused5; -}; -#endif - -#endif /* __mips__ */ - -#if defined(__hppa__) -#define HAVE_MSQID64_DS -/* - * The msqid64_ds structure for parisc architecture, copied from sparc. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 2 miscellaneous 32-bit values - */ - -struct msqid64_ds { - struct ipc64_perm msg_perm; -#if __BITS_PER_LONG == 64 - long msg_stime; /* last msgsnd time */ - long msg_rtime; /* last msgrcv time */ - long msg_ctime; /* last change time */ -#else -#define HAVE_MSQID64_DS_TIME_HIGH - unsigned long msg_stime_high; - unsigned long msg_stime; /* last msgsnd time */ - unsigned long msg_rtime_high; - unsigned long msg_rtime; /* last msgrcv time */ - unsigned long msg_ctime_high; - unsigned long msg_ctime; /* last change time */ -#endif - unsigned long msg_cbytes; /* current number of bytes on queue */ - unsigned long msg_qnum; /* number of messages in queue */ - unsigned long msg_qbytes; /* max number of bytes on queue */ - __kernel_pid_t msg_lspid; /* pid of last msgsnd */ - __kernel_pid_t msg_lrpid; /* last receive pid */ - unsigned long __unused1; - unsigned long __unused2; -}; - -#endif /* __hppa__ */ - -#if defined(__powerpc__) || defined(__powerpc64__) -#define HAVE_MSQID64_DS -/* - * The msqid64_ds structure for the PowerPC architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - */ - -struct msqid64_ds { - struct ipc64_perm msg_perm; -#ifdef __powerpc64__ - long msg_stime; /* last msgsnd time */ - long msg_rtime; /* last msgrcv time */ - long msg_ctime; /* last change time */ -#else -#define HAVE_MSQID64_DS_TIME_HIGH - unsigned long msg_stime_high; - unsigned long msg_stime; /* last msgsnd time */ - unsigned long msg_rtime_high; - unsigned long msg_rtime; /* last msgrcv time */ - unsigned long msg_ctime_high; - unsigned long msg_ctime; /* last change time */ -#endif - unsigned long msg_cbytes; /* current number of bytes on queue */ - unsigned long msg_qnum; /* number of messages in queue */ - unsigned long msg_qbytes; /* max number of bytes on queue */ - __kernel_pid_t msg_lspid; /* pid of last msgsnd */ - __kernel_pid_t msg_lrpid; /* last receive pid */ - unsigned long __unused4; - unsigned long __unused5; -}; - -#endif /* defined(__powerpc__) || defined(__powerpc64__) */ - -#if defined(__sparc__) -#define HAVE_MSQID64_DS -/* - * The msqid64_ds structure for sparc64 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 2 miscellaneous 32-bit values - */ -struct msqid64_ds { - struct ipc64_perm msg_perm; -#if defined(__arch64__) - long msg_stime; /* last msgsnd time */ - long msg_rtime; /* last msgrcv time */ - long msg_ctime; /* last change time */ -#else -#define HAVE_MSQID64_DS_TIME_HIGH - unsigned long msg_stime_high; - unsigned long msg_stime; /* last msgsnd time */ - unsigned long msg_rtime_high; - unsigned long msg_rtime; /* last msgrcv time */ - unsigned long msg_ctime_high; - unsigned long msg_ctime; /* last change time */ -#endif - unsigned long msg_cbytes; /* current number of bytes on queue */ - unsigned long msg_qnum; /* number of messages in queue */ - unsigned long msg_qbytes; /* max number of bytes on queue */ - __kernel_pid_t msg_lspid; /* pid of last msgsnd */ - __kernel_pid_t msg_lrpid; /* last receive pid */ - unsigned long __unused1; - unsigned long __unused2; -}; - -#endif /* __sparc__ */ - -#if defined(__x86_64__) && defined(__ILP32__) -#define HAVE_MSQID64_DS -/* - * The msqid64_ds structure for x86 architecture with x32 ABI. - * - * On x86-32 and x86-64 we can just use the generic definition, but - * x32 uses the same binary layout as x86_64, which is differnet - * from other 32-bit architectures. - */ - -struct msqid64_ds { - struct ipc64_perm msg_perm; - __kernel_long_t msg_stime; /* last msgsnd time */ - __kernel_long_t msg_rtime; /* last msgrcv time */ - __kernel_long_t msg_ctime; /* last change time */ - __kernel_ulong_t msg_cbytes; /* current number of bytes on queue */ - __kernel_ulong_t msg_qnum; /* number of messages in queue */ - __kernel_ulong_t msg_qbytes; /* max number of bytes on queue */ - __kernel_pid_t msg_lspid; /* pid of last msgsnd */ - __kernel_pid_t msg_lrpid; /* last receive pid */ - __kernel_ulong_t __unused4; - __kernel_ulong_t __unused5; -}; - -#endif /* defined(__x86_64__) && defined(__ILP32__) */ - -#if defined(__xtensa__) -#define HAVE_MSQID64_DS -/* - * The msqid64_ds structure for the Xtensa architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 2 miscellaneous 32-bit values - */ - -struct msqid64_ds { - struct ipc64_perm msg_perm; -#ifdef __XTENSA_EB__ -#define HAVE_MSQID64_DS_TIME_HIGH - unsigned long msg_stime_high; - unsigned long msg_stime; /* last msgsnd time */ - unsigned long msg_rtime_high; - unsigned long msg_rtime; /* last msgrcv time */ - unsigned long msg_ctime_high; - unsigned long msg_ctime; /* last change time */ -#elif defined(__XTENSA_EL__) -#define HAVE_MSQID64_DS_TIME_HIGH - unsigned long msg_stime; /* last msgsnd time */ - unsigned long msg_stime_high; - unsigned long msg_rtime; /* last msgrcv time */ - unsigned long msg_rtime_high; - unsigned long msg_ctime; /* last change time */ - unsigned long msg_ctime_high; -#else -# error processor byte order undefined! -#endif - unsigned long msg_cbytes; /* current number of bytes on queue */ - unsigned long msg_qnum; /* number of messages in queue */ - unsigned long msg_qbytes; /* max number of bytes on queue */ - __kernel_pid_t msg_lspid; /* pid of last msgsnd */ - __kernel_pid_t msg_lrpid; /* last receive pid */ - unsigned long __unused4; - unsigned long __unused5; -}; - -#endif /* __xtensa__ */ - -#ifndef HAVE_MSQID64_DS -/* - * generic msqid64_ds structure. - * - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * msqid64_ds was originally meant to be architecture specific, but - * everyone just ended up making identical copies without specific - * optimizations, so we may just as well all use the same one. - * - * 64 bit architectures use a 64-bit long time field here, while - * 32 bit architectures have a pair of unsigned long values. - * On big-endian systems, the lower half is in the wrong place. - * - * Pad space is left for: - * - 2 miscellaneous 32-bit values - */ - -struct msqid64_ds { - struct ipc64_perm msg_perm; -#if __BITS_PER_LONG == 64 - long msg_stime; /* last msgsnd time */ - long msg_rtime; /* last msgrcv time */ - long msg_ctime; /* last change time */ -#else -#define HAVE_MSQID64_DS_TIME_HIGH - unsigned long msg_stime; /* last msgsnd time */ - unsigned long msg_stime_high; - unsigned long msg_rtime; /* last msgrcv time */ - unsigned long msg_rtime_high; - unsigned long msg_ctime; /* last change time */ - unsigned long msg_ctime_high; -#endif - unsigned long msg_cbytes; /* current number of bytes on queue */ - unsigned long msg_qnum; /* number of messages in queue */ - unsigned long msg_qbytes; /* max number of bytes on queue */ - __kernel_pid_t msg_lspid; /* pid of last msgsnd */ - __kernel_pid_t msg_lrpid; /* last receive pid */ - unsigned long __unused4; - unsigned long __unused5; -}; - -#endif /* msqid64_ds */ - -#endif /* HAVE_MSQID64_DS */ - -#endif /* IPC_MSGBUF_H */ diff --git a/fsstress/include/lapi/namespaces_constants.h b/fsstress/include/lapi/namespaces_constants.h deleted file mode 100644 index 8f73c43026..0000000000 --- a/fsstress/include/lapi/namespaces_constants.h +++ /dev/null @@ -1,31 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2015 Red Hat, Inc. - */ - -#ifndef __NAMESPACES_CONSTANTS_H__ -#define __NAMESPACES_CONSTANTS_H__ - -#ifndef CLONE_NEWIPC -# define CLONE_NEWIPC 0x08000000 -#endif -#ifndef CLONE_NEWNS -# define CLONE_NEWNS 0x00020000 -#endif -#ifndef CLONE_NEWNET -# define CLONE_NEWNET 0x40000000 -#endif -#ifndef CLONE_NEWPID -# define CLONE_NEWPID 0x20000000 -#endif -#ifndef CLONE_NEWUSER -# define CLONE_NEWUSER 0x10000000 -#endif -#ifndef CLONE_NEWUTS -# define CLONE_NEWUTS 0x04000000 -#endif -#ifndef CLONE_NEWTIME -# define CLONE_NEWTIME 0x00000080 -#endif - -#endif /* __NAMESPACES_CONSTANTS_H__ */ diff --git a/fsstress/include/lapi/netinet_in.h b/fsstress/include/lapi/netinet_in.h deleted file mode 100644 index e88485c5ca..0000000000 --- a/fsstress/include/lapi/netinet_in.h +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2017 Petr Vorel - */ - -#ifndef LAPI_IN_H__ -#define LAPI_IN_H__ - -#include - -#ifndef IPPROTO_DCCP -#define IPPROTO_DCCP 33 -#endif - -#ifndef IPPROTO_UDPLITE -# define IPPROTO_UDPLITE 136 /* UDP-Lite (RFC 3828) */ -#endif - -#ifndef IP_BIND_ADDRESS_NO_PORT -# define IP_BIND_ADDRESS_NO_PORT 24 -#endif - -#endif /* LAPI_IN_H__ */ diff --git a/fsstress/include/lapi/openat2.h b/fsstress/include/lapi/openat2.h deleted file mode 100644 index 62da1a04c8..0000000000 --- a/fsstress/include/lapi/openat2.h +++ /dev/null @@ -1,72 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2020 Linaro Limited. All rights reserved. - * Author: Viresh Kumar - */ - -#ifndef OPENAT2_H -#define OPENAT2_H - -#include -#include - -#include "lapi/syscalls.h" - -#include "config.h" - -#ifndef HAVE_OPENAT2 -/* - * Arguments for how openat2(2) should open the target path. If only @flags and - * @mode are non-zero, then openat2(2) operates very similarly to openat(2). - * - * However, unlike openat(2), unknown or invalid bits in @flags result in - * -EINVAL rather than being silently ignored. @mode must be zero unless one of - * {O_CREAT, O_TMPFILE} are set. - * - * @flags: O_* flags. - * @mode: O_CREAT/O_TMPFILE file mode. - * @resolve: RESOLVE_* flags. - */ -struct open_how { - uint64_t flags; - uint64_t mode; - uint64_t resolve; -}; - -/* how->resolve flags for openat2(2). */ -#define RESOLVE_NO_XDEV 0x01 /* Block mount-point crossings - (includes bind-mounts). */ -#define RESOLVE_NO_MAGICLINKS 0x02 /* Block traversal through procfs-style - "magic-links". */ -#define RESOLVE_NO_SYMLINKS 0x04 /* Block traversal through all symlinks - (implies OEXT_NO_MAGICLINKS) */ -#define RESOLVE_BENEATH 0x08 /* Block "lexical" trickery like - "..", symlinks, and absolute - paths which escape the dirfd. */ -#define RESOLVE_IN_ROOT 0x10 /* Make all jumps to "/" and ".." - be scoped inside the dirfd - (similar to chroot(2)). */ - -int openat2(int dfd, const char *pathname, struct open_how *how, size_t size) -{ - return tst_syscall(__NR_openat2, dfd, pathname, how, size); -} -#endif - -struct open_how_pad { - /* how should be kept as the first entry here */ - struct open_how how; - uint64_t pad; -}; - -void openat2_supported_by_kernel(void) -{ - if ((tst_kvercmp(5, 6, 0)) < 0) { - /* Check if the syscall is backported on an older kernel */ - TEST(syscall(__NR_openat2, -1, NULL, NULL, 0)); - if (TST_RET == -1 && TST_ERR == ENOSYS) - tst_brk(TCONF, "Test not supported on kernel version < v5.6"); - } -} - -#endif /* OPENAT2_H */ diff --git a/fsstress/include/lapi/personality.h b/fsstress/include/lapi/personality.h deleted file mode 100644 index 6b4b7ebf36..0000000000 --- a/fsstress/include/lapi/personality.h +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2017 Richard Palethorpe - */ - -/* In the Linux kernel and glibc enums are (mostly) used for the constants, - * but in musl macros are used. - */ - -#ifndef PERSONALITY_H -#define PERSONALITY_H - -#include - -#ifndef UNAME26 -# define UNAME26 0x0020000 -#endif - -#ifndef READ_IMPLIES_EXEC -# define READ_IMPLIES_EXEC 0x0400000 -#endif - -#endif /* PERSONALITY_H */ diff --git a/fsstress/include/lapi/pidfd_open.h b/fsstress/include/lapi/pidfd_open.h deleted file mode 100644 index 9f532f86e1..0000000000 --- a/fsstress/include/lapi/pidfd_open.h +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2020 Linaro Limited. All rights reserved. - * Author: Viresh Kumar - */ - -#ifndef PIDFD_OPEN_H -#define PIDFD_OPEN_H - -#include -#include - -#include "lapi/syscalls.h" - -#include "config.h" - -#ifndef HAVE_PIDFD_OPEN -int pidfd_open(pid_t pid, unsigned int flags) -{ - return tst_syscall(__NR_pidfd_open, pid, flags); -} -#endif - -#endif /* PIDFD_OPEN_H */ diff --git a/fsstress/include/lapi/pidfd_send_signal.h b/fsstress/include/lapi/pidfd_send_signal.h deleted file mode 100644 index 8352d2adf7..0000000000 --- a/fsstress/include/lapi/pidfd_send_signal.h +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2019 SUSE LLC - * Author: Christian Amann - */ - -#ifndef PIDFD_SEND_SIGNAL_H -#define PIDFD_SEND_SIGNAL_H - -#include "tst_test.h" -#include "lapi/syscalls.h" - -static inline void pidfd_send_signal_supported(void) -{ - /* allow the tests to fail early */ - tst_syscall(__NR_pidfd_send_signal); -} - -#ifndef HAVE_PIDFD_SEND_SIGNAL -static int pidfd_send_signal(int pidfd, int sig, siginfo_t *info, - unsigned int flags) -{ - return tst_syscall(__NR_pidfd_send_signal, pidfd, sig, info, flags); -} -#endif /* HAVE_PIDFD_SEND_SIGNAL */ - -#endif /* PIDFD_SEND_SIGNAL_H */ diff --git a/fsstress/include/lapi/posix_clocks.h b/fsstress/include/lapi/posix_clocks.h deleted file mode 100644 index ae2139fe3a..0000000000 --- a/fsstress/include/lapi/posix_clocks.h +++ /dev/null @@ -1,42 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2019, Linux Test Project - * Copyright (c) 2013 Cyril Hrubis - */ - -#include - -#ifndef POSIX_CLOCKS_H__ -#define POSIX_CLOCKS_H__ - -#define MAX_CLOCKS 16 - -#ifndef CLOCK_MONOTONIC_RAW -# define CLOCK_MONOTONIC_RAW 4 -#endif - -#ifndef CLOCK_REALTIME_COARSE -# define CLOCK_REALTIME_COARSE 5 -#endif - -#ifndef CLOCK_MONOTONIC_COARSE -# define CLOCK_MONOTONIC_COARSE 6 -#endif - -#ifndef CLOCK_BOOTTIME -# define CLOCK_BOOTTIME 7 -#endif - -#ifndef CLOCK_REALTIME_ALARM -# define CLOCK_REALTIME_ALARM 8 -#endif - -#ifndef CLOCK_BOOTTIME_ALARM -# define CLOCK_BOOTTIME_ALARM 9 -#endif - -#ifndef CLOCK_TAI -#define CLOCK_TAI 11 -#endif - -#endif /* POSIX_CLOCKS_H__ */ diff --git a/fsstress/include/lapi/posix_types.h b/fsstress/include/lapi/posix_types.h deleted file mode 100644 index 9c0947cca6..0000000000 --- a/fsstress/include/lapi/posix_types.h +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) Linux Test Project, 2014-2019 - */ - -#ifndef POSIX_TYPES_H__ -#define POSIX_TYPES_H__ - -#include - -#ifndef __kernel_long_t -# if defined(__x86_64__) && defined(__ILP32__) -typedef long long __kernel_long_t; -typedef unsigned long long __kernel_ulong_t; -# else -typedef long __kernel_long_t; -typedef unsigned long __kernel_ulong_t; -# endif -#endif - -#endif /* POSIX_TYPES_H__ */ diff --git a/fsstress/include/lapi/prctl.h b/fsstress/include/lapi/prctl.h deleted file mode 100644 index 4499df0302..0000000000 --- a/fsstress/include/lapi/prctl.h +++ /dev/null @@ -1,55 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. - * Author: Xiao Yang - */ - -#ifndef LAPI_PRCTL_H__ -# define LAPI_PRCTL_H__ - -#include - -#ifndef PR_SET_NAME -# define PR_SET_NAME 15 -# define PR_GET_NAME 16 -#endif - -#ifndef PR_SET_SECCOMP -# define PR_GET_SECCOMP 21 -# define PR_SET_SECCOMP 22 -#endif - -#ifndef PR_SET_TIMERSLACK -# define PR_SET_TIMERSLACK 29 -# define PR_GET_TIMERSLACK 30 -#endif - -#ifndef PR_SET_CHILD_SUBREAPER -# define PR_SET_CHILD_SUBREAPER 36 -# define PR_GET_CHILD_SUBREAPER 37 -#endif - -#ifndef PR_SET_NO_NEW_PRIVS -# define PR_SET_NO_NEW_PRIVS 38 -# define PR_GET_NO_NEW_PRIVS 39 -#endif - -#ifndef PR_SET_THP_DISABLE -# define PR_SET_THP_DISABLE 41 -# define PR_GET_THP_DISABLE 42 -#endif - -#ifndef PR_CAP_AMBIENT -# define PR_CAP_AMBIENT 47 -# define PR_CAP_AMBIENT_IS_SET 1 -# define PR_CAP_AMBIENT_RAISE 2 -# define PR_CAP_AMBIENT_LOWER 3 -# define PR_CAP_AMBIENT_CLEAR_ALL 4 -#endif - -#ifndef PR_GET_SPECULATION_CTRL -# define PR_GET_SPECULATION_CTRL 52 -# define PR_SET_SPECULATION_CTRL 53 -#endif - -#endif /* LAPI_PRCTL_H__ */ diff --git a/fsstress/include/lapi/preadv2.h b/fsstress/include/lapi/preadv2.h deleted file mode 100644 index 538ed72181..0000000000 --- a/fsstress/include/lapi/preadv2.h +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. - * Author: Xiao Yang - */ - -#ifndef PREADV2_H -#define PREADV2_H - -#include "config.h" -#include "lapi/syscalls.h" - -#ifndef RWF_NOWAIT -# define RWF_NOWAIT 0x00000008 -#endif - -#if !defined(HAVE_PREADV2) - -/* LO_HI_LONG taken from glibc */ -# define LO_HI_LONG(val) (long) (val), (long) (((uint64_t) (val)) >> 32) - -ssize_t preadv2(int fd, const struct iovec *iov, int iovcnt, off_t offset, - int flags) -{ - return tst_syscall(__NR_preadv2, fd, iov, iovcnt, - LO_HI_LONG(offset), flags); -} -#endif - -#endif /* PREADV2_H */ diff --git a/fsstress/include/lapi/pwritev2.h b/fsstress/include/lapi/pwritev2.h deleted file mode 100644 index 305e48e028..0000000000 --- a/fsstress/include/lapi/pwritev2.h +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved. - * Author: Jinhui Huang - */ - -#ifndef PWRITEV2_H -#define PWRITEV2_H - -#include "config.h" -#include "lapi/syscalls.h" - -#if !defined(HAVE_PWRITEV2) - -/* LO_HI_LONG taken from glibc */ -# define LO_HI_LONG(val) (long) (val), (long) (((uint64_t) (val)) >> 32) - -ssize_t pwritev2(int fd, const struct iovec *iov, int iovcnt, off_t offset, - int flags) -{ - return tst_syscall(__NR_pwritev2, fd, iov, iovcnt, - LO_HI_LONG(offset), flags); -} -#endif - -#endif /* PWRITEV2_H */ diff --git a/fsstress/include/lapi/quotactl.h b/fsstress/include/lapi/quotactl.h deleted file mode 100644 index c1ec9d6e1f..0000000000 --- a/fsstress/include/lapi/quotactl.h +++ /dev/null @@ -1,78 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2017-2019 Fujitsu Ltd. - * Author: Xiao Yang - * Author: Yang Xu - */ - -#ifndef LAPI_QUOTACTL_H__ -#define LAPI_QUOTACTL_H__ - -#include - -#ifdef HAVE_STRUCT_IF_NEXTDQBLK -# include -#else -# include -struct if_nextdqblk { - uint64_t dqb_bhardlimit; - uint64_t dqb_bsoftlimit; - uint64_t dqb_curspace; - uint64_t dqb_ihardlimit; - uint64_t dqb_isoftlimit; - uint64_t dqb_curinodes; - uint64_t dqb_btime; - uint64_t dqb_itime; - uint32_t dqb_valid; - uint32_t dqb_id; -}; -#endif /* HAVE_STRUCT_IF_NEXTDQBLK */ - -#ifndef HAVE_STRUCT_FS_QUOTA_STATV -# include -struct fs_qfilestatv { - uint64_t qfs_ino; - uint64_t qfs_nblks; - uint32_t qfs_nextents; - uint32_t qfs_pad; -}; - -struct fs_quota_statv { - int8_t qs_version; - uint8_t qs_pad1; - uint16_t qs_flags; - uint32_t qs_incoredqs; - struct fs_qfilestatv qs_uquota; - struct fs_qfilestatv qs_gquota; - struct fs_qfilestatv qs_pquota; - int32_t qs_btimelimit; - int32_t qs_itimelimit; - int32_t qs_rtbtimelimit; - uint16_t qs_bwarnlimit; - uint16_t qs_iwarnlimit; - uint64_t qs_pad2[8]; -}; -# define FS_QSTATV_VERSION1 1 -#endif /* HAVE_STRUCT_FS_QUOTA_STATV */ - -#ifndef PRJQUOTA -# define PRJQUOTA 2 -#endif - -#ifndef Q_XQUOTARM -# define Q_XQUOTARM XQM_CMD(6) -#endif - -#ifndef Q_XGETQSTATV -# define Q_XGETQSTATV XQM_CMD(8) -#endif - -#ifndef Q_XGETNEXTQUOTA -# define Q_XGETNEXTQUOTA XQM_CMD(9) -#endif - -#ifndef Q_GETNEXTQUOTA -# define Q_GETNEXTQUOTA 0x800009 /* get disk limits and usage >= ID */ -#endif - -#endif /* LAPI_QUOTACTL_H__ */ diff --git a/fsstress/include/lapi/readdir.h b/fsstress/include/lapi/readdir.h deleted file mode 100644 index 84e77ae0ab..0000000000 --- a/fsstress/include/lapi/readdir.h +++ /dev/null @@ -1,19 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2014 Fujitsu Ltd. - * Author: Zeng Linggang - */ - -#ifndef READDIR_H -#define READDIR_H - -#include - -struct old_linux_dirent { - long d_ino; /* inode number */ - off_t d_off; /* offset to this old_linux_dirent */ - unsigned short d_reclen; /* length of this d_name */ - char d_name[NAME_MAX+1]; /* filename (null-terminated) */ -}; - -#endif /* READDIR_H */ diff --git a/fsstress/include/lapi/readlinkat.h b/fsstress/include/lapi/readlinkat.h deleted file mode 100644 index 5a3a7b2d60..0000000000 --- a/fsstress/include/lapi/readlinkat.h +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2014 Cyril Hrubis - */ - -#ifndef __READLINKAT_H__ -#define __READLINKAT_H__ - -#include "config.h" -#include "lapi/syscalls.h" -#include "lapi/fcntl.h" - -#ifndef HAVE_READLINKAT -int readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz) -{ - return ltp_syscall(__NR_readlinkat, dirfd, pathname, buf, bufsiz); -} -#endif - -#endif /* __READLINKAT_H__ */ diff --git a/fsstress/include/lapi/renameat.h b/fsstress/include/lapi/renameat.h deleted file mode 100644 index 66d3e21401..0000000000 --- a/fsstress/include/lapi/renameat.h +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) International Business Machines Corp., 2007 - * Copyright (c) 2014 Fujitsu Ltd. - */ - -#ifndef RENAMEAT_H -#define RENAMEAT_H - -#include -#include "config.h" -#include "lapi/syscalls.h" - -#if !defined(HAVE_RENAMEAT) -int renameat(int olddirfd, const char *oldpath, int newdirfd, - const char *newpath) -{ - return ltp_syscall(__NR_renameat, olddirfd, oldpath, newdirfd, - newpath); -} -#endif - -#endif /* RENAMEAT_H */ diff --git a/fsstress/include/lapi/rt_sigaction.h b/fsstress/include/lapi/rt_sigaction.h deleted file mode 100644 index 3af91362f6..0000000000 --- a/fsstress/include/lapi/rt_sigaction.h +++ /dev/null @@ -1,245 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2009 Cisco Systems, Inc. All Rights Reserved. - * Copyright (c) 2009 FUJITSU LIMITED. All Rights Reserved. - * Author: Liu Bo - * Author: Ngie Cooper - */ - -#ifndef LTP_RT_SIGACTION_H -#define LTP_RT_SIGACTION_H - -#include "ltp_signal.h" - -#define INVAL_SA_PTR ((void *)-1) - -#if defined(__mips__) -struct kernel_sigaction { - unsigned int sa_flags; - void (* k_sa_handler)(int); - sigset_t sa_mask; -}; -#else -struct kernel_sigaction { - void (* k_sa_handler)(int); - unsigned long sa_flags; - void (*sa_restorer) (void); - sigset_t sa_mask; -}; -#endif - -/* This macro marks if (struct sigaction) has .sa_restorer member */ -#if !defined(__ia64__) && !defined(__alpha__) && !defined(__hppa__) && !defined(__mips__) -# define HAVE_SA_RESTORER -#endif - -#ifdef __x86_64__ - -/* - * From asm/signal.h -- this value isn't exported anywhere outside of glibc and - * asm/signal.h and is only required for the rt_sig* function family because - * sigaction(2), et all, appends this if necessary to - * (struct sigaction).sa_flags. HEH. - * - * I do #undef though, just in case... - * - * Also, from .../arch/x86/kernel/signal.c:448 for v2.6.30 (something or - * other): - * - * x86-64 should always use SA_RESTORER. - * - * -- thus SA_RESTORER must always be defined along with - * (struct sigaction).sa_restorer for this architecture. - */ -#undef SA_RESTORER -#define SA_RESTORER 0x04000000 - -void (*restore_rt)(void); - -static void handler_h(int signal) -{ - return; -} - -/* Setup an initial signal handler for signal number = sig for x86_64. */ -static inline int sig_initial(int sig) -{ - int ret_code = -1; - struct sigaction act, oact; - - act.sa_handler = handler_h; - act.sa_flags = 0; - /* Clear out the signal set. */ - if (sigemptyset(&act.sa_mask) < 0) { - /* Add the signal to the mask set. */ - } else if (sigaddset(&act.sa_mask, sig) < 0) { - /* Set act.sa_restorer via syscall(2) */ - } else if (sigaction(sig, &act, &oact) < 0) { - /* Copy oact.sa_restorer via syscall(2) */ - } else if (sigaction(sig, &act, &oact) < 0) { - /* And voila -- we just tricked the kernel into giving us our - * restorer function! */ - } else { - restore_rt = oact.sa_restorer; - ret_code = 0; - } - - return ret_code; -} - -#endif /* __x86_64__ */ - -#ifdef __sparc__ -# if defined __arch64__ || defined __sparcv9 - -/* - * Based on glibc/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c - */ - -extern char *__rt_sig_stub; - -static void __attribute__((used)) __rt_sigreturn_stub(void) -{ - __asm__ ("__rt_sig_stub: mov %0, %%g1\n\t" - "ta 0x6d\n\t" - : /* no outputs */ - : "i" (__NR_rt_sigreturn)); -} - -# else /* sparc32 */ - -/* - * Based on glibc/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c - */ - -extern char *__rt_sig_stub, *__sig_stub; - -static void __attribute__((used)) __rt_sigreturn_stub(void) -{ - __asm__ ("__rt_sig_stub: mov %0, %%g1\n\t" - "ta 0x10\n\t" - : /* no outputs */ - : "i" (__NR_rt_sigreturn)); -} - -static void __attribute__((used)) __sigreturn_stub(void) -{ - __asm__ ("__sig_stub: mov %0, %%g1\n\t" - "ta 0x10\n\t" - : /* no outputs */ - : "i" (__NR_sigreturn)); -} - -# endif -#endif /* __sparc__ */ - -#ifdef __arc__ - -#undef SA_RESTORER -#define SA_RESTORER 0x04000000 - -/* - * based on uClibc/libc/sysdeps/linux/arc/sigaction.c - */ -static void -__attribute__ ((optimize("Os"))) __attribute__((used)) restore_rt(void) -{ - __asm__ ( - "mov r8, %0 \n\t" -#ifdef __ARCHS__ - "trap_s 0 \n\t" -#else - "trap0 \n\t" -#endif - : /* no outputs */ - : "i" (__NR_rt_sigreturn) - : "r8"); -} -#endif - -#ifdef TST_TEST_H__ -# define TST_SYSCALL tst_syscall -#else -# define TST_SYSCALL ltp_syscall -#endif - -/* This is a wrapper for __NR_rt_sigaction syscall. - * act/oact values of INVAL_SA_PTR is used to pass - * an invalid pointer to syscall(__NR_rt_sigaction) - * - * Based on glibc/sysdeps/unix/sysv/linux/{...}/sigaction.c - */ - -static int ltp_rt_sigaction(int signum, const struct sigaction *act, - struct sigaction *oact, size_t sigsetsize) -{ - int ret; - struct kernel_sigaction kact, koact; - struct kernel_sigaction *kact_p = NULL; - struct kernel_sigaction *koact_p = NULL; - - if (act == INVAL_SA_PTR) { - kact_p = INVAL_SA_PTR; - } else if (act) { - kact.k_sa_handler = act->sa_handler; - memcpy(&kact.sa_mask, &act->sa_mask, sizeof(sigset_t)); - kact.sa_flags = act->sa_flags; -#ifndef __mips__ - kact.sa_restorer = NULL; -#endif - kact_p = &kact; - } - - if (oact == INVAL_SA_PTR) - koact_p = INVAL_SA_PTR; - else if (oact) - koact_p = &koact; - -#ifdef __x86_64__ - sig_initial(signum); -#endif - -#if defined __x86_64__ || defined __arc__ - kact.sa_flags |= SA_RESTORER; - kact.sa_restorer = restore_rt; -#endif - -#ifdef __sparc__ - unsigned long stub = 0; -# if defined __arch64__ || defined __sparcv9 - stub = ((unsigned long) &__rt_sig_stub) - 8; -# else /* sparc32 */ - if ((kact.sa_flags & SA_SIGINFO) != 0) - stub = ((unsigned long) &__rt_sig_stub) - 8; - else - stub = ((unsigned long) &__sig_stub) - 8; -# endif -#endif - - -#ifdef __sparc__ - ret = TST_SYSCALL(__NR_rt_sigaction, signum, - kact_p, koact_p, - stub, sigsetsize); -#else - ret = TST_SYSCALL(__NR_rt_sigaction, signum, - kact_p, koact_p, - sigsetsize); -#endif - - if (ret >= 0) { - if (oact && (oact != INVAL_SA_PTR)) { - oact->sa_handler = koact.k_sa_handler; - memcpy(&oact->sa_mask, &koact.sa_mask, - sizeof(sigset_t)); - oact->sa_flags = koact.sa_flags; -#ifdef HAVE_SA_RESTORER - oact->sa_restorer = koact.sa_restorer; -#endif - } - } - - return ret; -} - -#endif /* LTP_RT_SIGACTION_H */ diff --git a/fsstress/include/lapi/safe_rt_signal.h b/fsstress/include/lapi/safe_rt_signal.h deleted file mode 100644 index 67fa444174..0000000000 --- a/fsstress/include/lapi/safe_rt_signal.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2018 Cyril Hrubis - */ - -#ifndef SAFE_RT_SIGNAL_H__ -#define SAFE_RT_SIGNAL_H__ - -#include -#include "lapi/rt_sigaction.h" - -static inline int safe_rt_sigaction(const char *file, const int lineno, - int signum, const struct sigaction *act, - struct sigaction *oact, size_t sigsetsize) -{ - int ret; - - ret = ltp_rt_sigaction(signum, act, oact, sigsetsize); - if (ret < 0) { - tst_brk(TBROK | TERRNO, - "%s:%d: ltp_rt_sigaction(%i, %p, %p, %zu) failed", - file, lineno, signum, act, oact, sigsetsize); - } - - return ret; -} - -#define SAFE_RT_SIGACTION(signum, act, oldact, sigsetsize) \ - safe_rt_sigaction(__FILE__, __LINE__, signum, act, oldact, sigsetsize) - - -static inline int safe_rt_sigprocmask(const char *file, const int lineno, - int how, const sigset_t *set, - sigset_t *oldset, size_t sigsetsize) -{ - int ret; - - ret = tst_syscall(__NR_rt_sigprocmask, how, set, oldset, sigsetsize); - if (ret < 0) { - tst_brk(TBROK | TERRNO, - "%s:%d: rt_sigprocmask(%i, %p, %p, %zu) failed", - file, lineno, how, set, oldset, sigsetsize); - } - - return ret; -} - -#define SAFE_RT_SIGPROCMASK(how, set, oldset, sigsetsize) \ - safe_rt_sigprocmask(__FILE__, __LINE__, how, set, oldset, sigsetsize) - -#endif /* SAFE_RT_SIGNAL_H__ */ diff --git a/fsstress/include/lapi/sched.h b/fsstress/include/lapi/sched.h deleted file mode 100644 index 26fe445e95..0000000000 --- a/fsstress/include/lapi/sched.h +++ /dev/null @@ -1,62 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2015 Cui Bixuan - */ - -#ifndef __SCHED_H__ -#define __SCHED_H__ - -#include "lapi/syscalls.h" -#include -#include - -struct sched_attr { - uint32_t size; - - uint32_t sched_policy; - uint64_t sched_flags; - - /* SCHED_NORMAL, SCHED_BATCH */ - int32_t sched_nice; - - /* SCHED_FIFO, SCHED_RR */ - uint32_t sched_priority; - - /* SCHED_DEADLINE (nsec) */ - uint64_t sched_runtime; - uint64_t sched_deadline; - uint64_t sched_period; -}; - -int sched_setattr(pid_t pid, - const struct sched_attr *attr, - unsigned int flags) -{ - return syscall(__NR_sched_setattr, pid, attr, flags); -} - -int sched_getattr(pid_t pid, - struct sched_attr *attr, - unsigned int size, - unsigned int flags) -{ - return syscall(__NR_sched_getattr, pid, attr, size, flags); -} - -#ifndef CLONE_VM -#define CLONE_VM 0x00000100 -#endif - -#ifndef CLONE_FS -#define CLONE_FS 0x00000200 -#endif - -#ifndef CLONE_SYSVSEM -#define CLONE_SYSVSEM 0x00040000 -#endif - -#ifndef CLONE_IO -#define CLONE_IO 0x80000000 -#endif - -#endif /* __SCHED_H__ */ diff --git a/fsstress/include/lapi/sctp.h b/fsstress/include/lapi/sctp.h deleted file mode 100644 index c4c1cc91fa..0000000000 --- a/fsstress/include/lapi/sctp.h +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2018 Oracle and/or its affiliates. - */ - -#ifndef LAPI_SCTP_H__ -#define LAPI_SCTP_H__ - -#ifdef HAVE_NETINET_SCTP_H -# include -#endif - -#ifndef SCTP_SOCKOPT_BINDX_ADD -# define SCTP_SOCKOPT_BINDX_ADD 100 -#endif - -#endif /* LAPI_SCTP_H__ */ diff --git a/fsstress/include/lapi/seccomp.h b/fsstress/include/lapi/seccomp.h deleted file mode 100644 index fe95cab1b2..0000000000 --- a/fsstress/include/lapi/seccomp.h +++ /dev/null @@ -1,40 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved. - * Author: Yang Xu - */ -#ifndef LAPI_SECCOMP_H -#define LAPI_SECCOMP_H - -#include - -#ifdef HAVE_LINUX_SECCOMP_H -# include -#else -/* Valid values for seccomp.mode and prctl(PR_SET_SECCOMP, ) */ -# define SECCOMP_MODE_DISABLED 0 -# define SECCOMP_MODE_STRICT 1 -# define SECCOMP_MODE_FILTER 2 - -# define SECCOMP_RET_KILL_THREAD 0x00000000U /* kill the thread */ -# define SECCOMP_RET_KILL SECCOMP_RET_KILL_THREAD -# define SECCOMP_RET_ALLOW 0x7fff0000U /* allow */ - -/** - * struct seccomp_data - the format the BPF program executes over. - * @nr: the system call number - * @arch: indicates system call convention as an AUDIT_ARCH_* value - * as defined in . - * @instruction_pointer: at the time of the system call. - * @args: up to 6 system call arguments always stored as 64-bit values - * regardless of the architecture. - */ -struct seccomp_data { - int nr; - uint32_t arch; - uint64_t instruction_pointer; - uint64_t args[6]; -}; - -#endif /* HAVE_LINUX_SECCOMP_H*/ -#endif /* LAPI_SECCOMP_H */ diff --git a/fsstress/include/lapi/securebits.h b/fsstress/include/lapi/securebits.h deleted file mode 100644 index 2da137c3a6..0000000000 --- a/fsstress/include/lapi/securebits.h +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved. - * Author: Yang Xu - */ -#ifndef LAPI_SECUREBITS_H -#define LAPI_SECUREBITS_H - -# ifdef HAVE_LINUX_SECUREBITS_H -# include -# endif - -# ifndef SECBIT_NO_CAP_AMBIENT_RAISE -# define SECBIT_NO_CAP_AMBIENT_RAISE 6 -# endif - -#endif /* LAPI_SECUREBITS_H */ diff --git a/fsstress/include/lapi/seek.h b/fsstress/include/lapi/seek.h deleted file mode 100644 index 1a29ba45dc..0000000000 --- a/fsstress/include/lapi/seek.h +++ /dev/null @@ -1,19 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2017 Cyril Hrubis - */ - -#ifndef SEEK_H__ -#define SEEK_H__ - -#include - -#ifndef SEEK_DATA -# define SEEK_DATA 3 -#endif - -#ifndef SEEK_HOLE -# define SEEK_HOLE 4 -#endif - -#endif /* SEEK_H__ */ diff --git a/fsstress/include/lapi/sembuf.h b/fsstress/include/lapi/sembuf.h deleted file mode 100644 index 4ef0483a01..0000000000 --- a/fsstress/include/lapi/sembuf.h +++ /dev/null @@ -1,234 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2020 Linaro Limited. All rights reserved. - * Author: Viresh Kumar - */ - -#ifndef IPC_SEMBUF_H -#define IPC_SEMBUF_H - -#include "lapi/posix_types.h" -#include -#include "tst_timer.h" -#include "ipcbuf.h" - -#ifndef HAVE_SEMID64_DS - -#if defined(__mips__) -#define HAVE_SEMID64_DS -/* - * The semid64_ds structure for the MIPS architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for 2 miscellaneous 64-bit values on mips64, - * but used for the upper 32 bit of the time values on mips32. - */ -#if defined(__arch64__) -struct semid64_ds { - struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ - long sem_otime; /* last semop time */ - long sem_ctime; /* last change time */ - unsigned long sem_nsems; /* no. of semaphores in array */ - unsigned long __unused1; - unsigned long __unused2; -}; -#else -#define HAVE_SEMID64_DS_TIME_HIGH -struct semid64_ds { - struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ - unsigned long sem_otime; /* last semop time */ - unsigned long sem_ctime; /* last change time */ - unsigned long sem_nsems; /* no. of semaphores in array */ - unsigned long sem_otime_high; - unsigned long sem_ctime_high; -}; -#endif -#endif /* __mips__ */ - -#if defined(__hppa__) -#define HAVE_SEMID64_DS -/* - * The semid64_ds structure for parisc architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 2 miscellaneous 32-bit values - */ -struct semid64_ds { - struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ -#if __BITS_PER_LONG == 64 - long sem_otime; /* last semop time */ - long sem_ctime; /* last change time */ -#else -#define HAVE_SEMID64_DS_TIME_HIGH - unsigned long sem_otime_high; - unsigned long sem_otime; /* last semop time */ - unsigned long sem_ctime_high; - unsigned long sem_ctime; /* last change time */ -#endif - unsigned long sem_nsems; /* no. of semaphores in array */ - unsigned long __unused1; - unsigned long __unused2; -}; -#endif /* __hppa__ */ - -#if defined(__powerpc__) || defined(__powerpc64__) -#define HAVE_SEMID64_DS -/* - * The semid64_ds structure for PPC architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 2 miscellaneous 32/64-bit values - */ - -struct semid64_ds { - struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ -#ifndef __powerpc64__ -#define HAVE_SEMID64_DS_TIME_HIGH - unsigned long sem_otime_high; - unsigned long sem_otime; /* last semop time */ - unsigned long sem_ctime_high; - unsigned long sem_ctime; /* last change time */ -#else - long sem_otime; /* last semop time */ - long sem_ctime; /* last change time */ -#endif - unsigned long sem_nsems; /* no. of semaphores in array */ - unsigned long __unused3; - unsigned long __unused4; -}; -#endif /* defined(__powerpc__) || defined(__powerpc64__) */ - -#if defined(__sparc__) -#define HAVE_SEMID64_DS -/* - * The semid64_ds structure for sparc architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 2 miscellaneous 32-bit values - */ - -struct semid64_ds { - struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ -#if defined(__arch64__) - long sem_otime; /* last semop time */ - long sem_ctime; /* last change time */ -#else -#define HAVE_SEMID64_DS_TIME_HIGH - unsigned long sem_otime_high; - unsigned long sem_otime; /* last semop time */ - unsigned long sem_ctime_high; - unsigned long sem_ctime; /* last change time */ -#endif - unsigned long sem_nsems; /* no. of semaphores in array */ - unsigned long __unused1; - unsigned long __unused2; -}; -#endif /* __sparc__ */ - -#if defined(__x86_64__) -#define HAVE_SEMID64_DS -/* - * The semid64_ds structure for x86 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 2 miscellaneous 32-bit values - * - * x86_64 and x32 incorrectly added padding here, so the structures - * are still incompatible with the padding on x86. - */ -struct semid64_ds { - struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ -#ifdef __i386__ -#define HAVE_SEMID64_DS_TIME_HIGH - unsigned long sem_otime; /* last semop time */ - unsigned long sem_otime_high; - unsigned long sem_ctime; /* last change time */ - unsigned long sem_ctime_high; -#else - __kernel_long_t sem_otime; /* last semop time */ - __kernel_ulong_t __unused1; - __kernel_long_t sem_ctime; /* last change time */ - __kernel_ulong_t __unused2; -#endif - __kernel_ulong_t sem_nsems; /* no. of semaphores in array */ - __kernel_ulong_t __unused3; - __kernel_ulong_t __unused4; -}; -#endif /* defined(__x86_64__) */ - -#if defined(__xtensa__) -#define HAVE_SEMID64_DS -#define HAVE_SEMID64_DS_TIME_HIGH - -struct semid64_ds { - struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ -#ifdef __XTENSA_EL__ - unsigned long sem_otime; /* last semop time */ - unsigned long sem_otime_high; - unsigned long sem_ctime; /* last change time */ - unsigned long sem_ctime_high; -#else - unsigned long sem_otime_high; - unsigned long sem_otime; /* last semop time */ - unsigned long sem_ctime_high; - unsigned long sem_ctime; /* last change time */ -#endif - unsigned long sem_nsems; /* no. of semaphores in array */ - unsigned long __unused3; - unsigned long __unused4; -}; - -#endif /* __xtensa__ */ - -#ifndef HAVE_SEMID64_DS -/* - * The semid64_ds structure for most architectures (though it came - * from x86_32 originally). Note extra padding because this structure - * is passed back and forth between kernel and user space. - * - * semid64_ds was originally meant to be architecture specific, but - * everyone just ended up making identical copies without specific - * optimizations, so we may just as well all use the same one. - * - * 64 bit architectures use a 64-bit long time field here, while - * 32 bit architectures have a pair of unsigned long values. - * - * On big-endian systems, the padding is in the wrong place for - * historic reasons, so user space has to reconstruct a time_t - * value using - * - * user_semid_ds.sem_otime = kernel_semid64_ds.sem_otime + - * ((long long)kernel_semid64_ds.sem_otime_high << 32) - * - * Pad space is left for 2 miscellaneous 32-bit values - */ -struct semid64_ds { - struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ -#if __BITS_PER_LONG == 64 - long sem_otime; /* last semop time */ - long sem_ctime; /* last change time */ -#else -#define HAVE_SEMID64_DS_TIME_HIGH - unsigned long sem_otime; /* last semop time */ - unsigned long sem_otime_high; - unsigned long sem_ctime; /* last change time */ - unsigned long sem_ctime_high; -#endif - unsigned long sem_nsems; /* no. of semaphores in array */ - unsigned long __unused3; - unsigned long __unused4; -}; -#endif /* semid64_ds */ - -#endif /* HAVE_SEMID64_DS */ - -#endif /* IPC_SEMBUF_H */ diff --git a/fsstress/include/lapi/semun.h b/fsstress/include/lapi/semun.h deleted file mode 100644 index 1a9dc9803b..0000000000 --- a/fsstress/include/lapi/semun.h +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2015 Linux Test Project - */ - -#ifndef SEMUN_H__ -#define SEMUN_H__ - -#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED) -/* union semun is defined by including */ -#else -/* according to X/OPEN we have to define it ourselves */ -union semun { - int val; /* value for SETVAL */ - struct semid_ds *buf; /* buffer for IPC_STAT, IPC_SET */ - unsigned short *array; /* array for GETALL, SETALL */ - /* Linux specific part: */ - struct seminfo *__buf; /* buffer for IPC_INFO */ -}; -#endif - -#endif /* SEMUN_H__ */ diff --git a/fsstress/include/lapi/setns.h b/fsstress/include/lapi/setns.h deleted file mode 100644 index 7b0a7afc47..0000000000 --- a/fsstress/include/lapi/setns.h +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - Copyright (c) 2020 Cyril Hrubis - */ - -#ifndef LAPI_SETNS_H__ -#define LAPI_SETNS_H__ - -#include "config.h" -#include "lapi/syscalls.h" -#include - -#ifndef HAVE_SETNS -int setns(int fd, int nstype) -{ - return tst_syscall(__NR_setns, fd, nstype); -} -#endif - -#endif /* LAPI_SETNS_H__ */ diff --git a/fsstress/include/lapi/shmbuf.h b/fsstress/include/lapi/shmbuf.h deleted file mode 100644 index 28ee336206..0000000000 --- a/fsstress/include/lapi/shmbuf.h +++ /dev/null @@ -1,273 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2020 Linaro Limited. All rights reserved. - * Author: Viresh Kumar - */ - -#ifndef IPC_SHMBUF_H -#define IPC_SHMBUF_H - -#include "lapi/posix_types.h" -#include -#include "tst_timer.h" -#include "ipcbuf.h" - -#ifndef HAVE_SHMID64_DS - -#if defined(__mips__) -#define HAVE_SHMID64_DS -/* - * The shmid64_ds structure for the MIPS architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * As MIPS was lacking proper padding after shm_?time, we use 48 bits - * of the padding at the end to store a few additional bits of the time. - * libc implementations need to take care to convert this into a proper - * data structure when moving to 64-bit time_t. - */ - -#if defined(__arch64__) -struct shmid64_ds { - struct ipc64_perm shm_perm; /* operation perms */ - size_t shm_segsz; /* size of segment (bytes) */ - long shm_atime; /* last attach time */ - long shm_dtime; /* last detach time */ - long shm_ctime; /* last change time */ - __kernel_pid_t shm_cpid; /* pid of creator */ - __kernel_pid_t shm_lpid; /* pid of last operator */ - unsigned long shm_nattch; /* no. of current attaches */ - unsigned long __unused1; - unsigned long __unused2; -}; -#else -#define HAVE_SHMID64_DS_TIME_HIGH -struct shmid64_ds { - struct ipc64_perm shm_perm; /* operation perms */ - size_t shm_segsz; /* size of segment (bytes) */ - unsigned long shm_atime; /* last attach time */ - unsigned long shm_dtime; /* last detach time */ - unsigned long shm_ctime; /* last change time */ - __kernel_pid_t shm_cpid; /* pid of creator */ - __kernel_pid_t shm_lpid; /* pid of last operator */ - unsigned long shm_nattch; /* no. of current attaches */ - unsigned short shm_atime_high; - unsigned short shm_dtime_high; - unsigned short shm_ctime_high; - unsigned short __unused1; -}; -#endif - -#endif /* __mips__ */ - -#if defined(__hppa__) -#define HAVE_SHMID64_DS -/* - * The shmid64_ds structure for parisc architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 2 miscellaneous 32-bit values - */ - -struct shmid64_ds { - struct ipc64_perm shm_perm; /* operation perms */ -#if __BITS_PER_LONG == 64 - long shm_atime; /* last attach time */ - long shm_dtime; /* last detach time */ - long shm_ctime; /* last change time */ -#else -#define HAVE_SHMID64_DS_TIME_HIGH - unsigned long shm_atime_high; - unsigned long shm_atime; /* last attach time */ - unsigned long shm_dtime_high; - unsigned long shm_dtime; /* last detach time */ - unsigned long shm_ctime_high; - unsigned long shm_ctime; /* last change time */ - unsigned int __pad4; -#endif - __kernel_size_t shm_segsz; /* size of segment (bytes) */ - __kernel_pid_t shm_cpid; /* pid of creator */ - __kernel_pid_t shm_lpid; /* pid of last operator */ - unsigned long shm_nattch; /* no. of current attaches */ - unsigned long __unused1; - unsigned long __unused2; -}; -#endif /* __hppa__ */ - -#if defined(__powerpc__) || defined(__powerpc64__) -#define HAVE_SHMID64_DS -/* - * The shmid64_ds structure for PPC architecture. - * - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 2 miscellaneous 32-bit values - */ - -struct shmid64_ds { - struct ipc64_perm shm_perm; /* operation perms */ -#ifdef __powerpc64__ - long shm_atime; /* last attach time */ - long shm_dtime; /* last detach time */ - long shm_ctime; /* last change time */ -#else -#define HAVE_SHMID64_DS_TIME_HIGH - unsigned long shm_atime_high; - unsigned long shm_atime; /* last attach time */ - unsigned long shm_dtime_high; - unsigned long shm_dtime; /* last detach time */ - unsigned long shm_ctime_high; - unsigned long shm_ctime; /* last change time */ - unsigned long __unused4; -#endif - size_t shm_segsz; /* size of segment (bytes) */ - __kernel_pid_t shm_cpid; /* pid of creator */ - __kernel_pid_t shm_lpid; /* pid of last operator */ - unsigned long shm_nattch; /* no. of current attaches */ - unsigned long __unused5; - unsigned long __unused6; -}; - -#endif /* defined(__powerpc__) || defined(__powerpc64__) */ - -#if defined(__sparc__) -#define HAVE_SHMID64_DS -/* - * The shmid64_ds structure for sparc architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 2 miscellaneous 32-bit values - */ - -struct shmid64_ds { - struct ipc64_perm shm_perm; /* operation perms */ -#if defined(__arch64__) - long shm_atime; /* last attach time */ - long shm_dtime; /* last detach time */ - long shm_ctime; /* last change time */ -#else -#define HAVE_SHMID64_DS_TIME_HIGH - unsigned long shm_atime_high; - unsigned long shm_atime; /* last attach time */ - unsigned long shm_dtime_high; - unsigned long shm_dtime; /* last detach time */ - unsigned long shm_ctime_high; - unsigned long shm_ctime; /* last change time */ -#endif - size_t shm_segsz; /* size of segment (bytes) */ - __kernel_pid_t shm_cpid; /* pid of creator */ - __kernel_pid_t shm_lpid; /* pid of last operator */ - unsigned long shm_nattch; /* no. of current attaches */ - unsigned long __unused1; - unsigned long __unused2; -}; - -#endif /* __sparc__ */ - -#if defined(__x86_64__) && defined(__ILP32__) -#define HAVE_SHMID64_DS -/* - * The shmid64_ds structure for x86 architecture with x32 ABI. - * - * On x86-32 and x86-64 we can just use the generic definition, but - * x32 uses the same binary layout as x86_64, which is differnet - * from other 32-bit architectures. - */ - -struct shmid64_ds { - struct ipc64_perm shm_perm; /* operation perms */ - size_t shm_segsz; /* size of segment (bytes) */ - __kernel_long_t shm_atime; /* last attach time */ - __kernel_long_t shm_dtime; /* last detach time */ - __kernel_long_t shm_ctime; /* last change time */ - __kernel_pid_t shm_cpid; /* pid of creator */ - __kernel_pid_t shm_lpid; /* pid of last operator */ - __kernel_ulong_t shm_nattch; /* no. of current attaches */ - __kernel_ulong_t __unused4; - __kernel_ulong_t __unused5; -}; -#endif /* defined(__x86_64__) && defined(__ILP32__) */ - -#if defined(__xtensa__) -#define HAVE_SHMID64_DS -#define HAVE_SHMID64_DS_TIME_HIGH -/* - * The shmid64_ds structure for Xtensa architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space, but the padding is on the wrong - * side for big-endian xtensa, for historic reasons. - * - * Pad space is left for: - * - 2 miscellaneous 32-bit values - */ - -struct shmid64_ds { - struct ipc64_perm shm_perm; /* operation perms */ - size_t shm_segsz; /* size of segment (bytes) */ - unsigned long shm_atime; /* last attach time */ - unsigned long shm_atime_high; - unsigned long shm_dtime; /* last detach time */ - unsigned long shm_dtime_high; - unsigned long shm_ctime; /* last change time */ - unsigned long shm_ctime_high; - __kernel_pid_t shm_cpid; /* pid of creator */ - __kernel_pid_t shm_lpid; /* pid of last operator */ - unsigned long shm_nattch; /* no. of current attaches */ - unsigned long __unused4; - unsigned long __unused5; -}; - -#endif /* __xtensa__ */ - -#ifndef HAVE_SHMID64_DS -/* - * The shmid64_ds structure for most architectures (though it came - * from x86_32 originally). Note extra padding because this structure - * is passed back and forth between kernel and user space. - * - * shmid64_ds was originally meant to be architecture specific, but - * everyone just ended up making identical copies without specific - * optimizations, so we may just as well all use the same one. - * - * 64 bit architectures use a 64-bit long time field here, while - * 32 bit architectures have a pair of unsigned long values. - * On big-endian systems, the lower half is in the wrong place. - * - * - * Pad space is left for: - * - 2 miscellaneous 32-bit values - */ - -struct shmid64_ds { - struct ipc64_perm shm_perm; /* operation perms */ - size_t shm_segsz; /* size of segment (bytes) */ -#if __BITS_PER_LONG == 64 - long shm_atime; /* last attach time */ - long shm_dtime; /* last detach time */ - long shm_ctime; /* last change time */ -#else -#define HAVE_SHMID64_DS_TIME_HIGH - unsigned long shm_atime; /* last attach time */ - unsigned long shm_atime_high; - unsigned long shm_dtime; /* last detach time */ - unsigned long shm_dtime_high; - unsigned long shm_ctime; /* last change time */ - unsigned long shm_ctime_high; -#endif - __kernel_pid_t shm_cpid; /* pid of creator */ - __kernel_pid_t shm_lpid; /* pid of last operator */ - unsigned long shm_nattch; /* no. of current attaches */ - unsigned long __unused4; - unsigned long __unused5; -}; -#endif /* shmid64_ds */ - -#endif /* HAVE_SHMID64_DS */ - -#endif /* IPC_SHMBUF_H */ diff --git a/fsstress/include/lapi/signal.h b/fsstress/include/lapi/signal.h deleted file mode 100644 index d22965a943..0000000000 --- a/fsstress/include/lapi/signal.h +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2019 Linaro Limited. All rights reserved. - * Author: Daniel Díaz - */ - -#ifndef LAPI_SIGNAL_H -#define LAPI_SIGNAL_H - -#include - -/* - * Some libc implementations might differ in the definitions they include. This - * covers those differences for all tests to successfully build. - */ - -#ifndef __SIGRTMIN -# define __SIGRTMIN 32 -#endif -#ifndef __SIGRTMAX -# define __SIGRTMAX (_NSIG - 1) -#endif - -#endif diff --git a/fsstress/include/lapi/socket.h b/fsstress/include/lapi/socket.h deleted file mode 100644 index d6389e5041..0000000000 --- a/fsstress/include/lapi/socket.h +++ /dev/null @@ -1,72 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* -* Copyright (c) 2016 Fujitsu Ltd. -* Author: Xiao Yang -*/ - -#ifndef __LAPI_SOCKET_H__ -#define __LAPI_SOCKET_H__ - -#include "config.h" -#include - -#ifndef MSG_ZEROCOPY -# define MSG_ZEROCOPY 0x4000000 /* Use user data in kernel path */ -#endif - -#ifndef MSG_FASTOPEN -# define MSG_FASTOPEN 0x20000000 /* Send data in TCP SYN */ -#endif - -#ifndef SO_REUSEPORT -# define SO_REUSEPORT 15 -#endif - -#ifndef SO_BUSY_POLL -# define SO_BUSY_POLL 46 -#endif - -#ifndef SO_ATTACH_BPF -# define SO_ATTACH_BPF 50 -#endif - -#ifndef SO_ZEROCOPY -# define SO_ZEROCOPY 60 -#endif - -#ifndef SOCK_DCCP -# define SOCK_DCCP 6 -#endif - -#ifndef SOCK_CLOEXEC -# define SOCK_CLOEXEC 02000000 -#endif - -#ifndef AF_ALG -# define AF_ALG 38 -#endif - -#ifndef SOL_SCTP -# define SOL_SCTP 132 -#endif - -#ifndef SOL_UDPLITE -# define SOL_UDPLITE 136 /* UDP-Lite (RFC 3828) */ -#endif - -#ifndef SOL_DCCP -# define SOL_DCCP 269 -#endif - -#ifndef SOL_ALG -# define SOL_ALG 279 -#endif - -#ifndef HAVE_STRUCT_MMSGHDR -struct mmsghdr { - struct msghdr msg_hdr; - unsigned int msg_len; -}; -#endif - -#endif /* __LAPI_SOCKET_H__ */ diff --git a/fsstress/include/lapi/splice.h b/fsstress/include/lapi/splice.h deleted file mode 100644 index 0cd6f55d27..0000000000 --- a/fsstress/include/lapi/splice.h +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) International Business Machines Corp., 2007 - * Copyright (c) 2014 Fujitsu Ltd. - */ - -#ifndef SPLICE_H -#define SPLICE_H - -#include "config.h" -#include "lapi/syscalls.h" - -#if !defined(HAVE_SPLICE) -ssize_t splice(int fd_in, loff_t *off_in, int fd_out, - loff_t *off_out, size_t len, unsigned int flags) -{ - return tst_syscall(__NR_splice, fd_in, off_in, - fd_out, off_out, len, flags); -} -#endif - -#endif /* SPLICE_H */ diff --git a/fsstress/include/lapi/stat.h b/fsstress/include/lapi/stat.h deleted file mode 100644 index 979e42d374..0000000000 --- a/fsstress/include/lapi/stat.h +++ /dev/null @@ -1,257 +0,0 @@ -//SPDX-License-Identifier: GPL-2.0-or-later -/* - * Referred from linux kernel -github/torvalds/linux/include/uapi/linux/fcntl.h - * Copyright (c) Zilogic Systems Pvt. Ltd., 2018 - * Email: code@zilogic.com - */ -#ifndef LAPI_STAT_H -#define LAPI_STAT_H - -#include -#include -#include "lapi/syscalls.h" -/* - * Timestamp structure for the timestamps in struct statx. - * - * tv_sec holds the number of seconds before (negative) or after (positive) - * 00:00:00 1st January 1970 UTC. - * - * tv_nsec holds a number of nanoseconds (0..999,999,999) after the tv_sec time. - * - * __reserved is held in case we need a yet finer resolution. - */ -#if defined(HAVE_STRUCT_STATX_TIMESTAMP) -#include -#else -struct statx_timestamp { - int64_t tv_sec; - uint32_t tv_nsec; - int32_t __reserved; -}; -#endif -/* - * Structures for the extended file attribute retrieval system call - * (statx()). - * - * The caller passes a mask of what they're specifically interested in as a - * parameter to statx(). What statx() actually got will be indicated in - * st_mask upon return. - * - * For each bit in the mask argument: - * - * - if the datum is not supported: - * - * - the bit will be cleared, and - * - * - the datum will be set to an appropriate fabricated value if one is - * available (eg. CIFS can take a default uid and gid), otherwise - * - * - the field will be cleared; - * - * - otherwise, if explicitly requested: - * - * - the datum will be synchronised to the server if AT_STATX_FORCE_SYNC is - * set or if the datum is considered out of date, and - * - * - the field will be filled in and the bit will be set; - * - * - otherwise, if not requested, but available in approximate form without any - * effort, it will be filled in anyway, and the bit will be set upon return - * (it might not be up to date, however, and no attempt will be made to - * synchronise the internal state first); - * - * - otherwise the field and the bit will be cleared before returning. - * - * Items in STATX_BASIC_STATS may be marked unavailable on return, but they - * will have values installed for compatibility purposes so that stat() and - * co. can be emulated in userspace. - */ -#if defined(HAVE_STRUCT_STATX) -#include -#else -struct statx { - /* 0x00 */ - uint32_t stx_mask; - uint32_t stx_blksize; - uint64_t stx_attributes; - /* 0x10 */ - uint32_t stx_nlink; - uint32_t stx_uid; - uint32_t stx_gid; - uint16_t stx_mode; - uint16_t __spare0[1]; - /* 0x20 */ - uint64_t stx_ino; - uint64_t stx_size; - uint64_t stx_blocks; - uint64_t stx_attributes_mask; - /* 0x40 */ - const struct statx_timestamp stx_atime; - const struct statx_timestamp stx_btime; - const struct statx_timestamp stx_ctime; - const struct statx_timestamp stx_mtime; - /* 0x80 */ - uint32_t stx_rdev_major; - uint32_t stx_rdev_minor; - uint32_t stx_dev_major; - uint32_t stx_dev_minor; - /* 0x90 */ - uint64_t __spare2[14]; - /* 0x100 */ -}; -#endif - -#if !defined(HAVE_STATX) - -/* - * statx: wrapper function of statx - * - * Returns: It returns status of statx syscall - */ -static inline int statx(int dirfd, const char *pathname, unsigned int flags, - unsigned int mask, struct statx *statxbuf) -{ - return tst_syscall(__NR_statx, dirfd, pathname, flags, mask, statxbuf); -} -#endif - -/* - * Flags to be stx_mask - * - * Query request/result mask for statx() and struct statx::stx_mask. - * - * These bits should be set in the mask argument of statx() to request - * particular items when calling statx(). - */ -#ifndef STATX_TYPE -# define STATX_TYPE 0x00000001U -#endif - -#ifndef STATX_MODE -# define STATX_MODE 0x00000002U -#endif - -#ifndef STATX_NLINK -# define STATX_NLINK 0x00000004U -#endif - -#ifndef STATX_UID -# define STATX_UID 0x00000008U -#endif - -#ifndef STATX_GID -# define STATX_GID 0x00000010U -#endif - -#ifndef STATX_ATIME -# define STATX_ATIME 0x00000020U -#endif - -#ifndef STATX_MTIME -# define STATX_MTIME 0x00000040U -#endif - -#ifndef STATX_CTIME -# define STATX_CTIME 0x00000080U -#endif - -#ifndef STATX_INO -# define STATX_INO 0x00000100U -#endif - -#ifndef STATX_SIZE -# define STATX_SIZE 0x00000200U -#endif - -#ifndef STATX_BLOCKS -# define STATX_BLOCKS 0x00000400U -#endif - -#ifndef STATX_BASIC_STATS -# define STATX_BASIC_STATS 0x000007ffU -#endif - -#ifndef STATX_BTIME -# define STATX_BTIME 0x00000800U -#endif - -#ifndef STATX_ALL -# define STATX_ALL 0x00000fffU -#endif - -#ifndef STATX__RESERVED -# define STATX__RESERVED 0x80000000U -#endif - -/* - * Attributes to be found in stx_attributes and masked in stx_attributes_mask. - * - * These give information about the features or the state of a file that might - * be of use to ordinary userspace programs such as GUIs or ls rather than - * specialised tools. - * - * Note that the flags marked [I] correspond to generic FS_IOC_FLAGS - * semantically. Where possible, the numerical value is picked to correspond - * also. - */ -#ifndef STATX_ATTR_COMPRESSED -# define STATX_ATTR_COMPRESSED 0x00000004 -#endif - -#ifndef STATX_ATTR_IMMUTABLE -# define STATX_ATTR_IMMUTABLE 0x00000010 -#endif - -#ifndef STATX_ATTR_APPEND -# define STATX_ATTR_APPEND 0x00000020 -#endif - -#ifndef STATX_ATTR_NODUMP -# define STATX_ATTR_NODUMP 0x00000040 -#endif - -#ifndef STATX_ATTR_ENCRYPTED -# define STATX_ATTR_ENCRYPTED 0x00000800 -#endif - -#ifndef STATX_ATTR_AUTOMOUNT -# define STATX_ATTR_AUTOMOUNT 0x00001000 -#endif - -#ifndef AT_SYMLINK_NOFOLLOW -# define AT_SYMLINK_NOFOLLOW 0x100 -#endif - -#ifndef AT_REMOVEDIR -# define AT_REMOVEDIR 0x200 -#endif - -#ifndef AT_SYMLINK_FOLLOW -# define AT_SYMLINK_FOLLOW 0x400 -#endif - -#ifndef AT_NO_AUTOMOUNT -# define AT_NO_AUTOMOUNT 0x800 -#endif - -#ifndef AT_EMPTY_PATH -# define AT_EMPTY_PATH 0x1000 -#endif - -#ifndef AT_STATX_SYNC_TYPE -# define AT_STATX_SYNC_TYPE 0x6000 -#endif - -#ifndef AT_STATX_SYNC_AS_STAT -# define AT_STATX_SYNC_AS_STAT 0x0000 -#endif - -#ifndef AT_STATX_FORCE_SYNC -# define AT_STATX_FORCE_SYNC 0x2000 -#endif - -#ifndef AT_STATX_DONT_SYNC -# define AT_STATX_DONT_SYNC 0x4000 -#endif - -#endif diff --git a/fsstress/include/lapi/sync_file_range.h b/fsstress/include/lapi/sync_file_range.h deleted file mode 100644 index 86bfe5d6ec..0000000000 --- a/fsstress/include/lapi/sync_file_range.h +++ /dev/null @@ -1,58 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) International Business Machines Corp., 2008 - */ - -#ifndef SYNC_FILE_RANGE_H -#define SYNC_FILE_RANGE_H - -#include -#include "config.h" -#include "lapi/syscalls.h" -#include "lapi/abisize.h" - -#if !defined(HAVE_SYNC_FILE_RANGE) - -#ifdef TST_TEST_H__ -# define TST_SYSCALL tst_syscall -#else -# define TST_SYSCALL ltp_syscall -#endif - -/***************************************************************************** - * Wraper function to call sync_file_range system call - ******************************************************************************/ -static inline long sync_file_range(int fd, off64_t offset, off64_t nbytes, - unsigned int flags) -{ -#if (defined(__arm__) || defined(__powerpc__) || defined(__powerpc64__)) -# ifdef TST_ABI32 -# if __BYTE_ORDER == __BIG_ENDIAN - return TST_SYSCALL(__NR_sync_file_range2, fd, flags, - (int)(offset >> 32), (int)offset, (int)(nbytes >> 32), - (int)nbytes); -# elif __BYTE_ORDER == __LITTLE_ENDIAN - return TST_SYSCALL(__NR_sync_file_range2, fd, flags, (int)offset, - (int)(offset >> 32), nbytes, (int)(nbytes >> 32)); -# endif -# else - return TST_SYSCALL(__NR_sync_file_range2, fd, flags, offset, nbytes); -# endif -#elif (defined(__s390__) || defined(__s390x__)) && defined(TST_ABI32) - return TST_SYSCALL(__NR_sync_file_range, fd, (int)(offset >> 32), - (int)offset, (int)(nbytes >> 32), (int)nbytes, flags); -#elif defined(__mips__) && defined(TST_ABI32) -# if __BYTE_ORDER == __BIG_ENDIAN - return TST_SYSCALL(__NR_sync_file_range, fd, 0, (int)(offset >> 32), - (int)offset, (int)(nbytes >> 32), (int)nbytes, flags); -# elif __BYTE_ORDER == __LITTLE_ENDIAN - return TST_SYSCALL(__NR_sync_file_range, fd, 0, (int)offset, - (int)(offset >> 32), (int)nbytes, (int)(nbytes >> 32), flags); -# endif -#else - return TST_SYSCALL(__NR_sync_file_range, fd, offset, nbytes, flags); -#endif -} -#endif - -#endif /* SYNC_FILE_RANGE_H */ diff --git a/fsstress/include/lapi/syncfs.h b/fsstress/include/lapi/syncfs.h deleted file mode 100644 index e5d29fa96a..0000000000 --- a/fsstress/include/lapi/syncfs.h +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2019 Linaro Limited. All rights reserved. - * Author: Sumit Garg - */ - -#ifndef SYNCFS_H -#define SYNCFS_H - -#include "config.h" -#include -#include "lapi/syscalls.h" - -#if !defined(HAVE_SYNCFS) -int syncfs(int fd) -{ - return tst_syscall(__NR_syncfs, fd); -} -#endif - -#endif /* SYNCFS_H */ diff --git a/fsstress/include/lapi/syscalls/aarch64.in b/fsstress/include/lapi/syscalls/aarch64.in deleted file mode 100644 index 07556933f0..0000000000 --- a/fsstress/include/lapi/syscalls/aarch64.in +++ /dev/null @@ -1,315 +0,0 @@ -io_setup 0 -io_destroy 1 -io_submit 2 -io_cancel 3 -io_getevents 4 -setxattr 5 -lsetxattr 6 -fsetxattr 7 -getxattr 8 -lgetxattr 9 -fgetxattr 10 -listxattr 11 -llistxattr 12 -flistxattr 13 -removexattr 14 -lremovexattr 15 -fremovexattr 16 -getcwd 17 -lookup_dcookie 18 -eventfd2 19 -epoll_create1 20 -epoll_ctl 21 -epoll_pwait 22 -dup 23 -dup3 24 -fcntl 25 -inotify_init1 26 -inotify_add_watch 27 -inotify_rm_watch 28 -ioctl 29 -ioprio_set 30 -ioprio_get 31 -flock 32 -mknodat 33 -mkdirat 34 -unlinkat 35 -symlinkat 36 -linkat 37 -renameat 38 -umount2 39 -mount 40 -pivot_root 41 -nfsservctl 42 -statfs 43 -fstatfs 44 -truncate 45 -ftruncate 46 -fallocate 47 -faccessat 48 -chdir 49 -fchdir 50 -chroot 51 -fchmod 52 -fchmodat 53 -fchownat 54 -fchown 55 -openat 56 -close 57 -vhangup 58 -pipe2 59 -quotactl 60 -getdents64 61 -lseek 62 -read 63 -write 64 -readv 65 -writev 66 -pread64 67 -pwrite64 68 -preadv 69 -pwritev 70 -sendfile 71 -pselect6 72 -ppoll 73 -signalfd4 74 -vmsplice 75 -splice 76 -tee 77 -readlinkat 78 -fstatat 79 -fstat 80 -sync 81 -fsync 82 -fdatasync 83 -sync_file_range2 84 -sync_file_range 84 -timerfd_create 85 -timerfd_settime 86 -timerfd_gettime 87 -utimensat 88 -acct 89 -capget 90 -capset 91 -personality 92 -exit 93 -exit_group 94 -waitid 95 -set_tid_address 96 -unshare 97 -futex 98 -set_robust_list 99 -get_robust_list 100 -nanosleep 101 -getitimer 102 -setitimer 103 -kexec_load 104 -init_module 105 -delete_module 106 -timer_create 107 -timer_gettime 108 -timer_getoverrun 109 -timer_settime 110 -timer_delete 111 -clock_settime 112 -clock_gettime 113 -clock_getres 114 -clock_nanosleep 115 -syslog 116 -ptrace 117 -sched_setparam 118 -sched_setscheduler 119 -sched_getscheduler 120 -sched_getparam 121 -sched_setaffinity 122 -sched_getaffinity 123 -sched_yield 124 -sched_get_priority_max 125 -sched_get_priority_min 126 -sched_rr_get_interval 127 -restart_syscall 128 -kill 129 -tkill 130 -tgkill 131 -sigaltstack 132 -rt_sigsuspend 133 -rt_sigaction 134 -rt_sigprocmask 135 -rt_sigpending 136 -rt_sigtimedwait 137 -rt_sigqueueinfo 138 -rt_sigreturn 139 -setpriority 140 -getpriority 141 -reboot 142 -setregid 143 -setgid 144 -setreuid 145 -setuid 146 -setresuid 147 -getresuid 148 -setresgid 149 -getresgid 150 -setfsuid 151 -setfsgid 152 -times 153 -setpgid 154 -getpgid 155 -getsid 156 -setsid 157 -getgroups 158 -setgroups 159 -uname 160 -sethostname 161 -setdomainname 162 -getrlimit 163 -setrlimit 164 -getrusage 165 -umask 166 -prctl 167 -getcpu 168 -gettimeofday 169 -settimeofday 170 -adjtimex 171 -getpid 172 -getppid 173 -getuid 174 -geteuid 175 -getgid 176 -getegid 177 -gettid 178 -sysinfo 179 -mq_open 180 -mq_unlink 181 -mq_timedsend 182 -mq_timedreceive 183 -mq_notify 184 -mq_getsetattr 185 -msgget 186 -msgctl 187 -msgrcv 188 -msgsnd 189 -semget 190 -semctl 191 -semtimedop 192 -semop 193 -shmget 194 -shmctl 195 -shmat 196 -shmdt 197 -socket 198 -socketpair 199 -bind 200 -listen 201 -accept 202 -connect 203 -getsockname 204 -getpeername 205 -sendto 206 -recvfrom 207 -setsockopt 208 -getsockopt 209 -shutdown 210 -sendmsg 211 -recvmsg 212 -readahead 213 -brk 214 -munmap 215 -mremap 216 -add_key 217 -request_key 218 -keyctl 219 -clone 220 -execve 221 -mmap 222 -fadvise64 223 -swapon 224 -swapoff 225 -mprotect 226 -msync 227 -mlock 228 -munlock 229 -mlockall 230 -munlockall 231 -mincore 232 -madvise 233 -remap_file_pages 234 -mbind 235 -get_mempolicy 236 -set_mempolicy 237 -migrate_pages 238 -move_pages 239 -rt_tgsigqueueinfo 240 -perf_event_open 241 -accept4 242 -recvmmsg 243 -wait4 260 -prlimit64 261 -fanotify_init 262 -fanotify_mark 263 -name_to_handle_at 264 -open_by_handle_at 265 -clock_adjtime 266 -syncfs 267 -setns 268 -sendmmsg 269 -process_vm_readv 270 -process_vm_writev 271 -kcmp 272 -finit_module 273 -sched_setattr 274 -sched_getattr 275 -renameat2 276 -seccomp 277 -getrandom 278 -memfd_create 279 -bpf 280 -execveat 281 -userfaultfd 282 -membarrier 283 -mlock2 284 -copy_file_range 285 -preadv2 286 -pwritev2 287 -pkey_mprotect 288 -pkey_alloc 289 -pkey_free 290 -statx 291 -io_pgetevents 292 -rseq 293 -kexec_file_load 294 -clock_gettime64 403 -clock_settime64 404 -clock_adjtime64 405 -clock_getres_time64 406 -clock_nanosleep_time64 407 -timer_gettime64 408 -timer_settime64 409 -timerfd_gettime64 410 -timerfd_settime64 411 -utimensat_time64 412 -pselect6_time64 413 -ppoll_time64 414 -io_pgetevents_time64 416 -recvmmsg_time64 417 -mq_timedsend_time64 418 -mq_timedreceive_time64 419 -semtimedop_time64 420 -rt_sigtimedwait_time64 421 -futex_time64 422 -sched_rr_get_interval_time64 423 -pidfd_send_signal 424 -io_uring_setup 425 -io_uring_enter 426 -io_uring_register 427 -open_tree 428 -move_mount 429 -fsopen 430 -fsconfig 431 -fsmount 432 -fspick 433 -pidfd_open 434 -clone3 435 -openat2 437 -pidfd_getfd 438 -_sysctl 1078 diff --git a/fsstress/include/lapi/syscalls/arc.in b/fsstress/include/lapi/syscalls/arc.in deleted file mode 100644 index 0cadb150c7..0000000000 --- a/fsstress/include/lapi/syscalls/arc.in +++ /dev/null @@ -1,314 +0,0 @@ -io_setup 0 -io_destroy 1 -io_submit 2 -io_cancel 3 -io_getevents 4 -setxattr 5 -lsetxattr 6 -fsetxattr 7 -getxattr 8 -lgetxattr 9 -fgetxattr 10 -listxattr 11 -llistxattr 12 -flistxattr 13 -removexattr 14 -lremovexattr 15 -fremovexattr 16 -getcwd 17 -lookup_dcookie 18 -eventfd2 19 -epoll_create1 20 -epoll_ctl 21 -epoll_pwait 22 -dup 23 -dup3 24 -fcntl 25 -inotify_init1 26 -inotify_add_watch 27 -inotify_rm_watch 28 -ioctl 29 -ioprio_set 30 -ioprio_get 31 -flock 32 -mknodat 33 -mkdirat 34 -unlinkat 35 -symlinkat 36 -linkat 37 -renameat 38 -umount2 39 -mount 40 -pivot_root 41 -nfsservctl 42 -statfs 43 -fstatfs 44 -truncate 45 -ftruncate 46 -fallocate 47 -faccessat 48 -chdir 49 -fchdir 50 -chroot 51 -fchmod 52 -fchmodat 53 -fchownat 54 -fchown 55 -openat 56 -close 57 -vhangup 58 -pipe2 59 -quotactl 60 -getdents64 61 -lseek 62 -read 63 -write 64 -readv 65 -writev 66 -pread64 67 -pwrite64 68 -preadv 69 -pwritev 70 -sendfile 71 -pselect6 72 -ppoll 73 -signalfd4 74 -vmsplice 75 -splice 76 -tee 77 -readlinkat 78 -fstatat 79 -fstat 80 -sync 81 -fsync 82 -fdatasync 83 -sync_file_range2 84 -sync_file_range 84 -timerfd_create 85 -timerfd_settime 86 -timerfd_gettime 87 -utimensat 88 -acct 89 -capget 90 -capset 91 -personality 92 -exit 93 -exit_group 94 -waitid 95 -set_tid_address 96 -unshare 97 -futex 98 -set_robust_list 99 -get_robust_list 100 -nanosleep 101 -getitimer 102 -setitimer 103 -kexec_load 104 -init_module 105 -delete_module 106 -timer_create 107 -timer_gettime 108 -timer_getoverrun 109 -timer_settime 110 -timer_delete 111 -clock_settime 112 -clock_gettime 113 -clock_getres 114 -clock_nanosleep 115 -syslog 116 -ptrace 117 -sched_setparam 118 -sched_setscheduler 119 -sched_getscheduler 120 -sched_getparam 121 -sched_setaffinity 122 -sched_getaffinity 123 -sched_yield 124 -sched_get_priority_max 125 -sched_get_priority_min 126 -sched_rr_get_interval 127 -restart_syscall 128 -kill 129 -tkill 130 -tgkill 131 -sigaltstack 132 -rt_sigsuspend 133 -rt_sigaction 134 -rt_sigprocmask 135 -rt_sigpending 136 -rt_sigtimedwait 137 -rt_sigqueueinfo 138 -rt_sigreturn 139 -setpriority 140 -getpriority 141 -reboot 142 -setregid 143 -setgid 144 -setreuid 145 -setuid 146 -setresuid 147 -getresuid 148 -setresgid 149 -getresgid 150 -setfsuid 151 -setfsgid 152 -times 153 -setpgid 154 -getpgid 155 -getsid 156 -setsid 157 -getgroups 158 -setgroups 159 -uname 160 -sethostname 161 -setdomainname 162 -getrlimit 163 -setrlimit 164 -getrusage 165 -umask 166 -prctl 167 -getcpu 168 -gettimeofday 169 -settimeofday 170 -adjtimex 171 -getpid 172 -getppid 173 -getuid 174 -geteuid 175 -getgid 176 -getegid 177 -gettid 178 -sysinfo 179 -mq_open 180 -mq_unlink 181 -mq_timedsend 182 -mq_timedreceive 183 -mq_notify 184 -mq_getsetattr 185 -msgget 186 -msgctl 187 -msgrcv 188 -msgsnd 189 -semget 190 -semctl 191 -semtimedop 192 -semop 193 -shmget 194 -shmctl 195 -shmat 196 -shmdt 197 -socket 198 -socketpair 199 -bind 200 -listen 201 -accept 202 -connect 203 -getsockname 204 -getpeername 205 -sendto 206 -recvfrom 207 -setsockopt 208 -getsockopt 209 -shutdown 210 -sendmsg 211 -recvmsg 212 -readahead 213 -brk 214 -munmap 215 -mremap 216 -add_key 217 -request_key 218 -keyctl 219 -clone 220 -execve 221 -mmap 222 -fadvise64 223 -swapon 224 -swapoff 225 -mprotect 226 -msync 227 -mlock 228 -munlock 229 -mlockall 230 -munlockall 231 -mincore 232 -madvise 233 -remap_file_pages 234 -mbind 235 -get_mempolicy 236 -set_mempolicy 237 -migrate_pages 238 -move_pages 239 -rt_tgsigqueueinfo 240 -perf_event_open 241 -accept4 242 -recvmmsg 243 -cacheflush 244 -arc_settls 245 -arc_gettls 246 -sysfs 247 -arc_usr_cmpxchg 248 -wait4 260 -prlimit64 261 -fanotify_init 262 -fanotify_mark 263 -name_to_handle_at 264 -open_by_handle_at 265 -clock_adjtime 266 -syncfs 267 -setns 268 -sendmmsg 269 -process_vm_readv 270 -process_vm_writev 271 -kcmp 272 -getrandom 278 -memfd_create 279 -bpf 280 -execveat 281 -userfaultfd 282 -membarrier 283 -mlock2 284 -copy_file_range 285 -preadv2 286 -pwritev2 287 -pkey_mprotect 288 -pkey_alloc 289 -pkey_free 290 -statx 291 -io_pgetevents 292 -rseq 293 -kexec_file_load 294 -clock_gettime64 403 -clock_settime64 404 -clock_adjtime64 405 -clock_getres_time64 406 -clock_nanosleep_time64 407 -timer_gettime64 408 -timer_settime64 409 -timerfd_gettime64 410 -timerfd_settime64 411 -utimensat_time64 412 -pselect6_time64 413 -ppoll_time64 414 -io_pgetevents_time64 416 -recvmmsg_time64 417 -mq_timedsend_time64 418 -mq_timedreceive_time64 419 -semtimedop_time64 420 -rt_sigtimedwait_time64 421 -futex_time64 422 -sched_rr_get_interval_time64 423 -pidfd_send_signal 424 -io_uring_setup 425 -io_uring_enter 426 -io_uring_register 427 -open_tree 428 -move_mount 429 -fsopen 430 -fsconfig 431 -fsmount 432 -fspick 433 -pidfd_open 434 -clone3 435 -openat2 437 -pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/arm.in b/fsstress/include/lapi/syscalls/arm.in deleted file mode 100644 index 395d53a68f..0000000000 --- a/fsstress/include/lapi/syscalls/arm.in +++ /dev/null @@ -1,392 +0,0 @@ -restart_syscall (__NR_SYSCALL_BASE+ 0) -exit (__NR_SYSCALL_BASE+ 1) -fork (__NR_SYSCALL_BASE+ 2) -read (__NR_SYSCALL_BASE+ 3) -write (__NR_SYSCALL_BASE+ 4) -open (__NR_SYSCALL_BASE+ 5) -close (__NR_SYSCALL_BASE+ 6) -creat (__NR_SYSCALL_BASE+ 8) -link (__NR_SYSCALL_BASE+ 9) -unlink (__NR_SYSCALL_BASE+ 10) -execve (__NR_SYSCALL_BASE+ 11) -chdir (__NR_SYSCALL_BASE+ 12) -mknod (__NR_SYSCALL_BASE+ 14) -chmod (__NR_SYSCALL_BASE+ 15) -lchown (__NR_SYSCALL_BASE+ 16) -lseek (__NR_SYSCALL_BASE+ 19) -getpid (__NR_SYSCALL_BASE+ 20) -mount (__NR_SYSCALL_BASE+ 21) -setuid (__NR_SYSCALL_BASE+ 23) -getuid (__NR_SYSCALL_BASE+ 24) -ptrace (__NR_SYSCALL_BASE+ 26) -pause (__NR_SYSCALL_BASE+ 29) -access (__NR_SYSCALL_BASE+ 33) -nice (__NR_SYSCALL_BASE+ 34) -sync (__NR_SYSCALL_BASE+ 36) -kill (__NR_SYSCALL_BASE+ 37) -rename (__NR_SYSCALL_BASE+ 38) -mkdir (__NR_SYSCALL_BASE+ 39) -rmdir (__NR_SYSCALL_BASE+ 40) -dup (__NR_SYSCALL_BASE+ 41) -pipe (__NR_SYSCALL_BASE+ 42) -times (__NR_SYSCALL_BASE+ 43) -brk (__NR_SYSCALL_BASE+ 45) -setgid (__NR_SYSCALL_BASE+ 46) -getgid (__NR_SYSCALL_BASE+ 47) -geteuid (__NR_SYSCALL_BASE+ 49) -getegid (__NR_SYSCALL_BASE+ 50) -acct (__NR_SYSCALL_BASE+ 51) -umount2 (__NR_SYSCALL_BASE+ 52) -ioctl (__NR_SYSCALL_BASE+ 54) -fcntl (__NR_SYSCALL_BASE+ 55) -setpgid (__NR_SYSCALL_BASE+ 57) -umask (__NR_SYSCALL_BASE+ 60) -chroot (__NR_SYSCALL_BASE+ 61) -ustat (__NR_SYSCALL_BASE+ 62) -dup2 (__NR_SYSCALL_BASE+ 63) -getppid (__NR_SYSCALL_BASE+ 64) -getpgrp (__NR_SYSCALL_BASE+ 65) -setsid (__NR_SYSCALL_BASE+ 66) -sigaction (__NR_SYSCALL_BASE+ 67) -setreuid (__NR_SYSCALL_BASE+ 70) -setregid (__NR_SYSCALL_BASE+ 71) -sigsuspend (__NR_SYSCALL_BASE+ 72) -sigpending (__NR_SYSCALL_BASE+ 73) -sethostname (__NR_SYSCALL_BASE+ 74) -setrlimit (__NR_SYSCALL_BASE+ 75) -getrusage (__NR_SYSCALL_BASE+ 77) -gettimeofday (__NR_SYSCALL_BASE+ 78) -settimeofday (__NR_SYSCALL_BASE+ 79) -getgroups (__NR_SYSCALL_BASE+ 80) -setgroups (__NR_SYSCALL_BASE+ 81) -symlink (__NR_SYSCALL_BASE+ 83) -readlink (__NR_SYSCALL_BASE+ 85) -uselib (__NR_SYSCALL_BASE+ 86) -swapon (__NR_SYSCALL_BASE+ 87) -reboot (__NR_SYSCALL_BASE+ 88) -munmap (__NR_SYSCALL_BASE+ 91) -truncate (__NR_SYSCALL_BASE+ 92) -ftruncate (__NR_SYSCALL_BASE+ 93) -fchmod (__NR_SYSCALL_BASE+ 94) -fchown (__NR_SYSCALL_BASE+ 95) -getpriority (__NR_SYSCALL_BASE+ 96) -setpriority (__NR_SYSCALL_BASE+ 97) -statfs (__NR_SYSCALL_BASE+ 99) -fstatfs (__NR_SYSCALL_BASE+100) -syslog (__NR_SYSCALL_BASE+103) -setitimer (__NR_SYSCALL_BASE+104) -getitimer (__NR_SYSCALL_BASE+105) -stat (__NR_SYSCALL_BASE+106) -lstat (__NR_SYSCALL_BASE+107) -fstat (__NR_SYSCALL_BASE+108) -vhangup (__NR_SYSCALL_BASE+111) -wait4 (__NR_SYSCALL_BASE+114) -swapoff (__NR_SYSCALL_BASE+115) -sysinfo (__NR_SYSCALL_BASE+116) -fsync (__NR_SYSCALL_BASE+118) -sigreturn (__NR_SYSCALL_BASE+119) -clone (__NR_SYSCALL_BASE+120) -setdomainname (__NR_SYSCALL_BASE+121) -uname (__NR_SYSCALL_BASE+122) -adjtimex (__NR_SYSCALL_BASE+124) -mprotect (__NR_SYSCALL_BASE+125) -sigprocmask (__NR_SYSCALL_BASE+126) -init_module (__NR_SYSCALL_BASE+128) -delete_module (__NR_SYSCALL_BASE+129) -quotactl (__NR_SYSCALL_BASE+131) -getpgid (__NR_SYSCALL_BASE+132) -fchdir (__NR_SYSCALL_BASE+133) -bdflush (__NR_SYSCALL_BASE+134) -sysfs (__NR_SYSCALL_BASE+135) -personality (__NR_SYSCALL_BASE+136) -setfsuid (__NR_SYSCALL_BASE+138) -setfsgid (__NR_SYSCALL_BASE+139) -_llseek (__NR_SYSCALL_BASE+140) -getdents (__NR_SYSCALL_BASE+141) -_newselect (__NR_SYSCALL_BASE+142) -flock (__NR_SYSCALL_BASE+143) -msync (__NR_SYSCALL_BASE+144) -readv (__NR_SYSCALL_BASE+145) -writev (__NR_SYSCALL_BASE+146) -getsid (__NR_SYSCALL_BASE+147) -fdatasync (__NR_SYSCALL_BASE+148) -_sysctl (__NR_SYSCALL_BASE+149) -mlock (__NR_SYSCALL_BASE+150) -munlock (__NR_SYSCALL_BASE+151) -mlockall (__NR_SYSCALL_BASE+152) -munlockall (__NR_SYSCALL_BASE+153) -sched_setparam (__NR_SYSCALL_BASE+154) -sched_getparam (__NR_SYSCALL_BASE+155) -sched_setscheduler (__NR_SYSCALL_BASE+156) -sched_getscheduler (__NR_SYSCALL_BASE+157) -sched_yield (__NR_SYSCALL_BASE+158) -sched_get_priority_max (__NR_SYSCALL_BASE+159) -sched_get_priority_min (__NR_SYSCALL_BASE+160) -sched_rr_get_interval (__NR_SYSCALL_BASE+161) -nanosleep (__NR_SYSCALL_BASE+162) -mremap (__NR_SYSCALL_BASE+163) -setresuid (__NR_SYSCALL_BASE+164) -getresuid (__NR_SYSCALL_BASE+165) -poll (__NR_SYSCALL_BASE+168) -nfsservctl (__NR_SYSCALL_BASE+169) -setresgid (__NR_SYSCALL_BASE+170) -getresgid (__NR_SYSCALL_BASE+171) -prctl (__NR_SYSCALL_BASE+172) -rt_sigreturn (__NR_SYSCALL_BASE+173) -rt_sigaction (__NR_SYSCALL_BASE+174) -rt_sigprocmask (__NR_SYSCALL_BASE+175) -rt_sigpending (__NR_SYSCALL_BASE+176) -rt_sigtimedwait (__NR_SYSCALL_BASE+177) -rt_sigqueueinfo (__NR_SYSCALL_BASE+178) -rt_sigsuspend (__NR_SYSCALL_BASE+179) -pread64 (__NR_SYSCALL_BASE+180) -pwrite64 (__NR_SYSCALL_BASE+181) -chown (__NR_SYSCALL_BASE+182) -getcwd (__NR_SYSCALL_BASE+183) -capget (__NR_SYSCALL_BASE+184) -capset (__NR_SYSCALL_BASE+185) -sigaltstack (__NR_SYSCALL_BASE+186) -sendfile (__NR_SYSCALL_BASE+187) -vfork (__NR_SYSCALL_BASE+190) -ugetrlimit (__NR_SYSCALL_BASE+191) -mmap2 (__NR_SYSCALL_BASE+192) -truncate64 (__NR_SYSCALL_BASE+193) -ftruncate64 (__NR_SYSCALL_BASE+194) -stat64 (__NR_SYSCALL_BASE+195) -lstat64 (__NR_SYSCALL_BASE+196) -fstat64 (__NR_SYSCALL_BASE+197) -lchown32 (__NR_SYSCALL_BASE+198) -getuid32 (__NR_SYSCALL_BASE+199) -getgid32 (__NR_SYSCALL_BASE+200) -geteuid32 (__NR_SYSCALL_BASE+201) -getegid32 (__NR_SYSCALL_BASE+202) -setreuid32 (__NR_SYSCALL_BASE+203) -setregid32 (__NR_SYSCALL_BASE+204) -getgroups32 (__NR_SYSCALL_BASE+205) -setgroups32 (__NR_SYSCALL_BASE+206) -fchown32 (__NR_SYSCALL_BASE+207) -setresuid32 (__NR_SYSCALL_BASE+208) -getresuid32 (__NR_SYSCALL_BASE+209) -setresgid32 (__NR_SYSCALL_BASE+210) -getresgid32 (__NR_SYSCALL_BASE+211) -chown32 (__NR_SYSCALL_BASE+212) -setuid32 (__NR_SYSCALL_BASE+213) -setgid32 (__NR_SYSCALL_BASE+214) -setfsuid32 (__NR_SYSCALL_BASE+215) -setfsgid32 (__NR_SYSCALL_BASE+216) -getdents64 (__NR_SYSCALL_BASE+217) -pivot_root (__NR_SYSCALL_BASE+218) -mincore (__NR_SYSCALL_BASE+219) -madvise (__NR_SYSCALL_BASE+220) -fcntl64 (__NR_SYSCALL_BASE+221) -gettid (__NR_SYSCALL_BASE+224) -readahead (__NR_SYSCALL_BASE+225) -setxattr (__NR_SYSCALL_BASE+226) -lsetxattr (__NR_SYSCALL_BASE+227) -fsetxattr (__NR_SYSCALL_BASE+228) -getxattr (__NR_SYSCALL_BASE+229) -lgetxattr (__NR_SYSCALL_BASE+230) -fgetxattr (__NR_SYSCALL_BASE+231) -listxattr (__NR_SYSCALL_BASE+232) -llistxattr (__NR_SYSCALL_BASE+233) -flistxattr (__NR_SYSCALL_BASE+234) -removexattr (__NR_SYSCALL_BASE+235) -lremovexattr (__NR_SYSCALL_BASE+236) -fremovexattr (__NR_SYSCALL_BASE+237) -tkill (__NR_SYSCALL_BASE+238) -sendfile64 (__NR_SYSCALL_BASE+239) -futex (__NR_SYSCALL_BASE+240) -sched_setaffinity (__NR_SYSCALL_BASE+241) -sched_getaffinity (__NR_SYSCALL_BASE+242) -io_setup (__NR_SYSCALL_BASE+243) -io_destroy (__NR_SYSCALL_BASE+244) -io_getevents (__NR_SYSCALL_BASE+245) -io_submit (__NR_SYSCALL_BASE+246) -io_cancel (__NR_SYSCALL_BASE+247) -exit_group (__NR_SYSCALL_BASE+248) -lookup_dcookie (__NR_SYSCALL_BASE+249) -epoll_create (__NR_SYSCALL_BASE+250) -epoll_ctl (__NR_SYSCALL_BASE+251) -epoll_wait (__NR_SYSCALL_BASE+252) -remap_file_pages (__NR_SYSCALL_BASE+253) -set_tid_address (__NR_SYSCALL_BASE+256) -timer_create (__NR_SYSCALL_BASE+257) -timer_settime (__NR_SYSCALL_BASE+258) -timer_gettime (__NR_SYSCALL_BASE+259) -timer_getoverrun (__NR_SYSCALL_BASE+260) -timer_delete (__NR_SYSCALL_BASE+261) -clock_settime (__NR_SYSCALL_BASE+262) -clock_gettime (__NR_SYSCALL_BASE+263) -clock_getres (__NR_SYSCALL_BASE+264) -clock_nanosleep (__NR_SYSCALL_BASE+265) -statfs64 (__NR_SYSCALL_BASE+266) -fstatfs64 (__NR_SYSCALL_BASE+267) -tgkill (__NR_SYSCALL_BASE+268) -utimes (__NR_SYSCALL_BASE+269) -arm_fadvise64_64 (__NR_SYSCALL_BASE+270) -pciconfig_iobase (__NR_SYSCALL_BASE+271) -pciconfig_read (__NR_SYSCALL_BASE+272) -pciconfig_write (__NR_SYSCALL_BASE+273) -mq_open (__NR_SYSCALL_BASE+274) -mq_unlink (__NR_SYSCALL_BASE+275) -mq_timedsend (__NR_SYSCALL_BASE+276) -mq_timedreceive (__NR_SYSCALL_BASE+277) -mq_notify (__NR_SYSCALL_BASE+278) -mq_getsetattr (__NR_SYSCALL_BASE+279) -waitid (__NR_SYSCALL_BASE+280) -socket (__NR_SYSCALL_BASE+281) -bind (__NR_SYSCALL_BASE+282) -connect (__NR_SYSCALL_BASE+283) -listen (__NR_SYSCALL_BASE+284) -accept (__NR_SYSCALL_BASE+285) -getsockname (__NR_SYSCALL_BASE+286) -getpeername (__NR_SYSCALL_BASE+287) -socketpair (__NR_SYSCALL_BASE+288) -send (__NR_SYSCALL_BASE+289) -sendto (__NR_SYSCALL_BASE+290) -recv (__NR_SYSCALL_BASE+291) -recvfrom (__NR_SYSCALL_BASE+292) -shutdown (__NR_SYSCALL_BASE+293) -setsockopt (__NR_SYSCALL_BASE+294) -getsockopt (__NR_SYSCALL_BASE+295) -sendmsg (__NR_SYSCALL_BASE+296) -recvmsg (__NR_SYSCALL_BASE+297) -semop (__NR_SYSCALL_BASE+298) -semget (__NR_SYSCALL_BASE+299) -semctl (__NR_SYSCALL_BASE+300) -msgsnd (__NR_SYSCALL_BASE+301) -msgrcv (__NR_SYSCALL_BASE+302) -msgget (__NR_SYSCALL_BASE+303) -msgctl (__NR_SYSCALL_BASE+304) -shmat (__NR_SYSCALL_BASE+305) -shmdt (__NR_SYSCALL_BASE+306) -shmget (__NR_SYSCALL_BASE+307) -shmctl (__NR_SYSCALL_BASE+308) -add_key (__NR_SYSCALL_BASE+309) -request_key (__NR_SYSCALL_BASE+310) -keyctl (__NR_SYSCALL_BASE+311) -semtimedop (__NR_SYSCALL_BASE+312) -vserver (__NR_SYSCALL_BASE+313) -ioprio_set (__NR_SYSCALL_BASE+314) -ioprio_get (__NR_SYSCALL_BASE+315) -inotify_init (__NR_SYSCALL_BASE+316) -inotify_add_watch (__NR_SYSCALL_BASE+317) -inotify_rm_watch (__NR_SYSCALL_BASE+318) -mbind (__NR_SYSCALL_BASE+319) -get_mempolicy (__NR_SYSCALL_BASE+320) -set_mempolicy (__NR_SYSCALL_BASE+321) -openat (__NR_SYSCALL_BASE+322) -mkdirat (__NR_SYSCALL_BASE+323) -mknodat (__NR_SYSCALL_BASE+324) -fchownat (__NR_SYSCALL_BASE+325) -futimesat (__NR_SYSCALL_BASE+326) -fstatat64 (__NR_SYSCALL_BASE+327) -unlinkat (__NR_SYSCALL_BASE+328) -renameat (__NR_SYSCALL_BASE+329) -linkat (__NR_SYSCALL_BASE+330) -symlinkat (__NR_SYSCALL_BASE+331) -readlinkat (__NR_SYSCALL_BASE+332) -fchmodat (__NR_SYSCALL_BASE+333) -faccessat (__NR_SYSCALL_BASE+334) -pselect6 (__NR_SYSCALL_BASE+335) -ppoll (__NR_SYSCALL_BASE+336) -unshare (__NR_SYSCALL_BASE+337) -set_robust_list (__NR_SYSCALL_BASE+338) -get_robust_list (__NR_SYSCALL_BASE+339) -splice (__NR_SYSCALL_BASE+340) -arm_sync_file_range (__NR_SYSCALL_BASE+341) -sync_file_range2 __NR_arm_sync_file_range -tee (__NR_SYSCALL_BASE+342) -vmsplice (__NR_SYSCALL_BASE+343) -move_pages (__NR_SYSCALL_BASE+344) -getcpu (__NR_SYSCALL_BASE+345) -epoll_pwait (__NR_SYSCALL_BASE+346) -kexec_load (__NR_SYSCALL_BASE+347) -utimensat (__NR_SYSCALL_BASE+348) -signalfd (__NR_SYSCALL_BASE+349) -timerfd_create (__NR_SYSCALL_BASE+350) -eventfd (__NR_SYSCALL_BASE+351) -fallocate (__NR_SYSCALL_BASE+352) -timerfd_settime (__NR_SYSCALL_BASE+353) -timerfd_gettime (__NR_SYSCALL_BASE+354) -signalfd4 (__NR_SYSCALL_BASE+355) -eventfd2 (__NR_SYSCALL_BASE+356) -epoll_create1 (__NR_SYSCALL_BASE+357) -dup3 (__NR_SYSCALL_BASE+358) -pipe2 (__NR_SYSCALL_BASE+359) -inotify_init1 (__NR_SYSCALL_BASE+360) -preadv (__NR_SYSCALL_BASE+361) -pwritev (__NR_SYSCALL_BASE+362) -rt_tgsigqueueinfo (__NR_SYSCALL_BASE+363) -perf_event_open (__NR_SYSCALL_BASE+364) -recvmmsg (__NR_SYSCALL_BASE+365) -accept4 (__NR_SYSCALL_BASE+366) -fanotify_init (__NR_SYSCALL_BASE+367) -fanotify_mark (__NR_SYSCALL_BASE+368) -prlimit64 (__NR_SYSCALL_BASE+369) -name_to_handle_at (__NR_SYSCALL_BASE+370) -open_by_handle_at (__NR_SYSCALL_BASE+371) -clock_adjtime (__NR_SYSCALL_BASE+372) -syncfs (__NR_SYSCALL_BASE+373) -sendmmsg (__NR_SYSCALL_BASE+374) -setns (__NR_SYSCALL_BASE+375) -process_vm_readv (__NR_SYSCALL_BASE+376) -process_vm_writev (__NR_SYSCALL_BASE+377) -kcmp (__NR_SYSCALL_BASE+378) -finit_module (__NR_SYSCALL_BASE+379) -sched_setattr (__NR_SYSCALL_BASE+380) -sched_getattr (__NR_SYSCALL_BASE+381) -renameat2 (__NR_SYSCALL_BASE+382) -seccomp (__NR_SYSCALL_BASE+383) -getrandom (__NR_SYSCALL_BASE+384) -memfd_create (__NR_SYSCALL_BASE+385) -bpf (__NR_SYSCALL_BASE+386) -execveat (__NR_SYSCALL_BASE+387) -userfaultfd (__NR_SYSCALL_BASE+388) -membarrier (__NR_SYSCALL_BASE+389) -mlock2 (__NR_SYSCALL_BASE+390) -copy_file_range (__NR_SYSCALL_BASE+391) -preadv2 (__NR_SYSCALL_BASE+392) -pwritev2 (__NR_SYSCALL_BASE+393) -pkey_mprotect (__NR_SYSCALL_BASE+394) -pkey_alloc (__NR_SYSCALL_BASE+395) -pkey_free (__NR_SYSCALL_BASE+396) -statx (__NR_SYSCALL_BASE+397) -rseq (__NR_SYSCALL_BASE+398) -io_pgetevents (__NR_SYSCALL_BASE+399) -migrate_pages (__NR_SYSCALL_BASE+400) -kexec_file_load (__NR_SYSCALL_BASE+401) -clock_gettime64 (__NR_SYSCALL_BASE+403) -clock_settime64 (__NR_SYSCALL_BASE+404) -clock_adjtime64 (__NR_SYSCALL_BASE+405) -clock_getres_time64 (__NR_SYSCALL_BASE+406) -clock_nanosleep_time64 (__NR_SYSCALL_BASE+407) -timer_gettime64 (__NR_SYSCALL_BASE+408) -timer_settime64 (__NR_SYSCALL_BASE+409) -timerfd_gettime64 (__NR_SYSCALL_BASE+410) -timerfd_settime64 (__NR_SYSCALL_BASE+411) -utimensat_time64 (__NR_SYSCALL_BASE+412) -pselect6_time64 (__NR_SYSCALL_BASE+413) -ppoll_time64 (__NR_SYSCALL_BASE+414) -io_pgetevents_time64 (__NR_SYSCALL_BASE+416) -recvmmsg_time64 (__NR_SYSCALL_BASE+417) -mq_timedsend_time64 (__NR_SYSCALL_BASE+418) -mq_timedreceive_time64 (__NR_SYSCALL_BASE+419) -semtimedop_time64 (__NR_SYSCALL_BASE+420) -rt_sigtimedwait_time64 (__NR_SYSCALL_BASE+421) -futex_time64 (__NR_SYSCALL_BASE+422) -sched_rr_get_interval_time64 (__NR_SYSCALL_BASE+423) -pidfd_send_signal (__NR_SYSCALL_BASE+424) -io_uring_setup (__NR_SYSCALL_BASE+425) -io_uring_enter (__NR_SYSCALL_BASE+426) -io_uring_register (__NR_SYSCALL_BASE+427) -open_tree (__NR_SYSCALL_BASE+428) -move_mount (__NR_SYSCALL_BASE+429) -fsopen (__NR_SYSCALL_BASE+430) -fsconfig (__NR_SYSCALL_BASE+431) -fsmount (__NR_SYSCALL_BASE+432) -fspick (__NR_SYSCALL_BASE+433) -pidfd_open (__NR_SYSCALL_BASE+434) -clone3 (__NR_SYSCALL_BASE+435) -openat2 (__NR_SYSCALL_BASE+437) -pidfd_getfd (__NR_SYSCALL_BASE+438) diff --git a/fsstress/include/lapi/syscalls/hppa.in b/fsstress/include/lapi/syscalls/hppa.in deleted file mode 100644 index 7f9b5e0a01..0000000000 --- a/fsstress/include/lapi/syscalls/hppa.in +++ /dev/null @@ -1,41 +0,0 @@ -_sysctl 149 -openat 275 -mkdirat (__NR_openat + 1) -mknodat (__NR_openat + 2) -fchownat (__NR_openat + 3) -futimesat (__NR_openat + 4) -newfstatat (__NR_openat + 5) -fstatat64 (__NR_openat + 5) -unlinkat (__NR_openat + 6) -renameat (__NR_openat + 7) -linkat (__NR_openat + 8) -symlinkat (__NR_openat + 9) -readlinkat (__NR_openat + 10) -fchmodat (__NR_openat + 11) -faccessat (__NR_openat + 12) -splice 291 -tee 293 -vmsplice 294 -syncfs 327 -setns 328 -process_vm_readv 330 -process_vm_writev 331 -memfd_create 340 -membarrier 343 -execveat 342 -mlock2 345 -copy_file_range 346 -preadv2 347 -pwritev2 348 -io_pgetevents 350 -pidfd_send_signal 424 -io_uring_setup 425 -io_uring_enter 426 -io_uring_register 427 -open_tree 428 -move_mount 429 -fsopen 430 -fsconfig 431 -fsmount 432 -fspick 433 -pidfd_open 434 diff --git a/fsstress/include/lapi/syscalls/i386.in b/fsstress/include/lapi/syscalls/i386.in deleted file mode 100644 index d6773abcb0..0000000000 --- a/fsstress/include/lapi/syscalls/i386.in +++ /dev/null @@ -1,428 +0,0 @@ -restart_syscall 0 -exit 1 -fork 2 -read 3 -write 4 -open 5 -close 6 -waitpid 7 -creat 8 -link 9 -unlink 10 -execve 11 -chdir 12 -time 13 -mknod 14 -chmod 15 -lchown 16 -break 17 -oldstat 18 -lseek 19 -getpid 20 -mount 21 -umount 22 -setuid 23 -getuid 24 -stime 25 -ptrace 26 -alarm 27 -oldfstat 28 -pause 29 -utime 30 -stty 31 -gtty 32 -access 33 -nice 34 -ftime 35 -sync 36 -kill 37 -rename 38 -mkdir 39 -rmdir 40 -dup 41 -pipe 42 -times 43 -prof 44 -brk 45 -setgid 46 -getgid 47 -signal 48 -geteuid 49 -getegid 50 -acct 51 -umount2 52 -lock 53 -ioctl 54 -fcntl 55 -mpx 56 -setpgid 57 -ulimit 58 -oldolduname 59 -umask 60 -chroot 61 -ustat 62 -dup2 63 -getppid 64 -getpgrp 65 -setsid 66 -sigaction 67 -sgetmask 68 -ssetmask 69 -setreuid 70 -setregid 71 -sigsuspend 72 -sigpending 73 -sethostname 74 -setrlimit 75 -getrlimit 76 -getrusage 77 -gettimeofday 78 -settimeofday 79 -getgroups 80 -setgroups 81 -select 82 -symlink 83 -oldlstat 84 -readlink 85 -uselib 86 -swapon 87 -reboot 88 -readdir 89 -mmap 90 -munmap 91 -truncate 92 -ftruncate 93 -fchmod 94 -fchown 95 -getpriority 96 -setpriority 97 -profil 98 -statfs 99 -fstatfs 100 -ioperm 101 -socketcall 102 -syslog 103 -setitimer 104 -getitimer 105 -stat 106 -lstat 107 -fstat 108 -olduname 109 -iopl 110 -vhangup 111 -idle 112 -vm86old 113 -wait4 114 -swapoff 115 -sysinfo 116 -ipc 117 -fsync 118 -sigreturn 119 -clone 120 -setdomainname 121 -uname 122 -modify_ldt 123 -adjtimex 124 -mprotect 125 -sigprocmask 126 -create_module 127 -init_module 128 -delete_module 129 -get_kernel_syms 130 -quotactl 131 -getpgid 132 -fchdir 133 -bdflush 134 -sysfs 135 -personality 136 -afs_syscall 137 -setfsuid 138 -setfsgid 139 -_llseek 140 -getdents 141 -_newselect 142 -flock 143 -msync 144 -readv 145 -writev 146 -getsid 147 -fdatasync 148 -_sysctl 149 -mlock 150 -munlock 151 -mlockall 152 -munlockall 153 -sched_setparam 154 -sched_getparam 155 -sched_setscheduler 156 -sched_getscheduler 157 -sched_yield 158 -sched_get_priority_max 159 -sched_get_priority_min 160 -sched_rr_get_interval 161 -nanosleep 162 -mremap 163 -setresuid 164 -getresuid 165 -vm86 166 -query_module 167 -poll 168 -nfsservctl 169 -setresgid 170 -getresgid 171 -prctl 172 -rt_sigreturn 173 -rt_sigaction 174 -rt_sigprocmask 175 -rt_sigpending 176 -rt_sigtimedwait 177 -rt_sigqueueinfo 178 -rt_sigsuspend 179 -pread64 180 -pwrite64 181 -chown 182 -getcwd 183 -capget 184 -capset 185 -sigaltstack 186 -sendfile 187 -getpmsg 188 -putpmsg 189 -vfork 190 -ugetrlimit 191 -mmap2 192 -truncate64 193 -ftruncate64 194 -stat64 195 -lstat64 196 -fstat64 197 -lchown32 198 -getuid32 199 -getgid32 200 -geteuid32 201 -getegid32 202 -setreuid32 203 -setregid32 204 -getgroups32 205 -setgroups32 206 -fchown32 207 -setresuid32 208 -getresuid32 209 -setresgid32 210 -getresgid32 211 -chown32 212 -setuid32 213 -setgid32 214 -setfsuid32 215 -setfsgid32 216 -pivot_root 217 -mincore 218 -madvise 219 -madvise1 219 -getdents64 220 -fcntl64 221 -gettid 224 -readahead 225 -setxattr 226 -lsetxattr 227 -fsetxattr 228 -getxattr 229 -lgetxattr 230 -fgetxattr 231 -listxattr 232 -llistxattr 233 -flistxattr 234 -removexattr 235 -lremovexattr 236 -fremovexattr 237 -tkill 238 -sendfile64 239 -futex 240 -sched_setaffinity 241 -sched_getaffinity 242 -set_thread_area 243 -get_thread_area 244 -io_setup 245 -io_destroy 246 -io_getevents 247 -io_submit 248 -io_cancel 249 -fadvise64 250 -exit_group 252 -lookup_dcookie 253 -epoll_create 254 -epoll_ctl 255 -epoll_wait 256 -remap_file_pages 257 -set_tid_address 258 -timer_create 259 -timer_settime 260 -timer_gettime 261 -timer_getoverrun 262 -timer_delete 263 -clock_settime 264 -clock_gettime 265 -clock_getres 266 -clock_nanosleep 267 -statfs64 268 -fstatfs64 269 -tgkill 270 -utimes 271 -fadvise64_64 272 -vserver 273 -mbind 274 -get_mempolicy 275 -set_mempolicy 276 -mq_open 277 -mq_unlink 278 -mq_timedsend 279 -mq_timedreceive 280 -mq_notify 281 -mq_getsetattr 282 -kexec_load 283 -waitid 284 -add_key 286 -request_key 287 -keyctl 288 -ioprio_set 289 -ioprio_get 290 -inotify_init 291 -inotify_add_watch 292 -inotify_rm_watch 293 -migrate_pages 294 -openat 295 -mkdirat 296 -mknodat 297 -fchownat 298 -futimesat 299 -fstatat64 300 -unlinkat 301 -renameat 302 -linkat 303 -symlinkat 304 -readlinkat 305 -fchmodat 306 -faccessat 307 -pselect6 308 -ppoll 309 -unshare 310 -set_robust_list 311 -get_robust_list 312 -splice 313 -sync_file_range 314 -tee 315 -vmsplice 316 -move_pages 317 -getcpu 318 -epoll_pwait 319 -utimensat 320 -signalfd 321 -timerfd_create 322 -eventfd 323 -fallocate 324 -timerfd_settime 325 -timerfd_gettime 326 -signalfd4 327 -eventfd2 328 -epoll_create1 329 -dup3 330 -pipe2 331 -inotify_init1 332 -preadv 333 -pwritev 334 -rt_tgsigqueueinfo 335 -perf_event_open 336 -recvmmsg 337 -fanotify_init 338 -fanotify_mark 339 -prlimit64 340 -name_to_handle_at 341 -open_by_handle_at 342 -clock_adjtime 343 -syncfs 344 -sendmmsg 345 -setns 346 -process_vm_readv 347 -process_vm_writev 348 -kcmp 349 -finit_module 350 -sched_setattr 351 -sched_getattr 352 -renameat2 353 -seccomp 354 -getrandom 355 -memfd_create 356 -bpf 357 -execveat 358 -socket 359 -socketpair 360 -bind 361 -connect 362 -listen 363 -accept4 364 -getsockopt 365 -setsockopt 366 -getsockname 367 -getpeername 368 -sendto 369 -sendmsg 370 -recvfrom 371 -recvmsg 372 -shutdown 373 -userfaultfd 374 -membarrier 375 -mlock2 376 -copy_file_range 377 -preadv2 378 -pwritev2 379 -pkey_mprotect 380 -pkey_alloc 381 -pkey_free 382 -statx 383 -arch_prctl 384 -io_pgetevents 385 -rseq 386 -semget 393 -semctl 394 -shmget 395 -shmctl 396 -shmat 397 -shmdt 398 -msgget 399 -msgsnd 400 -msgrcv 401 -msgctl 402 -clock_gettime64 403 -clock_settime64 404 -clock_adjtime64 405 -clock_getres_time64 406 -clock_nanosleep_time64 407 -timer_gettime64 408 -timer_settime64 409 -timerfd_gettime64 410 -timerfd_settime64 411 -utimensat_time64 412 -pselect6_time64 413 -ppoll_time64 414 -io_pgetevents_time64 416 -recvmmsg_time64 417 -mq_timedsend_time64 418 -mq_timedreceive_time64 419 -semtimedop_time64 420 -rt_sigtimedwait_time64 421 -futex_time64 422 -sched_rr_get_interval_time64 423 -pidfd_send_signal 424 -io_uring_setup 425 -io_uring_enter 426 -io_uring_register 427 -open_tree 428 -move_mount 429 -fsopen 430 -fsconfig 431 -fsmount 432 -fspick 433 -pidfd_open 434 -clone3 435 -openat2 437 -pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/ia64.in b/fsstress/include/lapi/syscalls/ia64.in deleted file mode 100644 index 427b711b1c..0000000000 --- a/fsstress/include/lapi/syscalls/ia64.in +++ /dev/null @@ -1,341 +0,0 @@ -ni_syscall 1024 -exit 1025 -read 1026 -write 1027 -open 1028 -close 1029 -creat 1030 -link 1031 -unlink 1032 -execve 1033 -chdir 1034 -fchdir 1035 -utimes 1036 -mknod 1037 -chmod 1038 -chown 1039 -lseek 1040 -getpid 1041 -getppid 1042 -mount 1043 -umount2 1044 -setuid 1045 -getuid 1046 -geteuid 1047 -ptrace 1048 -access 1049 -sync 1050 -fsync 1051 -fdatasync 1052 -kill 1053 -rename 1054 -mkdir 1055 -rmdir 1056 -dup 1057 -pipe 1058 -times 1059 -brk 1060 -setgid 1061 -getgid 1062 -getegid 1063 -acct 1064 -ioctl 1065 -fcntl 1066 -umask 1067 -chroot 1068 -ustat 1069 -dup2 1070 -setreuid 1071 -setregid 1072 -getresuid 1073 -setresuid 1074 -getresgid 1075 -setresgid 1076 -getgroups 1077 -setgroups 1078 -getpgid 1079 -setpgid 1080 -setsid 1081 -getsid 1082 -sethostname 1083 -setrlimit 1084 -getrlimit 1085 -getrusage 1086 -gettimeofday 1087 -settimeofday 1088 -select 1089 -poll 1090 -symlink 1091 -readlink 1092 -uselib 1093 -swapon 1094 -swapoff 1095 -reboot 1096 -truncate 1097 -ftruncate 1098 -fchmod 1099 -fchown 1100 -getpriority 1101 -setpriority 1102 -statfs 1103 -fstatfs 1104 -gettid 1105 -semget 1106 -semop 1107 -semctl 1108 -msgget 1109 -msgsnd 1110 -msgrcv 1111 -msgctl 1112 -shmget 1113 -shmat 1114 -shmdt 1115 -shmctl 1116 -syslog 1117 -setitimer 1118 -getitimer 1119 -vhangup 1123 -lchown 1124 -remap_file_pages 1125 -wait4 1126 -sysinfo 1127 -clone 1128 -setdomainname 1129 -uname 1130 -adjtimex 1131 -init_module 1133 -delete_module 1134 -quotactl 1137 -bdflush 1138 -sysfs 1139 -personality 1140 -afs_syscall 1141 -setfsuid 1142 -setfsgid 1143 -getdents 1144 -flock 1145 -readv 1146 -writev 1147 -pread64 1148 -pwrite64 1149 -_sysctl 1150 -mmap 1151 -munmap 1152 -mlock 1153 -mlockall 1154 -mprotect 1155 -mremap 1156 -msync 1157 -munlock 1158 -munlockall 1159 -sched_getparam 1160 -sched_setparam 1161 -sched_getscheduler 1162 -sched_setscheduler 1163 -sched_yield 1164 -sched_get_priority_max 1165 -sched_get_priority_min 1166 -sched_rr_get_interval 1167 -nanosleep 1168 -nfsservctl 1169 -prctl 1170 -old_getpagesize 1171 -mmap2 1172 -pciconfig_read 1173 -pciconfig_write 1174 -perfmonctl 1175 -sigaltstack 1176 -rt_sigaction 1177 -rt_sigpending 1178 -rt_sigprocmask 1179 -rt_sigqueueinfo 1180 -rt_sigreturn 1181 -rt_sigsuspend 1182 -rt_sigtimedwait 1183 -getcwd 1184 -capget 1185 -capset 1186 -sendfile 1187 -getpmsg 1188 -putpmsg 1189 -socket 1190 -bind 1191 -connect 1192 -listen 1193 -accept 1194 -getsockname 1195 -getpeername 1196 -socketpair 1197 -send 1198 -sendto 1199 -recv 1200 -recvfrom 1201 -shutdown 1202 -setsockopt 1203 -getsockopt 1204 -sendmsg 1205 -recvmsg 1206 -pivot_root 1207 -mincore 1208 -madvise 1209 -stat 1210 -lstat 1211 -fstat 1212 -clone2 1213 -getdents64 1214 -getunwind 1215 -readahead 1216 -setxattr 1217 -lsetxattr 1218 -fsetxattr 1219 -getxattr 1220 -lgetxattr 1221 -fgetxattr 1222 -listxattr 1223 -llistxattr 1224 -flistxattr 1225 -removexattr 1226 -lremovexattr 1227 -fremovexattr 1228 -tkill 1229 -futex 1230 -sched_setaffinity 1231 -sched_getaffinity 1232 -set_tid_address 1233 -fadvise64 1234 -tgkill 1235 -exit_group 1236 -lookup_dcookie 1237 -io_setup 1238 -io_destroy 1239 -io_getevents 1240 -io_submit 1241 -io_cancel 1242 -epoll_create 1243 -epoll_ctl 1244 -epoll_wait 1245 -restart_syscall 1246 -semtimedop 1247 -timer_create 1248 -timer_settime 1249 -timer_gettime 1250 -timer_getoverrun 1251 -timer_delete 1252 -clock_settime 1253 -clock_gettime 1254 -clock_getres 1255 -clock_nanosleep 1256 -fstatfs64 1257 -statfs64 1258 -mbind 1259 -get_mempolicy 1260 -set_mempolicy 1261 -mq_open 1262 -mq_unlink 1263 -mq_timedsend 1264 -mq_timedreceive 1265 -mq_notify 1266 -mq_getsetattr 1267 -kexec_load 1268 -vserver 1269 -waitid 1270 -add_key 1271 -request_key 1272 -keyctl 1273 -ioprio_set 1274 -ioprio_get 1275 -move_pages 1276 -inotify_init 1277 -inotify_add_watch 1278 -inotify_rm_watch 1279 -migrate_pages 1280 -openat 1281 -mkdirat 1282 -mknodat 1283 -fchownat 1284 -futimesat 1285 -newfstatat 1286 -unlinkat 1287 -renameat 1288 -linkat 1289 -symlinkat 1290 -readlinkat 1291 -fchmodat 1292 -faccessat 1293 -pselect6 1294 -ppoll 1295 -unshare 1296 -splice 1297 -set_robust_list 1298 -get_robust_list 1299 -sync_file_range 1300 -tee 1301 -vmsplice 1302 -fallocate 1303 -getcpu 1304 -epoll_pwait 1305 -utimensat 1306 -signalfd 1307 -timerfd 1308 -eventfd 1309 -timerfd_create 1310 -timerfd_settime 1311 -timerfd_gettime 1312 -signalfd4 1313 -eventfd2 1314 -epoll_create1 1315 -dup3 1316 -pipe2 1317 -inotify_init1 1318 -preadv 1319 -pwritev 1320 -rt_tgsigqueueinfo 1321 -recvmmsg 1322 -fanotify_init 1323 -fanotify_mark 1324 -prlimit64 1325 -name_to_handle_at 1326 -open_by_handle_at 1327 -clock_adjtime 1328 -syncfs 1329 -setns 1330 -sendmmsg 1331 -process_vm_readv 1332 -process_vm_writev 1333 -accept4 1334 -finit_module 1335 -sched_setattr 1336 -sched_getattr 1337 -renameat2 1338 -getrandom 1339 -memfd_create 1340 -bpf 1341 -execveat 1342 -userfaultfd 1343 -membarrier 1344 -kcmp 1345 -mlock2 1346 -copy_file_range 1347 -preadv2 1348 -pwritev2 1349 -statx 1350 -io_pgetevents 1351 -perf_event_open 1352 -seccomp 1353 -pkey_mprotect 1354 -pkey_alloc 1355 -pkey_free 1356 -rseq 1357 -pidfd_send_signal 1448 -io_uring_setup 1449 -io_uring_enter 1450 -io_uring_register 1451 -open_tree 1452 -move_mount 1453 -fsopen 1454 -fsconfig 1455 -fsmount 1456 -fspick 1457 -pidfd_open 1458 -openat2 1461 -pidfd_getfd 1462 diff --git a/fsstress/include/lapi/syscalls/mips_n32.in b/fsstress/include/lapi/syscalls/mips_n32.in deleted file mode 100644 index eb6140ebc4..0000000000 --- a/fsstress/include/lapi/syscalls/mips_n32.in +++ /dev/null @@ -1,366 +0,0 @@ -read 0 -write 1 -open 2 -close 3 -stat 4 -fstat 5 -lstat 6 -poll 7 -lseek 8 -mmap 9 -mprotect 10 -munmap 11 -brk 12 -rt_sigaction 13 -rt_sigprocmask 14 -ioctl 15 -pread64 16 -pwrite64 17 -readv 18 -writev 19 -access 20 -pipe 21 -_newselect 22 -sched_yield 23 -mremap 24 -msync 25 -mincore 26 -madvise 27 -shmget 28 -shmat 29 -shmctl 30 -dup 31 -dup2 32 -pause 33 -nanosleep 34 -getitimer 35 -setitimer 36 -alarm 37 -getpid 38 -sendfile 39 -socket 40 -connect 41 -accept 42 -sendto 43 -recvfrom 44 -sendmsg 45 -recvmsg 46 -shutdown 47 -bind 48 -listen 49 -getsockname 50 -getpeername 51 -socketpair 52 -setsockopt 53 -getsockopt 54 -clone 55 -fork 56 -execve 57 -exit 58 -wait4 59 -kill 60 -uname 61 -semget 62 -semop 63 -semctl 64 -shmdt 65 -msgget 66 -msgsnd 67 -msgrcv 68 -msgctl 69 -fcntl 70 -flock 71 -fsync 72 -fdatasync 73 -truncate 74 -ftruncate 75 -getdents 76 -getcwd 77 -chdir 78 -fchdir 79 -rename 80 -mkdir 81 -rmdir 82 -creat 83 -link 84 -unlink 85 -symlink 86 -readlink 87 -chmod 88 -fchmod 89 -chown 90 -fchown 91 -lchown 92 -umask 93 -gettimeofday 94 -getrlimit 95 -getrusage 96 -sysinfo 97 -times 98 -ptrace 99 -getuid 100 -syslog 101 -getgid 102 -setuid 103 -setgid 104 -geteuid 105 -getegid 106 -setpgid 107 -getppid 108 -getpgrp 109 -setsid 110 -setreuid 111 -setregid 112 -getgroups 113 -setgroups 114 -setresuid 115 -getresuid 116 -setresgid 117 -getresgid 118 -getpgid 119 -setfsuid 120 -setfsgid 121 -getsid 122 -capget 123 -capset 124 -rt_sigpending 125 -rt_sigtimedwait 126 -rt_sigqueueinfo 127 -rt_sigsuspend 128 -sigaltstack 129 -utime 130 -mknod 131 -personality 132 -ustat 133 -statfs 134 -fstatfs 135 -sysfs 136 -getpriority 137 -setpriority 138 -sched_setparam 139 -sched_getparam 140 -sched_setscheduler 141 -sched_getscheduler 142 -sched_get_priority_max 143 -sched_get_priority_min 144 -sched_rr_get_interval 145 -mlock 146 -munlock 147 -mlockall 148 -munlockall 149 -vhangup 150 -pivot_root 151 -_sysctl 152 -prctl 153 -adjtimex 154 -setrlimit 155 -chroot 156 -sync 157 -acct 158 -settimeofday 159 -mount 160 -umount2 161 -swapon 162 -swapoff 163 -reboot 164 -sethostname 165 -setdomainname 166 -create_module 167 -init_module 168 -delete_module 169 -get_kernel_syms 170 -query_module 171 -quotactl 172 -nfsservctl 173 -getpmsg 174 -putpmsg 175 -afs_syscall 176 -reserved177 177 -gettid 178 -readahead 179 -setxattr 180 -lsetxattr 181 -fsetxattr 182 -getxattr 183 -lgetxattr 184 -fgetxattr 185 -listxattr 186 -llistxattr 187 -flistxattr 188 -removexattr 189 -lremovexattr 190 -fremovexattr 191 -tkill 192 -reserved193 193 -futex 194 -sched_setaffinity 195 -sched_getaffinity 196 -cacheflush 197 -cachectl 198 -sysmips 199 -io_setup 200 -io_destroy 201 -io_getevents 202 -io_submit 203 -io_cancel 204 -exit_group 205 -lookup_dcookie 206 -epoll_create 207 -epoll_ctl 208 -epoll_wait 209 -remap_file_pages 210 -rt_sigreturn 211 -fcntl64 212 -set_tid_address 213 -restart_syscall 214 -semtimedop 215 -fadvise64 216 -statfs64 217 -fstatfs64 218 -sendfile64 219 -timer_create 220 -timer_settime 221 -timer_gettime 222 -timer_getoverrun 223 -timer_delete 224 -clock_settime 225 -clock_gettime 226 -clock_getres 227 -clock_nanosleep 228 -tgkill 229 -utimes 230 -mbind 231 -get_mempolicy 232 -set_mempolicy 233 -mq_open 234 -mq_unlink 235 -mq_timedsend 236 -mq_timedreceive 237 -mq_notify 238 -mq_getsetattr 239 -vserver 240 -waitid 241 -add_key 243 -request_key 244 -keyctl 245 -set_thread_area 246 -inotify_init 247 -inotify_add_watch 248 -inotify_rm_watch 249 -migrate_pages 250 -openat 251 -mkdirat 252 -mknodat 253 -fchownat 254 -futimesat 255 -newfstatat 256 -unlinkat 257 -renameat 258 -linkat 259 -symlinkat 260 -readlinkat 261 -fchmodat 262 -faccessat 263 -pselect6 264 -ppoll 265 -unshare 266 -splice 267 -sync_file_range 268 -tee 269 -vmsplice 270 -move_pages 271 -set_robust_list 272 -get_robust_list 273 -kexec_load 274 -getcpu 275 -epoll_pwait 276 -ioprio_set 277 -ioprio_get 278 -utimensat 279 -signalfd 280 -timerfd 281 -eventfd 282 -fallocate 283 -timerfd_create 284 -timerfd_gettime 285 -timerfd_settime 286 -signalfd4 287 -eventfd2 288 -epoll_create1 289 -dup3 290 -pipe2 291 -inotify_init1 292 -preadv 293 -pwritev 294 -rt_tgsigqueueinfo 295 -perf_event_open 296 -accept4 297 -recvmmsg 298 -getdents64 299 -fanotify_init 300 -fanotify_mark 301 -prlimit64 302 -name_to_handle_at 303 -open_by_handle_at 304 -clock_adjtime 305 -syncfs 306 -sendmmsg 307 -setns 308 -process_vm_readv 309 -process_vm_writev 310 -kcmp 311 -finit_module 312 -sched_setattr 313 -sched_getattr 314 -renameat2 315 -seccomp 316 -getrandom 317 -memfd_create 318 -bpf 319 -execveat 320 -userfaultfd 321 -membarrier 322 -mlock2 323 -copy_file_range 324 -preadv2 325 -pwritev2 326 -pkey_mprotect 327 -pkey_alloc 328 -pkey_free 329 -statx 330 -rseq 331 -io_pgetevents 332 -clock_gettime64 403 -clock_settime64 404 -clock_adjtime64 405 -clock_getres_time64 406 -clock_nanosleep_time64 407 -timer_gettime64 408 -timer_settime64 409 -timerfd_gettime64 410 -timerfd_settime64 411 -utimensat_time64 412 -pselect6_time64 413 -ppoll_time64 414 -io_pgetevents_time64 416 -recvmmsg_time64 417 -mq_timedsend_time64 418 -mq_timedreceive_time64 419 -semtimedop_time64 420 -rt_sigtimedwait_time64 421 -futex_time64 422 -sched_rr_get_interval_time64 423 -pidfd_send_signal 424 -io_uring_setup 425 -io_uring_enter 426 -io_uring_register 427 -open_tree 428 -move_mount 429 -fsopen 430 -fsconfig 431 -fsmount 432 -fspick 433 -pidfd_open 434 -clone3 435 -openat2 437 -pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/mips_n64.in b/fsstress/include/lapi/syscalls/mips_n64.in deleted file mode 100644 index 5480aa3c9c..0000000000 --- a/fsstress/include/lapi/syscalls/mips_n64.in +++ /dev/null @@ -1,342 +0,0 @@ -read 0 -write 1 -open 2 -close 3 -stat 4 -fstat 5 -lstat 6 -poll 7 -lseek 8 -mmap 9 -mprotect 10 -munmap 11 -brk 12 -rt_sigaction 13 -rt_sigprocmask 14 -ioctl 15 -pread64 16 -pwrite64 17 -readv 18 -writev 19 -access 20 -pipe 21 -_newselect 22 -sched_yield 23 -mremap 24 -msync 25 -mincore 26 -madvise 27 -shmget 28 -shmat 29 -shmctl 30 -dup 31 -dup2 32 -pause 33 -nanosleep 34 -getitimer 35 -setitimer 36 -alarm 37 -getpid 38 -sendfile 39 -socket 40 -connect 41 -accept 42 -sendto 43 -recvfrom 44 -sendmsg 45 -recvmsg 46 -shutdown 47 -bind 48 -listen 49 -getsockname 50 -getpeername 51 -socketpair 52 -setsockopt 53 -getsockopt 54 -clone 55 -fork 56 -execve 57 -exit 58 -wait4 59 -kill 60 -uname 61 -semget 62 -semop 63 -semctl 64 -shmdt 65 -msgget 66 -msgsnd 67 -msgrcv 68 -msgctl 69 -fcntl 70 -flock 71 -fsync 72 -fdatasync 73 -truncate 74 -ftruncate 75 -getdents 76 -getcwd 77 -chdir 78 -fchdir 79 -rename 80 -mkdir 81 -rmdir 82 -creat 83 -link 84 -unlink 85 -symlink 86 -readlink 87 -chmod 88 -fchmod 89 -chown 90 -fchown 91 -lchown 92 -umask 93 -gettimeofday 94 -getrlimit 95 -getrusage 96 -sysinfo 97 -times 98 -ptrace 99 -getuid 100 -syslog 101 -getgid 102 -setuid 103 -setgid 104 -geteuid 105 -getegid 106 -setpgid 107 -getppid 108 -getpgrp 109 -setsid 110 -setreuid 111 -setregid 112 -getgroups 113 -setgroups 114 -setresuid 115 -getresuid 116 -setresgid 117 -getresgid 118 -getpgid 119 -setfsuid 120 -setfsgid 121 -getsid 122 -capget 123 -capset 124 -rt_sigpending 125 -rt_sigtimedwait 126 -rt_sigqueueinfo 127 -rt_sigsuspend 128 -sigaltstack 129 -utime 130 -mknod 131 -personality 132 -ustat 133 -statfs 134 -fstatfs 135 -sysfs 136 -getpriority 137 -setpriority 138 -sched_setparam 139 -sched_getparam 140 -sched_setscheduler 141 -sched_getscheduler 142 -sched_get_priority_max 143 -sched_get_priority_min 144 -sched_rr_get_interval 145 -mlock 146 -munlock 147 -mlockall 148 -munlockall 149 -vhangup 150 -pivot_root 151 -_sysctl 152 -prctl 153 -adjtimex 154 -setrlimit 155 -chroot 156 -sync 157 -acct 158 -settimeofday 159 -mount 160 -umount2 161 -swapon 162 -swapoff 163 -reboot 164 -sethostname 165 -setdomainname 166 -create_module 167 -init_module 168 -delete_module 169 -get_kernel_syms 170 -query_module 171 -quotactl 172 -nfsservctl 173 -getpmsg 174 -putpmsg 175 -afs_syscall 176 -reserved177 177 -gettid 178 -readahead 179 -setxattr 180 -lsetxattr 181 -fsetxattr 182 -getxattr 183 -lgetxattr 184 -fgetxattr 185 -listxattr 186 -llistxattr 187 -flistxattr 188 -removexattr 189 -lremovexattr 190 -fremovexattr 191 -tkill 192 -reserved193 193 -futex 194 -sched_setaffinity 195 -sched_getaffinity 196 -cacheflush 197 -cachectl 198 -sysmips 199 -io_setup 200 -io_destroy 201 -io_getevents 202 -io_submit 203 -io_cancel 204 -exit_group 205 -lookup_dcookie 206 -epoll_create 207 -epoll_ctl 208 -epoll_wait 209 -remap_file_pages 210 -rt_sigreturn 211 -set_tid_address 212 -restart_syscall 213 -semtimedop 214 -fadvise64 215 -timer_create 216 -timer_settime 217 -timer_gettime 218 -timer_getoverrun 219 -timer_delete 220 -clock_settime 221 -clock_gettime 222 -clock_getres 223 -clock_nanosleep 224 -tgkill 225 -utimes 226 -mbind 227 -get_mempolicy 228 -set_mempolicy 229 -mq_open 230 -mq_unlink 231 -mq_timedsend 232 -mq_timedreceive 233 -mq_notify 234 -mq_getsetattr 235 -vserver 236 -waitid 237 -add_key 239 -request_key 240 -keyctl 241 -set_thread_area 242 -inotify_init 243 -inotify_add_watch 244 -inotify_rm_watch 245 -migrate_pages 246 -openat 247 -mkdirat 248 -mknodat 249 -fchownat 250 -futimesat 251 -newfstatat 252 -unlinkat 253 -renameat 254 -linkat 255 -symlinkat 256 -readlinkat 257 -fchmodat 258 -faccessat 259 -pselect6 260 -ppoll 261 -unshare 262 -splice 263 -sync_file_range 264 -tee 265 -vmsplice 266 -move_pages 267 -set_robust_list 268 -get_robust_list 269 -kexec_load 270 -getcpu 271 -epoll_pwait 272 -ioprio_set 273 -ioprio_get 274 -utimensat 275 -signalfd 276 -timerfd 277 -eventfd 278 -fallocate 279 -timerfd_create 280 -timerfd_gettime 281 -timerfd_settime 282 -signalfd4 283 -eventfd2 284 -epoll_create1 285 -dup3 286 -pipe2 287 -inotify_init1 288 -preadv 289 -pwritev 290 -rt_tgsigqueueinfo 291 -perf_event_open 292 -accept4 293 -recvmmsg 294 -fanotify_init 295 -fanotify_mark 296 -prlimit64 297 -name_to_handle_at 298 -open_by_handle_at 299 -clock_adjtime 300 -syncfs 301 -sendmmsg 302 -setns 303 -process_vm_readv 304 -process_vm_writev 305 -kcmp 306 -finit_module 307 -getdents64 308 -sched_setattr 309 -sched_getattr 310 -renameat2 311 -seccomp 312 -getrandom 313 -memfd_create 314 -bpf 315 -execveat 316 -userfaultfd 317 -membarrier 318 -mlock2 319 -copy_file_range 320 -preadv2 321 -pwritev2 322 -pkey_mprotect 323 -pkey_alloc 324 -pkey_free 325 -statx 326 -rseq 327 -io_pgetevents 328 -pidfd_send_signal 424 -io_uring_setup 425 -io_uring_enter 426 -io_uring_register 427 -open_tree 428 -move_mount 429 -fsopen 430 -fsconfig 431 -fsmount 432 -fspick 433 -pidfd_open 434 -clone3 435 -openat2 437 -pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/mips_o32.in b/fsstress/include/lapi/syscalls/mips_o32.in deleted file mode 100644 index feee8fbf35..0000000000 --- a/fsstress/include/lapi/syscalls/mips_o32.in +++ /dev/null @@ -1,412 +0,0 @@ -syscall 0 -exit 1 -fork 2 -read 3 -write 4 -open 5 -close 6 -waitpid 7 -creat 8 -link 9 -unlink 10 -execve 11 -chdir 12 -time 13 -mknod 14 -chmod 15 -lchown 16 -break 17 -unused18 18 -lseek 19 -getpid 20 -mount 21 -umount 22 -setuid 23 -getuid 24 -stime 25 -ptrace 26 -alarm 27 -unused28 28 -pause 29 -utime 30 -stty 31 -gtty 32 -access 33 -nice 34 -ftime 35 -sync 36 -kill 37 -rename 38 -mkdir 39 -rmdir 40 -dup 41 -pipe 42 -times 43 -prof 44 -brk 45 -setgid 46 -getgid 47 -signal 48 -geteuid 49 -getegid 50 -acct 51 -umount2 52 -lock 53 -ioctl 54 -fcntl 55 -mpx 56 -setpgid 57 -ulimit 58 -unused59 59 -umask 60 -chroot 61 -ustat 62 -dup2 63 -getppid 64 -getpgrp 65 -setsid 66 -sigaction 67 -sgetmask 68 -ssetmask 69 -setreuid 70 -setregid 71 -sigsuspend 72 -sigpending 73 -sethostname 74 -setrlimit 75 -getrlimit 76 -getrusage 77 -gettimeofday 78 -settimeofday 79 -getgroups 80 -setgroups 81 -reserved82 82 -symlink 83 -unused84 84 -readlink 85 -uselib 86 -swapon 87 -reboot 88 -readdir 89 -mmap 90 -munmap 91 -truncate 92 -ftruncate 93 -fchmod 94 -fchown 95 -getpriority 96 -setpriority 97 -profil 98 -statfs 99 -fstatfs 100 -ioperm 101 -socketcall 102 -syslog 103 -setitimer 104 -getitimer 105 -stat 106 -lstat 107 -fstat 108 -unused109 109 -iopl 110 -vhangup 111 -idle 112 -vm86 113 -wait4 114 -swapoff 115 -sysinfo 116 -ipc 117 -fsync 118 -sigreturn 119 -clone 120 -setdomainname 121 -uname 122 -modify_ldt 123 -adjtimex 124 -mprotect 125 -sigprocmask 126 -create_module 127 -init_module 128 -delete_module 129 -get_kernel_syms 130 -quotactl 131 -getpgid 132 -fchdir 133 -bdflush 134 -sysfs 135 -personality 136 -afs_syscall 137 -setfsuid 138 -setfsgid 139 -_llseek 140 -getdents 141 -_newselect 142 -flock 143 -msync 144 -readv 145 -writev 146 -cacheflush 147 -cachectl 148 -sysmips 149 -unused150 150 -getsid 151 -fdatasync 152 -_sysctl 153 -mlock 154 -munlock 155 -mlockall 156 -munlockall 157 -sched_setparam 158 -sched_getparam 159 -sched_setscheduler 160 -sched_getscheduler 161 -sched_yield 162 -sched_get_priority_max 163 -sched_get_priority_min 164 -sched_rr_get_interval 165 -nanosleep 166 -mremap 167 -accept 168 -bind 169 -connect 170 -getpeername 171 -getsockname 172 -getsockopt 173 -listen 174 -recv 175 -recvfrom 176 -recvmsg 177 -send 178 -sendmsg 179 -sendto 180 -setsockopt 181 -shutdown 182 -socket 183 -socketpair 184 -setresuid 185 -getresuid 186 -query_module 187 -poll 188 -nfsservctl 189 -setresgid 190 -getresgid 191 -prctl 192 -rt_sigreturn 193 -rt_sigaction 194 -rt_sigprocmask 195 -rt_sigpending 196 -rt_sigtimedwait 197 -rt_sigqueueinfo 198 -rt_sigsuspend 199 -pread64 200 -pwrite64 201 -chown 202 -getcwd 203 -capget 204 -capset 205 -sigaltstack 206 -sendfile 207 -getpmsg 208 -putpmsg 209 -mmap2 210 -truncate64 211 -ftruncate64 212 -stat64 213 -lstat64 214 -fstat64 215 -pivot_root 216 -mincore 217 -madvise 218 -getdents64 219 -fcntl64 220 -reserved221 221 -gettid 222 -readahead 223 -setxattr 224 -lsetxattr 225 -fsetxattr 226 -getxattr 227 -lgetxattr 228 -fgetxattr 229 -listxattr 230 -llistxattr 231 -flistxattr 232 -removexattr 233 -lremovexattr 234 -fremovexattr 235 -tkill 236 -sendfile64 237 -futex 238 -sched_setaffinity 239 -sched_getaffinity 240 -io_setup 241 -io_destroy 242 -io_getevents 243 -io_submit 244 -io_cancel 245 -exit_group 246 -lookup_dcookie 247 -epoll_create 248 -epoll_ctl 249 -epoll_wait 250 -remap_file_pages 251 -set_tid_address 252 -restart_syscall 253 -fadvise64 254 -statfs64 255 -fstatfs64 256 -timer_create 257 -timer_settime 258 -timer_gettime 259 -timer_getoverrun 260 -timer_delete 261 -clock_settime 262 -clock_gettime 263 -clock_getres 264 -clock_nanosleep 265 -tgkill 266 -utimes 267 -mbind 268 -get_mempolicy 269 -set_mempolicy 270 -mq_open 271 -mq_unlink 272 -mq_timedsend 273 -mq_timedreceive 274 -mq_notify 275 -mq_getsetattr 276 -vserver 277 -waitid 278 -add_key 280 -request_key 281 -keyctl 282 -set_thread_area 283 -inotify_init 284 -inotify_add_watch 285 -inotify_rm_watch 286 -migrate_pages 287 -openat 288 -mkdirat 289 -mknodat 290 -fchownat 291 -futimesat 292 -fstatat64 293 -unlinkat 294 -renameat 295 -linkat 296 -symlinkat 297 -readlinkat 298 -fchmodat 299 -faccessat 300 -pselect6 301 -ppoll 302 -unshare 303 -splice 304 -sync_file_range 305 -tee 306 -vmsplice 307 -move_pages 308 -set_robust_list 309 -get_robust_list 310 -kexec_load 311 -getcpu 312 -epoll_pwait 313 -ioprio_set 314 -ioprio_get 315 -utimensat 316 -signalfd 317 -timerfd 318 -eventfd 319 -fallocate 320 -timerfd_create 321 -timerfd_gettime 322 -timerfd_settime 323 -signalfd4 324 -eventfd2 325 -epoll_create1 326 -dup3 327 -pipe2 328 -inotify_init1 329 -preadv 330 -pwritev 331 -rt_tgsigqueueinfo 332 -perf_event_open 333 -accept4 334 -recvmmsg 335 -fanotify_init 336 -fanotify_mark 337 -prlimit64 338 -name_to_handle_at 339 -open_by_handle_at 340 -clock_adjtime 341 -syncfs 342 -sendmmsg 343 -setns 344 -process_vm_readv 345 -process_vm_writev 346 -kcmp 347 -finit_module 348 -sched_setattr 349 -sched_getattr 350 -renameat2 351 -seccomp 352 -getrandom 353 -memfd_create 354 -bpf 355 -execveat 356 -userfaultfd 357 -membarrier 358 -mlock2 359 -copy_file_range 360 -preadv2 361 -pwritev2 362 -pkey_mprotect 363 -pkey_alloc 364 -pkey_free 365 -statx 366 -rseq 367 -io_pgetevents 368 -semget 393 -semctl 394 -shmget 395 -shmctl 396 -shmat 397 -shmdt 398 -msgget 399 -msgsnd 400 -msgrcv 401 -msgctl 402 -clock_gettime64 403 -clock_settime64 404 -clock_adjtime64 405 -clock_getres_time64 406 -clock_nanosleep_time64 407 -timer_gettime64 408 -timer_settime64 409 -timerfd_gettime64 410 -timerfd_settime64 411 -utimensat_time64 412 -pselect6_time64 413 -ppoll_time64 414 -io_pgetevents_time64 416 -recvmmsg_time64 417 -mq_timedsend_time64 418 -mq_timedreceive_time64 419 -semtimedop_time64 420 -rt_sigtimedwait_time64 421 -futex_time64 422 -sched_rr_get_interval_time64 423 -pidfd_send_signal 424 -io_uring_setup 425 -io_uring_enter 426 -io_uring_register 427 -open_tree 428 -move_mount 429 -fsopen 430 -fsconfig 431 -fsmount 432 -fspick 433 -pidfd_open 434 -clone3 435 -openat2 437 -pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/order b/fsstress/include/lapi/syscalls/order deleted file mode 100644 index 5480976813..0000000000 --- a/fsstress/include/lapi/syscalls/order +++ /dev/null @@ -1,17 +0,0 @@ -aarch64 -arc -arm -hppa -i386 -ia64 -mips_n32 -mips_n64 -mips_o32 -powerpc64 -powerpc -s390x -s390 -sh -sparc64 -sparc -x86_64 diff --git a/fsstress/include/lapi/syscalls/powerpc.in b/fsstress/include/lapi/syscalls/powerpc.in deleted file mode 100644 index cdbebc62d9..0000000000 --- a/fsstress/include/lapi/syscalls/powerpc.in +++ /dev/null @@ -1,421 +0,0 @@ -restart_syscall 0 -exit 1 -fork 2 -read 3 -write 4 -open 5 -close 6 -waitpid 7 -creat 8 -link 9 -unlink 10 -execve 11 -chdir 12 -time 13 -mknod 14 -chmod 15 -lchown 16 -break 17 -oldstat 18 -lseek 19 -getpid 20 -mount 21 -umount 22 -setuid 23 -getuid 24 -stime 25 -ptrace 26 -alarm 27 -oldfstat 28 -pause 29 -utime 30 -stty 31 -gtty 32 -access 33 -nice 34 -ftime 35 -sync 36 -kill 37 -rename 38 -mkdir 39 -rmdir 40 -dup 41 -pipe 42 -times 43 -prof 44 -brk 45 -setgid 46 -getgid 47 -signal 48 -geteuid 49 -getegid 50 -acct 51 -umount2 52 -lock 53 -ioctl 54 -fcntl 55 -mpx 56 -setpgid 57 -ulimit 58 -oldolduname 59 -umask 60 -chroot 61 -ustat 62 -dup2 63 -getppid 64 -getpgrp 65 -setsid 66 -sigaction 67 -sgetmask 68 -ssetmask 69 -setreuid 70 -setregid 71 -sigsuspend 72 -sigpending 73 -sethostname 74 -setrlimit 75 -getrlimit 76 -getrusage 77 -gettimeofday 78 -settimeofday 79 -getgroups 80 -setgroups 81 -select 82 -symlink 83 -oldlstat 84 -readlink 85 -uselib 86 -swapon 87 -reboot 88 -readdir 89 -mmap 90 -munmap 91 -truncate 92 -ftruncate 93 -fchmod 94 -fchown 95 -getpriority 96 -setpriority 97 -profil 98 -statfs 99 -fstatfs 100 -ioperm 101 -socketcall 102 -syslog 103 -setitimer 104 -getitimer 105 -stat 106 -lstat 107 -fstat 108 -olduname 109 -iopl 110 -vhangup 111 -idle 112 -vm86 113 -wait4 114 -swapoff 115 -sysinfo 116 -ipc 117 -fsync 118 -sigreturn 119 -clone 120 -setdomainname 121 -uname 122 -modify_ldt 123 -adjtimex 124 -mprotect 125 -sigprocmask 126 -create_module 127 -init_module 128 -delete_module 129 -get_kernel_syms 130 -quotactl 131 -getpgid 132 -fchdir 133 -bdflush 134 -sysfs 135 -personality 136 -afs_syscall 137 -setfsuid 138 -setfsgid 139 -_llseek 140 -getdents 141 -_newselect 142 -flock 143 -msync 144 -readv 145 -writev 146 -getsid 147 -fdatasync 148 -_sysctl 149 -mlock 150 -munlock 151 -mlockall 152 -munlockall 153 -sched_setparam 154 -sched_getparam 155 -sched_setscheduler 156 -sched_getscheduler 157 -sched_yield 158 -sched_get_priority_max 159 -sched_get_priority_min 160 -sched_rr_get_interval 161 -nanosleep 162 -mremap 163 -setresuid 164 -getresuid 165 -query_module 166 -poll 167 -nfsservctl 168 -setresgid 169 -getresgid 170 -prctl 171 -rt_sigreturn 172 -rt_sigaction 173 -rt_sigprocmask 174 -rt_sigpending 175 -rt_sigtimedwait 176 -rt_sigqueueinfo 177 -rt_sigsuspend 178 -pread64 179 -pwrite64 180 -chown 181 -getcwd 182 -capget 183 -capset 184 -sigaltstack 185 -sendfile 186 -getpmsg 187 -putpmsg 188 -vfork 189 -ugetrlimit 190 -readahead 191 -mmap2 192 -truncate64 193 -ftruncate64 194 -stat64 195 -lstat64 196 -fstat64 197 -pciconfig_read 198 -pciconfig_write 199 -pciconfig_iobase 200 -multiplexer 201 -getdents64 202 -pivot_root 203 -fcntl64 204 -madvise 205 -mincore 206 -gettid 207 -tkill 208 -setxattr 209 -lsetxattr 210 -fsetxattr 211 -getxattr 212 -lgetxattr 213 -fgetxattr 214 -listxattr 215 -llistxattr 216 -flistxattr 217 -removexattr 218 -lremovexattr 219 -fremovexattr 220 -futex 221 -sched_setaffinity 222 -sched_getaffinity 223 -tuxcall 225 -sendfile64 226 -io_setup 227 -io_destroy 228 -io_getevents 229 -io_submit 230 -io_cancel 231 -set_tid_address 232 -fadvise64 233 -exit_group 234 -lookup_dcookie 235 -epoll_create 236 -epoll_ctl 237 -epoll_wait 238 -remap_file_pages 239 -timer_create 240 -timer_settime 241 -timer_gettime 242 -timer_getoverrun 243 -timer_delete 244 -clock_settime 245 -clock_gettime 246 -clock_getres 247 -clock_nanosleep 248 -swapcontext 249 -tgkill 250 -utimes 251 -statfs64 252 -fstatfs64 253 -fadvise64_64 254 -rtas 255 -sys_debug_setcontext 256 -migrate_pages 258 -mbind 259 -get_mempolicy 260 -set_mempolicy 261 -mq_open 262 -mq_unlink 263 -mq_timedsend 264 -mq_timedreceive 265 -mq_notify 266 -mq_getsetattr 267 -kexec_load 268 -add_key 269 -request_key 270 -keyctl 271 -waitid 272 -ioprio_set 273 -ioprio_get 274 -inotify_init 275 -inotify_add_watch 276 -inotify_rm_watch 277 -spu_run 278 -spu_create 279 -pselect6 280 -ppoll 281 -unshare 282 -splice 283 -tee 284 -vmsplice 285 -openat 286 -mkdirat 287 -mknodat 288 -fchownat 289 -futimesat 290 -newfstatat 291 -fstatat64 291 -unlinkat 292 -renameat 293 -linkat 294 -symlinkat 295 -readlinkat 296 -fchmodat 297 -faccessat 298 -get_robust_list 299 -set_robust_list 300 -move_pages 301 -getcpu 302 -epoll_pwait 303 -utimensat 304 -signalfd 305 -timerfd_create 306 -eventfd 307 -sync_file_range2 308 -fallocate 309 -subpage_prot 310 -timerfd_settime 311 -timerfd_gettime 312 -signalfd4 313 -eventfd2 314 -epoll_create1 315 -dup3 316 -pipe2 317 -inotify_init1 318 -perf_event_open 319 -preadv 320 -pwritev 321 -rt_tgsigqueueinfo 322 -fanotify_init 323 -fanotify_mark 324 -prlimit64 325 -socket 326 -bind 327 -connect 328 -listen 329 -accept 330 -getsockname 331 -getpeername 332 -socketpair 333 -send 334 -sendto 335 -recv 336 -recvfrom 337 -shutdown 338 -setsockopt 339 -getsockopt 340 -sendmsg 341 -recvmsg 342 -recvmmsg 343 -accept4 344 -name_to_handle_at 345 -open_by_handle_at 346 -clock_adjtime 347 -syncfs 348 -sendmmsg 349 -setns 350 -process_vm_readv 351 -process_vm_writev 352 -finit_module 353 -kcmp 354 -sched_setattr 355 -sched_getattr 356 -renameat2 357 -seccomp 358 -getrandom 359 -memfd_create 360 -bpf 361 -execveat 362 -switch_endian 363 -userfaultfd 364 -membarrier 365 -mlock2 378 -copy_file_range 379 -preadv2 380 -pwritev2 381 -kexec_file_load 382 -statx 383 -pkey_alloc 384 -pkey_free 385 -pkey_mprotect 386 -rseq 387 -io_pgetevents 388 -semtimedop 392 -semget 393 -semctl 394 -shmget 395 -shmctl 396 -shmat 397 -shmdt 398 -msgget 399 -msgsnd 400 -msgrcv 401 -msgctl 402 -clock_gettime64 403 -clock_settime64 404 -clock_adjtime64 405 -clock_getres_time64 406 -clock_nanosleep_time64 407 -timer_gettime64 408 -timer_settime64 409 -timerfd_gettime64 410 -timerfd_settime64 411 -utimensat_time64 412 -pselect6_time64 413 -ppoll_time64 414 -io_pgetevents_time64 416 -recvmmsg_time64 417 -mq_timedsend_time64 418 -mq_timedreceive_time64 419 -semtimedop_time64 420 -rt_sigtimedwait_time64 421 -futex_time64 422 -sched_rr_get_interval_time64 423 -pidfd_send_signal 424 -io_uring_setup 425 -io_uring_enter 426 -io_uring_register 427 -open_tree 428 -move_mount 429 -fsopen 430 -fsconfig 431 -fsmount 432 -fspick 433 -pidfd_open 434 -clone3 435 -openat2 437 -pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/powerpc64.in b/fsstress/include/lapi/syscalls/powerpc64.in deleted file mode 100644 index cdbebc62d9..0000000000 --- a/fsstress/include/lapi/syscalls/powerpc64.in +++ /dev/null @@ -1,421 +0,0 @@ -restart_syscall 0 -exit 1 -fork 2 -read 3 -write 4 -open 5 -close 6 -waitpid 7 -creat 8 -link 9 -unlink 10 -execve 11 -chdir 12 -time 13 -mknod 14 -chmod 15 -lchown 16 -break 17 -oldstat 18 -lseek 19 -getpid 20 -mount 21 -umount 22 -setuid 23 -getuid 24 -stime 25 -ptrace 26 -alarm 27 -oldfstat 28 -pause 29 -utime 30 -stty 31 -gtty 32 -access 33 -nice 34 -ftime 35 -sync 36 -kill 37 -rename 38 -mkdir 39 -rmdir 40 -dup 41 -pipe 42 -times 43 -prof 44 -brk 45 -setgid 46 -getgid 47 -signal 48 -geteuid 49 -getegid 50 -acct 51 -umount2 52 -lock 53 -ioctl 54 -fcntl 55 -mpx 56 -setpgid 57 -ulimit 58 -oldolduname 59 -umask 60 -chroot 61 -ustat 62 -dup2 63 -getppid 64 -getpgrp 65 -setsid 66 -sigaction 67 -sgetmask 68 -ssetmask 69 -setreuid 70 -setregid 71 -sigsuspend 72 -sigpending 73 -sethostname 74 -setrlimit 75 -getrlimit 76 -getrusage 77 -gettimeofday 78 -settimeofday 79 -getgroups 80 -setgroups 81 -select 82 -symlink 83 -oldlstat 84 -readlink 85 -uselib 86 -swapon 87 -reboot 88 -readdir 89 -mmap 90 -munmap 91 -truncate 92 -ftruncate 93 -fchmod 94 -fchown 95 -getpriority 96 -setpriority 97 -profil 98 -statfs 99 -fstatfs 100 -ioperm 101 -socketcall 102 -syslog 103 -setitimer 104 -getitimer 105 -stat 106 -lstat 107 -fstat 108 -olduname 109 -iopl 110 -vhangup 111 -idle 112 -vm86 113 -wait4 114 -swapoff 115 -sysinfo 116 -ipc 117 -fsync 118 -sigreturn 119 -clone 120 -setdomainname 121 -uname 122 -modify_ldt 123 -adjtimex 124 -mprotect 125 -sigprocmask 126 -create_module 127 -init_module 128 -delete_module 129 -get_kernel_syms 130 -quotactl 131 -getpgid 132 -fchdir 133 -bdflush 134 -sysfs 135 -personality 136 -afs_syscall 137 -setfsuid 138 -setfsgid 139 -_llseek 140 -getdents 141 -_newselect 142 -flock 143 -msync 144 -readv 145 -writev 146 -getsid 147 -fdatasync 148 -_sysctl 149 -mlock 150 -munlock 151 -mlockall 152 -munlockall 153 -sched_setparam 154 -sched_getparam 155 -sched_setscheduler 156 -sched_getscheduler 157 -sched_yield 158 -sched_get_priority_max 159 -sched_get_priority_min 160 -sched_rr_get_interval 161 -nanosleep 162 -mremap 163 -setresuid 164 -getresuid 165 -query_module 166 -poll 167 -nfsservctl 168 -setresgid 169 -getresgid 170 -prctl 171 -rt_sigreturn 172 -rt_sigaction 173 -rt_sigprocmask 174 -rt_sigpending 175 -rt_sigtimedwait 176 -rt_sigqueueinfo 177 -rt_sigsuspend 178 -pread64 179 -pwrite64 180 -chown 181 -getcwd 182 -capget 183 -capset 184 -sigaltstack 185 -sendfile 186 -getpmsg 187 -putpmsg 188 -vfork 189 -ugetrlimit 190 -readahead 191 -mmap2 192 -truncate64 193 -ftruncate64 194 -stat64 195 -lstat64 196 -fstat64 197 -pciconfig_read 198 -pciconfig_write 199 -pciconfig_iobase 200 -multiplexer 201 -getdents64 202 -pivot_root 203 -fcntl64 204 -madvise 205 -mincore 206 -gettid 207 -tkill 208 -setxattr 209 -lsetxattr 210 -fsetxattr 211 -getxattr 212 -lgetxattr 213 -fgetxattr 214 -listxattr 215 -llistxattr 216 -flistxattr 217 -removexattr 218 -lremovexattr 219 -fremovexattr 220 -futex 221 -sched_setaffinity 222 -sched_getaffinity 223 -tuxcall 225 -sendfile64 226 -io_setup 227 -io_destroy 228 -io_getevents 229 -io_submit 230 -io_cancel 231 -set_tid_address 232 -fadvise64 233 -exit_group 234 -lookup_dcookie 235 -epoll_create 236 -epoll_ctl 237 -epoll_wait 238 -remap_file_pages 239 -timer_create 240 -timer_settime 241 -timer_gettime 242 -timer_getoverrun 243 -timer_delete 244 -clock_settime 245 -clock_gettime 246 -clock_getres 247 -clock_nanosleep 248 -swapcontext 249 -tgkill 250 -utimes 251 -statfs64 252 -fstatfs64 253 -fadvise64_64 254 -rtas 255 -sys_debug_setcontext 256 -migrate_pages 258 -mbind 259 -get_mempolicy 260 -set_mempolicy 261 -mq_open 262 -mq_unlink 263 -mq_timedsend 264 -mq_timedreceive 265 -mq_notify 266 -mq_getsetattr 267 -kexec_load 268 -add_key 269 -request_key 270 -keyctl 271 -waitid 272 -ioprio_set 273 -ioprio_get 274 -inotify_init 275 -inotify_add_watch 276 -inotify_rm_watch 277 -spu_run 278 -spu_create 279 -pselect6 280 -ppoll 281 -unshare 282 -splice 283 -tee 284 -vmsplice 285 -openat 286 -mkdirat 287 -mknodat 288 -fchownat 289 -futimesat 290 -newfstatat 291 -fstatat64 291 -unlinkat 292 -renameat 293 -linkat 294 -symlinkat 295 -readlinkat 296 -fchmodat 297 -faccessat 298 -get_robust_list 299 -set_robust_list 300 -move_pages 301 -getcpu 302 -epoll_pwait 303 -utimensat 304 -signalfd 305 -timerfd_create 306 -eventfd 307 -sync_file_range2 308 -fallocate 309 -subpage_prot 310 -timerfd_settime 311 -timerfd_gettime 312 -signalfd4 313 -eventfd2 314 -epoll_create1 315 -dup3 316 -pipe2 317 -inotify_init1 318 -perf_event_open 319 -preadv 320 -pwritev 321 -rt_tgsigqueueinfo 322 -fanotify_init 323 -fanotify_mark 324 -prlimit64 325 -socket 326 -bind 327 -connect 328 -listen 329 -accept 330 -getsockname 331 -getpeername 332 -socketpair 333 -send 334 -sendto 335 -recv 336 -recvfrom 337 -shutdown 338 -setsockopt 339 -getsockopt 340 -sendmsg 341 -recvmsg 342 -recvmmsg 343 -accept4 344 -name_to_handle_at 345 -open_by_handle_at 346 -clock_adjtime 347 -syncfs 348 -sendmmsg 349 -setns 350 -process_vm_readv 351 -process_vm_writev 352 -finit_module 353 -kcmp 354 -sched_setattr 355 -sched_getattr 356 -renameat2 357 -seccomp 358 -getrandom 359 -memfd_create 360 -bpf 361 -execveat 362 -switch_endian 363 -userfaultfd 364 -membarrier 365 -mlock2 378 -copy_file_range 379 -preadv2 380 -pwritev2 381 -kexec_file_load 382 -statx 383 -pkey_alloc 384 -pkey_free 385 -pkey_mprotect 386 -rseq 387 -io_pgetevents 388 -semtimedop 392 -semget 393 -semctl 394 -shmget 395 -shmctl 396 -shmat 397 -shmdt 398 -msgget 399 -msgsnd 400 -msgrcv 401 -msgctl 402 -clock_gettime64 403 -clock_settime64 404 -clock_adjtime64 405 -clock_getres_time64 406 -clock_nanosleep_time64 407 -timer_gettime64 408 -timer_settime64 409 -timerfd_gettime64 410 -timerfd_settime64 411 -utimensat_time64 412 -pselect6_time64 413 -ppoll_time64 414 -io_pgetevents_time64 416 -recvmmsg_time64 417 -mq_timedsend_time64 418 -mq_timedreceive_time64 419 -semtimedop_time64 420 -rt_sigtimedwait_time64 421 -futex_time64 422 -sched_rr_get_interval_time64 423 -pidfd_send_signal 424 -io_uring_setup 425 -io_uring_enter 426 -io_uring_register 427 -open_tree 428 -move_mount 429 -fsopen 430 -fsconfig 431 -fsmount 432 -fspick 433 -pidfd_open 434 -clone3 435 -openat2 437 -pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/regen.sh b/fsstress/include/lapi/syscalls/regen.sh deleted file mode 100755 index 7a4f0cf443..0000000000 --- a/fsstress/include/lapi/syscalls/regen.sh +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/sh - -output="syscalls.h" -rm -f "${output}".[1-9]* -output_pid="${output}.$$" - -max_jobs=$(getconf _NPROCESSORS_ONLN 2>/dev/null) -: ${max_jobs:=1} - -srcdir=${0%/*} - -err() { - echo "$*" 1>&2 - exit 1 -} - -cat << EOF > "${output_pid}" -/************************************************ - * GENERATED FILE: DO NOT EDIT/PATCH THIS FILE * - * change your arch specific .in file instead * - ************************************************/ - -/* - * Here we stick all the ugly *fallback* logic for linux - * system call numbers (those __NR_ thingies). - * - * Licensed under the GPLv2 or later, see the COPYING file. - */ - -#ifndef __LAPI_SYSCALLS_H__ -#define __LAPI_SYSCALLS_H__ - -#include -#include -#include -#include "cleanup.c" - -#define ltp_syscall(NR, ...) ({ \\ - int __ret; \\ - if (NR == __LTP__NR_INVALID_SYSCALL) { \\ - errno = ENOSYS; \\ - __ret = -1; \\ - } else { \\ - __ret = syscall(NR, ##__VA_ARGS__); \\ - } \\ - if (__ret == -1 && errno == ENOSYS) { \\ - tst_brkm(TCONF, CLEANUP, \\ - "syscall(%d) " #NR " not supported on your arch", \\ - NR); \\ - } \\ - __ret; \\ -}) - -#define tst_syscall(NR, ...) ({ \\ - int tst_ret; \\ - if (NR == __LTP__NR_INVALID_SYSCALL) { \\ - errno = ENOSYS; \\ - tst_ret = -1; \\ - } else { \\ - tst_ret = syscall(NR, ##__VA_ARGS__); \\ - } \\ - if (tst_ret == -1 && errno == ENOSYS) { \\ - tst_brk(TCONF, "syscall(%d) " #NR " not supported", NR); \\ - } \\ - tst_ret; \\ -}) - -EOF - -jobs=0 -for arch in $(cat "${srcdir}/order") ; do - ( - echo "Generating data for arch $arch ... " - - ( - echo - case ${arch} in - sparc64) echo "#if defined(__sparc__) && defined(__arch64__)" ;; - sparc) echo "#if defined(__sparc__) && !defined(__arch64__)" ;; - s390) echo "#if defined(__s390__) && !defined(__s390x__)" ;; - mips_n32) echo "#if defined(__mips__) && defined(_ABIN32)" ;; - mips_n64) echo "#if defined(__mips__) && defined(_ABI64)" ;; - mips_o32) echo "#if defined(__mips__) && defined(_ABIO32)" ;; - *) echo "#ifdef __${arch}__" ;; - esac - while read line ; do - set -- ${line} - nr="__NR_$1" - shift - if [ $# -eq 0 ] ; then - err "invalid line found: $line" - fi - echo "# ifndef ${nr}" - echo "# define ${nr} $*" - echo "# endif" - done < "${srcdir}/${arch}.in" - echo "#endif" - echo - ) >> "${output_pid}.${arch}" - - ) & - - jobs=$(( jobs + 1 )) - if [ ${jobs} -ge ${max_jobs} ] ; then - wait || exit 1 - jobs=0 - fi -done - -echo "Generating stub list ... " -( -echo -echo "/* Common stubs */" -echo "#define __LTP__NR_INVALID_SYSCALL -1" >> "${output_pid}" -for nr in $(awk '{print $1}' "${srcdir}/"*.in | sort -u) ; do - nr="__NR_${nr}" - echo "# ifndef ${nr}" - echo "# define ${nr} __LTP__NR_INVALID_SYSCALL" - echo "# endif" -done -echo "#endif" -) >> "${output_pid}._footer" - -wait || exit 1 - -printf "Combining them all ... " -for arch in $(cat "${srcdir}/order") _footer ; do - cat "${output_pid}.${arch}" -done >> "${output_pid}" -mv "${output_pid}" "../${output}" -rm -f "${output_pid}"* -echo "OK!" diff --git a/fsstress/include/lapi/syscalls/s390.in b/fsstress/include/lapi/syscalls/s390.in deleted file mode 100644 index c3f249aedf..0000000000 --- a/fsstress/include/lapi/syscalls/s390.in +++ /dev/null @@ -1,408 +0,0 @@ -exit 1 -fork 2 -read 3 -write 4 -open 5 -close 6 -restart_syscall 7 -creat 8 -link 9 -unlink 10 -execve 11 -chdir 12 -time 13 -mknod 14 -chmod 15 -lchown 16 -lseek 19 -getpid 20 -mount 21 -umount 22 -setuid 23 -getuid 24 -stime 25 -ptrace 26 -alarm 27 -pause 29 -utime 30 -access 33 -nice 34 -sync 36 -kill 37 -rename 38 -mkdir 39 -rmdir 40 -dup 41 -pipe 42 -times 43 -brk 45 -setgid 46 -getgid 47 -signal 48 -geteuid 49 -getegid 50 -acct 51 -umount2 52 -ioctl 54 -fcntl 55 -setpgid 57 -umask 60 -chroot 61 -ustat 62 -dup2 63 -getppid 64 -getpgrp 65 -setsid 66 -sigaction 67 -setreuid 70 -setregid 71 -sigsuspend 72 -sigpending 73 -sethostname 74 -setrlimit 75 -getrlimit 76 -getrusage 77 -gettimeofday 78 -settimeofday 79 -getgroups 80 -setgroups 81 -symlink 83 -readlink 85 -uselib 86 -swapon 87 -reboot 88 -readdir 89 -mmap 90 -munmap 91 -truncate 92 -ftruncate 93 -fchmod 94 -fchown 95 -getpriority 96 -setpriority 97 -statfs 99 -fstatfs 100 -ioperm 101 -socketcall 102 -syslog 103 -setitimer 104 -getitimer 105 -stat 106 -lstat 107 -fstat 108 -lookup_dcookie 110 -vhangup 111 -idle 112 -wait4 114 -swapoff 115 -sysinfo 116 -ipc 117 -fsync 118 -sigreturn 119 -clone 120 -setdomainname 121 -uname 122 -adjtimex 124 -mprotect 125 -sigprocmask 126 -create_module 127 -init_module 128 -delete_module 129 -get_kernel_syms 130 -quotactl 131 -getpgid 132 -fchdir 133 -bdflush 134 -sysfs 135 -personality 136 -afs_syscall 137 -setfsuid 138 -setfsgid 139 -_llseek 140 -getdents 141 -_newselect 142 -flock 143 -msync 144 -readv 145 -writev 146 -getsid 147 -fdatasync 148 -_sysctl 149 -mlock 150 -munlock 151 -mlockall 152 -munlockall 153 -sched_setparam 154 -sched_getparam 155 -sched_setscheduler 156 -sched_getscheduler 157 -sched_yield 158 -sched_get_priority_max 159 -sched_get_priority_min 160 -sched_rr_get_interval 161 -nanosleep 162 -mremap 163 -setresuid 164 -getresuid 165 -query_module 167 -poll 168 -nfsservctl 169 -setresgid 170 -getresgid 171 -prctl 172 -rt_sigreturn 173 -rt_sigaction 174 -rt_sigprocmask 175 -rt_sigpending 176 -rt_sigtimedwait 177 -rt_sigqueueinfo 178 -rt_sigsuspend 179 -pread64 180 -pwrite64 181 -chown 182 -getcwd 183 -capget 184 -capset 185 -sigaltstack 186 -sendfile 187 -getpmsg 188 -putpmsg 189 -vfork 190 -ugetrlimit 191 -mmap2 192 -truncate64 193 -ftruncate64 194 -stat64 195 -lstat64 196 -fstat64 197 -lchown32 198 -getuid32 199 -getgid32 200 -geteuid32 201 -getegid32 202 -setreuid32 203 -setregid32 204 -getgroups32 205 -setgroups32 206 -fchown32 207 -setresuid32 208 -getresuid32 209 -setresgid32 210 -getresgid32 211 -chown32 212 -setuid32 213 -setgid32 214 -setfsuid32 215 -setfsgid32 216 -pivot_root 217 -mincore 218 -madvise 219 -getdents64 220 -fcntl64 221 -readahead 222 -sendfile64 223 -setxattr 224 -lsetxattr 225 -fsetxattr 226 -getxattr 227 -lgetxattr 228 -fgetxattr 229 -listxattr 230 -llistxattr 231 -flistxattr 232 -removexattr 233 -lremovexattr 234 -fremovexattr 235 -gettid 236 -tkill 237 -futex 238 -sched_setaffinity 239 -sched_getaffinity 240 -tgkill 241 -io_setup 243 -io_destroy 244 -io_getevents 245 -io_submit 246 -io_cancel 247 -exit_group 248 -epoll_create 249 -epoll_ctl 250 -epoll_wait 251 -set_tid_address 252 -fadvise64 253 -timer_create 254 -timer_settime 255 -timer_gettime 256 -timer_getoverrun 257 -timer_delete 258 -clock_settime 259 -clock_gettime 260 -clock_getres 261 -clock_nanosleep 262 -fadvise64_64 264 -statfs64 265 -fstatfs64 266 -remap_file_pages 267 -mbind 268 -get_mempolicy 269 -set_mempolicy 270 -mq_open 271 -mq_unlink 272 -mq_timedsend 273 -mq_timedreceive 274 -mq_notify 275 -mq_getsetattr 276 -kexec_load 277 -add_key 278 -request_key 279 -keyctl 280 -waitid 281 -ioprio_set 282 -ioprio_get 283 -inotify_init 284 -inotify_add_watch 285 -inotify_rm_watch 286 -migrate_pages 287 -openat 288 -mkdirat 289 -mknodat 290 -fchownat 291 -futimesat 292 -fstatat64 293 -unlinkat 294 -renameat 295 -linkat 296 -symlinkat 297 -readlinkat 298 -fchmodat 299 -faccessat 300 -pselect6 301 -ppoll 302 -unshare 303 -set_robust_list 304 -get_robust_list 305 -splice 306 -sync_file_range 307 -tee 308 -vmsplice 309 -move_pages 310 -getcpu 311 -epoll_pwait 312 -utimes 313 -fallocate 314 -utimensat 315 -signalfd 316 -timerfd 317 -eventfd 318 -timerfd_create 319 -timerfd_settime 320 -timerfd_gettime 321 -signalfd4 322 -eventfd2 323 -inotify_init1 324 -pipe2 325 -dup3 326 -epoll_create1 327 -preadv 328 -pwritev 329 -rt_tgsigqueueinfo 330 -perf_event_open 331 -fanotify_init 332 -fanotify_mark 333 -prlimit64 334 -name_to_handle_at 335 -open_by_handle_at 336 -clock_adjtime 337 -syncfs 338 -setns 339 -process_vm_readv 340 -process_vm_writev 341 -s390_runtime_instr 342 -kcmp 343 -finit_module 344 -sched_setattr 345 -sched_getattr 346 -renameat2 347 -seccomp 348 -getrandom 349 -memfd_create 350 -bpf 351 -s390_pci_mmio_write 352 -s390_pci_mmio_read 353 -execveat 354 -userfaultfd 355 -membarrier 356 -recvmmsg 357 -sendmmsg 358 -socket 359 -socketpair 360 -bind 361 -connect 362 -listen 363 -accept4 364 -getsockopt 365 -setsockopt 366 -getsockname 367 -getpeername 368 -sendto 369 -sendmsg 370 -recvfrom 371 -recvmsg 372 -shutdown 373 -mlock2 374 -copy_file_range 375 -preadv2 376 -pwritev2 377 -s390_guarded_storage 378 -statx 379 -s390_sthyi 380 -kexec_file_load 381 -io_pgetevents 382 -rseq 383 -pkey_mprotect 384 -pkey_alloc 385 -pkey_free 386 -semget 393 -semctl 394 -shmget 395 -shmctl 396 -shmat 397 -shmdt 398 -msgget 399 -msgsnd 400 -msgrcv 401 -msgctl 402 -clock_gettime64 403 -clock_settime64 404 -clock_adjtime64 405 -clock_getres_time64 406 -clock_nanosleep_time64 407 -timer_gettime64 408 -timer_settime64 409 -timerfd_gettime64 410 -timerfd_settime64 411 -utimensat_time64 412 -pselect6_time64 413 -ppoll_time64 414 -io_pgetevents_time64 416 -recvmmsg_time64 417 -mq_timedsend_time64 418 -mq_timedreceive_time64 419 -semtimedop_time64 420 -rt_sigtimedwait_time64 421 -futex_time64 422 -sched_rr_get_interval_time64 423 -pidfd_send_signal 424 -io_uring_setup 425 -io_uring_enter 426 -io_uring_register 427 -open_tree 428 -move_mount 429 -fsopen 430 -fsconfig 431 -fsmount 432 -fspick 433 -pidfd_open 434 -clone3 435 -openat2 437 -pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/s390x.in b/fsstress/include/lapi/syscalls/s390x.in deleted file mode 100644 index 88cc9b86bd..0000000000 --- a/fsstress/include/lapi/syscalls/s390x.in +++ /dev/null @@ -1,356 +0,0 @@ -exit 1 -fork 2 -read 3 -write 4 -open 5 -close 6 -restart_syscall 7 -creat 8 -link 9 -unlink 10 -execve 11 -chdir 12 -mknod 14 -chmod 15 -lseek 19 -getpid 20 -mount 21 -umount 22 -ptrace 26 -alarm 27 -pause 29 -utime 30 -access 33 -nice 34 -sync 36 -kill 37 -rename 38 -mkdir 39 -rmdir 40 -dup 41 -pipe 42 -times 43 -brk 45 -signal 48 -acct 51 -umount2 52 -ioctl 54 -fcntl 55 -setpgid 57 -umask 60 -chroot 61 -ustat 62 -dup2 63 -getppid 64 -getpgrp 65 -setsid 66 -sigaction 67 -sigsuspend 72 -sigpending 73 -sethostname 74 -setrlimit 75 -getrusage 77 -gettimeofday 78 -settimeofday 79 -symlink 83 -readlink 85 -uselib 86 -swapon 87 -reboot 88 -readdir 89 -mmap 90 -munmap 91 -truncate 92 -ftruncate 93 -fchmod 94 -getpriority 96 -setpriority 97 -statfs 99 -fstatfs 100 -socketcall 102 -syslog 103 -setitimer 104 -getitimer 105 -stat 106 -lstat 107 -fstat 108 -lookup_dcookie 110 -vhangup 111 -idle 112 -wait4 114 -swapoff 115 -sysinfo 116 -ipc 117 -fsync 118 -sigreturn 119 -clone 120 -setdomainname 121 -uname 122 -adjtimex 124 -mprotect 125 -sigprocmask 126 -create_module 127 -init_module 128 -delete_module 129 -get_kernel_syms 130 -quotactl 131 -getpgid 132 -fchdir 133 -bdflush 134 -sysfs 135 -personality 136 -afs_syscall 137 -getdents 141 -select 142 -flock 143 -msync 144 -readv 145 -writev 146 -getsid 147 -fdatasync 148 -_sysctl 149 -mlock 150 -munlock 151 -mlockall 152 -munlockall 153 -sched_setparam 154 -sched_getparam 155 -sched_setscheduler 156 -sched_getscheduler 157 -sched_yield 158 -sched_get_priority_max 159 -sched_get_priority_min 160 -sched_rr_get_interval 161 -nanosleep 162 -mremap 163 -query_module 167 -poll 168 -nfsservctl 169 -prctl 172 -rt_sigreturn 173 -rt_sigaction 174 -rt_sigprocmask 175 -rt_sigpending 176 -rt_sigtimedwait 177 -rt_sigqueueinfo 178 -rt_sigsuspend 179 -pread64 180 -pwrite64 181 -getcwd 183 -capget 184 -capset 185 -sigaltstack 186 -sendfile 187 -getpmsg 188 -putpmsg 189 -vfork 190 -getrlimit 191 -lchown 198 -getuid 199 -getgid 200 -geteuid 201 -getegid 202 -setreuid 203 -setregid 204 -getgroups 205 -setgroups 206 -fchown 207 -setresuid 208 -getresuid 209 -setresgid 210 -getresgid 211 -chown 212 -setuid 213 -setgid 214 -setfsuid 215 -setfsgid 216 -pivot_root 217 -mincore 218 -madvise 219 -getdents64 220 -readahead 222 -setxattr 224 -lsetxattr 225 -fsetxattr 226 -getxattr 227 -lgetxattr 228 -fgetxattr 229 -listxattr 230 -llistxattr 231 -flistxattr 232 -removexattr 233 -lremovexattr 234 -fremovexattr 235 -gettid 236 -tkill 237 -futex 238 -sched_setaffinity 239 -sched_getaffinity 240 -tgkill 241 -io_setup 243 -io_destroy 244 -io_getevents 245 -io_submit 246 -io_cancel 247 -exit_group 248 -epoll_create 249 -epoll_ctl 250 -epoll_wait 251 -set_tid_address 252 -fadvise64 253 -timer_create 254 -timer_settime 255 -timer_gettime 256 -timer_getoverrun 257 -timer_delete 258 -clock_settime 259 -clock_gettime 260 -clock_getres 261 -clock_nanosleep 262 -statfs64 265 -fstatfs64 266 -remap_file_pages 267 -mbind 268 -get_mempolicy 269 -set_mempolicy 270 -mq_open 271 -mq_unlink 272 -mq_timedsend 273 -mq_timedreceive 274 -mq_notify 275 -mq_getsetattr 276 -kexec_load 277 -add_key 278 -request_key 279 -keyctl 280 -waitid 281 -ioprio_set 282 -ioprio_get 283 -inotify_init 284 -inotify_add_watch 285 -inotify_rm_watch 286 -migrate_pages 287 -openat 288 -mkdirat 289 -mknodat 290 -fchownat 291 -futimesat 292 -newfstatat 293 -unlinkat 294 -renameat 295 -linkat 296 -symlinkat 297 -readlinkat 298 -fchmodat 299 -faccessat 300 -pselect6 301 -ppoll 302 -unshare 303 -set_robust_list 304 -get_robust_list 305 -splice 306 -sync_file_range 307 -tee 308 -vmsplice 309 -move_pages 310 -getcpu 311 -epoll_pwait 312 -utimes 313 -fallocate 314 -utimensat 315 -signalfd 316 -timerfd 317 -eventfd 318 -timerfd_create 319 -timerfd_settime 320 -timerfd_gettime 321 -signalfd4 322 -eventfd2 323 -inotify_init1 324 -pipe2 325 -dup3 326 -epoll_create1 327 -preadv 328 -pwritev 329 -rt_tgsigqueueinfo 330 -perf_event_open 331 -fanotify_init 332 -fanotify_mark 333 -prlimit64 334 -name_to_handle_at 335 -open_by_handle_at 336 -clock_adjtime 337 -syncfs 338 -setns 339 -process_vm_readv 340 -process_vm_writev 341 -s390_runtime_instr 342 -kcmp 343 -finit_module 344 -sched_setattr 345 -sched_getattr 346 -renameat2 347 -seccomp 348 -getrandom 349 -memfd_create 350 -bpf 351 -s390_pci_mmio_write 352 -s390_pci_mmio_read 353 -execveat 354 -userfaultfd 355 -membarrier 356 -recvmmsg 357 -sendmmsg 358 -socket 359 -socketpair 360 -bind 361 -connect 362 -listen 363 -accept4 364 -getsockopt 365 -setsockopt 366 -getsockname 367 -getpeername 368 -sendto 369 -sendmsg 370 -recvfrom 371 -recvmsg 372 -shutdown 373 -mlock2 374 -copy_file_range 375 -preadv2 376 -pwritev2 377 -s390_guarded_storage 378 -statx 379 -s390_sthyi 380 -kexec_file_load 381 -io_pgetevents 382 -rseq 383 -pkey_mprotect 384 -pkey_alloc 385 -pkey_free 386 -semtimedop 392 -semget 393 -semctl 394 -shmget 395 -shmctl 396 -shmat 397 -shmdt 398 -msgget 399 -msgsnd 400 -msgrcv 401 -msgctl 402 -pidfd_send_signal 424 -io_uring_setup 425 -io_uring_enter 426 -io_uring_register 427 -open_tree 428 -move_mount 429 -fsopen 430 -fsconfig 431 -fsmount 432 -fspick 433 -pidfd_open 434 -clone3 435 -openat2 437 -pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/sh.in b/fsstress/include/lapi/syscalls/sh.in deleted file mode 100644 index 06055ed106..0000000000 --- a/fsstress/include/lapi/syscalls/sh.in +++ /dev/null @@ -1,402 +0,0 @@ -restart_syscall 0 -exit 1 -fork 2 -read 3 -write 4 -open 5 -close 6 -waitpid 7 -creat 8 -link 9 -unlink 10 -execve 11 -chdir 12 -time 13 -mknod 14 -chmod 15 -lchown 16 -oldstat 18 -lseek 19 -getpid 20 -mount 21 -umount 22 -setuid 23 -getuid 24 -stime 25 -ptrace 26 -alarm 27 -oldfstat 28 -pause 29 -utime 30 -access 33 -nice 34 -sync 36 -kill 37 -rename 38 -mkdir 39 -rmdir 40 -dup 41 -pipe 42 -times 43 -brk 45 -setgid 46 -getgid 47 -signal 48 -geteuid 49 -getegid 50 -acct 51 -umount2 52 -ioctl 54 -fcntl 55 -setpgid 57 -umask 60 -chroot 61 -ustat 62 -dup2 63 -getppid 64 -getpgrp 65 -setsid 66 -sigaction 67 -sgetmask 68 -ssetmask 69 -setreuid 70 -setregid 71 -sigsuspend 72 -sigpending 73 -sethostname 74 -setrlimit 75 -getrlimit 76 -getrusage 77 -gettimeofday 78 -settimeofday 79 -getgroups 80 -setgroups 81 -symlink 83 -oldlstat 84 -readlink 85 -uselib 86 -swapon 87 -reboot 88 -readdir 89 -mmap 90 -munmap 91 -truncate 92 -ftruncate 93 -fchmod 94 -fchown 95 -getpriority 96 -setpriority 97 -statfs 99 -fstatfs 100 -socketcall 102 -syslog 103 -setitimer 104 -getitimer 105 -stat 106 -lstat 107 -fstat 108 -olduname 109 -vhangup 111 -wait4 114 -swapoff 115 -sysinfo 116 -ipc 117 -fsync 118 -sigreturn 119 -clone 120 -setdomainname 121 -uname 122 -cacheflush 123 -adjtimex 124 -mprotect 125 -sigprocmask 126 -init_module 128 -delete_module 129 -quotactl 131 -getpgid 132 -fchdir 133 -bdflush 134 -sysfs 135 -personality 136 -setfsuid 138 -setfsgid 139 -_llseek 140 -getdents 141 -_newselect 142 -flock 143 -msync 144 -readv 145 -writev 146 -getsid 147 -fdatasync 148 -_sysctl 149 -mlock 150 -munlock 151 -mlockall 152 -munlockall 153 -sched_setparam 154 -sched_getparam 155 -sched_setscheduler 156 -sched_getscheduler 157 -sched_yield 158 -sched_get_priority_max 159 -sched_get_priority_min 160 -sched_rr_get_interval 161 -nanosleep 162 -mremap 163 -setresuid 164 -getresuid 165 -poll 168 -nfsservctl 169 -setresgid 170 -getresgid 171 -prctl 172 -rt_sigreturn 173 -rt_sigaction 174 -rt_sigprocmask 175 -rt_sigpending 176 -rt_sigtimedwait 177 -rt_sigqueueinfo 178 -rt_sigsuspend 179 -pread64 180 -pwrite64 181 -chown 182 -getcwd 183 -capget 184 -capset 185 -sigaltstack 186 -sendfile 187 -vfork 190 -ugetrlimit 191 -mmap2 192 -truncate64 193 -ftruncate64 194 -stat64 195 -lstat64 196 -fstat64 197 -lchown32 198 -getuid32 199 -getgid32 200 -geteuid32 201 -getegid32 202 -setreuid32 203 -setregid32 204 -getgroups32 205 -setgroups32 206 -fchown32 207 -setresuid32 208 -getresuid32 209 -setresgid32 210 -getresgid32 211 -chown32 212 -setuid32 213 -setgid32 214 -setfsuid32 215 -setfsgid32 216 -pivot_root 217 -mincore 218 -madvise 219 -getdents64 220 -fcntl64 221 -gettid 224 -readahead 225 -setxattr 226 -lsetxattr 227 -fsetxattr 228 -getxattr 229 -lgetxattr 230 -fgetxattr 231 -listxattr 232 -llistxattr 233 -flistxattr 234 -removexattr 235 -lremovexattr 236 -fremovexattr 237 -tkill 238 -sendfile64 239 -futex 240 -sched_setaffinity 241 -sched_getaffinity 242 -io_setup 245 -io_destroy 246 -io_getevents 247 -io_submit 248 -io_cancel 249 -fadvise64 250 -exit_group 252 -lookup_dcookie 253 -epoll_create 254 -epoll_ctl 255 -epoll_wait 256 -remap_file_pages 257 -set_tid_address 258 -timer_create 259 -timer_settime 260 -timer_gettime 261 -timer_getoverrun 262 -timer_delete 263 -clock_settime 264 -clock_gettime 265 -clock_getres 266 -clock_nanosleep 267 -statfs64 268 -fstatfs64 269 -tgkill 270 -utimes 271 -fadvise64_64 272 -mbind 274 -get_mempolicy 275 -set_mempolicy 276 -mq_open 277 -mq_unlink 278 -mq_timedsend 279 -mq_timedreceive 280 -mq_notify 281 -mq_getsetattr 282 -kexec_load 283 -waitid 284 -add_key 285 -request_key 286 -keyctl 287 -ioprio_set 288 -ioprio_get 289 -inotify_init 290 -inotify_add_watch 291 -inotify_rm_watch 292 -migrate_pages 294 -openat 295 -mkdirat 296 -mknodat 297 -fchownat 298 -futimesat 299 -fstatat64 300 -unlinkat 301 -renameat 302 -linkat 303 -symlinkat 304 -readlinkat 305 -fchmodat 306 -faccessat 307 -pselect6 308 -ppoll 309 -unshare 310 -set_robust_list 311 -get_robust_list 312 -splice 313 -sync_file_range 314 -tee 315 -vmsplice 316 -move_pages 317 -getcpu 318 -epoll_pwait 319 -utimensat 320 -signalfd 321 -timerfd_create 322 -eventfd 323 -fallocate 324 -timerfd_settime 325 -timerfd_gettime 326 -signalfd4 327 -eventfd2 328 -epoll_create1 329 -dup3 330 -pipe2 331 -inotify_init1 332 -preadv 333 -pwritev 334 -rt_tgsigqueueinfo 335 -perf_event_open 336 -fanotify_init 337 -fanotify_mark 338 -prlimit64 339 -socket 340 -bind 341 -connect 342 -listen 343 -accept 344 -getsockname 345 -getpeername 346 -socketpair 347 -send 348 -sendto 349 -recv 350 -recvfrom 351 -shutdown 352 -setsockopt 353 -getsockopt 354 -sendmsg 355 -recvmsg 356 -recvmmsg 357 -accept4 358 -name_to_handle_at 359 -open_by_handle_at 360 -clock_adjtime 361 -syncfs 362 -sendmmsg 363 -setns 364 -process_vm_readv 365 -process_vm_writev 366 -kcmp 367 -finit_module 368 -sched_getattr 369 -sched_setattr 370 -renameat2 371 -seccomp 372 -getrandom 373 -memfd_create 374 -bpf 375 -execveat 376 -userfaultfd 377 -membarrier 378 -mlock2 379 -copy_file_range 380 -preadv2 381 -pwritev2 382 -statx 383 -pkey_mprotect 384 -pkey_alloc 385 -pkey_free 386 -rseq 387 -semget 393 -semctl 394 -shmget 395 -shmctl 396 -shmat 397 -shmdt 398 -msgget 399 -msgsnd 400 -msgrcv 401 -msgctl 402 -clock_gettime64 403 -clock_settime64 404 -clock_adjtime64 405 -clock_getres_time64 406 -clock_nanosleep_time64 407 -timer_gettime64 408 -timer_settime64 409 -timerfd_gettime64 410 -timerfd_settime64 411 -utimensat_time64 412 -pselect6_time64 413 -ppoll_time64 414 -io_pgetevents_time64 416 -recvmmsg_time64 417 -mq_timedsend_time64 418 -mq_timedreceive_time64 419 -semtimedop_time64 420 -rt_sigtimedwait_time64 421 -futex_time64 422 -sched_rr_get_interval_time64 423 -pidfd_send_signal 424 -io_uring_setup 425 -io_uring_enter 426 -io_uring_register 427 -open_tree 428 -move_mount 429 -fsopen 430 -fsconfig 431 -fsmount 432 -fspick 433 -pidfd_open 434 -openat2 437 -pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/sparc.in b/fsstress/include/lapi/syscalls/sparc.in deleted file mode 100644 index 522e3c9974..0000000000 --- a/fsstress/include/lapi/syscalls/sparc.in +++ /dev/null @@ -1,407 +0,0 @@ -restart_syscall 0 -exit 1 -fork 2 -read 3 -write 4 -open 5 -close 6 -wait4 7 -creat 8 -link 9 -unlink 10 -execv 11 -chdir 12 -chown 13 -mknod 14 -chmod 15 -lchown 16 -brk 17 -perfctr 18 -lseek 19 -getpid 20 -capget 21 -capset 22 -setuid 23 -getuid 24 -vmsplice 25 -ptrace 26 -alarm 27 -sigaltstack 28 -pause 29 -utime 30 -lchown32 31 -fchown32 32 -access 33 -nice 34 -chown32 35 -sync 36 -kill 37 -stat 38 -sendfile 39 -lstat 40 -dup 41 -pipe 42 -times 43 -getuid32 44 -umount2 45 -setgid 46 -getgid 47 -signal 48 -geteuid 49 -getegid 50 -acct 51 -getgid32 53 -ioctl 54 -reboot 55 -mmap2 56 -symlink 57 -readlink 58 -execve 59 -umask 60 -chroot 61 -fstat 62 -fstat64 63 -getpagesize 64 -msync 65 -vfork 66 -pread64 67 -pwrite64 68 -geteuid32 69 -getegid32 70 -mmap 71 -setreuid32 72 -munmap 73 -mprotect 74 -madvise 75 -vhangup 76 -truncate64 77 -mincore 78 -getgroups 79 -setgroups 80 -getpgrp 81 -setgroups32 82 -setitimer 83 -ftruncate64 84 -swapon 85 -getitimer 86 -setuid32 87 -sethostname 88 -setgid32 89 -dup2 90 -setfsuid32 91 -fcntl 92 -select 93 -setfsgid32 94 -fsync 95 -setpriority 96 -socket 97 -connect 98 -accept 99 -getpriority 100 -rt_sigreturn 101 -rt_sigaction 102 -rt_sigprocmask 103 -rt_sigpending 104 -rt_sigtimedwait 105 -rt_sigqueueinfo 106 -rt_sigsuspend 107 -setresuid32 108 -getresuid32 109 -setresgid32 110 -getresgid32 111 -setregid32 112 -recvmsg 113 -sendmsg 114 -getgroups32 115 -gettimeofday 116 -getrusage 117 -getsockopt 118 -getcwd 119 -readv 120 -writev 121 -settimeofday 122 -fchown 123 -fchmod 124 -recvfrom 125 -setreuid 126 -setregid 127 -rename 128 -truncate 129 -ftruncate 130 -flock 131 -lstat64 132 -sendto 133 -shutdown 134 -socketpair 135 -mkdir 136 -rmdir 137 -utimes 138 -stat64 139 -sendfile64 140 -getpeername 141 -futex 142 -gettid 143 -getrlimit 144 -setrlimit 145 -pivot_root 146 -prctl 147 -pciconfig_read 148 -pciconfig_write 149 -getsockname 150 -inotify_init 151 -inotify_add_watch 152 -poll 153 -getdents64 154 -fcntl64 155 -inotify_rm_watch 156 -statfs 157 -fstatfs 158 -umount 159 -sched_set_affinity 160 -sched_get_affinity 161 -getdomainname 162 -setdomainname 163 -quotactl 165 -set_tid_address 166 -mount 167 -ustat 168 -setxattr 169 -lsetxattr 170 -fsetxattr 171 -getxattr 172 -lgetxattr 173 -getdents 174 -setsid 175 -fchdir 176 -fgetxattr 177 -listxattr 178 -llistxattr 179 -flistxattr 180 -removexattr 181 -lremovexattr 182 -sigpending 183 -query_module 184 -setpgid 185 -fremovexattr 186 -tkill 187 -exit_group 188 -uname 189 -init_module 190 -personality 191 -remap_file_pages 192 -epoll_create 193 -epoll_ctl 194 -epoll_wait 195 -ioprio_set 196 -getppid 197 -sigaction 198 -sgetmask 199 -ssetmask 200 -sigsuspend 201 -oldlstat 202 -uselib 203 -readdir 204 -readahead 205 -socketcall 206 -syslog 207 -lookup_dcookie 208 -fadvise64 209 -fadvise64_64 210 -tgkill 211 -waitpid 212 -swapoff 213 -sysinfo 214 -ipc 215 -sigreturn 216 -clone 217 -ioprio_get 218 -adjtimex 219 -sigprocmask 220 -create_module 221 -delete_module 222 -get_kernel_syms 223 -getpgid 224 -bdflush 225 -sysfs 226 -afs_syscall 227 -setfsuid 228 -setfsgid 229 -_newselect 230 -time 231 -splice 232 -stime 233 -statfs64 234 -fstatfs64 235 -_llseek 236 -mlock 237 -munlock 238 -mlockall 239 -munlockall 240 -sched_setparam 241 -sched_getparam 242 -sched_setscheduler 243 -sched_getscheduler 244 -sched_yield 245 -sched_get_priority_max 246 -sched_get_priority_min 247 -sched_rr_get_interval 248 -nanosleep 249 -mremap 250 -_sysctl 251 -getsid 252 -fdatasync 253 -nfsservctl 254 -sync_file_range 255 -clock_settime 256 -clock_gettime 257 -clock_getres 258 -clock_nanosleep 259 -sched_getaffinity 260 -sched_setaffinity 261 -timer_settime 262 -timer_gettime 263 -timer_getoverrun 264 -timer_delete 265 -timer_create 266 -vserver 267 -io_setup 268 -io_destroy 269 -io_submit 270 -io_cancel 271 -io_getevents 272 -mq_open 273 -mq_unlink 274 -mq_timedsend 275 -mq_timedreceive 276 -mq_notify 277 -mq_getsetattr 278 -waitid 279 -tee 280 -add_key 281 -request_key 282 -keyctl 283 -openat 284 -mkdirat 285 -mknodat 286 -fchownat 287 -futimesat 288 -fstatat64 289 -unlinkat 290 -renameat 291 -linkat 292 -symlinkat 293 -readlinkat 294 -fchmodat 295 -faccessat 296 -pselect6 297 -ppoll 298 -unshare 299 -set_robust_list 300 -get_robust_list 301 -migrate_pages 302 -mbind 303 -get_mempolicy 304 -set_mempolicy 305 -kexec_load 306 -move_pages 307 -getcpu 308 -epoll_pwait 309 -utimensat 310 -signalfd 311 -timerfd_create 312 -eventfd 313 -fallocate 314 -timerfd_settime 315 -timerfd_gettime 316 -signalfd4 317 -eventfd2 318 -epoll_create1 319 -dup3 320 -pipe2 321 -inotify_init1 322 -accept4 323 -preadv 324 -pwritev 325 -rt_tgsigqueueinfo 326 -perf_event_open 327 -recvmmsg 328 -fanotify_init 329 -fanotify_mark 330 -prlimit64 331 -name_to_handle_at 332 -open_by_handle_at 333 -clock_adjtime 334 -syncfs 335 -sendmmsg 336 -setns 337 -process_vm_readv 338 -process_vm_writev 339 -kern_features 340 -kcmp 341 -finit_module 342 -sched_setattr 343 -sched_getattr 344 -renameat2 345 -seccomp 346 -getrandom 347 -memfd_create 348 -bpf 349 -execveat 350 -membarrier 351 -userfaultfd 352 -bind 353 -listen 354 -setsockopt 355 -mlock2 356 -copy_file_range 357 -preadv2 358 -pwritev2 359 -statx 360 -io_pgetevents 361 -pkey_mprotect 362 -pkey_alloc 363 -pkey_free 364 -rseq 365 -semget 393 -semctl 394 -shmget 395 -shmctl 396 -shmat 397 -shmdt 398 -msgget 399 -msgsnd 400 -msgrcv 401 -msgctl 402 -clock_gettime64 403 -clock_settime64 404 -clock_adjtime64 405 -clock_getres_time64 406 -clock_nanosleep_time64 407 -timer_gettime64 408 -timer_settime64 409 -timerfd_gettime64 410 -timerfd_settime64 411 -utimensat_time64 412 -pselect6_time64 413 -ppoll_time64 414 -io_pgetevents_time64 416 -recvmmsg_time64 417 -mq_timedsend_time64 418 -mq_timedreceive_time64 419 -semtimedop_time64 420 -rt_sigtimedwait_time64 421 -futex_time64 422 -sched_rr_get_interval_time64 423 -pidfd_send_signal 424 -io_uring_setup 425 -io_uring_enter 426 -io_uring_register 427 -open_tree 428 -move_mount 429 -fsopen 430 -fsconfig 431 -fsmount 432 -fspick 433 -pidfd_open 434 -openat2 437 -pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/sparc64.in b/fsstress/include/lapi/syscalls/sparc64.in deleted file mode 100644 index 6f884a7bf7..0000000000 --- a/fsstress/include/lapi/syscalls/sparc64.in +++ /dev/null @@ -1,372 +0,0 @@ -restart_syscall 0 -exit 1 -fork 2 -read 3 -write 4 -open 5 -close 6 -wait4 7 -creat 8 -link 9 -unlink 10 -execv 11 -chdir 12 -chown 13 -mknod 14 -chmod 15 -lchown 16 -brk 17 -perfctr 18 -lseek 19 -getpid 20 -capget 21 -capset 22 -setuid 23 -getuid 24 -vmsplice 25 -ptrace 26 -alarm 27 -sigaltstack 28 -pause 29 -utime 30 -lchown32 31 -fchown32 32 -access 33 -nice 34 -sync 36 -kill 37 -stat 38 -sendfile 39 -lstat 40 -dup 41 -pipe 42 -times 43 -umount2 45 -setgid 46 -getgid 47 -signal 48 -geteuid 49 -getegid 50 -acct 51 -memory_ordering 52 -ioctl 54 -reboot 55 -symlink 57 -readlink 58 -execve 59 -umask 60 -chroot 61 -fstat 62 -fstat64 63 -getpagesize 64 -msync 65 -vfork 66 -pread64 67 -pwrite64 68 -mmap 71 -munmap 73 -mprotect 74 -madvise 75 -vhangup 76 -mincore 78 -getgroups 79 -setgroups 80 -getpgrp 81 -setitimer 83 -swapon 85 -getitimer 86 -sethostname 88 -dup2 90 -fcntl 92 -select 93 -fsync 95 -setpriority 96 -socket 97 -connect 98 -accept 99 -getpriority 100 -rt_sigreturn 101 -rt_sigaction 102 -rt_sigprocmask 103 -rt_sigpending 104 -rt_sigtimedwait 105 -rt_sigqueueinfo 106 -rt_sigsuspend 107 -setresuid 108 -getresuid 109 -setresgid 110 -getresgid 111 -recvmsg 113 -sendmsg 114 -gettimeofday 116 -getrusage 117 -getsockopt 118 -getcwd 119 -readv 120 -writev 121 -settimeofday 122 -fchown 123 -fchmod 124 -recvfrom 125 -setreuid 126 -setregid 127 -rename 128 -truncate 129 -ftruncate 130 -flock 131 -lstat64 132 -sendto 133 -shutdown 134 -socketpair 135 -mkdir 136 -rmdir 137 -utimes 138 -stat64 139 -sendfile64 140 -getpeername 141 -futex 142 -gettid 143 -getrlimit 144 -setrlimit 145 -pivot_root 146 -prctl 147 -pciconfig_read 148 -pciconfig_write 149 -getsockname 150 -inotify_init 151 -inotify_add_watch 152 -poll 153 -getdents64 154 -inotify_rm_watch 156 -statfs 157 -fstatfs 158 -umount 159 -sched_set_affinity 160 -sched_get_affinity 161 -getdomainname 162 -setdomainname 163 -utrap_install 164 -quotactl 165 -set_tid_address 166 -mount 167 -ustat 168 -setxattr 169 -lsetxattr 170 -fsetxattr 171 -getxattr 172 -lgetxattr 173 -getdents 174 -setsid 175 -fchdir 176 -fgetxattr 177 -listxattr 178 -llistxattr 179 -flistxattr 180 -removexattr 181 -lremovexattr 182 -sigpending 183 -query_module 184 -setpgid 185 -fremovexattr 186 -tkill 187 -exit_group 188 -uname 189 -init_module 190 -personality 191 -remap_file_pages 192 -epoll_create 193 -epoll_ctl 194 -epoll_wait 195 -ioprio_set 196 -getppid 197 -sigaction 198 -sgetmask 199 -ssetmask 200 -sigsuspend 201 -oldlstat 202 -uselib 203 -readdir 204 -readahead 205 -socketcall 206 -syslog 207 -lookup_dcookie 208 -fadvise64 209 -fadvise64_64 210 -tgkill 211 -waitpid 212 -swapoff 213 -sysinfo 214 -ipc 215 -sigreturn 216 -clone 217 -ioprio_get 218 -adjtimex 219 -sigprocmask 220 -create_module 221 -delete_module 222 -get_kernel_syms 223 -getpgid 224 -bdflush 225 -sysfs 226 -afs_syscall 227 -setfsuid 228 -setfsgid 229 -_newselect 230 -splice 232 -stime 233 -statfs64 234 -fstatfs64 235 -_llseek 236 -mlock 237 -munlock 238 -mlockall 239 -munlockall 240 -sched_setparam 241 -sched_getparam 242 -sched_setscheduler 243 -sched_getscheduler 244 -sched_yield 245 -sched_get_priority_max 246 -sched_get_priority_min 247 -sched_rr_get_interval 248 -nanosleep 249 -mremap 250 -_sysctl 251 -getsid 252 -fdatasync 253 -nfsservctl 254 -sync_file_range 255 -clock_settime 256 -clock_gettime 257 -clock_getres 258 -clock_nanosleep 259 -sched_getaffinity 260 -sched_setaffinity 261 -timer_settime 262 -timer_gettime 263 -timer_getoverrun 264 -timer_delete 265 -timer_create 266 -vserver 267 -io_setup 268 -io_destroy 269 -io_submit 270 -io_cancel 271 -io_getevents 272 -mq_open 273 -mq_unlink 274 -mq_timedsend 275 -mq_timedreceive 276 -mq_notify 277 -mq_getsetattr 278 -waitid 279 -tee 280 -add_key 281 -request_key 282 -keyctl 283 -openat 284 -mkdirat 285 -mknodat 286 -fchownat 287 -futimesat 288 -fstatat64 289 -unlinkat 290 -renameat 291 -linkat 292 -symlinkat 293 -readlinkat 294 -fchmodat 295 -faccessat 296 -pselect6 297 -ppoll 298 -unshare 299 -set_robust_list 300 -get_robust_list 301 -migrate_pages 302 -mbind 303 -get_mempolicy 304 -set_mempolicy 305 -kexec_load 306 -move_pages 307 -getcpu 308 -epoll_pwait 309 -utimensat 310 -signalfd 311 -timerfd_create 312 -eventfd 313 -fallocate 314 -timerfd_settime 315 -timerfd_gettime 316 -signalfd4 317 -eventfd2 318 -epoll_create1 319 -dup3 320 -pipe2 321 -inotify_init1 322 -accept4 323 -preadv 324 -pwritev 325 -rt_tgsigqueueinfo 326 -perf_event_open 327 -recvmmsg 328 -fanotify_init 329 -fanotify_mark 330 -prlimit64 331 -name_to_handle_at 332 -open_by_handle_at 333 -clock_adjtime 334 -syncfs 335 -sendmmsg 336 -setns 337 -process_vm_readv 338 -process_vm_writev 339 -kern_features 340 -kcmp 341 -finit_module 342 -sched_setattr 343 -sched_getattr 344 -renameat2 345 -seccomp 346 -getrandom 347 -memfd_create 348 -bpf 349 -execveat 350 -membarrier 351 -userfaultfd 352 -bind 353 -listen 354 -setsockopt 355 -mlock2 356 -copy_file_range 357 -preadv2 358 -pwritev2 359 -statx 360 -io_pgetevents 361 -pkey_mprotect 362 -pkey_alloc 363 -pkey_free 364 -rseq 365 -semtimedop 392 -semget 393 -semctl 394 -shmget 395 -shmctl 396 -shmat 397 -shmdt 398 -msgget 399 -msgsnd 400 -msgrcv 401 -msgctl 402 -pidfd_send_signal 424 -io_uring_setup 425 -io_uring_enter 426 -io_uring_register 427 -open_tree 428 -move_mount 429 -fsopen 430 -fsconfig 431 -fsmount 432 -fspick 433 -pidfd_open 434 -openat2 437 -pidfd_getfd 438 diff --git a/fsstress/include/lapi/syscalls/strip_syscall.awk b/fsstress/include/lapi/syscalls/strip_syscall.awk deleted file mode 100755 index e8dff422e2..0000000000 --- a/fsstress/include/lapi/syscalls/strip_syscall.awk +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/awk -f -# -# Dumb script that can be used to strip all of the syscall information from -# the arch-respective unistd*.h. -# -# Examples: -# -# 1. Grab the i386 32-bit syscalls from unistd_32.h and put them in i386.in -# strip_syscall.awk arch/x86/include/asm/unistd_32.h > i386.in -# - -/^#define[[:space:]]+__NR_[0-9a-z]+/ { - - sub (/#define[[:space:]]+__NR_/, "", $0); - sub (/[[:space:]]*(\/\*.*)/, "", $0); - sub (/[[:space:]]+/, " ", $0); - - print -} diff --git a/fsstress/include/lapi/syscalls/x86_64.in b/fsstress/include/lapi/syscalls/x86_64.in deleted file mode 100644 index c76328c93a..0000000000 --- a/fsstress/include/lapi/syscalls/x86_64.in +++ /dev/null @@ -1,385 +0,0 @@ -read 0 -write 1 -open 2 -close 3 -stat 4 -fstat 5 -lstat 6 -poll 7 -lseek 8 -mmap 9 -mprotect 10 -munmap 11 -brk 12 -rt_sigaction 13 -rt_sigprocmask 14 -rt_sigreturn 15 -ioctl 16 -pread64 17 -pwrite64 18 -readv 19 -writev 20 -access 21 -pipe 22 -select 23 -sched_yield 24 -mremap 25 -msync 26 -mincore 27 -madvise 28 -shmget 29 -shmat 30 -shmctl 31 -dup 32 -dup2 33 -pause 34 -nanosleep 35 -getitimer 36 -alarm 37 -setitimer 38 -getpid 39 -sendfile 40 -socket 41 -connect 42 -accept 43 -sendto 44 -recvfrom 45 -sendmsg 46 -recvmsg 47 -shutdown 48 -bind 49 -listen 50 -getsockname 51 -getpeername 52 -socketpair 53 -setsockopt 54 -getsockopt 55 -clone 56 -fork 57 -vfork 58 -execve 59 -exit 60 -wait4 61 -kill 62 -uname 63 -semget 64 -semop 65 -semctl 66 -shmdt 67 -msgget 68 -msgsnd 69 -msgrcv 70 -msgctl 71 -fcntl 72 -flock 73 -fsync 74 -fdatasync 75 -truncate 76 -ftruncate 77 -getdents 78 -getcwd 79 -chdir 80 -fchdir 81 -rename 82 -mkdir 83 -rmdir 84 -creat 85 -link 86 -unlink 87 -symlink 88 -readlink 89 -chmod 90 -fchmod 91 -chown 92 -fchown 93 -lchown 94 -umask 95 -gettimeofday 96 -getrlimit 97 -getrusage 98 -sysinfo 99 -times 100 -ptrace 101 -getuid 102 -syslog 103 -getgid 104 -setuid 105 -setgid 106 -geteuid 107 -getegid 108 -setpgid 109 -getppid 110 -getpgrp 111 -setsid 112 -setreuid 113 -setregid 114 -getgroups 115 -setgroups 116 -setresuid 117 -getresuid 118 -setresgid 119 -getresgid 120 -getpgid 121 -setfsuid 122 -setfsgid 123 -getsid 124 -capget 125 -capset 126 -rt_sigpending 127 -rt_sigtimedwait 128 -rt_sigqueueinfo 129 -rt_sigsuspend 130 -sigaltstack 131 -utime 132 -mknod 133 -uselib 134 -personality 135 -ustat 136 -statfs 137 -fstatfs 138 -sysfs 139 -getpriority 140 -setpriority 141 -sched_setparam 142 -sched_getparam 143 -sched_setscheduler 144 -sched_getscheduler 145 -sched_get_priority_max 146 -sched_get_priority_min 147 -sched_rr_get_interval 148 -mlock 149 -munlock 150 -mlockall 151 -munlockall 152 -vhangup 153 -modify_ldt 154 -pivot_root 155 -_sysctl 156 -prctl 157 -arch_prctl 158 -adjtimex 159 -setrlimit 160 -chroot 161 -sync 162 -acct 163 -settimeofday 164 -mount 165 -umount2 166 -swapon 167 -swapoff 168 -reboot 169 -sethostname 170 -setdomainname 171 -iopl 172 -ioperm 173 -create_module 174 -init_module 175 -delete_module 176 -get_kernel_syms 177 -query_module 178 -quotactl 179 -nfsservctl 180 -getpmsg 181 -putpmsg 182 -afs_syscall 183 -tuxcall 184 -security 185 -gettid 186 -readahead 187 -setxattr 188 -lsetxattr 189 -fsetxattr 190 -getxattr 191 -lgetxattr 192 -fgetxattr 193 -listxattr 194 -llistxattr 195 -flistxattr 196 -removexattr 197 -lremovexattr 198 -fremovexattr 199 -tkill 200 -time 201 -futex 202 -sched_setaffinity 203 -sched_getaffinity 204 -set_thread_area 205 -io_setup 206 -io_destroy 207 -io_getevents 208 -io_submit 209 -io_cancel 210 -get_thread_area 211 -lookup_dcookie 212 -epoll_create 213 -epoll_ctl_old 214 -epoll_wait_old 215 -remap_file_pages 216 -getdents64 217 -set_tid_address 218 -restart_syscall 219 -semtimedop 220 -fadvise64 221 -timer_create 222 -timer_settime 223 -timer_gettime 224 -timer_getoverrun 225 -timer_delete 226 -clock_settime 227 -clock_gettime 228 -clock_getres 229 -clock_nanosleep 230 -exit_group 231 -epoll_wait 232 -epoll_ctl 233 -tgkill 234 -utimes 235 -vserver 236 -mbind 237 -set_mempolicy 238 -get_mempolicy 239 -mq_open 240 -mq_unlink 241 -mq_timedsend 242 -mq_timedreceive 243 -mq_notify 244 -mq_getsetattr 245 -kexec_load 246 -waitid 247 -add_key 248 -request_key 249 -keyctl 250 -ioprio_set 251 -ioprio_get 252 -inotify_init 253 -inotify_add_watch 254 -inotify_rm_watch 255 -migrate_pages 256 -openat 257 -mkdirat 258 -mknodat 259 -fchownat 260 -futimesat 261 -newfstatat 262 -unlinkat 263 -renameat 264 -linkat 265 -symlinkat 266 -readlinkat 267 -fchmodat 268 -faccessat 269 -pselect6 270 -ppoll 271 -unshare 272 -set_robust_list 273 -get_robust_list 274 -splice 275 -tee 276 -sync_file_range 277 -vmsplice 278 -move_pages 279 -utimensat 280 -epoll_pwait 281 -signalfd 282 -timerfd_create 283 -eventfd 284 -fallocate 285 -timerfd_settime 286 -timerfd_gettime 287 -accept4 288 -signalfd4 289 -eventfd2 290 -epoll_create1 291 -dup3 292 -pipe2 293 -inotify_init1 294 -preadv 295 -pwritev 296 -rt_tgsigqueueinfo 297 -perf_event_open 298 -recvmmsg 299 -fanotify_init 300 -fanotify_mark 301 -prlimit64 302 -name_to_handle_at 303 -open_by_handle_at 304 -clock_adjtime 305 -syncfs 306 -sendmmsg 307 -setns 308 -getcpu 309 -process_vm_readv 310 -process_vm_writev 311 -kcmp 312 -finit_module 313 -sched_setattr 314 -sched_getattr 315 -renameat2 316 -seccomp 317 -getrandom 318 -memfd_create 319 -kexec_file_load 320 -bpf 321 -execveat 322 -userfaultfd 323 -membarrier 324 -mlock2 325 -copy_file_range 326 -preadv2 327 -pwritev2 328 -pkey_mprotect 329 -pkey_alloc 330 -pkey_free 331 -statx 332 -io_pgetevents 333 -rseq 334 -pidfd_send_signal 424 -io_uring_setup 425 -io_uring_enter 426 -io_uring_register 427 -open_tree 428 -move_mount 429 -fsopen 430 -fsconfig 431 -fsmount 432 -fspick 433 -pidfd_open 434 -clone3 435 -openat2 437 -pidfd_getfd 438 -rt_sigaction 512 -rt_sigreturn 513 -ioctl 514 -readv 515 -writev 516 -recvfrom 517 -sendmsg 518 -recvmsg 519 -execve 520 -ptrace 521 -rt_sigpending 522 -rt_sigtimedwait 523 -rt_sigqueueinfo 524 -sigaltstack 525 -timer_create 526 -mq_notify 527 -kexec_load 528 -waitid 529 -set_robust_list 530 -get_robust_list 531 -vmsplice 532 -move_pages 533 -preadv 534 -pwritev 535 -rt_tgsigqueueinfo 536 -recvmmsg 537 -sendmmsg 538 -process_vm_readv 539 -process_vm_writev 540 -setsockopt 541 -getsockopt 542 -io_setup 543 -io_submit 544 -execveat 545 -preadv2 546 -pwritev2 547 diff --git a/fsstress/include/lapi/tcp.h b/fsstress/include/lapi/tcp.h deleted file mode 100644 index bb98f28f08..0000000000 --- a/fsstress/include/lapi/tcp.h +++ /dev/null @@ -1,19 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2017 Petr Vorel - */ - -#ifndef LAPI_TCP_H__ -#define LAPI_TCP_H__ - -#include - -#ifndef TCP_FASTOPEN -# define TCP_FASTOPEN 23 -#endif - -#ifndef TCP_FASTOPEN_CONNECT -# define TCP_FASTOPEN_CONNECT 30 /* Attempt FastOpen with connect */ -#endif - -#endif /* LAPI_TCP_H__ */ diff --git a/fsstress/include/lapi/tee.h b/fsstress/include/lapi/tee.h deleted file mode 100644 index 422e811773..0000000000 --- a/fsstress/include/lapi/tee.h +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) International Business Machines Corp., 2007 - * Copyright (c) 2014 Fujitsu Ltd. - */ - -#ifndef TEE_H -#define TEE_H - -#include "config.h" -#include "lapi/syscalls.h" - -#if !defined(HAVE_TEE) -ssize_t tee(int fd_in, int fd_out, size_t len, unsigned int flags) -{ - return tst_syscall(__NR_tee, fd_in, fd_out, len, flags); -} -#endif - -#endif /* TEE_H */ diff --git a/fsstress/include/lapi/termbits.h b/fsstress/include/lapi/termbits.h deleted file mode 100644 index d79da085b1..0000000000 --- a/fsstress/include/lapi/termbits.h +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2018 Linux Test Project - */ - -#ifndef LAPI_TERMBITS_H__ -#define LAPI_TERMBITS_H__ - -#ifndef EXTPROC -# define EXTPROC 0200000 -#endif - -#endif diff --git a/fsstress/include/lapi/timerfd.h b/fsstress/include/lapi/timerfd.h deleted file mode 100644 index 50e09726be..0000000000 --- a/fsstress/include/lapi/timerfd.h +++ /dev/null @@ -1,41 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) International Business Machines Corp., 2007 - * Copyright (c) 2014 Fujitsu Ltd. - */ - -#ifndef TIMERFD_H -#define TIMERFD_H - -#include -#include "config.h" -#include "lapi/syscalls.h" - -#ifdef HAVE_SYS_TIMERFD_H -#include -#endif - -#if !defined(HAVE_TIMERFD_CREATE) -int timerfd_create(int clockid, int flags) -{ - return ltp_syscall(__NR_timerfd_create, clockid, flags); -} -#endif - -#if !defined(HAVE_TIMERFD_GETTIME) -int timerfd_settime(int fd, int flags, const struct itimerspec *new_value, - struct itimerspec *old_value) -{ - return ltp_syscall(__NR_timerfd_settime, fd, flags, new_value, - old_value); -} -#endif - -#if !defined(HAVE_TIMERFD_SETTIME) -int timerfd_gettime(int fd, struct itimerspec *curr_value) -{ - return ltp_syscall(__NR_timerfd_gettime, fd, curr_value); -} -#endif - -#endif /* TIMERFD_H */ diff --git a/fsstress/include/lapi/timex.h b/fsstress/include/lapi/timex.h deleted file mode 100644 index c2c9e4d8d4..0000000000 --- a/fsstress/include/lapi/timex.h +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved. - * Author: Yang Xu - */ - -#ifndef LAPI_TIMEX_H__ -# define LAPI_TIMEX_H__ - -#define ADJ_ALL (ADJ_OFFSET | ADJ_FREQUENCY | ADJ_MAXERROR | \ - ADJ_ESTERROR | ADJ_STATUS | ADJ_TIMECONST | \ - ADJ_TICK) - -#ifndef ADJ_OFFSET_SS_READ -# define ADJ_OFFSET_SS_READ 0xa001 -#endif - -#ifndef ADJ_NANO -# define ADJ_NANO 0x2000 -#endif - -#ifndef STA_NANO -# define STA_NANO 0x2000 -#endif - -#ifndef ADJ_MICRO -# define ADJ_MICRO 0x1000 -#endif - -#endif/* LAPI_TIMEX_H__ */ diff --git a/fsstress/include/lapi/tty.h b/fsstress/include/lapi/tty.h deleted file mode 100644 index 353a103f12..0000000000 --- a/fsstress/include/lapi/tty.h +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2020 Petr Vorel - */ - -#ifndef LAPI_TTY_H -#define LAPI_TTY_H - -#ifdef HAVE_LINUX_TTY_H -# include -#endif - -#ifndef N_SLCAN -# define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */ -#endif - -#endif /* LAPI_TTY_H */ diff --git a/fsstress/include/lapi/udp.h b/fsstress/include/lapi/udp.h deleted file mode 100644 index 5c73dd3698..0000000000 --- a/fsstress/include/lapi/udp.h +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2018 Oracle and/or its affiliates. - */ - -#ifndef LAPI_UDP_H__ -#define LAPI_UDP_H__ - -#include - -#ifndef UDPLITE_SEND_CSCOV -# define UDPLITE_SEND_CSCOV 10 /* sender partial coverage (as sent) */ -#endif -#ifndef UDPLITE_RECV_CSCOV -# define UDPLITE_RECV_CSCOV 11 /* receiver partial coverage (threshold ) */ -#endif - -#endif /* LAPI_UDP_H__ */ diff --git a/fsstress/include/lapi/ustat.h b/fsstress/include/lapi/ustat.h deleted file mode 100644 index 98633e7494..0000000000 --- a/fsstress/include/lapi/ustat.h +++ /dev/null @@ -1,22 +0,0 @@ -//SPDX-License-Identifier: GPL-2.0-or-later - -#ifndef LAPI_USTAT_H -#define LAPI_USTAT_H - -#include "config.h" - -#include - -#ifdef HAVE_SYS_USTAT_H -# include -#elif HAVE_LINUX_TYPES_H -# include -struct ustat { - __kernel_daddr_t f_tfree; - ino_t f_tinode; - char f_fname[6]; - char f_fpack[6]; -}; -#endif - -#endif /* LAPI_USTAT_H */ diff --git a/fsstress/include/lapi/utime.h b/fsstress/include/lapi/utime.h deleted file mode 100644 index dbfaa55be3..0000000000 --- a/fsstress/include/lapi/utime.h +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved. - */ - -#ifndef __UTIME_H__ - -#ifndef UTIME_NOW -# define UTIME_NOW ((1l << 30) - 1l) -#endif - -#ifndef UTIME_OMIT -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* __UTIME_H__ */ diff --git a/fsstress/include/lapi/utsname.h b/fsstress/include/lapi/utsname.h deleted file mode 100644 index 6209eac47b..0000000000 --- a/fsstress/include/lapi/utsname.h +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2019 Petr Vorel - */ - -#ifdef HAVE_SYS_UTSNAME_H -# include -#endif - -#ifndef _UTSNAME_LENGTH -# define _UTSNAME_LENGTH 65 -#endif - -#ifndef _UTSNAME_DOMAIN_LENGTH -# define _UTSNAME_DOMAIN_LENGTH _UTSNAME_LENGTH -#endif diff --git a/fsstress/include/lapi/vmsplice.h b/fsstress/include/lapi/vmsplice.h deleted file mode 100644 index ba0fcca277..0000000000 --- a/fsstress/include/lapi/vmsplice.h +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) International Business Machines Corp., 2007 - * Copyright (c) 2014 Cyril Hrubis - */ - -#ifndef VMSPLICE_H -#define VMSPLICE_H - -#include "config.h" -#include "lapi/syscalls.h" - -#include "lapi/iovec.h" - -#if !defined(HAVE_VMSPLICE) -ssize_t vmsplice(int fd, const struct iovec *iov, - unsigned long nr_segs, unsigned int flags) -{ - return tst_syscall(__NR_vmsplice, fd, iov, nr_segs, flags); -} -#endif - -#endif /* VMSPLICE_H */ diff --git a/fsstress/include/lapi/xfrm.h b/fsstress/include/lapi/xfrm.h deleted file mode 100644 index d9051202c1..0000000000 --- a/fsstress/include/lapi/xfrm.h +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2018 Linux Test Project - */ - -#ifndef LAPI_XFRM_H__ -#define LAPI_XFRM_H__ - -#ifndef XFRMNLGRP_NONE -# define XFRMNLGRP_NONE 0 -#endif - -#ifndef XFRM_MSG_GETPOLICY -# define XFRM_MSG_GETPOLICY 21 -#endif - -#endif diff --git a/fsstress/include/libmsgctl.h b/fsstress/include/libmsgctl.h deleted file mode 100644 index e1afeab5f8..0000000000 --- a/fsstress/include/libmsgctl.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) International Business Machines Corp., 2002 - * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved. - * - * 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 would 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 the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __LIBMSGCTL_H__ -#define __LIBMSGCTL_H__ - -#define FAIL 1 -#define PASS 0 - -struct mbuffer { - long type; - struct { - char len; - char pbytes[99]; - } data; -}; - -int doreader(long key, int tid, long type, int child, int nreps); -int dowriter(long key, int tid, long type, int child, int nreps); -int fill_buffer(char *buf, char val, int size); -int verify(char *buf, char val, int size, int child); - -#endif /*__LIBMSGCTL_H__ */ diff --git a/fsstress/include/libnewipc.h b/fsstress/include/libnewipc.h deleted file mode 100644 index 30288cd68c..0000000000 --- a/fsstress/include/libnewipc.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2016 Xiao Yang - * - * 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. - */ - -/* - * common definitions for the IPC system calls. - */ - -#ifndef __LIBNEWIPC_H -#define __LIBNEWIPC_H 1 - -#include - -#define MSG_RD 0400 -#define MSG_WR 0200 -#define MSG_RW (MSG_RD | MSG_WR) -#define MSGSIZE 1024 -#define MSGTYPE 1 -#define NR_MSGQUEUES 16 -#define min(a, b) (((a) < (b)) ? (a) : (b)) - -#define SEM_RD 0400 -#define SEM_ALT 0200 -#define SEM_RA (SEM_RD | SEM_ALT) -#define PSEMS 10 - -#define SHM_RD 0400 -#define SHM_WR 0200 -#define SHM_RW (SHM_RD | SHM_WR) -#define SHM_SIZE 2048 -#define INT_SIZE 4 -#define MODE_MASK 0x01FF - -key_t getipckey(const char *file, const int lineno); -#define GETIPCKEY() \ - getipckey(__FILE__, __LINE__) - -int get_used_queues(const char *file, const int lineno); -#define GET_USED_QUEUES() \ - get_used_queues(__FILE__, __LINE__) - -void *probe_free_addr(const char *file, const int lineno); -#define PROBE_FREE_ADDR() \ - probe_free_addr(__FILE__, __LINE__) - -#endif /* newlibipc.h */ diff --git a/fsstress/include/mk/automake.mk b/fsstress/include/mk/automake.mk deleted file mode 100644 index 219d015d0c..0000000000 --- a/fsstress/include/mk/automake.mk +++ /dev/null @@ -1,115 +0,0 @@ -# -# Autotools include Makefile. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# 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. -# -# Ngie Cooper, July 2009 -# - -# Override these variables to use non-system available tools. -ACLOCAL ?= aclocal -AUTOCONF ?= autoconf -AUTOHEADER ?= autoheader -AUTOMAKE ?= automake - -AUTOCONFED_SUBDIRS = \ - testcases/realtime - -# We want to run this every single time to ensure that all of the prereq files -# are there. -.PHONY: testcases/realtime/configure -testcases/realtime/configure: - $(MAKE) -C $(@D) autotools - -.PHONY: autotools -autotools: aclocal autoconf autoheader automake $(addsuffix /configure,$(AUTOCONFED_SUBDIRS)) - -.PHONY: aclocal -aclocal: aclocal.m4 - -aclocal.m4: $(wildcard m4/*.m4) m4/ltp-version.m4 - $(ACLOCAL) -I m4 - -.PHONY: autoconf -autoconf: configure - -configure: configure.ac aclocal.m4 - $(AUTOCONF) - -.PHONY: autoheader -autoheader: configure.ac $(wildcard m4/*.m4) m4/ltp-version.m4 aclocal.m4 - $(AUTOHEADER) - -include: - mkdir -p "$@" - -m4/ltp-version.m4: VERSION - sed -n '1{s:LTP-:m4_define([LTP_VERSION],[:;s:$$:]):;p;q}' $< > $@ - -.PHONY: automake -AUTOMAKE_FILES := config.guess config.sub install-sh missing stamp-h1 -automake: aclocal $(AUTOMAKE_FILES) -$(AUTOMAKE_FILES): m4/Makefile.in -m4/Makefile.in: m4/Makefile.am aclocal.m4 - $(AUTOMAKE) -c -a - -.PHONY: ac-clean ac-distclean ac-maintainer-clean -ac-clean:: - $(RM) -rf autom4te.cache - $(RM) -f config.log config.status - $(RM) -f include/config.h include/stamp-h1 - $(RM) -f m4/Makefile m4/ltp-version.m4 - for d in $(AUTOCONFED_SUBDIRS); do \ - $(MAKE) -C "$(top_srcdir)/$$d" $@; \ - done - -ac-distclean:: ac-clean -ac-maintainer-clean:: ac-distclean - for d in $(AUTOCONFED_SUBDIRS); do \ - $(MAKE) -C "$(top_srcdir)/$$d" $@; \ - done - $(RM) -f aclocal.m4 configure $(AUTOMAKE_FILES) m4/Makefile.in - $(RM) -f include/*config.h.in - -# Don't include config.h, or make will (rightfully) whine about overriding -# rules. -# -# This list should match the files in configure.ac. -# -AUTOGENERATED_FILES = \ - include/mk/config.mk \ - include/mk/features.mk \ - lib/ltp.pc \ - m4/Makefile \ - execltp - -distclean:: %: clean ac-distclean - for d in $(AUTOCONFED_SUBDIRS); do \ - $(MAKE) -C "$(top_srcdir)/$$d" $@; \ - done - $(RM) -f $(AUTOGENERATED_FILES) - -maintainer-clean:: distclean ac-maintainer-clean - -$(AUTOGENERATED_FILES): $(top_builddir)/config.status - $(SHELL) $^ - -# This variable is automatically changed from help to all once someone has -# run configure, or the equivalent steps manually, as described in INSTALL. -$(abs_top_builddir)/include/mk/config.mk \ -$(abs_top_builddir)/include/mk/features.mk: - $(MAKE) -C $(top_srcdir) help; false diff --git a/fsstress/include/mk/config-openposix.mk b/fsstress/include/mk/config-openposix.mk deleted file mode 100644 index caf7656e17..0000000000 --- a/fsstress/include/mk/config-openposix.mk +++ /dev/null @@ -1,5 +0,0 @@ -# Parameters from the top level configure -CC= gcc -CFLAGS+= -g -O2 -LDLIBS+= -LDFLAGS+= diff --git a/fsstress/include/mk/config-openposix.mk.in b/fsstress/include/mk/config-openposix.mk.in deleted file mode 100644 index 9a91dcb7ee..0000000000 --- a/fsstress/include/mk/config-openposix.mk.in +++ /dev/null @@ -1,5 +0,0 @@ -# Parameters from the top level configure -CC= @CC@ -CFLAGS+= @CFLAGS@ -LDLIBS+= @LIBS@ -LDFLAGS+= @LDFLAGS@ diff --git a/fsstress/include/mk/config.mk b/fsstress/include/mk/config.mk deleted file mode 100644 index 55ecc68bb5..0000000000 --- a/fsstress/include/mk/config.mk +++ /dev/null @@ -1,85 +0,0 @@ -# -# config.mk.in. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# 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. -# -# Ngie Cooper, July 2009 -# - -# See this page for more info about LEX*: -# http://www.gnu.org/software/hello/manual/autoconf/Particular-Programs.html - -# Application specifying variables. You should never have to change these. -AR := ar -CC := gcc -LEX := flex -RANLIB := ranlib -STRIP := strip -YACC := bison -y - -AIO_LIBS := -CAP_LIBS := -ACL_LIBS := -CRYPTO_LIBS := -lcrypto -LEXLIB := -lfl -NUMA_LIBS := -SELINUX_LIBS := -HAVE_RPC := 1 -TIRPC_CFLAGS := -TIRPC_LIBS := -KEYUTILS_LIBS := -HAVE_FTS_H := 1 -LIBMNL_LIBS := -LIBMNL_CFLAGS := - -prefix := /opt/ltp - -datarootdir := ${prefix}/share -includedir := ${prefix}/include -exec_prefix := ${prefix} -bindir := ${exec_prefix}/bin -libdir := ${exec_prefix}/lib -mandir := ${datarootdir}/man - -CPPFLAGS := -CFLAGS := -g -O2 -LDLIBS := -LDFLAGS := - -DEBUG_CFLAGS ?= -g - -# for -fstrict-aliasing see doc/build-system-guide.txt -OPT_CFLAGS ?= -O2 -fno-strict-aliasing -pipe - -WCFLAGS ?= -Wall -W -Wold-style-definition - -LDFLAGS += $(WLDFLAGS) -CFLAGS += $(DEBUG_CFLAGS) $(OPT_CFLAGS) $(WCFLAGS) - -LINUX_VERSION := 4.13.0 -LINUX_DIR := /lib/modules/4.13.0/build -LINUX_VERSION_MAJOR := 4 -LINUX_VERSION_PATCH := 13 -WITH_MODULES := yes - -HOST_CPU := x86_64 - -ifeq ($(strip $(prefix)),) -$(error you are using $$(prefix) incorrectly -- set it to $(abs_top_srcdir) if you want to build in the source tree) -endif - -export datarootdir includedir libdir mandir prefix diff --git a/fsstress/include/mk/config.mk.in b/fsstress/include/mk/config.mk.in deleted file mode 100644 index 427608a17b..0000000000 --- a/fsstress/include/mk/config.mk.in +++ /dev/null @@ -1,85 +0,0 @@ -# -# config.mk.in. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# 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. -# -# Ngie Cooper, July 2009 -# - -# See this page for more info about LEX*: -# http://www.gnu.org/software/hello/manual/autoconf/Particular-Programs.html - -# Application specifying variables. You should never have to change these. -AR := @AR@ -CC := @CC@ -LEX := @LEX@ -RANLIB := @RANLIB@ -STRIP := @STRIP@ -YACC := @YACC@ - -AIO_LIBS := @AIO_LIBS@ -CAP_LIBS := @CAP_LIBS@ -ACL_LIBS := @ACL_LIBS@ -CRYPTO_LIBS := @CRYPTO_LIBS@ -LEXLIB := @LEXLIB@ -NUMA_LIBS := @NUMA_LIBS@ -SELINUX_LIBS := @SELINUX_LIBS@ -HAVE_RPC := @HAVE_RPC@ -TIRPC_CFLAGS := @TIRPC_CFLAGS@ -TIRPC_LIBS := @TIRPC_LIBS@ -KEYUTILS_LIBS := @KEYUTILS_LIBS@ -HAVE_FTS_H := @HAVE_FTS_H@ -LIBMNL_LIBS := @LIBMNL_LIBS@ -LIBMNL_CFLAGS := @LIBMNL_CFLAGS@ - -prefix := @prefix@ - -datarootdir := @datarootdir@ -includedir := @includedir@ -exec_prefix := @exec_prefix@ -bindir := @bindir@ -libdir := @libdir@ -mandir := @mandir@ - -CPPFLAGS := @CPPFLAGS@ -CFLAGS := @CFLAGS@ -LDLIBS := @LIBS@ -LDFLAGS := @LDFLAGS@ - -DEBUG_CFLAGS ?= -g - -# for -fstrict-aliasing see doc/build-system-guide.txt -OPT_CFLAGS ?= -O2 -fno-strict-aliasing -pipe - -WCFLAGS ?= -Wall -W @GCC_WARN_OLDSTYLE@ - -LDFLAGS += $(WLDFLAGS) -CFLAGS += $(DEBUG_CFLAGS) $(OPT_CFLAGS) $(WCFLAGS) - -LINUX_VERSION := @LINUX_VERSION@ -LINUX_DIR := @LINUX_DIR@ -LINUX_VERSION_MAJOR := @LINUX_VERSION_MAJOR@ -LINUX_VERSION_PATCH := @LINUX_VERSION_PATCH@ -WITH_MODULES := @WITH_MODULES@ - -HOST_CPU := @HOST_CPU@ - -ifeq ($(strip $(prefix)),) -$(error you are using $$(prefix) incorrectly -- set it to $(abs_top_srcdir) if you want to build in the source tree) -endif - -export datarootdir includedir libdir mandir prefix diff --git a/fsstress/include/mk/env_post.mk b/fsstress/include/mk/env_post.mk deleted file mode 100644 index f4169ad666..0000000000 --- a/fsstress/include/mk/env_post.mk +++ /dev/null @@ -1,110 +0,0 @@ -# -# Environment post-setup Makefile. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# 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. -# -# Ngie Cooper, July 2009 -# - -ENV_PRE_LOADED ?= $(error You must load env_pre.mk before including this file) - -include $(top_srcdir)/include/mk/functions.mk - -ifndef ENV_POST_LOADED -ENV_POST_LOADED = 1 - -# Default source search path. Modify as necessary, but I would call that -# poor software design if you need more than one search directory, and -# would suggest creating a general purpose static library to that end. -vpath %.c $(abs_srcdir) - -# For config.h, et all. -CPPFLAGS += -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_srcdir)/include/old/ - -LDFLAGS += -L$(top_builddir)/lib - -ifeq ($(UCLINUX),1) -CPPFLAGS += -D__UCLIBC__ -DUCLINUX -endif - -ifeq ($(ANDROID),1) -LDFLAGS += -L$(top_builddir)/lib/android_libpthread -LDFLAGS += -L$(top_builddir)/lib/android_librt -endif - -MAKE_TARGETS ?= $(notdir $(patsubst %.c,%,$(wildcard $(abs_srcdir)/*.c))) - -MAKE_TARGETS := $(filter-out $(FILTER_OUT_MAKE_TARGETS),$(MAKE_TARGETS)) - -# with only *.dwo, .[0-9]+.dwo can not be cleaned -CLEAN_TARGETS += $(MAKE_TARGETS) *.o *.pyc .cache.mk *.dwo .*.dwo - -# Majority of the files end up in testcases/bin... -INSTALL_DIR ?= testcases/bin - -ifneq ($(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS)) - -ifeq ($(strip $(INSTALL_DIR)),) -INSTALL_DIR := $(error You must define INSTALL_DIR before including this file) -endif - -ifneq ($(strip $(prefix)),) -# Value specified by INSTALL_DIR isn't an absolute path, so let's tack on $(prefix). -ifneq ($(patsubst /%,,$(INSTALL_DIR)),) -INSTALL_DIR := $(prefix)/$(INSTALL_DIR) -endif - -# Glob any possible expressions, but make sure to zap the $(abs_srcdir) -# reference at the start of the filename instead of using $(notdir), so that -# way we don't accidentally nuke the relative path from $(abs_srcdir) that -# may have been set in the Makefile. -INSTALL_TARGETS := $(wildcard $(addprefix $(abs_srcdir)/,$(INSTALL_TARGETS))) -INSTALL_TARGETS := $(patsubst $(abs_srcdir)/%,%,$(INSTALL_TARGETS)) - -# The large majority of the files that we install are going to be apps and -# scripts, so let's chmod them like that. -INSTALL_MODE ?= 00775 - -ifdef MAKE_3_80_COMPAT - -INSTALL_PATH := $(call MAKE_3_80_abspath,$(DESTDIR)/$(INSTALL_DIR)) - -INSTALL_TARGETS_ABS := $(call MAKE_3_80_abspath,$(addprefix $(INSTALL_PATH)/,$(INSTALL_TARGETS))) -MAKE_TARGETS_ABS := $(call MAKE_3_80_abspath,$(addprefix $(INSTALL_PATH)/,$(MAKE_TARGETS))) - -INSTALL_FILES := $(INSTALL_TARGETS_ABS) $(MAKE_TARGETS_ABS) - -$(INSTALL_TARGETS_ABS): - test -d "$(@D)" || mkdir -p "$(@D)" - install -m $(INSTALL_MODE) "$(abs_srcdir)/$(subst $(INSTALL_PATH)/,,$@)" "$@" - -$(MAKE_TARGETS_ABS): - test -d "$(@D)" || mkdir -p "$(@D)" - install -m $(INSTALL_MODE) "$(abs_builddir)/$(subst $(INSTALL_PATH)/,,$@)" "$@" -else -$(abspath $(addprefix $(DESTDIR)/$(INSTALL_DIR)/,$(sort $(dir $(INSTALL_TARGETS) $(MAKE_TARGETS))))): - mkdir -p "$@" -$(foreach install_target,$(INSTALL_TARGETS),$(eval $(call generate_install_rule,$(install_target),$(abs_srcdir),$(INSTALL_DIR)))) -$(foreach make_target,$(MAKE_TARGETS),$(eval $(call generate_install_rule,$(make_target),$(abs_builddir),$(INSTALL_DIR)))) -endif - -else # else ! $(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS) -$(error You must define $$(prefix) before executing install) -endif # END $(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS) -endif - -endif diff --git a/fsstress/include/mk/env_pre.mk b/fsstress/include/mk/env_pre.mk deleted file mode 100644 index c4a1f47081..0000000000 --- a/fsstress/include/mk/env_pre.mk +++ /dev/null @@ -1,155 +0,0 @@ -# -# Make pre-include environment Makefile. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# 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. -# -# Ngie Cooper, September 2009 -# -# This Makefile must be included first. NO IF'S, AND'S, OR BUT'S. -# -# This sets the stage for all operations required within Makefiles. -# - -ifndef ENV_PRE_LOADED -ENV_PRE_LOADED = 1 - -# "out-of-build-tree" build. -BUILD_TREE_BUILDDIR_INSTALL := 1 -# "in-srcdir" build / install. -BUILD_TREE_SRCDIR_INSTALL := 2 -# "in-srcdir" build, non-srcdir install. -BUILD_TREE_NONSRCDIR_INSTALL := 3 -# configure not run. -BUILD_TREE_UNCONFIGURED := 4 - -ifndef MAKE_VERSION_CHECK -export MAKE_VERSION_CHECK = 1 -ifneq ($(firstword $(sort 3.80 $(MAKE_VERSION))),3.80) -$(error Your version of make $(MAKE_VERSION) is too old. Upgrade to at least 3.80; 3.81+ is preferred) -else -ifneq ($(filter 3.80%,$(MAKE_VERSION)),) -export MAKE_3_80_COMPAT := 1 -endif # make 3.80? -endif # At least make 3.80? -endif # MAKE_VERSION_CHECK - -# Get the absolute path for the source directory. -top_srcdir ?= $(error You must define top_srcdir before including this file) - -include $(top_srcdir)/include/mk/functions.mk - -# Where's the root source directory? -ifdef MAKE_3_80_COMPAT -abs_top_srcdir := $(call MAKE_3_80_abspath,$(top_srcdir)) -else -abs_top_srcdir := $(abspath $(top_srcdir)) -endif - -# -# Where's the root object directory? -# -# Just in case it's not specified, set it to the top srcdir (because the user -# must not have wanted out of build tree support)... -# -top_builddir ?= $(top_srcdir) - -# We need the absolute path... -ifdef MAKE_3_80_COMPAT -abs_top_builddir := $(call MAKE_3_80_abspath,$(top_builddir)) -else -abs_top_builddir := $(abspath $(top_builddir)) -endif - -# Where's the root object directory? -builddir := . - -abs_builddir := $(CURDIR) - -cwd_rel_from_top := $(subst $(abs_top_builddir),,$(abs_builddir)) - -# Where's the source located at? Squish all of the / away by using abspath... -ifdef MAKE_3_80_COMPAT -abs_srcdir := $(call MAKE_3_80_abspath,$(abs_top_srcdir)/$(cwd_rel_from_top)) -else -abs_srcdir := $(abspath $(abs_top_srcdir)/$(cwd_rel_from_top)) -endif - -srcdir := $(strip $(subst $(abs_top_srcdir)/,,$(abs_srcdir))) - -ifeq ($(srcdir),) -srcdir := . -endif - -# If config.mk or features.mk doesn't exist it's not an error for some targets -# which are filtered below (e.g. clean). However these config files may be -# needed for those targets (eg. the open posix testsuite is not cleaned even if -# it's enabled by configure) thus it would be wise to do silent inclusion. -ifneq ("$(wildcard $(abs_top_builddir)/include/mk/config.mk)","") -include $(abs_top_builddir)/include/mk/config.mk -endif -ifneq ("$(wildcard $(abs_top_builddir)/include/mk/features.mk)","") -include $(abs_top_builddir)/include/mk/features.mk -endif - -# autotools, *clean, and help don't require config.mk, features.mk, etc... -ifeq ($(filter autotools %clean .gitignore gitignore.% help,$(MAKECMDGOALS)),) - -include $(abs_top_builddir)/include/mk/config.mk -include $(abs_top_builddir)/include/mk/features.mk - -# START out-of-build-tree check. -ifneq ($(abs_builddir),$(abs_srcdir)) -BUILD_TREE_STATE := $(BUILD_TREE_BUILDDIR_INSTALL) -else -# Else, not out of build tree.. - -# START srcdir build-tree install checks -ifeq ($(strip $(DESTDIR)$(prefix)),) -BUILD_TREE_STATE := $(BUILD_TREE_SRCDIR_INSTALL) -else # Empty $(DESTDIR)$(prefix) -ifeq ($(abs_top_srcdir),$(prefix)) -BUILD_TREE_STATE := $(BUILD_TREE_SRCDIR_INSTALL) -endif -# END srcdir build-tree install checks -endif -# END out-of-build-tree check. -endif - -# Is the build-tree configured yet? -ifeq ($(BUILD_TREE_STATE),) -ifneq ($(wildcard $(abs_top_builddir)/include/mk/config.mk),) -BUILD_TREE_STATE := $(BUILD_TREE_NONSRCDIR_INSTALL) -endif -endif - -ifeq ($(MAKE_3_80_COMPAT),1) -# Trick make 3.80 into thinking that the default goal is all. -.PHONY: default -default: all -else -.DEFAULT_GOAL := all -endif - -endif # END autotools, *clean... - -BUILD_TREE_STATE ?= $(BUILD_TREE_UNCONFIGURED) - -# We can piece together where we're located in the source and object trees with -# just these two vars and $(CURDIR). -export abs_top_srcdir abs_top_builddir BUILD_TREE_STATE - -endif diff --git a/fsstress/include/mk/features.mk b/fsstress/include/mk/features.mk deleted file mode 100644 index cf740c56d8..0000000000 --- a/fsstress/include/mk/features.mk +++ /dev/null @@ -1,49 +0,0 @@ -# -# features.mk.in - feature tuning include Makefile. -# -# Copyright (C) 2010, Linux Test Project. -# -# 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. -# -# Ngie Cooper, October 2010 -# - -# Tools enable knobs -WITH_EXPECT := no - -WITH_PERL := no - -WITH_PYTHON := no - -# Features knobs - -# Test suite knobs - -# Enable testcases/kernel/power_management's compile and install? -ifeq ($(UCLINUX),1) -WITH_POWER_MANAGEMENT_TESTSUITE := no -else -WITH_POWER_MANAGEMENT_TESTSUITE := yes -endif - -# Enable testcases/open_posix_testsuite's compile and install? -WITH_OPEN_POSIX_TESTSUITE := no - -# Enable testcases/realtime's compile and install? -ifeq ($(UCLINUX),1) -WITH_REALTIME_TESTSUITE := no -else -WITH_REALTIME_TESTSUITE := no -endif diff --git a/fsstress/include/mk/features.mk.in b/fsstress/include/mk/features.mk.in deleted file mode 100644 index 8e561b7384..0000000000 --- a/fsstress/include/mk/features.mk.in +++ /dev/null @@ -1,49 +0,0 @@ -# -# features.mk.in - feature tuning include Makefile. -# -# Copyright (C) 2010, Linux Test Project. -# -# 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. -# -# Ngie Cooper, October 2010 -# - -# Tools enable knobs -WITH_EXPECT := @WITH_EXPECT@ - -WITH_PERL := @WITH_PERL@ - -WITH_PYTHON := @WITH_PYTHON@ - -# Features knobs - -# Test suite knobs - -# Enable testcases/kernel/power_management's compile and install? -ifeq ($(UCLINUX),1) -WITH_POWER_MANAGEMENT_TESTSUITE := no -else -WITH_POWER_MANAGEMENT_TESTSUITE := yes -endif - -# Enable testcases/open_posix_testsuite's compile and install? -WITH_OPEN_POSIX_TESTSUITE := @WITH_OPEN_POSIX_TESTSUITE@ - -# Enable testcases/realtime's compile and install? -ifeq ($(UCLINUX),1) -WITH_REALTIME_TESTSUITE := no -else -WITH_REALTIME_TESTSUITE := @WITH_REALTIME_TESTSUITE@ -endif diff --git a/fsstress/include/mk/functions.mk b/fsstress/include/mk/functions.mk deleted file mode 100644 index 6f67b5af8c..0000000000 --- a/fsstress/include/mk/functions.mk +++ /dev/null @@ -1,76 +0,0 @@ -# -# A Makefile with a collection of reusable functions. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# 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. -# -# Ngie Cooper, July 2009 -# - -SQUOTE := ' - -# ' # to keep colorized editors from going nuts - -MAKE_3_80_realpath = $(shell $(top_srcdir)/scripts/realpath.sh '$(subst $(SQUOTE),\\$(SQUOTE),$(1))') - -MAKE_3_80_abspath = $(shell $(top_srcdir)/scripts/abspath.sh '$(subst $(SQUOTE),\\$(SQUOTE),$(1))') - -# -# NOTE (garrcoop): -# -# The following functions are (sometimes) split into 3.80 and 3.81+ -# counterparts, and not conditionalized inside of the define(s) to work around -# an issue with how make 3.80 evaluates defines. -# -# SO DO NOT INTERNALIZE CONDITIONALS IN DEFINES OR YOU WILL BREAK MAKE 3.80! -# - -# -# Generate an install rule which also creates the install directory if needed -# to avoid unnecessary bourne shell based for-loops and install errors, as well -# as adhoc install rules. -# -# 1 -> Target basename. -# 2 -> Source directory. -# 3 -> Destination directory. -# -ifdef MAKE_3_80_COMPAT -define generate_install_rule - -INSTALL_FILES += $$(call MAKE_3_80_abspath,$$(DESTDIR)/$(3)/$(1)) - -$$(call MAKE_3_80_abspath,$$(DESTDIR)/$(3)/$(1)): \ - $$(call MAKE_3_80_abspath,$$(dir $$(DESTDIR)/$(3)/$(1))) - install -m $$(INSTALL_MODE) "$(2)/$(1)" "$$@" -endef -else # not MAKE_3_80_COMPAT -define generate_install_rule - -INSTALL_FILES += $$(abspath $$(DESTDIR)/$(3)/$(1)) - -$$(abspath $$(DESTDIR)/$(3)/$(1)): \ - $$(abspath $$(dir $$(DESTDIR)/$(3)/$(1))) - install -m $$(INSTALL_MODE) "$(2)/$(1)" "$$@" -endef -endif # END MAKE_3_80_COMPAT - -# -# Set SUBDIRS to the subdirectories where Makefiles were found. -# -define get_make_dirs -SUBDIRS ?= $$(subst $$(abs_srcdir)/,,$$(patsubst %/Makefile,%,$$(wildcard $$(abs_srcdir)/*/Makefile))) -SUBDIRS := $$(filter-out $$(FILTER_OUT_DIRS),$$(SUBDIRS)) -endef diff --git a/fsstress/include/mk/generic_leaf_target.inc b/fsstress/include/mk/generic_leaf_target.inc deleted file mode 100644 index dd54d05e96..0000000000 --- a/fsstress/include/mk/generic_leaf_target.inc +++ /dev/null @@ -1,106 +0,0 @@ -# -# Generic leaf rules include Makefile. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# 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. -# -# Ngie Cooper, July 2009 -# - -# -# generic_leaf_target -# -# Generate a set of basic targets (all, clean, install) for a leaf directory -# (no subdirectories). -# -# $(MAKE_DEPS) : What should we execute beforehand as a -# dependency of $(MAKE_TARGETS)? -# -# $(INSTALL_FILES) -> install -# -# Helpful variables are: -# -# $(MAKE_TARGETS) : What to execute as direct dependencies of -# all. -# 1. Defaults to the basename of the targets -# produced by the %.c -> % implicit pattern -# rules, e.g. the MAKE_TARGET in a directory -# like the following: -# -# $$ ls /bar -# foo.c -# -# Would be `foo'. Similarly, the following -# dir structure: -# -# $$ ls /bar -# foo.c zanzibar.c -# -# Would be `foo zanzibar'. -# -# 2. If you define MAKE_TARGETS as an empty -# string, this will override the defaults. -# I did this to avoid providing too much -# rope to hang one's self in the event of -# unwanted behavior. -# -# $(CLEAN_TARGETS) : What targets should be cleaned (must be -# real files). This will automatically append -# adds the .o suffix to all files referenced -# by $(MAKE_TARGETS)) to CLEAN_TARGETS, if -# MAKE_TARGETS wasn't defined (see -# $(MAKE_TARGETS)). -# $(INSTALL_MODE) : What mode should we using when calling -# install(1)? -# -# Also, if you wish to change the installation directory, from the set default -# (testcases/bin) you must do something like either one of the following items: -# -# Method A: -# -# INSTALL_DIR := /path/to/installdir/from/$(DESTDIR)/$(prefix) -# -# e.g. if I wanted to install my binaries in testcases/bin, I would do: -# -# INSTALL_DIR := testcases/bin -# -# in my calling Makefile. -# -# Or Method B: -# -# INSTALL_DIR := /path/to/installdir/from/$(DESTDIR) -# -# e.g. if I wanted to install my binaries in $(libdir) (which may not exist -# outside of $(prefix) right now, but could in the future), I could do the -# following: -# -# INSTALL_DIR := $(libdir) -# - -.PHONY: all clean install - -$(MAKE_TARGETS): | $(MAKE_DEPS) - -all: $(MAKE_TARGETS) - -clean:: $(CLEAN_DEPS) - -$(RM) -f $(CLEAN_TARGETS) - -$(INSTALL_FILES): | $(INSTALL_DEPS) - -install: $(INSTALL_FILES) - -# vim: syntax=make diff --git a/fsstress/include/mk/generic_leaf_target.mk b/fsstress/include/mk/generic_leaf_target.mk deleted file mode 100644 index 908d0b0004..0000000000 --- a/fsstress/include/mk/generic_leaf_target.mk +++ /dev/null @@ -1,24 +0,0 @@ -# -# Generic leaf include Makefile. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# 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. -# -# Ngie Cooper, July 2009 -# - -include $(top_srcdir)/include/mk/env_post.mk -include $(top_srcdir)/include/mk/generic_leaf_target.inc diff --git a/fsstress/include/mk/generic_trunk_target.inc b/fsstress/include/mk/generic_trunk_target.inc deleted file mode 100644 index cc255c62a8..0000000000 --- a/fsstress/include/mk/generic_trunk_target.inc +++ /dev/null @@ -1,98 +0,0 @@ -# -# Generic trunk rules include Makefile. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# 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. -# -# Ngie Cooper, July 2009 -# - -# -# generic_trunk_target -# -# Generate a set of recursive targets to apply over a trunk directory (has -# directories) -- optionally with a set of trunk-based files. -# -# All variables in this canned define are essentially the same as -# generic_leaf_target, with the exception that the install flow for local -# targets is: -# -# $(INSTALL_FILES) -> trunk-install -> install (recursive) -# -# All recursive targets are traverse SUBDIRS as defined by the user, or if -# undefined, defaults to any subdirectories where Makefile's are contained -# within. -# -# generic_trunk_target specific variables are: -# -# RECURSIVE_TARGETS : a list of targets to apply over an entire -# directory tree. This defaults to -# `all install'. -# -# See generic_leaf_target, generic_target_env_setup, and get_make_dirs for -# more details and design notes. -# - -include $(top_srcdir)/include/mk/functions.mk - -RECURSIVE_TARGETS ?= all install - -$(eval $(get_make_dirs)) - -.PHONY: $(RECURSIVE_TARGETS) $(addprefix trunk-,$(RECURSIVE_TARGETS)) - -$(SUBDIRS): %: - mkdir -m 00755 -p "$@" - -$(MAKE_TARGETS): | $(MAKE_DEPS) - -trunk-all: $(MAKE_TARGETS) - -trunk-clean:: | $(SUBDIRS) - $(if $(strip $(CLEAN_TARGETS)),$(RM) -f $(CLEAN_TARGETS)) - -$(INSTALL_FILES): | $(INSTALL_DEPS) - -trunk-install: $(INSTALL_FILES) - -# Avoid creating duplicate .PHONY references to all, clean, and install. IIRC, -# I've seen some indeterministic behavior when one does this in the past with -# GNU Make... -.PHONY: $(filter-out $(RECURSIVE_TARGETS),all clean install) -all: trunk-all - -clean:: trunk-clean - @set -e; for dir in $(SUBDIRS); do \ - $(MAKE) -C "$$dir" -f "$(abs_srcdir)/$$dir/Makefile" $@; \ - done -ifneq ($(abs_builddir),$(abs_srcdir)) - $(RM) -Rf $(SUBDIRS) -endif - -install: trunk-install - -# Print out CURDIR to check for a recursion issue. -ifeq ($(strip $(SUBDIRS)),) - $(warning CURDIR is: $(CURDIR)) - $(error SUBDIRS empty -- did you want generic_leaf_target instead?) -else -$(RECURSIVE_TARGETS): %: | $(SUBDIRS) - @set -e; for dir in $(SUBDIRS); do \ - $(MAKE) -C $$dir -f "$(abs_srcdir)/$$dir/Makefile" $@; \ - done -endif - -# vim: syntax=make diff --git a/fsstress/include/mk/generic_trunk_target.mk b/fsstress/include/mk/generic_trunk_target.mk deleted file mode 100644 index 576b32db39..0000000000 --- a/fsstress/include/mk/generic_trunk_target.mk +++ /dev/null @@ -1,24 +0,0 @@ -# -# Generic trunk include Makefile. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# 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. -# -# Ngie Cooper, July 2009 -# - -include $(top_srcdir)/include/mk/env_post.mk -include $(top_srcdir)/include/mk/generic_trunk_target.inc diff --git a/fsstress/include/mk/gitignore.mk b/fsstress/include/mk/gitignore.mk deleted file mode 100644 index 475206dcd2..0000000000 --- a/fsstress/include/mk/gitignore.mk +++ /dev/null @@ -1,51 +0,0 @@ -# -# gitignore generation include Makefile. -# -# Copyright (C) 2011, Linux Test Project. -# -# 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. -# -# Ngie Cooper, January 2011 -# - -CLEAN_TARGETS+= gitignore_clean - -BEFORE:= .gitignore-before - -AFTER:= .gitignore-after - -IGNORE_DIR_EXPR:= egrep -v "^$$(echo "$(AUTOCONFED_SUBDIRS)" | tr " " "|")" - -# NOTE: The underscore is used in place of a dash to avoid implicit rule -# evaluation in top-level Makefile. -.PHONY: gitignore_clean -gitignore_clean: - $(RM) -f $(BEFORE) $(AFTER) - -$(BEFORE): - $(MAKE) distclean - $(MAKE) ac-maintainer-clean - find . | $(IGNORE_DIR_EXPR) > $@ - -$(AFTER): - $(MAKE) autotools - ./configure --prefix=/dev/null - $(MAKE) all - find . | $(IGNORE_DIR_EXPR) > $@ - # Set everything in autoconf land back to a sane state. - $(MAKE) distclean - -.gitignore: | $(BEFORE) $(AFTER) - diff -u $(BEFORE) $(AFTER) | grep '^+' | sed -e 's,^\+,,g' > $@ diff --git a/fsstress/include/mk/lib.mk b/fsstress/include/mk/lib.mk deleted file mode 100644 index 36e1ba17b1..0000000000 --- a/fsstress/include/mk/lib.mk +++ /dev/null @@ -1,73 +0,0 @@ -# -# library include Makefile. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# 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. -# -# Ngie Cooper, July 2009 -# -# Copyright (C) Cyril Hrubis 2012 -# - -# Makefile to include for libraries. - -include $(top_srcdir)/include/mk/env_pre.mk - -INSTALL_DIR := $(libdir) - -# An extension of generic_leaf_target, strictly for libraries. -.PHONY: install_headers - -ifndef LIB -ifndef INTERNAL_LIB -$(error You must define LIB or INTERNAL_LIB when including this Makefile) -endif -endif - -install_headers: $(addprefix $(DESTDIR)/$(includedir)/,$(notdir $(HEADER_FILES))) - -INSTALL_MODE ?= 00664 - -# Hide the LIB target for internal libs on install -ifneq ($(MAKECMDGOALS),install) -LIB ?= $(INTERNAL_LIB) -endif - -MAKE_TARGETS += $(LIB) - -LIBSRCS ?= $(wildcard $(abs_srcdir)/*.c) - -ifdef MAKE_3_80_COMPAT -LIBSRCS := $(call MAKE_3_80_abspath,$(LIBSRCS)) -else -LIBSRCS := $(abspath $(LIBSRCS)) -endif - -LIBSRCS := $(subst $(abs_srcdir)/,,$(wildcard $(LIBSRCS))) - -LIBSRCS := $(filter-out $(FILTER_OUT_LIBSRCS),$(LIBSRCS)) - -LIBOBJS := $(LIBSRCS:.c=.o) - -$(LIB): $(notdir $(LIBOBJS)) - if [ -z "$(strip $^)" ] ; then \ - echo "Cowardly refusing to create empty archive"; \ - exit 1; \ - fi - $(if $(AR),$(AR),ar) -rc "$@" $^ - $(if $(RANLIB),$(RANLIB),ranlib) "$@" - -include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/fsstress/include/mk/man.mk b/fsstress/include/mk/man.mk deleted file mode 100644 index c94af61b11..0000000000 --- a/fsstress/include/mk/man.mk +++ /dev/null @@ -1,37 +0,0 @@ -# -# Manpage include Makefile. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# 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. -# -# Ngie Cooper, July 2009 -# - -ifeq ($(strip $(MANPREFIX)),) -$(error $$(MANPREFIX) not defined) -endif - -include $(top_srcdir)/include/mk/env_pre.mk - -INSTALL_DIR := $(mandir)/man$(MANPREFIX) - -INSTALL_MODE := 00644 - -INSTALL_TARGETS ?= *.$(MANPREFIX) - -MAKE_TARGETS := - -include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/fsstress/include/mk/module.mk b/fsstress/include/mk/module.mk deleted file mode 100644 index 07d8fa89ef..0000000000 --- a/fsstress/include/mk/module.mk +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved. -# -# 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 would 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 the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# Author: Alexey Kodanev -# -# Include it to build kernel modules. -# REQ_VERSION_MAJOR and REQ_VERSION_PATCH must be defined beforehand. -# - -$(if $(REQ_VERSION_MAJOR),,$(error You must define REQ_VERSION_MAJOR)) -$(if $(REQ_VERSION_PATCH),,$(error You must define REQ_VERSION_MINOR)) - -ifeq ($(WITH_MODULES),no) -SKIP := 1 -else -ifeq ($(LINUX_VERSION_MAJOR)$(LINUX_VERSION_PATCH),) -SKIP := 1 -else -SKIP ?= $(shell \ - [ "$(LINUX_VERSION_MAJOR)" -gt "$(REQ_VERSION_MAJOR)" ] || \ - [ "$(LINUX_VERSION_MAJOR)" -eq "$(REQ_VERSION_MAJOR)" -a \ - "$(LINUX_VERSION_PATCH)" -ge "$(REQ_VERSION_PATCH)" ]; echo $$?) -endif -endif - -ifneq ($(SKIP),0) -MAKE_TARGETS := $(filter-out %.ko, $(MAKE_TARGETS)) -endif - -ifneq ($(filter install clean,$(MAKECMDGOALS)),) -MAKE_TARGETS := $(filter-out %.ko, $(MAKE_TARGETS)) -MAKE_TARGETS += $(wildcard *.ko) -endif - -CLEAN_TARGETS += .dep_modules - -MODULE_SOURCES := $(patsubst %.ko,%.c,$(filter %.ko, $(MAKE_TARGETS))) - -# Ignoring the exit status of commands is done to be forward compatible with -# kernel internal API changes. The user-space test will return TCONF, if it -# doesn't find the module (i.e. it wasn't built either due to kernel-devel -# missing or module build failure). -%.ko: %.c .dep_modules ; - -.dep_modules: $(MODULE_SOURCES) - @echo "Building modules: $(MODULE_SOURCES)" - -$(MAKE) -C $(LINUX_DIR) M=$(abs_srcdir) - rm -rf *.mod.c *.o *.ko.unsigned modules.order .tmp* .*.ko .*.cmd Module.symvers - @touch .dep_modules diff --git a/fsstress/include/mk/testcases.mk b/fsstress/include/mk/testcases.mk deleted file mode 100644 index bb22be82eb..0000000000 --- a/fsstress/include/mk/testcases.mk +++ /dev/null @@ -1,63 +0,0 @@ -# -# testcases include Makefile. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# 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. -# -# Ngie Cooper, July 2009 -# - -include $(top_srcdir)/include/mk/env_pre.mk -include $(top_srcdir)/include/mk/functions.mk - -APICMDS_DIR := $(abs_top_builddir)/tools/apicmds - -LIBLTP_DIR := $(abs_top_builddir)/lib - -LIBLTP := $(LIBLTP_DIR)/libltp.a - -$(APICMDS_DIR)/tst_kvercmp: $(APICMDS_DIR) - $(MAKE) -C "$^" -f "$(abs_top_srcdir)/tools/apicmds/Makefile" all - -$(LIBLTP): $(LIBLTP_DIR) - $(MAKE) -C "$^" -f "$(abs_top_srcdir)/lib/Makefile" all - -MAKE_DEPS := $(LIBLTP) - -INSTALL_DIR := testcases/bin - -LDLIBS += -lltp - -ifdef LTPLIBS - -LTPLIBS_DIRS = $(addprefix $(abs_top_builddir)/libs/lib, $(LTPLIBS)) -LTPLIBS_FILES = $(addsuffix .a, $(addprefix $(abs_top_builddir)/libs/, $(foreach LIB,$(LTPLIBS),lib$(LIB)/lib$(LIB)))) - -MAKE_DEPS += $(LTPLIBS_FILES) - -.PHONY: $(LTPLIBS_FILES) - -$(LTPLIBS_FILES): $(LTPLIBS_DIRS) - -$(LTPLIBS_FILES): %: - $(MAKE) -C "$(dir $@)" -f "$(subst $(abs_top_builddir),$(abs_top_srcdir),$(dir $@))/Makefile" all - -LDFLAGS += $(addprefix -L$(top_builddir)/libs/lib, $(LTPLIBS)) - -endif - -$(LTPLIBS_DIRS) $(APICMDS_DIR) $(LIBLTP_DIR): %: - mkdir -p "$@" diff --git a/fsstress/include/old/cleanup.c b/fsstress/include/old/cleanup.c deleted file mode 100644 index 040dff8523..0000000000 --- a/fsstress/include/old/cleanup.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Default cleanup logic because linux_syscall_numbers.h's need for cleanup - * and binutils bugs suck. - * - * Copyright (c) 2009 Cisco Systems, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#ifndef __CLEANUP_C__ -#define __CLEANUP_C__ - -/* Did the user define a cleanup function? */ -#ifndef CLEANUP -#define USING_DUMMY_CLEANUP 1 -#define CLEANUP dummy_cleanup -#endif - -/* A freebie for defining the function prototype. */ -static void CLEANUP(void) __attribute__ ((unused)); - -#ifdef USING_DUMMY_CLEANUP -/* The stub function. Wewt.. */ -static void dummy_cleanup(void) -{ -} -#endif - -#endif diff --git a/fsstress/include/old/ltp_cpuid.h b/fsstress/include/old/ltp_cpuid.h deleted file mode 100644 index 6bd553708b..0000000000 --- a/fsstress/include/old/ltp_cpuid.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2012-2013 The Chromium OS Authors. All rights reserved. - * - * Licensed under the BSD 3-clause. - */ - -#ifndef __LTP_CPUID_H__ -#define __LTP_CPUID_H__ - -static inline void cpuid(unsigned int info, unsigned int *eax, unsigned int *ebx, - unsigned int *ecx, unsigned int *edx) -{ -#if defined(__i386__) || defined(__x86_64__) - unsigned int _eax = info, _ebx, _ecx, _edx; - asm volatile( -# ifdef __i386__ - "xchg %%ebx, %%esi;" /* save ebx (for PIC) */ - "cpuid;" - "xchg %%esi, %%ebx;" /* restore ebx & pass to caller */ - : "=S" (_ebx), -# else - "cpuid;" - : "=b" (_ebx), -# endif - "+a" (_eax), "=c" (_ecx), "=d" (_edx) - : /* inputs: eax is handled above */ - ); - if (eax) *eax = _eax; - if (ebx) *ebx = _ebx; - if (ecx) *ecx = _ecx; - if (edx) *edx = _edx; -#endif -} - -#endif diff --git a/fsstress/include/old/ltp_priv.h b/fsstress/include/old/ltp_priv.h deleted file mode 100644 index 0552457e59..0000000000 --- a/fsstress/include/old/ltp_priv.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2013 Cyril Hrubis chrubis@suse.cz - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - */ - -#ifndef __LTP_PRIV_H__ -#define __LTP_PRIV_H__ - -#include - -/* - * This is the default temporary directory used by tst_tmpdir(). - * - * This is used when TMPDIR env variable is not set. - */ -#define TEMPDIR "/tmp" - -/* - * Default filesystem to be used for tests. - */ -#define DEFAULT_FS_TYPE "ext2" - -/* environment variables for controlling tst_res verbosity */ -#define TOUT_VERBOSE_S "VERBOSE" /* All test cases reported */ -#define TOUT_NOPASS_S "NOPASS" /* No pass test cases are reported */ -#define TOUT_DISCARD_S "DISCARD" /* No output is reported */ - -#define USC_ITERATION_ENV "USC_ITERATIONS" -#define USC_LOOP_WALLTIME "USC_LOOP_WALLTIME" -#define USC_NO_FUNC_CHECK "USC_NO_FUNC_CHECK" -#define USC_LOOP_DELAY "USC_LOOP_DELAY" - -const char *parse_opts(int ac, char **av, const option_t *user_optarr, void - (*uhf)(void)); - -/* Interface for rerouting to new lib calls from tst_res.c */ -extern void *tst_test; - -void tst_vbrk_(const char *file, const int lineno, int ttype, - const char *fmt, va_list va) __attribute__((noreturn)); - -void tst_brk_(const char *file, const int lineno, int ttype, - const char *msg, ...); - -void tst_vres_(const char *file, const int lineno, int ttype, - const char *fmt, va_list va); - -void tst_res_(const char *file, const int lineno, int ttype, - const char *msg, ...); - - -#define NO_NEWLIB_ASSERT(file, lineno) \ - if (tst_test) { \ - tst_brk_(file, lineno, TBROK, \ - "%s() executed from newlib!", __FUNCTION__); \ - } - -#endif /* __LTP_PRIV_H__ */ diff --git a/fsstress/include/old/ltp_signal.h b/fsstress/include/old/ltp_signal.h deleted file mode 100644 index 02ee8349a8..0000000000 --- a/fsstress/include/old/ltp_signal.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2009 Cisco Systems, Inc. All Rights Reserved. - * Copyright (c) 2009 FUJITSU LIMITED. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Author: Liu Bo - * Author: Ngie Cooper - * - */ - -#ifndef __LTP_SIGNAL_H -#define __LTP_SIGNAL_H - -#include -#include -#include -#include "config.h" - -/* - * For all but __mips__: - * - * _COMPAT_NSIG / _COMPAT_NSIG_BPW == 2. - * - * For __mips__: - * - * _COMPAT_NSIG / _COMPAT_NSIG_BPW == 4. - * - * See asm/compat.h under the kernel source for more details. - * - * Multiply that by a fudge factor of 4 and you have your SIGSETSIZE. - */ -#if defined __mips__ -#define SIGSETSIZE 16 -#else -#define SIGSETSIZE (_NSIG / 8) -#endif - -#endif diff --git a/fsstress/include/old/old_checkpoint.h b/fsstress/include/old/old_checkpoint.h deleted file mode 100644 index c8ffc92da7..0000000000 --- a/fsstress/include/old/old_checkpoint.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2015-2016 Cyril Hrubis - * - * 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, see . - */ - - /* - - Checkpoint - easy to use parent-child synchronization. - - Checkpoint is based on futexes (man futex). The library allocates a page of - shared memory for futexes and the id is an offset to it which gives the user - up to page_size/sizeof(uint32_t) checkpoint pairs. Up to INT_MAX processes - can sleep on single id and can be woken up by single wake. - - */ - -#ifndef OLD_CHECKPOINT__ -#define OLD_CHECKPOINT__ - -#include "test.h" -#include "tst_checkpoint_fn.h" - -/* - * Checkpoint initializaton, must be done first. - * - * NOTE: tst_tmpdir() must be called beforehand. - */ -#define TST_CHECKPOINT_INIT(cleanup_fn) \ - tst_checkpoint_init(__FILE__, __LINE__, cleanup_fn) - -#define TST_SAFE_CHECKPOINT_WAIT(cleanup_fn, id) \ - tst_safe_checkpoint_wait(__FILE__, __LINE__, cleanup_fn, id, 0); - -#define TST_SAFE_CHECKPOINT_WAIT2(cleanup_fn, id, msec_timeout) \ - tst_safe_checkpoint_wait(__FILE__, __LINE__, cleanup_fn, id, msec_timeout); - -#define TST_SAFE_CHECKPOINT_WAKE(cleanup_fn, id) \ - tst_safe_checkpoint_wake(__FILE__, __LINE__, cleanup_fn, id, 1); - -#define TST_SAFE_CHECKPOINT_WAKE2(cleanup_fn, id, nr_wake) \ - tst_safe_checkpoint_wake(__FILE__, __LINE__, cleanup_fn, id, nr_wake); - -#define TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(cleanup_fn, id) \ - tst_safe_checkpoint_wake(__FILE__, __LINE__, cleanup_fn, id, 1); \ - tst_safe_checkpoint_wait(__FILE__, __LINE__, cleanup_fn, id, 0); - -#endif /* OLD_CHECKPOINT__ */ diff --git a/fsstress/include/old/old_device.h b/fsstress/include/old/old_device.h deleted file mode 100644 index a6e9fea860..0000000000 --- a/fsstress/include/old/old_device.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2014-2016 Cyril Hrubis - * - * 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, see . - */ - -#ifndef OLD_DEVICE_H__ -#define OLD_DEVICE_H__ - -/* - * Returns filesystem type to be used for the testing. Unless your test is - * designed for specific filesystem you should use this function to the tested - * filesystem. - * - * If TST_DEV_FS_TYPE is set the function returns it's content, - * otherwise default fs type hardcoded in the library is returned. - */ -const char *tst_dev_fs_type(void); - -/* - * Acquires test device. - * - * Can be used only once, i.e. you cannot get two different devices. - * - * Looks for LTP_DEV env variable first (which may be passed by the test - * driver or by a user) and returns just it's value if found. - * - * Otherwise creates a temp file and loop device. - * - * Note that you have to call tst_tmpdir() beforehand. - * - * Returns path to the device or NULL if it cannot be created. - * Call tst_release_device() when you're done. - */ -const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size); - -const char *tst_acquire_device__(unsigned int size); - -static inline const char *tst_acquire_device(void (cleanup_fn)(void)) -{ - return tst_acquire_device_(cleanup_fn, 0); -} - -/* - * Acquire a loop device with specified temp filename. This function allows - * you to acquire multiple devices at the same time. LTP_DEV is ignored. - * If you call this function directly, use tst_detach_device() to release - * the devices. tst_release_device() will not work correctly. - * - * The return value points to a static buffer and additional calls of - * tst_acquire_loop_device() or tst_acquire_device() will overwrite it. - */ -const char *tst_acquire_loop_device(unsigned int size, const char *filename); - -/* - * @dev: device path returned by the tst_acquire_device() - */ -int tst_release_device(const char *dev); - -/* - * Cleanup function for tst_acquire_loop_device(). If you have acquired - * a device using tst_acquire_device(), use tst_release_device() instead. - * @dev: device path returned by the tst_acquire_loop_device() - */ -int tst_detach_device(const char *dev); - -/* - * Just like umount() but retries several times on failure. - * @path: Path to umount - */ -int tst_umount(const char *path); - -#endif /* OLD_DEVICE_H__ */ diff --git a/fsstress/include/old/old_module.h b/fsstress/include/old/old_module.h deleted file mode 100644 index c50efec762..0000000000 --- a/fsstress/include/old/old_module.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved. - * - * 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 would 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 the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author: - * Alexey Kodanev - * - * These functions help to load and unload kernel modules in the tests. - * - * tst_module_load function already includes tst_module_exists function, - * which is checking the following possible module's locations: - * - * 1. Current working directory - * - * 2. LTP installation path (using env LTPROOT, which is usually /opt/ltp) - * - * 3. If tmp directory created, it'll look at the test start working directory - * - */ - -#ifndef TST_MODULE -#define TST_MODULE - -/* - * Check module existence. - * - * @mod_name: module's file name. - * @mod_path: if it is not NULL, then tst_module_exists places the found - * module's path into the location pointed to by *mod_path. It must be freed - * with free() when it is no longer needed. - * - * In case of failure, test'll call cleanup_fn and exit with TCONF return value. - */ -void tst_module_exist(void (cleanup_fn)(void), const char *mod_name, - char **mod_path); - -/* - * Load a module using insmod program. - * - * @mod_name: module's file name. - * @argv: an array of pointers to null-terminated strings that represent the - * additional parameters to the module. The array of pointers must be - * terminated by a NULL pointer. If argv points to NULL, it will be ignored. - * - * In case of insmod failure, test will call cleanup_fn and exit with TBROK - * return value. - */ -void tst_module_load(void (cleanup_fn)(void), - const char *mod_name, char *const argv[]); - -/* - * Unload a module using rmmod program. In case of failure, test will call - * cleanup_fn and exit with TBROK return value. - * - * @mod_name: can be module name or module's file name. - */ -void tst_module_unload(void (cleanup_fn)(void), const char *mod_name); - -#endif /* TST_MODULE */ diff --git a/fsstress/include/old/old_resource.h b/fsstress/include/old/old_resource.h deleted file mode 100644 index 46767f35c4..0000000000 --- a/fsstress/include/old/old_resource.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2012 Cyril Hrubis chrubis@suse.cz - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - - /* - - Small helper for preparing files the test needs to copy before the testing. - - We need to support two scenarios. - - 1. Test is executed in local directory and this is also the place - we should look for files - - - 2. Test is executed after LTP has been installed, in this case we - look for env LTPROOT (usually /opt/ltp/) - - */ - -#ifndef TST_RESOURCE -#define TST_RESOURCE - -const char *tst_dataroot(void); - -/* - * Copy a file to the CWD. The destination is apended to CWD. - */ -#define TST_RESOURCE_COPY(cleanup_fn, filename, dest) \ - tst_resource_copy(__FILE__, __LINE__, (cleanup_fn), \ - (filename), (dest)) - -void tst_resource_copy(const char *file, const int lineno, - void (*cleanup_fn)(void), - const char *filename, const char *dest); - -#endif /* TST_RESOURCE */ diff --git a/fsstress/include/old/old_safe_file_ops.h b/fsstress/include/old/old_safe_file_ops.h deleted file mode 100644 index d6e2d29a96..0000000000 --- a/fsstress/include/old/old_safe_file_ops.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2012-2016 Cyril Hrubis - * - * 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, see . - */ - - /* - - This code helps with file reading/writing files providing scanf/printf like - interface that opens and closes the file automatically. - - This kind of interface is especially useful for reading/writing values - from/to pseudo filesystems like procfs or sysfs. - - */ - -#ifndef SAFE_FILE_OPS -#define SAFE_FILE_OPS - -#include "safe_file_ops_fn.h" - -#define FILE_SCANF(path, fmt, ...) \ - file_scanf(__FILE__, __LINE__, \ - (path), (fmt), ## __VA_ARGS__) - -#define SAFE_FILE_SCANF(cleanup_fn, path, fmt, ...) \ - safe_file_scanf(__FILE__, __LINE__, (cleanup_fn), \ - (path), (fmt), ## __VA_ARGS__) - -#define FILE_LINES_SCANF(cleanup_fn, path, fmt, ...) \ - file_lines_scanf(__FILE__, __LINE__, (cleanup_fn), 0, \ - (path), (fmt), ## __VA_ARGS__) - -#define SAFE_FILE_LINES_SCANF(cleanup_fn, path, fmt, ...) \ - file_lines_scanf(__FILE__, __LINE__, (cleanup_fn), 1, \ - (path), (fmt), ## __VA_ARGS__) - -#define FILE_PRINTF(path, fmt, ...) \ - file_printf(__FILE__, __LINE__, \ - (path), (fmt), ## __VA_ARGS__) - -#define SAFE_FILE_PRINTF(cleanup_fn, path, fmt, ...) \ - safe_file_printf(__FILE__, __LINE__, (cleanup_fn), \ - (path), (fmt), ## __VA_ARGS__) - -#define SAFE_CP(cleanup_fn, src, dst) \ - safe_cp(__FILE__, __LINE__, (cleanup_fn), (src), (dst)) - -#define SAFE_TOUCH(cleanup_fn, pathname, mode, times) \ - safe_touch(__FILE__, __LINE__, (cleanup_fn), \ - (pathname), (mode), (times)) - -#endif /* SAFE_FILE_OPS */ diff --git a/fsstress/include/old/old_safe_net.h b/fsstress/include/old/old_safe_net.h deleted file mode 100644 index 639094a948..0000000000 --- a/fsstress/include/old/old_safe_net.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2015 Fujitsu Ltd. - * Copyright (c) 2016 Cyril Hrubis - * - * 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, see . - */ - -#ifndef OLD_SAFE_NET_H__ -#define OLD_SAFE_NET_H__ - -#include -#include -#include -#include -#include - -#include "safe_net_fn.h" - -#define SAFE_SOCKET(cleanup_fn, domain, type, protocol) \ - safe_socket(__FILE__, __LINE__, (cleanup_fn), domain, type, protocol) - -#define SAFE_BIND(cleanup_fn, socket, address, address_len) \ - safe_bind(__FILE__, __LINE__, (cleanup_fn), socket, address, \ - address_len) - -#define SAFE_LISTEN(cleanup_fn, socket, backlog) \ - safe_listen(__FILE__, __LINE__, (cleanup_fn), socket, backlog) - -#define SAFE_CONNECT(cleanup_fn, sockfd, addr, addrlen) \ - safe_connect(__FILE__, __LINE__, (cleanup_fn), sockfd, addr, addrlen) - -#define SAFE_GETSOCKNAME(cleanup_fn, sockfd, addr, addrlen) \ - safe_getsockname(__FILE__, __LINE__, (cleanup_fn), sockfd, addr, \ - addrlen) - -#define TST_GET_UNUSED_PORT(cleanup_fn, family, type) \ - tst_get_unused_port(__FILE__, __LINE__, (cleanup_fn), family, type) - -#endif /* OLD_SAFE_NET_H__ */ diff --git a/fsstress/include/old/old_safe_stdio.h b/fsstress/include/old/old_safe_stdio.h deleted file mode 100644 index 3508b2479d..0000000000 --- a/fsstress/include/old/old_safe_stdio.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2013-2016 Cyril Hrubis - * - * 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, see . - */ - -#ifndef OLD_SAFE_STDIO_H__ -#define OLD_SAFE_STDIO_H__ - -#include - -#include "safe_stdio_fn.h" - -#define SAFE_FOPEN(cleanup_fn, path, mode) \ - safe_fopen(__FILE__, __LINE__, cleanup_fn, path, mode) - -#define SAFE_FCLOSE(cleanup_fn, f) \ - safe_fclose(__FILE__, __LINE__, cleanup_fn, f) - -#define SAFE_ASPRINTF(cleanup_fn, strp, fmt, ...) \ - safe_asprintf(__FILE__, __LINE__, cleanup_fn, strp, fmt, __VA_ARGS__) - -#define SAFE_POPEN(cleanup_fn, command, type) \ - safe_popen(__FILE__, __LINE__, cleanup_fn, command, type) - -#endif /* OLD_SAFE_STDIO_H__ */ diff --git a/fsstress/include/old/old_tmpdir.h b/fsstress/include/old/old_tmpdir.h deleted file mode 100644 index 9c61172fd7..0000000000 --- a/fsstress/include/old/old_tmpdir.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2016 Cyril Hrubis - * - * 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, see . - */ - -#ifndef OLD_TMPDIR_H__ -#define OLD_TMPDIR_H__ - -/* - * Create a unique temporary directory and chdir() to it. It expects the caller - * to have defined/initialized the TCID/TST_TOTAL global variables. - * The TESTDIR global variable will be set to the directory that gets used - * as the testing directory. - * - * NOTE: This function must be called BEFORE any activity that would require - * CLEANUP. If tst_tmpdir() fails, it cleans up afer itself and calls - * tst_exit() (i.e. does not return). - */ -void tst_tmpdir(void); - -/* - * Recursively remove the temporary directory created by tst_tmpdir(). - * This function is intended ONLY as a companion to tst_tmpdir(). - */ -void tst_rmdir(void); - -/* tst_get_tmpdir() - * - * Return a copy of the test temp directory as seen by LTP. This is for - * path-oriented tests like chroot, etc, that may munge the path a bit. - * - * FREE VARIABLE AFTER USE IF IT IS REUSED! - */ -char *tst_get_tmpdir(void); - -/* - * Returns 1 if temp directory was created. - */ -int tst_tmpdir_created(void); - -/* declared in tst_tmpdir.c */ -const char *tst_get_startwd(void); - -#endif /* OLD_TMPDIR_H__ */ diff --git a/fsstress/include/old/random_range.h b/fsstress/include/old/random_range.h deleted file mode 100644 index 22b3f93231..0000000000 --- a/fsstress/include/old/random_range.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ -#ifndef _RANDOM_RANGE_H_ -#define _RANDOM_RANGE_H_ - -int parse_ranges ( char *, int, int, int, int (*)(), char **, char ** ); -int range_min ( char *, int ); -int range_max ( char *, int ); -int range_mult ( char *, int ); -long random_range ( int, int, int, char ** ); -long random_rangel ( long, long, long, char ** ); -long long random_rangell ( long long, long long, long long, char ** ); -void random_range_seed( long ); -long random_bit ( long ); - -#endif diff --git a/fsstress/include/old/safe_macros.h b/fsstress/include/old/safe_macros.h deleted file mode 100644 index e778d3077e..0000000000 --- a/fsstress/include/old/safe_macros.h +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Safe macros for commonly used syscalls to reduce code duplication in LTP - * testcases, and to ensure all errors are caught in said testcases as - * gracefully as possible. - * - * Also satiates some versions of gcc/glibc when the warn_unused_result - * attribute is applied to the function call. - * - * Licensed under the GPLv2. - */ - -#ifndef __TEST_H__ -#error "you must include test.h before this file" -#else - -#ifndef __SAFE_MACROS_H__ -#define __SAFE_MACROS_H__ - -#include "safe_macros_fn.h" -#include "old_safe_stdio.h" -#include "old_safe_net.h" - -#define SAFE_BASENAME(cleanup_fn, path) \ - safe_basename(__FILE__, __LINE__, (cleanup_fn), (path)) - -#define SAFE_CHDIR(cleanup_fn, path) \ - safe_chdir(__FILE__, __LINE__, (cleanup_fn), (path)) - -#define SAFE_CLOSE(cleanup_fn, fd) ({ \ - int ret = safe_close(__FILE__, __LINE__, (cleanup_fn), (fd)); \ - fd = -1; \ - ret; \ - }) - -#define SAFE_CREAT(cleanup_fn, pathname, mode) \ - safe_creat(__FILE__, __LINE__, cleanup_fn, (pathname), (mode)) - -#define SAFE_DIRNAME(cleanup_fn, path) \ - safe_dirname(__FILE__, __LINE__, (cleanup_fn), (path)) - -#define SAFE_GETCWD(cleanup_fn, buf, size) \ - safe_getcwd(__FILE__, __LINE__, (cleanup_fn), (buf), (size)) - -#define SAFE_GETPWNAM(cleanup_fn, name) \ - safe_getpwnam(__FILE__, __LINE__, cleanup_fn, (name)) - -#define SAFE_GETRUSAGE(cleanup_fn, who, usage) \ - safe_getrusage(__FILE__, __LINE__, (cleanup_fn), (who), (usage)) - -#define SAFE_MALLOC(cleanup_fn, size) \ - safe_malloc(__FILE__, __LINE__, (cleanup_fn), (size)) - -#define SAFE_MKDIR(cleanup_fn, pathname, mode) \ - safe_mkdir(__FILE__, __LINE__, (cleanup_fn), (pathname), (mode)) - -#define SAFE_RMDIR(cleanup_fn, pathname) \ - safe_rmdir(__FILE__, __LINE__, (cleanup_fn), (pathname)) - -#define SAFE_MUNMAP(cleanup_fn, addr, length) \ - safe_munmap(__FILE__, __LINE__, (cleanup_fn), (addr), (length)) - -#define SAFE_OPEN(cleanup_fn, pathname, oflags, ...) \ - safe_open(__FILE__, __LINE__, (cleanup_fn), (pathname), (oflags), \ - ##__VA_ARGS__) - -#define SAFE_PIPE(cleanup_fn, fildes) \ - safe_pipe(__FILE__, __LINE__, cleanup_fn, (fildes)) - -#define SAFE_READ(cleanup_fn, len_strict, fildes, buf, nbyte) \ - safe_read(__FILE__, __LINE__, cleanup_fn, (len_strict), (fildes), \ - (buf), (nbyte)) - -#define SAFE_SETEGID(cleanup_fn, egid) \ - safe_setegid(__FILE__, __LINE__, cleanup_fn, (egid)) - -#define SAFE_SETEUID(cleanup_fn, euid) \ - safe_seteuid(__FILE__, __LINE__, cleanup_fn, (euid)) - -#define SAFE_SETGID(cleanup_fn, gid) \ - safe_setgid(__FILE__, __LINE__, cleanup_fn, (gid)) - -#define SAFE_SETUID(cleanup_fn, uid) \ - safe_setuid(__FILE__, __LINE__, cleanup_fn, (uid)) - -#define SAFE_GETRESUID(cleanup_fn, ruid, euid, suid) \ - safe_getresuid(__FILE__, __LINE__, cleanup_fn, (ruid), (euid), (suid)) - -#define SAFE_GETRESGID(cleanup_fn, rgid, egid, sgid) \ - safe_getresgid(__FILE__, __LINE__, cleanup_fn, (rgid), (egid), (sgid)) - -#define SAFE_UNLINK(cleanup_fn, pathname) \ - safe_unlink(__FILE__, __LINE__, cleanup_fn, (pathname)) - -#define SAFE_LINK(cleanup_fn, oldpath, newpath) \ - safe_link(__FILE__, __LINE__, cleanup_fn, (oldpath), (newpath)) - -#define SAFE_LINKAT(cleanup_fn, olddirfd, oldpath, newdirfd, newpath, flags) \ - safe_linkat(__FILE__, __LINE__, cleanup_fn, (olddirfd), (oldpath), \ - (newdirfd), (newpath), (flags)) - -#define SAFE_READLINK(cleanup_fn, path, buf, bufsize) \ - safe_readlink(__FILE__, __LINE__, cleanup_fn, (path), (buf), (bufsize)) - -#define SAFE_SYMLINK(cleanup_fn, oldpath, newpath) \ - safe_symlink(__FILE__, __LINE__, cleanup_fn, (oldpath), (newpath)) - -#define SAFE_WRITE(cleanup_fn, len_strict, fildes, buf, nbyte) \ - safe_write(__FILE__, __LINE__, cleanup_fn, (len_strict), (fildes), \ - (buf), (nbyte)) - -#define SAFE_STRTOL(cleanup_fn, str, min, max) \ - safe_strtol(__FILE__, __LINE__, cleanup_fn, (str), (min), (max)) - -#define SAFE_STRTOUL(cleanup_fn, str, min, max) \ - safe_strtoul(__FILE__, __LINE__, cleanup_fn, (str), (min), (max)) - -#define SAFE_SYSCONF(cleanup_fn, name) \ - safe_sysconf(__FILE__, __LINE__, cleanup_fn, name) - -#define SAFE_CHMOD(cleanup_fn, path, mode) \ - safe_chmod(__FILE__, __LINE__, (cleanup_fn), (path), (mode)) - -#define SAFE_FCHMOD(cleanup_fn, fd, mode) \ - safe_fchmod(__FILE__, __LINE__, (cleanup_fn), (fd), (mode)) - -#define SAFE_CHOWN(cleanup_fn, path, owner, group) \ - safe_chown(__FILE__, __LINE__, (cleanup_fn), (path), (owner), (group)) - -#define SAFE_FCHOWN(cleanup_fn, fd, owner, group) \ - safe_fchown(__FILE__, __LINE__, (cleanup_fn), (fd), (owner), (group)) - -#define SAFE_WAIT(cleanup_fn, status) \ - safe_wait(__FILE__, __LINE__, (cleanup_fn), (status)) - -#define SAFE_WAITPID(cleanup_fn, pid, status, opts) \ - safe_waitpid(__FILE__, __LINE__, (cleanup_fn), (pid), (status), (opts)) - -#define SAFE_KILL(cleanup_fn, pid, sig) \ - safe_kill(__FILE__, __LINE__, (cleanup_fn), (pid), (sig)) - -#define SAFE_MEMALIGN(cleanup_fn, alignment, size) \ - safe_memalign(__FILE__, __LINE__, (cleanup_fn), (alignment), (size)) - -#define SAFE_MKFIFO(cleanup_fn, pathname, mode) \ - safe_mkfifo(__FILE__, __LINE__, (cleanup_fn), (pathname), (mode)) - -#define SAFE_RENAME(cleanup_fn, oldpath, newpath) \ - safe_rename(__FILE__, __LINE__, (cleanup_fn), (oldpath), (newpath)) - -#define SAFE_MOUNT(cleanup_fn, source, target, filesystemtype, \ - mountflags, data) \ - safe_mount(__FILE__, __LINE__, (cleanup_fn), (source), (target), \ - (filesystemtype), (mountflags), (data)) - -#define SAFE_UMOUNT(cleanup_fn, target) \ - safe_umount(__FILE__, __LINE__, (cleanup_fn), (target)) - -/* - * following functions are inline because the behaviour may depend on - * -D_FILE_OFFSET_BITS=64 -DOFF_T=__off64_t compile flags - */ - -static inline void *safe_mmap(const char *file, const int lineno, - void (*cleanup_fn)(void), void *addr, size_t length, - int prot, int flags, int fd, off_t offset) -{ - void *rval; - - rval = mmap(addr, length, prot, flags, fd, offset); - if (rval == MAP_FAILED) { - tst_brkm(TBROK | TERRNO, cleanup_fn, - "%s:%d: mmap(%p,%zu,%d,%d,%d,%ld) failed", - file, lineno, addr, length, prot, flags, fd, - (long) offset); - } - - return rval; -} -#define SAFE_MMAP(cleanup_fn, addr, length, prot, flags, fd, offset) \ - safe_mmap(__FILE__, __LINE__, (cleanup_fn), (addr), (length), (prot), \ - (flags), (fd), (offset)) - -static inline int safe_ftruncate(const char *file, const int lineno, - void (cleanup_fn) (void), int fd, off_t length) -{ - int rval; - - rval = ftruncate(fd, length); - if (rval == -1) { - tst_brkm(TBROK | TERRNO, cleanup_fn, - "%s:%d: ftruncate(%d,%ld) failed", - file, lineno, fd, (long)length); - } - - return rval; -} -#define SAFE_FTRUNCATE(cleanup_fn, fd, length) \ - safe_ftruncate(__FILE__, __LINE__, cleanup_fn, (fd), (length)) - -static inline int safe_truncate(const char *file, const int lineno, - void (cleanup_fn) (void), const char *path, off_t length) -{ - int rval; - - rval = truncate(path, length); - if (rval == -1) { - tst_brkm(TBROK | TERRNO, cleanup_fn, - "%s:%d: truncate(%s,%ld) failed", - file, lineno, path, (long)length); - } - - return rval; -} -#define SAFE_TRUNCATE(cleanup_fn, path, length) \ - safe_truncate(__FILE__, __LINE__, cleanup_fn, (path), (length)) - -static inline int safe_stat(const char *file, const int lineno, - void (cleanup_fn)(void), const char *path, struct stat *buf) -{ - int rval; - - rval = stat(path, buf); - - if (rval == -1) { - tst_brkm(TBROK | TERRNO, cleanup_fn, - "%s:%d: stat(%s,%p) failed", file, lineno, path, buf); - } - - return rval; -} -#define SAFE_STAT(cleanup_fn, path, buf) \ - safe_stat(__FILE__, __LINE__, (cleanup_fn), (path), (buf)) - -static inline int safe_fstat(const char *file, const int lineno, - void (cleanup_fn)(void), int fd, struct stat *buf) -{ - int rval; - - rval = fstat(fd, buf); - - if (rval == -1) { - tst_brkm(TBROK | TERRNO, cleanup_fn, - "%s:%d: fstat(%d,%p) failed", file, lineno, fd, buf); - } - - return rval; -} -#define SAFE_FSTAT(cleanup_fn, fd, buf) \ - safe_fstat(__FILE__, __LINE__, (cleanup_fn), (fd), (buf)) - -static inline int safe_lstat(const char *file, const int lineno, - void (cleanup_fn)(void), const char *path, struct stat *buf) -{ - int rval; - - rval = lstat(path, buf); - - if (rval == -1) { - tst_brkm(TBROK | TERRNO, cleanup_fn, - "%s:%d: lstat(%s,%p) failed", file, lineno, path, buf); - } - - return rval; -} -#define SAFE_LSTAT(cleanup_fn, path, buf) \ - safe_lstat(__FILE__, __LINE__, (cleanup_fn), (path), (buf)) - -static inline off_t safe_lseek(const char *file, const int lineno, - void (cleanup_fn)(void), int fd, off_t offset, int whence) -{ - off_t rval; - - rval = lseek(fd, offset, whence); - - if (rval == (off_t) -1) { - tst_brkm(TBROK | TERRNO, cleanup_fn, - "%s:%d: lseek(%d,%ld,%d) failed", - file, lineno, fd, (long)offset, whence); - } - - return rval; -} -#define SAFE_LSEEK(cleanup_fn, fd, offset, whence) \ - safe_lseek(__FILE__, __LINE__, cleanup_fn, (fd), (offset), (whence)) - -static inline int safe_getrlimit(const char *file, const int lineno, - void (cleanup_fn)(void), int resource, struct rlimit *rlim) -{ - int rval; - - rval = getrlimit(resource, rlim); - - if (rval == -1) { - tst_brkm(TBROK | TERRNO, cleanup_fn, - "%s:%d: getrlimit(%d,%p) failed", - file, lineno, resource, rlim); - } - - return rval; -} -#define SAFE_GETRLIMIT(cleanup_fn, resource, rlim) \ - safe_getrlimit(__FILE__, __LINE__, (cleanup_fn), (resource), (rlim)) - -static inline int safe_setrlimit(const char *file, const int lineno, - void (cleanup_fn)(void), int resource, const struct rlimit *rlim) -{ - int rval; - - rval = setrlimit(resource, rlim); - - if (rval == -1) { - tst_brkm(TBROK | TERRNO, cleanup_fn, - "%s:%d: setrlimit(%d,%p) failed", - file, lineno, resource, rlim); - } - - return rval; -} -#define SAFE_SETRLIMIT(cleanup_fn, resource, rlim) \ - safe_setrlimit(__FILE__, __LINE__, (cleanup_fn), (resource), (rlim)) - -#define SAFE_OPENDIR(cleanup_fn, name) \ - safe_opendir(__FILE__, __LINE__, (cleanup_fn), (name)) - -#define SAFE_CLOSEDIR(cleanup_fn, dirp) \ - safe_closedir(__FILE__, __LINE__, (cleanup_fn), (dirp)) - -#define SAFE_READDIR(cleanup_fn, dirp) \ - safe_readdir(__FILE__, __LINE__, (cleanup_fn), (dirp)) - - -#define SAFE_IOCTL(cleanup_fn, fd, request, ...) \ - ({int ret = ioctl(fd, request, __VA_ARGS__); \ - if (ret < 0) \ - tst_brkm(TBROK | TERRNO, cleanup_fn, \ - "ioctl(%i,%s,...) failed", fd, #request); \ - ret;}) - -#endif /* __SAFE_MACROS_H__ */ -#endif /* __TEST_H__ */ diff --git a/fsstress/include/old/test.h b/fsstress/include/old/test.h deleted file mode 100644 index 604254eea6..0000000000 --- a/fsstress/include/old/test.h +++ /dev/null @@ -1,214 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * Copyright (c) 2009-2013 Cyril Hrubis chrubis@suse.cz - */ - -#ifndef __TEST_H__ -#define __TEST_H__ - -#ifdef TST_TEST_H__ -# error Newlib tst_test.h already included -#endif /* TST_TEST_H__ */ - -#include -#include -#include -#include -#include -#include - -#include "usctest.h" - -#include "tst_common.h" -#include "old_safe_file_ops.h" -#include "old_checkpoint.h" -#include "tst_process_state.h" -#include "old_resource.h" -#include "tst_res_flags.h" -#include "tst_kvercmp.h" -#include "tst_fs.h" -#include "tst_pid.h" -#include "tst_cmd.h" -#include "tst_cpu.h" -#include "tst_clone.h" -#include "old_device.h" -#include "old_tmpdir.h" -#include "tst_minmax.h" -#include "tst_get_bad_addr.h" -#include "tst_path_has_mnt_flags.h" - -/* - * Ensure that NUMSIGS is defined. - * It should be defined in signal.h or sys/signal.h on - * UNICOS/mk and IRIX systems. On UNICOS systems, - * it is not defined, thus it is being set to UNICOS's NSIG. - * Note: IRIX's NSIG (signals are 1-(NSIG-1)) - * is not same meaning as UNICOS/UMK's NSIG (signals 1-NSIG) - */ -#ifndef NUMSIGS -#define NUMSIGS NSIG -#endif - - -/* defines for unexpected signal setup routine (set_usig.c) */ -#define FORK 1 /* SIGCHLD is to be ignored */ -#define NOFORK 0 /* SIGCHLD is to be caught */ -#define DEF_HANDLER SIG_ERR /* tells set_usig() to use default signal handler */ - -/* - * The following defines are used to control tst_res and t_result reporting. - */ - -#define TOUTPUT "TOUTPUT" /* The name of the environment variable */ - /* that can be set to one of the following */ - /* strings to control tst_res output */ - /* If not set, TOUT_VERBOSE_S is assumed */ - -/* - * fork() can't be used on uClinux systems, so use FORK_OR_VFORK instead, - * which will run vfork() on uClinux. - * mmap() doesn't support MAP_PRIVATE on uClinux systems, so use - * MAP_PRIVATE_EXCEPT_UCLINUX instead, which will skip the option on uClinux. - * If MAP_PRIVATE really is required, the test can not be run on uClinux. - */ -#ifdef UCLINUX -# define FORK_OR_VFORK tst_vfork -# define MAP_PRIVATE_EXCEPT_UCLINUX 0 -/* tst_old_flush() + vfork() */ -pid_t tst_vfork(void); -#else -# define FORK_OR_VFORK tst_fork -# define MAP_PRIVATE_EXCEPT_UCLINUX MAP_PRIVATE -#endif - -/* - * Macro to use for making functions called only once in - * multi-threaded tests such as init or cleanup function. - * The first call to @name_fn function by any thread shall - * call the @exec_fn. Subsequent calls shall not call @exec_fn. - * *_fn functions must not take any arguments. - */ -#define TST_DECLARE_ONCE_FN(name_fn, exec_fn) \ - void name_fn(void) \ - { \ - static pthread_once_t ltp_once = PTHREAD_ONCE_INIT; \ - pthread_once(<p_once, exec_fn); \ - } - -/* - * lib/forker.c - */ -extern int Forker_pids[]; -extern int Forker_npids; - -typedef struct { - char *option; /* Valid option string (one option only) like "a:" */ - int *flag; /* Pointer to location to set true if option given */ - char **arg; /* Pointer to location to place argument, if needed */ -} option_t; - -/* lib/tst_parse_opts.c */ -void tst_parse_opts(int argc, char *argv[], const option_t *user_optarg, - void (*user_help)(void)); - -/* lib/tst_res.c */ -const char *strttype(int ttype); - -void tst_resm_(const char *file, const int lineno, int ttype, - const char *arg_fmt, ...) - __attribute__ ((format (printf, 4, 5))); -#define tst_resm(ttype, arg_fmt, ...) \ - tst_resm_(__FILE__, __LINE__, (ttype), \ - (arg_fmt), ##__VA_ARGS__) - -void tst_resm_hexd_(const char *file, const int lineno, int ttype, - const void *buf, size_t size, const char *arg_fmt, ...) - __attribute__ ((format (printf, 6, 7))); -#define tst_resm_hexd(ttype, buf, size, arg_fmt, ...) \ - tst_resm_hexd_(__FILE__, __LINE__, (ttype), (buf), (size), \ - (arg_fmt), ##__VA_ARGS__) - -void tst_brkm_(const char *file, const int lineno, int ttype, - void (*func)(void), const char *arg_fmt, ...) - __attribute__ ((format (printf, 5, 6))) LTP_ATTRIBUTE_NORETURN; - -#ifdef LTPLIB -# include "ltp_priv.h" -# define tst_brkm(flags, cleanup, fmt, ...) do { \ - if (tst_test) \ - tst_brk_(__FILE__, __LINE__, flags, fmt, ##__VA_ARGS__); \ - else \ - tst_brkm_(__FILE__, __LINE__, flags, cleanup, fmt, ##__VA_ARGS__); \ - } while (0) -#else -# define tst_brkm(flags, cleanup, fmt, ...) do { \ - tst_brkm_(__FILE__, __LINE__, flags, cleanup, fmt, ##__VA_ARGS__); \ - } while (0) -#endif - -void tst_require_root(void); -void tst_exit(void) LTP_ATTRIBUTE_NORETURN; -void tst_old_flush(void); - -/* - * tst_old_flush() + fork - * NOTE: tst_fork() will reset T_exitval to 0 for child process. - */ -pid_t tst_fork(void); - -/* lib/tst_res.c */ -/* - * In case we need do real test work in child process parent process can use - * tst_record_childstatus() to make child process's test results propagated to - * parent process correctly. - * - * The child can use tst_resm(), tst_brkm() followed by the tst_exit() or - * plain old exit() (with TPASS, TFAIL and TBROK). - * - * WARNING: Be wary that the child cleanup function passed to tst_brkm() - * must clean only resources the child has allocated. E.g. the - * child cleanup is different function from the parent cleanup. - */ -void tst_record_childstatus(void (*cleanup)(void), pid_t child); - -extern int tst_count; - -/* lib/tst_sig.c */ -void tst_sig(int fork_flag, void (*handler)(), void (*cleanup)()); - -/* lib/self_exec.c */ -void maybe_run_child(void (*child)(), const char *fmt, ...); -int self_exec(const char *argv0, const char *fmt, ...); - -/* lib/tst_mkfs.c - * - * @dev: path to a device - * @fs_type: filesystem type - * @fs_opts: NULL or NULL terminated array of mkfs options - * @extra_opt: extra mkfs option which is passed after the device name - */ -#define tst_mkfs(cleanup, dev, fs_type, fs_opts, extra_opts) \ - tst_mkfs_(__FILE__, __LINE__, cleanup, dev, fs_type, \ - fs_opts, extra_opts) -void tst_mkfs_(const char *file, const int lineno, void (cleanup_fn)(void), - const char *dev, const char *fs_type, - const char *const fs_opts[], const char *const extra_opts[]); - -/* lib/tst_res.c - * tst_strsig converts signal's value to corresponding string. - * tst_strerrno converts errno to corresponding string. - */ -const char *tst_strsig(int sig); -const char *tst_strerrno(int err); - -#ifdef TST_USE_COMPAT16_SYSCALL -#define TCID_BIT_SUFFIX "_16" -#elif TST_USE_NEWER64_SYSCALL -#define TCID_BIT_SUFFIX "_64" -#else -#define TCID_BIT_SUFFIX "" -#endif -#define TCID_DEFINE(ID) char *TCID = (#ID TCID_BIT_SUFFIX) - -#endif /* __TEST_H__ */ diff --git a/fsstress/include/old/tlibio.h b/fsstress/include/old/tlibio.h deleted file mode 100644 index 0fe9ce9deb..0000000000 --- a/fsstress/include/old/tlibio.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ - -#define LIO_IO_SYNC 00001 /* read/write */ -#define LIO_IO_ASYNC 00002 /* reada/writea/aio_write/aio_read */ -#define LIO_IO_SLISTIO 00004 /* single stride sync listio */ -#define LIO_IO_ALISTIO 00010 /* single stride async listio */ -#define LIO_IO_SYNCV 00020 /* single-buffer readv/writev */ -#define LIO_IO_SYNCP 00040 /* pread/pwrite */ - -#ifdef sgi -#define LIO_IO_ATYPES 00077 /* all io types */ -#define LIO_IO_TYPES 00061 /* all io types, non-async */ -#endif /* sgi */ -#if defined(__linux__) && !defined(__UCLIBC__) -#define LIO_IO_TYPES 00061 /* all io types */ -#define LIO_IO_ATYPES 00077 /* all io types */ -#endif -#if defined(__sun) || defined(__hpux) || defined(_AIX) || defined(__UCLIBC__) -#define LIO_IO_TYPES 00021 /* all io types except pread/pwrite */ -#endif /* linux */ -#ifdef CRAY -#define LIO_IO_TYPES 00017 /* all io types */ -#endif /* CRAY */ - -#ifndef LIO_IO_ATYPES -#define LIO_IO_ATYPES LIO_IO_TYPES -#endif - -#define LIO_WAIT_NONE 00010000 /* return asap -- use with care */ -#define LIO_WAIT_ACTIVE 00020000 /* spin looking at iosw fields, or EINPROGRESS */ -#define LIO_WAIT_RECALL 00040000 /* call recall(2)/aio_suspend(3) */ -#define LIO_WAIT_SIGPAUSE 00100000 /* call pause */ -#define LIO_WAIT_SIGACTIVE 00200000 /* spin waiting for signal */ -#if defined(sgi) || defined(__linux__) -#define LIO_WAIT_CBSUSPEND 00400000 /* aio_suspend waiting for callback */ -#define LIO_WAIT_SIGSUSPEND 01000000 /* aio_suspend waiting for signal */ -#define LIO_WAIT_ATYPES 01760000 /* all async wait types, except nowait */ -#define LIO_WAIT_TYPES 00020000 /* all sync wait types (sorta) */ -#endif /* sgi */ -#if defined(__sun) || defined(__hpux) || defined(_AIX) -#define LIO_WAIT_TYPES 00300000 /* all wait types, except nowait */ -#endif /* linux */ -#ifdef CRAY -#define LIO_WAIT_TYPES 00360000 /* all wait types, except nowait */ -#endif /* CRAY */ - -/* meta wait io */ -/* 00 000 0000 */ - -#if defined(sgi) || defined(__linux__) -/* all callback wait types */ -#define LIO_WAIT_CBTYPES (LIO_WAIT_CBSUSPEND) -/* all signal wait types */ -#define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE|LIO_WAIT_SIGACTIVE|LIO_WAIT_SIGSUSPEND) -/* all aio_{read,write} or lio_listio */ -#define LIO_IO_ASYNC_TYPES (LIO_IO_ASYNC|LIO_IO_SLISTIO|LIO_IO_ALISTIO) -#endif /* sgi */ -#if defined(__sun) || defined(__hpux) || defined(_AIX) -/* all signal wait types */ -#define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE) -#endif /* linux */ -#ifdef CRAY -/* all signal wait types */ -#define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE|LIO_WAIT_SIGACTIVE) -#endif /* CRAY */ - -/* - * This bit provides a way to randomly pick an io type and wait method. - * lio_read_buffer() and lio_write_buffer() functions will call - * lio_random_methods() with the given method. - */ -#define LIO_RANDOM 010000000 - -/* - * This bit provides a way for the programmer to use async i/o with - * signals and to use their own signal handler. By default, - * the signal will only be given to the system call if the wait - * method is LIO_WAIT_SIGPAUSE or LIO_WAIT_SIGACTIVE. - * Whenever these wait methods are used, libio signal handler - * will be used. - */ -#define LIO_USE_SIGNAL 020000000 - -/* - * prototypes/structures for functions in the libio.c module. See comments - * in that module, or man page entries for information on the individual - * functions. - */ - -int stride_bounds(int offset, int stride, int nstrides, - int bytes_per_stride, int *min_byte, int *max_byte); - -int lio_set_debug(int level); -int lio_parse_io_arg1(char *string); -void lio_help1(char *prefex); -int lio_parse_io_arg2(char *string, char **badtoken); -void lio_help2(char *prefex); -int lio_write_buffer(int fd, int method, char *buffer, int size, - int sig, char **errmsg, long wrd); - -int lio_read_buffer(int fd, int method, char *buffer, int size, - int sig, char **errmsg, long wrd); -int lio_random_methods(long mask); - -#if CRAY -#include -int lio_wait4asyncio(int method, int fd, struct iosw **statptr); -int lio_check_asyncio(char *io_type, int size, struct iosw *status); -#endif /* CRAY */ -#if defined (sgi) -#include -int lio_wait4asyncio(int method, int fd, aiocb_t *aiocbp); -int lio_check_asyncio(char *io_type, int size, aiocb_t *aiocbp, int method); -#endif /* sgi */ -#if defined(__linux__) && !defined(__UCLIBC__) -#include -int lio_wait4asyncio(int method, int fd, struct aiocb *aiocbp); -int lio_check_asyncio(char *io_type, int size, struct aiocb *aiocbp, int method); -#endif - -/* - * Define the structure that contains the infomation that is used - * by the parsing and help functions. - */ -struct lio_info_type { - char *token; - int bits; - char *desc; -}; - - diff --git a/fsstress/include/old/usctest.h b/fsstress/include/old/usctest.h deleted file mode 100644 index 9b9446d70a..0000000000 --- a/fsstress/include/old/usctest.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * Author: William Roske - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ - */ - -#ifndef __USCTEST_H__ -#define __USCTEST_H__ - -/* - * Ensure that PATH_MAX is defined - */ -#ifndef PATH_MAX -#ifdef MAXPATHLEN -#define PATH_MAX MAXPATHLEN -#else -#define PATH_MAX 1024 -#endif -#endif - -/*********************************************************************** - * The following globals are defined in parse_opts.c but must be - * externed here because they are used in the macros defined below. - ***********************************************************************/ -extern int STD_LOOP_COUNT; /* changed by -in to set loop count to n */ - -extern long TEST_RETURN; -extern int TEST_ERRNO; - -/*********************************************************************** - * TEST: calls a system call - * - * parameters: - * SCALL = system call and parameters to execute - * - ***********************************************************************/ -#define TEST(SCALL) \ - do { \ - errno = 0; \ - TEST_RETURN = SCALL; \ - TEST_ERRNO = errno; \ - } while (0) - -/*********************************************************************** - * TEST_VOID: calls a system call - * - * parameters: - * SCALL = system call and parameters to execute - * - * Note: This is IDENTICAL to the TEST() macro except that it is intended - * for use with syscalls returning no values (void syscall()). The - * Typecasting nothing (void) into an unsigned integer causes compilation - * errors. - * - ***********************************************************************/ -#define TEST_VOID(SCALL) do { errno = 0; SCALL; TEST_ERRNO = errno; } while (0) - -/*********************************************************************** - * TEST_PAUSE: Pause for SIGUSR1 if the pause flag is set. - * Just continue when signal comes in. - * - * parameters: - * none - * - ***********************************************************************/ -#define TEST_PAUSE usc_global_setup_hook(); -int usc_global_setup_hook(); - -/*********************************************************************** - * TEST_LOOPING now call the usc_test_looping function. - * The function will return 1 if the test should continue - * iterating. - * - ***********************************************************************/ -#define TEST_LOOPING usc_test_looping -int usc_test_looping(int counter); - -#endif /* __USCTEST_H__ */ diff --git a/fsstress/include/parse_vdso.h b/fsstress/include/parse_vdso.h deleted file mode 100644 index 5212fc659e..0000000000 --- a/fsstress/include/parse_vdso.h +++ /dev/null @@ -1,41 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2020 Linaro Limited. All rights reserved. - * Author: Viresh Kumar - */ - -#ifndef PARSE_VDSO_H__ -#define PARSE_VDSO_H__ - -#include - -/* - * To use this vDSO parser, first call one of the vdso_init_* functions. - * If you've already parsed auxv, then pass the value of AT_SYSINFO_EHDR - * to vdso_init_from_sysinfo_ehdr. Otherwise pass auxv to vdso_init_from_auxv. - * Then call vdso_sym for each symbol you want. For example, to look up - * gettimeofday on x86_64, use: - * - * = vdso_sym("LINUX_2.6", "gettimeofday"); - * or - * = vdso_sym("LINUX_2.6", "__vdso_gettimeofday"); - * - * vdso_sym will return 0 if the symbol doesn't exist or if the init function - * failed or was not called. vdso_sym is a little slow, so its return value - * should be cached. - * - * vdso_sym is threadsafe; the init functions are not. - * - * These are the prototypes: - */ - -#include - -extern void vdso_init_from_auxv(void *auxv); -extern void vdso_init_from_sysinfo_ehdr(uintptr_t base); -extern void *vdso_sym(const char *version, const char *name); - -typedef int (*gettime_t)(clockid_t clk_id, void *ts); -void find_clock_gettime_vdso(gettime_t *ptr_vdso_gettime, - gettime_t *ptr_vdso_gettime64); -#endif /* PARSE_VDSO_H__ */ diff --git a/fsstress/include/safe_file_ops_fn.h b/fsstress/include/safe_file_ops_fn.h deleted file mode 100644 index 052fb1b9a4..0000000000 --- a/fsstress/include/safe_file_ops_fn.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2012-2016 Cyril Hrubis - * - * 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, see . - */ - -#ifndef SAFE_FILE_OPS_FN -#define SAFE_FILE_OPS_FN - -#include -#include - -#include "lapi/utime.h" - -/* - * All-in-one function to scanf value(s) from a file. - */ -int file_scanf(const char *file, const int lineno, - const char *path, const char *fmt, ...) - __attribute__ ((format (scanf, 4, 5))); - -void safe_file_scanf(const char *file, const int lineno, - void (*cleanup_fn)(void), - const char *path, const char *fmt, ...) - __attribute__ ((format (scanf, 5, 6))); - -int file_lines_scanf(const char *file, const int lineno, - void (*cleanup_fn)(void), int strict, - const char *path, const char *fmt, ...) - __attribute__ ((format (scanf, 6, 7))); - -/* - * All-in-one function that lets you printf directly into a file. - */ -int file_printf(const char *file, const int lineno, - const char *path, const char *fmt, ...) - __attribute__ ((format (printf, 4, 5))); - -void safe_file_printf(const char *file, const int lineno, - void (*cleanup_fn)(void), - const char *path, const char *fmt, ...) - __attribute__ ((format (printf, 5, 6))); - -/* - * Safe function to copy files, no more system("cp ...") please. - */ -void safe_cp(const char *file, const int lineno, - void (*cleanup_fn)(void), - const char *src, const char *dst); - -/* - * Safe function to touch a file. - * - * If the file (pathname) does not exist It will be created with - * the specified permission (mode) and the access/modification times (times). - * - * If mode is 0 then the file is created with (0666 & ~umask) - * permission or (if the file exists) the permission is not changed. - * - * times is a timespec[2] (as for utimensat(2)). If times is NULL then - * the access/modification times of the file is set to the current time. - */ -void safe_touch(const char *file, const int lineno, - void (*cleanup_fn)(void), - const char *pathname, - mode_t mode, const struct timespec times[2]); - -/* helper functions to setup overlayfs mountpoint */ -void create_overlay_dirs(void); -int mount_overlay(const char *file, const int lineno, int skip); - -#endif /* SAFE_FILE_OPS_FN */ diff --git a/fsstress/include/safe_macros_fn.h b/fsstress/include/safe_macros_fn.h deleted file mode 100644 index 3df952811b..0000000000 --- a/fsstress/include/safe_macros_fn.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Safe macros for commonly used syscalls to reduce code duplication in LTP - * testcases, and to ensure all errors are caught in said testcases as - * gracefully as possible. - * - * Also satiates some versions of gcc/glibc when the warn_unused_result - * attribute is applied to the function call. - * - * Licensed under the GPLv2. - */ - -#ifndef SAFE_MACROS_FN_H__ -#define SAFE_MACROS_FN_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -char* safe_basename(const char *file, const int lineno, - void (*cleanup_fn)(void), char *path); - -int safe_chdir(const char *file, const int lineno, - void (*cleanup_fn)(void), const char *path); - -int safe_close(const char *file, const int lineno, - void (*cleanup_fn)(void), int fildes); - -int safe_creat(const char *file, const int lineno, - void (*cleanup_fn)(void), const char *pathname, mode_t mode); - -char* safe_dirname(const char *file, const int lineno, - void (*cleanup_fn)(void), char *path); - -char* safe_getcwd(const char *file, const int lineno, - void (*cleanup_fn)(void), char *buf, size_t size); - -struct passwd* safe_getpwnam(const char *file, const int lineno, - void (*cleanup_fn)(void), const char *name); - -int safe_getrusage(const char *file, const int lineno, - void (*cleanup_fn)(void), int who, struct rusage *usage); - -void* safe_malloc(const char *file, const int lineno, - void (*cleanup_fn)(void), size_t size); - -int safe_mkdir(const char *file, const int lineno, - void (*cleanup_fn)(void), const char *pathname, mode_t mode); - -int safe_rmdir(const char *file, const int lineno, - void (*cleanup_fn)(void), const char *pathname); - - -int safe_munmap(const char *file, const int lineno, - void (*cleanup_fn)(void), void *addr, size_t length); - -int safe_open(const char *file, const int lineno, - void (*cleanup_fn)(void), const char *pathname, int oflags, ...); - -int safe_pipe(const char *file, const int lineno, - void (*cleanup_fn)(void), int fildes[2]); - -ssize_t safe_read(const char *file, const int lineno, - void (*cleanup_fn)(void), char len_strict, int fildes, - void *buf, size_t nbyte); - -int safe_setegid(const char *file, const int lineno, - void (*cleanup_fn)(void), gid_t egid); - -int safe_seteuid(const char *file, const int lineno, - void (*cleanup_fn)(void), uid_t euid); - -int safe_setgid(const char *file, const int lineno, - void (*cleanup_fn)(void), gid_t gid); - -int safe_setuid(const char *file, const int lineno, - void (*cleanup_fn)(void), uid_t uid); - -int safe_getresuid(const char *file, const int lineno, - void (*cleanup_fn)(void), - uid_t *ruid, uid_t *euid, uid_t *suid); - -int safe_getresgid(const char *file, const int lineno, - void (*cleanup_fn)(void), - gid_t *rgid, gid_t *egid, gid_t *sgid); - -int safe_unlink(const char *file, const int lineno, - void (*cleanup_fn)(void), const char *pathname); - -int safe_link(const char *file, const int lineno, - void (cleanup_fn)(void), const char *oldpath, - const char *newpath); - -int safe_linkat(const char *file, const int lineno, - void (cleanup_fn)(void), int olddirfd, const char *oldpath, - int newdirfd, const char *newpath, int flags); - -ssize_t safe_readlink(const char *file, const int lineno, - void (cleanup_fn)(void), const char *path, - char *buf, size_t bufsize); - -int safe_symlink(const char *file, const int lineno, - void (cleanup_fn)(void), const char *oldpath, - const char *newpath); - -ssize_t safe_write(const char *file, const int lineno, - void (cleanup_fn)(void), char len_strict, int fildes, - const void *buf, size_t nbyte); - -long safe_strtol(const char *file, const int lineno, - void (cleanup_fn)(void), char *str, long min, long max); - -unsigned long safe_strtoul(const char *file, const int lineno, - void (cleanup_fn)(void), - char *str, unsigned long min, unsigned long max); - -long safe_sysconf(const char *file, const int lineno, - void (cleanup_fn)(void), int name); - -int safe_chmod(const char *file, const int lineno, void (cleanup_fn)(void), - const char *path, mode_t mode); - -int safe_fchmod(const char *file, const int lineno, void (cleanup_fn)(void), - int fd, mode_t mode); - -int safe_chown(const char *file, const int lineno, void (cleanup_fn)(void), - const char *path, uid_t owner, gid_t group); - -int safe_fchown(const char *file, const int lineno, void (cleanup_fn)(void), - int fd, uid_t owner, gid_t group); - -pid_t safe_wait(const char *file, const int lineno, void (cleanup_fn)(void), - int *status); - -pid_t safe_waitpid(const char *file, const int lineno, void (cleanup_fn)(void), - pid_t pid, int *status, int opts); - -int safe_kill(const char *file, const int lineno, void (cleanup_fn)(void), - pid_t pid, int sig); - -void *safe_memalign(const char *file, const int lineno, - void (*cleanup_fn)(void), size_t alignment, size_t size); - -int safe_mkfifo(const char *file, const int lineno, - void (*cleanup_fn)(void), const char *pathname, mode_t mode); - -int safe_rename(const char *file, const int lineno, void (*cleanup_fn)(void), - const char *oldpath, const char *newpath); - -int safe_mount(const char *file, const int lineno, void (*cleanup_fn)(void), - const char *source, const char *target, - const char *filesystemtype, unsigned long mountflags, - const void *data); - -int safe_umount(const char *file, const int lineno, void (*cleanup_fn)(void), - const char *target); - -DIR* safe_opendir(const char *file, const int lineno, void (cleanup_fn)(void), - const char *name); - -int safe_closedir(const char *file, const int lineno, void (cleanup_fn)(void), - DIR *dirp); - -struct dirent *safe_readdir(const char *file, const int lineno, - void (cleanup_fn)(void), - DIR *dirp); - -DIR* safe_opendir(const char *file, const int lineno, - void (cleanup_fn)(void), - const char *name); - -struct dirent *safe_readdir(const char *file, const int lineno, - void (cleanup_fn)(void), - DIR *dirp); - -int safe_closedir(const char *file, const int lineno, - void (cleanup_fn)(void), - DIR *dirp); - -#endif /* SAFE_MACROS_FN_H__ */ diff --git a/fsstress/include/safe_net_fn.h b/fsstress/include/safe_net_fn.h deleted file mode 100644 index 2fda11fab7..0000000000 --- a/fsstress/include/safe_net_fn.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2016 Cyril Hrubis - * Copyright (c) 2015 Fujitsu Ltd. - * - * 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, see . - */ - -#ifndef SAFE_NET_FN_H__ -#define SAFE_NET_FN_H__ - -#include -#include -#include -#include -#include - -int safe_socket(const char *file, const int lineno, void (cleanup_fn)(void), - int domain, int type, int protocol); - -int safe_socketpair(const char *file, const int lineno, int domain, int type, - int protocol, int sv[]); - -int safe_getsockopt(const char *file, const int lineno, int sockfd, int level, - int optname, void *optval, socklen_t *optlen); - -int safe_setsockopt(const char *file, const int lineno, int sockfd, int level, - int optname, const void *optval, socklen_t optlen); - -ssize_t safe_send(const char *file, const int lineno, char len_strict, - int sockfd, const void *buf, size_t len, int flags); - -ssize_t safe_sendto(const char *file, const int lineno, char len_strict, - int sockfd, const void *buf, size_t len, int flags, - const struct sockaddr *dest_addr, socklen_t addrlen); - -ssize_t safe_sendmsg(const char *file, const int lineno, size_t msg_len, - int sockfd, const struct msghdr *msg, int flags); - -ssize_t safe_recvmsg(const char *file, const int lineno, size_t msg_len, - int sockfd, struct msghdr *msg, int flags); - -int safe_bind(const char *file, const int lineno, void (cleanup_fn)(void), - int socket, const struct sockaddr *address, - socklen_t address_len); - -int safe_listen(const char *file, const int lineno, void (cleanup_fn)(void), - int socket, int backlog); - -int safe_accept(const char *file, const int lineno, void (cleanup_fn)(void), - int sockfd, struct sockaddr *addr, socklen_t *addrlen); - -int safe_connect(const char *file, const int lineno, void (cleanup_fn)(void), - int sockfd, const struct sockaddr *addr, socklen_t addrlen); - -int safe_getsockname(const char *file, const int lineno, - void (cleanup_fn)(void), int sockfd, struct sockaddr *addr, - socklen_t *addrlen); - -int safe_gethostname(const char *file, const int lineno, - char *name, size_t size); - -int tst_getsockport(const char *file, const int lineno, int sockfd); - -unsigned short tst_get_unused_port(const char *file, const int lineno, - void (cleanup_fn)(void), unsigned short family, int type); - -char *tst_sock_addr(const struct sockaddr *sa, socklen_t salen, char *res, - size_t len); - -#endif /* SAFE_NET_FN_H__ */ diff --git a/fsstress/include/safe_stdio_fn.h b/fsstress/include/safe_stdio_fn.h deleted file mode 100644 index 3818a86571..0000000000 --- a/fsstress/include/safe_stdio_fn.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2013-2016 Cyril Hrubis - * - * 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, see . - */ - -#ifndef SAFE_STDIO_FN_H__ -#define SAFE_STDIO_FN_H__ - -#include - -FILE *safe_fopen(const char *file, const int lineno, void (cleanup_fn)(void), - const char *path, const char *mode); - -int safe_fclose(const char *file, const int lineno, void (cleanup_fn)(void), - FILE *f); - -int safe_asprintf(const char *file, const int lineno, void (cleanup_fn)(void), - char **strp, const char *fmt, ...); - -FILE *safe_popen(const char *file, const int lineno, void (cleanup_fn)(void), - const char *command, const char *type); - -#endif /* SAFE_STDIO_FN_H__ */ diff --git a/fsstress/include/stamp-h1 b/fsstress/include/stamp-h1 deleted file mode 100644 index b330768e9b..0000000000 --- a/fsstress/include/stamp-h1 +++ /dev/null @@ -1 +0,0 @@ -timestamp for include/config.h diff --git a/fsstress/include/tst_af_alg.h b/fsstress/include/tst_af_alg.h deleted file mode 100644 index fc4b1989a2..0000000000 --- a/fsstress/include/tst_af_alg.h +++ /dev/null @@ -1,136 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright 2019 Google LLC - */ -/** - * @file tst_af_alg.h - * - * Library for accessing kernel crypto algorithms via AF_ALG. - * - * See https://www.kernel.org/doc/html/latest/crypto/userspace-if.html - * for more information about AF_ALG. - */ - -#ifndef TST_AF_ALG_H -#define TST_AF_ALG_H - -#include "lapi/if_alg.h" -#include - -/** - * Create an AF_ALG algorithm socket. - * - * This creates an AF_ALG algorithm socket that is initially not bound to any - * particular algorithm. On failure, tst_brk() is called with TCONF if the - * kernel doesn't support AF_ALG, otherwise TBROK. - * - * @return a new AF_ALG algorithm socket - */ -int tst_alg_create(void); - -/** - * Bind an AF_ALG algorithm socket to an algorithm. - * - * @param algfd An AF_ALG algorithm socket - * @param addr A structure which specifies the algorithm to use - * - * On failure, tst_brk() is called with TCONF if the kernel doesn't support the - * specified algorithm, otherwise TBROK. - */ -void tst_alg_bind_addr(int algfd, const struct sockaddr_alg *addr); - -/** - * Bind an AF_ALG algorithm socket to an algorithm. - * - * @param algfd An AF_ALG algorithm socket - * @param algtype The type of algorithm, such as "hash" or "skcipher" - * @param algname The name of the algorithm, such as "sha256" or "xts(aes)" - * - * Like tst_alg_bind_addr(), except this just takes in the algorithm type and - * name. The 'feat' and 'mask' fields are left 0. - * - * On failure, tst_brk() is called with TCONF if the kernel doesn't support the - * specified algorithm, otherwise TBROK. - */ -void tst_alg_bind(int algfd, const char *algtype, const char *algname); - -/** - * Check for the availability of an algorithm. - * - * @param algtype The type of algorithm, such as "hash" or "skcipher" - * @param algname The name of the algorithm, such as "sha256" or "xts(aes)" - * - * Return true if the algorithm is available, or false if unavailable. - * If another error occurs, tst_brk() is called with TBROK. - */ -bool tst_have_alg(const char *algtype, const char *algname); - -/** - * Require the availability of an algorithm. - * - * @param algtype The type of algorithm, such as "hash" or "skcipher" - * @param algname The name of the algorithm, such as "sha256" or "xts(aes)" - * - * If the algorithm is unavailable, tst_brk() is called with TCONF. - * If another error occurs, tst_brk() is called with TBROK. - */ -void tst_require_alg(const char *algtype, const char *algname); - -/** - * Assign a cryptographic key to an AF_ALG algorithm socket. - * - * @param algfd An AF_ALG algorithm socket - * @param key Pointer to the key. If NULL, a random key is generated. - * @param keylen Length of the key in bytes - * - * On failure, tst_brk() is called with TBROK. - */ -void tst_alg_setkey(int algfd, const uint8_t *key, unsigned int keylen); - -/** - * Create an AF_ALG request socket for the given algorithm socket. - * - * @param algfd An AF_ALG algorithm socket - * - * This creates a request socket for the given algorithm socket, which must be - * bound to an algorithm. The same algorithm socket can have many request - * sockets used concurrently to perform independent cryptographic operations, - * e.g. hashing or encryption/decryption. But the key, if any, that has been - * assigned to the algorithm is shared by all request sockets. - * - * On failure, tst_brk() is called with TBROK. - * - * @return a new AF_ALG request socket - */ -int tst_alg_accept(int algfd); - -/** - * Set up an AF_ALG algorithm socket for the given algorithm w/ given key. - * - * @param algtype The type of algorithm, such as "hash" or "skcipher" - * @param algname The name of the algorithm, such as "sha256" or "xts(aes)" - * @param key The key to use (optional) - * @param keylen The length of the key in bytes (optional) - * - * This is a helper function which creates an AF_ALG algorithm socket, binds it - * to the specified algorithm, and optionally sets a key. If keylen is 0 then - * no key is set; otherwise if key is NULL a key of the given length is randomly - * generated and set; otherwise the given key is set. - * - * @return the AF_ALG algorithm socket that was set up - */ -int tst_alg_setup(const char *algtype, const char *algname, - const uint8_t *key, unsigned int keylen); - -/** - * Set up an AF_ALG request socket for the given algorithm w/ given key. - * - * This is like tst_alg_setup(), except this returns a request fd instead of the - * alg fd. The alg fd is closed, so it doesn't need to be kept track of. - * - * @return the AF_ALG request socket that was set up - */ -int tst_alg_setup_reqfd(const char *algtype, const char *algname, - const uint8_t *key, unsigned int keylen); - -#endif /* TST_AF_ALG_H */ diff --git a/fsstress/include/tst_ansi_color.h b/fsstress/include/tst_ansi_color.h deleted file mode 100644 index 770bf46d96..0000000000 --- a/fsstress/include/tst_ansi_color.h +++ /dev/null @@ -1,22 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2017 Petr Vorel - */ - -#ifndef TST_ANSI_COLOR_H__ -#define TST_ANSI_COLOR_H__ -/* - * NOTE: these colors should match colors defined in tst_flag2color() in - * testcases/lib/tst_ansi_color.sh - */ -#define ANSI_COLOR_BLUE "\033[1;34m" -#define ANSI_COLOR_GREEN "\033[1;32m" -#define ANSI_COLOR_MAGENTA "\033[1;35m" -#define ANSI_COLOR_RED "\033[1;31m" -#define ANSI_COLOR_YELLOW "\033[1;33m" - -#define ANSI_COLOR_RESET "\033[0m" - -char* tst_ttype2color(int ttype); -int tst_color_enabled(int fd); - -#endif /* TST_ANSI_COLOR_H__ */ diff --git a/fsstress/include/tst_assert.h b/fsstress/include/tst_assert.h deleted file mode 100644 index 9969a81690..0000000000 --- a/fsstress/include/tst_assert.h +++ /dev/null @@ -1,56 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved. - * Author: Yang Xu - * Copyright (c) 2020 Cyril Hrubis - */ -#ifndef TST_ASSERT_H__ -#define TST_ASSERT_H__ - -#define TST_ASSERT_INT(path, val) \ - tst_assert_int(__FILE__, __LINE__, path, val) - -/* - * Asserts that integer value stored in file pointed by path equals to the - * value passed to this function. This is mostly useful for asserting correct - * values in sysfs, procfs, etc. - */ -void tst_assert_int(const char *file, const int lineno, - const char *path, int val); - -#define TST_ASSERT_FILE_INT(path, prefix, val) \ - tst_assert_file_int(__FILE__, __LINE__, path, prefix, val) - -/* - * Asserts that integer value stored in the prefix field of file pointed by path - * equals to the value passed to this function. This is mostly useful for - * asserting correct field values in sysfs, procfs, etc. - */ - -void tst_assert_file_int(const char *file, const int lineno, - const char *path, const char *prefix, int val); - - -#define TST_ASSERT_STR(path, val) \ - tst_assert_str(__FILE__, __LINE__, path, val) - -/* - * Asserts that a string value stored in file pointed by path equals to the - * value passed to this function. This is mostly useful for asserting correct - * values in sysfs, procfs, etc. - */ -void tst_assert_str(const char *file, const int lineno, - const char *path, const char *val); - -#define TST_ASSERT_FILE_STR(path, prefix, val) \ - tst_assert_file_str(__FILE__, __LINE__, path, prefix, val) - -/* - * Asserts that a string value stored in the prefix field of file pointed by path - * equals to the value passed to this function. This is mostly useful for - * asserting correct field values in sysfs, procfs, etc. - */ -void tst_assert_file_str(const char *file, const int lineno, - const char *path, const char *prefix, const char *val); - -#endif /* TST_ASSERT_H__ */ diff --git a/fsstress/include/tst_atomic.h b/fsstress/include/tst_atomic.h deleted file mode 100644 index 061cd3dc63..0000000000 --- a/fsstress/include/tst_atomic.h +++ /dev/null @@ -1,334 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2016 Cyril Hrubis - */ - -/* The LTP library has some of its own atomic synchronisation primitives - * contained in this file. Generally speaking these should not be used - * directly in tests for synchronisation, instead use tst_checkpoint.h, - * tst_fuzzy_sync.h or the POSIX library. - * - * Notes on compile and runtime memory barriers and atomics. - * - * Within the LTP library we have three concerns when accessing variables - * shared by multiple threads or processes: - * - * (1) Removal or reordering of accesses by the compiler. - * (2) Atomicity of addition. - * (3) LOAD-STORE ordering between threads. - * - * The first (1) is the most likely to cause an error if not properly - * handled. We avoid it by using volatile variables and statements which will - * not be removed or reordered by the compiler during optimisation. This includes - * the __atomic and __sync intrinsics and volatile asm statements marked with - * "memory" as well as variables marked with volatile. - * - * On any platform Linux is likely to run on, a LOAD (fetch) or STORE of a - * 32-bit integer will be atomic. However fetching and adding to a variable is - * quite likely not; so for (2) we need to ensure we use atomic addition. - * - * Finally, for tst_fuzzy_sync at least, we need to ensure that LOADs and - * STOREs of any shared variables (including non-atomics) that are made - * between calls to tst_fzsync_wait are completed (globally visible) before - * tst_fzsync_wait completes. For this, runtime memory and instruction - * barriers are required in addition to compile time. - * - * We use full sequential ordering (__ATOMIC_SEQ_CST) for the sake of - * simplicity. LTP tests tend to be syscall heavy so any performance gain from - * using a weaker memory model is unlikely to result in a relatively large - * performance improvement while at the same time being a potent source of - * confusion. - * - * Likewise, for the fallback ASM, the simplest "definitely will work, always" - * approach is preferred over anything more performant. - * - * Also see Documentation/memory-barriers.txt in the kernel tree and - * https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html - * terminology may vary between sources. - */ - -#ifndef TST_ATOMIC_H__ -#define TST_ATOMIC_H__ - -#include "config.h" - -#if HAVE_ATOMIC_MEMORY_MODEL == 1 -static inline int tst_atomic_add_return(int i, int *v) -{ - return __atomic_add_fetch(v, i, __ATOMIC_SEQ_CST); -} - -static inline int tst_atomic_load(int *v) -{ - return __atomic_load_n(v, __ATOMIC_SEQ_CST); -} - -static inline void tst_atomic_store(int i, int *v) -{ - __atomic_store_n(v, i, __ATOMIC_SEQ_CST); -} - -#elif HAVE_SYNC_ADD_AND_FETCH == 1 -static inline int tst_atomic_add_return(int i, int *v) -{ - return __sync_add_and_fetch(v, i); -} - -static inline int tst_atomic_load(int *v) -{ - int ret; - - __sync_synchronize(); - ret = *v; - __sync_synchronize(); - return ret; -} - -static inline void tst_atomic_store(int i, int *v) -{ - __sync_synchronize(); - *v = i; - __sync_synchronize(); -} - -#elif defined(__i386__) || defined(__x86_64__) -# define LTP_USE_GENERIC_LOAD_STORE_ASM 1 - -static inline int tst_atomic_add_return(int i, int *v) -{ - int __ret = i; - - /* - * taken from arch/x86/include/asm/cmpxchg.h - */ - asm volatile ("lock; xaddl %0, %1\n" - : "+r" (__ret), "+m" (*v) : : "memory", "cc"); - - return i + __ret; -} - -#elif defined(__powerpc__) || defined(__powerpc64__) -static inline int tst_atomic_add_return(int i, int *v) -{ - int t; - - /* taken from arch/powerpc/include/asm/atomic.h */ - asm volatile( - " sync\n" - "1: lwarx %0,0,%2 # atomic_add_return\n" - " add %0,%1,%0\n" - " stwcx. %0,0,%2 \n" - " bne- 1b\n" - " sync\n" - : "=&r" (t) - : "r" (i), "r" (v) - : "cc", "memory"); - - return t; -} - -static inline int tst_atomic_load(int *v) -{ - int ret; - - asm volatile("sync\n" : : : "memory"); - ret = *v; - asm volatile("sync\n" : : : "memory"); - - return ret; -} - -static inline void tst_atomic_store(int i, int *v) -{ - asm volatile("sync\n" : : : "memory"); - *v = i; - asm volatile("sync\n" : : : "memory"); -} - -#elif defined(__s390__) || defined(__s390x__) -# define LTP_USE_GENERIC_LOAD_STORE_ASM 1 - -static inline int tst_atomic_add_return(int i, int *v) -{ - int old_val, new_val; - - /* taken from arch/s390/include/asm/atomic.h */ - asm volatile( - " l %0,%2\n" - "0: lr %1,%0\n" - " ar %1,%3\n" - " cs %0,%1,%2\n" - " jl 0b" - : "=&d" (old_val), "=&d" (new_val), "+Q" (*v) - : "d" (i) - : "cc", "memory"); - - return old_val + i; -} - -#elif defined(__arc__) - -/*ARCv2 defines the smp barriers */ -#ifdef __ARC700__ -#define smp_mb() asm volatile("" : : : "memory") -#else -#define smp_mb() asm volatile("dmb 3\n" : : : "memory") -#endif - -static inline int tst_atomic_add_return(int i, int *v) -{ - unsigned int val; - - smp_mb(); - - asm volatile( - "1: llock %[val], [%[ctr]] \n" - " add %[val], %[val], %[i] \n" - " scond %[val], [%[ctr]] \n" - " bnz 1b \n" - : [val] "=&r" (val) - : [ctr] "r" (v), - [i] "ir" (i) - : "cc", "memory"); - - smp_mb(); - - return val; -} - -static inline int tst_atomic_load(int *v) -{ - int ret; - - smp_mb(); - ret = *v; - smp_mb(); - - return ret; -} - -static inline void tst_atomic_store(int i, int *v) -{ - smp_mb(); - *v = i; - smp_mb(); -} - -#elif defined (__aarch64__) -static inline int tst_atomic_add_return(int i, int *v) -{ - unsigned long tmp; - int result; - - __asm__ __volatile__( -" prfm pstl1strm, %2 \n" -"1: ldaxr %w0, %2 \n" -" add %w0, %w0, %w3 \n" -" stlxr %w1, %w0, %2 \n" -" cbnz %w1, 1b \n" -" dmb ish \n" - : "=&r" (result), "=&r" (tmp), "+Q" (*v) - : "Ir" (i) - : "memory"); - - return result; -} - -/* We are using load and store exclusive (ldaxr & stlxr) instructions to try - * and help prevent the tst_atomic_load and, more likely, tst_atomic_store - * functions from interfering with tst_atomic_add_return which takes advantage - * of exclusivity. It is not clear if this is a good idea or not, but does - * mean that all three functions are very similar. - */ -static inline int tst_atomic_load(int *v) -{ - int ret; - unsigned long tmp; - - asm volatile("//atomic_load \n" - " prfm pstl1strm, %[v] \n" - "1: ldaxr %w[ret], %[v] \n" - " stlxr %w[tmp], %w[ret], %[v] \n" - " cbnz %w[tmp], 1b \n" - " dmb ish \n" - : [tmp] "=&r" (tmp), [ret] "=&r" (ret), [v] "+Q" (*v) - : : "memory"); - - return ret; -} - -static inline void tst_atomic_store(int i, int *v) -{ - unsigned long tmp; - - asm volatile("//atomic_store \n" - " prfm pstl1strm, %[v] \n" - "1: ldaxr %w[tmp], %[v] \n" - " stlxr %w[tmp], %w[i], %[v] \n" - " cbnz %w[tmp], 1b \n" - " dmb ish \n" - : [tmp] "=&r" (tmp), [v] "+Q" (*v) - : [i] "r" (i) - : "memory"); -} - -#elif defined(__sparc__) && defined(__arch64__) -# define LTP_USE_GENERIC_LOAD_STORE_ASM 1 -static inline int tst_atomic_add_return(int i, int *v) -{ - int ret, tmp; - - /* Based on arch/sparc/lib/atomic_64.S with the exponential backoff - * function removed because we are unlikely to have a large (>= 16?) - * number of cores continuously trying to update one variable. - */ - asm volatile("/*atomic_add_return*/ \n" - "1: ldsw [%[v]], %[ret]; \n" - " add %[ret], %[i], %[tmp]; \n" - " cas [%[v]], %[ret], %[tmp]; \n" - " cmp %[ret], %[tmp]; \n" - " bne,pn %%icc, 1b; \n" - " nop; \n" - " add %[ret], %[i], %[ret]; \n" - : [ret] "=r&" (ret), [tmp] "=r&" (tmp) - : [i] "r" (i), [v] "r" (v) - : "memory", "cc"); - - return ret; -} - -#else /* HAVE_SYNC_ADD_AND_FETCH == 1 */ -# error Your compiler does not provide __atomic_add_fetch, __sync_add_and_fetch \ - and an LTP implementation is missing for your architecture. -#endif - -#ifdef LTP_USE_GENERIC_LOAD_STORE_ASM -static inline int tst_atomic_load(int *v) -{ - int ret; - - asm volatile("" : : : "memory"); - ret = *v; - asm volatile("" : : : "memory"); - - return ret; -} - -static inline void tst_atomic_store(int i, int *v) -{ - asm volatile("" : : : "memory"); - *v = i; - asm volatile("" : : : "memory"); -} -#endif - -static inline int tst_atomic_inc(int *v) -{ - return tst_atomic_add_return(1, v); -} - -static inline int tst_atomic_dec(int *v) -{ - return tst_atomic_add_return(-1, v); -} - -#endif /* TST_ATOMIC_H__ */ diff --git a/fsstress/include/tst_buffers.h b/fsstress/include/tst_buffers.h deleted file mode 100644 index d19ac8cf07..0000000000 --- a/fsstress/include/tst_buffers.h +++ /dev/null @@ -1,63 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2019 Cyril Hrubis - */ - -#ifndef TST_BUFFERS_H__ -#define TST_BUFFERS_H__ - -/* - * Buffer description consist of a pointer to a pointer and buffer type/size - * encoded as a different structure members. - * - * Only one of the size and iov_sizes can be set at a time. - */ -struct tst_buffers { - /* - * This pointer points to a buffer pointer. - */ - void *ptr; - /* - * Buffer size. - */ - size_t size; - /* - * Array of iov buffer sizes terminated by -1. - */ - int *iov_sizes; -}; - -/* - * Allocates buffers based on the tst_buffers structure. - * - * @bufs NULL terminated array of test buffer descriptions. - * - * This is called from the test library if the tst_test->bufs pointer is set. - */ -void tst_buffers_alloc(struct tst_buffers bufs[]); - -/* - * strdup() that callls tst_alloc(). - */ -char *tst_strdup(const char *str); - -/* - * Allocates size bytes, returns pointer to the allocated buffer. - */ -void *tst_alloc(size_t size); - -/* - * Allocates iovec structure including the buffers. - * - * @sizes -1 terminated array of buffer sizes. - */ -struct iovec *tst_iovec_alloc(int sizes[]); - -/* - * Frees all allocated buffers. - * - * This is called at the end of the test automatically. - */ -void tst_free_all(void); - -#endif /* TST_BUFFERS_H__ */ diff --git a/fsstress/include/tst_capability.h b/fsstress/include/tst_capability.h deleted file mode 100644 index 6067804a36..0000000000 --- a/fsstress/include/tst_capability.h +++ /dev/null @@ -1,83 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Copyright (c) 2019 Richard Palethorpe - */ -/** - * @file tst_capability.h - * - * Limited capability operations without libcap. - */ - -#ifndef TST_CAPABILITY_H -#define TST_CAPABILITY_H - -#include - -#include "lapi/capability.h" - -#define TST_CAP_DROP 1 -#define TST_CAP_REQ (1 << 1) - -#define TST_CAP(action, capability) {action, capability, #capability} - -struct tst_cap_user_header { - uint32_t version; - int pid; -}; - -struct tst_cap_user_data { - uint32_t effective; - uint32_t permitted; - uint32_t inheritable; -}; - -struct tst_cap { - uint32_t action; - uint32_t id; - char *name; -}; - -/** - * Get the capabilities as decided by hdr. - * - * Note that the memory pointed to by data should be large enough to store two - * structs. - */ -int tst_capget(struct tst_cap_user_header *hdr, - struct tst_cap_user_data *data); - -/** - * Set the capabilities as decided by hdr and data - * - * Note that the memory pointed to by data should be large enough to store two - * structs. - */ -int tst_capset(struct tst_cap_user_header *hdr, - const struct tst_cap_user_data *data); - -/** - * Add, check or remove a capability - * - * It will attempt to drop or add capability to the effective set. It will - * try to detect if this is needed and whether it can or can't be done. If it - * clearly can not add a privilege to the effective set then it will return - * TCONF. However it may fail for some other reason and return TBROK. - * - * This only tries to change the effective set. Some tests may need to change - * the inheritable and ambient sets, so that child processes retain some - * capability. - */ -void tst_cap_action(struct tst_cap *cap); - - -/** - * Add, check or remove a capabilities - * - * Takes a NULL terminated array of structs which describe whether some - * capabilities are needed or not and mask that determines subset of the - * actions to be performed. Loops over the array and if mask matches the - * element action it's passed to tst_cap_action(). - */ -void tst_cap_setup(struct tst_cap *cap, unsigned int action_mask); - -#endif /* TST_CAPABILITY_H */ diff --git a/fsstress/include/tst_cgroup.h b/fsstress/include/tst_cgroup.h deleted file mode 100644 index 77780e0d64..0000000000 --- a/fsstress/include/tst_cgroup.h +++ /dev/null @@ -1,45 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2020 Red Hat, Inc. - * Copyright (c) 2020 Li Wang - */ - -#ifndef TST_CGROUP_H -#define TST_CGROUP_H - -#define PATH_TMP_CG_MEM "/tmp/cgroup_mem" -#define PATH_TMP_CG_CST "/tmp/cgroup_cst" - -enum tst_cgroup_ver { - TST_CGROUP_V1 = 1, - TST_CGROUP_V2 = 2, -}; - -enum tst_cgroup_ctrl { - TST_CGROUP_MEMCG = 1, - TST_CGROUP_CPUSET = 2, - /* add cgroup controller */ -}; - -enum tst_cgroup_ver tst_cgroup_version(void); - -/* To mount/umount specified cgroup controller on 'cgroup_dir' path */ -void tst_cgroup_mount(enum tst_cgroup_ctrl ctrl, const char *cgroup_dir); -void tst_cgroup_umount(const char *cgroup_dir); - -/* To move current process PID to the mounted cgroup tasks */ -void tst_cgroup_move_current(const char *cgroup_dir); - -/* To set cgroup controller knob with new value */ -void tst_cgroup_set_knob(const char *cgroup_dir, const char *knob, long value); - -/* Set of functions to set knobs under the memory controller */ -void tst_cgroup_mem_set_maxbytes(const char *cgroup_dir, long memsz); -int tst_cgroup_mem_swapacct_enabled(const char *cgroup_dir); -void tst_cgroup_mem_set_maxswap(const char *cgroup_dir, long memsz); - -/* Set of functions to read/write cpuset controller files content */ -void tst_cgroup_cpuset_read_files(const char *cgroup_dir, const char *filename, char *retbuf); -void tst_cgroup_cpuset_write_files(const char *cgroup_dir, const char *filename, const char *buf); - -#endif /* TST_CGROUP_H */ diff --git a/fsstress/include/tst_checkpoint.h b/fsstress/include/tst_checkpoint.h deleted file mode 100644 index 5c8067d0dc..0000000000 --- a/fsstress/include/tst_checkpoint.h +++ /dev/null @@ -1,28 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2016 Cyril Hrubis - */ - -#ifndef TST_CHECKPOINT__ -#define TST_CHECKPOINT__ - -#include "tst_checkpoint_fn.h" - -#define TST_CHECKPOINT_WAIT(id) \ - tst_safe_checkpoint_wait(__FILE__, __LINE__, NULL, id, 0); - -#define TST_CHECKPOINT_WAIT2(id, msec_timeout) \ - tst_safe_checkpoint_wait(__FILE__, __LINE__, NULL, id, msec_timeout); - -#define TST_CHECKPOINT_WAKE(id) \ - tst_safe_checkpoint_wake(__FILE__, __LINE__, NULL, id, 1); - -#define TST_CHECKPOINT_WAKE2(id, nr_wake) \ - tst_safe_checkpoint_wake(__FILE__, __LINE__, NULL, id, nr_wake); - -#define TST_CHECKPOINT_WAKE_AND_WAIT(id) \ - tst_safe_checkpoint_wake(__FILE__, __LINE__, NULL, id, 1); \ - tst_safe_checkpoint_wait(__FILE__, __LINE__, NULL, id, 0); - -extern const char *tst_ipc_path; - -#endif /* TST_CHECKPOINT__ */ diff --git a/fsstress/include/tst_checkpoint_fn.h b/fsstress/include/tst_checkpoint_fn.h deleted file mode 100644 index 57db905c83..0000000000 --- a/fsstress/include/tst_checkpoint_fn.h +++ /dev/null @@ -1,42 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2015-2016 Cyril Hrubis - */ - -#ifndef TST_CHECKPOINT_FN__ -#define TST_CHECKPOINT_FN__ - -/* - * Checkpoint initializaton, must be done first. - * - * NOTE: tst_tmpdir() must be called beforehand. - */ -void tst_checkpoint_init(const char *file, const int lineno, - void (*cleanup_fn)(void)); - -/* - * Waits for wakeup. - * - * @id: Checkpoint id, possitive number - * @msec_timeout: Timeout in milliseconds, 0 == no timeout - */ -int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout); - -/* - * Wakes up sleeping process(es)/thread(s). - * - * @id: Checkpoint id, possitive number - * @nr_wake: Number of processes/threads to wake up - * @msec_timeout: Timeout in milliseconds, 0 == no timeout - */ -int tst_checkpoint_wake(unsigned int id, unsigned int nr_wake, - unsigned int msec_timeout); - -void tst_safe_checkpoint_wait(const char *file, const int lineno, - void (*cleanup_fn)(void), unsigned int id, - unsigned int msec_timeout); - -void tst_safe_checkpoint_wake(const char *file, const int lineno, - void (*cleanup_fn)(void), unsigned int id, - unsigned int nr_wake); - -#endif /* TST_CHECKPOINT_FN__ */ diff --git a/fsstress/include/tst_checksum.h b/fsstress/include/tst_checksum.h deleted file mode 100644 index f062869de8..0000000000 --- a/fsstress/include/tst_checksum.h +++ /dev/null @@ -1,16 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2018 Oracle and/or its affiliates. All Rights Reserved. - */ - -#ifndef TST_CHECKSUM_H__ -#define TST_CHECKSUM_H__ - -#include -#include - -/* - * Generates CRC32c checksum. - */ -uint32_t tst_crc32c(uint8_t *buf, size_t buf_len); - -#endif diff --git a/fsstress/include/tst_clocks.h b/fsstress/include/tst_clocks.h deleted file mode 100644 index 80030c6b0c..0000000000 --- a/fsstress/include/tst_clocks.h +++ /dev/null @@ -1,23 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2017 Cyril Hrubis - */ - -/* - * clock_gettime() and clock_getres() functions - */ - -#ifndef TST_CLOCKS__ -#define TST_CLOCKS__ - -int tst_clock_getres(clockid_t clk_id, struct timespec *res); - -int tst_clock_gettime(clockid_t clk_id, struct timespec *ts); - -int tst_clock_settime(clockid_t clk_id, struct timespec *ts); - -/* - * Converts clock id to a readable name. - */ -const char *tst_clock_name(clockid_t clk_id); - -#endif /* TST_CLOCKS__ */ diff --git a/fsstress/include/tst_clone.h b/fsstress/include/tst_clone.h deleted file mode 100644 index 88188525d0..0000000000 --- a/fsstress/include/tst_clone.h +++ /dev/null @@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2016 Xiao Yang - */ - -#ifndef TST_CLONE_H__ -#define TST_CLONE_H__ - -/* Functions from lib/cloner.c */ -int ltp_clone(unsigned long flags, int (*fn)(void *arg), void *arg, - size_t stack_size, void *stack); -int ltp_clone7(unsigned long flags, int (*fn)(void *arg), void *arg, - size_t stack_size, void *stack, ...); -int ltp_clone_alloc(unsigned long clone_flags, int (*fn)(void *arg), - void *arg, size_t stacksize); -int ltp_clone_quick(unsigned long clone_flags, int (*fn)(void *arg), - void *arg); -void *ltp_alloc_stack(size_t size); - -#define clone(...) (use_the_ltp_clone_functions__do_not_use_clone) - -#endif /* TST_CLONE_H__ */ diff --git a/fsstress/include/tst_cmd.h b/fsstress/include/tst_cmd.h deleted file mode 100644 index 1f39f690f3..0000000000 --- a/fsstress/include/tst_cmd.h +++ /dev/null @@ -1,94 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2015-2016 Cyril Hrubis - */ - -#ifndef TST_CMD_H__ -#define TST_CMD_H__ - -enum tst_cmd_flags { - /* - * return the program exit code, otherwise it will call cleanup_fn() if the - * program exit code is not zero. - */ - TST_CMD_PASS_RETVAL = 1, - - /* exit with TCONF if program is not in path */ - TST_CMD_TCONF_ON_MISSING = 2, -}; - -/* - * vfork() + execvp() specified program. - * @argv: a list of two (at least program name + NULL) or more pointers that - * represent the argument list to the new program. The array of pointers - * must be terminated by a NULL pointer. - * @stdout_fd: file descriptor where to redirect stdout. Set -1 if - * redirection is not needed. - * @stderr_fd: file descriptor where to redirect stderr. Set -1 if - * redirection is not needed. - * @flags: enum tst_cmd_flags - */ -int tst_cmd_fds_(void (cleanup_fn)(void), - const char *const argv[], - int stdout_fd, - int stderr_fd, - enum tst_cmd_flags flags); - -/* Executes tst_cmd_fds() and redirects its output to a file - * @stdout_path: path where to redirect stdout. Set NULL if redirection is - * not needed. - * @stderr_path: path where to redirect stderr. Set NULL if redirection is - * not needed. - * @flags: enum tst_cmd_flags - */ -int tst_cmd_(void (cleanup_fn)(void), - const char *const argv[], - const char *stdout_path, - const char *stderr_path, - enum tst_cmd_flags flags); - -#ifdef TST_TEST_H__ -static inline int tst_cmd_fds(const char *const argv[], - int stdout_fd, - int stderr_fd, - enum tst_cmd_flags flags) -{ - return tst_cmd_fds_(NULL, argv, - stdout_fd, stderr_fd, flags); -} - -static inline int tst_cmd(const char *const argv[], - const char *stdout_path, - const char *stderr_path, - enum tst_cmd_flags flags) -{ - return tst_cmd_(NULL, argv, - stdout_path, stderr_path, flags); -} -#else -static inline int tst_cmd_fds(void (cleanup_fn)(void), - const char *const argv[], - int stdout_fd, - int stderr_fd, - enum tst_cmd_flags flags) -{ - return tst_cmd_fds_(cleanup_fn, argv, - stdout_fd, stderr_fd, flags); -} - -static inline int tst_cmd(void (cleanup_fn)(void), - const char *const argv[], - const char *stdout_path, - const char *stderr_path, - enum tst_cmd_flags flags) -{ - return tst_cmd_(cleanup_fn, argv, - stdout_path, stderr_path, flags); -} -#endif - -/* Wrapper function for system(3), ignorcing SIGCHLD signal. - * @command: the command to be run. - */ -int tst_system(const char *command); - -#endif /* TST_CMD_H__ */ diff --git a/fsstress/include/tst_common.h b/fsstress/include/tst_common.h deleted file mode 100644 index fd7a900d4a..0000000000 --- a/fsstress/include/tst_common.h +++ /dev/null @@ -1,86 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2016 Cyril Hrubis - * Copyright (c) 2013 Stanislav Kholmanskikh - * Copyright (c) 2010 Ngie Cooper - * Copyright (c) 2008 Mike Frysinger - */ - -#ifndef TST_COMMON_H__ -#define TST_COMMON_H__ - -#define LTP_ATTRIBUTE_NORETURN __attribute__((noreturn)) -#define LTP_ATTRIBUTE_UNUSED __attribute__((unused)) -#define LTP_ATTRIBUTE_UNUSED_RESULT __attribute__((warn_unused_result)) - -#ifndef ARRAY_SIZE -# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) -#endif - -/* Round x to the next multiple of a. - * a should be a power of 2. - */ -#define LTP_ALIGN(x, a) __LTP_ALIGN_MASK(x, (typeof(x))(a) - 1) -#define __LTP_ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask)) - -/** - * TST_RETRY_FUNC() - Repeatedly retry a function with an increasing delay. - * @FUNC - The function which will be retried - * @ECHCK - Function/macro for validating @FUNC return value - * - * This macro will call @FUNC in a loop with a delay between retries. - * If ECHCK(ret) evaluates to non-zero, the loop ends. The delay between - * retries starts at one microsecond and is then doubled each iteration until - * it exceeds one second (the total time sleeping will be approximately one - * second as well). When the delay exceeds one second, the loop will end. - * The TST_RETRY_FUNC() macro returns the last value returned by @FUNC. - */ -#define TST_RETRY_FUNC(FUNC, ECHCK) \ - TST_RETRY_FN_EXP_BACKOFF(FUNC, ECHCK, 1) - -#define TST_RETRY_FN_EXP_BACKOFF(FUNC, ECHCK, MAX_DELAY) \ -({ unsigned int tst_delay_, tst_max_delay_; \ - typeof(FUNC) tst_ret_; \ - tst_delay_ = 1; \ - tst_max_delay_ = tst_multiply_timeout(MAX_DELAY * 1000000); \ - for (;;) { \ - errno = 0; \ - tst_ret_ = FUNC; \ - if (ECHCK(tst_ret_)) \ - break; \ - if (tst_delay_ < tst_max_delay_) { \ - usleep(tst_delay_); \ - tst_delay_ *= 2; \ - } else { \ - break; \ - } \ - } \ - tst_ret_; \ -}) - -/* - * Return value validation macros for TST_RETRY_FUNC(): - * TST_RETVAL_EQ0() - Check that value is equal to zero - */ -#define TST_RETVAL_EQ0(x) (!(x)) - -/* - * TST_RETVAL_NOTNULL() - Check that value is not equal to zero/NULL - */ -#define TST_RETVAL_NOTNULL(x) (!!(x)) - -/* - * TST_RETVAL_GE0() - Check that value is greater than or equal to zero - */ -#define TST_RETVAL_GE0(x) ((x) >= 0) - -#define TST_BUILD_BUG_ON(condition) \ - do { ((void)sizeof(char[1 - 2 * !!(condition)])); } while (0) - -#define TST_BRK_SUPPORTS_ONLY_TCONF_TBROK(condition) \ - TST_BUILD_BUG_ON(condition) - -#define TST_RES_SUPPORTS_TCONF_TFAIL_TINFO_TPASS_TWARN(condition) \ - TST_BUILD_BUG_ON(condition) - -#endif /* TST_COMMON_H__ */ diff --git a/fsstress/include/tst_coredump.h b/fsstress/include/tst_coredump.h deleted file mode 100644 index e1f892544a..0000000000 --- a/fsstress/include/tst_coredump.h +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2019 Red Hat, Inc. - */ - -#ifndef TST_COREDUMP__ -#define TST_COREDUMP__ - -/* - * If crash is expected, avoid dumping corefile. - * 1 is a special value, that disables core-to-pipe. - * At the same time it is small enough value for - * core-to-file, so it skips creating cores as well. - */ -void tst_no_corefile(int verbose); - -#endif /* TST_COREDUMP_H */ - diff --git a/fsstress/include/tst_cpu.h b/fsstress/include/tst_cpu.h deleted file mode 100644 index c83a582600..0000000000 --- a/fsstress/include/tst_cpu.h +++ /dev/null @@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2015-2016 Cyril Hrubis - */ - -#ifndef TST_CPU_H__ -#define TST_CPU_H__ - -long tst_ncpus(void); -long tst_ncpus_conf(void); -long tst_ncpus_max(void); - -#define VIRT_ANY 0 /* catch-all argument for tst_is_virt() */ -#define VIRT_XEN 1 /* xen dom0/domU */ -#define VIRT_KVM 2 /* only default virtual CPU */ -#define VIRT_OTHER 0xffff /* unrecognized hypervisor */ - -int tst_is_virt(int virt_type); - -#endif /* TST_CPU_H__ */ diff --git a/fsstress/include/tst_crypto.h b/fsstress/include/tst_crypto.h deleted file mode 100644 index ae406bd04a..0000000000 --- a/fsstress/include/tst_crypto.h +++ /dev/null @@ -1,112 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2018 Richard Palethorpe - */ - -/** - * @file tst_crypto.h - * - * Library for interacting with kernel's crypto layer using the netlink - * interface. - */ - -#ifndef TST_CRYPTO_H -#define TST_CRYPTO_H - -#include "lapi/cryptouser.h" - -/** - * A reference to a crypto session and associated state. - * - * Holds state relevant to a netlink crypto connection. The seq_num is used - * to tag each message sent to the netlink layer and is automatically - * incremented by the tst_crypto_ functions. When the netlink layer sends a - * response (ack) it will use the sequences number from the request. - * - * Some functions, such as delete ALG, may return EBUSY in which case it is - * safe to retry them. The retries field allows you to set the number of - * times this should be done. If set to zero the operation will only be tried - * once. For operations which do not return EBUSY, the field is ignored. - * - * Use TST_CRYPTO_SESSION_INIT to statically initialize this struct with sane - * defaults. - */ -struct tst_crypto_session { - /** File descriptor for the netlink socket */ - int fd; - /** A sequence number used to identify responses from the kernel. */ - uint32_t seq_num; - /** Number of times some operations will be retried. */ - uint32_t retries; -}; - -/** - * Default static definition of tst_crypto_session. - * - * @relates tst_crypto_session - */ -#define TST_CRYPTO_SESSION_INIT {\ - .fd = 0, \ - .seq_num = 0, \ - .retries = 1000 \ -} - -/** - * Creates a crypto session. - * - * @relates tst_crypto_session - * @param ses Session structure to use, it can be uninitialized. - * - * If some necessary feature is missing then it will call tst_brk() with - * TCONF, for any other error it will use TBROK. - */ -void tst_crypto_open(struct tst_crypto_session *ses); - -/** - * Close a crypto session. - * - * @relates tst_crypto_session - * @param ses The session to close. - */ -void tst_crypto_close(struct tst_crypto_session *ses); - -/** - * Add a crypto algorithm to a session. - * - * @relates tst_crypto_session - * @param ses An open session. - * @param alg The crypto algorithm or module to add. - * - * This requests a new crypto algorithm/engine/module to be initialized by the - * kernel. It sends the request contained in alg and then waits for a - * response. If sending the message or receiving the ack fails at the netlink - * level then tst_brk() with TBROK will be called. - * - * @return On success it will return 0 otherwise it will return an inverted - * error code from the crypto layer. - */ -int tst_crypto_add_alg(struct tst_crypto_session *ses, - const struct crypto_user_alg *alg); - -/** - * Delete a crypto algorithm from a session. - * - * @relates tst_crypto_session - * @param ses An open session. - * @param alg The crypto algorithm to delete. - * - * Request that the kernel remove an existing crypto algorithm. This behaves - * in a similar way to tst_crypto_add_alg() except that it is the inverse - * operation and that it is not unusual for the crypto layer to return - * EBUSY. If EBUSY is returned then the function will internally retry the - * operation tst_crypto_session::retries times before giving up and returning - * EBUSY. - * - * Return: Either 0 or an inverted error code from the crypto layer. If called - * during cleanup it may return a positive ENODATA value from the LTP - * library, you don't need to log this error as it will already have - * been printed by tst_brk(). - */ -int tst_crypto_del_alg(struct tst_crypto_session *ses, - const struct crypto_user_alg *alg); - -#endif /* TST_CRYPTO_H */ diff --git a/fsstress/include/tst_device.h b/fsstress/include/tst_device.h deleted file mode 100644 index 6a1fc5186a..0000000000 --- a/fsstress/include/tst_device.h +++ /dev/null @@ -1,94 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2016-2019 Cyril Hrubis - */ - -#ifndef TST_DEVICE_H__ -#define TST_DEVICE_H__ - -#include - -struct tst_device { - const char *dev; - const char *fs_type; -}; - -/* - * Automatically initialized if test.needs_device is set. - */ -extern struct tst_device *tst_device; - -/* - * Just like umount() but retries several times on failure. - * @path: Path to umount - */ -int tst_umount(const char *path); - -/* - * Verifies if an earlier mount is successful or not. - * @path: Mount path to verify - */ -int tst_is_mounted(const char *path); -int tst_is_mounted_at_tmpdir(const char *path); - -/* - * Clears a first few blocks of the device. This is needed when device has - * already been formatted with a filesystems, subset of mkfs.foo utils aborts - * the operation if it finds a filesystem signature there. - * - * Note that this is called from tst_mkfs() automatically, so you probably will - * not need to use this from the test yourself. - */ -int tst_clear_device(const char *dev); - -/* - * Finds a free loop device for use and returns the free loopdev minor(-1 for no - * free loopdev). If path is non-NULL, it will be filled with free loopdev path. - * - */ -int tst_find_free_loopdev(const char *path, size_t path_len); - -/* - * Attaches a file to a loop device. - * - * @dev_path Path to the loop device e.g. /dev/loop0 - * @file_path Path to a file e.g. disk.img - * @return Zero on success, non-zero otherwise. - */ -int tst_attach_device(const char *dev_path, const char *file_path); - -/* - * Detaches a file from a loop device. - * - * @dev_path Path to the loop device e.g. /dev/loop0 - * @return Zero on succes, non-zero otherwise. - */ -int tst_detach_device(const char *dev_path); - -/* - * To avoid FS deferred IO metadata/cache interference, so we do syncfs - * simply before the tst_dev_bytes_written invocation. For easy to use, - * we create this inline function tst_dev_sync. - */ -int tst_dev_sync(int fd); - -/* - * Reads test block device stat file and returns the bytes written since the - * last call of this function. - * @dev: test block device - */ -unsigned long tst_dev_bytes_written(const char *dev); - -/* - * Wipe the contents of given directory but keep the directory itself - */ -void tst_purge_dir(const char *path); - -/* - * Find the file or path belongs to which block dev - * @path Path to find the backing dev - * @dev The block dev - */ -void tst_find_backing_dev(const char *path, char *dev); - -#endif /* TST_DEVICE_H__ */ diff --git a/fsstress/include/tst_fs.h b/fsstress/include/tst_fs.h deleted file mode 100644 index fc03905820..0000000000 --- a/fsstress/include/tst_fs.h +++ /dev/null @@ -1,246 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2015-2016 Cyril Hrubis - */ - -#ifndef TST_FS_H__ -#define TST_FS_H__ - -/* man 2 statfs or kernel-source/include/linux/magic.h */ -#define TST_BTRFS_MAGIC 0x9123683E -#define TST_NFS_MAGIC 0x6969 -#define TST_RAMFS_MAGIC 0x858458f6 -#define TST_TMPFS_MAGIC 0x01021994 -#define TST_V9FS_MAGIC 0x01021997 -#define TST_XFS_MAGIC 0x58465342 -#define TST_EXT2_OLD_MAGIC 0xEF51 -/* ext2, ext3, ext4 have the same magic number */ -#define TST_EXT234_MAGIC 0xEF53 -#define TST_MINIX_MAGIC 0x137F -#define TST_MINIX_MAGIC2 0x138F -#define TST_MINIX2_MAGIC 0x2468 -#define TST_MINIX2_MAGIC2 0x2478 -#define TST_MINIX3_MAGIC 0x4D5A -#define TST_UDF_MAGIC 0x15013346 -#define TST_SYSV2_MAGIC 0x012FF7B6 -#define TST_SYSV4_MAGIC 0x012FF7B5 -#define TST_UFS_MAGIC 0x00011954 -#define TST_UFS2_MAGIC 0x19540119 -#define TST_F2FS_MAGIC 0xF2F52010 -#define TST_NILFS_MAGIC 0x3434 -#define TST_EXOFS_MAGIC 0x5DF5 -#define TST_OVERLAYFS_MAGIC 0x794c7630 - -enum { - TST_BYTES = 1, - TST_KB = 1024, - TST_MB = 1048576, - TST_GB = 1073741824, -}; - -#define OVL_BASE_MNTPOINT "mntpoint" -#define OVL_LOWER OVL_BASE_MNTPOINT"/lower" -#define OVL_UPPER OVL_BASE_MNTPOINT"/upper" -#define OVL_WORK OVL_BASE_MNTPOINT"/work" -#define OVL_MNT OVL_BASE_MNTPOINT"/ovl" - -/* - * @path: path is the pathname of any file within the mounted file system - * @mult: mult should be TST_KB, TST_MB or TST_GB - * the required free space is calculated by @size * @mult - */ -int tst_fs_has_free_(void (*cleanup)(void), const char *path, - unsigned int size, unsigned int mult); - -/* - * Returns filesystem magick for a given path. - * - * The expected usage is: - * - * if (tst_fs_type(cleanup, ".") == TST_NFS_MAGIC) { - * tst_brkm(TCONF, cleanup, - * "Test not supported on NFS filesystem"); - * } - * - * Or: - * - * long type; - * - * swtich ((type = tst_fs_type(cleanup, "."))) { - * case TST_NFS_MAGIC: - * case TST_TMPFS_MAGIC: - * case TST_RAMFS_MAGIC: - * tst_brkm(TCONF, cleanup, "Test not supported on %s filesystem", - * tst_fs_type_name(type)); - * break; - * } - */ -long tst_fs_type_(void (*cleanup)(void), const char *path); - -/* - * Returns filesystem name given magic. - */ -const char *tst_fs_type_name(long f_type); - -/* - * Try to get maximum number of hard links to a regular file inside the @dir. - * - * Note: This number depends on the filesystem @dir is on. - * - * The code uses link(2) to create hard links to a single file until it gets - * EMLINK or creates 65535 links. - * - * If limit is hit maximal number of hardlinks is returned and the the @dir is - * filled with hardlinks in format "testfile%i" where i belongs to [0, limit) - * interval. - * - * If no limit is hit (succed to create 65535 without error) or if link() - * failed with ENOSPC or EDQUOT zero is returned previously created files are - * removed. - */ -int tst_fs_fill_hardlinks_(void (*cleanup) (void), const char *dir); - -/* - * Try to get maximum number of subdirectories in directory. - * - * Note: This number depends on the filesystem @dir is on. - * - * The code uses mkdir(2) to create directories in @dir until it gets EMLINK - * or creates 65535 directories. - * - * If limit is hit the maximal number of subdirectories is returned and the - * @dir is filled with subdirectories in format "testdir%i" where i belongs to - * [0, limit - 2) interval (because each newly created dir has two links - * already the '.' and link from parent dir). - * - * If no limit is hit or mkdir() failed with ENOSPC or EDQUOT zero is returned - * previously created directories are removed. - * - */ -int tst_fs_fill_subdirs_(void (*cleanup) (void), const char *dir); - -/* - * Checks if a given directory contains any entities, - * returns 1 if directory is empty, 0 otherwise - */ -int tst_dir_is_empty_(void (*cleanup)(void), const char *name, int verbose); - -/* - * Search $PATH for prog_name and fills buf with absolute path if found. - * - * Returns -1 on failure, either command was not found or buffer was too small. - */ -int tst_get_path(const char *prog_name, char *buf, size_t buf_len); - -/* - * Fill a file with specified pattern - * @fd: file descriptor - * @pattern: pattern - * @bs: block size - * @bcount: blocks count - */ -int tst_fill_fd(int fd, char pattern, size_t bs, size_t bcount); - -/* - * Preallocate space in open file. If fallocate() fails, falls back to - * using tst_fill_fd(). - * @fd: file descriptor - * @bs: block size - * @bcount: blocks count - */ -int tst_prealloc_size_fd(int fd, size_t bs, size_t bcount); - -/* - * Creates/ovewrites a file with specified pattern - * @path: path to file - * @pattern: pattern - * @bs: block size - * @bcount: blocks amount - */ -int tst_fill_file(const char *path, char pattern, size_t bs, size_t bcount); - -/* - * Creates file of specified size. Space will be only preallocated if possible. - * @path: path to file - * @bs: block size - * @bcount: blocks amount - */ -int tst_prealloc_file(const char *path, size_t bs, size_t bcount); - -#define TST_FS_SKIP_FUSE 0x01 - -/* - * Return 1 if a specified fiilsystem is supported - * Return 0 if a specified fiilsystem isn't supported - */ -int tst_fs_is_supported(const char *fs_type, int flags); - -/* - * Returns NULL-terminated array of kernel-supported filesystems. - */ -const char **tst_get_supported_fs_types(int flags); - -/* - * Creates and writes to files on given path until write fails with ENOSPC - */ -void tst_fill_fs(const char *path, int verbose); - -/* - * test if FIBMAP ioctl is supported - */ -int tst_fibmap(const char *filename); - -#ifdef TST_TEST_H__ -static inline long tst_fs_type(const char *path) -{ - return tst_fs_type_(NULL, path); -} - -static inline int tst_fs_has_free(const char *path, unsigned int size, - unsigned int mult) -{ - return tst_fs_has_free_(NULL, path, size, mult); -} - -static inline int tst_fs_fill_hardlinks(const char *dir) -{ - return tst_fs_fill_hardlinks_(NULL, dir); -} - -static inline int tst_fs_fill_subdirs(const char *dir) -{ - return tst_fs_fill_subdirs_(NULL, dir); -} - -static inline int tst_dir_is_empty(const char *name, int verbose) -{ - return tst_dir_is_empty_(NULL, name, verbose); -} -#else -static inline long tst_fs_type(void (*cleanup)(void), const char *path) -{ - return tst_fs_type_(cleanup, path); -} - -static inline int tst_fs_has_free(void (*cleanup)(void), const char *path, - unsigned int size, unsigned int mult) -{ - return tst_fs_has_free_(cleanup, path, size, mult); -} - -static inline int tst_fs_fill_hardlinks(void (*cleanup)(void), const char *dir) -{ - return tst_fs_fill_hardlinks_(cleanup, dir); -} - -static inline int tst_fs_fill_subdirs(void (*cleanup)(void), const char *dir) -{ - return tst_fs_fill_subdirs_(cleanup, dir); -} - -static inline int tst_dir_is_empty(void (*cleanup)(void), const char *name, int verbose) -{ - return tst_dir_is_empty_(cleanup, name, verbose); -} -#endif - -#endif /* TST_FS_H__ */ diff --git a/fsstress/include/tst_fuzzy_sync.h b/fsstress/include/tst_fuzzy_sync.h deleted file mode 100644 index 4141f5c646..0000000000 --- a/fsstress/include/tst_fuzzy_sync.h +++ /dev/null @@ -1,776 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Copyright (c) 2017-2018 Richard Palethorpe - */ -/** - * @file tst_fuzzy_sync.h - * Fuzzy Synchronisation - abbreviated to fzsync - * - * This library is intended to help reproduce race conditions by synchronising - * two threads at a given place by marking the range a race may occur - * in. Because the exact place where any race occurs is within the kernel, - * and therefore impossible to mark accurately, the library may add randomised - * delays to either thread in order to help find the exact race timing. - * - * Currently only two way races are explicitly supported, that is races - * involving two threads or processes. We refer to the main test thread as - * thread A and the child thread as thread B. - * - * In each thread you need a simple while- or for-loop which the tst_fzsync_* - * functions are called in. In the simplest case thread A will look something - * like: - * - * tst_fzsync_pair_reset(&pair, run_thread_b); - * while (tst_fzsync_run_a(&pair)) { - * // Perform some setup which must happen before the race - * tst_fzsync_start_race_a(&pair); - * // Do some dodgy syscall - * tst_fzsync_end_race_a(&pair); - * } - * - * Then in thread B (run_thread_b): - * - * while (tst_fzsync_run_b(&pair)) { - * tst_fzsync_start_race_b(&pair); - * // Do something which can race with the dodgy syscall in A - * tst_fzsync_end_race_b(&pair) - * } - * - * The calls to tst_fzsync_start/end_race and tst_fzsync_run_a/b block (at - * least) until both threads have enter them. These functions can only be - * called once for each iteration, but further synchronisation points can be - * added by calling tst_fzsync_wait_a() and tst_fzsync_wait_b() in each - * thread. - * - * The execution of the loops in threads A and B are bounded by both iteration - * count and time. A slow machine is likely to be limited by time and a fast - * one by iteration count. The user can use the -i parameter to run the test - * multiple times or LTP_TIMEOUT_MUL to give the test more time. - * - * It is possible to use the library just for tst_fzsync_pair_wait() to get a - * basic spin wait. However if you are actually testing a race condition then - * it is recommended to use tst_fzsync_start_race_a/b even if the - * randomisation is not needed. It provides some semantic information which - * may be useful in the future. - * - * For a usage example see testcases/cve/cve-2016-7117.c or just run - * 'git grep tst_fuzzy_sync.h' - * - * @sa tst_fzsync_pair - */ - -#include -#include -#include -#include -#include -#include "tst_atomic.h" -#include "tst_timer.h" -#include "tst_safe_pthread.h" - -#ifndef TST_FUZZY_SYNC_H__ -#define TST_FUZZY_SYNC_H__ - -/* how much of exec time is sampling allowed to take */ -#define SAMPLING_SLICE 0.5f - -/** Some statistics for a variable */ -struct tst_fzsync_stat { - float avg; - float avg_dev; - float dev_ratio; -}; - -/** - * The state of a two way synchronisation or race. - * - * This contains all the necessary state for approximately synchronising two - * sections of code in different threads. - * - * Some of the fields can be configured before calling - * tst_fzsync_pair_reset(), however this is mainly for debugging purposes. If - * a test requires one of the parameters to be modified, we should consider - * finding a way of automatically selecting an appropriate value at runtime. - * - * Internal fields should only be accessed by library functions. - */ -struct tst_fzsync_pair { - /** - * The rate at which old diff samples are forgotten - * - * Defaults to 0.25. - */ - float avg_alpha; - /** Internal; Thread A start time */ - struct timespec a_start; - /** Internal; Thread B start time */ - struct timespec b_start; - /** Internal; Thread A end time */ - struct timespec a_end; - /** Internal; Thread B end time */ - struct timespec b_end; - /** Internal; Avg. difference between a_start and b_start */ - struct tst_fzsync_stat diff_ss; - /** Internal; Avg. difference between a_start and a_end */ - struct tst_fzsync_stat diff_sa; - /** Internal; Avg. difference between b_start and b_end */ - struct tst_fzsync_stat diff_sb; - /** Internal; Avg. difference between a_end and b_end */ - struct tst_fzsync_stat diff_ab; - /** Internal; Number of spins while waiting for the slower thread */ - int spins; - struct tst_fzsync_stat spins_avg; - /** - * Internal; Number of spins to use in the delay. - * - * A negative value delays thread A and a positive delays thread B. - */ - int delay; - int delay_bias; - /** - * Internal; The number of samples left or the sampling state. - * - * A positive value is the number of remaining mandatory - * samples. Zero or a negative indicate some other state. - */ - int sampling; - /** - * The Minimum number of statistical samples which must be collected. - * - * The minimum number of iterations which must be performed before a - * random delay can be calculated. Defaults to 1024. - */ - int min_samples; - /** - * The maximum allowed proportional average deviation. - * - * A value in the range (0, 1) which gives the maximum average - * deviation which must be attained before random delays can be - * calculated. - * - * It is a ratio of (average_deviation / total_time). The default is - * 0.1, so this allows an average deviation of at most 10%. - */ - float max_dev_ratio; - - /** Internal; Atomic counter used by fzsync_pair_wait() */ - int a_cntr; - /** Internal; Atomic counter used by fzsync_pair_wait() */ - int b_cntr; - /** Internal; Used by tst_fzsync_pair_exit() and fzsync_pair_wait() */ - int exit; - /** - * The maximum desired execution time as a proportion of the timeout - * - * A value x so that 0 < x < 1 which decides how long the test should - * be run for (assuming the loop limit is not exceeded first). - * - * Defaults to 0.5 (~150 seconds with default timeout). - */ - float exec_time_p; - /** Internal; The test time remaining on tst_fzsync_pair_reset() */ - float exec_time_start; - /** - * The maximum number of iterations to execute during the test - * - * Defaults to a large number, but not too large. - */ - int exec_loops; - /** Internal; The current loop index */ - int exec_loop; - /** Internal; The second thread or 0 */ - pthread_t thread_b; -}; - -#define CHK(param, low, hi, def) do { \ - pair->param = (pair->param ? pair->param : def); \ - if (pair->param < low) \ - tst_brk(TBROK, #param " is less than the lower bound " #low); \ - if (pair->param > hi) \ - tst_brk(TBROK, #param " is more than the upper bound " #hi); \ - } while (0) -/** - * Ensures that any Fuzzy Sync parameters are properly set - * - * @relates tst_fzsync_pair - * - * Usually called from the setup function, it sets default parameter values or - * validates any existing non-defaults. - * - * @sa tst_fzsync_pair_reset() - */ -static void tst_fzsync_pair_init(struct tst_fzsync_pair *pair) -{ - CHK(avg_alpha, 0, 1, 0.25); - CHK(min_samples, 20, INT_MAX, 1024); - CHK(max_dev_ratio, 0, 1, 0.1); - CHK(exec_time_p, 0, 1, 0.5); - CHK(exec_loops, 20, INT_MAX, 3000000); -} -#undef CHK - -/** - * Exit and join thread B if necessary. - * - * @relates tst_fzsync_pair - * - * Call this from your cleanup function. - */ -static void tst_fzsync_pair_cleanup(struct tst_fzsync_pair *pair) -{ - if (pair->thread_b) { - /* Revoke thread B if parent hits accidental break */ - if (!pair->exit) { - tst_atomic_store(1, &pair->exit); - usleep(100000); - pthread_cancel(pair->thread_b); - } - SAFE_PTHREAD_JOIN(pair->thread_b, NULL); - pair->thread_b = 0; - } -} - -/** To store the run_b pointer and pass to tst_fzsync_thread_wrapper */ -struct tst_fzsync_run_thread { - void *(*func)(void *); - void *arg; -}; - -/** - * Wrap run_b for tst_fzsync_pair_reset to enable pthread cancel - * at the start of the thread B. - */ -static void *tst_fzsync_thread_wrapper(void *run_thread) -{ - struct tst_fzsync_run_thread t = *(struct tst_fzsync_run_thread *)run_thread; - - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - return t.func(t.arg); -} - -/** - * Zero some stat fields - * - * @relates tst_fzsync_stat - */ -static void tst_init_stat(struct tst_fzsync_stat *s) -{ - s->avg = 0; - s->avg_dev = 0; -} - -/** - * Reset or initialise fzsync. - * - * @relates tst_fzsync_pair - * @param pair The state structure initialised with TST_FZSYNC_PAIR_INIT. - * @param run_b The function defining thread B or NULL. - * - * Call this from your main test function (thread A), just before entering the - * main loop. It will (re)set any variables needed by fzsync and (re)start - * thread B using the function provided. - * - * If you need to use fork or clone to start the second thread/process then - * you can pass NULL to run_b and handle starting and stopping thread B - * yourself. You may need to place tst_fzsync_pair in some shared memory as - * well. - * - * @sa tst_fzsync_pair_init() - */ -static void tst_fzsync_pair_reset(struct tst_fzsync_pair *pair, - void *(*run_b)(void *)) -{ - tst_fzsync_pair_cleanup(pair); - - tst_init_stat(&pair->diff_ss); - tst_init_stat(&pair->diff_sa); - tst_init_stat(&pair->diff_sb); - tst_init_stat(&pair->diff_ab); - tst_init_stat(&pair->spins_avg); - pair->delay = 0; - pair->sampling = pair->min_samples; - - pair->exec_loop = 0; - - pair->a_cntr = 0; - pair->b_cntr = 0; - pair->exit = 0; - if (run_b) { - static struct tst_fzsync_run_thread wrap_run_b; - - wrap_run_b.func = run_b; - wrap_run_b.arg = NULL; - SAFE_PTHREAD_CREATE(&pair->thread_b, 0, tst_fzsync_thread_wrapper, &wrap_run_b); - } - - pair->exec_time_start = (float)tst_timeout_remaining(); -} - -/** - * Print stat - * - * @relates tst_fzsync_stat - */ -static inline void tst_fzsync_stat_info(struct tst_fzsync_stat stat, - char *unit, char *name) -{ - tst_res(TINFO, - "%1$-17s: { avg = %3$5.0f%2$s, avg_dev = %4$5.0f%2$s, dev_ratio = %5$.2f }", - name, unit, stat.avg, stat.avg_dev, stat.dev_ratio); -} - -/** - * Print some synchronisation statistics - * - * @relates tst_fzsync_pair - */ -static void tst_fzsync_pair_info(struct tst_fzsync_pair *pair) -{ - tst_res(TINFO, "loop = %d, delay_bias = %d", - pair->exec_loop, pair->delay_bias); - tst_fzsync_stat_info(pair->diff_ss, "ns", "start_a - start_b"); - tst_fzsync_stat_info(pair->diff_sa, "ns", "end_a - start_a"); - tst_fzsync_stat_info(pair->diff_sb, "ns", "end_b - start_b"); - tst_fzsync_stat_info(pair->diff_ab, "ns", "end_a - end_b"); - tst_fzsync_stat_info(pair->spins_avg, " ", "spins"); -} - -/** Wraps clock_gettime */ -static inline void tst_fzsync_time(struct timespec *t) -{ -#ifdef CLOCK_MONOTONIC_RAW - clock_gettime(CLOCK_MONOTONIC_RAW, t); -#else - clock_gettime(CLOCK_MONOTONIC, t); -#endif -} - -/** - * Exponential moving average - * - * @param alpha The preference for recent samples over old ones. - * @param sample The current sample - * @param prev_avg The average of the all the previous samples - * - * @return The average including the current sample. - */ -static inline float tst_exp_moving_avg(float alpha, - float sample, - float prev_avg) -{ - return alpha * sample + (1.0 - alpha) * prev_avg; -} - -/** - * Update a stat with a new sample - * - * @relates tst_fzsync_stat - */ -static inline void tst_upd_stat(struct tst_fzsync_stat *s, - float alpha, - float sample) -{ - s->avg = tst_exp_moving_avg(alpha, sample, s->avg); - s->avg_dev = tst_exp_moving_avg(alpha, - fabs(s->avg - sample), s->avg_dev); - s->dev_ratio = fabs(s->avg ? s->avg_dev / s->avg : 0); -} - -/** - * Update a stat with a new diff sample - * - * @relates tst_fzsync_stat - */ -static inline void tst_upd_diff_stat(struct tst_fzsync_stat *s, - float alpha, - struct timespec t1, - struct timespec t2) -{ - tst_upd_stat(s, alpha, tst_timespec_diff_ns(t1, t2)); -} - -/** - * Calculate various statistics and the delay - * - * This function helps create the fuzz in fuzzy sync. Imagine we have the - * following timelines in threads A and B: - * - * start_race_a - * ^ end_race_a (a) - * | ^ - * | | - * - --+------------------------+-- - - - * | Syscall A | Thread A - * - --+------------------------+-- - - - * - --+----------------+-------+-- - - - * | Syscall B | spin | Thread B - * - --+----------------+-------+-- - - - * | | - * ^ ^ - * start_race_b end_race_b - * - * Here we have synchronised the calls to syscall A and B with start_race_{a, - * b} so that they happen at approximately the same time in threads A and - * B. If the race condition occurs during the entry code for these two - * functions then we will quickly hit it. If it occurs during the exit code of - * B and mid way through A, then we will quickly hit it. - * - * However if the exit paths of A and B need to be aligned and (end_race_a - - * end_race_b) is large relative to the variation in call times, the - * probability of hitting the race condition is close to zero. To solve this - * scenario (and others) a randomised delay is introduced before the syscalls - * in A and B. Given enough time the following should happen where the exit - * paths are now synchronised: - * - * start_race_a - * ^ end_race_a (a) - * | ^ - * | | - * - --+------------------------+-- - - - * | Syscall A | Thread A - * - --+------------------------+-- - - - * - --+-------+----------------+-- - - - * | delay | Syscall B | Thread B - * - --+-------+----------------+-- - - - * | | - * ^ ^ - * start_race_b end_race_b - * - * The delay is not introduced immediately and the delay range is only - * calculated once the average relative deviation has dropped below some - * percentage of the total time. - * - * The delay range is chosen so that any point in Syscall A could be - * synchronised with any point in Syscall B using a value from the - * range. Because the delay range may be too large for a linear search, we use - * an evenly distributed random function to pick a value from it. - * - * The delay range goes from positive to negative. A negative delay will delay - * thread A and a positive one will delay thread B. The range is bounded by - * the point where the entry code to Syscall A is synchronised with the exit - * to Syscall B and the entry code to Syscall B is synchronised with the exit - * of A. - * - * In order to calculate the lower bound (the max delay of A) we can simply - * negate the execution time of Syscall B and convert it to a spin count. For - * the upper bound (the max delay of B), we just take the execution time of A - * and convert it to a spin count. - * - * In order to calculate spin count we need to know approximately how long a - * spin takes and divide the delay time with it. We find this by first - * counting how many spins one thread spends waiting for the other during - * end_race[1]. We also know when each syscall exits so we can take the - * difference between the exit times and divide it with the number of spins - * spent waiting. - * - * All the times and counts we use in the calculation are averaged over a - * variable number of iterations. There is an initial sampling period where we - * simply collect time and count samples then calculate their averages. When a - * minimum number of samples have been collected, and if the average deviation - * is below some proportion of the average sample magnitude, then the sampling - * period is ended. On all further iterations a random delay is calculated and - * applied, but the averages are not updated. - * - * [1] This assumes there is always a significant difference. The algorithm - * may fail to introduce a delay (when one is needed) in situations where - * Syscall A and B finish at approximately the same time. - * - * @relates tst_fzsync_pair - */ -static void tst_fzsync_pair_update(struct tst_fzsync_pair *pair) -{ - float alpha = pair->avg_alpha; - float per_spin_time, time_delay; - float max_dev = pair->max_dev_ratio; - int over_max_dev; - - pair->delay = pair->delay_bias; - - over_max_dev = pair->diff_ss.dev_ratio > max_dev - || pair->diff_sa.dev_ratio > max_dev - || pair->diff_sb.dev_ratio > max_dev - || pair->diff_ab.dev_ratio > max_dev - || pair->spins_avg.dev_ratio > max_dev; - - if (pair->sampling > 0 || over_max_dev) { - tst_upd_diff_stat(&pair->diff_ss, alpha, - pair->a_start, pair->b_start); - tst_upd_diff_stat(&pair->diff_sa, alpha, - pair->a_end, pair->a_start); - tst_upd_diff_stat(&pair->diff_sb, alpha, - pair->b_end, pair->b_start); - tst_upd_diff_stat(&pair->diff_ab, alpha, - pair->a_end, pair->b_end); - tst_upd_stat(&pair->spins_avg, alpha, pair->spins); - if (pair->sampling > 0 && --pair->sampling == 0) { - tst_res(TINFO, "Minimum sampling period ended"); - tst_fzsync_pair_info(pair); - } - } else if (fabsf(pair->diff_ab.avg) >= 1) { - per_spin_time = fabsf(pair->diff_ab.avg) / MAX(pair->spins_avg.avg, 1.0f); - time_delay = drand48() * (pair->diff_sa.avg + pair->diff_sb.avg) - - pair->diff_sb.avg; - pair->delay += (int)(1.1 * time_delay / per_spin_time); - - if (!pair->sampling) { - tst_res(TINFO, - "Reached deviation ratios < %.2f, introducing randomness", - pair->max_dev_ratio); - tst_res(TINFO, "Delay range is [-%d, %d]", - (int)(pair->diff_sb.avg / per_spin_time) + pair->delay_bias, - (int)(pair->diff_sa.avg / per_spin_time) - pair->delay_bias); - tst_fzsync_pair_info(pair); - pair->sampling = -1; - } - } else if (!pair->sampling) { - tst_res(TWARN, "Can't calculate random delay"); - tst_fzsync_pair_info(pair); - pair->sampling = -1; - } - - pair->spins = 0; -} - -/** - * Wait for the other thread - * - * @relates tst_fzsync_pair - * @param our_cntr The counter for the thread we are on - * @param other_cntr The counter for the thread we are synchronising with - * @param spins A pointer to the spin counter or NULL - * - * Used by tst_fzsync_pair_wait_a(), tst_fzsync_pair_wait_b(), - * tst_fzsync_start_race_a(), etc. If the calling thread is ahead of the other - * thread, then it will spin wait. Unlike pthread_barrier_wait it will never - * use futex and can count the number of spins spent waiting. - * - * @return A non-zero value if the thread should continue otherwise the - * calling thread should exit. - */ -static inline void tst_fzsync_pair_wait(int *our_cntr, - int *other_cntr, - int *spins) -{ - if (tst_atomic_inc(other_cntr) == INT_MAX) { - /* - * We are about to break the invariant that the thread with - * the lowest count is in front of the other. So we must wait - * here to ensure the other thread has at least reached the - * line above before doing that. If we are in rear position - * then our counter may already have been set to zero. - */ - while (tst_atomic_load(our_cntr) > 0 - && tst_atomic_load(our_cntr) < INT_MAX) { - if (spins) - (*spins)++; - } - - tst_atomic_store(0, other_cntr); - /* - * Once both counters have been set to zero the invariant - * is restored and we can continue. - */ - while (tst_atomic_load(our_cntr) > 1) - ; - } else { - /* - * If our counter is less than the other thread's we are ahead - * of it and need to wait. - */ - while (tst_atomic_load(our_cntr) < tst_atomic_load(other_cntr)) { - if (spins) - (*spins)++; - } - } -} - -/** - * Wait in thread A - * - * @relates tst_fzsync_pair - * @sa tst_fzsync_pair_wait - */ -static inline void tst_fzsync_wait_a(struct tst_fzsync_pair *pair) -{ - tst_fzsync_pair_wait(&pair->a_cntr, &pair->b_cntr, NULL); -} - -/** - * Wait in thread B - * - * @relates tst_fzsync_pair - * @sa tst_fzsync_pair_wait - */ -static inline void tst_fzsync_wait_b(struct tst_fzsync_pair *pair) -{ - tst_fzsync_pair_wait(&pair->b_cntr, &pair->a_cntr, NULL); -} - -/** - * Decide whether to continue running thread A - * - * @relates tst_fzsync_pair - * - * Checks some values and decides whether it is time to break the loop of - * thread A. - * - * @return True to continue and false to break. - * @sa tst_fzsync_run_a - */ -static inline int tst_fzsync_run_a(struct tst_fzsync_pair *pair) -{ - int exit = 0; - float rem_p = 1 - tst_timeout_remaining() / pair->exec_time_start; - - if ((pair->exec_time_p * SAMPLING_SLICE < rem_p) - && (pair->sampling > 0)) { - tst_res(TINFO, "Stopped sampling at %d (out of %d) samples, " - "sampling time reached 50%% of the total time limit", - pair->exec_loop, pair->min_samples); - pair->sampling = 0; - tst_fzsync_pair_info(pair); - } - - if (pair->exec_time_p < rem_p) { - tst_res(TINFO, - "Exceeded execution time, requesting exit"); - exit = 1; - } - - if (++pair->exec_loop > pair->exec_loops) { - tst_res(TINFO, - "Exceeded execution loops, requesting exit"); - exit = 1; - } - - tst_atomic_store(exit, &pair->exit); - tst_fzsync_wait_a(pair); - - if (exit) { - tst_fzsync_pair_cleanup(pair); - return 0; - } - - return 1; -} - -/** - * Decide whether to continue running thread B - * - * @relates tst_fzsync_pair - * @sa tst_fzsync_run_a - */ -static inline int tst_fzsync_run_b(struct tst_fzsync_pair *pair) -{ - tst_fzsync_wait_b(pair); - return !tst_atomic_load(&pair->exit); -} - -/** - * Marks the start of a race region in thread A - * - * @relates tst_fzsync_pair - * - * This should be placed just before performing whatever action can cause a - * race condition. Usually it is placed just before a syscall and - * tst_fzsync_end_race_a() is placed just afterwards. - * - * A corresponding call to tst_fzsync_start_race_b() should be made in thread - * B. - * - * @return A non-zero value if the calling thread should continue to loop. If - * it returns zero then tst_fzsync_exit() has been called and you must exit - * the thread. - * - * @sa tst_fzsync_pair_update - */ -static inline void tst_fzsync_start_race_a(struct tst_fzsync_pair *pair) -{ - volatile int delay; - - tst_fzsync_pair_update(pair); - - tst_fzsync_wait_a(pair); - - delay = pair->delay; - while (delay < 0) - delay++; - - tst_fzsync_time(&pair->a_start); -} - -/** - * Marks the end of a race region in thread A - * - * @relates tst_fzsync_pair - * @sa tst_fzsync_start_race_a - */ -static inline void tst_fzsync_end_race_a(struct tst_fzsync_pair *pair) -{ - tst_fzsync_time(&pair->a_end); - tst_fzsync_pair_wait(&pair->a_cntr, &pair->b_cntr, &pair->spins); -} - -/** - * Marks the start of a race region in thread B - * - * @relates tst_fzsync_pair - * @sa tst_fzsync_start_race_a - */ -static inline void tst_fzsync_start_race_b(struct tst_fzsync_pair *pair) -{ - volatile int delay; - - tst_fzsync_wait_b(pair); - - delay = pair->delay; - while (delay > 0) - delay--; - - tst_fzsync_time(&pair->b_start); -} - -/** - * Marks the end of a race region in thread B - * - * @relates tst_fzsync_pair - * @sa tst_fzsync_start_race_a - */ -static inline void tst_fzsync_end_race_b(struct tst_fzsync_pair *pair) -{ - tst_fzsync_time(&pair->b_end); - tst_fzsync_pair_wait(&pair->b_cntr, &pair->a_cntr, &pair->spins); -} - -/** - * Add some amount to the delay bias - * - * @relates tst_fzsync_pair - * @param change The amount to add, can be negative - * - * A positive change delays thread B and a negative one delays thread - * A. - * - * It is intended to be used in tests where the time taken by syscall A and/or - * B are significantly affected by their chronological order. To the extent - * that the delay range will not include the correct values if too many of the - * initial samples are taken when the syscalls (or operations within the - * syscalls) happen in the wrong order. - * - * An example of this is cve/cve-2016-7117.c where a call to close() is racing - * with a call to recvmmsg(). If close() happens before recvmmsg() has chance - * to check if the file descriptor is open then recvmmsg() completes very - * quickly. If the call to close() happens once recvmmsg() has already checked - * the descriptor it takes much longer. The sample where recvmmsg() completes - * quickly is essentially invalid for our purposes. The test uses the simple - * heuristic of whether recvmmsg() returns EBADF, to decide if it should call - * tst_fzsync_pair_add_bias() to further delay syscall B. - */ -static inline void tst_fzsync_pair_add_bias(struct tst_fzsync_pair *pair, int change) -{ - if (pair->sampling > 0) - pair->delay_bias += change; -} - -#endif /* TST_FUZZY_SYNC_H__ */ diff --git a/fsstress/include/tst_get_bad_addr.h b/fsstress/include/tst_get_bad_addr.h deleted file mode 100644 index 69d7402098..0000000000 --- a/fsstress/include/tst_get_bad_addr.h +++ /dev/null @@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. - * Author: Xiao Yang - */ - -#ifndef TST_GET_BAD_ADDR_H__ -#define TST_GET_BAD_ADDR_H__ - -/* Functions from lib/tst_get_bad_addr.c */ -void *tst_get_bad_addr(void (*cleanup_fn) (void)); - -#endif /* TST_GET_BAD_ADDR_H__ */ diff --git a/fsstress/include/tst_hugepage.h b/fsstress/include/tst_hugepage.h deleted file mode 100644 index e08a2daa24..0000000000 --- a/fsstress/include/tst_hugepage.h +++ /dev/null @@ -1,37 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2019 Red Hat, Inc. - */ - -#ifndef TST_HUGEPAGE__ -#define TST_HUGEPAGE__ - -#define PATH_HUGEPAGES "/sys/kernel/mm/hugepages/" -#define PATH_NR_HPAGES "/proc/sys/vm/nr_hugepages" - -extern char *nr_opt; /* -s num Set the number of the been allocated hugepages */ -extern char *Hopt; /* -H /.. Location of hugetlbfs, i.e. -H /var/hugetlbfs */ - -/* - * Get the default hugepage size. Returns 0 if hugepages are not supported. - */ -size_t tst_get_hugepage_size(void); - -/* - * Try the best to request a specified number of huge pages from system, - * it will store the reserved hpage number in tst_hugepages. - * - * Note: this depend on the status of system memory fragmentation. - */ -unsigned long tst_request_hugepages(unsigned long hpages); - -/* - * This variable is used for recording the number of hugepages which system can - * provides. It will be equal to 'hpages' if tst_request_hugepages on success, - * otherwise set it to a number of hugepages that we were able to reserve. - * - * If system does not support hugetlb, then it will be set to 0. - */ -extern unsigned long tst_hugepages; - -#endif /* TST_HUGEPAGE_H */ diff --git a/fsstress/include/tst_kconfig.h b/fsstress/include/tst_kconfig.h deleted file mode 100644 index 2d2cfd782f..0000000000 --- a/fsstress/include/tst_kconfig.h +++ /dev/null @@ -1,56 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2018 Cyril Hrubis - */ - -#ifndef TST_KCONFIG_H__ -#define TST_KCONFIG_H__ - -struct tst_kconfig_res { - char match; - char *value; -}; - -/** - * Reads a kernel config and parses it for values defined in kconfigs array. - * - * The path to the kernel config should be autodetected in most of the cases as - * the code looks for know locations. It can be explicitely set/overrided with - * the KCONFIG_PATH environment variable as well. - * - * The kcofings array is expected to contain strings in a format "CONFIG_FOO" - * or "CONFIG_FOO=bar". The result array has to be suitably sized to fit the - * results. - * - * @param kconfigs array of config strings to look for - * @param results array to store results to - * @param cnt size of the arrays - * - * The match in the tst_kconfig_res structure is set as follows: - * - * 'm' - config option set to m - * 'y' - config option set to y - * 'v' - config option set to other value - * 'n' - config option is not set - * 0 - config option not found - * - * In the case that match is set to 'v' the value points to a newly allocated - * string that holds the value. - */ -void tst_kconfig_read(const char *const kconfigs[], - struct tst_kconfig_res results[], size_t cnt); - -/** - * Checks if required kernel configuration options are set in the kernel - * config and exits the test with TCONF if at least one is missing. - * - * The config options can be passed in two different formats, either - * "CONFIG_FOO" in which case the option has to be set in order to continue the - * test or with an explicit value "CONFIG_FOO=bar" in which case the value has - * to match. - * - * @param kconfigs NULL-terminated array of config strings needed for the testrun. - */ -void tst_kconfig_check(const char *const kconfigs[]); - -#endif /* TST_KCONFIG_H__ */ diff --git a/fsstress/include/tst_kernel.h b/fsstress/include/tst_kernel.h deleted file mode 100644 index 71ab9466b0..0000000000 --- a/fsstress/include/tst_kernel.h +++ /dev/null @@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2017 Cyril Hrubis - */ - -#ifndef TST_KERNEL_H__ -#define TST_KERNEL_H__ - -/* - * Returns 32 if we are running on 32bit kernel and 64 if on 64bit kernel. - */ -int tst_kernel_bits(void); - -/** - * Checks support for the kernel driver. - * - * @param name The name of the driver. - * @return Returns 0 if the kernel has the driver or modprobe is missing. - */ -int tst_check_driver(const char *name); - -#endif /* TST_KERNEL_H__ */ diff --git a/fsstress/include/tst_kvercmp.h b/fsstress/include/tst_kvercmp.h deleted file mode 100644 index 5bf1169f90..0000000000 --- a/fsstress/include/tst_kvercmp.h +++ /dev/null @@ -1,44 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. - * Copyright (c) 2009-2016 Cyril Hrubis chrubis@suse.cz - */ - -#ifndef TST_KVERCMP_H__ -#define TST_KVERCMP_H__ - -/* - * The same as tst_kvercmp() but running kernel version is passed as parameter - * instead of utilizing uname(). - */ -int tst_kvcmp(const char *cur_kver, int r1, int r2, int r3); - -/* - * Parsers string into three integer version. - */ -int tst_parse_kver(const char *str_kver, int *v1, int *v2, int *v3); - -/* - * Returns distribution name parsed from kernel version string or NULL. - */ -const char *tst_kvcmp_distname(const char *cur_kver); - -/* - * Compares versions up to five version numbers long. - */ -int tst_kvexcmp(const char *tst_exv, const char *cur_kver); - -/* - * Compare given kernel version with currently running kernel. - * - * Returns negative if older, 0 if the smame and possitive if newer. - */ -int tst_kvercmp(int r1, int r2, int r3); - -struct tst_kern_exv { - char *dist_name; - char *extra_ver; -}; - -int tst_kvercmp2(int r1, int r2, int r3, struct tst_kern_exv *vers); - -#endif /* TST_KVERCMP_H__ */ diff --git a/fsstress/include/tst_minmax.h b/fsstress/include/tst_minmax.h deleted file mode 100644 index 6417dd703e..0000000000 --- a/fsstress/include/tst_minmax.h +++ /dev/null @@ -1,24 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2017 Cyril Hrubis - */ - -#ifndef TST_MINMAX_H__ -#define TST_MINMAX_H__ - -#ifndef MIN -# define MIN(a, b) ({ \ - typeof(a) _a = (a); \ - typeof(b) _b = (b); \ - _a < _b ? _a : _b; \ -}) -#endif /* MIN */ - -#ifndef MAX -# define MAX(a, b) ({ \ - typeof(a) _a = (a); \ - typeof(b) _b = (b); \ - _a > _b ? _a : _b; \ -}) -#endif /* MAX */ - -#endif /* TST_MINMAX_H__ */ diff --git a/fsstress/include/tst_mkfs.h b/fsstress/include/tst_mkfs.h deleted file mode 100644 index b89bf812f6..0000000000 --- a/fsstress/include/tst_mkfs.h +++ /dev/null @@ -1,22 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2016 Cyril Hrubis - */ - -#ifndef TST_MKFS_H__ -#define TST_MKFS_H__ - -/* - * @dev: path to a device - * @fs_type: filesystem type - * @fs_opts: NULL or NULL terminated array of extra mkfs options - * @extra_opts: NULL or NULL terminated array of extra mkfs options - */ -void tst_mkfs_(const char *file, const int lineno, void (cleanup_fn)(void), - const char *dev, const char *fs_type, - const char *const fs_opts[], const char *const extra_opts[]); - -#define SAFE_MKFS(device, fs_type, fs_opts, extra_opts) \ - tst_mkfs_(__FILE__, __LINE__, NULL, device, fs_type, \ - fs_opts, extra_opts) - -#endif /* TST_MKFS_H__ */ diff --git a/fsstress/include/tst_net.h b/fsstress/include/tst_net.h deleted file mode 100644 index daefdd9d9e..0000000000 --- a/fsstress/include/tst_net.h +++ /dev/null @@ -1,35 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2017-2019 Petr Vorel - */ - -#ifndef TST_NET_H_ -#define TST_NET_H_ - -#include -#include -#include -#include -#include - -void tst_get_in_addr(const char *ip_str, struct in_addr *ip); -void tst_get_in6_addr(const char *ip_str, struct in6_addr *ip6); - -/* - * Find valid connection address for a given bound socket - */ -socklen_t tst_get_connect_address(int sock, struct sockaddr_storage *addr); - -/* - * Initialize AF_INET/AF_INET6 socket address structure with address and port - */ -void tst_init_sockaddr_inet(struct sockaddr_in *sa, const char *ip_str, uint16_t port); -void tst_init_sockaddr_inet_bin(struct sockaddr_in *sa, uint32_t ip_val, uint16_t port); -void tst_init_sockaddr_inet6(struct sockaddr_in6 *sa, const char *ip_str, uint16_t port); -void tst_init_sockaddr_inet6_bin(struct sockaddr_in6 *sa, const struct in6_addr *ip_val, uint16_t port); - -void safe_getaddrinfo(const char *file, const int lineno, const char *src_addr, - const char *port, const struct addrinfo *hints, - struct addrinfo **addr_info); - -#endif /* TST_NET_H_ */ diff --git a/fsstress/include/tst_netlink.h b/fsstress/include/tst_netlink.h deleted file mode 100644 index 2030ac30b2..0000000000 --- a/fsstress/include/tst_netlink.h +++ /dev/null @@ -1,88 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2018 Richard Palethorpe - */ - -/** - * @file tst_netlink.h - * - * Library for communicating with the kernel over the netlink interface. - */ - -#ifndef TST_NETLINK_H -#define TST_NETLINK_H - -#include - -#ifndef NETLINK_CRYPTO -/** - * The netlink-crypto socket protocol. - */ -#define NETLINK_CRYPTO 21 -#endif - -/** @private */ -static inline ssize_t safe_netlink_send(const char *file, const int lineno, - int fd, const struct nlmsghdr *nh, - const void *payload) -{ - struct sockaddr_nl sa = { .nl_family = AF_NETLINK }; - struct iovec iov[2] = { - {(struct nlmsghdr *)nh, sizeof(*nh)}, - {(void *)payload, nh->nlmsg_len - sizeof(*nh)} - }; - struct msghdr msg = { - .msg_name = &sa, - .msg_namelen = sizeof(sa), - .msg_iov = iov, - .msg_iovlen = 2 - }; - - return safe_sendmsg(file, lineno, nh->nlmsg_len, fd, &msg, 0); -} - -/** - * Sends a netlink message using safe_sendmsg(). - * - * @param fd netlink socket file descriptor. - * @param nl_header netlink header structure describing the message. - * @param payload an opaque object containing the message data. - * - * You should set the message length, type and flags to appropriate values - * within the nl_header object. See lib/tst_crypto.c for an example. - * - * @return The number of bytes sent. - */ -#define SAFE_NETLINK_SEND(fd, nl_header, payload) \ - safe_netlink_send(__FILE__, __LINE__, fd, nl_header, payload) - -/** @private */ -static inline ssize_t safe_netlink_recv(const char *file, const int lineno, - int fd, char *nl_headers_buf, - size_t buf_len) -{ - struct iovec iov = { nl_headers_buf, buf_len }; - struct sockaddr_nl sa; - struct msghdr msg = { - .msg_name = &sa, - .msg_namelen = sizeof(sa), - .msg_iov = &iov, - .msg_iovlen = 1 - }; - - return safe_recvmsg(file, lineno, 0, fd, &msg, 0); -} - -/** - * Receives a netlink message using safe_recvmsg(). - * - * @param fd netlink socket file descriptor. - * @param nl_header_buf buffer to contain the received netlink header structure. - * @param buf_len The length of the header buffer. Must be greater than the page - * size. - * - * @return The number of bytes received. - */ -#define SAFE_NETLINK_RECV(fd, nl_header_buf, buf_len) \ - safe_netlink_recv(__FILE__, __LINE__, fd, nl_header_buf, buf_len) - -#endif /* TST_NETLINK_H */ diff --git a/fsstress/include/tst_numa.h b/fsstress/include/tst_numa.h deleted file mode 100644 index 846e093a91..0000000000 --- a/fsstress/include/tst_numa.h +++ /dev/null @@ -1,112 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2018 Cyril Hrubis - */ - -#ifndef TST_NUMA_H__ -#define TST_NUMA_H__ - -#include - -/** - * Numa nodemap. - */ -struct tst_nodemap { - /** Number of nodes in map */ - unsigned int cnt; - /** Page allocation counters */ - unsigned int *counters; - /** Array of numa ids */ - unsigned int map[]; -}; - -/** - * Clears numa counters. The counters are lazy-allocated on first call of this function. - * - * @nodes Numa nodemap. - */ -void tst_nodemap_reset_counters(struct tst_nodemap *nodes); - -/** - * Prints pages allocated per each node. - * - * @nodes Numa nodemap. - */ -void tst_nodemap_print_counters(struct tst_nodemap *nodes); - -/** - * Returns a name for a mempolicy/mbind mode. - * - * @mode Numa mempolicy mode. - */ -const char *tst_numa_mode_name(int mode); - -/** - * Maps pages into memory, if path is NULL the mapping is anonymous otherwise is backed by the file. - * - * @path Path to a file, if not NULL mapping is file based. - * @size Mapping size. - */ -void *tst_numa_map(const char *path, size_t size); - -/* - * Writes to memory in order to get the pages faulted. - * - * @ptr Start of the mapping. - * @size Size of the mapping. - */ -static inline void tst_numa_fault(void *ptr, size_t size) -{ - memset(ptr, 'a', size); -} - -/* - * Frees the memory. - * - * @ptr Start of the mapping. - * @size Size of the mapping. - */ -static inline void tst_numa_unmap(void *ptr, size_t size) -{ - SAFE_MUNMAP(ptr, size); -} - -/** - * Check on which numa node resides each page of the mapping starting at ptr - * and continuing pages long and increases nodemap counters accordingly. - * - * @nodes Nodemap with initialized counters. - * @ptr Pointer to start of a mapping. - * @size Size of the mapping. - */ -void tst_nodemap_count_pages(struct tst_nodemap *nodes, void *ptr, size_t size); - -/** - * Frees nodemap. - * - * @nodes Numa nodemap to be freed. - */ -void tst_nodemap_free(struct tst_nodemap *nodes); - -/** - * Bitflags for tst_get_nodemap() function. - */ -enum tst_numa_types { - TST_NUMA_ANY = 0x00, - TST_NUMA_MEM = 0x01, -}; - -/** - * Allocates and returns numa node map, which is an array of numa nodes which - * contain desired resources e.g. memory. - * - * @type Bitflags of enum tst_numa_types specifying desired resources. - * @min_mem_kb Minimal free RAM on memory nodes, if given node has less than - * requested amount of free+buffers memory it's not included in - * the resulting list of nodes. - * - * @return On success returns allocated and initialized struct tst_nodemap which contains - * array of numa node ids that contains desired resources. - */ -struct tst_nodemap *tst_get_nodemap(int type, size_t min_mem_kb); - -#endif /* TST_NUMA_H__ */ diff --git a/fsstress/include/tst_path_has_mnt_flags.h b/fsstress/include/tst_path_has_mnt_flags.h deleted file mode 100644 index a9e1f40505..0000000000 --- a/fsstress/include/tst_path_has_mnt_flags.h +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. - * Copyright (c) 2018 Cyril Hrubis - * Author: Xiao Yang - */ - -#ifndef TST_PATH_HAS_MNT_FLAGS_H__ -#define TST_PATH_HAS_MNT_FLAGS_H__ - -#ifdef TST_TEST_H__ -# define tst_path_has_mnt_flags(...) tst_path_has_mnt_flags_(NULL, __VA_ARGS__) -#else -# define tst_path_has_mnt_flags tst_path_has_mnt_flags_ -#endif - -/* lib/tst_path_has_mnt_flags.c - * - * Check whether a path is on a filesystem that is mounted with - * specified flags - * @path: path to file, if path is NULL tst_tmpdir is used. - * @flags: NULL or NULL terminated array of mount flags - * - * Return: 0..n - number of flags matched - */ -int tst_path_has_mnt_flags_(void (*cleanup_fn)(void), - const char *path, const char *flags[]); - -#endif /* TST_PATH_HAS_MNT_FLAGS_H__ */ diff --git a/fsstress/include/tst_pid.h b/fsstress/include/tst_pid.h deleted file mode 100644 index 9ba1abb27b..0000000000 --- a/fsstress/include/tst_pid.h +++ /dev/null @@ -1,43 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2015-2016 Cyril Hrubis - */ - -#ifndef TST_PID_H__ -#define TST_PID_H__ - -#include - -/* - * Get a pid value not used by the OS - */ -pid_t tst_get_unused_pid_(void (*cleanup_fn)(void)); - -/* - * Returns number of free pids by substarction of the number of pids - * currently used ('ps -eT') from max_pids - */ -int tst_get_free_pids_(void (*cleanup_fn)(void)); - -#ifdef TST_TEST_H__ -static inline pid_t tst_get_unused_pid(void) -{ - return tst_get_unused_pid_(NULL); -} - -static inline int tst_get_free_pids(void) -{ - return tst_get_free_pids_(NULL); -} -#else -static inline pid_t tst_get_unused_pid(void (*cleanup_fn)(void)) -{ - return tst_get_unused_pid_(cleanup_fn); -} - -static inline int tst_get_free_pids(void (*cleanup_fn)(void)) -{ - return tst_get_free_pids_(cleanup_fn); -} -#endif - -#endif /* TST_PID_H__ */ diff --git a/fsstress/include/tst_private.h b/fsstress/include/tst_private.h deleted file mode 100644 index e30d347401..0000000000 --- a/fsstress/include/tst_private.h +++ /dev/null @@ -1,32 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2017-2019 Petr Vorel - * - * Internal helper functions for the shell library. Do not use directly - * in test programs. - */ - -#ifndef TST_PRIVATE_H_ -#define TST_PRIVATE_H_ - -#include -#include - -#define MAX_IPV4_PREFIX 32 -#define MAX_IPV6_PREFIX 128 - -#define tst_res_comment(...) { \ - fprintf(stderr, "# "); \ - tst_res(__VA_ARGS__); } \ - - -#define tst_brk_comment(...) { \ - fprintf(stderr, "# "); \ - tst_brk(TCONF, __VA_ARGS__); } \ - -void tst_print_svar(const char *name, const char *val); -void tst_print_svar_change(const char *name, const char *val); - -int tst_get_prefix(const char *ip_str, int is_ipv6); - -#endif diff --git a/fsstress/include/tst_process_state.h b/fsstress/include/tst_process_state.h deleted file mode 100644 index c32aa58e68..0000000000 --- a/fsstress/include/tst_process_state.h +++ /dev/null @@ -1,53 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (C) 2012-2014 Cyril Hrubis chrubis@suse.cz - */ - - /* - - These functions helps you wait till a process with given pid changes state. - This is for example useful when you need to wait in parent until child - blocks. - - */ - -#ifndef TST_PROCESS_STATE__ -#define TST_PROCESS_STATE__ - -#include - -/* - * Waits for process state change. - * - * The state is one of the following: - * - * R - process is running - * S - process is sleeping - * D - process sleeping uninterruptibly - * Z - zombie process - * T - process is traced - */ -#ifdef TST_TEST_H__ - -#define TST_PROCESS_STATE_WAIT(pid, state, msec_timeout) \ - tst_process_state_wait(__FILE__, __LINE__, NULL, \ - (pid), (state), (msec_timeout)) -#else -/* - * The same as above but does not use tst_brkm() interface. - * - * This function is intended to be used from child processes. - * - * Returns zero on success, non-zero on failure. - */ -int tst_process_state_wait2(pid_t pid, const char state); - -# define TST_PROCESS_STATE_WAIT(cleanup_fn, pid, state) \ - tst_process_state_wait(__FILE__, __LINE__, (cleanup_fn), \ - (pid), (state), 0) -#endif - -int tst_process_state_wait(const char *file, const int lineno, - void (*cleanup_fn)(void), pid_t pid, - const char state, unsigned int msec_timeout); - -#endif /* TST_PROCESS_STATE__ */ diff --git a/fsstress/include/tst_res_flags.h b/fsstress/include/tst_res_flags.h deleted file mode 100644 index 8eda2f8b81..0000000000 --- a/fsstress/include/tst_res_flags.h +++ /dev/null @@ -1,23 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) Linux Test Project, 2014 - */ - -#ifndef TST_RES_FLAGS_H -#define TST_RES_FLAGS_H - -/* Use low 6 bits to encode test type */ -#define TTYPE_MASK 0x3f -#define TPASS 0 /* Test passed flag */ -#define TFAIL 1 /* Test failed flag */ -#define TBROK 2 /* Test broken flag */ -#define TWARN 4 /* Test warning flag */ -#define TINFO 16 /* Test information flag */ -#define TCONF 32 /* Test not appropriate for configuration flag */ -#define TTYPE_RESULT(ttype) ((ttype) & TTYPE_MASK) - -#define TERRNO 0x100 /* Append errno information to output */ -#define TTERRNO 0x200 /* Append TEST_ERRNO information to output */ -#define TRERRNO 0x400 /* Capture errno information from TEST_RETURN to - output; useful for pthread-like APIs :). */ - -#endif /* TST_RES_FLAGS_H */ diff --git a/fsstress/include/tst_safe_clocks.h b/fsstress/include/tst_safe_clocks.h deleted file mode 100644 index 4cb5f41ed8..0000000000 --- a/fsstress/include/tst_safe_clocks.h +++ /dev/null @@ -1,67 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2019, Linux Test Project - * Copyright (c) Zilogic Systems Pvt. Ltd., 2018 - * Email : code@zilogic.com - */ - -#ifndef TST_SAFE_CLOCKS_H__ -#define TST_SAFE_CLOCKS_H__ - -#include -#include -#include "tst_test.h" -#include "tst_clocks.h" -#include "lapi/syscalls.h" -#include "lapi/posix_clocks.h" - -static inline void safe_clock_getres(const char *file, const int lineno, - clockid_t clk_id, struct timespec *res) -{ - int rval; - - rval = clock_getres(clk_id, res); - if (rval != 0) { - tst_brk(TBROK | TERRNO, - "%s:%d clock_getres(%s) failed", - file, lineno, tst_clock_name(clk_id)); - } -} - -static inline void safe_clock_gettime(const char *file, const int lineno, - clockid_t clk_id, struct timespec *tp) -{ - int rval; - - rval = clock_gettime(clk_id, tp); - if (rval != 0) { - tst_brk(TBROK | TERRNO, - "%s:%d clock_gettime(%s) failed", - file, lineno, tst_clock_name(clk_id)); - } -} - - -static inline void safe_clock_settime(const char *file, const int lineno, - clockid_t clk_id, struct timespec *tp) -{ - int rval; - - rval = clock_settime(clk_id, tp); - if (rval != 0) { - tst_brk(TBROK | TERRNO, - "%s:%d clock_gettime(%s) failed", - file, lineno, tst_clock_name(clk_id)); - } -} - -#define SAFE_CLOCK_GETRES(clk_id, res)\ - safe_clock_getres(__FILE__, __LINE__, (clk_id), (res)) - -#define SAFE_CLOCK_GETTIME(clk_id, tp)\ - safe_clock_gettime(__FILE__, __LINE__, (clk_id), (tp)) - -#define SAFE_CLOCK_SETTIME(clk_id, tp)\ - safe_clock_settime(__FILE__, __LINE__, (clk_id), (tp)) - -#endif /* SAFE_CLOCKS_H__ */ diff --git a/fsstress/include/tst_safe_file_ops.h b/fsstress/include/tst_safe_file_ops.h deleted file mode 100644 index 894c16123d..0000000000 --- a/fsstress/include/tst_safe_file_ops.h +++ /dev/null @@ -1,49 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (C) 2012 Cyril Hrubis chrubis@suse.cz - */ - -#ifndef TST_SAFE_FILE_OPS -#define TST_SAFE_FILE_OPS - -#include "safe_file_ops_fn.h" - -#define SAFE_FILE_SCANF(path, fmt, ...) \ - safe_file_scanf(__FILE__, __LINE__, NULL, \ - (path), (fmt), ## __VA_ARGS__) - -#define FILE_LINES_SCANF(path, fmt, ...) \ - file_lines_scanf(__FILE__, __LINE__, NULL, 0,\ - (path), (fmt), ## __VA_ARGS__) - -#define SAFE_FILE_LINES_SCANF(path, fmt, ...) \ - file_lines_scanf(__FILE__, __LINE__, NULL, 1,\ - (path), (fmt), ## __VA_ARGS__) - -#define SAFE_READ_MEMINFO(item) \ - ({long tst_rval; \ - SAFE_FILE_LINES_SCANF("/proc/meminfo", item " %ld", \ - &tst_rval); \ - tst_rval;}) - -#define FILE_PRINTF(path, fmt, ...) \ - file_printf(__FILE__, __LINE__, \ - (path), (fmt), ## __VA_ARGS__) - -#define SAFE_FILE_PRINTF(path, fmt, ...) \ - safe_file_printf(__FILE__, __LINE__, NULL, \ - (path), (fmt), ## __VA_ARGS__) - -#define SAFE_CP(src, dst) \ - safe_cp(__FILE__, __LINE__, NULL, (src), (dst)) - -#define SAFE_TOUCH(pathname, mode, times) \ - safe_touch(__FILE__, __LINE__, NULL, \ - (pathname), (mode), (times)) - -#define SAFE_MOUNT_OVERLAY() \ - ((void) mount_overlay(__FILE__, __LINE__, 1)) - -#define TST_MOUNT_OVERLAY() \ - (mount_overlay(__FILE__, __LINE__, 0) == 0) - -#endif /* TST_SAFE_FILE_OPS */ diff --git a/fsstress/include/tst_safe_macros.h b/fsstress/include/tst_safe_macros.h deleted file mode 100644 index c39d8768b1..0000000000 --- a/fsstress/include/tst_safe_macros.h +++ /dev/null @@ -1,571 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2010-2018 Linux Test Project - * Copyright (c) 2011-2015 Cyril Hrubis - */ - -#ifndef TST_SAFE_MACROS_H__ -#define TST_SAFE_MACROS_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "safe_macros_fn.h" -#include "tst_cmd.h" - -#define SAFE_BASENAME(path) \ - safe_basename(__FILE__, __LINE__, NULL, (path)) - -#define SAFE_CHDIR(path) \ - safe_chdir(__FILE__, __LINE__, NULL, (path)) - -#define SAFE_CLOSE(fd) do { \ - safe_close(__FILE__, __LINE__, NULL, (fd)); \ - fd = -1; \ - } while (0) - -#define SAFE_CREAT(pathname, mode) \ - safe_creat(__FILE__, __LINE__, NULL, (pathname), (mode)) - -#define SAFE_CHROOT(path) \ - safe_chroot(__FILE__, __LINE__, (path)) -int safe_chroot(const char *file, const int lineno, const char *path); - -#define SAFE_DIRNAME(path) \ - safe_dirname(__FILE__, __LINE__, NULL, (path)) - -static inline int safe_dup(const char *file, const int lineno, - int oldfd) -{ - int rval; - - rval = dup(oldfd); - if (rval == -1) { - tst_brk_(file, lineno, TBROK | TERRNO, - "dup(%i) failed", oldfd); - } - - return rval; -} -#define SAFE_DUP(oldfd) \ - safe_dup(__FILE__, __LINE__, (oldfd)) - -#define SAFE_GETCWD(buf, size) \ - safe_getcwd(__FILE__, __LINE__, NULL, (buf), (size)) - -#define SAFE_GETPWNAM(name) \ - safe_getpwnam(__FILE__, __LINE__, NULL, (name)) - -#define SAFE_GETRUSAGE(who, usage) \ - safe_getrusage(__FILE__, __LINE__, NULL, (who), (usage)) - -#define SAFE_MALLOC(size) \ - safe_malloc(__FILE__, __LINE__, NULL, (size)) - -#define SAFE_MKDIR(pathname, mode) \ - safe_mkdir(__FILE__, __LINE__, NULL, (pathname), (mode)) - -#define SAFE_RMDIR(pathname) \ - safe_rmdir(__FILE__, __LINE__, NULL, (pathname)) - -#define SAFE_MUNMAP(addr, length) \ - safe_munmap(__FILE__, __LINE__, NULL, (addr), (length)) - -#define SAFE_OPEN(pathname, oflags, ...) \ - safe_open(__FILE__, __LINE__, NULL, (pathname), (oflags), \ - ##__VA_ARGS__) - -#define SAFE_PIPE(fildes) \ - safe_pipe(__FILE__, __LINE__, NULL, (fildes)) - -int safe_pipe2(const char *file, const int lineno, int fildes[2], int flags); - -#define SAFE_PIPE2(fildes, flags) \ - safe_pipe2(__FILE__, __LINE__, (fildes), (flags)) - -#define SAFE_READ(len_strict, fildes, buf, nbyte) \ - safe_read(__FILE__, __LINE__, NULL, (len_strict), (fildes), (buf), (nbyte)) - -#define SAFE_SETEGID(egid) \ - safe_setegid(__FILE__, __LINE__, NULL, (egid)) - -#define SAFE_SETEUID(euid) \ - safe_seteuid(__FILE__, __LINE__, NULL, (euid)) - -#define SAFE_SETGID(gid) \ - safe_setgid(__FILE__, __LINE__, NULL, (gid)) - -#define SAFE_SETUID(uid) \ - safe_setuid(__FILE__, __LINE__, NULL, (uid)) - -int safe_setregid(const char *file, const int lineno, - gid_t rgid, gid_t egid); - -#define SAFE_SETREGID(rgid, egid) \ - safe_setregid(__FILE__, __LINE__, (rgid), (egid)) - -int safe_setreuid(const char *file, const int lineno, - uid_t ruid, uid_t euid); - -#define SAFE_SETREUID(ruid, euid) \ - safe_setreuid(__FILE__, __LINE__, (ruid), (euid)) - -#define SAFE_GETRESUID(ruid, euid, suid) \ - safe_getresuid(__FILE__, __LINE__, NULL, (ruid), (euid), (suid)) - -#define SAFE_GETRESGID(rgid, egid, sgid) \ - safe_getresgid(__FILE__, __LINE__, NULL, (rgid), (egid), (sgid)) - -int safe_setpgid(const char *file, const int lineno, pid_t pid, pid_t pgid); - -#define SAFE_SETPGID(pid, pgid) \ - safe_setpgid(__FILE__, __LINE__, (pid), (pgid)); - -pid_t safe_getpgid(const char *file, const int lineno, pid_t pid); - -#define SAFE_GETPGID(pid) \ - safe_getpgid(__FILE__, __LINE__, (pid)) - -#define SAFE_UNLINK(pathname) \ - safe_unlink(__FILE__, __LINE__, NULL, (pathname)) - -#define SAFE_LINK(oldpath, newpath) \ - safe_link(__FILE__, __LINE__, NULL, (oldpath), (newpath)) - -#define SAFE_LINKAT(olddirfd, oldpath, newdirfd, newpath, flags) \ - safe_linkat(__FILE__, __LINE__, NULL, (olddirfd), (oldpath), \ - (newdirfd), (newpath), (flags)) - -#define SAFE_READLINK(path, buf, bufsize) \ - safe_readlink(__FILE__, __LINE__, NULL, (path), (buf), (bufsize)) - -#define SAFE_SYMLINK(oldpath, newpath) \ - safe_symlink(__FILE__, __LINE__, NULL, (oldpath), (newpath)) - -#define SAFE_WRITE(len_strict, fildes, buf, nbyte) \ - safe_write(__FILE__, __LINE__, NULL, (len_strict), (fildes), (buf), (nbyte)) - -#define SAFE_STRTOL(str, min, max) \ - safe_strtol(__FILE__, __LINE__, NULL, (str), (min), (max)) - -#define SAFE_STRTOUL(str, min, max) \ - safe_strtoul(__FILE__, __LINE__, NULL, (str), (min), (max)) - -#define SAFE_SYSCONF(name) \ - safe_sysconf(__FILE__, __LINE__, NULL, name) - -#define SAFE_CHMOD(path, mode) \ - safe_chmod(__FILE__, __LINE__, NULL, (path), (mode)) - -#define SAFE_FCHMOD(fd, mode) \ - safe_fchmod(__FILE__, __LINE__, NULL, (fd), (mode)) - -#define SAFE_CHOWN(path, owner, group) \ - safe_chown(__FILE__, __LINE__, NULL, (path), (owner), (group)) - -#define SAFE_FCHOWN(fd, owner, group) \ - safe_fchown(__FILE__, __LINE__, NULL, (fd), (owner), (group)) - -#define SAFE_WAIT(status) \ - safe_wait(__FILE__, __LINE__, NULL, (status)) - -#define SAFE_WAITPID(pid, status, opts) \ - safe_waitpid(__FILE__, __LINE__, NULL, (pid), (status), (opts)) - -#define SAFE_KILL(pid, sig) \ - safe_kill(__FILE__, __LINE__, NULL, (pid), (sig)) - -#define SAFE_MEMALIGN(alignment, size) \ - safe_memalign(__FILE__, __LINE__, NULL, (alignment), (size)) - -#define SAFE_MKFIFO(pathname, mode) \ - safe_mkfifo(__FILE__, __LINE__, NULL, (pathname), (mode)) - -#define SAFE_RENAME(oldpath, newpath) \ - safe_rename(__FILE__, __LINE__, NULL, (oldpath), (newpath)) - -#define SAFE_MOUNT(source, target, filesystemtype, \ - mountflags, data) \ - safe_mount(__FILE__, __LINE__, NULL, (source), (target), \ - (filesystemtype), (mountflags), (data)) - -#define SAFE_UMOUNT(target) \ - safe_umount(__FILE__, __LINE__, NULL, (target)) - -#define SAFE_OPENDIR(name) \ - safe_opendir(__FILE__, __LINE__, NULL, (name)) - -#define SAFE_CLOSEDIR(dirp) \ - safe_closedir(__FILE__, __LINE__, NULL, (dirp)) - -#define SAFE_READDIR(dirp) \ - safe_readdir(__FILE__, __LINE__, NULL, (dirp)) - -#define SAFE_IOCTL(fd, request, ...) \ - ({int tst_ret_ = ioctl(fd, request, ##__VA_ARGS__); \ - tst_ret_ < 0 ? \ - tst_brk(TBROK | TERRNO, \ - "ioctl(%i,%s,...) failed", fd, #request), 0 \ - : tst_ret_;}) - -#define SAFE_FCNTL(fd, cmd, ...) \ - ({int tst_ret_ = fcntl(fd, cmd, ##__VA_ARGS__); \ - tst_ret_ == -1 ? \ - tst_brk(TBROK | TERRNO, \ - "fcntl(%i,%s,...) failed", fd, #cmd), 0 \ - : tst_ret_;}) - -/* - * following functions are inline because the behaviour may depend on - * -D_FILE_OFFSET_BITS=64 -DOFF_T=off64_t compile flags - */ - -static inline void *safe_mmap(const char *file, const int lineno, - void *addr, size_t length, - int prot, int flags, int fd, off_t offset) -{ - void *rval; - - rval = mmap(addr, length, prot, flags, fd, offset); - if (rval == MAP_FAILED) { - tst_brk_(file, lineno, TBROK | TERRNO, - "mmap(%p,%zu,%d,%d,%d,%ld) failed", - addr, length, prot, flags, fd, (long) offset); - } - - return rval; -} -#define SAFE_MMAP(addr, length, prot, flags, fd, offset) \ - safe_mmap(__FILE__, __LINE__, (addr), (length), (prot), \ - (flags), (fd), (offset)) - -static inline int safe_ftruncate(const char *file, const int lineno, - int fd, off_t length) -{ - int rval; - - rval = ftruncate(fd, length); - if (rval == -1) { - tst_brk_(file, lineno, TBROK | TERRNO, - "ftruncate(%d,%ld) failed", - fd, (long)length); - } - - return rval; -} -#define SAFE_FTRUNCATE(fd, length) \ - safe_ftruncate(__FILE__, __LINE__, (fd), (length)) - -static inline int safe_truncate(const char *file, const int lineno, - const char *path, off_t length) -{ - int rval; - - rval = truncate(path, length); - if (rval == -1) { - tst_brk_(file, lineno, TBROK | TERRNO, - "truncate(%s,%ld) failed", - path, (long)length); - } - - return rval; -} -#define SAFE_TRUNCATE(path, length) \ - safe_truncate(__FILE__, __LINE__, (path), (length)) - -static inline int safe_stat(const char *file, const int lineno, - const char *path, struct stat *buf) -{ - int rval; - - rval = stat(path, buf); - - if (rval == -1) { - tst_brk_(file, lineno, TBROK | TERRNO, - "stat(%s,%p) failed", path, buf); - } - - return rval; -} -#define SAFE_STAT(path, buf) \ - safe_stat(__FILE__, __LINE__, (path), (buf)) - -static inline int safe_fstat(const char *file, const int lineno, - int fd, struct stat *buf) -{ - int rval; - - rval = fstat(fd, buf); - - if (rval == -1) { - tst_brk_(file, lineno, TBROK | TERRNO, - "fstat(%d,%p) failed", fd, buf); - } - - return rval; -} -#define SAFE_FSTAT(fd, buf) \ - safe_fstat(__FILE__, __LINE__, (fd), (buf)) - -static inline int safe_lstat(const char *file, const int lineno, - const char *path, struct stat *buf) -{ - int rval; - - rval = lstat(path, buf); - - if (rval == -1) { - tst_brk_(file, lineno, TBROK | TERRNO, - "lstat(%s,%p) failed", path, buf); - } - - return rval; -} -#define SAFE_LSTAT(path, buf) \ - safe_lstat(__FILE__, __LINE__, (path), (buf)) - -static inline int safe_statfs(const char *file, const int lineno, - const char *path, struct statfs *buf) -{ - int rval; - - rval = statfs(path, buf); - - if (rval == -1) { - tst_brk_(file, lineno, TBROK | TERRNO, - "statfs(%s,%p) failed", path, buf); - } - - return rval; -} -#define SAFE_STATFS(path, buf) \ - safe_statfs(__FILE__, __LINE__, (path), (buf)) - -static inline off_t safe_lseek(const char *file, const int lineno, - int fd, off_t offset, int whence) -{ - off_t rval; - - rval = lseek(fd, offset, whence); - - if (rval == (off_t) -1) { - tst_brk_(file, lineno, TBROK | TERRNO, - "lseek(%d,%ld,%d) failed", - fd, (long)offset, whence); - } - - return rval; -} -#define SAFE_LSEEK(fd, offset, whence) \ - safe_lseek(__FILE__, __LINE__, (fd), (offset), (whence)) - -static inline int safe_getrlimit(const char *file, const int lineno, - int resource, struct rlimit *rlim) -{ - int rval; - - rval = getrlimit(resource, rlim); - - if (rval == -1) { - tst_brk_(file, lineno, TBROK | TERRNO, - "getrlimit(%d,%p) failed", - resource, rlim); - } - - return rval; -} -#define SAFE_GETRLIMIT(resource, rlim) \ - safe_getrlimit(__FILE__, __LINE__, (resource), (rlim)) - -static inline int safe_setrlimit(const char *file, const int lineno, - int resource, const struct rlimit *rlim) -{ - int rval; - - rval = setrlimit(resource, rlim); - - if (rval == -1) { - tst_brk_(file, lineno, TBROK | TERRNO, - "setrlimit(%d,%p) failed", - resource, rlim); - } - - return rval; -} -#define SAFE_SETRLIMIT(resource, rlim) \ - safe_setrlimit(__FILE__, __LINE__, (resource), (rlim)) - -typedef void (*sighandler_t)(int); -static inline sighandler_t safe_signal(const char *file, const int lineno, - int signum, sighandler_t handler) -{ - sighandler_t rval; - - rval = signal(signum, handler); - - if (rval == SIG_ERR) { - tst_brk_(file, lineno, TBROK | TERRNO, - "signal(%d,%p) failed", - signum, handler); - } - - return rval; -} - -#define SAFE_SIGNAL(signum, handler) \ - safe_signal(__FILE__, __LINE__, (signum), (handler)) - -int safe_sigaction(const char *file, const int lineno, - int signum, const struct sigaction *act, - struct sigaction *oldact); -#define SAFE_SIGACTION(signum, act, oldact) \ - safe_sigaction(__FILE__, __LINE__, (signum), (act), (oldact)) - -#define SAFE_EXECLP(file, arg, ...) do { \ - execlp((file), (arg), ##__VA_ARGS__); \ - tst_brk_(__FILE__, __LINE__, TBROK | TERRNO, \ - "execlp(%s, %s, ...) failed", file, arg); \ - } while (0) - -#define SAFE_EXECL(file, arg, ...) do { \ - execl((file), (arg), ##__VA_ARGS__); \ - tst_brk_(__FILE__, __LINE__, TBROK | TERRNO, \ - "execl(%s, %s, ...) failed", file, arg); \ - } while (0) - -int safe_getpriority(const char *file, const int lineno, int which, id_t who); -#define SAFE_GETPRIORITY(which, who) \ - safe_getpriority(__FILE__, __LINE__, (which), (who)) - -struct group *safe_getgrnam(const char *file, const int lineno, - const char *name); -#define SAFE_GETGRNAM(name) \ - safe_getgrnam(__FILE__, __LINE__, (name)) - -struct group *safe_getgrnam_fallback(const char *file, const int lineno, - const char *name, const char *fallback); -#define SAFE_GETGRNAM_FALLBACK(name, fallback) \ - safe_getgrnam_fallback(__FILE__, __LINE__, (name), (fallback)) - -struct group *safe_getgrgid(const char *file, const int lineno, gid_t gid); -#define SAFE_GETGRGID(gid) \ - safe_getgrgid(__FILE__, __LINE__, (gid)) - -ssize_t safe_getxattr(const char *file, const int lineno, const char *path, - const char *name, void *value, size_t size); -#define SAFE_GETXATTR(path, name, value, size) \ - safe_getxattr(__FILE__, __LINE__, (path), (name), (value), (size)) - -int safe_setxattr(const char *file, const int lineno, const char *path, - const char *name, const void *value, size_t size, int flags); -#define SAFE_SETXATTR(path, name, value, size, flags) \ - safe_setxattr(__FILE__, __LINE__, (path), (name), (value), (size), (flags)) - -int safe_lsetxattr(const char *file, const int lineno, const char *path, - const char *name, const void *value, size_t size, int flags); -#define SAFE_LSETXATTR(path, name, value, size, flags) \ - safe_lsetxattr(__FILE__, __LINE__, (path), (name), (value), (size), (flags)) - -int safe_fsetxattr(const char *file, const int lineno, int fd, const char *name, - const void *value, size_t size, int flags); -#define SAFE_FSETXATTR(fd, name, value, size, flags) \ - safe_fsetxattr(__FILE__, __LINE__, (fd), (name), (value), (size), (flags)) - -int safe_removexattr(const char *file, const int lineno, const char *path, - const char *name); -#define SAFE_REMOVEXATTR(path, name) \ - safe_removexattr(__FILE__, __LINE__, (path), (name)) - -int safe_lremovexattr(const char *file, const int lineno, const char *path, - const char *name); -#define SAFE_LREMOVEXATTR(path, name) \ - safe_lremovexattr(__FILE__, __LINE__, (path), (name)) - -int safe_fremovexattr(const char *file, const int lineno, int fd, - const char *name); -#define SAFE_FREMOVEXATTR(fd, name) \ - safe_fremovexattr(__FILE__, __LINE__, (fd), (name)) - -int safe_fsync(const char *file, const int lineno, int fd); -#define SAFE_FSYNC(fd) safe_fsync(__FILE__, __LINE__, (fd)) - -int safe_setsid(const char *file, const int lineno); -#define SAFE_SETSID() safe_setsid(__FILE__, __LINE__) - -int safe_mknod(const char *file, const int lineno, const char *pathname, - mode_t mode, dev_t dev); -#define SAFE_MKNOD(pathname, mode, dev) \ - safe_mknod(__FILE__, __LINE__, (pathname), (mode), (dev)) - -int safe_mlock(const char *file, const int lineno, const char *addr, - size_t len); -#define SAFE_MLOCK(addr, len) safe_mlock(__FILE__, __LINE__, (addr), (len)) - -int safe_munlock(const char *file, const int lineno, const char *addr, - size_t len); -#define SAFE_MUNLOCK(addr, len) safe_munlock(__FILE__, __LINE__, (addr), (len)) - -int safe_mincore(const char *file, const int lineno, void *start, - size_t length, unsigned char *vec); -#define SAFE_MINCORE(start, length, vec) \ - safe_mincore(__FILE__, __LINE__, (start), (length), (vec)) - -int safe_fanotify_init(const char *file, const int lineno, - unsigned int flags, unsigned int event_f_flags); -#define SAFE_FANOTIFY_INIT(fan, mode) \ - safe_fanotify_init(__FILE__, __LINE__, (fan), (mode)) - -int safe_personality(const char *filename, unsigned int lineno, - unsigned long persona); -#define SAFE_PERSONALITY(persona) safe_personality(__FILE__, __LINE__, persona) - -#define SAFE_SETENV(name, value, overwrite) do { \ - if (setenv(name, value, overwrite)) { \ - tst_brk_(__FILE__, __LINE__, TBROK | TERRNO, \ - "setenv(%s, %s, %d) failed", \ - name, value, overwrite); \ - } \ - } while (0) - -void safe_unshare(const char *file, const int lineno, int flags); -#define SAFE_UNSHARE(flags) safe_unshare(__FILE__, __LINE__, (flags)) - -void safe_setns(const char *file, const int lineno, int fd, int nstype); -#define SAFE_SETNS(fd, nstype) safe_setns(__FILE__, __LINE__, (fd), (nstype)); - -static inline void safe_cmd(const char *file, const int lineno, const char *const argv[], - const char *stdout_path, const char *stderr_path) -{ - int rval; - - switch ((rval = tst_cmd(argv, stdout_path, stderr_path, - TST_CMD_PASS_RETVAL | TST_CMD_TCONF_ON_MISSING))) { - case 0: - break; - default: - tst_brk(TBROK, "%s:%d: %s failed (%d)", file, lineno, argv[0], rval); - } -} -#define SAFE_CMD(argv, stdout_path, stderr_path) \ - safe_cmd(__FILE__, __LINE__, (argv), (stdout_path), (stderr_path)) -/* - * SAFE_PTRACE() treats any non-zero return value as error. Don't use it - * for requests like PTRACE_PEEK* or PTRACE_SECCOMP_GET_FILTER which use - * the return value to pass arbitrary data. - */ -long tst_safe_ptrace(const char *file, const int lineno, int req, pid_t pid, - void *addr, void *data); -#define SAFE_PTRACE(req, pid, addr, data) \ - tst_safe_ptrace(__FILE__, __LINE__, req, pid, addr, data) - -#endif /* SAFE_MACROS_H__ */ diff --git a/fsstress/include/tst_safe_net.h b/fsstress/include/tst_safe_net.h deleted file mode 100644 index 78a488a18d..0000000000 --- a/fsstress/include/tst_safe_net.h +++ /dev/null @@ -1,79 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2016 Cyril Hrubis - */ - -#ifndef TST_SAFE_NET_H__ -#define TST_SAFE_NET_H__ - -#include -#include -#include -#include -#include - -#include "safe_net_fn.h" -#include "tst_net.h" - -#define SAFE_SOCKET(domain, type, protocol) \ - safe_socket(__FILE__, __LINE__, NULL, domain, type, protocol) - -#define SAFE_SOCKETPAIR(domain, type, protocol, sv) \ - safe_socketpair(__FILE__, __LINE__, domain, type, protocol, sv) - -#define SAFE_GETSOCKOPT(fd, level, optname, optval, optlen) \ - safe_getsockopt(__FILE__, __LINE__, fd, level, optname, optval, optlen) - -#define SAFE_SETSOCKOPT(fd, level, optname, optval, optlen) \ - safe_setsockopt(__FILE__, __LINE__, fd, level, optname, optval, optlen) - -#define SAFE_SETSOCKOPT_INT(fd, l, n, val) \ - do { \ - int v = val; \ - safe_setsockopt(__FILE__, __LINE__, fd, l, n, &v, sizeof(v)); \ - } while (0) - -#define SAFE_SEND(strict, sockfd, buf, len, flags) \ - safe_send(__FILE__, __LINE__, strict, sockfd, buf, len, flags) - -#define SAFE_SENDTO(strict, fd, buf, len, flags, dest_addr, addrlen) \ - safe_sendto(__FILE__, __LINE__, strict, fd, buf, len, flags, \ - dest_addr, addrlen) - -#define SAFE_SENDMSG(msg_len, fd, msg, flags) \ - safe_sendmsg(__FILE__, __LINE__, msg_len, fd, msg, flags) - -#define SAFE_RECVMSG(msg_len, fd, msg, flags) \ - safe_recvmsg(__FILE__, __LINE__, msg_len, fd, msg, flags) - -#define SAFE_BIND(socket, address, address_len) \ - safe_bind(__FILE__, __LINE__, NULL, socket, address, \ - address_len) - -#define SAFE_LISTEN(socket, backlog) \ - safe_listen(__FILE__, __LINE__, NULL, socket, backlog) - -#define SAFE_ACCEPT(sockfd, addr, addrlen) \ - safe_accept(__FILE__, __LINE__, NULL, sockfd, addr, addrlen) - -#define SAFE_CONNECT(sockfd, addr, addrlen) \ - safe_connect(__FILE__, __LINE__, NULL, sockfd, addr, addrlen) - -#define SAFE_GETSOCKNAME(sockfd, addr, addrlen) \ - safe_getsockname(__FILE__, __LINE__, NULL, sockfd, addr, \ - addrlen) - -#define SAFE_GETHOSTNAME(name, size) \ - safe_gethostname(__FILE__, __LINE__, name, size) - -#define TST_GETSOCKPORT(sockfd) \ - tst_getsockport(__FILE__, __LINE__, sockfd) - -#define TST_GET_UNUSED_PORT(family, type) \ - tst_get_unused_port(__FILE__, __LINE__, NULL, family, type) - -/* new API only */ - -#define SAFE_GETADDRINFO(src_addr, port, hints, addr_info) \ - safe_getaddrinfo(__FILE__, __LINE__, src_addr, port, hints, addr_info) - -#endif /* TST_SAFE_NET_H__ */ diff --git a/fsstress/include/tst_safe_posix_ipc.h b/fsstress/include/tst_safe_posix_ipc.h deleted file mode 100644 index d74ef4ee89..0000000000 --- a/fsstress/include/tst_safe_posix_ipc.h +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (C) 2017-2019 Petr Vorel pvorel@suse.cz - */ - -#ifndef TST_SAFE_POSIX_IPC_H__ -#define TST_SAFE_POSIX_IPC_H__ - -#include -#include - -#define SAFE_MQ_OPEN(pathname, oflags, ...) \ - safe_mq_open(__FILE__, __LINE__, (pathname), (oflags), ##__VA_ARGS__) - -static inline int safe_mq_open(const char *file, const int lineno, - const char *pathname, int oflags, ...) -{ - va_list ap; - int rval; - mode_t mode; - struct mq_attr *attr; - - va_start(ap, oflags); - - /* Android's NDK's mode_t is smaller than an int, which results in - * SIGILL here when passing the mode_t type. - */ -#ifndef __ANDROID__ - mode = va_arg(ap, mode_t); -#else - mode = va_arg(ap, int); -#endif - - attr = va_arg(ap, struct mq_attr *); - - va_end(ap); - - rval = mq_open(pathname, oflags, mode, attr); - if (rval == -1) { - tst_brk(TBROK | TERRNO, "%s:%d: mq_open(%s,%d,0%o,%p) failed", - file, lineno, pathname, oflags, mode, attr); - } - - return rval; -} - -#endif /* TST_SAFE_POSIX_IPC_H__ */ diff --git a/fsstress/include/tst_safe_prw.h b/fsstress/include/tst_safe_prw.h deleted file mode 100644 index 01a684da31..0000000000 --- a/fsstress/include/tst_safe_prw.h +++ /dev/null @@ -1,47 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2010-2017 Linux Test Project - */ - -#ifndef TST_SAFE_PRW_H__ -#define TST_SAFE_PRW_H__ - -static inline ssize_t safe_pread(const char *file, const int lineno, - char len_strict, int fildes, void *buf, size_t nbyte, - off_t offset) -{ - ssize_t rval; - - rval = pread(fildes, buf, nbyte, offset); - - if (rval == -1 || (len_strict && (size_t)rval != nbyte)) { - tst_brk_(file, lineno, TBROK | TERRNO, - "pread(%d,%p,%zu,%lld) failed", - fildes, buf, nbyte, (long long)offset); - } - - return rval; -} -#define SAFE_PREAD(len_strict, fildes, buf, nbyte, offset) \ - safe_pread(__FILE__, __LINE__, (len_strict), (fildes), \ - (buf), (nbyte), (offset)) - -static inline ssize_t safe_pwrite(const char *file, const int lineno, - char len_strict, int fildes, const void *buf, size_t nbyte, - off_t offset) -{ - ssize_t rval; - - rval = pwrite(fildes, buf, nbyte, offset); - if (rval == -1 || (len_strict && (size_t)rval != nbyte)) { - tst_brk_(file, lineno, TBROK | TERRNO, - "pwrite(%d,%p,%zu,%lld) failed", - fildes, buf, nbyte, (long long)offset); - } - - return rval; -} -#define SAFE_PWRITE(len_strict, fildes, buf, nbyte, offset) \ - safe_pwrite(__FILE__, __LINE__, (len_strict), (fildes), \ - (buf), (nbyte), (offset)) - -#endif /* SAFE_PRW_H__ */ diff --git a/fsstress/include/tst_safe_pthread.h b/fsstress/include/tst_safe_pthread.h deleted file mode 100644 index 0c6d4d2010..0000000000 --- a/fsstress/include/tst_safe_pthread.h +++ /dev/null @@ -1,33 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2016 Oracle and/or its affiliates. All Rights Reserved. - */ - -#ifndef TST_SAFE_PTHREAD_H__ -#define TST_SAFE_PTHREAD_H__ - -/* - * Macro to use for making functions called only once in - * multi-threaded tests such as init or cleanup function. - * The first call to @name_fn function by any thread shall - * call the @exec_fn. Subsequent calls shall not call @exec_fn. - * *_fn functions must not take any arguments. - */ -#define TST_DECLARE_ONCE_FN(name_fn, exec_fn) \ - void name_fn(void) \ - { \ - static pthread_once_t ltp_once = PTHREAD_ONCE_INIT; \ - pthread_once(<p_once, exec_fn); \ - } - -int safe_pthread_create(const char *file, const int lineno, - pthread_t *thread_id, const pthread_attr_t *attr, - void *(*thread_fn)(void *), void *arg); -#define SAFE_PTHREAD_CREATE(thread_id, attr, thread_fn, arg) \ - safe_pthread_create(__FILE__, __LINE__, thread_id, attr, thread_fn, arg) - -int safe_pthread_join(const char *file, const int lineno, - pthread_t thread_id, void **retval); -#define SAFE_PTHREAD_JOIN(thread_id, retval) \ - safe_pthread_join(__FILE__, __LINE__, thread_id, retval) - -#endif /* TST_SAFE_PTHREAD_H__ */ diff --git a/fsstress/include/tst_safe_stdio.h b/fsstress/include/tst_safe_stdio.h deleted file mode 100644 index e4bff34da1..0000000000 --- a/fsstress/include/tst_safe_stdio.h +++ /dev/null @@ -1,24 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2013-2016 Cyril Hrubis - */ - -#ifndef TST_SAFE_STDIO_H__ -#define TST_SAFE_STDIO_H__ - -#include - -#include "safe_stdio_fn.h" - -#define SAFE_FOPEN(path, mode) \ - safe_fopen(__FILE__, __LINE__, NULL, path, mode) - -#define SAFE_FCLOSE(f) \ - safe_fclose(__FILE__, __LINE__, NULL, f) - -#define SAFE_ASPRINTF(strp, fmt, ...) \ - safe_asprintf(__FILE__, __LINE__, NULL, strp, fmt, __VA_ARGS__) - -#define SAFE_POPEN(command, type) \ - safe_popen(__FILE__, __LINE__, NULL, command, type) - -#endif /* TST_SAFE_STDIO_H__ */ diff --git a/fsstress/include/tst_safe_sysv_ipc.h b/fsstress/include/tst_safe_sysv_ipc.h deleted file mode 100644 index 3e0e50e8de..0000000000 --- a/fsstress/include/tst_safe_sysv_ipc.h +++ /dev/null @@ -1,54 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2017 Xiao yang - */ - -#ifndef TST_SAFE_SYSV_IPC_H__ -#define TST_SAFE_SYSV_IPC_H__ - -#include -#include -#include -#include - -int safe_msgget(const char *file, const int lineno, key_t key, int msgflg); -#define SAFE_MSGGET(key, msgflg) \ - safe_msgget(__FILE__, __LINE__, (key), (msgflg)) - -int safe_msgsnd(const char *file, const int lineno, int msqid, const void *msgp, - size_t msgsz, int msgflg); -#define SAFE_MSGSND(msqid, msgp, msgsz, msgflg) \ - safe_msgsnd(__FILE__, __LINE__, (msqid), (msgp), (msgsz), (msgflg)) - -ssize_t safe_msgrcv(const char *file, const int lineno, int msqid, void *msgp, - size_t msgsz, long msgtyp, int msgflg); -#define SAFE_MSGRCV(msqid, msgp, msgsz, msgtyp, msgflg) \ - safe_msgrcv(__FILE__, __LINE__, (msqid), (msgp), (msgsz), (msgtyp), (msgflg)) - -int safe_msgctl(const char *file, const int lineno, int msqid, int cmd, - struct msqid_ds *buf); -#define SAFE_MSGCTL(msqid, cmd, buf) ({ \ - int tst_ret_ = safe_msgctl(__FILE__, __LINE__, (msqid), (cmd), (buf)); \ - (msqid) = ((cmd) == IPC_RMID ? -1 : (msqid)); \ - tst_ret_;}) - -int safe_shmget(const char *file, const int lineno, key_t key, size_t size, - int shmflg); -#define SAFE_SHMGET(key, size, shmflg) \ - safe_shmget(__FILE__, __LINE__, (key), (size), (shmflg)) - -void *safe_shmat(const char *file, const int lineno, int shmid, - const void *shmaddr, int shmflg); -#define SAFE_SHMAT(shmid, shmaddr, shmflg) \ - safe_shmat(__FILE__, __LINE__, (shmid), (shmaddr), (shmflg)) - -int safe_shmdt(const char *file, const int lineno, const void *shmaddr); -#define SAFE_SHMDT(shmaddr) safe_shmdt(__FILE__, __LINE__, (shmaddr)) - -int safe_shmctl(const char *file, const int lineno, int shmid, int cmd, - struct shmid_ds *buf); -#define SAFE_SHMCTL(shmid, cmd, buf) ({ \ - int tst_ret_ = safe_shmctl(__FILE__, __LINE__, (shmid), (cmd), (buf)); \ - (shmid) = ((cmd) == IPC_RMID ? -1 : (shmid)); \ - tst_ret_;}) - -#endif /* TST_SAFE_SYSV_IPC_H__ */ diff --git a/fsstress/include/tst_safe_timerfd.h b/fsstress/include/tst_safe_timerfd.h deleted file mode 100644 index 526f128389..0000000000 --- a/fsstress/include/tst_safe_timerfd.h +++ /dev/null @@ -1,32 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2020 Petr Vorel - */ - -#ifndef TST_SAFE_TIMERFD_H__ -#define TST_SAFE_TIMERFD_H__ - -#include "lapi/timerfd.h" - -int safe_timerfd_create(const char *file, const int lineno, - int clockid, int flags); - -#define SAFE_TIMERFD_CREATE(clockid, flags)\ - safe_timerfd_create(__FILE__, __LINE__, (clockid), (flags)) - -int safe_timerfd_gettime(const char *file, const int lineno, - int fd, struct itimerspec *curr_value); - -#define SAFE_TIMERFD_GETTIME(fd, curr_value)\ - safe_timerfd_gettime(__FILE__, __LINE__, (fd), (curr_value)) - -int safe_timerfd_settime(const char *file, const int lineno, - int fd, int flags, - const struct itimerspec *new_value, - struct itimerspec *old_value); - -#define SAFE_TIMERFD_SETTIME(fd, flags, new_value, old_value)\ - safe_timerfd_settime(__FILE__, __LINE__, (fd), (flags), (new_value), \ - (old_value)) - -#endif /* SAFE_TIMERFD_H__ */ diff --git a/fsstress/include/tst_sig_proc.h b/fsstress/include/tst_sig_proc.h deleted file mode 100644 index b85981e772..0000000000 --- a/fsstress/include/tst_sig_proc.h +++ /dev/null @@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2016 Linux Test Project - */ - -#ifndef TST_SIG_PROC_H__ -#define TST_SIG_PROC_H__ - -#include - -pid_t create_sig_proc(int sig, int count, unsigned int usec); - -#endif /* TST_SIG_PROC_H__ */ diff --git a/fsstress/include/tst_sys_conf.h b/fsstress/include/tst_sys_conf.h deleted file mode 100644 index 323e29a278..0000000000 --- a/fsstress/include/tst_sys_conf.h +++ /dev/null @@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (c) 2018 Jan Stancek - */ - -#ifndef TST_SYS_CONF_H__ -#define TST_SYS_CONF_H__ - -struct tst_sys_conf { - char path[PATH_MAX]; - char value[PATH_MAX]; - struct tst_sys_conf *next; -}; - -int tst_sys_conf_save_str(const char *path, const char *value); -int tst_sys_conf_save(const char *path); -void tst_sys_conf_restore(int verbose); -void tst_sys_conf_dump(void); - -#endif diff --git a/fsstress/include/tst_taint.h b/fsstress/include/tst_taint.h deleted file mode 100644 index cfa84dded2..0000000000 --- a/fsstress/include/tst_taint.h +++ /dev/null @@ -1,93 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2018 Michael Moese - */ - -/* Usage example - * - * ... - * #include "tst_test.h" - * #include "tst_taint.h" - * .. - * void setup(void) - * { - * ... - * tst_taint_init(TST_TAINT_W | TST_TAINT_D)); - * ... - * } - * - * void run(void) - * { - * ... - * . test code here - * ... - * if (tst_taint_check() != 0) - * tst_res(TFAIL, "kernel has issues"); - * else - * tst_res(TPASS, "kernel seems to be fine"); - * } - * - * - * - * The above code checks, if the kernel issued a warning (TST_TAINT_W) - * or even died (TST_TAINT_D) during test execution. - * If these are set after running a test case, we most likely - * triggered a kernel bug. - */ - -#ifndef TST_TAINTED_H__ -#define TST_TAINTED_H__ - -/* - * This are all 17 flags that are present in kernel 4.15 - * see kernel/panic.c in kernel sources - * - * Not all of them are valid in all kernel versions. - */ -#define TST_TAINT_G (1 << 0) /* a module with non-GPL license loaded */ -#define TST_TAINT_F (1 << 1) /* a module was force-loaded */ -#define TST_TAINT_S (1 << 2) /* SMP with Non-SMP kernel */ -#define TST_TAINT_R (1 << 3) /* module force unloaded */ -#define TST_TAINT_M (1 << 4) /* machine check error occurred */ -#define TST_TAINT_B (1 << 5) /* page-release function found bad page */ -#define TST_TAINT_U (1 << 6) /* user requested taint flag */ -#define TST_TAINT_D (1 << 7) /* kernel died recently - OOPS or BUG */ -#define TST_TAINT_A (1 << 8) /* ACPI table has been overwritten */ -#define TST_TAINT_W (1 << 9) /* a warning has been issued by kernel */ -#define TST_TAINT_C (1 << 10) /* driver from drivers/staging was loaded */ -#define TST_TAINT_I (1 << 11) /* working around BIOS/Firmware bug */ -#define TST_TAINT_O (1 << 12) /* out of tree module loaded */ -#define TST_TAINT_E (1 << 13) /* unsigned module was loaded */ -#define TST_TAINT_L (1 << 14) /* A soft lock-up has previously occurred */ -#define TST_TAINT_K (1 << 15) /* kernel has been live-patched */ -#define TST_TAINT_X (1 << 16) /* auxiliary taint, for distro's use */ -#define TST_TAINT_T (1 << 17) /* kernel was built with the struct randomization plugin */ - -/* - * Initialize and prepare support for checking tainted kernel. - * - * supply the mask of TAINT-flags you want to check, for example - * (TST_TAINT_W | TST_TAINT_D) when you want to check if the kernel issued - * a warning or even reported it died. - * - * This function tests if the requested flags are supported on the - * locally running kernel. In case the tainted-flags are already set by - * the kernel, there is no reason to continue and TCONF is generated. - * - * The mask must not be zero. - */ -void tst_taint_init(unsigned int mask); - - -/* - * check if the tainted flags handed to tst_taint_init() are still not set - * during or after running the test. - * Calling this function is only allowed after tst_taint_init() was called, - * otherwise TBROK will be generated. - * - * returns 0 or a bitmask of the flags that currently tainted the kernel. - */ -unsigned int tst_taint_check(void); - - -#endif /* TST_TAINTED_H__ */ diff --git a/fsstress/include/tst_test.h b/fsstress/include/tst_test.h deleted file mode 100644 index b84f7b9dd5..0000000000 --- a/fsstress/include/tst_test.h +++ /dev/null @@ -1,325 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2015-2016 Cyril Hrubis - * Copyright (c) Linux Test Project, 2016-2019 - */ - -#ifndef TST_TEST_H__ -#define TST_TEST_H__ - -#ifdef __TEST_H__ -# error Oldlib test.h already included -#endif /* __TEST_H__ */ - -#include -#include -#include -#include - -#include "tst_common.h" -#include "tst_res_flags.h" -#include "tst_checkpoint.h" -#include "tst_device.h" -#include "tst_mkfs.h" -#include "tst_fs.h" -#include "tst_pid.h" -#include "tst_cmd.h" -#include "tst_cpu.h" -#include "tst_process_state.h" -#include "tst_atomic.h" -#include "tst_kvercmp.h" -#include "tst_clone.h" -#include "tst_kernel.h" -#include "tst_minmax.h" -#include "tst_get_bad_addr.h" -#include "tst_path_has_mnt_flags.h" -#include "tst_sys_conf.h" -#include "tst_coredump.h" -#include "tst_buffers.h" -#include "tst_capability.h" -#include "tst_hugepage.h" -#include "tst_assert.h" -#include "tst_cgroup.h" - -/* - * Reports testcase result. - */ -void tst_res_(const char *file, const int lineno, int ttype, - const char *fmt, ...) - __attribute__ ((format (printf, 4, 5))); - -#define tst_res(ttype, arg_fmt, ...) \ - ({ \ - TST_RES_SUPPORTS_TCONF_TFAIL_TINFO_TPASS_TWARN(!((TTYPE_RESULT(ttype) ?: TCONF) & \ - (TCONF | TFAIL | TINFO | TPASS | TWARN))); \ - tst_res_(__FILE__, __LINE__, (ttype), (arg_fmt), ##__VA_ARGS__);\ - }) - -void tst_resm_hexd_(const char *file, const int lineno, int ttype, - const void *buf, size_t size, const char *arg_fmt, ...) - __attribute__ ((format (printf, 6, 7))); - -#define tst_res_hexd(ttype, buf, size, arg_fmt, ...) \ - tst_resm_hexd_(__FILE__, __LINE__, (ttype), (buf), (size), \ - (arg_fmt), ##__VA_ARGS__) - -/* - * Reports result and exits a test. - */ -void tst_brk_(const char *file, const int lineno, int ttype, - const char *fmt, ...) - __attribute__ ((format (printf, 4, 5))); - -#define tst_brk(ttype, arg_fmt, ...) \ - ({ \ - TST_BRK_SUPPORTS_ONLY_TCONF_TBROK(!((ttype) & \ - (TBROK | TCONF | TFAIL))); \ - tst_brk_(__FILE__, __LINE__, (ttype), (arg_fmt), ##__VA_ARGS__);\ - }) - -/* flush stderr and stdout */ -void tst_flush(void); - -pid_t safe_fork(const char *filename, unsigned int lineno); -#define SAFE_FORK() \ - safe_fork(__FILE__, __LINE__) - -#define TST_TRACE(expr) \ - ({int ret = expr; \ - ret != 0 ? tst_res(TINFO, #expr " failed"), ret : ret; }) \ - -#include "tst_safe_macros.h" -#include "tst_safe_file_ops.h" -#include "tst_safe_net.h" - -/* - * Wait for all children and exit with TBROK if - * any of them returned a non-zero exit status. - */ -void tst_reap_children(void); - -struct tst_option { - char *optstr; - char **arg; - char *help; -}; - -/* - * Options parsing helpers. - * - * If str is NULL these are No-op. - * - * On failure non-zero (errno) is returned. - */ -int tst_parse_int(const char *str, int *val, int min, int max); -int tst_parse_long(const char *str, long *val, long min, long max); -int tst_parse_float(const char *str, float *val, float min, float max); - -struct tst_tag { - const char *name; - const char *value; -}; - -extern unsigned int tst_variant; - -struct tst_test { - /* number of tests available in test() function */ - unsigned int tcnt; - - struct tst_option *options; - - const char *min_kver; - - /* If set the test is compiled out */ - const char *tconf_msg; - - int needs_tmpdir:1; - int needs_root:1; - int forks_child:1; - int needs_device:1; - int needs_checkpoints:1; - int needs_overlay:1; - int format_device:1; - int mount_device:1; - int needs_rofs:1; - int child_needs_reinit:1; - int needs_devfs:1; - int restore_wallclock:1; - /* - * If set the test function will be executed for all available - * filesystems and the current filesytem type would be set in the - * tst_device->fs_type. - * - * The test setup and cleanup are executed before/after __EACH__ call - * to the test function. - */ - int all_filesystems:1; - - /* - * If set non-zero number of request_hugepages, test will try to reserve the - * expected number of hugepage for testing in setup phase. If system does not - * have enough hpage for using, it will try the best to reserve 80% available - * number of hpages. With success test stores the reserved hugepage number in - * 'tst_hugepages. For the system without hugetlb supporting, variable - * 'tst_hugepages' will be set to 0. - * - * Also, we do cleanup and restore work for the hpages resetting automatically. - */ - unsigned long request_hugepages; - - /* - * If set non-zero denotes number of test variant, the test is executed - * variants times each time with tst_variant set to different number. - * - * This allows us to run the same test for different settings. The - * intended use is to test different syscall wrappers/variants but the - * API is generic and does not limit the usage in any way. - */ - unsigned int test_variants; - - /* Minimal device size in megabytes */ - unsigned int dev_min_size; - - /* Device filesystem type override NULL == default */ - const char *dev_fs_type; - /* Flags to be passed to tst_get_supported_fs_types() */ - int dev_fs_flags; - - /* Options passed to SAFE_MKFS() when format_device is set */ - const char *const *dev_fs_opts; - const char *const *dev_extra_opts; - - /* Device mount options, used if mount_device is set */ - const char *mntpoint; - unsigned int mnt_flags; - void *mnt_data; - - /* override default timeout per test run, disabled == -1 */ - int timeout; - - void (*setup)(void); - void (*cleanup)(void); - - void (*test)(unsigned int test_nr); - void (*test_all)(void); - - /* Syscall name used by the timer measurement library */ - const char *scall; - - /* Sampling function for timer measurement testcases */ - int (*sample)(int clk_id, long long usec); - - /* NULL terminated array of resource file names */ - const char *const *resource_files; - - /* NULL terminated array of needed kernel drivers */ - const char * const *needs_drivers; - - /* - * NULL terminated array of (/proc, /sys) files to save - * before setup and restore after cleanup - */ - const char * const *save_restore; - - /* - * NULL terminated array of kernel config options required for the - * test. - */ - const char *const *needs_kconfigs; - - /* - * NULL-terminated array to be allocated buffers. - */ - struct tst_buffers *bufs; - - /* - * NULL-terminated array of capability settings - */ - struct tst_cap *caps; - - /* - * {NULL, NULL} terminated array of tags. - */ - const struct tst_tag *tags; - - /* NULL terminated array of required commands */ - const char *const *needs_cmds; -}; - -/* - * Runs tests. - */ -void tst_run_tcases(int argc, char *argv[], struct tst_test *self) - __attribute__ ((noreturn)); - -/* - * Does library initialization for child processes started by exec() - * - * The LTP_IPC_PATH variable must be passed to the program environment. - */ -void tst_reinit(void); - -//TODO Clean? -#define TEST(SCALL) \ - do { \ - errno = 0; \ - TST_RET = SCALL; \ - TST_ERR = errno; \ - } while (0) - -#define TEST_VOID(SCALL) \ - do { \ - errno = 0; \ - SCALL; \ - TST_ERR = errno; \ - } while (0) - -extern long TST_RET; -extern int TST_ERR; - -extern void *TST_RET_PTR; - -#define TESTPTR(SCALL) \ - do { \ - errno = 0; \ - TST_RET_PTR = (void*)SCALL; \ - TST_ERR = errno; \ - } while (0) - -/* - * Functions to convert ERRNO to its name and SIGNAL to its name. - */ -const char *tst_strerrno(int err); -const char *tst_strsig(int sig); -/* - * Returns string describing status as returned by wait(). - * - * BEWARE: Not thread safe. - */ -const char *tst_strstatus(int status); - -unsigned int tst_timeout_remaining(void); -unsigned int tst_multiply_timeout(unsigned int timeout); -void tst_set_timeout(int timeout); - - -/* - * Returns path to the test temporary directory in a newly allocated buffer. - */ -char *tst_get_tmpdir(void); - -#ifndef TST_NO_DEFAULT_MAIN - -static struct tst_test test; - -int main(int argc, char *argv[]) -{ - tst_run_tcases(argc, argv, &test); -} - -#endif /* TST_NO_DEFAULT_MAIN */ - -#define TST_TEST_TCONF(message) \ - static struct tst_test test = { .tconf_msg = message } \ - -#endif /* TST_TEST_H__ */ diff --git a/fsstress/include/tst_timer.h b/fsstress/include/tst_timer.h deleted file mode 100644 index e42b54f0e9..0000000000 --- a/fsstress/include/tst_timer.h +++ /dev/null @@ -1,1055 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright (C) 2015-2020 Cyril Hrubis - */ - - /* - - Timer - struct timespec conversion runtimes and easy to use functions to - measure elapsed time. - - */ - -#ifndef TST_TIMER -#define TST_TIMER - -#include -#include -#include -#include -#include "tst_test.h" -#include "lapi/common_timers.h" -#include "lapi/posix_types.h" -#include "lapi/syscalls.h" - -/* - * Converts timeval to microseconds. - */ -static inline long long tst_timeval_to_us(struct timeval t) -{ - return t.tv_sec * 1000000 + t.tv_usec; -} - -/* - * Converts timeval to milliseconds. - */ -static inline long long tst_timeval_to_ms(struct timeval t) -{ - return t.tv_sec * 1000 + (t.tv_usec + 500) / 1000; -} - -/* - * Converts milliseconds to struct timeval - */ -static inline struct timeval tst_ms_to_timeval(long long ms) -{ - struct timeval ret; - - ret.tv_sec = ms / 1000; - ret.tv_usec = (ms % 1000) * 1000; - - return ret; -} - -/* - * Converts microseconds to struct timeval - */ -static inline struct timeval tst_us_to_timeval(long long us) -{ - struct timeval ret; - - ret.tv_sec = us / 1000000; - ret.tv_usec = us % 1000000; - - return ret; -} - -/* - * Returns difference between two timeval structures. - */ -static inline struct timeval tst_timeval_diff(struct timeval t1, - struct timeval t2) -{ - struct timeval res; - - res.tv_sec = t1.tv_sec - t2.tv_sec; - - if (t1.tv_usec < t2.tv_usec) { - res.tv_sec--; - res.tv_usec = 1000000 - (t2.tv_usec - t1.tv_usec); - } else { - res.tv_usec = t1.tv_usec - t2.tv_usec; - } - - return res; -} - -static inline long long tst_timeval_diff_us(struct timeval t1, - struct timeval t2) -{ - return tst_timeval_to_us(tst_timeval_diff(t1, t2)); -} - -static inline long long tst_timeval_diff_ms(struct timeval t1, - struct timeval t2) -{ - return tst_timeval_to_ms(tst_timeval_diff(t1, t2)); -} - -#ifndef __kernel_timespec - -typedef __kernel_long_t __kernel_old_time_t; - -struct __kernel_old_timeval { - __kernel_old_time_t tv_sec; /* seconds */ - __kernel_suseconds_t tv_usec; /* microseconds */ -}; - -struct __kernel_old_timespec { - __kernel_old_time_t tv_sec; /* seconds */ - __kernel_old_time_t tv_nsec; /* nanoseconds */ -}; - -typedef long long __kernel_time64_t; - -struct __kernel_timespec { - __kernel_time64_t tv_sec; /* seconds */ - long long tv_nsec; /* nanoseconds */ -}; - -struct __kernel_old_itimerspec { - struct __kernel_old_timespec it_interval; /* timer period */ - struct __kernel_old_timespec it_value; /* timer expiration */ -}; - -struct __kernel_itimerspec { - struct __kernel_timespec it_interval; /* timer period */ - struct __kernel_timespec it_value; /* timer expiration */ -}; -#endif - -enum tst_ts_type { - TST_LIBC_TIMESPEC, - TST_KERN_OLD_TIMESPEC, - TST_KERN_TIMESPEC -}; - -struct tst_ts { - enum tst_ts_type type; - union ts { - struct timespec libc_ts; - struct __kernel_old_timespec kern_old_ts; - struct __kernel_timespec kern_ts; - } ts; -}; - -struct tst_its { - enum tst_ts_type type; - union { - struct __kernel_old_itimerspec kern_old_its; - struct __kernel_itimerspec kern_its; - } ts; -}; - -static inline void *tst_ts_get(struct tst_ts *t) -{ - if (!t) - return NULL; - - switch (t->type) { - case TST_LIBC_TIMESPEC: - return &t->ts.libc_ts; - case TST_KERN_OLD_TIMESPEC: - return &t->ts.kern_old_ts; - case TST_KERN_TIMESPEC: - return &t->ts.kern_ts; - default: - tst_brk(TBROK, "Invalid type: %d", t->type); - return NULL; - } -} - -static inline void *tst_its_get(struct tst_its *t) -{ - if (!t) - return NULL; - - switch (t->type) { - case TST_KERN_OLD_TIMESPEC: - return &t->ts.kern_old_its; - case TST_KERN_TIMESPEC: - return &t->ts.kern_its; - default: - tst_brk(TBROK, "Invalid type: %d", t->type); - return NULL; - } -} - -static inline int libc_clock_getres(clockid_t clk_id, void *ts) -{ - return clock_getres(clk_id, ts); -} - -static inline int sys_clock_getres(clockid_t clk_id, void *ts) -{ - return tst_syscall(__NR_clock_getres, clk_id, ts); -} - -static inline int sys_clock_getres64(clockid_t clk_id, void *ts) -{ - return tst_syscall(__NR_clock_getres_time64, clk_id, ts); -} - -static inline int libc_clock_gettime(clockid_t clk_id, void *ts) -{ - return clock_gettime(clk_id, ts); -} - -static inline int sys_clock_gettime(clockid_t clk_id, void *ts) -{ - return tst_syscall(__NR_clock_gettime, clk_id, ts); -} - -static inline int sys_clock_gettime64(clockid_t clk_id, void *ts) -{ - return tst_syscall(__NR_clock_gettime64, clk_id, ts); -} - -static inline int libc_clock_settime(clockid_t clk_id, void *ts) -{ - return clock_settime(clk_id, ts); -} - -static inline int sys_clock_settime(clockid_t clk_id, void *ts) -{ - return tst_syscall(__NR_clock_settime, clk_id, ts); -} - -static inline int sys_clock_settime64(clockid_t clk_id, void *ts) -{ - return tst_syscall(__NR_clock_settime64, clk_id, ts); -} - -static inline int libc_clock_nanosleep(clockid_t clk_id, int flags, - void *request, void *remain) -{ - return clock_nanosleep(clk_id, flags, request, remain); -} - -static inline int sys_clock_nanosleep(clockid_t clk_id, int flags, - void *request, void *remain) -{ - return tst_syscall(__NR_clock_nanosleep, clk_id, flags, - request, remain); -} - -static inline int sys_clock_nanosleep64(clockid_t clk_id, int flags, - void *request, void *remain) -{ - return tst_syscall(__NR_clock_nanosleep_time64, clk_id, flags, - request, remain); -} - -static inline int sys_futex(int *uaddr, int futex_op, int val, void *to, - int *uaddr2, int val3) -{ - return tst_syscall(__NR_futex, uaddr, futex_op, val, to, uaddr2, val3); -} - -static inline int sys_futex_time64(int *uaddr, int futex_op, int val, void *to, - int *uaddr2, int val3) -{ - return tst_syscall(__NR_futex_time64, uaddr, futex_op, val, to, uaddr2, val3); -} - -static inline int libc_mq_timedsend(mqd_t mqdes, const char *msg_ptr, - size_t msg_len, unsigned int msg_prio, void *abs_timeout) -{ - return mq_timedsend(mqdes, msg_ptr, msg_len, msg_prio, abs_timeout); -} - -static inline int sys_mq_timedsend(mqd_t mqdes, const char *msg_ptr, - size_t msg_len, unsigned int msg_prio, void *abs_timeout) -{ - return tst_syscall(__NR_mq_timedsend, mqdes, msg_ptr, msg_len, msg_prio, - abs_timeout); -} - -static inline int sys_mq_timedsend64(mqd_t mqdes, const char *msg_ptr, - size_t msg_len, unsigned int msg_prio, void *abs_timeout) -{ - return tst_syscall(__NR_mq_timedsend_time64, mqdes, msg_ptr, msg_len, - msg_prio, abs_timeout); -} - -static inline ssize_t libc_mq_timedreceive(mqd_t mqdes, char *msg_ptr, - size_t msg_len, unsigned int *msg_prio, void *abs_timeout) -{ - return mq_timedreceive(mqdes, msg_ptr, msg_len, msg_prio, abs_timeout); -} - -static inline ssize_t sys_mq_timedreceive(mqd_t mqdes, char *msg_ptr, - size_t msg_len, unsigned int *msg_prio, void *abs_timeout) -{ - return tst_syscall(__NR_mq_timedreceive, mqdes, msg_ptr, msg_len, - msg_prio, abs_timeout); -} - -static inline ssize_t sys_mq_timedreceive64(mqd_t mqdes, char *msg_ptr, - size_t msg_len, unsigned int *msg_prio, void *abs_timeout) -{ - return tst_syscall(__NR_mq_timedreceive_time64, mqdes, msg_ptr, msg_len, - msg_prio, abs_timeout); -} - -static inline int libc_sched_rr_get_interval(pid_t pid, void *ts) -{ - return sched_rr_get_interval(pid, ts); -} - -static inline int sys_sched_rr_get_interval(pid_t pid, void *ts) -{ - return tst_syscall(__NR_sched_rr_get_interval, pid, ts); -} - -static inline int sys_sched_rr_get_interval64(pid_t pid, void *ts) -{ - return tst_syscall(__NR_sched_rr_get_interval_time64, pid, ts); -} - -static inline int sys_timer_gettime(timer_t timerid, void *its) -{ - return tst_syscall(__NR_timer_gettime, timerid, its); -} - -static inline int sys_timer_gettime64(timer_t timerid, void *its) -{ - return tst_syscall(__NR_timer_gettime64, timerid, its); -} - -static inline int sys_timer_settime(timer_t timerid, int flags, void *its, - void *old_its) -{ - return tst_syscall(__NR_timer_settime, timerid, flags, its, old_its); -} - -static inline int sys_timer_settime64(timer_t timerid, int flags, void *its, - void *old_its) -{ - return tst_syscall(__NR_timer_settime64, timerid, flags, its, old_its); -} - -static inline int sys_timerfd_gettime(int fd, void *its) -{ - return tst_syscall(__NR_timerfd_gettime, fd, its); -} - -static inline int sys_timerfd_gettime64(int fd, void *its) -{ - return tst_syscall(__NR_timerfd_gettime64, fd, its); -} - -static inline int sys_timerfd_settime(int fd, int flags, void *its, - void *old_its) -{ - return tst_syscall(__NR_timerfd_settime, fd, flags, its, old_its); -} - -static inline int sys_timerfd_settime64(int fd, int flags, void *its, - void *old_its) -{ - return tst_syscall(__NR_timerfd_settime64, fd, flags, its, old_its); -} - -/* - * Returns tst_ts seconds. - */ -static inline long long tst_ts_get_sec(struct tst_ts ts) -{ - switch (ts.type) { - case TST_LIBC_TIMESPEC: - return ts.ts.libc_ts.tv_sec; - case TST_KERN_OLD_TIMESPEC: - return ts.ts.kern_old_ts.tv_sec; - case TST_KERN_TIMESPEC: - return ts.ts.kern_ts.tv_sec; - default: - tst_brk(TBROK, "Invalid type: %d", ts.type); - return -1; - } -} - -/* - * Returns tst_ts nanoseconds. - */ -static inline long long tst_ts_get_nsec(struct tst_ts ts) -{ - switch (ts.type) { - case TST_LIBC_TIMESPEC: - return ts.ts.libc_ts.tv_nsec; - case TST_KERN_OLD_TIMESPEC: - return ts.ts.kern_old_ts.tv_nsec; - case TST_KERN_TIMESPEC: - return ts.ts.kern_ts.tv_nsec; - default: - tst_brk(TBROK, "Invalid type: %d", ts.type); - return -1; - } -} - -/* - * Sets tst_ts seconds. - */ -static inline void tst_ts_set_sec(struct tst_ts *ts, long long sec) -{ - switch (ts->type) { - case TST_LIBC_TIMESPEC: - ts->ts.libc_ts.tv_sec = sec; - break; - case TST_KERN_OLD_TIMESPEC: - ts->ts.kern_old_ts.tv_sec = sec; - break; - case TST_KERN_TIMESPEC: - ts->ts.kern_ts.tv_sec = sec; - break; - default: - tst_brk(TBROK, "Invalid type: %d", ts->type); - } -} - -/* - * Sets tst_ts nanoseconds. - */ -static inline void tst_ts_set_nsec(struct tst_ts *ts, long long nsec) -{ - switch (ts->type) { - case TST_LIBC_TIMESPEC: - ts->ts.libc_ts.tv_nsec = nsec; - break; - case TST_KERN_OLD_TIMESPEC: - ts->ts.kern_old_ts.tv_nsec = nsec; - break; - case TST_KERN_TIMESPEC: - ts->ts.kern_ts.tv_nsec = nsec; - break; - default: - tst_brk(TBROK, "Invalid type: %d", ts->type); - } -} - -/* - * Returns tst_its it_interval seconds. - */ -static inline long long tst_its_get_interval_sec(struct tst_its its) -{ - switch (its.type) { - case TST_KERN_OLD_TIMESPEC: - return its.ts.kern_old_its.it_interval.tv_sec; - case TST_KERN_TIMESPEC: - return its.ts.kern_its.it_interval.tv_sec; - default: - tst_brk(TBROK, "Invalid type: %d", its.type); - return -1; - } -} - -/* - * Returns tst_its it_interval nanoseconds. - */ -static inline long long tst_its_get_interval_nsec(struct tst_its its) -{ - switch (its.type) { - case TST_KERN_OLD_TIMESPEC: - return its.ts.kern_old_its.it_interval.tv_nsec; - case TST_KERN_TIMESPEC: - return its.ts.kern_its.it_interval.tv_nsec; - default: - tst_brk(TBROK, "Invalid type: %d", its.type); - return -1; - } -} - -/* - * Sets tst_its it_interval seconds. - */ -static inline void tst_its_set_interval_sec(struct tst_its *its, long long sec) -{ - switch (its->type) { - break; - case TST_KERN_OLD_TIMESPEC: - its->ts.kern_old_its.it_interval.tv_sec = sec; - break; - case TST_KERN_TIMESPEC: - its->ts.kern_its.it_interval.tv_sec = sec; - break; - default: - tst_brk(TBROK, "Invalid type: %d", its->type); - } -} - -/* - * Sets tst_its it_interval nanoseconds. - */ -static inline void tst_its_set_interval_nsec(struct tst_its *its, long long nsec) -{ - switch (its->type) { - break; - case TST_KERN_OLD_TIMESPEC: - its->ts.kern_old_its.it_interval.tv_nsec = nsec; - break; - case TST_KERN_TIMESPEC: - its->ts.kern_its.it_interval.tv_nsec = nsec; - break; - default: - tst_brk(TBROK, "Invalid type: %d", its->type); - } -} - -/* - * Returns tst_its it_value seconds. - */ -static inline long long tst_its_get_value_sec(struct tst_its its) -{ - switch (its.type) { - case TST_KERN_OLD_TIMESPEC: - return its.ts.kern_old_its.it_value.tv_sec; - case TST_KERN_TIMESPEC: - return its.ts.kern_its.it_value.tv_sec; - default: - tst_brk(TBROK, "Invalid type: %d", its.type); - return -1; - } -} - -/* - * Returns tst_its it_value nanoseconds. - */ -static inline long long tst_its_get_value_nsec(struct tst_its its) -{ - switch (its.type) { - case TST_KERN_OLD_TIMESPEC: - return its.ts.kern_old_its.it_value.tv_nsec; - case TST_KERN_TIMESPEC: - return its.ts.kern_its.it_value.tv_nsec; - default: - tst_brk(TBROK, "Invalid type: %d", its.type); - return -1; - } -} - -/* - * Sets tst_its it_value seconds. - */ -static inline void tst_its_set_value_sec(struct tst_its *its, long long sec) -{ - switch (its->type) { - break; - case TST_KERN_OLD_TIMESPEC: - its->ts.kern_old_its.it_value.tv_sec = sec; - break; - case TST_KERN_TIMESPEC: - its->ts.kern_its.it_value.tv_sec = sec; - break; - default: - tst_brk(TBROK, "Invalid type: %d", its->type); - } -} - -/* - * Sets tst_its it_value nanoseconds. - */ -static inline void tst_its_set_value_nsec(struct tst_its *its, long long nsec) -{ - switch (its->type) { - break; - case TST_KERN_OLD_TIMESPEC: - its->ts.kern_old_its.it_value.tv_nsec = nsec; - break; - case TST_KERN_TIMESPEC: - its->ts.kern_its.it_value.tv_nsec = nsec; - break; - default: - tst_brk(TBROK, "Invalid type: %d", its->type); - } -} - -/* - * Checks that timespec is valid, i.e. that the timestamp is not zero and that - * the nanoseconds are normalized i.e. in <0, 1s) interval. - * - * 0: On success, i.e. timespec updated correctly. - * -1: Error, timespec not updated. - * -2: Error, tv_nsec is corrupted. - */ -static inline int tst_ts_valid(struct tst_ts *t) -{ - long long nsec = tst_ts_get_nsec(*t); - - if (nsec < 0 || nsec >= 1000000000) - return -2; - - if (tst_ts_get_sec(*t) == 0 && tst_ts_get_nsec(*t) == 0) - return -1; - - return 0; -} - -/* - * Converts timespec to tst_ts. - */ -static inline struct tst_ts tst_ts_from_timespec(struct timespec ts) -{ - struct tst_ts t = { - .type = TST_LIBC_TIMESPEC, - .ts.libc_ts.tv_sec = ts.tv_sec, - .ts.libc_ts.tv_nsec = ts.tv_nsec, - }; - - return t; -} - -/* - * Converst tst_ts into timespec. - */ -static inline struct timespec tst_ts_to_timespec(struct tst_ts t) -{ - return t.ts.libc_ts; -} - -/* - * Converts tst_ts to nanoseconds. - */ -static inline long long tst_ts_to_ns(struct tst_ts t) -{ - return tst_ts_get_sec(t) * 1000000000 + tst_ts_get_nsec(t); -} - -/* - * Converts tst_ts to microseconds and rounds the value. - */ -static inline long long tst_ts_to_us(struct tst_ts t) -{ - return tst_ts_get_sec(t) * 1000000 + - (tst_ts_get_nsec(t) + 500) / 1000; -} - -/* - * Converts timespec to microseconds and rounds the value. - */ -static inline long long tst_timespec_to_us(struct timespec ts) -{ - return tst_ts_to_us(tst_ts_from_timespec(ts)); -} - -/* - * Converts tst_ts to milliseconds and rounds the value. - */ -static inline long long tst_ts_to_ms(struct tst_ts t) -{ - return tst_ts_get_sec(t) * 1000 + - (tst_ts_get_nsec(t) + 500000) / 1000000; -} - -/* - * Converts timespec to milliseconds and rounds the value. - */ -static inline long long tst_timespec_to_ms(struct timespec ts) -{ - return tst_ts_to_ms(tst_ts_from_timespec(ts)); -} - -/* - * Converts nanoseconds to tst_ts - */ -static inline struct tst_ts -tst_ts_from_ns(enum tst_ts_type type, long long ns) -{ - struct tst_ts ret = {.type = type}; - - tst_ts_set_sec(&ret, ns / 1000000000); - tst_ts_set_nsec(&ret, ns % 1000000000); - - return ret; -} - -/* - * Converts microseconds to tst_ts - */ -static inline struct tst_ts -tst_ts_from_us(enum tst_ts_type type, long long us) -{ - struct tst_ts ret = {.type = type}; - - tst_ts_set_sec(&ret, us / 1000000); - tst_ts_set_nsec(&ret, (us % 1000000) * 1000); - - return ret; -} - -/* - * Converts microseconds to timespec - */ -static inline struct timespec -tst_timespec_from_us(long long us) -{ - return tst_ts_to_timespec(tst_ts_from_us(TST_LIBC_TIMESPEC, us)); -} - -/* - * Converts miliseconds to tst_ts - */ -static inline struct tst_ts -tst_ts_from_ms(enum tst_ts_type type, long long ms) -{ - struct tst_ts ret = {.type = type}; - - tst_ts_set_sec(&ret, ms / 1000); - tst_ts_set_nsec(&ret, (ms % 1000) * 1000000); - - return ret; -} - -/* - * Converts miliseconds to timespec - */ -static inline struct timespec -tst_timespec_from_ms(long long ms) -{ - return tst_ts_to_timespec(tst_ts_from_ms(TST_LIBC_TIMESPEC, ms)); -} - -/* - * Sets tst_its it_value from microseconds. - */ -static inline void tst_its_set_interval_from_us(struct tst_its *its, long long usec) -{ - struct timespec tp = tst_timespec_from_us(usec); - - tst_its_set_interval_sec(its, tp.tv_sec); - tst_its_set_interval_nsec(its, tp.tv_nsec); -} - -/* - * Sets tst_its it_value from microseconds. - */ -static inline void tst_its_set_value_from_us(struct tst_its *its, long long usec) -{ - struct timespec tp = tst_timespec_from_us(usec); - - tst_its_set_value_sec(its, tp.tv_sec); - tst_its_set_value_nsec(its, tp.tv_nsec); -} - -/* - * Sets tst_its it_interval from tst_ts. - */ -static inline void tst_its_set_interval_from_ts(struct tst_its *its, struct tst_ts ts) -{ - tst_its_set_interval_sec(its, tst_ts_get_sec(ts)); - tst_its_set_interval_nsec(its, tst_ts_get_nsec(ts)); -} - -/* - * Sets tst_its it_value from tst_ts. - */ -static inline void tst_its_set_value_from_ts(struct tst_its *its, struct tst_ts ts) -{ - tst_its_set_value_sec(its, tst_ts_get_sec(ts)); - tst_its_set_value_nsec(its, tst_ts_get_nsec(ts)); -} - -/* - * Returns if t1 less than t2. Both t1 and t2 must be normalized. - */ -static inline int tst_ts_lt(struct tst_ts t1, struct tst_ts t2) -{ - if (tst_ts_get_sec(t1) == tst_ts_get_sec(t2)) - return tst_ts_get_nsec(t1) < tst_ts_get_nsec(t2); - - return tst_ts_get_sec(t1) < tst_ts_get_sec(t2); -} - -/* - * Returns if ts1 less than ts2. Both ts1 and ts2 must be normalized. - */ -static inline int tst_timespec_lt(struct timespec ts1, struct timespec ts2) -{ - return tst_ts_lt(tst_ts_from_timespec(ts1), tst_ts_from_timespec(ts2)); -} - -/* - * Returns normalized tst_ts, i.e. 0 <= nsec < 1000000000. - */ -static inline struct tst_ts tst_ts_normalize(struct tst_ts t) -{ - long long sec = tst_ts_get_sec(t); - long long nsec = tst_ts_get_nsec(t); - - if (nsec >= 1000000000) { - tst_ts_set_sec(&t, sec + 1); - tst_ts_set_nsec(&t, nsec - 1000000000); - } - - if (nsec < 0) { - tst_ts_set_sec(&t, sec - 1); - tst_ts_set_nsec(&t, nsec + 1000000000); - } - - return t; -} - -/* - * Adds us microseconds to tst_ts. - */ -static inline struct tst_ts -tst_ts_add_us(struct tst_ts t, long long us) -{ - struct tst_ts res = {.type = t.type}; - - tst_ts_set_sec(&res, tst_ts_get_sec(t) + us / 1000000); - tst_ts_set_nsec(&res, tst_ts_get_nsec(t) + (us % 1000000) * 1000); - - return tst_ts_normalize(res); -} - -/* - * Adds us microseconds to struct timespec. - */ -static inline struct timespec -tst_timespec_add_us(struct timespec ts, long long us) -{ - struct tst_ts res; - - res = tst_ts_add_us(tst_ts_from_timespec(ts), us); - - return tst_ts_to_timespec(res); -} - -/* - * Substracts us microseconds from tst_ts. - */ -static inline struct tst_ts -tst_ts_sub_us(struct tst_ts t, long long us) -{ - struct tst_ts res = {.type = t.type}; - - tst_ts_set_sec(&res, tst_ts_get_sec(t) - us / 1000000); - tst_ts_set_nsec(&res, tst_ts_get_nsec(t) - (us % 1000000) * 1000); - - return tst_ts_normalize(res); -} - -/* - * Substracts us microseconds from timespec. - */ -static inline struct timespec -tst_timespec_sub_us(struct timespec ts, long long us) -{ - struct tst_ts res; - - res = tst_ts_sub_us(tst_ts_from_timespec(ts), us); - - return tst_ts_to_timespec(res); -} - -/* - * Adds two tst_ts structures. - */ -static inline struct tst_ts -tst_ts_add(struct tst_ts t1, struct tst_ts t2) -{ - struct tst_ts res = {.type = t1.type}; - - tst_ts_set_sec(&res, tst_ts_get_sec(t1) + tst_ts_get_sec(t2)); - tst_ts_set_nsec(&res, tst_ts_get_nsec(t1) + tst_ts_get_nsec(t2)); - - return tst_ts_normalize(res); -} - -/* - * Adds two timespec structures. - */ -static inline struct timespec -tst_timespec_add(struct timespec ts1, struct timespec ts2) -{ - struct tst_ts res; - - res = tst_ts_add(tst_ts_from_timespec(ts1), tst_ts_from_timespec(ts2)); - - return tst_ts_to_timespec(res); -} - -/* - * Substract two tst_ts structures. - */ -static inline struct tst_ts -tst_ts_diff(struct tst_ts t1, struct tst_ts t2) -{ - struct tst_ts res = {.type = t1.type}; - - tst_ts_set_sec(&res, tst_ts_get_sec(t1) - tst_ts_get_sec(t2)); - tst_ts_set_nsec(&res, tst_ts_get_nsec(t1) - tst_ts_get_nsec(t2)); - - return tst_ts_normalize(res); -} - -/* - * Substract two timespec structures. - */ -static inline struct timespec -tst_timespec_diff(struct timespec ts1, struct timespec ts2) -{ - struct tst_ts res; - - res = tst_ts_diff(tst_ts_from_timespec(ts1), tst_ts_from_timespec(ts2)); - - return tst_ts_to_timespec(res); -} - -/* - * Substract two tst_ts structures returns number of nanoseconds. - */ -static inline long long -tst_ts_diff_ns(struct tst_ts t1, struct tst_ts t2) -{ - return tst_ts_to_ns(tst_ts_diff(t1, t2)); -} - -/* - * Substract two timespec structures returns number of nanoseconds. - */ -static inline long long -tst_timespec_diff_ns(struct timespec ts1, struct timespec ts2) -{ - return tst_ts_diff_ns(tst_ts_from_timespec(ts1), tst_ts_from_timespec(ts2)); -} - -/* - * Substract two tst_ts structures returns number of microseconds. - */ -static inline long long -tst_ts_diff_us(struct tst_ts t1, struct tst_ts t2) -{ - return tst_ts_to_us(tst_ts_diff(t1, t2)); -} - -/* - * Substract two timespec structures returns number of microseconds. - */ -static inline long long -tst_timespec_diff_us(struct timespec ts1, struct timespec ts2) -{ - return tst_ts_diff_us(tst_ts_from_timespec(ts1), tst_ts_from_timespec(ts2)); -} - -/* - * Substract two tst_ts structures returns number of milliseconds. - */ -static inline long long -tst_ts_diff_ms(struct tst_ts t1, struct tst_ts t2) -{ - return tst_ts_to_ms(tst_ts_diff(t1, t2)); -} - -/* - * Substract two timespec structures returns number of milliseconds. - */ -static inline long long -tst_timespec_diff_ms(struct timespec ts1, struct timespec ts2) -{ - return tst_ts_diff_ms(tst_ts_from_timespec(ts1), tst_ts_from_timespec(ts2)); -} - -/* - * Returns absolute value of difference between two timespec structures. - */ -static inline struct tst_ts -tst_ts_abs_diff(struct tst_ts t1, struct tst_ts t2) -{ - if (tst_ts_lt(t1, t2)) - return tst_ts_diff(t2, t1); - else - return tst_ts_diff(t1, t2); -} - -/* - * Returns absolute value of difference between two tst_ts structures in - * microseconds. - */ -static inline long long -tst_ts_abs_diff_us(struct tst_ts t1, struct tst_ts t2) -{ - return tst_ts_to_us(tst_ts_abs_diff(t1, t2)); -} - -/* - * Returns absolute value of difference between two timespec structures in - * microseconds. - */ -static inline long long -tst_timespec_abs_diff_us(struct timespec ts1, struct timespec ts2) -{ - return tst_ts_abs_diff_us(tst_ts_from_timespec(ts1), tst_ts_from_timespec(ts2)); -} - -/* - * Returns absolute value of difference between two timespec structures in - * milliseconds. - */ -static inline long long -tst_ts_abs_diff_ms(struct tst_ts t1, struct tst_ts t2) -{ - return tst_ts_to_ms(tst_ts_abs_diff(t1, t2)); -} - -/* - * Exits the test with TCONF if particular timer is not supported. This is - * intended to be used in test setup. There is no cleanup callback parameter as - * you are expected to call it before initializing any resources that has to be - * cleaned up later. - * - * @clk_id: Posix clock to use. - */ -void tst_timer_check(clockid_t clk_id); - -/* - * Marks a start time for given clock type. - * - * @clk_id: Posix clock to use. - */ -void tst_timer_start(clockid_t clk_id); - -/* - * Returns true if timer started by tst_timer_start() has been running for - * longer than ms seconds. - * - * @ms: Time interval in milliseconds. - */ -int tst_timer_expired_ms(long long ms); - -/* - * Marks timer end time. - */ -void tst_timer_stop(void); - -/* - * Retuns elapsed time in struct timespec. - */ -struct timespec tst_timer_elapsed(void); - -/* - * Returns elapsed time in milliseconds. - */ -static inline long long tst_timer_elapsed_ms(void) -{ - return tst_timespec_to_ms(tst_timer_elapsed()); -} - -/* - * Returns elapsed time in microseconds. - */ -static inline long long tst_timer_elapsed_us(void) -{ - return tst_timespec_to_us(tst_timer_elapsed()); -} - -#endif /* TST_TIMER */ diff --git a/fsstress/include/tst_timer_test.h b/fsstress/include/tst_timer_test.h deleted file mode 100644 index b825a4d1aa..0000000000 --- a/fsstress/include/tst_timer_test.h +++ /dev/null @@ -1,45 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2017 Cyril Hrubis - */ - - /* - - Timer measuring library. - - The test is supposed to define sampling function and set it in the tst_test - structure the rest of the work is then done by the library. - - int sample(int clk_id, long long usec) - { - // Any setup done here - - tst_timer_start(clk_id); - // Call that is being measured sleeps for usec - tst_timer_stop(); - tst_timer_sample(); - - // Any cleanup done here - - // Non-zero return exits the test - } - - struct tst_test test = { - .scall = "syscall_name()", - .sample = sample, - }; - - */ - -#ifndef TST_TIMER_TEST__ -#define TST_TIMER_TEST__ - -#include "tst_test.h" -#include "tst_timer.h" - -void tst_timer_sample(void); - -# ifdef TST_NO_DEFAULT_MAIN -struct tst_test *tst_timer_test_setup(struct tst_test *test); -# endif /* TST_NO_DEFAULT_MAIN */ -#endif /* TST_TIMER_TEST__ */ diff --git a/fsstress/include/tst_uinput.h b/fsstress/include/tst_uinput.h deleted file mode 100644 index cf351cdfbd..0000000000 --- a/fsstress/include/tst_uinput.h +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2019 Cyril Hrubis - */ - -#ifndef TST_UINPUT_H__ -#define TST_UINPUT_H__ - -/** - * Tries to open the uinput device. - * - * Returns file descriptor on success, -1 on failure. - */ -int open_uinput(void); - -/** - * Creates virtual input device. - * - * @fd File descriptor returned by open_uinput(). - */ -void create_input_device(int fd); - -/** - * Parses /proc/bus/input/devices and returns the strings for our virtual device. - * If passing 'H' to it, it returns HANDLERS string. If passing 'S' to it, it - * returns SYSFS string. - * - * Returns newly allocated string, or NULL in a case of failure. - */ -char *get_input_field_value(char field); - -/** - * Sets up the virtual device to appear as a mouse, this must be called before - * the call to create_input_device(). - * - * @fd File descriptor as returned by open_uinput(). - */ -void setup_mouse_events(int fd); - -/** - * Destroys virtual input device. - * - * @fd File descriptor returned by open_uinput(). - */ -void destroy_input_device(int fd); - -#endif /* TST_UINPUT_H__ */ diff --git a/fsstress/include/tst_wallclock.h b/fsstress/include/tst_wallclock.h deleted file mode 100644 index 7d6723a7ac..0000000000 --- a/fsstress/include/tst_wallclock.h +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2019 Linaro Limited. All rights reserved. - * Author: Rafael David Tinoco - */ - - -#ifndef TST_WALLCLK_H__ -#define TST_WALLCLK_H__ - -void tst_wallclock_save(void); - -void tst_wallclock_restore(void); - -#endif /* TST_WALLCLK_H__ */ diff --git a/fsstress/xfscompat.h b/fsstress/xfscompat.h deleted file mode 100644 index 61550a8f71..0000000000 --- a/fsstress/xfscompat.h +++ /dev/null @@ -1,7 +0,0 @@ -#define MAXNAMELEN 1024 -struct dioattr { - int d_miniosz, d_maxiosz, d_mem; -}; - -#define MIN(a,b) ((a)<(b) ? (a):(b)) -#define MAX(a,b) ((a)>(b) ? (a):(b)) From 55684400882212e507a17591fec123fbc48e0942 Mon Sep 17 00:00:00 2001 From: Krishnan Date: Tue, 18 Aug 2020 22:51:19 -0700 Subject: [PATCH 5/7] fsstress readme changes --- README.md | 12 ++++++++++++ scripts/fsstress/run_fsstress.sh | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 19ca2c1ee9..2f2a650461 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,18 @@ where `` is one of `posix`, `sync` or `strict`. Example: `make -C tests p Tip: Redirect stderr for less verbose output: e.g `make test 2>/dev/null` +**Running fsstress with splitfs** +Compile fsstress +``` +$ cd scripts/fsstress +$ ./compile_fsstress.sh +``` +To run tests with fasstress +``` +$ ./run_fsstress.sh 100 +``` +Note: run_fsstress.sh takes one argument as number of operations to test using fsstress. In the above example, 100 operations are done on target directory /mnt/pmem_emul + ## Implementation Notes 1. Only regular files, block special files, and directories (only for consistency guarantees) are handled by SplitFS, the other file types are delegated to POSIX. 2. Only files in the persistent memory mount (`/mnt/pmem_emul/`) are handled by SplitFS, rest are delegated to POSIX. diff --git a/scripts/fsstress/run_fsstress.sh b/scripts/fsstress/run_fsstress.sh index e0510378a3..1d3a1e20a0 100755 --- a/scripts/fsstress/run_fsstress.sh +++ b/scripts/fsstress/run_fsstress.sh @@ -7,6 +7,6 @@ root_dir=`readlink -f ../..` fsstress_dir=$root_dir/ltp-master/testcases/kernel/fs/fsstress cd $fsstress_dir -LD_PRELOAD=$root_dir/splitfs/libnvp.so ./fsstress -c -d /mnt/pmem_emul -n $1 -v +sudo LD_PRELOAD=$root_dir/splitfs/libnvp.so ./fsstress -c -d /mnt/pmem_emul -n $1 -v cd $cur_dir From 7010da667b83144c7d7a917b33bdc07e7ddf0e2f Mon Sep 17 00:00:00 2001 From: Krishnan Date: Tue, 18 Aug 2020 22:52:57 -0700 Subject: [PATCH 6/7] readme file added endline --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2f2a650461..c4b978073c 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ where `` is one of `posix`, `sync` or `strict`. Example: `make -C tests p Tip: Redirect stderr for less verbose output: e.g `make test 2>/dev/null` -**Running fsstress with splitfs** +**Running fsstress with splitfs** Compile fsstress ``` $ cd scripts/fsstress From 7786f59eaf673984fa5da8c18e006c1e1ea1c160 Mon Sep 17 00:00:00 2001 From: Krishnan Date: Wed, 19 Aug 2020 21:29:01 -0700 Subject: [PATCH 7/7] removed unwanted file --- micro/a.out | Bin 13960 -> 0 bytes micro/rw_expt | Bin 13480 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100755 micro/a.out delete mode 100755 micro/rw_expt diff --git a/micro/a.out b/micro/a.out deleted file mode 100755 index 4bc4009bcbbeb1e47059a9df7a383b5d2d8ce806..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13960 zcmeHOeQ+DcbzcCYM129!mrcuVba5mPVVoLIIJ ziA@}_zqhv!JRE_k`!W4X%fY>UzkToR+ugT&cYDicIy$#|Js!cyEAAJ>HO&u8$i513 zE+konwTSs5ELMrz#9SbC_=RN&Q9H+UN||O_ujG87bMR~N+CYmpEHg}RvtiU=C-#si z)i;yEDr?i%m)k5;Av6h)9{C#lgk(W`WQOUO@+0VzZlO$*l4v+iFh(Qyl%K<^SaF&Lzz@)gKRh1C)o!c+9PY?e$>E` z&&%2#R9#o0v#7KV{ABfXCsy#tRMeUW%V45i~q zvkxQ|iEiGAa>yl9Mk3W4G2^ME7>p#47yU8Qj1R_AebLAP5iwJ7(VIwRVj?vZOUl{? zhs4m6>9`q#5!BALkxNu%+B60u@g(f`4TCk2=^sobRgobc=-kn^&DapySk7$-QJi`4 z=aW~;(VvYm#}qK;gjdcBp1;fE@x?TgUPl>W*_HA6q%YpOSN@b5aa5T7_ zdK@^-c}@ckd=Z17Lk=7rSx&;%TT#m#+g@^S8v)5S1n+|JTIR(3H+g{!7Hukdz9Nzj%`-`VN7YsreT> ztP79n)=%}3pIz?i-Z4?=S`rre#Hq<3k%^o?EQ;5l_^ZCas&*lcPhjBo=<5m~`pA@D zw|@S_t;fj}4cC%=<5Vy`3E?kF`}@w&DD{PyKS||#^e_BU8aQ>`2LrlwSwB_Ws(a4r z7p|Kt%GMULwZJN|?~Gml!O#3F{1@3Jd!SfMq67Awtvd_Ib4AuPuHk`3AK5Chb(g*j zy|S?nNMZW?zS2|Bp*$i@)2%-(PIOF>rzBYa8s+qB*`n3)k-{%E6_2C&`VlIt*R2cs zr*{^W+y}aK-a4J{n9`3}%X8W%d&Ee`ln4C19Unb??$8@&WIbPaZxX83iThBob*zQ1 zhd1J?TceF2?N*KgA*$!+tZAg`t&XYYfVKIacp8} zTyZBn8i$!_sjrkhQaUdy*N^1q$ey=kFO8g_o)y`}dCBUQ6djSG9$VvH+3LWv4?(b0 zg4=eJJb~QXl}-BIf7PTQoO3oQaJUe7wP59FkVa0(p)$9Ok5MZ(k!b#~>>gQ;K;qUG z%B?ki%dK4l`Tx__-UXlRk-m%xSgb=$hjc`0RKLp(J1n*5e=|K@j#*kEFg>2vt?WVF zIy?-01ndxqJ5uu<&+8)vtlHva5lzuC*zdqnu8>`X8V*j#`|+hakT1*qQpugP9W!h|3nFa8HwB-x4L zOHi{;Ly6jFp>mnYqfN3#=%FEbVVxZph)+8-UxEItE*u3|?!qqIg{%{=)9PUz8v}9m z+(ho50n)9hFYtchN?=LuZSW&f!}rYcaUFFPe+!G_@M^la1WxLsqqM4Hg8!2w$H)S_ zB> z$7yhiTd09_zbzgm9Y?);(cp>Pn`9B`(#rf{%A>X9iS9XnR_q#)#hBUT?LCr7znPbv zV|PPd_HkbNh4qOvTdgVh6`|hDuXsJEA?E6SKxFM{tmpAUxGex^#mj)O+UHk%2br}O ztRH<e+V>KQFKUjUEk-(zsp;Ja#V7ch9c_O*Vtbzkdat;U%{ zGxzH&XJ+zrC)ceHt?T3R@v0e4;Z}>fW**Pv^E{0fCwfKE=%pnVT_DzEwrHuozD&&2 zKBKKkB(e*HeEld32r05FW@gjLSX6r=lE}tLG#b(#uA(Q%y2!*nFXZbI)!97|(<15q z>|iWuX0)M5CIdT>bPN^aZA!i#NrS(yK~3e-Pa2u{Q?ep>WT!ouNI#T9>m#95*3|B! zn$}Ba@7L~w>UydXSqVw?`^Eafq`7`*Fg9q!2D6FvW-Mcd%wbcu>0!Kcsb+?>j&z!; z&Y-ddkI?&A{X+Wbkg6H1V>B zS2W?d)psxLq0ob8@mJH+M?qUK{6nB24AeQ$7eR}l4Hc!|*Lkw*A5F z{)Ptw3!kh%D7LP=_s+Xk-%ch-29KHIG59_}K&wCaoOj#ex!zvXY?ns?zl8Gd($dN0 zzHfU;fb{9flU9{&R8P75eh-&_1Moid!6Oy=yQDtV{eAq7;07E66>a|DUwYg84KMgQ z{MzW8Hh<$^)am}F=jQ7EmXUco{o%B~rPbfm>ThiGYmkF{o4;Q6+alCofE}ua6ZOw( z;KzYG-?zB@2EEY(H+tYk58UX18$EEN2X6GhjUM=4_P~O$G%z{erfiKK4Jk2QWV50$ zFD!GscRqxT1xmNbD}8V6k-1wHk4I9ORw~+{%IP_j5|{t_`gDr;Bi=BP@;BeHIW|ul z%#@CM!$iv8HZDp|2;Tc|Q2Yu-nfN$^-5pB&%y~{Vke|!>TLgWtqcl|)mXz^H#k1dB zAAgfz9~V3Zc_9PMK>$DUD3UY z_9^;=qR%P%qM|P;`l_O575%ZI?Y?h|HJd`>xjoyL5K z=Hpf6=L(MRO8I%BT3q-rTR5I7<>w2I%SwDfIeshgh2?o%i7yh9Dh?{~#X_qx9zNkO zpBt%^4+vftD)FE=sMd>0d`bD-LnXdcbS(=zA({7yW#x6oS?I%CC9f})_zFRvJ>1DB zZo)Z_YWU59zoR;Jd;+sutsj;6En=)HzEaR<9Cz{wUL9vjXkC~iK9D?s~** z|7pGTqW^nb<3g4RKkC9m3ZHc0^gizqGk)^=v|Hk{`|~MfN2vP-Sec%~)l+3${tkGx zb{&)QK|$X$DDgMZGst`JWt+A`Db>jYV z*m1`{?fEYiv)6}zsbT+04SXK__wC=oMb(a_zS?%7;j$mokF<3=Q% zjvO$s%bq?U`qGiXm=Vnm4jzDtgEJs$R*2$*Lae+&FCFd6CVLGdw7Kb?yGdDb%^Rrp z?Ymlcb{HKGwWAewlQ>^tI4X?xKYFNj=ZinBW45+RUUDhQQN3ayUid}vGZtK zWr;lERtc%r&YWngES6{ODj~!Tys{6vsgrVUfr^uGkk6!y0elid!;KveLo*sr8d-dN zDxa`(8z_$ejioxW=a#Y0-MP{InT&Exe*00!04t^Fj9(>!u#<=QFa|hO=qh{g31gR< zKHC!X(JUhm3|30b#75K(4mzq>DPkCi0ghz~4xW_m(5T{s2xSfonvwmWX4<9$oWps? zSb9i=k|{G5YHi!G&W!Xcu0NR#?a#(>ayK3oA>sxinE?@s9!SETP0h4j@H@6jW{~VTzC(mJqU`{uEdSIjd4GbfldLm+ z3JmQDU>TN)-xFzFrliU1%%$Qc3Ah6@NFVxgV7W+$eQF8NN1?H@upZA)S{#KU)*DHGSyUzQRGJ|74B!vw`op^!fiS`2R4vSx`}T{d6{ms^I#0pQ3A- zt&nil@9GZm2E_dM(Hx@0`=GxYvPiQ}8==QucmGH3m~-!ipIs?CZw)@S;@OJ8U`wxVW}F`JaH ztjBZ;CC>W!y=_dhRoG89z00f0qj< zSxQVP%(-q^pf2BAXJ_bag)_NWX@_IiDL19rTv0Wc!l4;IZa=S!G(W4=Ke^V{|B0*6 HUH^XqVDi+% diff --git a/micro/rw_expt b/micro/rw_expt deleted file mode 100755 index f13cb32c294f288f861042ae92be168ebca5470f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13480 zcmeHOdvILUc|R-3SopCk+cFpo_zuX_7`&3OF)|>~%94FW*N@l|CJk`C)?P_lR=djX zU62WFL}W2sl%+~1Lrg}-q#}b+0 z6~is7SFBzYOecd^%W{)_l3l;CM|z_6R;FZnJ$S+>z3_MUJ-Pg&jawes`^xT-+`=0# zzwG*oYMAC>Sdm~mXnGl1KIO4$jhGD=G{ibEb2F+w&G_q6l#*=ANB!|p| zw4dr7+9}-|M(=RM=!+#H@z_147`i(ZvrIUFPtFZxoU)X%jKN4OA=Zbx+SeLa2UiAH z730&ftAp1FqpN#^5j9h0e=Kd8sqPJH~C9oZ2#;k|z_nNao&N3^UU>XF88HGcVz z5a+K3W18cPIxXRY2AWdvd}Cb@JC|n0Un;CV7Mn{}f2;V+g_K?;rodC+`I+a{Hb_%w zQS&h4LgBTVCes;b{_qk9r#X_!!C}gU&twoZ=faVpVmRW$X%6FX(uJSLAgHczvQ72C zVY3UTd62`cE}Z9fO55(j-S58v7w(?_hg>+<1=$&P;j;)(VZ?>gnCI|-3s*}5nKa?T zRn<#;w+r{P5zsv@JmA8A;KI3&Q1VkQe4a~wuM2mN>q!^Bz$O0+7p|5DGWC!PKi?&< zkA6_AkI(q`^E9E4OZd!ZlS$DlDzRZ(vCqV#E(ndVZ>au=LY~;Hjze zha~^s#8a2cPfGrM;;G5=Pf7lF#8Xq}_elO#;;D)A6Ow<4cxu}Gh~$4sJawo1kmR2y zo|-tnUGmQmPhB>@S@Qo#JT-N`P4Z6?PfeU}lKkHgPfeTGB>xx0Q(5cQ&Z-J z2$lmsOc+IKId*in? z)Q!Dn)n~UBezpZh!}bY%^m$)yF_}hYk-z$|{c)!~WxttQjS@A#L~DUsJ$p?PS}%0s zSYP0y$!DpfAo9Y|!177-yPwvh-(5N507z`Itvw*Fobf#3)iZvC-=lh9`7id8#?inX z&m9f?(PVA~ymi>`<^JUqatQ;d#i+j0snZOqc>l7m-5$CvbbIKIkg+ef2~y)NIbBxS z!WU6x$jxC?i*7$BbJ9GSdyOm=a`jTCbpvE_CjpKAx{wpVa*M(A1p`ZVAsa$WG=JD- zzj%jk|4tu$=g8*naCXLpWG_4SF?4CP%N*zw7T&c$6Q2Z@bV%qCFg<#9#&zKV2-Rt+695ow!2^ue5_J7cj3E7|bY?aMqAGKfUun*|>eeeVL>a>53`o~bJ zQA250!*0N6%a1-I+p62OejNokakTk(2qVZuO6S-+nW4_Hg4I0sVPMxkk;;b?x}DeU zSHt%44*R3rTaeP%91e^H(dj~?`+d6ajm|aiWnM)qEP%D<$@{E4&%S@8jpODuq<-hrz<`21jO8f_;|9ye6w;|^CpZ^9bT-JX$yY%UK znh0gL70?y49Sx}48zx-+#a$l9-r>xS(D+piU8DPJHlQ$X72IrIqbdZjGd(z^tpc}k?g_@CVceSC4giLqL^qO(tj4t3%SRoSnGUJu^p9mN9Aj* z(q-qKrm+vbYau}clJs*A{*QY=qW|gk$*sD5tjqp4-Tn<`*`e_GdQ3a5`=DJi;SMyv z@HD+x!uElqPXxaA{K%_f*Gqx19|AhqDOW4u@it7ot>1;_(-_Yl$z8Mp$i{X7gy<2@o|I};;{ z8b-1{-qA2n>|B}knAV1Pe8Bz3uym&Tz}QWwSd@c8ekJ0vzZ|TF3z6@qO5c1EuI2dp zPa0on`b*}>sc8k#ts(nVmwh~Z#k+D%@Z72D+*>D*nXwNot@$C2(OF_?`Z_Jy*M}{I)~YRy$1}5p z+yoQ_Bqw!5+WfkZTb0Jagw;5Norqx$X5x*OnYMz~uqBOc!X`s02er;rip-{qOFweA z#k4Z1gc;TDio`P}rALF>rqVog513jc)t?zO6INOqiloz!kEBdw7W*W*j{ zrS3M;*u@ZsQaGU}9qETsurU%$W-RRnDtn_W(v8{;P;I30ASxlLexp>JwT*T{nl+G0 zX8H$)GS+q4(x%|meH%0>nQly*z2rk~iIguQ$Xs7CHP|_f2zFly3z%w-)-u!h;*WIA>UV9nzUeJp$MC&0#!FSIV z;Tx{=EuJ&8cEUHaj_`}{97bQek_1#JFE2y`(n)^zu|lB<_JzN0oqy5If!TN0j)387SgZ$Itj{_~HZo@N-{BIzz-Cy_Zs*r!t{ndZy*G6l;;a?Q;*R}ge zN5}I3o<|{jIm$q?e^%A*U-VFQr(es~wELHRdq#)9>Hc#<{+7|1Tm4hMs=uD)ZwdLE zLjGm#ehs2ffw7L+O;CRs&j_Y$neS=89pra|f5KPw@+`lGtT-9ym`(nvPCr0de@^P0X~1`^JZGMP+-buq;=}hc&?KyEOm%^f#UgGd$Hna zJx1X|hZN7ZX)Q>B(~q4lB#Gax7ALgrqHwatp|qc)uvew?y1Q9rkk5AMy9*^mQ5oTUPbxW8ErR`DqHvbO@==x#?j(fewdA)e zd)T*ey3{3X5tmqSp{#eliivCv7 z|5Eh0qUWfFJWtWf6&`kY1I`D`bG9Aoxc3=cYU`!eM92!;iY)Bu(-py66ljW_jeZz`!kCDyc9pDI37yz znS%RCDPAkMf0g3r3hu|H_$lJ~T`J{& zzm%UZ8oU!b@N(sS3AliLZ~Oips1I)kZ~K0r(#dwFiZ55_jV6-wbfg4XF6_aHN&# zpWl&o{9=!?FV9J!^BC|t$k%D5)~=QEXO7b+C4Q#k0~PS83iw+vLG`v-bNtpRlb=+O zpNVquSa5r%a+Jf@0H<=HhU-0{eo!lkuPtRj& zIU~j@*!jN1G4519k!L>{K)e4RgfPhd9;f+|GR(}EwClf zzp7y8pMhWMlH=&(vL4QSKmLKlS;|Fmcx)CAZG-Y2O(xN67{N8ot5?#k8s^qqEqYT{ z+RF6xL2UY(i(w5KxMq_u(~yoPjsAFYMc-H9uC=8p@@5YpT#Pe1b!9>C*dmPe;Z5zKu(4^~x~-kvMt7(^+-ZnNG)h;Lm2;s9c`LcyZOz#}D zB0E5FeNNH=j^Xm1nHmzoMA9;Yq4us7R-|8X{fSI)M<#}Arm?695;qV@4~SrNX9D&d zYNec%yUbLYF5XEo#TZCSnehlIsMt{45<%H;K}3W7NwAiQk7Yp`>kvxHZXGlS)aV|- z2rF`qsx!b-vJDts*>!V_j61+|GYlu^&p$w zhzOlsu>M{ZVM^;03UmxW^~Cyo&TtDbyqb#od|tw|nUq|?!-_kQMrRM~pZAeW>H8N2 z&OggBy%TA4mccylH<`APGJ-e%4l2Ywh)|uf{vLJS!E{myvVU*+cPagLCCB?$rhL9b z`gDKMtN#!%suSh5xXlmA6zK|?3e95=F#W#Jf`05y|?^7RQlY0BWm5sG*zMe?EfD;`riK!=w?Ah zz5bu|==1)c>6FJm*BhIC0THaW>lmWv&p