2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-25 03:18:36 +00:00

39 Commits

Author SHA1 Message Date
Stanislav Kinsbursky
6c9396f9bd protobuf: add generic support for "bytes" field
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-21 16:27:14 +04:00
Stanislav Kinsbursky
768d88f228 protobuf: use pretty output for unix sockets
New custom specificator:

'S': output as string (unprintable characters replaced by dots)

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-21 16:27:07 +04:00
Pavel Emelyanov
712979a475 pb_show: Don't show all unknown fields as boolean
Broken by 92b6d86c.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 20:53:35 +04:00
Pavel Emelyanov
29f6d62a8a pb: Init fsize to make compiler happy
protobuf.c: In function ‘pb_show_msg’:
protobuf.c:384:68: error: ‘fsize’ may be used uninitialized in this function [-Werror=uninitialized]
protobuf.c:247:9: note: ‘fsize’ was declared here

The warning about 'may be uninitialized' is false -- the BUG() is a never-returning function.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:52:21 +04:00
Stanislav Kinsbursky
96b62808ff protobuf: use pretty output for inet sockets
v4:
1) Only address specificator ('A') left

New custom specificators:

'A': output as socket address

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:50:48 +04:00
Stanislav Kinsbursky
3904b402bb protobuf: "pretty" engine
v2:
1) parser updated to properly parse strings like this: "11:%x 1:%d"

Protobuf generic show function now accept a string with pretty specificators.
The string have to look like below (an example):

"0:%d 3:%u"

where numbers with colon specifies field number (the same number as in
proto-file) and "%[a-zA-Z]" specifies output format.
If pretty specificator for specified for a field, then it will be used for
output instead of generic hexidecimal view.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:49:21 +04:00
Stanislav Kinsbursky
50ff74ffa9 protobuf: show field cleanup
Let's pass field structure to show functions. Hope, it makes the mess less
anoying...

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:47:40 +04:00
Stanislav Kinsbursky
ed9cbaf412 protobuf: field showing routine split
Will be usefull later with "pretty" show support.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:47:03 +04:00
Stanislav Kinsbursky
92b6d86c7e protobuf: helper for show function selection introduced
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:46:49 +04:00
Stanislav Kinsbursky
f64633bd7d protobuf: service helper for show routine introduced
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:46:47 +04:00
Stanislav Kinsbursky
3f1b07f5a7 protobuf: move data pointer to field structure
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:45:47 +04:00
Stanislav Kinsbursky
ea5f645463 protobuf: structure for currently showing field introduced
"depth" variable was moved to field structure.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:45:29 +04:00
Stanislav Kinsbursky
248a97c160 protobuf: rename type for show functions
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:45:10 +04:00
Stanislav Kinsbursky
d84dc289a7 protobuf: remove carriage return from unknown object print
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:44:55 +04:00
Stanislav Kinsbursky
691bbdad4b protobuf: change pb_pr_field_t to pointer
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:44:43 +04:00
Pavel Emelyanov
64e161f307 show: Tune protobus showers for .int(32|64)
Use # for both and don't use fixed field width for 32bit one (as they are
most likely just some values, while the 64bit is some address which is better
to be printed with full width).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-10 07:36:20 +04:00
Pavel Emelyanov
6a9e5bbdcc show: Fix optional submessage showing
Wrong pointer was checked against NULL and default value. This resulted
in lost tc part of the core message in show output.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 22:40:18 +04:00
Pavel Emelyanov
242fd55a57 protobuf: Support showing bool datatype
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 18:12:22 +04:00
Pavel Emelyanov
fc7071d05e net: Packet sockets basic support
Support only basic packet socket functionality -- create and bind.
This should be enough to start testing dhclient inside container.
Other stuff (filter, mmaps, fanouts, etc.) will come later.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 16:17:41 +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
47266dd031 pb: Move pb callback types to .c file
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-07 19:25:09 +04:00
Pavel Emelyanov
657a544fb7 pb: Rewrite object showing to use pb-descs
The pb_show things are no longer macros.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-07 19:22:02 +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
9e84bd1083 pb: Introduce pb message types and cr-descriptors
The protobuf-c generate plain routines for entries manipulations, but
we want to have some "generic" way of working with messages. Collect them
all in an array of descriptors (similar to image files descriptions) and
do full typechecking while this.

Such thing will allow to simplfy code later.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-07 19:21:58 +04:00
Kinsbursky Stanislav
33293222ba protobuf: set field size to proper value fro "ENUM" type
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-28 09:10:17 +04:00
Kinsbursky Stanislav
290003e964 protobuf: add payload print support in generic show function
This patch also updates pipe data and sockets queues payload handlers to
output data in "-c" option was passed to crtools.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-28 09:02:38 +04:00
Kinsbursky Stanislav
d0a5f0aea9 protobuf: add show support for images payload
Payload handler can be passed into generic protobuf show function.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-25 18:32:41 +04:00
Kinsbursky Stanislav
5bb1b8428b protobuf: replace rectangular bracket by curly one for nested messages show
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-25 18:28:17 +04:00
Kinsbursky Stanislav
b56bc8c5f9 protobuf: added support for optional fields
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-25 18:28:15 +04:00
Kinsbursky Stanislav
01228a195a protobuf: added nested messages outup shift for vertical output
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-25 18:28:15 +04:00
Kinsbursky Stanislav
705411f4bc protobuf: vertical output support introduced
Will be used for single-entry images.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-25 18:28:14 +04:00
Kinsbursky Stanislav
5809e7d0b3 protobuf: control block for generic show introduced
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-25 18:28:12 +04:00
Stanislav Kinsbursky
92e6a30904 protobuf: simplify plain show logic
__pb_show_msg() is redundant.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-19 14:54:27 +04:00
Pavel Emelyanov
dffd0aa65f 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>
2012-07-19 10:17:40 +04:00
Pavel Emelyanov
d6514dae45 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>
2012-07-18 19:09:51 +04:00
Pavel Emelyanov
a710f61717 pb: Clean pb callback pointers typedefs
Use more classical version with asterisk in type definition

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-18 18:42:35 +04:00
Kinsbursky Stanislav
0456049579 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>
2012-07-19 08:25:03 +04:00
Cyrill Gorcunov
c75b4b70fc protbuf: Add protobuf (PB) image entries read/write helpers v4
To not bloat util.h or image.h the protobuf.h introduced to handle all PB needs.

We represent our PB objects as pairs of records

  | 4 bytes for object packed size
  +---
  | X bytes -- object itself

v3:
 - Use plain read/write calls
 - Use local buffers for small objects

v4:
 - Add pb_pksize helper to calculate object
   size with header

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:00:18 +04:00