From e95f0bb75654ab508522d9a28bc24e0998019491 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Fri, 18 May 2018 09:49:10 -0700 Subject: [PATCH] nbd/rpc: make get_nbd_disks nbd_device param optional Change-Id: Ie56d5908af306eec75a360a7ce6078ba93bb2f4f Signed-off-by: Daniel Verkamp Reviewed-on: https://review.gerrithub.io/411746 Tested-by: SPDK Automated Test System Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- lib/nbd/nbd_rpc.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/nbd/nbd_rpc.c b/lib/nbd/nbd_rpc.c index 7c344fb91..ab2953638 100644 --- a/lib/nbd/nbd_rpc.c +++ b/lib/nbd/nbd_rpc.c @@ -245,7 +245,7 @@ free_rpc_get_nbd_disks(struct rpc_get_nbd_disks *r) } static const struct spdk_json_object_decoder rpc_get_nbd_disks_decoders[] = { - {"nbd_device", offsetof(struct rpc_get_nbd_disks, nbd_device), spdk_json_decode_string}, + {"nbd_device", offsetof(struct rpc_get_nbd_disks, nbd_device), spdk_json_decode_string, true}, }; static void @@ -262,12 +262,9 @@ spdk_rpc_get_nbd_disks(struct spdk_jsonrpc_request *request, &req)) { SPDK_ERRLOG("spdk_json_decode_object failed\n"); goto invalid; - } else { - if (req.nbd_device == NULL) { - SPDK_ERRLOG("missing nbd_device param\n"); - goto invalid; - } + } + if (req.nbd_device) { nbd = spdk_nbd_disk_find_by_nbd_path(req.nbd_device); if (nbd == NULL) { SPDK_ERRLOG("nbd device '%s' does not exist\n", req.nbd_device);