Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Feb 2023 11:56:01 GMT
From:      =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= <dumbbell@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 2c447575b604 - stable/13 - linuxkpi: Add `sysfs_emit_at()` in <linux/sysfs.h>
Message-ID:  <202302161156.31GBu1Yx055464@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <dumbbell@FreeBSD.org>
AuthorDate: 2023-01-20 19:23:17 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2023-02-16 11:55:15 +0000

    linuxkpi: Add `sysfs_emit_at()` in <linux/sysfs.h>
    
    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_ */



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