Linux驱动开发杂记(0x18) - 内核tty接口各版本的变化(二)之tty_driver.h

2024-06-09 06:18

本文主要是介绍Linux驱动开发杂记(0x18) - 内核tty接口各版本的变化(二)之tty_driver.h,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

2.6.17 - 2.6.18

删除

struct tty_driver {const char      *devfs_name;
}

2.6.19 - 2.6.20

修改

struct tty_operations {void (*set_termios)(struct tty_struct *tty, struct termios * old);
//改为	void (*set_termios)(struct tty_struct *tty, struct ktermios * old);
}
struct tty_driver {struct termios init_termios; /* Initial termios *///改为	struct ktermios init_termios; /* Initial termios */struct termios **termios;struct termios **termios_locked;//改为	struct ktermios **termios;struct ktermios **termios_locked;void (*set_termios)(struct tty_struct *tty, struct termios * old);//改为	void (*set_termios)(struct tty_struct *tty, struct ktermios * old);
}

2.6.21 - 2.6.22

添加

struct tty_operations {long (*compat_ioctl)(struct tty_struct *tty, struct file * file,unsigned int cmd, unsigned long arg);
}
struct tty_driver {long (*compat_ioctl)(struct tty_struct *tty, struct file * file,unsigned int cmd, unsigned long arg);
}

2.6.25 - 2.6.26

添加

extern struct tty_driver *tty_find_polling_driver(char *name, int *line);
struct tty_driver {const struct tty_operations *ops;
}

修改

struct tty_operations {void (*put_char)(struct tty_struct *tty, unsigned char ch);//改为int  (*put_char)(struct tty_struct *tty, unsigned char ch);
}
struct tty_driver {long (*compat_ioctl)(struct tty_struct *tty, struct file * file,unsigned int cmd, unsigned long arg);
}

删除

struct tty_operations {int (*write_proc)(struct file *file, const char __user *buffer,unsigned long count, void *data);
}
struct tty_driver {int  (*open)(struct tty_struct * tty, struct file * filp);void (*close)(struct tty_struct * tty, struct file * filp);int  (*write)(struct tty_struct * tty,const unsigned char *buf, int count);void (*put_char)(struct tty_struct *tty, unsigned char ch);void (*flush_chars)(struct tty_struct *tty);int  (*write_room)(struct tty_struct *tty);int  (*chars_in_buffer)(struct tty_struct *tty);int  (*ioctl)(struct tty_struct *tty, struct file * file,unsigned int cmd, unsigned long arg);long (*compat_ioctl)(struct tty_struct *tty, struct file * file,unsigned int cmd, unsigned long arg);void (*set_termios)(struct tty_struct *tty, struct ktermios * old);void (*throttle)(struct tty_struct * tty);void (*unthrottle)(struct tty_struct * tty);void (*stop)(struct tty_struct *tty);void (*start)(struct tty_struct *tty);void (*hangup)(struct tty_struct *tty);void (*break_ctl)(struct tty_struct *tty, int state);void (*flush_buffer)(struct tty_struct *tty);void (*set_ldisc)(struct tty_struct *tty);void (*wait_until_sent)(struct tty_struct *tty, int timeout);void (*send_xchar)(struct tty_struct *tty, char ch);int (*read_proc)(char *page, char **start, off_t off,int count, int *eof, void *data);int (*write_proc)(struct file *file, const char __user *buffer,unsigned long count, void *data);int (*tiocmget)(struct tty_struct *tty, struct file *file);int (*tiocmset)(struct tty_struct *tty, struct file *file,unsigned int set, unsigned int clear);
}

2.6.26 - 2.6.27

添加

struct tty_operations {int (*resize)(struct tty_struct *tty, struct tty_struct *real_tty, struct winsize *ws);
}

修改

struct tty_operations {	void (*break_ctl)(struct tty_struct *tty, int state);
//改为int (*break_ctl)(struct tty_struct *tty, int state);
}

2.6.29 - 2.6.30

添加

struct tty_operations {struct tty_struct * (*lookup)(struct tty_driver *driver, struct inode *inode, int idx);int  (*install)(struct tty_driver *driver, struct tty_struct *tty);void (*remove)(struct tty_driver *driver, struct tty_struct *tty);void (*shutdown)(struct tty_struct *tty);int (*set_termiox)(struct tty_struct *tty, struct termiox *tnew);
}
struct tty_driver {struct kref kref;       /* Reference management */
}
extern void tty_driver_kref_put(struct tty_driver *driver);
extern inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d);

删除

struct tty_driver {int     refcount;       /* for loadable tty drivers */
}

2.6.28 - 2.6.29

修改

struct tty_operations {int (*resize)(struct tty_struct *tty, struct tty_struct *real_tty, unsigned int rows, unsigned int cols);int (*resize)(struct tty_struct *tty, struct winsize *ws);
}

2.6.29 - 2.6.30

添加

struct tty_operations {const struct file_operations *proc_fops;
}

删除

struct tty_operations {int (*read_proc)(char *page, char **start, off_t off, int count, int *eof, void *data);}

2.6.31 - 2.6.32

添加

struct tty_operations {void (*cleanup)(struct tty_struct *tty);
}

2.6.36 - 2.6.37

添加

struct tty_operations {int (*get_icount)(struct tty_struct *tty, struct serial_icounter_struct *icount);
}

2.6.38 - 2.6.39

//修改

