From 414b63004c4ecfbf79966cfdcc8c6c4f1a3580d0 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Tue, 22 Apr 2025 15:33:42 -0400 Subject: [PATCH] Adjust for __assign_str() losing second argument In v6.8-9146-gc759e609030c, the second argument for __assign_str() was removed, as the second parameter is already derived from the __string() definition and no longer needed. We have to do a little digging in headers here to find the definition. Note the missing `;` at a few places... it has to be added now. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 11 +++++++++++ kmod/src/kernelcompat.h | 6 ++++++ kmod/src/scoutfs_trace.h | 12 ++++++------ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 6be0ecf4..30d3630b 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -535,3 +535,14 @@ endif ifneq (,$(shell grep -s 'struct inode.*bd_inode' include/linux/blk_types.h include/linux/fs.h)) ccflags-y += -DKC_HAVE_BD_INODE endif + +# +# v6.8-9146-gc759e609030c +# +# Removes __assign_str_len() and removes the 2nd param of __assign_str(). +ifneq (,$(shell grep -s 'define __assign_str.dst, src' \ + include/trace/trace_events.h \ + include/trace/ftrace.h \ + include/trace/stages/stage6_event_callback.h)) +ccflags-y += -DKC_HAVE_ASSIGN_STR_PARMS +endif diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index e00440b0..56d3f202 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -596,4 +596,10 @@ static inline long inode_get_atime_nsec(const struct inode *inode) #define KC_BDEV_MAPPING(b) (b)->bd_mapping #endif +#ifdef KC_HAVE_ASSIGN_STR_PARMS +#define kc__assign_str(a, b) __assign_str(a, b) +#else +#define kc__assign_str(a, b) __assign_str(a) +#endif + #endif diff --git a/kmod/src/scoutfs_trace.h b/kmod/src/scoutfs_trace.h index c7157352..25279980 100644 --- a/kmod/src/scoutfs_trace.h +++ b/kmod/src/scoutfs_trace.h @@ -102,7 +102,7 @@ TRACE_EVENT(scoutfs_setattr, SCSB_TRACE_ASSIGN(dentry->d_inode->i_sb); __entry->ino = scoutfs_ino(dentry->d_inode); __entry->d_len = dentry->d_name.len; - __assign_str(d_name, dentry->d_name.name); + kc__assign_str(d_name, dentry->d_name.name); __entry->ia_valid = attr->ia_valid; __entry->size_change = !!(attr->ia_valid & ATTR_SIZE); __entry->ia_size = attr->ia_size; @@ -1638,9 +1638,9 @@ TRACE_EVENT(scoutfs_rename, TP_fast_assign( SCSB_TRACE_ASSIGN(sb); __entry->old_dir_ino = scoutfs_ino(old_dir); - __assign_str(old_name, old_dentry->d_name.name) + kc__assign_str(old_name, old_dentry->d_name.name); __entry->new_dir_ino = scoutfs_ino(new_dir); - __assign_str(new_name, new_dentry->d_name.name) + kc__assign_str(new_name, new_dentry->d_name.name); __entry->new_inode_ino = new_dentry->d_inode ? scoutfs_ino(new_dentry->d_inode) : 0; ), @@ -1670,7 +1670,7 @@ TRACE_EVENT(scoutfs_d_revalidate, TP_fast_assign( SCSB_TRACE_ASSIGN(sb); __entry->dentry = dentry; - __assign_str(name, dentry->d_name.name) + kc__assign_str(name, dentry->d_name.name); __entry->ino = dentry->d_inode ? scoutfs_ino(dentry->d_inode) : 0; __entry->dir_ino = dir_ino; __entry->flags = flags; @@ -1705,7 +1705,7 @@ TRACE_EVENT(scoutfs_validate_dentry, SCSB_TRACE_ASSIGN(sb); __entry->dentry = dentry; __entry->dir_ino = dir_ino; - __assign_str(name, dentry->d_name.name) + kc__assign_str(name, dentry->d_name.name); __entry->dentry_ino = dentry_ino; __entry->dent_ino = dent_ino; __entry->fsdata_gen = (unsigned long long)dentry->d_fsdata; @@ -1827,7 +1827,7 @@ TRACE_EVENT(scoutfs_get_name, SCSB_TRACE_ASSIGN(sb); __entry->parent_ino = scoutfs_ino(parent); __entry->child_ino = scoutfs_ino(child); - __assign_str(name, name); + kc__assign_str(name, name); ), TP_printk(SCSBF" parent %llu child %llu name: %s",