1. Fundamentals of file operations across file systems
In this way, we will be able to explain why the files can be manipulated across files and systems in Linux. For example, copy a file from a VFAT-formatted disk a.txt to a EXT3-formatted disk named B.txt. This includes two procedures for reading the a.txt and writing to the B.txt. Before reading and writing operations, you need to open the file first. As the previous analysis shows, when you open a file, the VFS will know the file system format of the file, and the VFS will invoke its corresponding actual file system operation method later when the file is manipulated. Therefore, the VFS calls Vfat's Read file method to read the A.txt data into memory, after the a.txt in-memory data is mapped to the b.txt corresponding memory space, the VFS call ext3 Write file method b.txt to disk, thus achieving the final cross-file system replication operations.
1-1. The realization of all documents "is fundamental
Whether it is an ordinary file, or a special directory, equipment, etc., VFS will treat them equally as files, through the same set of file interface to manipulate them. When you open a file, the VFS will know the file system format of the file, and when the VFS passes control to the actual file system, the actual file system makes a specific distinction and performs different operations on different file types. This is the essence of "everything is a document".
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/9B/2C/wKioL1lfFMiiTWheAAC4tAyO6ms640.png "title=" Vfs.png "alt=" Wkiol1lffmiitwheaac4tayo6ms640.png "/>
This article is from the "UVN2015" blog, make sure to keep this source http://10851095.blog.51cto.com/10841095/1945261
Linux Knowledge Summary (ii)