[libvirt] creating stream

Vasiliy Tolstov v.tolstov at selfip.ru
Fri Apr 21 16:10:19 UTC 2017


2017-04-21 17:34 GMT+03:00 Michal Privoznik <mprivozn at redhat.com>:
> So the extra "byte" (in fact 4 bytes) are at 0x0084-0x0087. So this is how
> strings are encoded. There are basically two types of strings when it comes
> to XDR. The first one is nonnull_string, which are encoded [length][string].
> With just this it would be impossible to differentiate between NULL and an
> empty string "" as both would be encoded in the same way. Therefore, there
> is remote_string (libvirt terminology) or xdr_pointer (XDR terminology)
> which encodes a pointer as [bool][pointer] where bool is either 00 00 00 00
> meaning the pointer is NULL or something else (e.g. 00 00 00 01) meaning the
> pointer has a non-NULL value. So long story short, what you can see here is:
>
> 00 00 00 01 00 00 00 07 73 65 72 69 61 6c 30
>
> which is the same as (regroup)
>
> [00 00 00 01] [00 00 00 07] [73 65 72 69 61 6c 30]
>
> which means: the following pointer is a non-NULL pointer, and it is a string
> of the length 7 and the string is "serial0".


Ahh sorry. This is bug in xdr2 package, and i merge pr for it and now
works fine =).
Thanks again for help!

-- 
Vasiliy Tolstov,
e-mail: v.tolstov at selfip.ru




More information about the libvir-list mailing list