[CRIU] [PATCH 2/6] crit: add --format hex option

Christopher Covington cov at codeaurora.org
Tue Aug 11 10:32:35 PDT 2015


On 01/19/2015 09:10 AM, Ruslan Kuprieiev wrote:
> Pavel reported that decimal values for some fields are hard to read,
> because people used to see hex values in there. Unfortunately, json
> doesn't support hex representation of integers, so we can only store
> them as hex strings. Not all field need to be represented as hex
> strings, so this set introduces a custom field option called "criu"
> to use in our proto files. One should use [(criu).hex = true] to mark
> which field should be represented as a hex string. pb2dict module
> from pycriu package will look into field options and if he finds that
> criu.hex is set to True, it will convert such field to/from hex string.
> Though, such behaviour is optional and user can request it by specifying
>  --format hex when calling crit decode("crit encode" in its turn, detects
> such fields automatically and doesn't require any special cmdline options
> to be set).
> 
> We need our proto files to compile with both protoc and
> protoc-c compilers, which requires creating google/protobuf
> directory with a symlink to /usr/include/google/protobuf/
> descriptor.proto to make protoc-c and generated c files happy.

This is not a nice presumption, that the user has a distribution package of
protobuf installed at that path, and if they do, that it's the version they
want criu/crit to be built against/use.

Can you please elaborate on why you think this is necessary? We'll probably be
cooking up a patch to change this.

> diff --git a/protobuf/google/protobuf/descriptor.proto b/protobuf/google/protobuf/descriptor.proto
> new file mode 120000
> index 0000000..07a4c9a
> --- /dev/null
> +++ b/protobuf/google/protobuf/descriptor.proto
> @@ -0,0 +1 @@
> +/usr/include/google/protobuf/descriptor.proto
> \ No newline at end of file
> diff --git a/pycriu/images/Makefile b/pycriu/images/Makefile
> index 6aa115e..579b6fa 100644
> --- a/pycriu/images/Makefile
> +++ b/pycriu/images/Makefile
> @@ -10,7 +10,7 @@ proto-py-modules := $(foreach m,$(proto),$(subst -,_,$(notdir $(m:.proto=_pb2)))
>  # Unfortunately, we can't drop ugly _pb2 suffixes here, because
>  # some _pb2 files depend on others _pb2 files.
>  protobuf:
> -	$(Q) protoc -I=$(SRC_DIR)/protobuf --python_out=./ $(proto)
> +	$(Q) protoc -I=$(SRC_DIR)/protobuf -I=/usr/include/ --python_out=./ $(proto)
>  
>  magic.py: $(SRC_DIR)/scripts/magic-gen.py $(SRC_DIR)/include/magic.h
>  	$(E) "  GEN  " $@

Thanks,
Christopher Covington

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


More information about the CRIU mailing list