stress-ng  0.13.05
About: stress-ng will stress test a computer system in various selectable ways. It was designed to exercise various physical subsystems of a computer as well as the various operating system kernel interfaces.
  Fossies Dox: stress-ng-0.13.05.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

core-smart.c File Reference
#include "stress-ng.h"
Include dependency graph for core-smart.c:

Go to the source code of this file.

Data Structures

struct  stress_smart_raw_value_t
 
struct  stress_smart_data_t
 
struct  stress_smart_dev_t
 
struct  stress_smart_devs_t
 

Macros

#define DEVS_MAX   (256)
 
#define SENSE_BUF_SZ   (0x20)
 
#define BUF_SZ   (0x200)
 
#define CBD_OPERATION_CODE   (0xa1) /* Operation code */
 
#define CBD_PROTOCOL_DMA   (0x06) /* Protocol DMA */
 
#define CBD_T_LENGTH   (0x02) /* Tx len in SECTOR_COUNT field */
 
#define CBD_BYT_BLOK   (0x01) /* Tx len in byte blocks */
 
#define CBD_T_DIR   (0x01) /* Tx direction, device -> client */
 
#define CBD_CK_COND   (0x00) /* Check condition, disabled */
 
#define CBD_OFF_LINE   (0x00) /* offline time, 0 seconds */
 
#define CBD_FEATURES   (0xd0) /* feature: read smart data */
 
#define CBD_SECTOR_COUNT   (0x01) /* 1 sector to read */
 
#define CBD_LBA_LOW   (0x00) /* LBA: 0:7 N/A */
 
#define CBD_LBA_MID   (0x4f) /* LBA: 23:8 magic: 0xc24f */
 
#define CBD_LBA_HIGH   (0xc2)
 
#define CBD_DEVICE   (0x00) /* all zero */
 
#define CBD_COMMAND   (0xb0) /* command: read smart log */
 
#define CBD_RESVERVED   (0x00) /* N/A */
 
#define CBD_CONTROL   (0x00)
 
#define ATTR_FLAG_WARRANTY   (0x01)
 
#define ATTR_FLAG_OFFLINE   (0x02)
 
#define ATTR_FLAG_PERFORMANCE   (0x04)
 
#define ATTR_FLAG_ERROR_RATE   (0x08)
 
#define ATTR_FLAG_EVENT_COUNT   (0x10)
 
#define ATTR_FLAG_SELF_PRESERV   (0x20)
 

Typedefs

typedef struct stress_smart_dev_t stress_smart_dev_t
 

Functions

static size_t stress_smart_data_diff_count (stress_smart_dev_t *dev)
 
static void stress_smart_data_free (stress_smart_data_t **data)
 
static stress_smart_data_tstress_smart_data_read (const char *path)
 
static void stress_smart_data_diff (stress_smart_dev_t *dev)
 
static void stress_smart_free_devs (void)
 
void stress_smart_start (void)
 
void stress_smart_stop (void)
 

Variables

static stress_smart_devs_t smart_devs
 

Macro Definition Documentation

◆ ATTR_FLAG_ERROR_RATE

#define ATTR_FLAG_ERROR_RATE   (0x08)

Definition at line 50 of file core-smart.c.

◆ ATTR_FLAG_EVENT_COUNT

#define ATTR_FLAG_EVENT_COUNT   (0x10)

Definition at line 51 of file core-smart.c.

◆ ATTR_FLAG_OFFLINE

#define ATTR_FLAG_OFFLINE   (0x02)

Definition at line 48 of file core-smart.c.

◆ ATTR_FLAG_PERFORMANCE

#define ATTR_FLAG_PERFORMANCE   (0x04)

Definition at line 49 of file core-smart.c.

◆ ATTR_FLAG_SELF_PRESERV

#define ATTR_FLAG_SELF_PRESERV   (0x20)

Definition at line 52 of file core-smart.c.

◆ ATTR_FLAG_WARRANTY

#define ATTR_FLAG_WARRANTY   (0x01)

Definition at line 47 of file core-smart.c.

◆ BUF_SZ

#define BUF_SZ   (0x200)

Definition at line 25 of file core-smart.c.

