1 /* @(#)scgsettarget.c 1.4 08/12/22 Copyright 2000 J. Schilling */
2 #include <schily/mconfig.h>
3 #ifndef lint
4 static const char _sccsid[] =
5 "@(#)scgsettarget.c 1.4 08/12/22 Copyright 2000 J. Schilling";
6 #endif
7 /*
8 * scg Library
9 * set target SCSI address
10 *
11 * This is the only place in libscg that is allowed to assign
12 * values to the scg address structure.
13 *
14 * Copyright (c) 2000 J. Schilling
15 */
16 /*
17 * The contents of this file are subject to the terms of the
18 * Common Development and Distribution License, Version 1.0 only
19 * (the "License"). You may not use this file except in compliance
20 * with the License.
21 *
22 * See the file CDDL.Schily.txt in this distribution for details.
23 * A copy of the CDDL is also available via the Internet at
24 * http://www.opensource.org/licenses/cddl1.txt
25 *
26 * The following exceptions apply:
27 * CDDL �3.6 needs to be replaced by: "You may create a Larger Work by
28 * combining Covered Software with other code if all other code is governed by
29 * the terms of a license that is OSI approved (see www.opensource.org) and
30 * you may distribute the Larger Work as a single product. In such a case,
31 * You must make sure the requirements of this License are fulfilled for
32 * the Covered Software."
33 *
34 * When distributing Covered Code, include this CDDL HEADER in each
35 * file and include the License file CDDL.Schily.txt from this distribution.
36 */
37
38 #include <schily/mconfig.h>
39 #include <schily/standard.h>
40 #include <schily/schily.h>
41
42 #include <scg/scsitransp.h>
43
44 EXPORT int scg_settarget __PR((SCSI *scgp, int, int, int));
45
46 EXPORT int
scg_settarget(scgp,busno,tgt,tlun)47 scg_settarget(scgp, busno, tgt, tlun)
48 SCSI *scgp;
49 int busno;
50 int tgt;
51 int tlun;
52 {
53 int fd = -1;
54
55 if (scgp->ops != NULL)
56 fd = SCGO_FILENO(scgp, busno, tgt, tlun);
57 scgp->fd = fd;
58 scg_scsibus(scgp) = busno;
59 scg_target(scgp) = tgt;
60 scg_lun(scgp) = tlun;
61 return (fd);
62 }
63