const struct argconfig_commandline_options command_line_options[] = {
{"device-name", 'd', "DEVICE", CFG_STRING, &cfg.devname, required_argument, devname},
{"mediamgr-name", 'm', "MM", CFG_STRING, &cfg.mmtype, required_argument, mmtype},
- {0}
+ {NULL}
};
argconfig_parse(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
const char *desc = "List all devices registered with LightNVM.";
const struct argconfig_commandline_options command_line_options[] = {
- {0}
+ {NULL}
};
argconfig_parse(argc, argv, desc, command_line_options, NULL, 0);
const char *desc = "Show general information and registered target types with LightNVM";
const struct argconfig_commandline_options command_line_options[] = {
- {0}
+ {NULL}
};
argconfig_parse(argc, argv, desc, command_line_options, NULL, 0);
{"force", 'f', "FLAG", CFG_NONE, &cfg.force, no_argument, force},
{"raw-binary", 'b', "FLAG", CFG_NONE, &cfg.raw_binary, no_argument, raw_binary},
{"human-readable", 'H', "FLAG", CFG_NONE, &cfg.human_readable, no_argument, human_readable},
- {0}
+ {NULL}
};
fd = parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
{"target-type", 't', "TARGETTYPE", CFG_STRING, &cfg.tgttype, required_argument, tgttype},
{"lun-begin", 'b', "NUM", CFG_POSITIVE, &cfg.lun_begin, required_argument, lun_begin},
{"lun-end", 'e', "NUM", CFG_POSITIVE, &cfg.lun_end, required_argument, lun_end},
- {0}
+ {NULL}
};
argconfig_parse(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
const struct argconfig_commandline_options command_line_options[] = {
{"target-name", 'n', "TARGET", CFG_STRING, &cfg.tgtname, required_argument, tgtname},
- {0}
+ {NULL}
};
argconfig_parse(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
{"erase-only-marked", 'e', "", CFG_NONE, &cfg.erase_only_marked, no_argument, erase_only_marked},
{"clear-host-side-blks", 's', "", CFG_NONE, &cfg.clear_host_marks, no_argument, host_marks},
{"clear-bb-blks", 'b', "", CFG_NONE, &cfg.clear_bb_marks, no_argument, bb_marks},
- {0}
+ {NULL}
};
argconfig_parse(argc, argv, desc, command_line_options, &cfg,
{"channel-id", 'c', "", CFG_SHORT, &cfg.chid, required_argument, ch},
{"lun-id", 'l', "", CFG_SHORT, &cfg.lunid, required_argument, lun},
{"raw-binary", 'b', "FLAG", CFG_NONE, &cfg.raw_binary, no_argument, raw_binary},
- {0}
+ {NULL}
};
fd = parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
{"plane-id", 'p', "NUM", CFG_SHORT, &cfg.plnid, required_argument, pln},
{"block-id", 'b', "NUM", CFG_SHORT, &cfg.blkid, required_argument, blk},
{"value", 'v', "NUM", CFG_SHORT, &cfg.value, required_argument, value},
- {0}
+ {NULL}
};
fd = parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
return fd;
}
-const char *output_format = "Output format: normal|json|binary";
+static const char *output_format = "Output format: normal|json|binary";
enum {
NORMAL,
{"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id, required_argument, namespace},
{"output-format", 'o', "FMT", CFG_STRING, &cfg.output_format, required_argument, output_format },
{"raw-binary", 'b', "", CFG_NONE, &cfg.raw_binary, no_argument, raw},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
const struct argconfig_commandline_options command_line_options[] = {
{"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id, required_argument, namespace},
{"raw-binary", 'b', "", CFG_NONE, &cfg.raw_binary, no_argument, raw},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
{"log-entries", 'e', "NUM", CFG_POSITIVE, &cfg.log_entries, required_argument, log_entries},
{"raw-binary", 'b', "", CFG_NONE, &cfg.raw_binary, no_argument, raw_binary},
{"output-format", 'o', "FMT", CFG_STRING, &cfg.output_format, required_argument, output_format },
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
const struct argconfig_commandline_options command_line_options[] = {
{"raw-binary", 'b', "", CFG_NONE, &cfg.raw_binary, no_argument, raw_binary},
{"output-format", 'o', "FMT", CFG_STRING, &cfg.output_format, required_argument, output_format },
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
{"log-id", 'i', "NUM", CFG_POSITIVE, &cfg.log_id, required_argument, log_id},
{"log-len", 'l', "NUM", CFG_POSITIVE, &cfg.log_len, required_argument, log_len},
{"raw-binary", 'b', "", CFG_NONE, &cfg.raw_binary, no_argument, raw_binary},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
const struct argconfig_commandline_options command_line_options[] = {
{"cntid", 'c', "NUM", CFG_SHORT, &cfg.cntid, required_argument, controller},
{"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id, required_argument, namespace_id},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
const struct argconfig_commandline_options command_line_options[] = {
{"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id, required_argument, namespace_id},
{"all", 'a', "", CFG_NONE, &cfg.all, no_argument, all},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
const struct argconfig_commandline_options command_line_options[] = {
{"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id, required_argument, namespace_id},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
const struct argconfig_commandline_options command_line_options[] = {
{"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id, required_argument, namespace_id},
{"controllers", 'c', "LIST", CFG_STRING, &cfg.cntlist, required_argument, cont},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
{"flbas", 'f', "NUM", CFG_BYTE, &cfg.flbas, required_argument, flbas},
{"dps", 'd', "NUM", CFG_BYTE, &cfg.dps, required_argument, dps},
{"nmic", 'm', "NUM", CFG_BYTE, &cfg.nmic, required_argument, nmic},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
exit(ENODEV);
}
- membase = mmap(0, getpagesize(), PROT_READ, MAP_SHARED, pci_fd, 0);
+ membase = mmap(NULL, getpagesize(), PROT_READ, MAP_SHARED, pci_fd, 0);
if (membase == MAP_FAILED) {
fprintf(stderr, "%s failed to map\n", base);
exit(ENODEV);
return 0;
}
-static int get_nsid()
+static int get_nsid(void)
{
int nsid = nvme_get_nsid(fd);
{"raw-binary", 'b', "", CFG_NONE, &cfg.raw_binary, no_argument, raw_binary},
{"human-readable", 'H', "", CFG_NONE, &cfg.human_readable, no_argument, human_readable},
{"output-format", 'o', "FMT", CFG_STRING, &cfg.output_format, required_argument, output_format },
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
{"raw-binary", 'b', "FLAG", CFG_NONE, &cfg.raw_binary, no_argument, raw_binary},
{"human-readable", 'H', "FLAG", CFG_NONE, &cfg.human_readable, no_argument, human_readable},
{"output-format", 'o', "FMT", CFG_STRING, &cfg.output_format, required_argument, output_format },
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
{"raw-binary", 'b', "FLAG",CFG_NONE, &cfg.raw_binary, no_argument, raw_binary},
{"cdw11", 'c', "NUM", CFG_POSITIVE, &cfg.cdw11, required_argument, cdw11},
{"human-readable", 'H', "FLAG",CFG_NONE, &cfg.human_readable, no_argument, human_readable},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
{"fw", 'f', "FILE", CFG_STRING, &cfg.fw, required_argument, fw},
{"xfer", 'x', "NUM", CFG_POSITIVE, &cfg.xfer, required_argument, xfer},
{"offset", 'o', "NUM", CFG_POSITIVE, &cfg.offset, required_argument, offset},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
const struct argconfig_commandline_options command_line_options[] = {
{"slot", 's', "NUM", CFG_BYTE, &cfg.slot, required_argument, slot},
{"action", 'a', "NUM", CFG_BYTE, &cfg.action, required_argument, action},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
const struct argconfig_commandline_options command_line_options[] = {
{"human-readable", 'H', "", CFG_NONE, &cfg.human_readable, no_argument, human_readable},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
if (cfg.human_readable) {
printf("cap : ");
print_lo_hi_64((uint32_t *)&bar->cap);
- show_registers_cap(&bar->cap);
+ show_registers_cap((struct nvme_bar_cap *)&bar->cap);
printf("version : %x\n", bar->vs);
show_registers_version(bar->vs);
{"pil", 'p', "NUM", CFG_BYTE, &cfg.pil, required_argument, pil},
{"ms", 'm', "NUM", CFG_BYTE, &cfg.ms, required_argument, ms},
{"reset", 'r', "FLAG", CFG_NONE, &cfg.reset, no_argument, reset},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
{"data-len", 'l', "NUM", CFG_POSITIVE, &cfg.data_len, required_argument, data_len},
{"data", 'd', "FILE", CFG_STRING, &cfg.file, required_argument, data},
{"save", 's', "FLAG", CFG_NONE, &cfg.save, no_argument, save},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
{"secp", 'p', "NUM", CFG_BYTE, &cfg.secp, required_argument, secp},
{"spsp", 's', "NUM", CFG_SHORT, &cfg.spsp, required_argument, spsp},
{"tl", 't', "NUM", CFG_POSITIVE, &cfg.tl, required_argument, tl},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
{"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id, required_argument, namespace_id},
{"start-block", 's', "NUM", CFG_LONG_SUFFIX, &cfg.start_block, required_argument, start_block},
{"block-count", 'c', "NUM", CFG_SHORT, &cfg.block_count, required_argument, block_count},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
{"ref-tag", 'r', "NUM", CFG_POSITIVE, &cfg.ref_tag, required_argument, ref_tag},
{"app-tag-mask", 'm', "NUM", CFG_BYTE, &cfg.app_tag_mask, required_argument, app_tag_mask},
{"app-tag", 'a', "NUM", CFG_POSITIVE, &cfg.app_tag, required_argument, app_tag},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
{"idw", 'w', "FLAG", CFG_NONE, &cfg.idw, no_argument, idw},
{"idr", 'r', "FLAG", CFG_NONE, &cfg.idr, no_argument, idr},
{"cdw11", 'c', "NUM", CFG_POSITIVE, &cfg.cdw11, required_argument, cdw11},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
const struct argconfig_commandline_options command_line_options[] = {
{"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id, required_argument, namespace_id},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
{"rtype", 't', "NUM", CFG_BYTE, &cfg.rtype, required_argument, rtype},
{"racqa", 'a', "NUM", CFG_BYTE, &cfg.racqa, required_argument, racqa},
{"iekey", 'i', "", CFG_NONE, &cfg.iekey, no_argument, iekey},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
{"rrega", 'r', "NUM", CFG_BYTE, &cfg.rrega, required_argument, rrega},
{"cptpl", 'p', "NUM", CFG_BYTE, &cfg.cptpl, required_argument, cptpl},
{"iekey", 'i', "", CFG_NONE, &cfg.iekey, no_argument, iekey},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
{"rtype", 't', "NUM", CFG_BYTE, &cfg.rtype, required_argument, rtype},
{"rrela", 'a', "NUM", CFG_BYTE, &cfg.rrela, required_argument, rrela},
{"iekey", 'i', "NUM", CFG_BYTE, &cfg.iekey, required_argument, iekey},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
{"numd", 'd', "NUM", CFG_POSITIVE, &cfg.numd, required_argument, numd},
{"raw-binary", 'b', "", CFG_NONE, &cfg.raw_binary, no_argument, raw_binary},
{"output-format", 'o', "FMT", CFG_STRING, &cfg.output_format, required_argument, output_format },
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
{"show-command", 'v', "", CFG_NONE, &cfg.show, no_argument, show},
{"dry-run", 'w', "", CFG_NONE, &cfg.dry_run, no_argument, dry},
{"latency", 't', "", CFG_NONE, &cfg.latency, no_argument, latency},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
{"spsp", 's', "NUM", CFG_SHORT, &cfg.spsp, required_argument, spsp},
{"al", 't', "NUM", CFG_POSITIVE, &cfg.al, required_argument, al},
{"raw-binary", 'b', "", CFG_NONE, &cfg.raw_binary, no_argument, raw_binary},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));
{"dry-run", 'd', "", CFG_NONE, &cfg.dry_run, no_argument, dry},
{"read", 'r', "", CFG_NONE, &cfg.read, no_argument, re},
{"write", 'w', "", CFG_NONE, &cfg.write, no_argument, wr},
- {0}
+ {NULL}
};
parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg));