LCOV - code coverage report
Current view: top level - drivers/tty - n_null.c (source / functions) Hit Total Coverage
Test: Real Lines: 3 16 18.8 %
Date: 2020-10-17 15:46:16 Functions: 0 7 0.0 %
Legend: Neither, QEMU, Real, Both Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : // SPDX-License-Identifier: GPL-2.0
       2                 :            : #include <linux/types.h>
       3                 :            : #include <linux/errno.h>
       4                 :            : #include <linux/tty.h>
       5                 :            : #include <linux/module.h>
       6                 :            : 
       7                 :            : /*
       8                 :            :  *  n_null.c - Null line discipline used in the failure path
       9                 :            :  *
      10                 :            :  *  Copyright (C) Intel 2017
      11                 :            :  */
      12                 :            : 
      13                 :          0 : static int n_null_open(struct tty_struct *tty)
      14                 :            : {
      15                 :          0 :         return 0;
      16                 :            : }
      17                 :            : 
      18                 :          0 : static void n_null_close(struct tty_struct *tty)
      19                 :            : {
      20                 :          0 : }
      21                 :            : 
      22                 :          0 : static ssize_t n_null_read(struct tty_struct *tty, struct file *file,
      23                 :            :                            unsigned char __user * buf, size_t nr)
      24                 :            : {
      25                 :          0 :         return -EOPNOTSUPP;
      26                 :            : }
      27                 :            : 
      28                 :          0 : static ssize_t n_null_write(struct tty_struct *tty, struct file *file,
      29                 :            :                             const unsigned char *buf, size_t nr)
      30                 :            : {
      31                 :          0 :         return -EOPNOTSUPP;
      32                 :            : }
      33                 :            : 
      34                 :          0 : static void n_null_receivebuf(struct tty_struct *tty,
      35                 :            :                                  const unsigned char *cp, char *fp,
      36                 :            :                                  int cnt)
      37                 :            : {
      38                 :          0 : }
      39                 :            : 
      40                 :            : static struct tty_ldisc_ops null_ldisc = {
      41                 :            :         .owner          =       THIS_MODULE,
      42                 :            :         .magic          =       TTY_LDISC_MAGIC,
      43                 :            :         .name           =       "n_null",
      44                 :            :         .open           =       n_null_open,
      45                 :            :         .close          =       n_null_close,
      46                 :            :         .read           =       n_null_read,
      47                 :            :         .write          =       n_null_write,
      48                 :            :         .receive_buf    =       n_null_receivebuf
      49                 :            : };
      50                 :            : 
      51                 :          3 : static int __init n_null_init(void)
      52                 :            : {
      53                 :          3 :         BUG_ON(tty_register_ldisc(N_NULL, &null_ldisc));
      54                 :          3 :         return 0;
      55                 :            : }
      56                 :            : 
      57                 :          0 : static void __exit n_null_exit(void)
      58                 :            : {
      59                 :          0 :         tty_unregister_ldisc(N_NULL);
      60                 :          0 : }
      61                 :            : 
      62                 :            : module_init(n_null_init);
      63                 :            : module_exit(n_null_exit);
      64                 :            : 
      65                 :            : MODULE_LICENSE("GPL");
      66                 :            : MODULE_AUTHOR("Alan Cox");
      67                 :            : MODULE_ALIAS_LDISC(N_NULL);
      68                 :            : MODULE_DESCRIPTION("Null ldisc driver");
    

Generated by: LCOV version 1.14