Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,21 @@ conf.set(
),
description: 'Does struct tm have a tm_gmtoff field?'
)
conf.set(
'HAVE_STDOUT_TO_SET',
cc.compiles(
'''
#include <stdio.h>
int main(void) {
char *buf;
size_t len;
stdout = open_memstream(&buf, &len);
}
''',
name: 'stdout_to_set'
),
description: 'Is stdout to set a mstream available?'
)

if cc.has_function_attribute('fallthrough')
conf.set('fallthrough', '__attribute__((__fallthrough__))')
Expand Down
18 changes: 12 additions & 6 deletions nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>

#include <linux/fs.h>
Expand Down Expand Up @@ -65,6 +66,7 @@
#include "util/suffix.h"
#include "logging.h"
#include "util/sighdl.h"
#include "util/delay.h"
#include "fabrics.h"
#define CREATE_CMD
#include "nvme-builtin.h"
Expand Down Expand Up @@ -185,6 +187,7 @@ static struct program nvme = {
};

const char *uuid_index = "UUID index";
const char *delay = "iterative delay as SECS [.TENTHS]";

static const char *app_tag = "app tag for end-to-end PI";
static const char *app_tag_mask = "app tag mask for end-to-end PI";
Expand Down Expand Up @@ -370,7 +373,7 @@ static int parse_args(int argc, char *argv[], const char *desc,

log_level = map_log_level(nvme_args.verbose, false);

return 0;
return ret = delay_set_stdout_file(&nvme_args.delay);
}

int parse_and_open(struct nvme_global_ctx **ctx,
Expand Down Expand Up @@ -10367,9 +10370,10 @@ static int show_topology_cmd(int argc, char **argv, struct command *acmd, struct
};

NVME_ARGS(opts,
OPT_FMT("ranking", 'r', &cfg.ranking, ranking));
OPT_FMT("ranking", 'r', &cfg.ranking, ranking),
OPT_DOUBLE("delay", 'd', &nvme_args.delay.time, delay));

err = argconfig_parse(argc, argv, desc, opts);
err = parse_args(argc, argv, desc, opts);
if (err)
return err;

Expand Down Expand Up @@ -11300,9 +11304,11 @@ int main(int argc, char **argv)
if (err)
return err;

err = handle_plugin(argc - 1, &argv[1], nvme.extensions);
if (err == -ENOTTY)
general_help(&builtin, NULL);
do {
err = handle_plugin(argc - 1, &argv[1], nvme.extensions);
if (err == -ENOTTY)
general_help(&builtin, NULL);
} while (!err && delay_handle(&nvme_args.delay));

return err ? 1 : 0;
}
3 changes: 3 additions & 0 deletions nvme.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "util/argconfig.h"
#include "util/cleanup.h"
#include "util/types.h"
#include "util/delay.h"

enum nvme_print_flags {
NORMAL = 0,
Expand Down Expand Up @@ -61,6 +62,7 @@ struct nvme_args {
bool no_retries;
bool no_ioctl_probing;
unsigned int output_format_ver;
struct delay_args delay;
};

#ifdef CONFIG_JSONC
Expand Down Expand Up @@ -120,6 +122,7 @@ static inline DEFINE_CLEANUP_FUNC(
#define _cleanup_nvme_transport_handle_ __cleanup__(cleanup_nvme_transport_handle)

extern const char *uuid_index;
extern const char *delay;
extern struct nvme_args nvme_args;

int validate_output_format(const char *format, nvme_print_flags_t *flags);
Expand Down
Loading