From: Stan Cox Date: Thu, 26 May 2022 17:36:02 +0000 (-0400) Subject: Adapt hw_breakpoint.exp for Linux 5.7.0 proc_create X-Git-Tag: release-4.8~89 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=d39c7c68680a215eb2f09cc560231dfd4cd19ab7;p=systemtap.git Adapt hw_breakpoint.exp for Linux 5.7.0 proc_create Linux 5.7.0 uses struct proc_ops instead of file_operations. xfail if unable to get address from kallsyms --- diff --git a/testsuite/systemtap.base/hw_breakpoint.exp b/testsuite/systemtap.base/hw_breakpoint.exp index 4f838be1c..92f778fd9 100644 --- a/testsuite/systemtap.base/hw_breakpoint.exp +++ b/testsuite/systemtap.base/hw_breakpoint.exp @@ -114,6 +114,8 @@ if { $no_hardware_support == 1 } { xfail "$test - addr (kernel support, but no hardware support)" } elseif { $rc == 0 && $found == 1 } { pass "$test - addr (hw breakpoint support)" +} elseif { $res == 0 } { + xfail "$test - addr {no module data address}" } else { fail "$test - addr ($rc, $found)" } diff --git a/testsuite/systemtap.base/stap_hwbkpt_kmod.c b/testsuite/systemtap.base/stap_hwbkpt_kmod.c index b52b7e421..98eb353c9 100644 --- a/testsuite/systemtap.base/stap_hwbkpt_kmod.c +++ b/testsuite/systemtap.base/stap_hwbkpt_kmod.c @@ -9,6 +9,7 @@ */ #include +#include #include #include #include @@ -69,11 +70,18 @@ static ssize_t stm_read_cmd(struct file *file, char __user *buffer, return bytes; } +#if LINUX_VERSION_CODE <= KERNEL_VERSION(5,6,0) static struct file_operations stm_fops_cmd = { - .owner = THIS_MODULE, - .write = stm_write_cmd, + .owner = THIS_MODULE, + .write = stm_write_cmd, .read = stm_read_cmd, }; +#else +static struct proc_ops stm_fops_cmd = { + .proc_write = stm_write_cmd, + .proc_read = stm_read_cmd, +}; +#endif #define CMD_FILE "stap_hwbkpt_cmd"