From 34990cf702bdf2b4964e0629dab4af7669f8b2c5 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Thu, 1 May 2008 04:34:42 -0700 Subject: Add a new sysfs_streq() string comparison function Add a new sysfs_streq() string comparison function, which ignores the trailing newlines found in sysfs inputs. By example: sysfs_streq("a", "b") ==> false sysfs_streq("a", "a") ==> true sysfs_streq("a", "a\n") ==> true sysfs_streq("a\n", "a") ==> true This is intended to simplify parsing of sysfs inputs, letting them avoid the need to manually strip off newlines from inputs. Signed-off-by: David Brownell Acked-by: Greg KH Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/string.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/linux/string.h') diff --git a/include/linux/string.h b/include/linux/string.h index c5d3fcad7b5..efdc44593b5 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -109,5 +109,7 @@ extern void *kmemdup(const void *src, size_t len, gfp_t gfp); extern char **argv_split(gfp_t gfp, const char *str, int *argcp); extern void argv_free(char **argv); +extern bool sysfs_streq(const char *s1, const char *s2); + #endif #endif /* _LINUX_STRING_H_ */ -- cgit v1.2.3-70-g09d2