This Code sends read SMART Log command and interpret the data thus returned.
STEPS to send the read SMART Log command in NVMe in LINUX: (it’s easy! we just have to send an admin command – Get Log Page)
-
Open the device file in O_RDWR mode.
-
Get 512 bytes allocated to receive and store the SMART data.
-
Prepare the “nvme_admin_cmd” structure. This structure is defined in nvme drivers libraries.
-
Call the IOCTL function to send and register the admin command.
-
Interpret the returned raw data.
The code is self explanatory
Link to my BLOG for more details: https://wisesciencewise.wordpress.com/2017/05/22/c-program-to-read-and-interpret-smart-log-of-an-nvme-drive/