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 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")); |
221 cbe_lun = CTL_BACKEND_LUN(io); |
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 |
272 cbe_lun = CTL_BACKEND_LUN(io); |
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 |
846 cbe_lun = CTL_BACKEND_LUN(io); |
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 --- |