Add some helper functions which will be put into use by following patches. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>