Skip to content
Snippets Groups Projects
Select Git revision
  • dc29c1224e877dc6c8156f40e53042f06a42173f
  • master default
  • trunk
  • RELEASE_6_5_DRIVEDB
  • RELEASE_6_6_DRIVEDB
  • RELEASE_7_0_DRIVEDB
  • RELEASE_7_2_DRIVEDB
  • RELEASE_7_3_DRIVEDB
  • RELEASE_6_0_DRIVEDB
  • RELEASE_6_1_DRIVEDB
  • RELEASE_6_2_DRIVEDB
  • RELEASE_6_3_DRIVEDB
  • RELEASE_6_4_DRIVEDB
  • tags/RELEASE_7_4
  • tags/RELEASE_7_3
  • RELEASE_5_41_DRIVEDB
  • RELEASE_5_42_DRIVEDB
  • RELEASE_5_43_DRIVEDB
  • tags/RELEASE_7_2
  • tags/RELEASE_7_1
  • tags/RELEASE_7_0
  • RELEASE_5_40_DRIVEDB
22 results

scsiata.h

Blame
  • user avatar
    dpgilbert authored
    git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2212 4ea69e1a-61f1-4043-bf83-b5c94c648137
    e71b679f
    History
    scsiata.h 2.89 KiB
    /*
     * 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