smartmontools SVN Rev 5645
Utility to control and monitor storage systems with "S.M.A.R.T."
Classes | Namespaces | Macros | Enumerations | Functions | Variables
nvmecmds.h File Reference
#include "static_assert.h"
#include <errno.h>
#include <stddef.h>
#include <stdint.h>
Include dependency graph for nvmecmds.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  smartmontools::nvme_error_log_page
 
struct  smartmontools::nvme_id_power_state
 
struct  smartmontools::nvme_id_ctrl
 
struct  smartmontools::nvme_lbaf
 
struct  smartmontools::nvme_id_ns
 
struct  smartmontools::nvme_smart_log
 
struct  smartmontools::nvme_self_test_result
 
struct  smartmontools::nvme_self_test_log
 

Namespaces

namespace  smartmontools
 

Macros

#define NVMECMDS_H_CVSID   "$Id: nvmecmds.h 5630 2024-10-23 17:15:56Z chrfranke $"
 

Enumerations

enum  smartmontools::nvme_admin_opcode { smartmontools::nvme_admin_get_log_page = 0x02 , smartmontools::nvme_admin_identify = 0x06 , smartmontools::nvme_admin_dev_self_test = 0x14 }
 

Functions

 smartmontools::STATIC_ASSERT (sizeof(nvme_error_log_page)==64)
 
 smartmontools::STATIC_ASSERT (sizeof(nvme_id_power_state)==32)
 
 smartmontools::STATIC_ASSERT (sizeof(nvme_id_ctrl)==4096)
 
 smartmontools::STATIC_ASSERT (sizeof(nvme_lbaf)==4)
 
 smartmontools::STATIC_ASSERT (sizeof(nvme_id_ns)==4096)
 
 smartmontools::STATIC_ASSERT (sizeof(nvme_smart_log)==512)
 
 smartmontools::STATIC_ASSERT (sizeof(nvme_self_test_result)==28)
 
 smartmontools::STATIC_ASSERT (sizeof(nvme_self_test_log)==564)
 
bool nvme_read_id_ctrl (nvme_device *device, smartmontools::nvme_id_ctrl &id_ctrl)
 
bool nvme_read_id_ns (nvme_device *device, unsigned nsid, smartmontools::nvme_id_ns &id_ns)
 
unsigned nvme_read_log_page (nvme_device *device, unsigned nsid, unsigned char lid, void *data, unsigned size, bool lpo_sup, unsigned offset=0)
 
unsigned nvme_read_error_log (nvme_device *device, smartmontools::nvme_error_log_page *error_log, unsigned num_entries, bool lpo_sup)
 
bool nvme_read_smart_log (nvme_device *device, uint32_t nsid, smartmontools::nvme_smart_log &smart_log)
 
bool nvme_read_self_test_log (nvme_device *device, uint32_t nsid, smartmontools::nvme_self_test_log &self_test_log)
 
bool nvme_self_test (nvme_device *device, uint8_t stc, uint32_t nsid)
 
constexpr bool nvme_status_is_error (uint16_t status)
 
int nvme_status_to_errno (uint16_t status)
 
const char * nvme_status_to_str (uint16_t status)
 
const char * nvme_status_to_info_str (char *buf, size_t bufsize, uint16_t status)
 
template<size_t SIZE>
const char * nvme_status_to_info_str (char(&buf)[SIZE], unsigned status)
 

Variables

constexpr uint32_t nvme_broadcast_nsid = 0xffffffffU
 
unsigned char nvme_debugmode
 

Macro Definition Documentation

◆ NVMECMDS_H_CVSID

#define NVMECMDS_H_CVSID   "$Id: nvmecmds.h 5630 2024-10-23 17:15:56Z chrfranke $"

Definition at line 17 of file nvmecmds.h.

Function Documentation

◆ nvme_read_error_log()

unsigned nvme_read_error_log ( nvme_device device,
smartmontools::nvme_error_log_page error_log,
unsigned  num_entries,
bool  lpo_sup 
)

Definition at line 231 of file nvmecmds.cpp.

◆ nvme_read_id_ctrl()

bool nvme_read_id_ctrl ( nvme_device device,
smartmontools::nvme_id_ctrl id_ctrl 
)

Definition at line 132 of file nvmecmds.cpp.

◆ nvme_read_id_ns()

bool nvme_read_id_ns ( nvme_device device,
unsigned  nsid,
smartmontools::nvme_id_ns id_ns 
)

Definition at line 169 of file nvmecmds.cpp.

◆ nvme_read_log_page()

unsigned nvme_read_log_page ( nvme_device device,
unsigned  nsid,
unsigned char  lid,
void *  data,
unsigned  size,
bool  lpo_sup,
unsigned  offset = 0 
)

Definition at line 208 of file nvmecmds.cpp.

◆ nvme_read_self_test_log()

bool nvme_read_self_test_log ( nvme_device device,
uint32_t  nsid,
smartmontools::nvme_self_test_log self_test_log 
)

Definition at line 270 of file nvmecmds.cpp.

◆ nvme_read_smart_log()

bool nvme_read_smart_log ( nvme_device device,
uint32_t  nsid,
smartmontools::nvme_smart_log smart_log 
)

Definition at line 254 of file nvmecmds.cpp.

◆ nvme_self_test()

bool nvme_self_test ( nvme_device device,
uint8_t  stc,
uint32_t  nsid 
)

Definition at line 285 of file nvmecmds.cpp.

◆ nvme_status_is_error()

constexpr bool nvme_status_is_error ( uint16_t  status)
constexpr

Definition at line 288 of file nvmecmds.h.

◆ nvme_status_to_errno()

int nvme_status_to_errno ( uint16_t  status)

Definition at line 472 of file nvmecmds.cpp.

◆ nvme_status_to_info_str() [1/2]

const char * nvme_status_to_info_str ( char *  buf,
size_t  bufsize,
uint16_t  status 
)

Definition at line 490 of file nvmecmds.cpp.

◆ nvme_status_to_info_str() [2/2]

template<size_t SIZE>
const char * nvme_status_to_info_str ( char(&)  buf[SIZE],
unsigned  status 
)
inline

Definition at line 302 of file nvmecmds.h.

◆ nvme_status_to_str()

const char * nvme_status_to_str ( uint16_t  status)

Definition at line 483 of file nvmecmds.cpp.

Variable Documentation

◆ nvme_broadcast_nsid

constexpr uint32_t nvme_broadcast_nsid = 0xffffffffU
constexpr

Definition at line 257 of file nvmecmds.h.

◆ nvme_debugmode

unsigned char nvme_debugmode
extern

Definition at line 27 of file nvmecmds.cpp.