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

James Simmons <[email protected]>
Newsgroups org.lustre.lists.lustre-devel
Message-ID <[email protected]>
From: Lai Siyao <[email protected]>

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 <[email protected]>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49328
Reviewed-by: Andreas Dilger <[email protected]>
Reviewed-by: James Simmons <[email protected]>
Reviewed-by: Oleg Drokin <[email protected]>
Signed-off-by: James Simmons <[email protected]>
---
 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

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.