29 #include <linux/kernel.h>
30 #include <linux/module.h>
31 #include <linux/types.h>
33 #include <linux/tty.h>
35 #include <linux/errno.h>
36 #include <linux/string.h>
45 #define RECEIVE_ROOM 65536
46 #define DRIVERNAME "n_tracesink"
74 static int n_tracesink_open(
struct tty_struct *tty)
79 if (this_tty ==
NULL) {
80 this_tty = tty_kref_get(tty);
81 if (this_tty ==
NULL) {
100 static void n_tracesink_close(
struct tty_struct *tty)
128 unsigned char __user *
buf,
size_t nr) {
152 const unsigned char *
buf,
size_t nr) {
175 if ((buf !=
NULL) && (count > 0) && (this_tty !=
NULL))
176 this_tty->
ops->write(this_tty, buf, count);
194 .open = n_tracesink_open,
195 .close = n_tracesink_close,
196 .read = n_tracesink_read,
197 .write = n_tracesink_write
208 static int __init n_tracesink_init(
void)
214 pr_err(
"%s: Registration failed: %d\n", __func__, retval);
224 static void __exit n_tracesink_exit(
void)
229 pr_err(
"%s: Unregistration failed: %d\n", __func__, retval);