git: cdfdafdc3424 - main - linuxkpi: Define `DEFINE_SHOW_STORE_ATTRIBUTE()`
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 09 Aug 2025 12:36:00 UTC
The branch main has been updated by dumbbell:
URL: https://cgit.FreeBSD.org/src/commit/?id=cdfdafdc34244aced687516a7a0cb04e7b4d267c
commit cdfdafdc34244aced687516a7a0cb04e7b4d267c
Author: Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2025-06-20 19:50:13 +0000
Commit: Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2025-08-09 12:26:24 +0000
linuxkpi: Define `DEFINE_SHOW_STORE_ATTRIBUTE()`
It is the same as `DEFINE_SHOW_ATTRIBUTE()` with a `write` function
added.
The i915 DRM driver started to use it in Linux 6.9.
Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50992
---
sys/compat/linuxkpi/common/include/linux/seq_file.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/sys/compat/linuxkpi/common/include/linux/seq_file.h b/sys/compat/linuxkpi/common/include/linux/seq_file.h
index 876ef9e8dfe5..47da16ab8688 100644
--- a/sys/compat/linuxkpi/common/include/linux/seq_file.h
+++ b/sys/compat/linuxkpi/common/include/linux/seq_file.h
@@ -55,6 +55,21 @@ static const struct file_operations __name ## _fops = { \
.release = single_release, \
}
+#define DEFINE_SHOW_STORE_ATTRIBUTE(__name) \
+static int __name ## _open(struct inode *inode, struct linux_file *file) \
+{ \
+ return single_open(file, __name ## _show, inode->i_private); \
+} \
+ \
+static const struct file_operations __name ## _fops = { \
+ .owner = THIS_MODULE, \
+ .open = __name ## _open, \
+ .read = seq_read, \
+ .write = __name ## _write, \
+ .llseek = seq_lseek, \
+ .release = single_release, \
+}
+
struct seq_file {
struct sbuf *buf;
size_t size;