File: smartdb.h

package info (click to toggle)
diskscan 0.21-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 1,656 kB
  • sloc: ansic: 11,136; python: 338; xml: 138; sh: 41; makefile: 36
file content (40 lines) | stat: -rw-r--r-- 942 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef LIBSCSICMD_SMARTDB_H
#define LIBSCSICMD_SMARTDB_H

#include <stdint.h>

typedef struct smart_table smart_table_t;
typedef struct smart_attr smart_attr_t;

typedef enum smart_attr_type {
	SMART_ATTR_TYPE_NONE,
	SMART_ATTR_TYPE_POH,
	SMART_ATTR_TYPE_TEMP,
	SMART_ATTR_TYPE_REALLOC,
	SMART_ATTR_TYPE_REALLOC_PENDING,
	SMART_ATTR_TYPE_CRC_ERRORS,
} smart_attr_type_e;

typedef enum smart_attr_raw {
	SMART_ATTR_RAW_HEX48,
	SMART_ATTR_RAW_DEC48,
} smart_attr_raw_e;

struct smart_attr {
	uint8_t id;
	smart_attr_type_e type;
	smart_attr_raw_e raw;
	int offset;
	const char *name;
};

struct smart_table {
	int num_attrs;
	smart_attr_t attrs[30];
};

const smart_table_t *smart_table_for_disk(const char *vendor, const char *model, const char *firmware);
const smart_attr_t *smart_attr_for_id(const smart_table_t *table, uint8_t id);
const smart_attr_t *smart_attr_for_type(const smart_table_t *table, smart_attr_type_e attr_type);

#endif