◆ CBD_BYT_BLOK

#define CBD_BYT_BLOK   (0x01) /* Tx len in byte blocks */

Definition at line 33 of file core-smart.c.

◆ CBD_CK_COND

#define CBD_CK_COND   (0x00) /* Check condition, disabled */

Definition at line 35 of file core-smart.c.

◆ CBD_COMMAND

#define CBD_COMMAND   (0xb0) /* command: read smart log */

Definition at line 43 of file core-smart.c.

◆ CBD_CONTROL

#define CBD_CONTROL   (0x00)

Definition at line 45 of file core-smart.c.

◆ CBD_DEVICE

#define CBD_DEVICE   (0x00) /* all zero */

Definition at line 42 of file core-smart.c.

◆ CBD_FEATURES

#define CBD_FEATURES   (0xd0) /* feature: read smart data */

Definition at line 37 of file core-smart.c.

◆ CBD_LBA_HIGH

#define CBD_LBA_HIGH   (0xc2)

Definition at line 41 of file core-smart.c.

◆ CBD_LBA_LOW

#define CBD_LBA_LOW   (0x00) /* LBA: 0:7 N/A */

Definition at line 39 of file core-smart.c.

◆ CBD_LBA_MID

#define CBD_LBA_MID   (0x4f) /* LBA: 23:8 magic: 0xc24f */

Definition at line 40 of file core-smart.c.

◆ CBD_OFF_LINE

#define CBD_OFF_LINE   (0x00) /* offline time, 0 seconds */

Definition at line 36 of file core-smart.c.

◆ CBD_OPERATION_CODE

#define CBD_OPERATION_CODE   (0xa1) /* Operation code */

Definition at line 30 of file core-smart.c.

◆ CBD_PROTOCOL_DMA

#define CBD_PROTOCOL_DMA   (0x06) /* Protocol DMA */

Definition at line 31 of file core-smart.c.

◆ CBD_RESVERVED

#define CBD_RESVERVED   (0x00) /* N/A */

Definition at line 44 of file core-smart.c.

◆ CBD_SECTOR_COUNT

#define CBD_SECTOR_COUNT   (0x01) /* 1 sector to read */

Definition at line 38 of file core-smart.c.

◆ CBD_T_DIR

#define CBD_T_DIR   (0x01) /* Tx direction, device -> client */

Definition at line 34 of file core-smart.c.

◆ CBD_T_LENGTH

#define CBD_T_LENGTH   (0x02) /* Tx len in SECTOR_COUNT field */

Definition at line 32 of file core-smart.c.

◆ DEVS_MAX

#define DEVS_MAX   (256)

Definition at line 22 of file core-smart.c.

◆ SENSE_BUF_SZ

#define SENSE_BUF_SZ   (0x20)

Definition at line 24 of file core-smart.c.

Typedef Documentation

◆ stress_smart_dev_t

Function Documentation

◆ stress_smart_data_diff()

static void stress_smart_data_diff ( stress_smart_dev_t dev)
static

Definition at line 385 of file core-smart.c.

Referenced by stress_smart_stop().

◆ stress_smart_data_diff_count()

static size_t stress_smart_data_diff_count ( stress_smart_dev_t dev)
static

Definition at line 353 of file core-smart.c.

Referenced by stress_smart_stop().

◆ stress_smart_data_free()

static void stress_smart_data_free ( stress_smart_data_t **  data)
static

Definition at line 364 of file core-smart.c.

Referenced by stress_smart_free_devs().

◆ stress_smart_data_read()

static stress_smart_data_t * stress_smart_data_read ( const char *  path)
static

Definition at line 373 of file core-smart.c.

Referenced by stress_smart_stop().

◆ stress_smart_free_devs()

◆ stress_smart_start()

void stress_smart_start ( void  )

Definition at line 498 of file core-smart.c.

References g_opt_flags, OPT_FLAGS_SMART, and pr_inf().

Referenced by main().

◆ stress_smart_stop()

Variable Documentation

◆ smart_devs

stress_smart_devs_t smart_devs
static

Definition at line 82 of file core-smart.c.

Referenced by stress_smart_free_devs(), and stress_smart_stop().