From nobody Thu Feb 16 11:55:47 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PHYLC6s3Jz3q5C1; Thu, 16 Feb 2023 11:55:47 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PHYLC54HHz47y3; Thu, 16 Feb 2023 11:55:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676548547; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ynnI7r2kCFjBaqI/MQTMm4euLREmC9Uzb+Q2Heqg5Eg=; b=KUWp9khZdqARtlCReoaYk8emr4J6ZGA+9UHPhGrKPrh7MXDkizSiwMM+WT4VqyVTDX8ZYZ NflhfVGgfqPr1GgmK7FK39yytx7xCe1eTWtgbgfv7PZ1Iqs7PW1PHtOZcrSwspbM1teGao D8lQ8FadL0wJ7oJMGUlizMWDnMYerDtsPrtV7alFNV4DWXF7DxndXStNgHCFurqPC9ptGx tXZ8yy4kN/v7+Rgy2mbY9AA9Yac+tPPZICvwXRXU9JRB4U6WY/gT7sla1Jhc29zsljOXWW QKsEgJxn8BW3IBKccaXj1Y9kPwYfFjVfhlWonkdZWufjGU9rLBZuH/8qfiQONQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676548547; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ynnI7r2kCFjBaqI/MQTMm4euLREmC9Uzb+Q2Heqg5Eg=; b=UOGbnST3BvV03E8Wp6PPTbq1RioTimVezfAjYDiIBwdjfpXczPKby3b5H44f16VmeHxNOJ hwJJ89RoZxNsN4KPfIsazCL2qQU7uHfx3CuXKm5lyX/PvxlLmY/HMYoPh60gBntHliLoo+ IwfZwCPprDhAxH9DV35iggetDLVMZnR4y+NBNouYqIzxUq66Bnbn4UP5iyLRhyE6DGcsMs w0xfT2Zw7v0eQdz9yJjE8JZXlI1H6QHYZ5eN0iYlqJUhIHvMk4QR4nzXuXsMt2aE0rOmVv r0YEHU9VPHFranMGh4X8Kzz8dZmlkqKkWk0lz5xFhXsOOJysJX5as8D0RU2Aow== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676548547; a=rsa-sha256; cv=none; b=H/5f6929oDq8kTuFSR/mPv+cmr5gz+Qcnp7gl/IKh2agsnk6nHYtMhM9XWB8vIq4ttsnUz JQWvMoplX0qwa6Bx6w8oy49+l1EN9DFd5ffbQlm6GhiKuLSa/r0saJW8T3TgUhQiGVa/rB N8qxaBGN+nKMdErfA3F5Tvhm37p6S8HHJGEQZFpM1I3qPQ2OiBSuwWGKkPqDdynktYQuDy 61EM/mZSiydYzclGAZNGa99OXIffa5WpKD/YIP2LNpTdZrE8hHAsturVYYsdUhNzeb/Rkb zATp0dsekZ0YiVa15VB0ml/t+3pEa+P9cnfPw7JLe1s9/u8KI9ieYB1kCxwC6g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PHYLC3XtMz12fS; Thu, 16 Feb 2023 11:55:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31GBtlF1055094; Thu, 16 Feb 2023 11:55:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31GBtlou055092; Thu, 16 Feb 2023 11:55:47 GMT (envelope-from git) Date: Thu, 16 Feb 2023 11:55:47 GMT Message-Id: <202302161155.31GBtlou055092@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Subject: git: a6575008038b - stable/13 - linuxkpi: Add `sysfs_emit()` List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a6575008038b7c70f8aaf0e8c18abdfe60e03852 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dumbbell (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a6575008038b7c70f8aaf0e8c18abdfe60e03852 commit a6575008038b7c70f8aaf0e8c18abdfe60e03852 Author: Jean-Sébastien Pédron AuthorDate: 2023-01-11 23:23:33 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2023-02-16 11:55:12 +0000 linuxkpi: Add `sysfs_emit()` Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D38086 (cherry picked from commit 4fee6659c42c264e17dad7625f8663a45594d46b) --- sys/compat/linuxkpi/common/include/linux/sysfs.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/sysfs.h b/sys/compat/linuxkpi/common/include/linux/sysfs.h index e6b8ad210f16..b9689a367c90 100644 --- a/sys/compat/linuxkpi/common/include/linux/sysfs.h +++ b/sys/compat/linuxkpi/common/include/linux/sysfs.h @@ -37,6 +37,7 @@ #include #include +#include struct sysfs_ops { ssize_t (*show)(struct kobject *, struct attribute *, char *); @@ -295,6 +296,24 @@ sysfs_streq(const char *s1, const char *s2) return (l1 == l2 && strncmp(s1, s2, l1) == 0); } +static inline int +sysfs_emit(char *buf, const char *fmt, ...) +{ + va_list args; + int i; + + if (!buf || offset_in_page(buf)) { + pr_warn("invalid sysfs_emit: buf:%p\n", buf); + return (0); + } + + va_start(args, fmt); + i = vscnprintf(buf, PAGE_SIZE, fmt, args); + va_end(args); + + return (i); +} + #define sysfs_attr_init(attr) do {} while(0) #endif /* _LINUXKPI_LINUX_SYSFS_H_ */