if (err) {
if (errno == EBUSY) {
fprintf(stderr, "Failed to open %s.\n",
- basename(argv[optind]));
- fprintf(stderr,
- "Namespace is currently busy.\n");
+ basename(argv[optind]));
+ fprintf(stderr, "Namespace is currently busy.\n");
if (!cfg.force)
fprintf(stderr,
- "Use the force [--force] option to ignore that.\n");
+ "Use the force [--force] option to ignore that.\n");
} else {
argconfig_print_help(desc, opts);
}
if ((cfg.bs & (~cfg.bs + 1)) != cfg.bs) {
fprintf(stderr,
"Invalid value for block size (%"PRIu64"), must be a power of two\n",
- (uint64_t) cfg.bs);
+ (uint64_t) cfg.bs);
err = -EINVAL;
goto close_dev;
}
if (cfg.namespace_id != NVME_NSID_ALL) {
err = nvme_cli_identify_ns(dev, cfg.namespace_id, &ns);
if (err) {
- if (err < 0)
+ if (err < 0) {
fprintf(stderr, "identify-namespace: %s\n", nvme_strerror(errno));
- else {
+ } else {
fprintf(stderr, "identify failed\n");
nvme_show_status(err);
}
err = -EINVAL;
goto close_dev;
}
- } else if (cfg.lbaf == 0xff)
+ } else if (cfg.lbaf == 0xff) {
cfg.lbaf = prev_lbaf;
+ }
} else {
- if (cfg.lbaf == 0xff) cfg.lbaf = 0;
+ if (cfg.lbaf == 0xff)
+ cfg.lbaf = 0;
}
/* ses & pi checks set to 7 for forward-compatibility */
dev->name, cfg.namespace_id,
cfg.namespace_id == NVME_NSID_ALL ? "(ALL namespaces)" : "");
nvme_show_relatives(dev->name);
- fprintf(stderr, "WARNING: Format may irrevocably delete this device's data.\n"
+ fprintf(stderr,
+ "WARNING: Format may irrevocably delete this device's data.\n"
"You have 10 seconds to press Ctrl-C to cancel this operation.\n\n"
"Use the force [--force] option to suppress this warning.\n");
sleep(10);
.result = NULL,
};
err = nvme_cli_format_nvm(dev, &args);
- if (err < 0)
+ if (err < 0) {
fprintf(stderr, "format: %s\n", nvme_strerror(errno));
- else if (err != 0)
+ } else if (err != 0) {
nvme_show_status(err);
- else {
+ } else {
printf("Success formatting namespace:%x\n", cfg.namespace_id);
- if (dev->type == NVME_DEV_DIRECT && cfg.lbaf != prev_lbaf){
+ if (dev->type == NVME_DEV_DIRECT && cfg.lbaf != prev_lbaf) {
if (is_chardev(dev)) {
if (ioctl(dev_fd(dev), NVME_IOCTL_RESCAN) < 0) {
fprintf(stderr, "failed to rescan namespaces\n");
*/
if (ioctl(dev_fd(dev), BLKBSZSET, &block_size) < 0) {
fprintf(stderr, "failed to set block size to %d\n",
- block_size);
+ block_size);
err = -errno;
goto close_dev;
}