sg_io_linux.h (sdparm-1.11.tgz) | : | sg_io_linux.h (sdparm-1.12.tgz) | ||
---|---|---|---|---|
#ifndef SG_IO_LINUX_H | #ifndef SG_IO_LINUX_H | |||
#define SG_IO_LINUX_H | #define SG_IO_LINUX_H | |||
/* | /* | |||
* Copyright (c) 2004-2018 Douglas Gilbert. | * Copyright (c) 2004-2020 Douglas Gilbert. | |||
* All rights reserved. | * All rights reserved. | |||
* Use of this source code is governed by a BSD-style | * Use of this source code is governed by a BSD-style | |||
* license that can be found in the BSD_LICENSE file. | * license that can be found in the BSD_LICENSE file. | |||
* | * | |||
* SPDX-License-Identifier: BSD-2-Clause | * SPDX-License-Identifier: BSD-2-Clause | |||
*/ | */ | |||
/* | /* | |||
* Version 1.07 [20181211] | * Version 1.08 [20201102] | |||
*/ | */ | |||
/* | /* | |||
* This header file contains Linux specific information related to the SCSI | * This header file contains Linux specific information related to the SCSI | |||
* command pass through in the SCSI generic (sg) driver and the Linux | * command pass through in the SCSI generic (sg) driver and the Linux | |||
* block layer. | * block layer. | |||
*/ | */ | |||
#include "sg_lib.h" | #include "sg_lib.h" | |||
#include "sg_linux_inc.h" | #include "sg_linux_inc.h" | |||
skipping to change at line 147 | skipping to change at line 147 | |||
#define SG_LIB_SUGGEST_SENSE SUGGEST_SENSE | #define SG_LIB_SUGGEST_SENSE SUGGEST_SENSE | |||
#define SG_LIB_SUGGEST_IS_OK SUGGEST_IS_OK | #define SG_LIB_SUGGEST_IS_OK SUGGEST_IS_OK | |||
#define SG_LIB_DRIVER_MASK DRIVER_MASK | #define SG_LIB_DRIVER_MASK DRIVER_MASK | |||
#define SG_LIB_SUGGEST_MASK SUGGEST_MASK | #define SG_LIB_SUGGEST_MASK SUGGEST_MASK | |||
void sg_print_masked_status(int masked_status); | void sg_print_masked_status(int masked_status); | |||
void sg_print_host_status(int host_status); | void sg_print_host_status(int host_status); | |||
void sg_print_driver_status(int driver_status); | void sg_print_driver_status(int driver_status); | |||
/* sg_chk_n_print() returns 1 quietly if there are no errors/warnings | /* sg_chk_n_print() returns 1 quietly if there are no errors/warnings | |||
else it prints errors/warnings (prefixed by 'leadin') to | * else it prints errors/warnings (prefixed by 'leadin') to | |||
'sg_warnings_fd' and returns 0. raw_sinfo indicates whether the | * 'sg_warnings_fd' and returns 0. raw_sinfo indicates whether the | |||
raw sense buffer (in ASCII hex) should be printed. */ | * raw sense buffer (in ASCII hex) should be printed. */ | |||
int sg_chk_n_print(const char * leadin, int masked_status, int host_status, | int sg_chk_n_print(const char * leadin, int masked_status, int host_status, | |||
int driver_status, const uint8_t * sense_buffer, | int driver_status, const uint8_t * sense_buffer, | |||
int sb_len, bool raw_sinfo); | int sb_len, bool raw_sinfo); | |||
/* The following function declaration is for the sg version 3 driver. */ | /* The following function declaration is for the sg version 3 driver. */ | |||
struct sg_io_hdr; | struct sg_io_hdr; | |||
/* sg_chk_n_print3() returns 1 quietly if there are no errors/warnings; | /* sg_chk_n_print3() returns 1 quietly if there are no errors/warnings; | |||
else it prints errors/warnings (prefixed by 'leadin') to | * else it prints errors/warnings (prefixed by 'leadin') to | |||
'sg_warnings_fd' and returns 0. */ | * 'sg_warnings_fd' and returns 0. For sg_io_v4 interface use | |||
* sg_linux_sense_print() instead. */ | ||||
int sg_chk_n_print3(const char * leadin, struct sg_io_hdr * hp, | int sg_chk_n_print3(const char * leadin, struct sg_io_hdr * hp, | |||
bool raw_sinfo); | bool raw_sinfo); | |||
/* Returns 1 if no errors found and thus nothing printed; otherwise | /* Returns 1 if no errors found and thus nothing printed; otherwise | |||
* prints error/warning (prefix by 'leadin') to stderr (pr2ws) and | * prints error/warning (prefix by 'leadin') to stderr (pr2ws) and | |||
* returns 0. */ | * returns 0. */ | |||
int sg_linux_sense_print(const char * leadin, int scsi_status, | int sg_linux_sense_print(const char * leadin, int scsi_status, | |||
int host_status, int driver_status, | int host_status, int driver_status, | |||
const uint8_t * sense_buffer, int sb_len, | const uint8_t * sense_buffer, int sb_len, | |||
bool raw_sinfo); | bool raw_sinfo); | |||
/* Calls sg_scsi_normalize_sense() after obtaining the sense buffer and | /* Calls sg_scsi_normalize_sense() after obtaining the sense buffer and | |||
its length from the struct sg_io_hdr pointer. If these cannot be | * its length from the struct sg_io_hdr pointer. If these cannot be | |||
obtained, false is returned. */ | * obtained, false is returned. For sg_io_v4 interface use | |||
* sg_scsi_normalize_sense() function instead [see sg_lib.h]. */ | ||||
bool sg_normalize_sense(const struct sg_io_hdr * hp, | bool sg_normalize_sense(const struct sg_io_hdr * hp, | |||
struct sg_scsi_sense_hdr * sshp); | struct sg_scsi_sense_hdr * sshp); | |||
/* Returns SG_LIB_CAT_* value. */ | ||||
int sg_err_category(int masked_status, int host_status, int driver_status, | int sg_err_category(int masked_status, int host_status, int driver_status, | |||
const uint8_t * sense_buffer, int sb_len); | const uint8_t * sense_buffer, int sb_len); | |||
/* Returns SG_LIB_CAT_* value. */ | ||||
int sg_err_category_new(int scsi_status, int host_status, int driver_status, | int sg_err_category_new(int scsi_status, int host_status, int driver_status, | |||
const uint8_t * sense_buffer, int sb_len); | const uint8_t * sense_buffer, int sb_len); | |||
/* The following function declaration is for the sg version 3 driver. */ | /* The following function declaration is for the sg version 3 driver. for | |||
* sg_io_v4 interface use sg_err_category_new() function instead */ | ||||
int sg_err_category3(struct sg_io_hdr * hp); | int sg_err_category3(struct sg_io_hdr * hp); | |||
/* Note about SCSI status codes found in older versions of Linux. | /* Note about SCSI status codes found in older versions of Linux. | |||
Linux has traditionally used a 1 bit right shifted and masked | * Linux has traditionally used a 1 bit right shifted and masked | |||
version of SCSI standard status codes. Now CHECK_CONDITION | * version of SCSI standard status codes. Now CHECK_CONDITION | |||
and friends (in <scsi/scsi.h>) are deprecated. */ | * and friends (in <scsi/scsi.h>) are deprecated. */ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 10 change blocks. | ||||
13 lines changed or deleted | 19 lines changed or added |