nvme-vendor: fix c99 declarations in vendor plugins
PATCH 1/1 nvme-vendor: fix c99 declarations in vendor plugins
We can't use c99 declarations with older compilers.
Signed-off-by Simon Schricker <sschricker at suse.de>
--- plugins/micron/micron-nvme.c | 3 ++- plugins/toshiba/toshiba-nvme.c | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-)
plugins/micron/micron-nvme.c +2 -1
@@ -40,6 +40,7 @@ static int micron_selective_download(int argc, char **argv, struct command *cmd,void *fw_buf;int fd, selectNo,fw_fd,fw_size,err,offset =0 ;struct stat sb; +int i;struct config {char *fw;
@@ -68,7 +69,7 @@ static int micron_selective_download(int argc, char **argv, struct command *cmd, goto out; } -for (int i=0 ;i<3 ;i++) +for (i=0 ;i<3 ;i++) { cfg.select[i] =toupper (cfg.select[i]); }
plugins/toshiba/toshiba-nvme.c +6 -3
@@ -192,10 +192,11 @@ static int d_raw_to_fd(const unsigned char *buf, unsigned len, int fd)static void progress_runner (float progress) {const size_t barWidth =70 ; +size_t i;fprintf (stdout,"[" );size_t pos = barWidth * progress; -for (size_t i =0 ; i < barWidth; ++i) { +for (i =0 ; i < barWidth; ++i) {if (i <= pos) {fprintf (stdout,"=" ); }else {
@@ -216,6 +217,8 @@ static int nvme_get_internal_log(int fd, const char* const filename, bool curren// By trial and error it seems that the largest transfer chunk size // is 128 * 32 = 4k sectors = 2MB const __u32 max_pages =128 ; +size_t i; +unsigned j; err =nvme_sct_command_transfer_log (fd, current);if (err) {fprintf (stderr,"%s: SCT command transfer failed\n" , __func__);
@@ -267,7 +270,7 @@ static int nvme_get_internal_log(int fd, const char* const filename, bool curren } }// Now read the rest -for (size_t i =1 ; i < pages;) { +for (i =1 ; i < pages;) {__u32 pages_chunk = max_pages;if (pages_chunk + i >= pages) { pages_chunk = pages - i;
@@ -280,7 +283,7 @@ static int nvme_get_internal_log(int fd, const char* const filename, bool curren progress = (float ) (i) / (float ) (pages);progress_runner (progress);if (filename ==NULL ) { -for (unsigned j =0 ; j < pages_chunk; ++j) { +for (j =0 ; j < pages_chunk; ++j) {fprintf (stdout,"Page: %zu of %zu\n" , i + j, pages);d (page_data + (j * page_data_len), page_data_len,16 ,1 ); }
Signature · 1 line
2.22.0
PATCH 1/1 nvme-vendor: fix c99 declarations in vendor plugins
Quoted 8 lines · Simon Schricker
We can't use c99 declarations with older compilers.
Signed-off-by Simon Schricker <sschricker at suse.de>--- plugins/micron/micron-nvme.c | 3 ++- plugins/toshiba/toshiba-nvme.c | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-)One should be doing a whitespace cleanup on those, but otherwise:
Reviewed-by Hannes Reinecke <hare at suse.com>
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking hare at suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg GF: Felix Imend?rffer, Mary Higgins, Sri Rasiah HRB 21284 (AG N?rnberg)
PATCH 1/1 nvme-vendor: fix c99 declarations in vendor plugins
In reply to Simon SchrickerReviewed-by Minwoo Im <minwoo.im.dev at gmail.com>
PATCH 1/1 nvme-vendor: fix c99 declarations in vendor plugins
In reply to Simon SchrickerQuoted 1 line · Simon Schricker
We can't use c99 declarations with older compilers.
It is very easy to introduce C99 declarations. Should -std=... be added to the compiler flags such that no new C99 declarations get introduced?
Thanks,
Bart.