26 #include <linux/kernel.h>
27 #include <linux/module.h>
34 #define ERST_DBG_PFX "ERST DBG: "
36 #define ERST_DBG_RECORD_LEN_MAX 0x4000
38 static void *erst_dbg_buf;
39 static unsigned int erst_dbg_buf_len;
60 static int erst_dbg_release(
struct inode *inode,
struct file *file)
67 static long erst_dbg_ioctl(
struct file *
f,
unsigned int cmd,
unsigned long arg)
94 static ssize_t erst_dbg_read(
struct file *filp,
char __user *ubuf,
95 size_t usize, loff_t *off)
117 rc = len =
erst_read(
id, erst_dbg_buf, erst_dbg_buf_len);
125 "Record (ID: 0x%llx) length is too long: %zd\n",
130 if (len > erst_dbg_buf_len) {
138 erst_dbg_buf_len = len;
152 return rc ? rc : len;
155 static ssize_t erst_dbg_write(
struct file *filp,
const char __user *ubuf,
156 size_t usize, loff_t *off)
171 if (usize > erst_dbg_buf_len) {
179 erst_dbg_buf_len = usize;
195 return rc < 0 ? rc : usize;
200 .open = erst_dbg_open,
201 .release = erst_dbg_release,
202 .read = erst_dbg_read,
203 .write = erst_dbg_write,
204 .unlocked_ioctl = erst_dbg_ioctl,
211 .fops = &erst_dbg_ops,
214 static __init int erst_dbg_init(
void)
223 static __exit void erst_dbg_exit(
void)