2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-28 04:48:16 +00:00

64 Commits

Author SHA1 Message Date
Pavel Emelyanov
51133437c9 fd: Remove per-filetype make_gen_id abstraction
It doesn't makemuch sense in pulling this further. The generic genid generation seems to
be enough for eny file type.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 22:41:29 +04:00
Pavel Emelyanov
9efd12f2c7 code: Remove trailing whitespaces over .c and .h files
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 21:34:35 +04:00
Pavel Emelyanov
b91445701b img: Introduce generic routine for collecting image entries
On restore we typically read an image and put the entries into
some hash/list/whatever to work on them later. It's handy to have
a generic routine for doing so.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 13:16:46 +04:00
Pavel Emelyanov
b1b0a39a58 pb: Rewrite object reading to use pb-descs
The pb_read thing is no longer a macros. This will allow to
factor out objects collecting on restore.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-07 19:22:00 +04:00
Pavel Emelyanov
2398c55e41 pb: Rewrite object writing to use pb-descs
The pb_write thing is no longer a macros.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-07 19:21:59 +04:00
Pavel Emelyanov
9fc1d6bbeb fdinfo: Make fdinfo.type be an enum
This types specifies a strict set of what is hidden behind
the fd. Thus these numbers should be in the description of
the fdinfo message.

Plus protobuf makes shure nothing else will be there.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-19 10:18:37 +04:00
Cyrill Gorcunov
0468355c12 protobuf: Drop fown_t type
We are ready to use FownEntry everywhere,
so drop fown_t type and clean up source code.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-19 09:39:00 +04:00
Cyrill Gorcunov
7861d32de0 protobuf: Convert struct pipe_data_entry to PB engine
Note, at moment we don't use "data" from proto declaration,
it's reserved to implement later (simply because it's easier
to use current code for a while).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 14:50:23 +04:00
Cyrill Gorcunov
baa30914b5 protobuf: Convert pipe_entry to PB engine
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:29:57 +04:00
Cyrill Gorcunov
a1fe3caf04 protobuf: Start switching our image entries to Google's protobuf
A short story -- there were a long conversation on which format should
be used to keep checkpointed data on disk image. We ended up in using
Google's Protocol Buffers (see https://developers.google.com/protocol-buffers/
for detailed description). Thus image entries should be convered to PB.

This patch converts fdinfo_entry to PB "message fdinfo_entry".

Build note: one should have protobuf and protobuf-c installed to be able
to build crtools.

 - http://code.google.com/p/protobuf/
 - http://code.google.com/p/protobuf-c/

Inspired-by: Pavel Emelianov <xemul@parallels.com>
Inspired-by: Kinsbursky Stanislav <skinsbursky@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:10:41 +04:00
Cyrill Gorcunov
6c2807e512 pipes: Use pipe_entry as a reference in pipe_info
Need it for PB transition.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-13 11:56:41 +04:00
Pavel Emelyanov
237ef3c809 pipe: Rework pipe data restore to use vmsplice
This serves two things -- kills annoying data offset management
which makes protobuf switch too ugly. And removes the need to
seek the pipe data image, which in turn is the prerequisity for
streaming migration.

Memory usage is still optimal, since we still use splice on dump
path and on restore stage we F_GIFT pipe buffers to the kernel.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-12 06:57:20 +04:00
Pavel Emelyanov
ab59e7d3a5 pipes: Plug memory leak on pipd data image EOF
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-11 14:44:00 +04:00
Cyrill Gorcunov
906f08133b pipes: Use pde as a reference in pipe_data_rst
Need it for PB transition.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-11 14:41:03 +04:00
Pavel Emelyanov
f965ead8b8 pipe: Shorten array for self link path
To open /proc/self/fd/%d PATH_MAX array is too long :) We can use shorter.
Plus fix the snprintf size argument.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-11 12:57:19 +04:00
Pavel Emelyanov
d271850694 pipe: Add helper for getting pipe_id from fdparms
Just to explicitly state that a pipe ID is its inode number.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-11 11:57:28 +04:00
Pavel Emelyanov
7ea40df4db pipe/fifo: Remove unused members from rst structures
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 08:56:20 +04:00
Pavel Emelyanov
d448a75ec7 pipe/fifo: Fix and cleanup data restore
Make it in two stages.

First -- collect pipe data into hash without checking for pipe/fifo existance.
Next -- when pipe/fifo gets restored walk the hash and search where the pipe data
is.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 08:55:16 +04:00
Pavel Emelyanov
3aa01f649f pipe: Don't intermix pipe and fifo data when dumping
The existing code checks for ID to be already dumped. But pipe and fifo may have the same ID
since they reside on different filesystems.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 08:21:54 +04:00
Pavel Emelyanov
499cc6789b pipe: Remove ID arg from pipe data dump fn
This routine checks for pipe data being dumped based on pipe ID, but the arg in questoin
is the pipe's end ID which makes code reading confusing.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 07:50:39 +04:00
Cyrill Gorcunov
2db18f5e16 files: Use fdinfo_entry * in fdinfo_list_entry structure
We will need to use pointer here (to PB object) anyway
so better to make it in a separate patch for bisectability sake.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-09 15:04:35 +04:00
Pavel Emelyanov
b1919be8bb pipes: Cleanup pipe data collecting code
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-28 13:32:59 +04:00
Cyrill Gorcunov
d16d4baa8d pipes: Make dump_one_pipe_data/restore_pipe_data being non-static
To reuse with fifo data restore.

