ploop check dd.xml: lock dd

Operation "ploop check DiskDescriptor.xml" should lock ddxml
for a duration of the check, otherwise races are possible,
resulting in broken top delta, such as one with incorrect size,
broken GPT etc. One such case is shown in OpenVZ bug #3074.

As dd.xml locking is internal to the library, add a function check_dd()
that does the locking, and use it from the ploop tool.

There's probably no need for check_dd() to be included into the library
API, so let's keep it internal but mark with PL_EXT for tools to use.

Reference: PSBM-28961
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Maxim Patlasov <mpatlasov@parallels.com>
ploop check dd.xml: skip check if ploop is used

Check should not be done if this set of images is in use by some
ploop device. So, add a call to ploop_get_devs() and return an error
if it finds that the device is in use.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Maxim Patlasov <mpatlasov@parallels.com>