mnt: Fix mountinfo collecting issues

1. Mountinfo should be collected after we have forked into new namespace (strictly
   speaking this is so)
2. When restoring a mnt ns we can reuse the collected mntinfos rather than reading
   them again.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
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>
sigact: Don't write sa_entry from parasite code

Pull the array of rt_sigact_t-s to the crtools instead and fill+write sa_entries there.
This is required to switch to protobuf, since we cannot use pb lib code in parasite for
encoding sa_entries.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
itimers: Don't write itimer_entry from parasite

Same as with previous patch -- we have to pull image-independent entry out of the victim
task to be able to use protobuf library for encoding.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
protobuf: Convert sa_entry to PB format

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
protobuf: Convert itimer_entry to PB format

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
protobuf: Convert mm_entry to PB format

Because the MmEntry has a "repeated" field, we
copy aux vector explicitly and reserve space for
it in task args.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
protobuf: generic show function introduced

This function can be used for any protobuf message which contains required,
repeated and even nested messages fields.

The functions doesn't support yet:
1) Optional fields (skipped)
2) Fields types: PROTOBUF_C_TYPE_FLOAT, PROTOBUF_C_TYPE_DOUBLE,
PROTOBUF_C_TYPE_BOOL, PROTOBUF_C_TYPE_ENUM, PROTOBUF_C_TYPE_BYTES.
These are show as unknown objects.

IOW, it supports only existent proto files.

Inspired-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
show: Convert simple array showing fns to use pb_show_msg

[merges some Stas' patches]

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
pb: Clean pb callback pointers typedefs

Use more classical version with asterisk in type definition

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
pb: Clean _TYPECHECK name generation

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
pb: Introduce show_plain routine

This one walks the 'plain' image file, i.e. the one with straignt <magi>[<size><entry>]*
format, and prints each message. Saves lots of lines of code.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
pb: Switch sigactions showing to use pb_show_plain

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
protobuf: Convert sk_opts_entry to PB format

This patch prepares the ground for further patches.
sk_opts_entry get converted to PB format but not
yet used anywhere in code. Also a few additional
pb_ helpers are added.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
protobuf: Convert unix_sk_entry to PB engine v3

v2:
 - Use alloc_socket_opts/free_socket_opts helpers
 - Use pb_prep_fown helper
v3:
 - Add missing ui->name = NULL

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
protobuf: Convert inet sockets to PB engine

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
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>
dump: Drop FD_DESC_INVALID redundant assignment

It's assigned by FD_PARMS_INIT already.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
protobuf: Drop old sk_opts_entry structure

We've switched to SkOptsEntry, no need to carry this
obsolete one.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
protobuf: Introduce enum showing function

Try hard to find the symbolic (declared in .proto file) name
for the given value.

Will use enums in fdinfo, thus prepare.

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