Deleted Added
full compact
ctl_backend_ramdisk.c (302408) ctl_backend_ramdisk.c (312834)
1/*-
2 * Copyright (c) 2003, 2008 Silicon Graphics International Corp.
3 * Copyright (c) 2012 The FreeBSD Foundation
4 * Copyright (c) 2014-2015 Alexander Motin <mav@FreeBSD.org>
5 * All rights reserved.
6 *
7 * Portions of this software were developed by Edward Tomasz Napierala
8 * under sponsorship from the FreeBSD Foundation.

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

36 */
37/*
38 * CAM Target Layer backend for a "fake" ramdisk.
39 *
40 * Author: Ken Merry <ken@FreeBSD.org>
41 */
42
43#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003, 2008 Silicon Graphics International Corp.
3 * Copyright (c) 2012 The FreeBSD Foundation
4 * Copyright (c) 2014-2015 Alexander Motin <mav@FreeBSD.org>
5 * All rights reserved.
6 *
7 * Portions of this software were developed by Edward Tomasz Napierala
8 * under sponsorship from the FreeBSD Foundation.

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

36 */
37/*
38 * CAM Target Layer backend for a "fake" ramdisk.
39 *
40 * Author: Ken Merry <ken@FreeBSD.org>
41 */
42
43#include <sys/cdefs.h>
44__FBSDID("$FreeBSD: stable/11/sys/cam/ctl/ctl_backend_ramdisk.c 288427 2015-09-30 20:38:35Z mav $");
44__FBSDID("$FreeBSD: stable/11/sys/cam/ctl/ctl_backend_ramdisk.c 312834 2017-01-26 20:49:19Z mav $");
45
46#include <sys/param.h>
47#include <sys/systm.h>
48#include <sys/kernel.h>
49#include <sys/condvar.h>
50#include <sys/types.h>
51#include <sys/lock.h>
52#include <sys/mutex.h>

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

213{
214 struct ctl_be_lun *cbe_lun;
215 struct ctl_be_ramdisk_lun *be_lun;
216#ifdef CTL_TIME_IO
217 struct bintime cur_bt;
218#endif
219
220 CTL_DEBUG_PRINT(("ctl_backend_ramdisk_move_done\n"));
45
46#include <sys/param.h>
47#include <sys/systm.h>
48#include <sys/kernel.h>
49#include <sys/condvar.h>
50#include <sys/types.h>
51#include <sys/lock.h>
52#include <sys/mutex.h>

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

213{
214 struct ctl_be_lun *cbe_lun;
215 struct ctl_be_ramdisk_lun *be_lun;
216#ifdef CTL_TIME_IO
217 struct bintime cur_bt;
218#endif
219
220 CTL_DEBUG_PRINT(("ctl_backend_ramdisk_move_done\n"));
221 cbe_lun = (struct ctl_be_lun *)io->io_hdr.ctl_private[
222 CTL_PRIV_BACKEND_LUN].ptr;
221 cbe_lun = CTL_BACKEND_LUN(io);
223 be_lun = (struct ctl_be_ramdisk_lun *)cbe_lun->be_lun;
224#ifdef CTL_TIME_IO
225 getbinuptime(&cur_bt);
226 bintime_sub(&cur_bt, &io->io_hdr.dma_start_bt);
227 bintime_add(&io->io_hdr.dma_bt, &cur_bt);
228#endif
229 io->io_hdr.num_dmas++;
230 if (io->scsiio.kern_sg_entries > 0)

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

265}
266
267static int
268ctl_backend_ramdisk_submit(union ctl_io *io)
269{
270 struct ctl_be_lun *cbe_lun;
271 struct ctl_lba_len_flags *lbalen;
272
222 be_lun = (struct ctl_be_ramdisk_lun *)cbe_lun->be_lun;
223#ifdef CTL_TIME_IO
224 getbinuptime(&cur_bt);
225 bintime_sub(&cur_bt, &io->io_hdr.dma_start_bt);
226 bintime_add(&io->io_hdr.dma_bt, &cur_bt);
227#endif
228 io->io_hdr.num_dmas++;
229 if (io->scsiio.kern_sg_entries > 0)

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

264}
265
266static int
267ctl_backend_ramdisk_submit(union ctl_io *io)
268{
269 struct ctl_be_lun *cbe_lun;
270 struct ctl_lba_len_flags *lbalen;
271
273 cbe_lun = (struct ctl_be_lun *)io->io_hdr.ctl_private[
274 CTL_PRIV_BACKEND_LUN].ptr;
272 cbe_lun = CTL_BACKEND_LUN(io);
275 lbalen = (struct ctl_lba_len_flags *)&io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN];
276 if (lbalen->flags & CTL_LLF_VERIFY) {
277 ctl_set_success(&io->scsiio);
278 ctl_data_submit_done(io);
279 return (CTL_RETVAL_COMPLETE);
280 }
281 io->io_hdr.ctl_private[CTL_PRIV_BACKEND].integer =
282 lbalen->len * cbe_lun->blocksize;

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

840}
841
842static int
843ctl_backend_ramdisk_config_write(union ctl_io *io)
844{
845 struct ctl_be_lun *cbe_lun;
846 int retval;
847
273 lbalen = (struct ctl_lba_len_flags *)&io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN];
274 if (lbalen->flags & CTL_LLF_VERIFY) {
275 ctl_set_success(&io->scsiio);
276 ctl_data_submit_done(io);
277 return (CTL_RETVAL_COMPLETE);
278 }
279 io->io_hdr.ctl_private[CTL_PRIV_BACKEND].integer =
280 lbalen->len * cbe_lun->blocksize;

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

838}
839
840static int
841ctl_backend_ramdisk_config_write(union ctl_io *io)
842{
843 struct ctl_be_lun *cbe_lun;
844 int retval;
845
848 cbe_lun = (struct ctl_be_lun *)io->io_hdr.ctl_private[
849 CTL_PRIV_BACKEND_LUN].ptr;
846 cbe_lun = CTL_BACKEND_LUN(io);
850 retval = 0;
851 switch (io->scsiio.cdb[0]) {
852 case SYNCHRONIZE_CACHE:
853 case SYNCHRONIZE_CACHE_16:
854 /*
855 * The upper level CTL code will filter out any CDBs with
856 * the immediate bit set and return the proper error. It
857 * will also not allow a sync cache command to go to a LUN

--- 84 unchanged lines hidden ---
847 retval = 0;
848 switch (io->scsiio.cdb[0]) {
849 case SYNCHRONIZE_CACHE:
850 case SYNCHRONIZE_CACHE_16:
851 /*
852 * The upper level CTL code will filter out any CDBs with
853 * the immediate bit set and return the proper error. It
854 * will also not allow a sync cache command to go to a LUN

--- 84 unchanged lines hidden ---