69 lines
1.7 KiB
C
69 lines
1.7 KiB
C
|
/* @(#)inquiry.c 1.158 09/07/10 Copyright 1995-2009 J. Schilling */
|
||
|
#include <schily/mconfig.h>
|
||
|
#ifndef lint
|
||
|
static UConst char sccsid[] =
|
||
|
"@(#)inquiry.c 1.158 09/07/10 Copyright 1995-2009 J. Schilling";
|
||
|
#endif
|
||
|
/*
|
||
|
* SCSI command functions for inquiry
|
||
|
*
|
||
|
* Copyright (c) 1995-2009 J. Schilling
|
||
|
*/
|
||
|
/*
|
||
|
* The contents of this file are subject to the terms of the
|
||
|
* Common Development and Distribution License, Version 1.0 only
|
||
|
* (the "License"). You may not use this file except in compliance
|
||
|
* with the License.
|
||
|
*
|
||
|
* See the file CDDL.Schily.txt in this distribution for details.
|
||
|
*
|
||
|
* When distributing Covered Code, include this CDDL HEADER in each
|
||
|
* file and include the License file CDDL.Schily.txt from this distribution.
|
||
|
*/
|
||
|
|
||
|
#include <schily/stdio.h>
|
||
|
#include <schily/standard.h>
|
||
|
|
||
|
#include <schily/utypes.h>
|
||
|
#include <schily/btorder.h>
|
||
|
#include <schily/intcvt.h>
|
||
|
#include <schily/schily.h>
|
||
|
|
||
|
#include <scg/scgcmd.h>
|
||
|
#include <scg/scsidefs.h>
|
||
|
#include <scg/scsireg.h>
|
||
|
#include <scg/scsitransp.h>
|
||
|
|
||
|
#include "libscgcmd.h"
|
||
|
|
||
|
EXPORT int inquiry __PR((SCSI *scgp, caddr_t, int));
|
||
|
|
||
|
|
||
|
EXPORT int
|
||
|
inquiry(scgp, bp, cnt)
|
||
|
SCSI *scgp;
|
||
|
caddr_t bp;
|
||
|
int cnt;
|
||
|
{
|
||
|
register struct scg_cmd *scmd = scgp->scmd;
|
||
|
|
||
|
fillbytes(bp, cnt, '\0');
|
||
|
fillbytes((caddr_t)scmd, sizeof (*scmd), '\0');
|
||
|
scmd->addr = bp;
|
||
|
scmd->size = cnt;
|
||
|
scmd->flags = SCG_RECV_DATA|SCG_DISRE_ENA;
|
||
|
scmd->cdb_len = SC_G0_CDBLEN;
|
||
|
scmd->sense_len = CCS_SENSE_LEN;
|
||
|
scmd->cdb.g0_cdb.cmd = SC_INQUIRY;
|
||
|
scmd->cdb.g0_cdb.lun = scg_lun(scgp);
|
||
|
scmd->cdb.g0_cdb.count = cnt;
|
||
|
|
||
|
scgp->cmdname = "inquiry";
|
||
|
|
||
|
if (scg_cmd(scgp) < 0)
|
||
|
return (-1);
|
||
|
if (scgp->verbose)
|
||
|
scg_prbytes("Inquiry Data :", (Uchar *)bp, cnt - scg_getresid(scgp));
|
||
|
return (0);
|
||
|
}
|