From nobody Wed Jan 25 22:15:12 2023 X-Original-To: dev-commits-src-main@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 4P2J744Lzsz3bbks; Wed, 25 Jan 2023 22:15:12 +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 4P2J743P8bz46qZ; Wed, 25 Jan 2023 22:15:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674684912; 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=OWq7Cr4A0x/PEwmsBJtGQ8fUcHcwhJFuGgiLO1d6yrk=; b=aHB1EXSmbJTgtdE5Vb7e9/GQw1VHpPK6kiqupQujUDe4dKQSQ/kiYU5hPBghtnijVWccRy 2L07GgFiNVbWO3pHnJfQjMq2c8zhJiaSZ01q3IxItEEkURn8mlOnwE13S3pcRAVVxOxX7q J34PAMG1DpNDj78EP7PDQkcwfx/XzNuHS7e+1tTMYQ9sWxcmXbVO1D67aZ6Jv1JmDVHypx QZYvpHbEsTXgFkbhJ67qVx/kSMIKPMadlYUunD0MXbszbAIgrw3q4+v7xJg1k9YlE3Hyzt 9qf0INhANXA7JBA5F5s73WCz9gFNBuJ1xvboAdN2IIlHfptGvFi9K2Xm69zliQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674684912; 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=OWq7Cr4A0x/PEwmsBJtGQ8fUcHcwhJFuGgiLO1d6yrk=; b=fJLRasL8vm8pDJloiSoXtYT7FnNm8BJ5KvElNFpntnvx//lnW+b7aYBQXyvDR/gYtleH0r 7u7bvfl6pzh5wrpfg+xyNjWXne/dHFQ3/Z4cFBRxXXXiASZDQNbnZ2p1UIpOvmYQUoBHtH RBKJol2c3yGLd8c/zLWRyhq2Wr+iAvYGm5vN7KLcn+Dvxnr0JG1+/FpsNq3Hl0mwD5lHQg 1VXk1yYzFRlmPfAzfzS4KDhJE/GnHfUsj4GzZzd/PSKsdstrJnSUbU0lRaXXsoM48SdP0L IJvk8mjJZQuo6XUWpaVRuLU8k+CdqdULQDEJDr9TbSpCV719zhbLKHkrHI44+Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674684912; a=rsa-sha256; cv=none; b=QNDFiLSTeBmipWx//ir5h+JFh1a8hwYWXY6I24zegCgtjGEEtrjAa3yGhQuu7wzPVbf9Iq KgAOr60+AH5km3I0mQYwqbocaT5jGFp4PPnd1UANyGQ5our3jCa8CbzMVe97dcZnj3DCCi yc1cXyom69dUgMF55wMB6y/xYjf9x3IvFqqDowD7qf22wWH9ial9I7pgiGPzpL3b7iP1s5 IOVr1FZZ2OPogJB9ogPIJ8m725g5G+HPjsqxM1XhxXQJMGK4krhqkkUXFzepwCLPMr4/Hk 5B379H/whpMGhydDqQqdHWaP6mv8tHPFlvWoqpsZS8OGorV2iDMcdOyi17AmcQ== 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 4P2J742VJ9z15B8; Wed, 25 Jan 2023 22:15:12 +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 30PMFCrm064416; Wed, 25 Jan 2023 22:15:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30PMFCF5064415; Wed, 25 Jan 2023 22:15:12 GMT (envelope-from git) Date: Wed, 25 Jan 2023 22:15:12 GMT Message-Id: <202301252215.30PMFCF5064415@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Subject: git: e64afbc21572 - main - linuxkpi: Add `sysfs_emit_at()` in List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: e64afbc21572984ca1249e01ff6b1cab39b679b9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dumbbell (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=e64afbc21572984ca1249e01ff6b1cab39b679b9 commit e64afbc21572984ca1249e01ff6b1cab39b679b9 Author: Jean-Sébastien Pédron AuthorDate: 2023-01-20 19:23:17 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2023-01-25 21:56:56 +0000 linuxkpi: Add `sysfs_emit_at()` in Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D38159 --- sys/compat/linuxkpi/common/include/linux/sysfs.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/sysfs.h b/sys/compat/linuxkpi/common/include/linux/sysfs.h index b9689a367c90..9d19dd50dbbc 100644 --- a/sys/compat/linuxkpi/common/include/linux/sysfs.h +++ b/sys/compat/linuxkpi/common/include/linux/sysfs.h @@ -314,6 +314,24 @@ sysfs_emit(char *buf, const char *fmt, ...) return (i); } +static inline int +sysfs_emit_at(char *buf, int at, const char *fmt, ...) +{ + va_list args; + int i; + + if (!buf || offset_in_page(buf) || at < 0 || at >= PAGE_SIZE) { + pr_warn("invalid sysfs_emit: buf:%p at:%d\n", buf, at); + return (0); + } + + va_start(args, fmt); + i = vscnprintf(buf + at, PAGE_SIZE - at, fmt, args); + va_end(args); + + return (i); +} + #define sysfs_attr_init(attr) do {} while(0) #endif /* _LINUXKPI_LINUX_SYSFS_H_ */