[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH 10/15] gluster: Drop assumptions on SocketTransp
From: |
Niels de Vos |
Subject: |
Re: [Qemu-block] [PATCH 10/15] gluster: Drop assumptions on SocketTransport names |
Date: |
Thu, 2 Mar 2017 22:40:35 -0800 |
User-agent: |
Mutt/1.7.1 (2016-10-04) |
On Thu, Mar 02, 2017 at 10:44:01PM +0100, Markus Armbruster wrote:
> qemu_gluster_glfs_init() passes the names of QAPI enumeration type
> SocketTransport to glfs_set_volfile_server(). Works, because they
> were chosen to match. But the coupling is artificial. Use the
> appropriate literal strings instead.
>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> block/gluster.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/block/gluster.c b/block/gluster.c
> index 56b4abe..7236d59 100644
> --- a/block/gluster.c
> +++ b/block/gluster.c
> @@ -412,8 +412,7 @@ static struct glfs
> *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf,
>
> for (server = gconf->server; server; server = server->next) {
> if (server->value->type == GLUSTER_TRANSPORT_UNIX) {
> - ret = glfs_set_volfile_server(glfs,
> -
> GlusterTransport_lookup[server->value->type],
> + ret = glfs_set_volfile_server(glfs, "unix",
> server->value->u.q_unix.path, 0);
> } else {
> if (parse_uint_full(server->value->u.tcp.port, &port, 10) < 0 ||
> @@ -423,8 +422,7 @@ static struct glfs
> *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf,
> errno = EINVAL;
> goto out;
> }
> - ret = glfs_set_volfile_server(glfs,
> -
> GlusterTransport_lookup[server->value->type],
> + ret = glfs_set_volfile_server(glfs, "tcp",
> server->value->u.tcp.host,
> (int)port);
> }
> --
> 2.7.4
Instead of the strings for "unix" and "tcp", I would have liked
#define's. Unfortunately it seems that these are not available in public
headers :-/
If this is easier to understand, I don't have any objections.
Reviewed-by: Niels de Vos <address@hidden>
- Re: [Qemu-block] [PATCH 05/15] sheepdog: Fix snapshot ID parsing in _open(), _create, _goto(), (continued)
- [Qemu-block] [PATCH 07/15] sheepdog: Report errors in pseudo-filename more usefully, Markus Armbruster, 2017/03/02
- [Qemu-block] [PATCH 11/15] gluster: Don't duplicate qapi-util.c's qapi_enum_parse(), Markus Armbruster, 2017/03/02
- [Qemu-block] [PATCH 10/15] gluster: Drop assumptions on SocketTransport names, Markus Armbruster, 2017/03/02
- Re: [Qemu-block] [PATCH 10/15] gluster: Drop assumptions on SocketTransport names,
Niels de Vos <=
- [Qemu-block] [PATCH 01/15] sheepdog: Defuse time bomb in sd_open() error handling, Markus Armbruster, 2017/03/02
- [Qemu-block] [PATCH 08/15] sheepdog: Use SocketAddress and socket_connect(), Markus Armbruster, 2017/03/02
- [Qemu-block] [PATCH 14/15] qapi-schema: Rename SocketAddressFlat's variant tcp to inet, Markus Armbruster, 2017/03/02