ctl.c (272631) | ctl.c (272632) |
---|---|
1/*- 2 * Copyright (c) 2003-2009 Silicon Graphics International Corp. 3 * Copyright (c) 2012 The FreeBSD Foundation 4 * All rights reserved. 5 * 6 * Portions of this software were developed by Edward Tomasz Napierala 7 * under sponsorship from the FreeBSD Foundation. 8 * --- 28 unchanged lines hidden (view full) --- 37 * CAM Target Layer, a SCSI device emulation subsystem. 38 * 39 * Author: Ken Merry <ken@FreeBSD.org> 40 */ 41 42#define _CTL_C 43 44#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2003-2009 Silicon Graphics International Corp. 3 * Copyright (c) 2012 The FreeBSD Foundation 4 * All rights reserved. 5 * 6 * Portions of this software were developed by Edward Tomasz Napierala 7 * under sponsorship from the FreeBSD Foundation. 8 * --- 28 unchanged lines hidden (view full) --- 37 * CAM Target Layer, a SCSI device emulation subsystem. 38 * 39 * Author: Ken Merry <ken@FreeBSD.org> 40 */ 41 42#define _CTL_C 43 44#include <sys/cdefs.h> |
45__FBSDID("$FreeBSD: stable/10/sys/cam/ctl/ctl.c 272631 2014-10-06 13:20:18Z mav $"); | 45__FBSDID("$FreeBSD: stable/10/sys/cam/ctl/ctl.c 272632 2014-10-06 13:21:13Z mav $"); |
46 47#include <sys/param.h> 48#include <sys/systm.h> 49#include <sys/kernel.h> 50#include <sys/types.h> 51#include <sys/kthread.h> 52#include <sys/bio.h> 53#include <sys/fcntl.h> --- 5936 unchanged lines hidden (view full) --- 5990 */ 5991 ctl_set_invalid_opcode(ctsio); 5992 ctl_done((union ctl_io *)ctsio); 5993 5994 return (CTL_RETVAL_COMPLETE); 5995 break; /* NOTREACHED */ 5996 } 5997 | 46 47#include <sys/param.h> 48#include <sys/systm.h> 49#include <sys/kernel.h> 50#include <sys/types.h> 51#include <sys/kthread.h> 52#include <sys/bio.h> 53#include <sys/fcntl.h> --- 5936 unchanged lines hidden (view full) --- 5990 */ 5991 ctl_set_invalid_opcode(ctsio); 5992 ctl_done((union ctl_io *)ctsio); 5993 5994 return (CTL_RETVAL_COMPLETE); 5995 break; /* NOTREACHED */ 5996 } 5997 |
5998 /* NDOB flag can be used only together with UNMAP */ 5999 if ((byte2 & (SWS_NDOB | SWS_UNMAP)) == SWS_NDOB) { 6000 ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, 6001 /*command*/ 1, /*field*/ 1, /*bit_valid*/ 1, /*bit*/ 0); 6002 ctl_done((union ctl_io *)ctsio); 6003 return (CTL_RETVAL_COMPLETE); 6004 } 6005 |
|
5998 /* 5999 * The first check is to make sure we're in bounds, the second 6000 * check is to catch wrap-around problems. If the lba + num blocks 6001 * is less than the lba, then we've wrapped around and the block 6002 * range is invalid anyway. 6003 */ 6004 if (((lba + num_blocks) > (lun->be_lun->maxlba + 1)) 6005 || ((lba + num_blocks) < lba)) { --- 18 unchanged lines hidden (view full) --- 6024 } 6025 6026 len = lun->be_lun->blocksize; 6027 6028 /* 6029 * If we've got a kernel request that hasn't been malloced yet, 6030 * malloc it and tell the caller the data buffer is here. 6031 */ | 6006 /* 6007 * The first check is to make sure we're in bounds, the second 6008 * check is to catch wrap-around problems. If the lba + num blocks 6009 * is less than the lba, then we've wrapped around and the block 6010 * range is invalid anyway. 6011 */ 6012 if (((lba + num_blocks) > (lun->be_lun->maxlba + 1)) 6013 || ((lba + num_blocks) < lba)) { --- 18 unchanged lines hidden (view full) --- 6032 } 6033 6034 len = lun->be_lun->blocksize; 6035 6036 /* 6037 * If we've got a kernel request that hasn't been malloced yet, 6038 * malloc it and tell the caller the data buffer is here. 6039 */ |
6032 if ((ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) == 0) { | 6040 if ((byte2 & SWS_NDOB) == 0 && 6041 (ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) == 0) { |
6033 ctsio->kern_data_ptr = malloc(len, M_CTL, M_WAITOK);; 6034 ctsio->kern_data_len = len; 6035 ctsio->kern_total_len = len; 6036 ctsio->kern_data_resid = 0; 6037 ctsio->kern_rel_offset = 0; 6038 ctsio->kern_sg_entries = 0; 6039 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 6040 ctsio->be_move_done = ctl_config_move_done; --- 8305 unchanged lines hidden --- | 6042 ctsio->kern_data_ptr = malloc(len, M_CTL, M_WAITOK);; 6043 ctsio->kern_data_len = len; 6044 ctsio->kern_total_len = len; 6045 ctsio->kern_data_resid = 0; 6046 ctsio->kern_rel_offset = 0; 6047 ctsio->kern_sg_entries = 0; 6048 ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; 6049 ctsio->be_move_done = ctl_config_move_done; --- 8305 unchanged lines hidden --- |