Deleted Added
sdiff udiff text old ( 107178 ) new ( 109161 )
full compact
1/*
2 * SCSI Disk Emulator
3 *
4 * Copyright (c) 2002 Nate Lawson.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 11 unchanged lines hidden (view full) ---

20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD: head/share/examples/scsi_target/scsi_target.c 107178 2002-11-22 22:55:51Z njl $
29 */
30
31#include <sys/types.h>
32#include <errno.h>
33#include <err.h>
34#include <fcntl.h>
35#include <signal.h>
36#include <stddef.h>
37#include <stdio.h>
38#include <stdlib.h>
39#include <string.h>
40#include <sysexits.h>
41#include <unistd.h>
42#include <aio.h>
43#include <sys/stat.h>
44#include <sys/queue.h>
45#include <sys/event.h>
46#include <sys/param.h>
47#include <cam/cam_queue.h>
48#include <cam/scsi/scsi_all.h>
49#include <cam/scsi/scsi_targetio.h>
50#include <cam/scsi/scsi_message.h>

--- 149 unchanged lines hidden (view full) ---

200 err(1, "fstat file");
201 volume_size = st.st_size / sector_size;
202 } else {
203 volume_size = user_size / sector_size;
204 }
205 if (volume_size <= 0)
206 errx(1, "volume must be larger than %d", sector_size);
207
208 /* Go through all the control devices and find one that isn't busy. */
209 unit = 0;
210 do {
211 snprintf(targname, sizeof(targname), "/dev/targ%d", unit++);
212 targ_fd = open(targname, O_RDWR);
213 } while (targ_fd < 0 && errno == EBUSY);
214
215 if (targ_fd < 0)

--- 689 unchanged lines hidden ---