// SPDX-License-Identifier: GPL-2.0-or-later
/*
-* Copyright (c) 2018 NetApp, Inc.
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-*/
+ * Copyright (c) 2018 NetApp, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
#include <stdio.h>
#include <dirent.h>
static const char *dev_path = "/dev/";
struct smdevice_info {
- unsigned nsid;
+ unsigned int nsid;
struct nvme_id_ctrl ctrl;
struct nvme_id_ns ns;
char dev[265];
};
struct ontapdevice_info {
- unsigned nsid;
+ unsigned int nsid;
struct nvme_id_ctrl ctrl;
struct nvme_id_ns ns;
unsigned char uuid[NVME_UUID_LEN];
struct nvme_id_ns *ns)
{
__u8 lba_index;
+
nvme_id_ns_flbas_to_lbaf_inuse(ns->flbas, &lba_index);
*lba = 1ULL << ns->lbaf[lba_index].ds;
double nsze = le64_to_cpu(ns->nsze) * (*lba);
char array_label[ARRAY_LABEL_LEN / 2 + 1];
char volume_label[VOLUME_LABEL_LEN / 2 + 1];
char nguid_str[33];
- char basestr[] = "%s, Array Name %s, Volume Name %s, NSID %d, "
- "Volume ID %s, Controller %c, Access State %s, %s\n";
+ char basestr[] =
+ "%s, Array Name %s, Volume Name %s, NSID %d, Volume ID %s, Controller %c, Access State %s, %s\n";
char columnstr[] = "%-16s %-30s %-30s %4d %32s %c %-12s %9s\n";
char *formatstr = basestr; /* default to "normal" output format */
__u8 lba_index;
"------------------------------", "----",
"--------------------------------", "----",
"------------", "---------");
- }
- else if (format == NJSON) {
+ } else if (format == NJSON) {
/* prepare for json output */
root = json_create_object();
json_devices = json_create_array();
for (i = 0; i < count; i++) {
nvme_id_ns_flbas_to_lbaf_inuse(devices[i].ns.flbas, &lba_index);
- unsigned long long int lba = 1ULL << devices[i].ns.lbaf[lba_index].ds;
+ unsigned long long lba = 1ULL << devices[i].ns.lbaf[lba_index].ds;
double nsze = le64_to_cpu(devices[i].ns.nsze) * lba;
const char *s_suffix = suffix_si_get(&nsze);
char size[128];
err = nvme_get_ontap_c2_log(fd, item->nsid, item->log_data, ONTAP_C2_LOG_SIZE);
if (err) {
fprintf(stderr, "Unable to get log page data for %s (%s)\n",
- dev, err < 0 ? strerror(-err):
+ dev, err < 0 ? strerror(-err) :
nvme_status_to_string(err, false));
return 0;
}
smdevices = calloc(num, sizeof(*smdevices));
if (!smdevices) {
fprintf(stderr, "Unable to allocate memory for devices.\n");
- return ENOMEM;
+ return -ENOMEM;
}
for (i = 0; i < num; i++) {