mem: Comment page-read, page-xfer and page-pipe

These three are quite complex things, so write general comments about
what they are doing.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
crtools: Tune --help test

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
crtools: Put short options near long options

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
page-xfer: Fix page writing API

Split it into two parts -- writing pagemap and writing
pages. This is required for page-server part, sinc it
cannot provide one big pipe with all the pages at once.
Thus it needs to feed pages in portions.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
page-server: Use new page-xfer API to write pages locally

Page server cannot provide one big pipe with pages. Thus,
before this patch, it wrote pages into image in small pieces.
Now the page-xfer API accepts pagemaps and pages separately,
so we can just use thie API.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
page-server: Make open_page_server_xfer static

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
page-xfer: Sanitize opening page xfer

Make it be explicitly splitted into 2 sub-paths.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
poage-xfer: Cleanup xfer logging

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
test: Rise verbosity of mem-snap test's dump

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
page-read: Factor out PagemapEntry to iovec conversion

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
mem-snap: Add comment about mem_snap_ctx object

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
fd: Comment file_desc_ops

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
kerndat:fix compile err

Update to commit 78b8abe9a53884686d4f70d1376f85108cbfc857
I find a compile err:

kerndat.c: In function 'kerndat_get_dirty_track':
kerndat.c:78:6: error: ignoring return value of 'read', declared with attribute warn_unused_result [-Werror=unused-result]
cc1: all warnings being treated as errors
make[2]: *** [kerndat.o] Error 1
make[1]: *** [built-in.o] Error 2
make[1]: Leaving directory `/home/clb/crtools'
make: *** [all] Error 2

Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
shmem: Add missing \Newline into pr_info

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
page-xfer: close sockets on errror paths

CID 996195 (#1 of 1): Resource leak (RESOURCE_LEAK)
10. leaked_handle: Handle variable ask going out of scope leaks the handle.

CID 996196 (#3 of 3): Resource leak (RESOURCE_LEAK)
10. leaked_handle: Handle variable sk going out of scope leaks the handle.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
show: Show nr_pages in pagemap in decimal

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
cr: Remove --snapshot from help text

It's not complete and is about to change significantly. Better not
show it oficially.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
page-server: Implement holes writing into pagemap

Just add new protocol command and call local_xfer->write_hole on
server side. Also tune the mem-snap test to test memory xfer via
page server.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
restore: add a synchronisation point after restoring credentials

For security reason processes can be resumed only when all
credentials are restored. Otherwise someone can attach to a
process, which are not restored credentials yet and execute
some code.

https://bugzilla.openvz.org/show_bug.cgi?id=2561

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Revert "make: Don't generate tags/cscope for tools/ and test/"

This reverts commit 396a08eb95133ab61eedce6cc3cd960d27f7efeb.

As Andrew requested he needs the symbols to be generated for
all possible sources in the crtools code.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>