Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ./../../../../../../usr/include/fm/libdisklog.h
Real path: /usr/include/fm/libdisklog.h
Zurück
/* * Copyright (c) 2012, 2021, Oracle and/or its affiliates. */ #ifndef _LIBDISKLOG_H #define _LIBDISKLOG_H #ifdef __cplusplus extern "C" { #endif #include <stdio.h> #include <sys/types.h> #include <sys/time.h> #include <sys/nvpair.h> #include <scsi/libscsi.h> #define DL_ROOT "/" #define DL_SD_DRIVER "sd" #define DL_SSD_DRIVER "ssd" #define DL_DEVICES "/devices" #define DL_DEV "/dev" #define DL_DISKWD ":wd,raw" #define DL_DISKS2 ":c,raw" #define DL_FILENAME_SUF ".disklog" #define DL_SEAGATE "SEAGATE" #define DL_HITACHI "HITACHI" #define DL_HGST "HGST" #define DL_WDC "WDC" #define DL_SAMSUNG "SAMSUNG" #define DL_INTEL "INTEL" #define DL_FILEMODE "w" #define DL_DIRMODE 0755 #define DL_MODE ".mode-" #define DL_NO_MODE 0xFF #define DL_ALL_MODES DL_NO_MODE #define DL_INQ_DATALEN 0xff #define DL_PAGELEN 0xff #define DL_DATALEN 0xffff #define DL_HITACHI_LOGDUMP_OFFSET 0 #define DL_HITACHI_LOGDUMP_DATALEN 0x10000 #define DL_HITACHI_LOGDUMP_DATALEN_BLOCK 0x80 #define DL_HITACHI_LOGDUMP_BLOCK_SIZE 0x200 /* 512 bytes */ #define DL_HITACHI_MODE2_LOGDUMP_SIZE 0xA00000 #define DL_HITACHI_LOGDUMP_LOGNAME_SUF ".hitachi.bin" /* HGST will use the hitachi infrastructure. */ #define DL_HGST_LOGDUMP_LOGNAME_SUF ".hgst.bin" /* WDC will use the hitachi infrastructure. */ #define DL_WDC_LOGDUMP_LOGNAME_SUF ".wdc.bin" #define DL_HITACHI_READ_DIR_MODE 0xE0 /* * The transfer length for Seagate drives indicates the number of 512 byte * sectors to transfer in one operation. */ #define DL_SEAGATE_LOGDUMP_FIXED 0xfe #define DL_SEAGATE_LOGDUMP_OFFSET 0 #define DL_SEAGATE_LOGDUMP_OFFSET_INC 0x200 #define DL_SEAGATE_LOGDUMP_XFER_LEN 0x200 #define DL_SEAGATE_LOGDUMP_DATALEN 0x80000 #define DL_SEAGATE_LOGDUMP_LOGNAME_SUF ".seagate.bin" #define DL_SEAGATE_LOGDUMP_SMART_LOGNAME_SUF ".seagate.smart.bin" #define DL_SEAGATE_LOGDUMP_DONE_KEY 0x05 #define DL_SEAGATE_LOGDUMP_DONE_ASC 0x24 /* * Starting with Skybolt drives, Seagate has modified their logdump scheme * necessitating some new values for transferring data. */ #define DL_SEAGATE_LOGDUMP_SECTOR_SIZE 512 /* Sector size in bytes) */ #define DL_SEAGATE_LOGDUMP_XFER_SECTOR_COUNT 128 /* Sectors to transfer */ #define DL_SEAGATE_LOGDUMP_BUFFSIZE \ DL_SEAGATE_LOGDUMP_XFER_SECTOR_COUNT * DL_SEAGATE_LOGDUMP_SECTOR_SIZE #define DL_SEAGATE_SMART_DATA_CHUNK_SIZE 0x80000 /* Size in bytes */ #define DL_SEAGATE_DUMPLOG_TYPE_DEFAULT 0 #define DL_SEAGATE_DUMPLOG_TYPE_UPDATED 1 #define DL_SEAGATE_DUMPLOG_TYPE_SMART 2 #define DL_DEFAULT_SAS_PHY_LOG_DESC_LEN 48 #define DL_BACK_SCAN_PROGRESS_PERCENT(i) (double)(i * 100.0 / 65536.0) #define SPC3_CMD_HITACHI_LOG_DUMP SPC3_CMD_VENDOR_E6 #define SPC3_CMD_SEAGATE_LOG_DUMP SPC3_CMD_VENDOR_F7 #define SPC3_CMD_SEAGATE_SMART_DUMP SPC3_CMD_VENDOR_E6 #define DL_SUCCESS 0 #define DL_FAILURE 1 #define DL_INVALID_PARAM 2 #define DL_DEVID_DECODE_FAIL 3 #define DL_DEVPATH_DECODE_FAIL 4 #define DL_INVALID_DISK_NAME 5 #define DL_DIR_CREATE_ERROR 6 #define DL_FILE_ERROR 7 #define DL_WRITE_ERROR 8 #define DL_DISK_OPEN_ERROR 9 #define DL_LIBSCSI_INIT_ERROR 10 #define DL_LIBSCSI_OPEN_ERROR 11 #define DL_LIBSCSI_ALLOC_ERROR 12 #define DL_LIBSCSI_EXEC_ERROR 13 #define DL_LIBSCSI_ACTION_ERROR 14 #define DL_DIR_OPEN_ERROR 15 #define DL_UNSUPPORTED_VENDOR 16 typedef struct dl_flags { unsigned int aflag : 1; /* All supported page data */ unsigned int bflag : 1; /* Basic inquiry/log/mode data */ unsigned int eflag : 1; /* All supported pages */ unsigned int lflag : 1; /* Log data */ unsigned int mflag : 1; /* Mode data */ unsigned int Aflag : 1; /* All data for all disks */ unsigned int m1_flag : 1; /* Subpage code valid */ unsigned int c_flag : 1; /* CLI output flag */ } dl_flags_t; typedef struct dl_logging_args { char devid[MAXNAMELEN]; char devpath[MAXPATHLEN]; char dir[MAXPATHLEN]; char *uuid; struct dl_flags flags; uchar_t mode; } dl_logging_args_t; typedef enum dl_log_page_code { DL_LOG_PC_BACK_SCAN = 0x15, DL_LOG_PC_SEAGATE_CACHE = 0x37, DL_LOG_PC_SEAGATE_FACTORY = 0x3e } dl_log_page_code_t; typedef enum dl_log_param_code { DL_LOG_PC_ERR_HITACHI_TR = 0x8009, DL_LOG_PC_ERR_HITACHI_POS = 0x8015, DL_LOG_PC_BACK_SCAN_STATUS = 0, DL_LOG_PC_BACK_SCAN_END = 0X800, DL_LOG_PC_SEAGATE_CACHE_BLKSENT = 0x0, DL_LOG_PC_SEAGATE_CACHE_BLKRECV = 0x1, DL_LOG_PC_SEAGATE_CACHE_BLKREAD = 0x2, DL_LOG_PC_SEAGATE_CACHE_SMALLSZ = 0x3, DL_LOG_PC_SEAGATE_CACHE_BIGSZ = 0x4, DL_LOG_PC_SEAGATE_FACTORY_HOURS = 0x0, DL_LOG_PC_SEAGATE_FACTORY_MINUTES = 0x8 } dl_log_param_code_t; typedef enum dl_mode_sub_page_code { DL_MODE_SPC_NONE = 0x0, DL_MODE_SPC_SPECIAL = 0xffff } dl_mode_sub_page_code_t; typedef enum dl_log_params_back_scan_status_code { DL_LPBS_SC_NONE = 0x0, DL_LPBS_SC_MEDIUM = 0x1, DL_LPBS_SC_PRESCAN = 0x2, DL_LPBS_SC_FATAL = 0x3, DL_LPBS_SC_VENDOR_ERR = 0x4, DL_LPBS_SC_NO_PLIST = 0x5, DL_LPBS_SC_VENDOR_CAUSE = 0x6, DL_LPBS_SC_HIGH_TEMP = 0x7, DL_LPBS_SC_INACTIVE = 0x8 } dl_log_params_back_scan_status_code_t; typedef struct dl_log_params_back_scan_status { spc3_log_params_header_t lpbss_prh; uint8_t lpbss_apom[4]; uint8_t _reserved1; uint8_t lpbss_status; uint16_t lpbss_number_of_bsp; uint16_t lpbss_progress; uint16_t lpbss_number_of_bmsp; } dl_log_params_back_scan_status_t; typedef struct dl_log_params_medium_scan { spc3_log_params_header_t lpms_prh; uint8_t lpms_apom[4]; DECL_BITFIELD2( lpms_sense_key :4, lpms_reassign_status :4); uint8_t lpms_asc; uint8_t lpms_ascq; char lpms_vendor[5]; uint8_t lpms_lba[8]; } dl_log_params_medium_scan_t; typedef enum dl_log_protocol_port_id { DL_LOG_PP_ID_SAS = 0x06 } dl_log_protocol_port_id_t; typedef struct dl_log_params_protocol_port_header { spc3_log_params_header_t lppph_prh; DECL_BITFIELD2( lppph_id :4, _reserved1 :4); uint8_t _reserved2; uint8_t lppph_generation_code; uint8_t lppph_number_of_phys; } dl_log_params_protocol_port_header_t; typedef enum dl_log_protocol_dev_type { DL_LOG_PD_TYPE_NONE = 0, DL_LOG_PD_TYPE_END_DEV = 1, DL_LOG_PD_TYPE_EXPANDER = 2, DL_LOG_PD_TYPE_EXPANDER_COMPLIANT = 3 } dl_log_params_protocol_dev_type_t; typedef enum dl_log_protocol_reason { DL_LOG_P_REASON_UNKOWN = 0, DL_LOG_P_REASON_POWERON = 1, DL_LOG_P_REASON_HARDRESET = 2, DL_LOG_P_REASON_SMP = 3, DL_LOG_P_REASON_LOSS_OF_DWORD = 4, DL_LOG_P_REASON_MUX = 5, DL_LOG_P_REASON_IT = 6, DL_LOG_P_REASON_TIMEOUT = 7, DL_LOG_P_REASON_STOP = 8, DL_LOG_P_REASON_EXP = 9 } dl_log_protocol_reason_t; typedef enum dl_log_protocol_link_rate { DL_LOG_PL_RATE_UNKOWN = 0, DL_LOG_PL_RATE_DISABLED = 1, DL_LOG_PL_RATE_PHY_RESET = 2, DL_LOG_PL_RATE_SPINUP_HOLD = 3, DL_LOG_PL_RATE_PORT_SELECTOR = 4, DL_LOG_PL_RATE_RESET = 5, DL_LOG_PL_RATE_UNSUPPORTED_PHY = 6, DL_LOG_PL_RESERVED = 7, DL_LOG_PL_RATE_G1 = 8, DL_LOG_PL_RATE_G2 = 9, DL_LOG_PL_RATE_G3 = 0xa, DL_LOG_PL_RATE_G4 = 0xb } dl_log_protocol_link_rate_t; /* * SAS-2 10.2.8.1 Table 232 SAS phy log descriptor */ typedef struct dl_log_params_protocol_spld_header { uint8_t _reserved1; uint8_t lppsh_phy_id; uint8_t _reserved2; uint8_t lppsh_spld_len; DECL_BITFIELD3( lppsh_attached_reason :4, lppsh_attached_dev_type :3, _reserved3 :1); DECL_BITFIELD2( lppsh_link_rate :4, lppsh_reason :4); DECL_BITFIELD5( _reserved4 :1, lppsh_attached_smpi :1, lppsh_attached_stpi :1, lppsh_attached_sspi :1, _reserved5 :4); DECL_BITFIELD5( _reserved6 :1, lppsh_attached_smpt :1, lppsh_attached_stpt :1, lppsh_attached_sspt :1, _reserved7 :4); uint8_t lppsh_sas_addr[8]; uint8_t lppsh_attached_sas_addr[8]; uint8_t lppsh_attached_phy_id; uint8_t _reserved8[7]; uint32_t lppsh_invalid_dword_cnt; uint32_t lppsh_disparity_err_cnt; uint32_t lppsh_loss_of_dword_sync; uint32_t lppsh_phy_reset_problem; uint8_t _reserved9[2]; uint8_t lppsh_phy_event_descriptor_len; uint8_t lppsh_number_of_phy_event; } dl_log_params_protocol_spld_header_t; typedef enum dl_log_protocol_phy_event_name { DL_LOG_PPEN_NO_EVENT = 0, DL_LOG_PPEN_INVALID_DWORD_CNT = 1, DL_LOG_PPEN_DISPARITY_ERR_CNT = 2, DL_LOG_PPEN_LOSS_OF_DWORD = 3, DL_LOG_PPEN_PHY_RESET_CNT = 4, DL_LOG_PPEN_BUF_OVERFLOW_CNT = 5, DL_LOG_PPEN_RECEIVED_ERR_CNT = 6, DL_LOG_PPEN_ADDR_ERR_CNT = 0x20, DL_LOG_PPEN_TRANSMITTED_ABANDON_CNT = 0x21, DL_LOG_PPEN_RECEIVED_ABANDON_CNT = 0x22, DL_LOG_PPEN_TRANSMITTED_RETRY_CNT = 0x23, DL_LOG_PPEN_RECEIVED_RETRY_CNT = 0x24, DL_LOG_PPEN_RECEIVED_AIP_PART_CNT = 0x25, DL_LOG_PPEN_RECEIVED_AIP_CONN_CNT = 0x26, DL_LOG_PPEN_TRANSMITTED_BREAK_CNT = 0x27, DL_LOG_PPEN_RECEIVED_BREAK_CNT = 0x28, DL_LOG_PPEN_BREAK_TIMEOUT_CNT = 0x29, DL_LOG_PPEN_CONN_CNT = 0x2a, DL_LOG_PPEN_PEAK_BLOCKED_CNT = 0x2b, DL_LOG_PPEN_PEAK_WAIT_TIME = 0x2c, DL_LOG_PPEN_PEAK_ARBI_TIME = 0x2d, DL_LOG_PPEN_PEAK_CONN_TIME = 0x2e, DL_LOG_PPEN_TRANSMITTED_SSP_CNT = 0x40, DL_LOG_PPEN_RECEIVED_SSP_CNT = 0x41, DL_LOG_PPEN_TRANSMITTED_SSP_ERR_CNT = 0x42, DL_LOG_PPEN_RECEIVED_SSP_ERR_CNT = 0x43, DL_LOG_PPEN_TRANSMITTED_CB_CNT = 0x44, DL_LOG_PPEN_RECEIVED_CB_CNT = 0x45, DL_LOG_PPEN_TRANSMITTED_SATA_CNT = 0x50, DL_LOG_PPEN_RECEIVED_SATA_CNT = 0x51, DL_LOG_PPEN_SATA_BUF_CNT = 0x52, DL_LOG_PPEN_TRANSMITTED_SMP_CNT = 0x60, DL_LOG_PPEN_RECEIVED_SMP_CNT = 0x61, DL_LOG_PPEN_RECEIVED_SMP_ERR_CNT = 0x63 } dl_log_protocol_phy_event_name_t; #pragma pack(1) /* * SAS-2 10.4.3.14.4 Table 297 Phy event descriptor */ typedef struct dl_log_params_protocol_ped { uint8_t reserved1[3]; uint8_t lppp_phy_event_source; uint32_t lppp_phy_event; uint32_t lppp_peak_val; } dl_log_params_protocol_ped_t; /* HITACHI Log Dump Command(E6) */ typedef struct dl_hitachi_logdump_cdb { uint8_t hlc_opcode; DECL_BITFIELD2( hlc_block :1, _reserved4 :7); DECL_BITFIELD2( hlc_mode :5, _reserved2 :3); uint8_t hlc_offset[3]; uint8_t hlc_allocation_length[3]; DECL_BITFIELD4( hlc_link :1, hlc_flag :1, _reserved3 :4, hlc_vu :2); } dl_hitachi_logdump_cdb_t; /* HITACHI Log Dump Mode dir Command(E6) */ typedef struct dl_hitachi_modedir_cdb { uint8_t hlc_opcode; DECL_BITFIELD2( hlc_block :1, _reserved4 :7); uint8_t hlc_mode; uint8_t hlc_offset[3]; uint8_t hlc_allocation_length[3]; DECL_BITFIELD4( hlc_link :1, hlc_flag :1, _reserved3 :4, hlc_vu :2); } dl_hitachi_modedir_cdb_t; /* SEAGATE Log Dump Command(F7) */ typedef struct dl_seagate_logdump_cdb { uint8_t slc_opcode; DECL_BITFIELD5( _reserved1 :1, slc_clear :1, slc_dump :1, slc_read :1, _reserved2 :4); uint8_t _reserved3[2]; uint8_t slc_start_offset[2]; uint8_t slc_fixed; uint8_t slc_xfer_length[2]; uint8_t _reserved4; } dl_seagate_logdump_cdb_t; /* SEAGATE Log Dump Command(F7) [UPDATED] */ typedef struct dl_seagate_updated_logdump_cdb { uint8_t sulc_opcode; uint8_t sulc_byte1; uint8_t _reserved1; uint8_t sulc_start_offset[3]; uint8_t sulc_fixed; uint8_t sulc_xfer_length[2]; uint8_t _reserved2; } dl_seagate_updated_logdump_cdb_t; /* SEAGATE smart Dump Command(E6) */ typedef struct dl_seagate_smart_cdb { uint8_t ssc_opcode; uint8_t ssc_hours; DECL_BITFIELD2( _reserved1 :3, ssc_mode :5); uint8_t ssc_offset[3]; uint8_t ssc_xfer_length[3]; uint8_t _reserved2; } dl_seagate_smart_cdb_t; #pragma pack() extern int disklog_print_diskinfo(dl_logging_args_t *); extern void disklog_send_inquiry(libscsi_hdl_t *, libscsi_target_t *, boolean_t, int, FILE *, dl_flags_t); extern void disklog_send_log_sense( libscsi_hdl_t *, libscsi_target_t *, int, FILE *, dl_flags_t); extern void disklog_send_mode_sense(libscsi_hdl_t *, libscsi_target_t *, int, int, FILE *, dl_flags_t); extern int disklog_save_dumplog(dl_logging_args_t *); extern int disklog_open_device(libscsi_hdl_t **, libscsi_target_t **, const char *); extern void disklog_close_device(libscsi_hdl_t *, libscsi_target_t *); extern boolean_t disklog_get_path_diskname(const char *, char *); extern const char *disklog_strerror(int); extern int disklog_clear_logfiles(dl_logging_args_t *); extern void dl_fprintf(FILE *, const char *, ...); extern void dbgprintf(const char *fmt, ...); extern int dl_check_path(char *, mode_t); extern int dl_open_dump_file_subdir(dl_logging_args_t *, char *, int, const char *, const char *, const char *); extern int dl_open_dump_file(dl_logging_args_t *, char *, int, const char *, const char *); extern void dl_record_filestats(nvlist_t *, char *, struct timeval *, struct timeval *, uint64_t); #ifdef __cplusplus } #endif #endif /* _LIBDISKLOG_H */