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中压缩、网络传输与系统监控工具的使用完整指南

《Linux中压缩、网络传输与系统监控工具的使用完整指南》在Linux系统管理中,压缩与传输工具是数据备份和远程协作的桥梁,而系统监控工具则是保障服务器稳定运行的眼睛,下面小编就来和大家详细介绍一下它... 目录引言一、压缩与解压:数据存储与传输的优化核心1. zip/unzip:通用压缩格式的便捷操作2.

Linux中SSH服务配置的全面指南

《Linux中SSH服务配置的全面指南》作为网络安全工程师,SSH(SecureShell)服务的安全配置是我们日常工作中不可忽视的重要环节,本文将从基础配置到高级安全加固,全面解析SSH服务的各项参... 目录概述基础配置详解端口与监听设置主机密钥配置认证机制强化禁用密码认证禁止root直接登录实现双因素

在Linux终端中统计非二进制文件行数的实现方法

《在Linux终端中统计非二进制文件行数的实现方法》在Linux系统中,有时需要统计非二进制文件(如CSV、TXT文件)的行数,而不希望手动打开文件进行查看,例如,在处理大型日志文件、数据文件时,了解... 目录在linux终端中统计非二进制文件的行数技术背景实现步骤1. 使用wc命令2. 使用grep命令

SpringBoot开发中十大常见陷阱深度解析与避坑指南

《SpringBoot开发中十大常见陷阱深度解析与避坑指南》在SpringBoot的开发过程中,即使是经验丰富的开发者也难免会遇到各种棘手的问题,本文将针对SpringBoot开发中十大常见的“坑... 目录引言一、配置总出错?是不是同时用了.properties和.yml?二、换个位置配置就失效?搞清楚加

Linux如何快速检查服务器的硬件配置和性能指标

《Linux如何快速检查服务器的硬件配置和性能指标》在运维和开发工作中,我们经常需要快速检查Linux服务器的硬件配置和性能指标,本文将以CentOS为例,介绍如何通过命令行快速获取这些关键信息,... 目录引言一、查询CPU核心数编程(几C?)1. 使用 nproc(最简单)2. 使用 lscpu(详细信

linux重启命令有哪些? 7个实用的Linux系统重启命令汇总

《linux重启命令有哪些?7个实用的Linux系统重启命令汇总》Linux系统提供了多种重启命令,常用的包括shutdown-r、reboot、init6等,不同命令适用于不同场景,本文将详细... 在管理和维护 linux 服务器时,完成系统更新、故障排查或日常维护后,重启系统往往是必不可少的步骤。本文

SpringBoot+Redis防止接口重复提交问题

《SpringBoot+Redis防止接口重复提交问题》:本文主要介绍SpringBoot+Redis防止接口重复提交问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不... 目录前言实现思路代码示例测试总结前言在项目的使用使用过程中,经常会出现某些操作在短时间内频繁提交。例

Python中对FFmpeg封装开发库FFmpy详解

《Python中对FFmpeg封装开发库FFmpy详解》:本文主要介绍Python中对FFmpeg封装开发库FFmpy,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐... 目录一、FFmpy简介与安装1.1 FFmpy概述1.2 安装方法二、FFmpy核心类与方法2.1 FF

基于Python开发Windows屏幕控制工具

《基于Python开发Windows屏幕控制工具》在数字化办公时代,屏幕管理已成为提升工作效率和保护眼睛健康的重要环节,本文将分享一个基于Python和PySide6开发的Windows屏幕控制工具,... 目录概述功能亮点界面展示实现步骤详解1. 环境准备2. 亮度控制模块3. 息屏功能实现4. 息屏时间

springboot下载接口限速功能实现

《springboot下载接口限速功能实现》通过Redis统计并发数动态调整每个用户带宽,核心逻辑为每秒读取并发送限定数据量,防止单用户占用过多资源,确保整体下载均衡且高效,本文给大家介绍spring... 目录 一、整体目标 二、涉及的主要类/方法✅ 三、核心流程图解(简化) 四、关键代码详解1️⃣ 设置