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

相关文章

防止Linux rm命令误操作的多场景防护方案与实践

《防止Linuxrm命令误操作的多场景防护方案与实践》在Linux系统中,rm命令是删除文件和目录的高效工具,但一旦误操作,如执行rm-rf/或rm-rf/*,极易导致系统数据灾难,本文针对不同场景... 目录引言理解 rm 命令及误操作风险rm 命令基础常见误操作案例防护方案使用 rm编程 别名及安全删除

Linux下MySQL数据库定时备份脚本与Crontab配置教学

《Linux下MySQL数据库定时备份脚本与Crontab配置教学》在生产环境中,数据库是核心资产之一,定期备份数据库可以有效防止意外数据丢失,本文将分享一份MySQL定时备份脚本,并讲解如何通过cr... 目录备份脚本详解脚本功能说明授权与可执行权限使用 Crontab 定时执行编辑 Crontab添加定

SpringBoot实现不同接口指定上传文件大小的具体步骤

《SpringBoot实现不同接口指定上传文件大小的具体步骤》:本文主要介绍在SpringBoot中通过自定义注解、AOP拦截和配置文件实现不同接口上传文件大小限制的方法,强调需设置全局阈值远大于... 目录一  springboot实现不同接口指定文件大小1.1 思路说明1.2 工程启动说明二 具体实施2

SpringBoot 多环境开发实战(从配置、管理与控制)

《SpringBoot多环境开发实战(从配置、管理与控制)》本文详解SpringBoot多环境配置,涵盖单文件YAML、多文件模式、MavenProfile分组及激活策略,通过优先级控制灵活切换环境... 目录一、多环境开发基础(单文件 YAML 版)(一)配置原理与优势(二)实操示例二、多环境开发多文件版

使用docker搭建嵌入式Linux开发环境

《使用docker搭建嵌入式Linux开发环境》本文主要介绍了使用docker搭建嵌入式Linux开发环境,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面... 目录1、前言2、安装docker3、编写容器管理脚本4、创建容器1、前言在日常开发全志、rk等不同

Ubuntu如何升级Python版本

《Ubuntu如何升级Python版本》Ubuntu22.04Docker中,安装Python3.11后,使用update-alternatives设置为默认版本,最后用python3-V验证... 目China编程录问题描述前提环境解决方法总结问题描述Ubuntu22.04系统自带python3.10,想升级

Python实战之SEO优化自动化工具开发指南

《Python实战之SEO优化自动化工具开发指南》在数字化营销时代,搜索引擎优化(SEO)已成为网站获取流量的重要手段,本文将带您使用Python开发一套完整的SEO自动化工具,需要的可以了解下... 目录前言项目概述技术栈选择核心模块实现1. 关键词研究模块2. 网站技术seo检测模块3. 内容优化分析模

linux系统上安装JDK8全过程

《linux系统上安装JDK8全过程》文章介绍安装JDK的必要性及Linux下JDK8的安装步骤,包括卸载旧版本、下载解压、配置环境变量等,强调开发需JDK,运行可选JRE,现JDK已集成JRE... 目录为什么要安装jdk?1.查看linux系统是否有自带的jdk:2.下载jdk压缩包2.解压3.配置环境

Linux搭建ftp服务器的步骤

《Linux搭建ftp服务器的步骤》本文给大家分享Linux搭建ftp服务器的步骤,本文通过图文并茂的形式给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录ftp搭建1:下载vsftpd工具2:下载客户端工具3:进入配置文件目录vsftpd.conf配置文件4:

Java+AI驱动实现PDF文件数据提取与解析

《Java+AI驱动实现PDF文件数据提取与解析》本文将和大家分享一套基于AI的体检报告智能评估方案,详细介绍从PDF上传、内容提取到AI分析、数据存储的全流程自动化实现方法,感兴趣的可以了解下... 目录一、核心流程:从上传到评估的完整链路二、第一步:解析 PDF,提取体检报告内容1. 引入依赖2. 封装