struct tty_operations {int  (*ioctl)(struct tty_struct *tty, struct file * file, unsigned int cmd, unsigned long arg);// 改为int  (*ioctl)(struct tty_struct *tty, unsigned int cmd, unsigned long arg);long (*compat_ioctl)(struct tty_struct *tty, struct file * file,unsigned int cmd, unsigned long arg);// 改为long (*compat_ioctl)(struct tty_struct *tty,unsigned int cmd, unsigned long arg);int (*tiocmget)(struct tty_struct *tty, struct file *file);int (*tiocmset)(struct tty_struct *tty, struct file *file,unsigned int set, unsigned int clear);// 改为int (*tiocmget)(struct tty_struct *tty);int (*tiocmset)(struct tty_struct *tty, unsigned int set, unsigned int clear);
}                        

3.2 - 3.3

删除

struct tty_driver {......struct ktermios **termios_locked;......
}

3.3 - 3.4

删除

struct tty_driver {......int     minor_num;      /* number of *possible* devices */......
}

3.6 - 3.7

添加

struct tty_driver {......struct tty_port **ports;......
}
#define tty_alloc_driver(lines, flags)

修改

struct tty_driver {......struct cdev cdev;// 改为struct cdev *cdevs;......
}

4.2 - 4.3

修改

struct tty_driver {......struct cdev *cdevs;// 改为struct cdev **cdevs;......
}

4.5 - 4.6

修改

struct tty_operations {......struct tty_struct * (*lookup)(struct tty_driver *self, int idx);// 改为struct tty_struct * (*lookup)(struct tty_driver *self, struct file *, int idx);......
}
struct tty_struct * (*lookup)(struct tty_driver *self, int idx)
struct tty_struct * (*lookup)(struct tty_driver *self, struct file *, int idx)

4.13 - 4.14

添加

struct tty_operations {......void (*show_fdinfo)(struct tty_struct *tty, struct seq_file *m);......
}

4.17 - 4.18

添加

struct tty_operations {......int (*proc_show)(struct seq_file *, void *);......
}

删除

struct tty_operations {......const struct file_operations *proc_fops;......
}

4.19 - 4.20

添加

struct tty_operations {......int  (*get_serial)(struct tty_struct *tty, struct serial_struct *p);int  (*set_serial)(struct tty_struct *tty, struct serial_struct *p);......
}

这篇关于Linux驱动开发杂记(0x18) - 内核tty接口各版本的变化(二)之tty_driver.h的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1044410

相关文章

Java controller接口出入参时间序列化转换操作方法(两种)

《Javacontroller接口出入参时间序列化转换操作方法(两种)》:本文主要介绍Javacontroller接口出入参时间序列化转换操作方法,本文给大家列举两种简单方法,感兴趣的朋友一起看... 目录方式一、使用注解方式二、统一配置场景:在controller编写的接口,在前后端交互过程中一般都会涉及

Linux之systemV共享内存方式

《Linux之systemV共享内存方式》:本文主要介绍Linux之systemV共享内存方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、工作原理二、系统调用接口1、申请共享内存(一)key的获取(二)共享内存的申请2、将共享内存段连接到进程地址空间3、将

快速修复一个Panic的Linux内核的技巧

《快速修复一个Panic的Linux内核的技巧》Linux系统中运行了不当的mkinitcpio操作导致内核文件不能正常工作,重启的时候,内核启动中止于Panic状态,该怎么解决这个问题呢?下面我们就... 感谢China编程(www.chinasem.cn)网友 鸢一雨音 的投稿写这篇文章是有原因的。为了配置完

Go语言开发实现查询IP信息的MCP服务器

《Go语言开发实现查询IP信息的MCP服务器》随着MCP的快速普及和广泛应用,MCP服务器也层出不穷,本文将详细介绍如何在Go语言中使用go-mcp库来开发一个查询IP信息的MCP... 目录前言mcp-ip-geo 服务器目录结构说明查询 IP 信息功能实现工具实现工具管理查询单个 IP 信息工具的实现服

usb接口驱动异常问题常用解决方案

《usb接口驱动异常问题常用解决方案》当遇到USB接口驱动异常时,可以通过多种方法来解决,其中主要就包括重装USB控制器、禁用USB选择性暂停设置、更新或安装新的主板驱动等... usb接口驱动异常怎么办,USB接口驱动异常是常见问题,通常由驱动损坏、系统更新冲突、硬件故障或电源管理设置导致。以下是常用解决

Linux命令之firewalld的用法

《Linux命令之firewalld的用法》:本文主要介绍Linux命令之firewalld的用法,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux命令之firewalld1、程序包2、启动firewalld3、配置文件4、firewalld规则定义的九大

Linux之计划任务和调度命令at/cron详解

《Linux之计划任务和调度命令at/cron详解》:本文主要介绍Linux之计划任务和调度命令at/cron的使用,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux计划任务和调度命令at/cron一、计划任务二、命令{at}介绍三、命令语法及功能 :at

Linux下如何使用C++获取硬件信息

《Linux下如何使用C++获取硬件信息》这篇文章主要为大家详细介绍了如何使用C++实现获取CPU,主板,磁盘,BIOS信息等硬件信息,文中的示例代码讲解详细,感兴趣的小伙伴可以了解下... 目录方法获取CPU信息:读取"/proc/cpuinfo"文件获取磁盘信息:读取"/proc/diskstats"文

Linux内核参数配置与验证详细指南

《Linux内核参数配置与验证详细指南》在Linux系统运维和性能优化中,内核参数(sysctl)的配置至关重要,本文主要来聊聊如何配置与验证这些Linux内核参数,希望对大家有一定的帮助... 目录1. 引言2. 内核参数的作用3. 如何设置内核参数3.1 临时设置(重启失效)3.2 永久设置(重启仍生效

kali linux 无法登录root的问题及解决方法

《kalilinux无法登录root的问题及解决方法》:本文主要介绍kalilinux无法登录root的问题及解决方法,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,... 目录kali linux 无法登录root1、问题描述1.1、本地登录root1.2、ssh远程登录root2、