v2:
 - use image type in functions arguments instead of forcing
   calling side to provide file descriptor

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 17:13:11 +04:00
Pavel Emelyanov
9ca95b5d3a fd: Remove ID from fd_parm
It's only required for making pipe_id, but making it is better to
be done in place and using the st_ino only.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-20 19:24:46 +04:00
Cyrill Gorcunov
2adbbcba89 pipes: Don't forget to init pipe_info::create
Otherwise its value might be taken from heap (it's xmalloc'ed).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:45:18 +04:00
Cyrill Gorcunov
70b65c9a50 pipes: Don't call for restore_fown if open failed
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:33:09 +04:00
Cyrill Gorcunov
6b06c744db pipes: Style tune up for pipe_info members
- align members
 - comment with empty line

No func changes.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:32:14 +04:00
Cyrill Gorcunov
f973fcabb9 pipes: Shrink pipe_should_open_transport to want_transport
It's static function near the file_desc_ops,
no need for a long name.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:30:36 +04:00
Cyrill Gorcunov
61e289f184 pipes: Reorder functions
Checkpoint and restore do use fdtype_ops
and file_desc_ops intensively so reorder
pipes functions, this allow us to make
them static and drop additional declarations.

No func changes.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:30:03 +04:00
Cyrill Gorcunov
f3c93470e1 pipes: Get rid of dangling line in dump_pipe
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:29:24 +04:00
Cyrill Gorcunov
28cd2a7633 pipes: Add missing void into func arguments
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:28:53 +04:00
Cyrill Gorcunov
9981b6a6d3 pipes: Eliminate parasite \t
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:27:37 +04:00
Cyrill Gorcunov
ac52abd83e pipes: Make pipes_with_data being static
There is no need to make it xmalloc'ed, it's
global for all processes dumped.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:27:10 +04:00
Cyrill Gorcunov
e6f6c9f1fb pipes: Make dump_one_pipe to use dump_one_pipe_data
xemul: Why we haven't done this earlier? Because the pe entry contained the
amount of bytes in the pipe and this value had to be calculated before we
wrote this entry into the image. Now the pipe data is stored in another img
file and we can happily split pe dump and pde dump into two calls.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:19:45 +04:00
Cyrill Gorcunov
8c54d8d932 pipes: Add dump_one_pipe_data helpers
Will need it for fifo data dumping. At moment
the helper is pushed out of compilation procedure
for easier review, and will be real used in next
patch.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:19:43 +04:00
Cyrill Gorcunov
6835e2ad98 pipes: Rename PIPE_NONALIG_DATA to PIPE_MAX_NONALIG_SIZE
And make it dep. on PIPE_DEF_BUFFERS, this points to
a limit from kernel side.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 13:33:25 +04:00
Stanislav Kinsbursky
41195598cf parasite: remove excessive header deps from parasite.h and friends
The task is not complete - this is just a part of what have to be done. I.e.
looks like a lot of excessive deps can be fixed.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 12:50:18 +04:00
Cyrill Gorcunov
eb12c976a3 pipes: Add test that pipe data is restored without errors
This eliminates the warning below as well

 | pipes.c: In function ‘open_pipe’:
 | pipes.c:252:6: error: variable ‘ret’ set but not used [-Werror=unused-but-set-variable]

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-25 10:34:28 +04:00
Andrey Vagin
066ec066a0 crtools: remove unused variables (v3)
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-18 19:01:21 +04:00
Andrey Vagin
10b46351d1 log: fix log messages
They looks better in this state

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 16:24:39 +04:00
Pavel Emelyanov
a604c63cdb restore: Move type from file_desc to file_desc_ops
This saves some space on dynamic file_desc and makes file_desc_ops
looks closer to fdinfo_ops used on dump.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 15:41:05 +04:00
Pavel Emelyanov
6a55c1c596 dump: Move per-type dump opts into respective .c files
No functional changes, just a code move.

TODO:

* need to write personal make_gen_id implementations for special
files (device and pos is const for them effectively)
* need to merge dump ops with restore ones (file_desc_ops)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 15:34:55 +04:00
Pavel Emelyanov
fa8a928e9f pipes: Move dumping code to pipes.c
Just a codemove, no real changed.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-03 17:36:00 +04:00
Pavel Emelyanov
3b0a8e7c81 file: Factor out fowners and flags restore
This is common, that opened fd fix its fowner and flags. Make
a cuntion for this. Those that obtain fd with open() don't need
to restore flags though.

A thought -- do we need yet another abstraction between fdinfo and
type-d files?

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-26 15:30:26 +04:00
Konstantin Khlebnikov
bef7092834 Replace printf format "0x%x" with "%#x"
printf() has standard flag for adding "0x" prefix before hexadecimal integer.

MOD='[-+]\?[0-9]*.\?[0-9]*[lL]*'
git grep -l "0x%${MOD}x" | xargs -n1 sed -e "s/0x%\(${MOD}\)x/%#\1x/g" -i

Signed-off-by:    Konstantin Khlebnikov <khlebnikov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-24 15:20:24 +04:00
Pavel Emelyanov
0e57ce29be files: Put fdinfo entry on fdinfo_list_entry
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-18 16:03:14 +04:00
Pavel Emelyanov
04800b6ed1 files: Rename fdinfo_list_entry's list to desc_list
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-18 15:46:04 +04:00
Kinsbursky Stanislav
35eedb5f1f output: add "0x" to hex prints using sed
Command below was executed several times:

sed 's/\(pr_.*[^%,x,X]\)\(\%[0-9,l,L]*x\)/\10x\2/g' -i *.c

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-16 12:33:35 +04:00
Cyrill Gorcunov
2d19a8750e pipes: Set fowners for both pipe ends
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-12 14:31:28 +04:00
Cyrill Gorcunov
6177c92bac pipes: Drop unused find_pipe(int id)
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-12 14:19:06 +04:00