In the Linux kernel, the corresponding struct inode is obtained based on the file inode number.

Article directory Preface 1. Introduction 2. iget_locked 2.1 Introduction 2.2 Used in the kernel 2.3 LKM demo 3. ext4_iget 3.1 Introduction 3.2 LKM demo Foreword Please refer to the file inode number and struct inode structure: Linux file path, directory entry, inode number association Linux file system struct inode structure analysis 1. Introduction In Linux, […]

The essence of character device driver registration and registration and cancellation steps, and the role of the struct inode/file structure

1. The essence of character device registration and registration and cancellation steps The essence of character device driver registration As long as a certain information exists on the operating system, there must be an object describing this information in the operating system. The character device driver is registered into the kernel, and there must be […]

File system and inode number

File descriptor fd 0 & amp;1 & amp;2 By default, the Linux process will have three default open file descriptors, namely standard input 0, standard output 1, and standard error 2. The physical devices corresponding to 0, 1, and 2 are generally: keyboard, monitor, and monitor, so input and output You can also use the […]

In-depth analysis of file system principles (inode, difference between soft and hard links)

The fourth stage of improvement Time: August 29, 2023 Participants: All members of the class content: In-depth analysis of file system principles Table of Contents 1. Overview of Inode and Block (1) View the inode information of the file: stat (2) Detailed explanation of Atime, Mtime and Ctime: (3) Operation examples: 2. Structure of directory […]

Linux buffer/disk/inode

1. Buffer 1. What is a buffer The essence of the buffer: it is a piece of memory. 2. Why is there a buffer zone Free up buffer process time The existence of the buffer can centrally process data refresh and reduce the number of IOs, thereby achieving the purpose of improving the efficiency of […]

[Linux] Understand the file system! Dynamic and static libraries are produced and used in detail! (buffers, inodes, soft and hard links, dynamic and static libraries)

Hello, everyone, this is bang___bang_, today I will talk about file system knowledge, including buffers, inodes, soft and hard links, dynamic and static libraries. This article aims to share and record knowledge, if necessary, I hope it can be helpful. Directory 1 buffer The meaning of the buffer zone Common buffer flush strategy Buffer position […]

[Linux] inode hard and soft link

Article directory preface 1. File system 1.1 The physical structure of the disk: 1.2 CSH and LBA: 1.3 The basic unit of IO: 1.4 File system structure: 1.5 Understanding inodes: 2. Hard and soft connection 2.1 Number of hard links for directories and files: 2.2 Soft connection: 2.3 Hard link: 2.4 The difference between soft […]

Register three device files for the three LED lights of the development board, one-to-one correspondence. Use the built-in struct inode structure and struct file structure in the kernel for development.

1. Driver code, install the LED light driver and register the device file, complete the mapping of the register address, and control the light on and off #include “head.h” #include “cdev.h” int mycdev_open(struct inode *inode, struct file *file) { //1. Find the device number through struct inode //2. Use the MINOR function to find the […]