Difference between revisions of "Dumping files"

From CRIU
Jump to navigation Jump to search
(Created page with "This is what CRIU does to dump information about opened files. == Files, descriptors and inodes in Linux == When a task opens a file Linux kernel constructs a chain of 3 (we...")
(No difference)

Revision as of 11:32, 1 December 2014

This is what CRIU does to dump information about opened files.

Files, descriptors and inodes in Linux

When a task opens a file Linux kernel constructs a chain of 3 (well, 3.5) object to serve this.

Inode
This is an object which describes file as a couple of meta-data (owner, type, size) and data (the bytes themselves).
Dentry (directory entry)
A helper object that kernel uses to resolve file path into Inode object. If a file has hard-links, then one Inode will have several Dentries.
File
This one describes how a tasks works with an opened Dentry-Inode pair.
File descriptor
It's a number in task's table, that is used to reference the needed File object

So after open() (or some other, see below) system call there will be this chain in the memory

+------+
+ Task +-----+
+------+     |
             v
           +------------------------------+
           | File Descriptors Table (FDT) |
           +------------------------------+
           |   |   | 2 |      ...     |   |
           +------------------------------+
                     |
                     |
                     |      +------+    +--------+    +-------+
                     +----->| File |--->| Dentry |--->| Inode |
                            +------+    +--------+    +-------+