From owner-svn-src-stable-12@freebsd.org Mon Aug 24 10:28:16 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 55BD43B8F78; Mon, 24 Aug 2020 10:28:16 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZpHN1ZHYz4XVR; Mon, 24 Aug 2020 10:28:16 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 193C31712E; Mon, 24 Aug 2020 10:28:16 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07OASFeg047231; Mon, 24 Aug 2020 10:28:15 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07OASF73047230; Mon, 24 Aug 2020 10:28:15 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202008241028.07OASF73047230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 24 Aug 2020 10:28:15 +0000 (UTC) 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 X-SVN-Group: stable-12 X-SVN-Commit-Author: manu X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 364652 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 10:28:16 -0000 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_ */