Commit 858f1509 authored by Pavel Emelyanov's avatar Pavel Emelyanov

file: Find descs by ID only (v2)

Actually all file-s we dump have unique IDs, regardless of
their types. This fact will be used to reduce complexity
of the SCM code -- instead of keeping TYPE:ID pair it'll
save only the ID.

Siad that -- we will need the way to lookup desc by ID only.

v2: Older images had fifo-s and tty-s having matching IDs
    with respective reg-file entries
Reviewed-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 05abfa5d
...@@ -89,7 +89,15 @@ struct file_desc *find_file_desc_raw(int type, u32 id) ...@@ -89,7 +89,15 @@ struct file_desc *find_file_desc_raw(int type, u32 id)
chain = &file_desc_hash[id % FDESC_HASH_SIZE]; chain = &file_desc_hash[id % FDESC_HASH_SIZE];
hlist_for_each_entry(d, chain, hash) hlist_for_each_entry(d, chain, hash)
if (d->ops->type == type && d->id == id) if ((d->id == id) &&
(d->ops->type == type || type == FD_TYPES__UND))
/*
* Warning -- old CRIU might generate matching IDs
* for different file types! So any code that uses
* FD_TYPES__UND for fdesc search MUST make sure it's
* dealing with the merged files images where all
* descs are forced to have different IDs.
*/
return d; return d;
return NULL; return NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment