]> xenbits.xensource.com Git - libvirt.git/commit
util: Export remoteDeserializeTypedParameters internally via util
authorErik Skultety <eskultet@redhat.com>
Thu, 28 Jan 2016 16:27:42 +0000 (17:27 +0100)
committerErik Skultety <eskultet@redhat.com>
Wed, 3 Feb 2016 14:46:45 +0000 (15:46 +0100)
commit0472cef68538a155b18609bc0352467540cd24e0
tree550ed3a94c27541668d53cb6e0bb047f1fcb25e6
parent41a459947f58c302ff5cbad824fa1737fb3ec374
util: Export remoteDeserializeTypedParameters internally via util

Currently, the deserializer is hardcoded into remote_driver which makes
it impossible for admin to use it. One way to achieve a shared implementation
(besides moving the code to another module) would be pass @ret_params_val as a
void pointer as opposed to the remote_typed_param pointer and add a new extra
argument specifying which of those two protocols is being used and typecast
the pointer at the function entry. An example from remote_protocol:

struct remote_typed_param_value {
        int type;
        union {
                int i;
                u_int ui;
                int64_t l;
                uint64_t ul;
                double d;
                int b;
                remote_nonnull_string s;
        } remote_typed_param_value_u;
};
typedef struct remote_typed_param_value remote_typed_param_value;

struct remote_typed_param {
        remote_nonnull_string field;
        remote_typed_param_value value;
};

That would leave us with a bunch of if-then-elses that needed to be used across
the method. This patch takes the other approach using the new datatype
introduced in one of earlier commits.
daemon/remote.c
src/libvirt_private.syms
src/remote/remote_driver.c
src/rpc/gendispatch.pl
src/util/virtypedparam.c
src/util/virtypedparam.h