svn commit: r364652 - stable/12/sys/compat/linuxkpi/common/include/linux
Emmanuel Vadot
manu at FreeBSD.org
Mon Aug 24 10:28:16 UTC 2020
Author: manu
Date: Mon Aug 24 10:28:15 2020
New Revision: 364652
URL: https://svnweb.freebsd.org/changeset/base/364652
Log:
MFC r358176-r358177
r358176:
linuxkpi: Add list_is_first function
This function just test if the element is the first of the list.
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D23766
r358177:
linuxkpi: Add str_has_prefix
This function test if the string str begins with the string pointed
at by prefix.
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D23767
Modified:
stable/12/sys/compat/linuxkpi/common/include/linux/list.h
stable/12/sys/compat/linuxkpi/common/include/linux/string.h
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/compat/linuxkpi/common/include/linux/list.h
==============================================================================
--- stable/12/sys/compat/linuxkpi/common/include/linux/list.h Mon Aug 24 09:46:36 2020 (r364651)
+++ stable/12/sys/compat/linuxkpi/common/include/linux/list.h Mon Aug 24 10:28:15 2020 (r364652)
@@ -449,6 +449,13 @@ static inline void list_cut_position(struct list_head
__list_cut_position(list, head, entry);
}
+static inline int list_is_first(const struct list_head *list,
+ const struct list_head *head)
+{
+
+ return (list->prev == head);
+}
+
static inline int list_is_last(const struct list_head *list,
const struct list_head *head)
{
Modified: stable/12/sys/compat/linuxkpi/common/include/linux/string.h
==============================================================================
--- stable/12/sys/compat/linuxkpi/common/include/linux/string.h Mon Aug 24 09:46:36 2020 (r364651)
+++ stable/12/sys/compat/linuxkpi/common/include/linux/string.h Mon Aug 24 10:28:15 2020 (r364652)
@@ -158,4 +158,13 @@ memchr_inv(const void *start, int c, size_t length)
return (NULL);
}
+static inline size_t
+str_has_prefix(const char *str, const char *prefix)
+{
+ size_t len;
+
+ len = strlen(prefix);
+ return (strncmp(str, prefix, len) == 0 ? len : 0);
+}
+
#endif /* _LINUX_STRING_H_ */
More information about the svn-src-all
mailing list