Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Aug 2000 18:59:17 -0700
From:      Matthew Reimer <mreimer@vpop.net>
To:        freebsd-scsi@freebsd.org
Subject:   Porting an app from old SCSI system to CAM
Message-ID:  <39935DF5.9FBDB44F@vpop.net>

next in thread | raw e-mail | index | archive | help
I'm trying to get DATlib
(ftp://ftp.informatik.uni-erlangen.de/pub/DATlib/) running on FreeBSD
4.1-STABLE. From what I can tell, all I need to do is to reimplement one
subroutine (see below).

How do I do this?

Matt


#ifdef __FreeBSD__    /* doesn't look like generic BSD */
#include <sys/scsiio.h>
int
send_scsi_command(    int scsifd,
                unsigned char *cmd,int cmdlen,
                unsigned char *inbuf,int inbuflen,
                unsigned char *outbuf,int outbuflen,
                unsigned char *rqbuf,int rqbuflen
) {
        scsireq_t       ucmd;
        int             r;

        memset (&ucmd, '\0', sizeof (ucmd));

        ucmd.flags      = 0;
        ucmd.timeout    = 1000;
        memcpy (ucmd.cmd, (caddr_t)cmd, cmdlen);
        ucmd.cmdlen     = cmdlen;

        if (inbuf) {
                ucmd.flags |= SCCMD_READ;
                ucmd.databuf =(caddr_t)inbuf;
                ucmd.datalen = inbuflen;
        } else {
                ucmd.flags |= SCCMD_WRITE;
                ucmd.databuf = (caddr_t)outbuf;
                ucmd.datalen = outbuflen;
        }
        if (rqbuf)
                ucmd.flags|=0; /* FIXME: Huh? Arne? */

        r = ioctl(scsifd,SCIOCCOMMAND,&ucmd);

        if (rqbuf)
                memcpy (rqbuf, ucmd.sense, rqbuflen);
        return r;
} /* send_scsi_command */
#endif


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-scsi" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?39935DF5.9FBDB44F>