Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] remove scsi_request infrastructure

With Achim patch the last user (gdth) is switched away from scsi_request
so we an kill it now. Also disables some code in i2o_scsi that was
broken since the sg driver stopped using scsi_requests.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>

authored by

Christoph Hellwig and committed by
James Bottomley
beb40487 1951d099

+14 -370
+2 -2
drivers/message/i2o/i2o_scsi.c
··· 65 65 #include <scsi/scsi_host.h> 66 66 #include <scsi/scsi_device.h> 67 67 #include <scsi/scsi_cmnd.h> 68 - #include <scsi/scsi_request.h> 69 68 #include <scsi/sg.h> 70 - #include <scsi/sg_request.h> 71 69 72 70 #define OSM_NAME "scsi-osm" 73 71 #define OSM_VERSION "1.316" ··· 586 588 587 589 mptr = &msg->body[0]; 588 590 591 + #if 0 /* this code can't work */ 589 592 #ifdef CONFIG_I2O_EXT_ADAPTEC 590 593 if (c->adaptec) { 591 594 u32 adpt_flags = 0; ··· 623 624 *mptr++ = cpu_to_le32(I2O_VENDOR_DPT << 16 | I2O_CMD_SCSI_EXEC); 624 625 *mptr++ = cpu_to_le32(adpt_flags | tid); 625 626 } 627 + #endif 626 628 #endif 627 629 628 630 msg->u.head[1] = cpu_to_le32(cmd | HOST_TID << 12 | tid);
+1 -11
drivers/scsi/constants.c
··· 13 13 #include <linux/kernel.h> 14 14 15 15 #include <scsi/scsi.h> 16 + #include <scsi/scsi_cmnd.h> 16 17 #include <scsi/scsi_device.h> 17 18 #include <scsi/scsi_host.h> 18 - #include <scsi/scsi_request.h> 19 19 #include <scsi/scsi_eh.h> 20 20 #include <scsi/scsi_dbg.h> 21 21 ··· 1260 1260 __scsi_print_sense(name, cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE); 1261 1261 } 1262 1262 EXPORT_SYMBOL(scsi_print_sense); 1263 - 1264 - void scsi_print_req_sense(const char *devclass, struct scsi_request *sreq) 1265 - { 1266 - const char *name = devclass; 1267 - 1268 - if (sreq->sr_request->rq_disk) 1269 - name = sreq->sr_request->rq_disk->disk_name; 1270 - __scsi_print_sense(name, sreq->sr_sense_buffer, SCSI_SENSE_BUFFERSIZE); 1271 - } 1272 - EXPORT_SYMBOL(scsi_print_req_sense); 1273 1263 1274 1264 void scsi_print_command(struct scsi_cmnd *cmd) 1275 1265 {
+4 -4
drivers/scsi/gdth.c
··· 716 716 { 717 717 TRACE2(("gdth_scsi_done()\n")); 718 718 719 - if (scp->sc_request) 720 - complete((struct completion *)scp->sc_request); 719 + if (scp->request) 720 + complete((struct completion *)scp->request); 721 721 } 722 722 723 723 int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd, ··· 732 732 return -ENOMEM; 733 733 memset(scp, 0, sizeof(*scp)); 734 734 scp->device = sdev; 735 - /* use sc_request field to save the ptr. to completion struct. */ 736 - scp->sc_request = (struct scsi_request *)&wait; 735 + /* use request field to save the ptr. to completion struct. */ 736 + scp->request = (struct request *)&wait; 737 737 scp->timeout_per_command = timeout*HZ; 738 738 scp->request_buffer = gdtcmd; 739 739 scp->cmd_len = 12;
-1
drivers/scsi/ipr.c
··· 79 79 #include <scsi/scsi_tcq.h> 80 80 #include <scsi/scsi_eh.h> 81 81 #include <scsi/scsi_cmnd.h> 82 - #include <scsi/scsi_request.h> 83 82 #include "ipr.h" 84 83 85 84 /*
+1 -1
drivers/scsi/libata-scsi.c
··· 38 38 #include <linux/spinlock.h> 39 39 #include <scsi/scsi.h> 40 40 #include <scsi/scsi_host.h> 41 + #include <scsi/scsi_cmnd.h> 41 42 #include <scsi/scsi_eh.h> 42 43 #include <scsi/scsi_device.h> 43 - #include <scsi/scsi_request.h> 44 44 #include <scsi/scsi_transport.h> 45 45 #include <linux/libata.h> 46 46 #include <linux/hdreg.h>
-1
drivers/scsi/qlogicpti.c
··· 43 43 #include <scsi/scsi_cmnd.h> 44 44 #include <scsi/scsi_device.h> 45 45 #include <scsi/scsi_eh.h> 46 - #include <scsi/scsi_request.h> 47 46 #include <scsi/scsi_tcq.h> 48 47 #include <scsi/scsi_host.h> 49 48
-157
drivers/scsi/scsi.c
··· 63 63 #include <scsi/scsi_eh.h> 64 64 #include <scsi/scsi_host.h> 65 65 #include <scsi/scsi_tcq.h> 66 - #include <scsi/scsi_request.h> 67 66 68 67 #include "scsi_priv.h" 69 68 #include "scsi_logging.h" ··· 114 115 "Direct-Access-RBC", 115 116 }; 116 117 EXPORT_SYMBOL(scsi_device_types); 117 - 118 - /* 119 - * Function: scsi_allocate_request 120 - * 121 - * Purpose: Allocate a request descriptor. 122 - * 123 - * Arguments: device - device for which we want a request 124 - * gfp_mask - allocation flags passed to kmalloc 125 - * 126 - * Lock status: No locks assumed to be held. This function is SMP-safe. 127 - * 128 - * Returns: Pointer to request block. 129 - */ 130 - struct scsi_request *scsi_allocate_request(struct scsi_device *sdev, 131 - gfp_t gfp_mask) 132 - { 133 - const int offset = ALIGN(sizeof(struct scsi_request), 4); 134 - const int size = offset + sizeof(struct request); 135 - struct scsi_request *sreq; 136 - 137 - sreq = kzalloc(size, gfp_mask); 138 - if (likely(sreq != NULL)) { 139 - sreq->sr_request = (struct request *)(((char *)sreq) + offset); 140 - sreq->sr_device = sdev; 141 - sreq->sr_host = sdev->host; 142 - sreq->sr_magic = SCSI_REQ_MAGIC; 143 - sreq->sr_data_direction = DMA_BIDIRECTIONAL; 144 - } 145 - 146 - return sreq; 147 - } 148 - EXPORT_SYMBOL(scsi_allocate_request); 149 - 150 - void __scsi_release_request(struct scsi_request *sreq) 151 - { 152 - struct request *req = sreq->sr_request; 153 - 154 - /* unlikely because the tag was usually ended earlier by the 155 - * mid-layer. However, for layering reasons ULD's don't end 156 - * the tag of commands they generate. */ 157 - if (unlikely(blk_rq_tagged(req))) { 158 - unsigned long flags; 159 - struct request_queue *q = req->q; 160 - 161 - spin_lock_irqsave(q->queue_lock, flags); 162 - blk_queue_end_tag(q, req); 163 - spin_unlock_irqrestore(q->queue_lock, flags); 164 - } 165 - 166 - 167 - if (likely(sreq->sr_command != NULL)) { 168 - struct scsi_cmnd *cmd = sreq->sr_command; 169 - 170 - sreq->sr_command = NULL; 171 - scsi_next_command(cmd); 172 - } 173 - } 174 - 175 - /* 176 - * Function: scsi_release_request 177 - * 178 - * Purpose: Release a request descriptor. 179 - * 180 - * Arguments: sreq - request to release 181 - * 182 - * Lock status: No locks assumed to be held. This function is SMP-safe. 183 - */ 184 - void scsi_release_request(struct scsi_request *sreq) 185 - { 186 - __scsi_release_request(sreq); 187 - kfree(sreq); 188 - } 189 - EXPORT_SYMBOL(scsi_release_request); 190 118 191 119 struct scsi_host_cmd_pool { 192 120 kmem_cache_t *slab; ··· 572 646 return rtn; 573 647 } 574 648 575 - /* 576 - * Function: scsi_init_cmd_from_req 577 - * 578 - * Purpose: Queue a SCSI command 579 - * Purpose: Initialize a struct scsi_cmnd from a struct scsi_request 580 - * 581 - * Arguments: cmd - command descriptor. 582 - * sreq - Request from the queue. 583 - * 584 - * Lock status: None needed. 585 - * 586 - * Returns: Nothing. 587 - * 588 - * Notes: Mainly transfer data from the request structure to the 589 - * command structure. The request structure is allocated 590 - * using the normal memory allocator, and requests can pile 591 - * up to more or less any depth. The command structure represents 592 - * a consumable resource, as these are allocated into a pool 593 - * when the SCSI subsystem initializes. The preallocation is 594 - * required so that in low-memory situations a disk I/O request 595 - * won't cause the memory manager to try and write out a page. 596 - * The request structure is generally used by ioctls and character 597 - * devices. 598 - */ 599 - void scsi_init_cmd_from_req(struct scsi_cmnd *cmd, struct scsi_request *sreq) 600 - { 601 - sreq->sr_command = cmd; 602 - 603 - cmd->cmd_len = sreq->sr_cmd_len; 604 - cmd->use_sg = sreq->sr_use_sg; 605 - 606 - cmd->request = sreq->sr_request; 607 - memcpy(cmd->data_cmnd, sreq->sr_cmnd, sizeof(cmd->data_cmnd)); 608 - cmd->serial_number = 0; 609 - cmd->bufflen = sreq->sr_bufflen; 610 - cmd->buffer = sreq->sr_buffer; 611 - cmd->retries = 0; 612 - cmd->allowed = sreq->sr_allowed; 613 - cmd->done = sreq->sr_done; 614 - cmd->timeout_per_command = sreq->sr_timeout_per_command; 615 - cmd->sc_data_direction = sreq->sr_data_direction; 616 - cmd->sglist_len = sreq->sr_sglist_len; 617 - cmd->underflow = sreq->sr_underflow; 618 - cmd->sc_request = sreq; 619 - memcpy(cmd->cmnd, sreq->sr_cmnd, sizeof(sreq->sr_cmnd)); 620 - 621 - /* 622 - * Zero the sense buffer. Some host adapters automatically request 623 - * sense on error. 0 is not a valid sense code. 624 - */ 625 - memset(cmd->sense_buffer, 0, sizeof(sreq->sr_sense_buffer)); 626 - cmd->request_buffer = sreq->sr_buffer; 627 - cmd->request_bufflen = sreq->sr_bufflen; 628 - cmd->old_use_sg = cmd->use_sg; 629 - if (cmd->cmd_len == 0) 630 - cmd->cmd_len = COMMAND_SIZE(cmd->cmnd[0]); 631 - cmd->old_cmd_len = cmd->cmd_len; 632 - cmd->sc_old_data_direction = cmd->sc_data_direction; 633 - cmd->old_underflow = cmd->underflow; 634 - 635 - /* 636 - * Start the timer ticking. 637 - */ 638 - cmd->result = 0; 639 - 640 - SCSI_LOG_MLQUEUE(3, printk("Leaving scsi_init_cmd_from_req()\n")); 641 - } 642 649 643 650 /* 644 651 * Per-CPU I/O completion queue. ··· 668 809 { 669 810 struct scsi_device *sdev = cmd->device; 670 811 struct Scsi_Host *shost = sdev->host; 671 - struct scsi_request *sreq; 672 812 673 813 scsi_device_unbusy(sdev); 674 814 ··· 697 839 * We can get here with use_sg=0, causing a panic in the upper level 698 840 */ 699 841 cmd->use_sg = cmd->old_use_sg; 700 - 701 - /* 702 - * If there is an associated request structure, copy the data over 703 - * before we call the completion function. 704 - */ 705 - sreq = cmd->sc_request; 706 - if (sreq) { 707 - sreq->sr_result = sreq->sr_command->result; 708 - if (sreq->sr_result) { 709 - memcpy(sreq->sr_sense_buffer, 710 - sreq->sr_command->sense_buffer, 711 - sizeof(sreq->sr_sense_buffer)); 712 - } 713 - } 714 - 715 842 cmd->done(cmd); 716 843 } 717 844 EXPORT_SYMBOL(scsi_finish_command);
-1
drivers/scsi/scsi.h
··· 25 25 #include <scsi/scsi_cmnd.h> 26 26 #include <scsi/scsi_device.h> 27 27 #include <scsi/scsi_eh.h> 28 - #include <scsi/scsi_request.h> 29 28 #include <scsi/scsi_tcq.h> 30 29 #include <scsi/scsi.h> 31 30
+1 -11
drivers/scsi/scsi_error.c
··· 26 26 #include <linux/delay.h> 27 27 28 28 #include <scsi/scsi.h> 29 + #include <scsi/scsi_cmnd.h> 29 30 #include <scsi/scsi_dbg.h> 30 31 #include <scsi/scsi_device.h> 31 32 #include <scsi/scsi_eh.h> 32 33 #include <scsi/scsi_transport.h> 33 34 #include <scsi/scsi_host.h> 34 35 #include <scsi/scsi_ioctl.h> 35 - #include <scsi/scsi_request.h> 36 36 37 37 #include "scsi_priv.h" 38 38 #include "scsi_logging.h" ··· 1671 1671 scmd->cmd_len = 0; 1672 1672 1673 1673 scmd->sc_data_direction = DMA_BIDIRECTIONAL; 1674 - scmd->sc_request = NULL; 1675 - scmd->sc_magic = SCSI_CMND_MAGIC; 1676 1674 1677 1675 init_timer(&scmd->eh_timeout); 1678 1676 ··· 1766 1768 return 1; 1767 1769 } 1768 1770 EXPORT_SYMBOL(scsi_normalize_sense); 1769 - 1770 - int scsi_request_normalize_sense(struct scsi_request *sreq, 1771 - struct scsi_sense_hdr *sshdr) 1772 - { 1773 - return scsi_normalize_sense(sreq->sr_sense_buffer, 1774 - sizeof(sreq->sr_sense_buffer), sshdr); 1775 - } 1776 - EXPORT_SYMBOL(scsi_request_normalize_sense); 1777 1771 1778 1772 int scsi_command_normalize_sense(struct scsi_cmnd *cmd, 1779 1773 struct scsi_sense_hdr *sshdr)
+1 -1
drivers/scsi/scsi_ioctl.c
··· 15 15 #include <asm/uaccess.h> 16 16 17 17 #include <scsi/scsi.h> 18 + #include <scsi/scsi_cmnd.h> 18 19 #include <scsi/scsi_device.h> 19 20 #include <scsi/scsi_eh.h> 20 21 #include <scsi/scsi_host.h> 21 22 #include <scsi/scsi_ioctl.h> 22 - #include <scsi/scsi_request.h> 23 23 #include <scsi/sg.h> 24 24 #include <scsi/scsi_dbg.h> 25 25
+3 -77
drivers/scsi/scsi_lib.c
··· 19 19 #include <linux/hardirq.h> 20 20 21 21 #include <scsi/scsi.h> 22 + #include <scsi/scsi_cmnd.h> 22 23 #include <scsi/scsi_dbg.h> 23 24 #include <scsi/scsi_device.h> 24 25 #include <scsi/scsi_driver.h> 25 26 #include <scsi/scsi_eh.h> 26 27 #include <scsi/scsi_host.h> 27 - #include <scsi/scsi_request.h> 28 28 29 29 #include "scsi_priv.h" 30 30 #include "scsi_logging.h" ··· 83 83 struct scsi_cmnd *cmd = req->special; 84 84 85 85 req->flags &= ~REQ_DONTPREP; 86 - req->special = (req->flags & REQ_SPECIAL) ? cmd->sc_request : NULL; 86 + req->special = NULL; 87 87 88 88 scsi_put_command(cmd); 89 89 } ··· 160 160 161 161 return 0; 162 162 } 163 - 164 - /* 165 - * Function: scsi_do_req 166 - * 167 - * Purpose: Queue a SCSI request 168 - * 169 - * Arguments: sreq - command descriptor. 170 - * cmnd - actual SCSI command to be performed. 171 - * buffer - data buffer. 172 - * bufflen - size of data buffer. 173 - * done - completion function to be run. 174 - * timeout - how long to let it run before timeout. 175 - * retries - number of retries we allow. 176 - * 177 - * Lock status: No locks held upon entry. 178 - * 179 - * Returns: Nothing. 180 - * 181 - * Notes: This function is only used for queueing requests for things 182 - * like ioctls and character device requests - this is because 183 - * we essentially just inject a request into the queue for the 184 - * device. 185 - * 186 - * In order to support the scsi_device_quiesce function, we 187 - * now inject requests on the *head* of the device queue 188 - * rather than the tail. 189 - */ 190 - void scsi_do_req(struct scsi_request *sreq, const void *cmnd, 191 - void *buffer, unsigned bufflen, 192 - void (*done)(struct scsi_cmnd *), 193 - int timeout, int retries) 194 - { 195 - /* 196 - * If the upper level driver is reusing these things, then 197 - * we should release the low-level block now. Another one will 198 - * be allocated later when this request is getting queued. 199 - */ 200 - __scsi_release_request(sreq); 201 - 202 - /* 203 - * Our own function scsi_done (which marks the host as not busy, 204 - * disables the timeout counter, etc) will be called by us or by the 205 - * scsi_hosts[host].queuecommand() function needs to also call 206 - * the completion function for the high level driver. 207 - */ 208 - memcpy(sreq->sr_cmnd, cmnd, sizeof(sreq->sr_cmnd)); 209 - sreq->sr_bufflen = bufflen; 210 - sreq->sr_buffer = buffer; 211 - sreq->sr_allowed = retries; 212 - sreq->sr_done = done; 213 - sreq->sr_timeout_per_command = timeout; 214 - 215 - if (sreq->sr_cmd_len == 0) 216 - sreq->sr_cmd_len = COMMAND_SIZE(sreq->sr_cmnd[0]); 217 - 218 - /* 219 - * head injection *required* here otherwise quiesce won't work 220 - * 221 - * Because users of this function are apt to reuse requests with no 222 - * modification, we have to sanitise the request flags here 223 - */ 224 - sreq->sr_request->flags &= ~REQ_DONTPREP; 225 - blk_insert_request(sreq->sr_device->request_queue, sreq->sr_request, 226 - 1, sreq); 227 - } 228 - EXPORT_SYMBOL(scsi_do_req); 229 163 230 164 /** 231 165 * scsi_execute - insert request and wait for the result ··· 1234 1300 * at request->cmd, as this tells us the real story. 1235 1301 */ 1236 1302 if (req->flags & REQ_SPECIAL && req->special) { 1237 - struct scsi_request *sreq = req->special; 1238 - 1239 - if (sreq->sr_magic == SCSI_REQ_MAGIC) { 1240 - cmd = scsi_get_command(sreq->sr_device, GFP_ATOMIC); 1241 - if (unlikely(!cmd)) 1242 - goto defer; 1243 - scsi_init_cmd_from_req(cmd, sreq); 1244 - } else 1245 - cmd = req->special; 1303 + cmd = req->special; 1246 1304 } else if (req->flags & (REQ_CMD | REQ_BLOCK_PC)) { 1247 1305 1248 1306 if(unlikely(specials_only) && !(req->flags & REQ_SPECIAL)) {
-10
drivers/scsi/scsi_priv.h
··· 8 8 struct scsi_cmnd; 9 9 struct scsi_device; 10 10 struct scsi_host_template; 11 - struct scsi_request; 12 11 struct Scsi_Host; 13 12 14 - 15 - /* 16 - * Magic values for certain scsi structs. Shouldn't ever be used. 17 - */ 18 - #define SCSI_CMND_MAGIC 0xE25C23A5 19 - #define SCSI_REQ_MAGIC 0x75F6D354 20 13 21 14 /* 22 15 * Scsi Error Handler Flags ··· 27 34 extern int scsi_dispatch_cmd(struct scsi_cmnd *cmd); 28 35 extern int scsi_setup_command_freelist(struct Scsi_Host *shost); 29 36 extern void scsi_destroy_command_freelist(struct Scsi_Host *shost); 30 - extern void scsi_init_cmd_from_req(struct scsi_cmnd *cmd, 31 - struct scsi_request *sreq); 32 - extern void __scsi_release_request(struct scsi_request *sreq); 33 37 extern void __scsi_done(struct scsi_cmnd *cmd); 34 38 extern int scsi_retry_command(struct scsi_cmnd *cmd); 35 39 #ifdef CONFIG_SCSI_LOGGING
+1 -1
drivers/scsi/scsi_scan.c
··· 33 33 #include <asm/semaphore.h> 34 34 35 35 #include <scsi/scsi.h> 36 + #include <scsi/scsi_cmnd.h> 36 37 #include <scsi/scsi_device.h> 37 38 #include <scsi/scsi_driver.h> 38 39 #include <scsi/scsi_devinfo.h> 39 40 #include <scsi/scsi_host.h> 40 - #include <scsi/scsi_request.h> 41 41 #include <scsi/scsi_transport.h> 42 42 #include <scsi/scsi_eh.h> 43 43
-1
drivers/scsi/scsi_typedefs.h
··· 1 1 2 2 typedef struct scsi_cmnd Scsi_Cmnd; 3 - typedef struct scsi_request Scsi_Request;
-6
include/scsi/scsi_cmnd.h
··· 9 9 struct request; 10 10 struct scatterlist; 11 11 struct scsi_device; 12 - struct scsi_request; 13 12 14 13 15 14 /* embedded in scsi_cmnd */ ··· 28 29 }; 29 30 30 31 struct scsi_cmnd { 31 - int sc_magic; 32 - 33 32 struct scsi_device *device; 34 - struct scsi_request *sc_request; 35 - 36 33 struct list_head list; /* scsi_cmnd participates in queue lists */ 37 - 38 34 struct list_head eh_entry; /* entry for the host eh_cmd_q */ 39 35 int eh_eflags; /* Used by error handlr */ 40 36 void (*done) (struct scsi_cmnd *); /* Mid-level done function */
-2
include/scsi/scsi_dbg.h
··· 2 2 #define _SCSI_SCSI_DBG_H 3 3 4 4 struct scsi_cmnd; 5 - struct scsi_request; 6 5 struct scsi_sense_hdr; 7 6 8 7 extern void scsi_print_command(struct scsi_cmnd *); 9 8 extern void scsi_print_sense_hdr(const char *, struct scsi_sense_hdr *); 10 9 extern void __scsi_print_command(unsigned char *); 11 10 extern void scsi_print_sense(const char *, struct scsi_cmnd *); 12 - extern void scsi_print_req_sense(const char *, struct scsi_request *); 13 11 extern void __scsi_print_sense(const char *name, 14 12 const unsigned char *sense_buffer, 15 13 int sense_len);
-3
include/scsi/scsi_eh.h
··· 3 3 4 4 struct scsi_cmnd; 5 5 struct scsi_device; 6 - struct scsi_request; 7 6 struct Scsi_Host; 8 7 9 8 /* ··· 41 42 extern void scsi_report_device_reset(struct Scsi_Host *, int, int); 42 43 extern int scsi_block_when_processing_errors(struct scsi_device *); 43 44 extern int scsi_normalize_sense(const u8 *sense_buffer, int sb_len, 44 - struct scsi_sense_hdr *sshdr); 45 - extern int scsi_request_normalize_sense(struct scsi_request *sreq, 46 45 struct scsi_sense_hdr *sshdr); 47 46 extern int scsi_command_normalize_sense(struct scsi_cmnd *cmd, 48 47 struct scsi_sense_hdr *sshdr);
-54
include/scsi/scsi_request.h
··· 1 - #ifndef _SCSI_SCSI_REQUEST_H 2 - #define _SCSI_SCSI_REQUEST_H 3 - 4 - #include <scsi/scsi_cmnd.h> 5 - 6 - struct request; 7 - struct scsi_cmnd; 8 - struct scsi_device; 9 - struct Scsi_Host; 10 - 11 - 12 - /* 13 - * This is essentially a slimmed down version of Scsi_Cmnd. The point of 14 - * having this is that requests that are injected into the queue as result 15 - * of things like ioctls and character devices shouldn't be using a 16 - * Scsi_Cmnd until such a time that the command is actually at the head 17 - * of the queue and being sent to the driver. 18 - */ 19 - struct scsi_request { 20 - int sr_magic; 21 - int sr_result; /* Status code from lower level driver */ 22 - unsigned char sr_sense_buffer[SCSI_SENSE_BUFFERSIZE]; /* obtained by REQUEST SENSE 23 - * when CHECK CONDITION is 24 - * received on original command 25 - * (auto-sense) */ 26 - 27 - struct Scsi_Host *sr_host; 28 - struct scsi_device *sr_device; 29 - struct scsi_cmnd *sr_command; 30 - struct request *sr_request; /* A copy of the command we are 31 - working on */ 32 - unsigned sr_bufflen; /* Size of data buffer */ 33 - void *sr_buffer; /* Data buffer */ 34 - int sr_allowed; 35 - enum dma_data_direction sr_data_direction; 36 - unsigned char sr_cmd_len; 37 - unsigned char sr_cmnd[MAX_COMMAND_SIZE]; 38 - void (*sr_done) (struct scsi_cmnd *); /* Mid-level done function */ 39 - int sr_timeout_per_command; 40 - unsigned short sr_use_sg; /* Number of pieces of scatter-gather */ 41 - unsigned short sr_sglist_len; /* size of malloc'd scatter-gather list */ 42 - unsigned sr_underflow; /* Return error if less than 43 - this amount is transferred */ 44 - void *upper_private_data; /* reserved for owner (usually upper 45 - level driver) of this request */ 46 - }; 47 - 48 - extern struct scsi_request *scsi_allocate_request(struct scsi_device *, gfp_t); 49 - extern void scsi_release_request(struct scsi_request *); 50 - extern void scsi_do_req(struct scsi_request *, const void *cmnd, 51 - void *buffer, unsigned bufflen, 52 - void (*done) (struct scsi_cmnd *), 53 - int timeout, int retries); 54 - #endif /* _SCSI_SCSI_REQUEST_H */
-26
include/scsi/sg_request.h
··· 1 - typedef struct scsi_request Scsi_Request; 2 - 3 - static Scsi_Request *dummy_cmdp; /* only used for sizeof */ 4 - 5 - typedef struct sg_scatter_hold { /* holding area for scsi scatter gather info */ 6 - unsigned short k_use_sg; /* Count of kernel scatter-gather pieces */ 7 - unsigned short sglist_len; /* size of malloc'd scatter-gather list ++ */ 8 - unsigned bufflen; /* Size of (aggregate) data buffer */ 9 - unsigned b_malloc_len; /* actual len malloc'ed in buffer */ 10 - void *buffer; /* Data buffer or scatter list (k_use_sg>0) */ 11 - char dio_in_use; /* 0->indirect IO (or mmap), 1->dio */ 12 - unsigned char cmd_opcode; /* first byte of command */ 13 - } Sg_scatter_hold; 14 - 15 - typedef struct sg_request { /* SG_MAX_QUEUE requests outstanding per file */ 16 - Scsi_Request *my_cmdp; /* != 0 when request with lower levels */ 17 - struct sg_request *nextrp; /* NULL -> tail request (slist) */ 18 - struct sg_fd *parentfp; /* NULL -> not in use */ 19 - Sg_scatter_hold data; /* hold buffer, perhaps scatter list */ 20 - sg_io_hdr_t header; /* scsi command+info, see <scsi/sg.h> */ 21 - unsigned char sense_b[sizeof (dummy_cmdp->sr_sense_buffer)]; 22 - char res_used; /* 1 -> using reserve buffer, 0 -> not ... */ 23 - char orphan; /* 1 -> drop on sight, 0 -> normal */ 24 - char sg_io_owned; /* 1 -> packet belongs to SG_IO */ 25 - volatile char done; /* 0->before bh, 1->before read, 2->read */ 26 - } Sg_request;