Currently, nvme-cli is enabled on all Debian and Ubuntu architectures,
which includes 64 and 32 bits architecture.
Version 0.8 does not compile in any 32 bits architecture, as it shows:
cc -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -g -O2 -fPIE
-fstack-protector-strong -Wformat -Werror=format-security -std=gnu99 -O2
-g -Wall -Werror -DLIBUDEV_EXISTS -DNVME_VERSION='"0.8"' -c intel-nvme.c
intel-nvme.c: In function ‘get_internal_log’:
intel-nvme.c:310:13: error: cast from pointer to integer of different
size [-Werror=pointer-to-int-cast]
cmd.addr = (__u64)(void *)buf;
^
cc1: all warnings being treated as errors
The cmd.addr field is defined as __u64 on all architectures, but a
pointer is not always 64-bit, making this an error. Cast to 'unsigned
long' instead, which is safe on all supported architectures, and let the
compiler take it from there.
Patch created by Steve Langasek <steve.langasek@ubuntu.com>
cmd.cdw10 = 0x400;
cmd.cdw12 = cfg.log;
cmd.data_len = 0x1000;
- cmd.addr = (__u64)(void *)buf;
+ cmd.addr = (unsigned long)(void *)buf;
memset(buf, 0, sizeof(buf));
err = nvme_submit_passthru(fd, NVME_IOCTL_ADMIN_CMD, &cmd);