mirror of
https://git.proxmox.com/git/mirror_smartmontools-debian
synced 2025-10-04 12:16:43 +00:00
79 lines
2.9 KiB
C
79 lines
2.9 KiB
C
/*
|
|
* scsiata.h
|
|
*
|
|
* Home page of code is: http://smartmontools.sourceforge.net
|
|
*
|
|
* Copyright (C) 2006 Douglas Gilbert <dougg@torque.net>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
* any later version.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* (for example COPYING); if not, write to the Free
|
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
*
|
|
*/
|
|
|
|
|
|
#ifndef SCSIATA_H_
|
|
#define SCSIATA_H_
|
|
|
|
#define SCSIATA_H_CVSID "$Id: scsiata.h,v 1.2 2006/07/01 21:29:31 dpgilbert Exp $\n"
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <errno.h>
|
|
|
|
#include "atacmds.h"
|
|
|
|
#define SAT_ATA_PASSTHROUGH_12LEN 12
|
|
#define SAT_ATA_PASSTHROUGH_16LEN 16
|
|
|
|
extern int sat_command_interface(int device, smart_command_set command,
|
|
int select, char *data);
|
|
|
|
/* Attempt an IDENTIFY DEVICE ATA command via SATL when packet_interface
|
|
is 0 otherwise attempt IDENTIFY PACKET DEVICE. If successful
|
|
return 1, else 0 */
|
|
extern int has_sat_pass_through(int device, int packet_interface);
|
|
|
|
/* This is a slightly stretched SCSI sense "descriptor" format header.
|
|
The addition is to allow the 0x70 and 0x71 response codes. The idea
|
|
is to place the salient data of both "fixed" and "descriptor" sense
|
|
format into one structure to ease application processing.
|
|
The original sense buffer should be kept around for those cases
|
|
in which more information is required (e.g. the LBA of a MEDIUM ERROR). */
|
|
struct sg_scsi_sense_hdr {
|
|
unsigned char response_code; /* permit: 0x0, 0x70, 0x71, 0x72, 0x73 */
|
|
unsigned char sense_key;
|
|
unsigned char asc;
|
|
unsigned char ascq;
|
|
unsigned char byte4;
|
|
unsigned char byte5;
|
|
unsigned char byte6;
|
|
unsigned char additional_length;
|
|
};
|
|
|
|
/* Maps the salient data from a sense buffer which is in either fixed or
|
|
descriptor format into a structure mimicking a descriptor format
|
|
header (i.e. the first 8 bytes of sense descriptor format).
|
|
If zero response code returns 0. Otherwise returns 1 and if 'sshp' is
|
|
non-NULL then zero all fields and then set the appropriate fields in
|
|
that structure. sshp::additional_length is always 0 for response
|
|
codes 0x70 and 0x71 (fixed format). */
|
|
extern int sg_scsi_normalize_sense(const unsigned char * sensep,
|
|
int sense_len,
|
|
struct sg_scsi_sense_hdr * sshp);
|
|
|
|
/* Attempt to find the first SCSI sense data descriptor that matches the
|
|
given 'desc_type'. If found return pointer to start of sense data
|
|
descriptor; otherwise (including fixed format sense data) returns NULL. */
|
|
extern const unsigned char * sg_scsi_sense_desc_find(
|
|
const unsigned char * sensep, int sense_len, int desc_type);
|
|
|
|
#endif
|
|
|