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
This commit is contained in:
Jean-Sébastien Pédron 2025-06-20 21:50:13 +02:00
parent 621f43ffe2
commit cdfdafdc34
No known key found for this signature in database
GPG key ID: 39E99761A5FD94CC

View file

@ -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;