[lustre-devel] [PATCH 20/42] lustre: uapi: remove _GNU_SOURCE dependency in lustre_user.h

James Simmons jsimmons at infradead.org
Mon Jan 23 15:00:33 PST 2023


From: Lai Siyao <lai.siyao at whamcloud.com>

The lustre_user.h header uses the non-standard strchrnul() function
in userspace.

Implement an alternative approach to avoid external dependencies on
the lustre_user.h header.

Fixes: 90c2d33680 ("lustre: uapi: avoid gcc-11 -Werror=stringop-overread warning")
WC-bug-id: https://jira.whamcloud.com/browse/LU-16335
Lustre-commit: efc5c8d4de60d3943 ("LU-16335 build: remove _GNU_SOURCE dependency in lustre_user.h")
Signed-off-by: Lai Siyao <lai.siyao at whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49328
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Reviewed-by: James Simmons <jsimmons at infradead.org>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
 include/uapi/linux/lustre/lustre_user.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/lustre/lustre_user.h b/include/uapi/linux/lustre/lustre_user.h
index a2f46e7f4257..9bbb1c9ab0b9 100644
--- a/include/uapi/linux/lustre/lustre_user.h
+++ b/include/uapi/linux/lustre/lustre_user.h
@@ -1715,9 +1715,11 @@ static inline __kernel_size_t changelog_rec_snamelen(struct changelog_rec *rec)
 
 static inline char *changelog_rec_sname(struct changelog_rec *rec)
 {
-	char *cr_name = changelog_rec_name(rec);
+	char *str = changelog_rec_name(rec);
 
-	return cr_name + strlen(cr_name) + 1;
+	while (*str != '\0')
+		str++;
+	return str + 1;
 }
 
 /**
-- 
2.27.0



More information about the lustre-devel mailing list