libsmart.c
/**
 * NVMe doesn't define attribute IDs like ATA does, but we can
 * approximate this behavior by treating the byte offset as the
 * attribute ID.
 */
NVMe doesn't define attribute IDs like ATA does, but we can
approximate this behavior by treating the byte offset as the
attribute ID.
NVMe doesn ' t define attribute IDs like ATA does but we can approximate this behavior by treating the byte offset as the attribute ID .
static void
__smart_map_nvme(smart_buf_t *sb, smart_map_t *sm)
{
	uint8_t *b = NULL;
	uint32_t vs = NVME_VS_1_0;	
	uint32_t i, a;
	sm->count = 0;
	b = sb->b;
	for (i = 0, a = 0; i < ARRAYLEN(__smart_nvme_values); i++) {
		if (vs >= __smart_nvme_values[i].ver) {
			sm->attr[a].page = 0x2;
			sm->attr[a].id = __smart_nvme_values[i].off;
			sm->attr[a].description = __smart_nvme_values[i].description;
			sm->attr[a].bytes = __smart_nvme_values[i].bytes;
			sm->attr[a].flags = 0;
			sm->attr[a].raw = b + __smart_nvme_values[i].off;
			sm->attr[a].thresh = NULL;
			a++;
		}
	}
	sm->count = a;
}
static void __smart_map_nvme ( smart_buf_t * sb , smart_map_t * sm ) { uint8_t * b = NULL ; uint32_t vs = NVME_VS_1_0 ; uint32_t i , a ; sm -> count = 0 ; b = sb -> b ; for ( i = 0 , a = 0 ; i < ARRAYLEN ( __smart_nvme_values ) ; i ++ ) { if ( vs >= __smart_nvme_values [ i ] . ver ) { sm -> attr [ a ] . page = 0x2 ; sm -> attr [ a ] . id = __smart_nvme_values [ i ] . off ; sm -> attr [ a ] . description = __smart_nvme_values [ i ] . description ; sm -> attr [ a ] . bytes = __smart_nvme_values [ i ] . bytes ; sm -> attr [ a ] . flags = 0 ; sm -> attr [ a ] . raw = b + __smart_nvme_values [ i ] . off ; sm -> attr [ a ] . thresh = NULL ; a ++ ; } } sm -> count = a ; }
NVMe doesn't define attribute IDs like ATA does, but we can
 approximate this behavior by treating the byte offset as the
 attribute ID.
NVMe doesn ' t define attribute IDs like ATA does but we can approximate this behavior by treating the byte offset as the attribute ID .
// XXX assume device is 1.0