From nobody Thu Feb 16 11:56:01 2023 X-Original-To: dev-commits-src-branches@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 4PHYLT4v0dz3q5lS; Thu, 16 Feb 2023 11:56:01 +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 4PHYLT1ntsz49Nn; Thu, 16 Feb 2023 11:56:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676548561; 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=MVqqs3MDkKNcOe8C+sNQIwml1KhB7s/1bTODwyXgMJI=; b=rKStiaOLHVF4ojnvRhM9DHL3NjhZr1zs6PI1dKEgJ6M2APRnUYqPOt2ZXroXug2riFbqFS 2vITgPYeO8U5yP9zYXEmSZb/6J9HNYdfSKCOpwJM9Cb6cDaJPdxx70v6YQa5EGv4uiHK8K RDALNZJvwBn1K3adm/CrpronQs+NNeSWS1oVPUzI53tmuQSJ+omCOfUTOBQKG0BMgK12cP Q6p6WYSXcdPxZds+Ol+kRS7sfHFEIVmFx81gQqX8x2Pf0AAjv1KOwsHBUtdRXako6E8Sms xmCdJFQ5Jl0UwzbmWGrkUGDnB/d35SE+huRm75klcWGB6JylNfYFWoV09kP50Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676548561; 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=MVqqs3MDkKNcOe8C+sNQIwml1KhB7s/1bTODwyXgMJI=; b=PZyfXwUwjyKFUlOGX1B2y6czxmGLXKMRKFIpB69izh9pL0qnDH5ZRZFpmjeb5wel9Xrlrd nDA9f0UmrSuv7qBI/jwSNFp8lgz4EVcx3XBmhaTRXu4H0mFy02yqmPHUHrIqsnb/zxIpb9 EkxVnwXnBjCLE1JnZGRkQ2BaE4YGJn/tIsn08LmA6kQoFhOM0Xv417LGVJfA2A2NbldQ1m DCbO0oBDSn0GW4r3UQevt56fA4pAbm4WOnTL0EmXpsvbgCarfPAG0gCgUX8d94cosAj5zQ 2iQka+FQ4q+I/zM6hxH2guIfDSCEWSc0IqJU7kKDXPocztUBJSJYMSpEFBO6tw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676548561; a=rsa-sha256; cv=none; b=wA4MEWLkORLETTFzij0NQJV3kkTJCP4eqfnUbJ7hWk61Qt+RLWHNFRmebxb6sWuii4dMTT Kz3c3uNBAkepW1yFdBliROoPbblT2gcLbvZGcNR81q1tEUZApTc5EGOcTPH5m314Zosfap oJ4Au9AAji31HW6N8RtG19BdeOhQX/ariUGHSEylNS0Ujfpub33GlCj/xpA5P4UpsvLn7Q orachcATzlS625R8LsBWpHfcD/6QLokdIAykOIV1iU8LoIWLyoFh7ah+KQAnCw3lu2hXZK UTXMP/oxIeWNVcGni/BsDMbsPz5cRUR7UTQBotq+0jt8b4P6Tan9pULNyczm2A== 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 4PHYLT0pZTz1352; Thu, 16 Feb 2023 11:56:01 +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 31GBu14S055465; Thu, 16 Feb 2023 11:56:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31GBu1Yx055464; Thu, 16 Feb 2023 11:56:01 GMT (envelope-from git) Date: Thu, 16 Feb 2023 11:56:01 GMT Message-Id: <202302161156.31GBu1Yx055464@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: 2c447575b604 - stable/13 - linuxkpi: Add `sysfs_emit_at()` in List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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: 2c447575b604ee9a29c342a65c1fc1936877adb5 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=2c447575b604ee9a29c342a65c1fc1936877adb5 commit 2c447575b604ee9a29c342a65c1fc1936877adb5 Author: Jean-Sébastien Pédron AuthorDate: 2023-01-20 19:23:17 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2023-02-16 11:55:15 +0000 linuxkpi: Add `sysfs_emit_at()` in Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D38159 (cherry picked from commit e64afbc21572984ca1249e01ff6b1cab39b679b9) --- 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_ */