Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Aug 2020 10:28:15 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r364652 - stable/12/sys/compat/linuxkpi/common/include/linux
Message-ID:  <202008241028.07OASF73047230@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008241028.07OASF73047230>