block device files:a device that represents a file system cache, such as a hard drive Device Files:represents a non-cache device, such as a tape drive, mouse, and system terminal So how do I save a data to a file system? How does it exist? Generally, we think that a file is the data information of a file, it is stored on disk, if the simple understanding is wrong and each file related information will be placed on the index node , for example, it is a character device, that is, the character device file, and its permissions, group, and size, update time and other information belong to the file information, if a file size is 1kb, Then the actual copy of the file, the space required is more than 1KB, because it also copy the index node when we copy files, we also copy the index nodes of the files. not that the file is just a file, it has an index node. There is also a v node , which is in the memory area on the Linux kernel and is different from the index node The file will have an offset pointer, read, write, and so on will operate the pointer, then we do the file operation will make the offset pointer changes, then we will have a V node on the Linux kernel, the file offset pointer on the V node, v node--index node --File both the index node and the file are stored on the disk, and the v node is stored in the memory area of the Linux kernel . v node is only related to file open, the file is closed, the V node is closed, but the index node is not closed, if the file is deleted, the index node is deletedas to how to access the file requires the system call API, we always say API, but many people think of the API is and call C library function, this understanding is wrong, let me tell you what the API is? API (Application Programming Interface, Application programming Interface) can be seen in English as an interface for application programming. API is a function interface implemented by the kernelMMI--Man-machine interfaceGUI is a graphical interface, graphical user interface The application layer can interact with the kernel by invoking the API through an interface, and the kernel interacts with the driver and the hardware . The application and the kernel to interact, we need to call the hardware device, then we need to invoke the API, although the API is also a function, it is actually running on the kernel, is the kernel of a program, if the application layer to operate the hardware, then must go through the kernel, you must call the API The kernel then uses the driver to manipulate the hardwarewe can get directory structure information through OPENDIR () and related functions. the system calls stat () to get the file information from the index node The file's data can be accessed through functions such as open () and read (), which are commonly used for file manipulation functions . Welcome to Exchangeif reproduced please indicate the source
Sina Blog: http://blog.sina.com.cn/u/2049150530
Blog Park: http://www.cnblogs.com/sky-heaven/
Know: Http://www.zhihu.com/people/zhang-bing-hua
How do I save a data to a file system? How does it exist? --"Sky original"