libsmart.c
/*
 * Create a map based on the page list
 */
Create a map based on the page list
Create a map based on the page list
static void
__smart_map_scsi(smart_h h, smart_buf_t *sb, smart_map_t *sm)
{
	smart_t *s = h;
	smart_page_list_t *pg_list = NULL;
	uint8_t *b = NULL;
	uint32_t p;
	pg_list = s->pg_list;
	b = sb->b;
	sm->count = 0;
	for (p = 0; p < pg_list->pg_count; p++) {
		switch (pg_list->pages[p].id) {
		case PAGE_ID_SCSI_WRITE_ERR:
		case PAGE_ID_SCSI_READ_ERR:
		case PAGE_ID_SCSI_VERIFY_ERR:
		case PAGE_ID_SCSI_NON_MEDIUM_ERR:
			__smart_map_scsi_err_page(sm, b, pg_list->pages[p].bytes);
			break;
		case PAGE_ID_SCSI_LAST_N_ERR:
			__smart_map_scsi_last_err(sm, b, pg_list->pages[p].bytes);
			break;
		case PAGE_ID_SCSI_TEMPERATURE:
			__smart_map_scsi_temp(sm, b, pg_list->pages[p].bytes);
			break;
		case PAGE_ID_SCSI_START_STOP_CYCLE:
			__smart_map_scsi_start_stop(sm, b, pg_list->pages[p].bytes);
			break;
		case PAGE_ID_SCSI_INFO_EXCEPTION:
			__smart_map_scsi_info_exception(sm, b, pg_list->pages[p].bytes);
			break;
		}
		b += pg_list->pages[p].bytes;
	}
}
static void __smart_map_scsi ( smart_h h , smart_buf_t * sb , smart_map_t * sm ) { smart_t * s = h ; smart_page_list_t * pg_list = NULL ; uint8_t * b = NULL ; uint32_t p ; pg_list = s -> pg_list ; b = sb -> b ; sm -> count = 0 ; for ( p = 0 ; p < pg_list -> pg_count ; p ++ ) { switch ( pg_list -> pages [ p ] . id ) { case PAGE_ID_SCSI_WRITE_ERR : case PAGE_ID_SCSI_READ_ERR : case PAGE_ID_SCSI_VERIFY_ERR : case PAGE_ID_SCSI_NON_MEDIUM_ERR : __smart_map_scsi_err_page ( sm , b , pg_list -> pages [ p ] . bytes ) ; break ; case PAGE_ID_SCSI_LAST_N_ERR : __smart_map_scsi_last_err ( sm , b , pg_list -> pages [ p ] . bytes ) ; break ; case PAGE_ID_SCSI_TEMPERATURE : __smart_map_scsi_temp ( sm , b , pg_list -> pages [ p ] . bytes ) ; break ; case PAGE_ID_SCSI_START_STOP_CYCLE : __smart_map_scsi_start_stop ( sm , b , pg_list -> pages [ p ] . bytes ) ; break ; case PAGE_ID_SCSI_INFO_EXCEPTION : __smart_map_scsi_info_exception ( sm , b , pg_list -> pages [ p ] . bytes ) ; break ; } b += pg_list -> pages [ p ] . bytes ; } }
Create a map based on the page list
Create a map based on the page list