Imported Upstream version 1.1.11
[platform/upstream/cdrkit.git] / libusal / usalsettarget.c
1 /*
2  * This file has been modified for the cdrkit suite.
3  *
4  * The behaviour and appearence of the program code below can differ to a major
5  * extent from the version distributed by the original author(s).
6  *
7  * For details, see Changelog file distributed with the cdrkit package. If you
8  * received this file from another source then ask the distributing person for
9  * a log of modifications.
10  *
11  */
12
13 /* @(#)usalsettarget.c  1.2 04/01/14 Copyright 2000 J. Schilling */
14 /*
15  *      usal Library
16  *      set target SCSI address
17  *
18  *      This is the only place in libusal that is allowed to assign
19  *      values to the usal address structure.
20  *
21  *      Copyright (c) 2000 J. Schilling
22  */
23 /*
24  * This program is free software; you can redistribute it and/or modify
25  * it under the terms of the GNU General Public License version 2
26  * as published by the Free Software Foundation.
27  *
28  * This program is distributed in the hope that it will be useful,
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
31  * GNU General Public License for more details.
32  *
33  * You should have received a copy of the GNU General Public License along with
34  * this program; see the file COPYING.  If not, write to the Free Software
35  * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
36  */
37
38 #include <mconfig.h>
39 #include <standard.h>
40 #include <schily.h>
41
42 #include <usal/scsitransp.h>
43
44 int     usal_settarget(SCSI *usalp, int, int, int);
45
46 int
47 usal_settarget(SCSI *usalp, int busno, int tgt, int tlun)
48 {
49         int fd = -1;
50
51         if (usalp->ops != NULL)
52                 fd = SCGO_FILENO(usalp, busno, tgt, tlun);
53         usalp->fd = fd;
54         usal_scsibus(usalp) = busno;
55         usal_target(usalp)  = tgt;
56         usal_lun(usalp)   = tlun;
57         return (fd);
58 }