Skip to content

Commit f1224d0

Browse files
committed
fabrics: do not print device name when dumping config
When the user asks for dumping the config, don't print the device name on connect. This can result in invalid JSON output. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 8e360e3 commit f1224d0

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

fabrics.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ static int setup_common_context(struct nvmf_context *fctx,
175175
struct cb_fabrics_data {
176176
struct nvme_fabrics_config *cfg;
177177
nvme_print_flags_t flags;
178+
bool quiet;
178179
char *raw;
179180
char **argv;
180181
FILE *f;
@@ -196,6 +197,9 @@ static void cb_connected(struct nvmf_context *fctx,
196197
{
197198
struct cb_fabrics_data *cfd = user_data;
198199

200+
if (cfd->quiet)
201+
return;
202+
199203
if (cfd->flags == NORMAL) {
200204
printf("device: %s\n", nvme_ctrl_get_name(c));
201205
return;
@@ -659,12 +663,13 @@ int fabrics_connect(const char *desc, int argc, char **argv)
659663
return ret;
660664
}
661665

662-
struct cb_fabrics_data dld = {
666+
struct cb_fabrics_data cfd = {
663667
.flags = flags,
668+
.quiet = dump_config,
664669
.raw = raw,
665670
};
666671
ret = create_common_context(ctx, persistent, &fa,
667-
&cfg, &dld, &fctx);
672+
&cfg, &cfd, &fctx);
668673
if (ret)
669674
return ret;
670675

0 commit comments

Comments
 (0)