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

scsi_dh: kill struct scsi_dh_data

Add a ->handler and a ->handler_data field to struct scsi_device and kill
this indirection. Also move struct scsi_device_handler to scsi_dh.h so that
changes to it don't require rebuilding every SCSI LLDD.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>

authored by

Christoph Hellwig and committed by
James Bottomley
ee14c674 d95dbff2

+98 -140
+10 -15
drivers/scsi/device_handler/scsi_dh_alua.c
··· 62 62 #define ALUA_OPTIMIZE_STPG 1 63 63 64 64 struct alua_dh_data { 65 - struct scsi_dh_data dh_data; 66 65 int group_id; 67 66 int rel_port; 68 67 int tpgs; ··· 84 85 85 86 static char print_alua_state(int); 86 87 static int alua_check_sense(struct scsi_device *, struct scsi_sense_hdr *); 87 - 88 - static inline struct alua_dh_data *get_alua_data(struct scsi_device *sdev) 89 - { 90 - return container_of(sdev->scsi_dh_data, struct alua_dh_data, dh_data); 91 - } 92 88 93 89 static int realloc_buffer(struct alua_dh_data *h, unsigned len) 94 90 { ··· 702 708 */ 703 709 static int alua_set_params(struct scsi_device *sdev, const char *params) 704 710 { 705 - struct alua_dh_data *h = get_alua_data(sdev); 711 + struct alua_dh_data *h = sdev->handler_data; 706 712 unsigned int optimize = 0, argc; 707 713 const char *p = params; 708 714 int result = SCSI_DH_OK; ··· 740 746 static int alua_activate(struct scsi_device *sdev, 741 747 activate_complete fn, void *data) 742 748 { 743 - struct alua_dh_data *h = get_alua_data(sdev); 749 + struct alua_dh_data *h = sdev->handler_data; 744 750 int err = SCSI_DH_OK; 745 751 int stpg = 0; 746 752 ··· 798 804 */ 799 805 static int alua_prep_fn(struct scsi_device *sdev, struct request *req) 800 806 { 801 - struct alua_dh_data *h = get_alua_data(sdev); 807 + struct alua_dh_data *h = sdev->handler_data; 802 808 int ret = BLKPREP_OK; 803 809 804 810 if (h->state == TPGS_STATE_TRANSITIONING) ··· 817 823 * alua_bus_attach - Attach device handler 818 824 * @sdev: device to be attached to 819 825 */ 820 - static struct scsi_dh_data *alua_bus_attach(struct scsi_device *sdev) 826 + static int alua_bus_attach(struct scsi_device *sdev) 821 827 { 822 828 struct alua_dh_data *h; 823 829 int err; 824 830 825 831 h = kzalloc(sizeof(*h) , GFP_KERNEL); 826 832 if (!h) 827 - return ERR_PTR(-ENOMEM); 833 + return -ENOMEM; 828 834 h->tpgs = TPGS_MODE_UNINITIALIZED; 829 835 h->state = TPGS_STATE_OPTIMIZED; 830 836 h->group_id = -1; ··· 837 843 if (err != SCSI_DH_OK && err != SCSI_DH_DEV_OFFLINED) 838 844 goto failed; 839 845 840 - sdev_printk(KERN_NOTICE, sdev, "%s: Attached\n", ALUA_DH_NAME); 841 - return &h->dh_data; 846 + sdev->handler_data = h; 847 + return 0; 842 848 failed: 843 849 kfree(h); 844 - return ERR_PTR(-EINVAL); 850 + return -EINVAL; 845 851 } 846 852 847 853 /* ··· 850 856 */ 851 857 static void alua_bus_detach(struct scsi_device *sdev) 852 858 { 853 - struct alua_dh_data *h = get_alua_data(sdev); 859 + struct alua_dh_data *h = sdev->handler_data; 854 860 855 861 if (h->buff && h->inq != h->buff) 856 862 kfree(h->buff); 863 + sdev->handler_data = NULL; 857 864 kfree(h); 858 865 } 859 866
+11 -18
drivers/scsi/device_handler/scsi_dh_emc.c
··· 72 72 }; 73 73 74 74 struct clariion_dh_data { 75 - struct scsi_dh_data dh_data; 76 75 /* 77 76 * Flags: 78 77 * CLARIION_SHORT_TRESPASS ··· 112 113 */ 113 114 int current_sp; 114 115 }; 115 - 116 - static inline struct clariion_dh_data 117 - *get_clariion_data(struct scsi_device *sdev) 118 - { 119 - return container_of(sdev->scsi_dh_data, struct clariion_dh_data, 120 - dh_data); 121 - } 122 116 123 117 /* 124 118 * Parse MODE_SELECT cmd reply. ··· 442 450 443 451 static int clariion_prep_fn(struct scsi_device *sdev, struct request *req) 444 452 { 445 - struct clariion_dh_data *h = get_clariion_data(sdev); 453 + struct clariion_dh_data *h = sdev->handler_data; 446 454 int ret = BLKPREP_OK; 447 455 448 456 if (h->lun_state != CLARIION_LUN_OWNED) { ··· 525 533 static int clariion_activate(struct scsi_device *sdev, 526 534 activate_complete fn, void *data) 527 535 { 528 - struct clariion_dh_data *csdev = get_clariion_data(sdev); 536 + struct clariion_dh_data *csdev = sdev->handler_data; 529 537 int result; 530 538 531 539 result = clariion_send_inquiry(sdev, csdev); ··· 566 574 */ 567 575 static int clariion_set_params(struct scsi_device *sdev, const char *params) 568 576 { 569 - struct clariion_dh_data *csdev = get_clariion_data(sdev); 577 + struct clariion_dh_data *csdev = sdev->handler_data; 570 578 unsigned int hr = 0, st = 0, argc; 571 579 const char *p = params; 572 580 int result = SCSI_DH_OK; ··· 614 622 return result; 615 623 } 616 624 617 - static struct scsi_dh_data *clariion_bus_attach(struct scsi_device *sdev) 625 + static int clariion_bus_attach(struct scsi_device *sdev) 618 626 { 619 627 struct clariion_dh_data *h; 620 628 int err; 621 629 622 630 h = kzalloc(sizeof(*h) , GFP_KERNEL); 623 631 if (!h) 624 - return ERR_PTR(-ENOMEM); 632 + return -ENOMEM; 625 633 h->lun_state = CLARIION_LUN_UNINITIALIZED; 626 634 h->default_sp = CLARIION_UNBOUND_LU; 627 635 h->current_sp = CLARIION_UNBOUND_LU; ··· 639 647 CLARIION_NAME, h->current_sp + 'A', 640 648 h->port, lun_state[h->lun_state], 641 649 h->default_sp + 'A'); 642 - return &h->dh_data; 650 + 651 + sdev->handler_data = h; 652 + return 0; 643 653 644 654 failed: 645 655 kfree(h); 646 - return ERR_PTR(-EINVAL); 656 + return -EINVAL; 647 657 } 648 658 649 659 static void clariion_bus_detach(struct scsi_device *sdev) 650 660 { 651 - struct clariion_dh_data *h = get_clariion_data(sdev); 652 - 653 - kfree(h); 661 + kfree(sdev->handler_data); 662 + sdev->handler_data = NULL; 654 663 } 655 664 656 665 static struct scsi_device_handler clariion_dh = {
+10 -15
drivers/scsi/device_handler/scsi_dh_hp_sw.c
··· 38 38 #define HP_SW_PATH_PASSIVE 1 39 39 40 40 struct hp_sw_dh_data { 41 - struct scsi_dh_data dh_data; 42 41 unsigned char sense[SCSI_SENSE_BUFFERSIZE]; 43 42 int path_state; 44 43 int retries; ··· 48 49 }; 49 50 50 51 static int hp_sw_start_stop(struct hp_sw_dh_data *); 51 - 52 - static inline struct hp_sw_dh_data *get_hp_sw_data(struct scsi_device *sdev) 53 - { 54 - return container_of(sdev->scsi_dh_data, struct hp_sw_dh_data, dh_data); 55 - } 56 52 57 53 /* 58 54 * tur_done - Handle TEST UNIT READY return status ··· 261 267 262 268 static int hp_sw_prep_fn(struct scsi_device *sdev, struct request *req) 263 269 { 264 - struct hp_sw_dh_data *h = get_hp_sw_data(sdev); 270 + struct hp_sw_dh_data *h = sdev->handler_data; 265 271 int ret = BLKPREP_OK; 266 272 267 273 if (h->path_state != HP_SW_PATH_ACTIVE) { ··· 286 292 activate_complete fn, void *data) 287 293 { 288 294 int ret = SCSI_DH_OK; 289 - struct hp_sw_dh_data *h = get_hp_sw_data(sdev); 295 + struct hp_sw_dh_data *h = sdev->handler_data; 290 296 291 297 ret = hp_sw_tur(sdev, h); 292 298 ··· 305 311 return 0; 306 312 } 307 313 308 - static struct scsi_dh_data *hp_sw_bus_attach(struct scsi_device *sdev) 314 + static int hp_sw_bus_attach(struct scsi_device *sdev) 309 315 { 310 316 struct hp_sw_dh_data *h; 311 317 int ret; 312 318 313 319 h = kzalloc(sizeof(*h), GFP_KERNEL); 314 320 if (!h) 315 - return ERR_PTR(-ENOMEM); 321 + return -ENOMEM; 316 322 h->path_state = HP_SW_PATH_UNINITIALIZED; 317 323 h->retries = HP_SW_RETRIES; 318 324 h->sdev = sdev; ··· 324 330 sdev_printk(KERN_INFO, sdev, "%s: attached to %s path\n", 325 331 HP_SW_NAME, h->path_state == HP_SW_PATH_ACTIVE? 326 332 "active":"passive"); 327 - return &h->dh_data; 333 + 334 + sdev->handler_data = h; 335 + return 0; 328 336 failed: 329 337 kfree(h); 330 - return ERR_PTR(-EINVAL); 338 + return -EINVAL; 331 339 } 332 340 333 341 static void hp_sw_bus_detach( struct scsi_device *sdev ) 334 342 { 335 - struct hp_sw_dh_data *h = get_hp_sw_data(sdev); 336 - 337 - kfree(h); 343 + kfree(sdev->handler_data); 344 + sdev->handler_data = NULL; 338 345 } 339 346 340 347 static struct scsi_device_handler hp_sw_dh = {
+13 -17
drivers/scsi/device_handler/scsi_dh_rdac.c
··· 181 181 }; 182 182 183 183 struct rdac_dh_data { 184 - struct scsi_dh_data dh_data; 185 184 struct rdac_controller *ctlr; 186 185 #define UNINITIALIZED_LUN (1 << 8) 187 186 unsigned lun; ··· 258 259 if (unlikely(RDAC_LOG_LEVEL(SHIFT))) \ 259 260 sdev_printk(KERN_INFO, sdev, RDAC_NAME ": " f "\n", ## arg); \ 260 261 } while (0); 261 - 262 - static inline struct rdac_dh_data *get_rdac_data(struct scsi_device *sdev) 263 - { 264 - return container_of(sdev->scsi_dh_data, struct rdac_dh_data, dh_data); 265 - } 266 262 267 263 static struct request *get_rdac_req(struct scsi_device *sdev, 268 264 void *buffer, unsigned buflen, int rw) ··· 538 544 { 539 545 struct scsi_sense_hdr sense_hdr; 540 546 int err = SCSI_DH_IO, ret; 541 - struct rdac_dh_data *h = get_rdac_data(sdev); 547 + struct rdac_dh_data *h = sdev->handler_data; 542 548 543 549 ret = scsi_normalize_sense(sensebuf, SCSI_SENSE_BUFFERSIZE, &sense_hdr); 544 550 if (!ret) ··· 583 589 container_of(work, struct rdac_controller, ms_work); 584 590 struct request *rq; 585 591 struct scsi_device *sdev = ctlr->ms_sdev; 586 - struct rdac_dh_data *h = get_rdac_data(sdev); 592 + struct rdac_dh_data *h = sdev->handler_data; 587 593 struct request_queue *q = sdev->request_queue; 588 594 int err, retry_cnt = RDAC_RETRY_COUNT; 589 595 struct rdac_queue_data *tmp, *qdata; ··· 642 648 if (!qdata) 643 649 return SCSI_DH_RETRY; 644 650 645 - qdata->h = get_rdac_data(sdev); 651 + qdata->h = sdev->handler_data; 646 652 qdata->callback_fn = fn; 647 653 qdata->callback_data = data; 648 654 ··· 661 667 static int rdac_activate(struct scsi_device *sdev, 662 668 activate_complete fn, void *data) 663 669 { 664 - struct rdac_dh_data *h = get_rdac_data(sdev); 670 + struct rdac_dh_data *h = sdev->handler_data; 665 671 int err = SCSI_DH_OK; 666 672 int act = 0; 667 673 ··· 696 702 697 703 static int rdac_prep_fn(struct scsi_device *sdev, struct request *req) 698 704 { 699 - struct rdac_dh_data *h = get_rdac_data(sdev); 705 + struct rdac_dh_data *h = sdev->handler_data; 700 706 int ret = BLKPREP_OK; 701 707 702 708 if (h->state != RDAC_STATE_ACTIVE) { ··· 710 716 static int rdac_check_sense(struct scsi_device *sdev, 711 717 struct scsi_sense_hdr *sense_hdr) 712 718 { 713 - struct rdac_dh_data *h = get_rdac_data(sdev); 719 + struct rdac_dh_data *h = sdev->handler_data; 714 720 715 721 RDAC_LOG(RDAC_LOG_SENSE, sdev, "array %s, ctlr %d, " 716 722 "I/O returned with sense %02x/%02x/%02x", ··· 772 778 return SCSI_RETURN_NOT_HANDLED; 773 779 } 774 780 775 - static struct scsi_dh_data *rdac_bus_attach(struct scsi_device *sdev) 781 + static int rdac_bus_attach(struct scsi_device *sdev) 776 782 { 777 783 struct rdac_dh_data *h; 778 784 int err; ··· 781 787 782 788 h = kzalloc(sizeof(*h) , GFP_KERNEL); 783 789 if (!h) 784 - return ERR_PTR(-ENOMEM); 790 + return -ENOMEM; 785 791 h->lun = UNINITIALIZED_LUN; 786 792 h->state = RDAC_STATE_ACTIVE; 787 793 ··· 806 812 RDAC_NAME, h->lun, mode[(int)h->mode], 807 813 lun_state[(int)h->lun_state]); 808 814 809 - return &h->dh_data; 815 + sdev->handler_data = h; 816 + return 0; 810 817 811 818 clean_ctlr: 812 819 spin_lock(&list_lock); ··· 816 821 817 822 failed: 818 823 kfree(h); 819 - return ERR_PTR(-EINVAL); 824 + return -EINVAL; 820 825 } 821 826 822 827 static void rdac_bus_detach( struct scsi_device *sdev ) 823 828 { 824 - struct rdac_dh_data *h = get_rdac_data(sdev); 829 + struct rdac_dh_data *h = sdev->handler_data; 825 830 826 831 if (h->ctlr && h->ctlr->ms_queued) 827 832 flush_workqueue(kmpath_rdacd); ··· 830 835 if (h->ctlr) 831 836 kref_put(&h->ctlr->kref, release_controller); 832 837 spin_unlock(&list_lock); 838 + sdev->handler_data = NULL; 833 839 kfree(h); 834 840 } 835 841
+28 -47
drivers/scsi/scsi_dh.c
··· 126 126 static int scsi_dh_handler_attach(struct scsi_device *sdev, 127 127 struct scsi_device_handler *scsi_dh) 128 128 { 129 - struct scsi_dh_data *d; 129 + int error; 130 130 131 131 if (!try_module_get(scsi_dh->module)) 132 132 return -EINVAL; 133 133 134 - d = scsi_dh->attach(sdev); 135 - if (IS_ERR(d)) { 136 - sdev_printk(KERN_ERR, sdev, "%s: Attach failed (%ld)\n", 137 - scsi_dh->name, PTR_ERR(d)); 134 + error = scsi_dh->attach(sdev); 135 + if (error) { 136 + sdev_printk(KERN_ERR, sdev, "%s: Attach failed (%d)\n", 137 + scsi_dh->name, error); 138 138 module_put(scsi_dh->module); 139 - return PTR_ERR(d); 140 - } 139 + } else 140 + sdev->handler = scsi_dh; 141 141 142 - d->scsi_dh = scsi_dh; 143 - d->sdev = sdev; 144 - 145 - spin_lock_irq(sdev->request_queue->queue_lock); 146 - sdev->scsi_dh_data = d; 147 - spin_unlock_irq(sdev->request_queue->queue_lock); 148 - return 0; 142 + return error; 149 143 } 150 144 151 145 /* ··· 148 154 */ 149 155 static void scsi_dh_handler_detach(struct scsi_device *sdev) 150 156 { 151 - struct scsi_dh_data *scsi_dh_data = sdev->scsi_dh_data; 152 - struct scsi_device_handler *scsi_dh = scsi_dh_data->scsi_dh; 153 - 154 - scsi_dh->detach(sdev); 155 - 156 - spin_lock_irq(sdev->request_queue->queue_lock); 157 - sdev->scsi_dh_data = NULL; 158 - spin_unlock_irq(sdev->request_queue->queue_lock); 159 - 160 - sdev_printk(KERN_NOTICE, sdev, "%s: Detached\n", scsi_dh->name); 161 - module_put(scsi_dh->module); 157 + sdev->handler->detach(sdev); 158 + sdev_printk(KERN_NOTICE, sdev, "%s: Detached\n", sdev->handler->name); 159 + module_put(sdev->handler->module); 162 160 } 163 161 164 162 /* ··· 168 182 sdev->sdev_state == SDEV_DEL) 169 183 return -ENODEV; 170 184 171 - if (!sdev->scsi_dh_data) { 185 + if (!sdev->handler) { 172 186 /* 173 187 * Attach to a device handler 174 188 */ ··· 177 191 return err; 178 192 err = scsi_dh_handler_attach(sdev, scsi_dh); 179 193 } else { 180 - scsi_dh = sdev->scsi_dh_data->scsi_dh; 181 194 if (!strncmp(buf, "detach", 6)) { 182 195 /* 183 196 * Detach from a device handler ··· 187 202 /* 188 203 * Activate a device handler 189 204 */ 190 - if (scsi_dh->activate) 191 - err = scsi_dh->activate(sdev, NULL, NULL); 205 + if (sdev->handler->activate) 206 + err = sdev->handler->activate(sdev, NULL, NULL); 192 207 else 193 208 err = 0; 194 209 } ··· 202 217 { 203 218 struct scsi_device *sdev = to_scsi_device(dev); 204 219 205 - if (!sdev->scsi_dh_data) 220 + if (!sdev->handler) 206 221 return snprintf(buf, 20, "detached\n"); 207 222 208 - return snprintf(buf, 20, "%s\n", sdev->scsi_dh_data->scsi_dh->name); 223 + return snprintf(buf, 20, "%s\n", sdev->handler->name); 209 224 } 210 225 211 226 static struct device_attribute scsi_dh_state_attr = ··· 232 247 233 248 void scsi_dh_remove_device(struct scsi_device *sdev) 234 249 { 235 - if (sdev->scsi_dh_data) 250 + if (sdev->handler) 236 251 scsi_dh_handler_detach(sdev); 237 252 device_remove_file(&sdev->sdev_gendev, &scsi_dh_state_attr); 238 253 } ··· 301 316 int err = 0; 302 317 unsigned long flags; 303 318 struct scsi_device *sdev; 304 - struct scsi_device_handler *scsi_dh = NULL; 305 319 struct device *dev = NULL; 306 320 307 321 spin_lock_irqsave(q->queue_lock, flags); ··· 313 329 return err; 314 330 } 315 331 316 - if (sdev->scsi_dh_data) 317 - scsi_dh = sdev->scsi_dh_data->scsi_dh; 318 332 dev = get_device(&sdev->sdev_gendev); 319 - if (!scsi_dh || !dev || 333 + if (!sdev->handler || !dev || 320 334 sdev->sdev_state == SDEV_CANCEL || 321 335 sdev->sdev_state == SDEV_DEL) 322 336 err = SCSI_DH_NOSYS; ··· 328 346 goto out; 329 347 } 330 348 331 - if (scsi_dh->activate) 332 - err = scsi_dh->activate(sdev, fn, data); 349 + if (sdev->handler->activate) 350 + err = sdev->handler->activate(sdev, fn, data); 333 351 out: 334 352 put_device(dev); 335 353 return err; ··· 351 369 int err = -SCSI_DH_NOSYS; 352 370 unsigned long flags; 353 371 struct scsi_device *sdev; 354 - struct scsi_device_handler *scsi_dh = NULL; 355 372 356 373 spin_lock_irqsave(q->queue_lock, flags); 357 374 sdev = q->queuedata; 358 - if (sdev && sdev->scsi_dh_data) 359 - scsi_dh = sdev->scsi_dh_data->scsi_dh; 360 - if (scsi_dh && scsi_dh->set_params && get_device(&sdev->sdev_gendev)) 375 + if (sdev->handler && 376 + sdev->handler->set_params && 377 + get_device(&sdev->sdev_gendev)) 361 378 err = 0; 362 379 spin_unlock_irqrestore(q->queue_lock, flags); 363 380 364 381 if (err) 365 382 return err; 366 - err = scsi_dh->set_params(sdev, params); 383 + err = sdev->handler->set_params(sdev, params); 367 384 put_device(&sdev->sdev_gendev); 368 385 return err; 369 386 } ··· 394 413 if (err) 395 414 return err; 396 415 397 - if (sdev->scsi_dh_data) { 398 - if (sdev->scsi_dh_data->scsi_dh != scsi_dh) 416 + if (sdev->handler) { 417 + if (sdev->handler != scsi_dh) 399 418 err = -EBUSY; 400 419 goto out_put_device; 401 420 } ··· 432 451 if (!sdev) 433 452 return NULL; 434 453 435 - if (sdev->scsi_dh_data) 436 - handler_name = kstrdup(sdev->scsi_dh_data->scsi_dh->name, gfp); 454 + if (sdev->handler) 455 + handler_name = kstrdup(sdev->handler->name, gfp); 437 456 438 457 put_device(&sdev->sdev_gendev); 439 458 return handler_name;
+3 -3
drivers/scsi/scsi_error.c
··· 37 37 #include <scsi/scsi_transport.h> 38 38 #include <scsi/scsi_host.h> 39 39 #include <scsi/scsi_ioctl.h> 40 + #include <scsi/scsi_dh.h> 40 41 #include <scsi/sg.h> 41 42 42 43 #include "scsi_priv.h" ··· 465 464 if (scsi_sense_is_deferred(&sshdr)) 466 465 return NEEDS_RETRY; 467 466 468 - if (sdev->scsi_dh_data && sdev->scsi_dh_data->scsi_dh && 469 - sdev->scsi_dh_data->scsi_dh->check_sense) { 467 + if (sdev->handler && sdev->handler->check_sense) { 470 468 int rc; 471 469 472 - rc = sdev->scsi_dh_data->scsi_dh->check_sense(sdev, &sshdr); 470 + rc = sdev->handler->check_sense(sdev, &sshdr); 473 471 if (rc != SCSI_RETURN_NOT_HANDLED) 474 472 return rc; 475 473 /* handler does not care. Drop down to default handling */
+3 -3
drivers/scsi/scsi_lib.c
··· 31 31 #include <scsi/scsi_driver.h> 32 32 #include <scsi/scsi_eh.h> 33 33 #include <scsi/scsi_host.h> 34 + #include <scsi/scsi_dh.h> 34 35 35 36 #include <trace/events/scsi.h> 36 37 ··· 1249 1248 { 1250 1249 struct scsi_cmnd *cmd = req->special; 1251 1250 1252 - if (unlikely(sdev->scsi_dh_data && sdev->scsi_dh_data->scsi_dh 1253 - && sdev->scsi_dh_data->scsi_dh->prep_fn)) { 1254 - int ret = sdev->scsi_dh_data->scsi_dh->prep_fn(sdev, req); 1251 + if (unlikely(sdev->handler && sdev->handler->prep_fn)) { 1252 + int ret = sdev->handler->prep_fn(sdev, req); 1255 1253 if (ret != BLKPREP_OK) 1256 1254 return ret; 1257 1255 }
+3 -22
include/scsi/scsi_device.h
··· 196 196 struct execute_work ew; /* used to get process context on put */ 197 197 struct work_struct requeue_work; 198 198 199 - struct scsi_dh_data *scsi_dh_data; 199 + struct scsi_device_handler *handler; 200 + void *handler_data; 201 + 200 202 enum scsi_device_state sdev_state; 201 203 unsigned long sdev_data[0]; 202 204 } __attribute__((aligned(sizeof(unsigned long)))); 203 - 204 - typedef void (*activate_complete)(void *, int); 205 - struct scsi_device_handler { 206 - /* Used by the infrastructure */ 207 - struct list_head list; /* list of scsi_device_handlers */ 208 - 209 - /* Filled by the hardware handler */ 210 - struct module *module; 211 - const char *name; 212 - int (*check_sense)(struct scsi_device *, struct scsi_sense_hdr *); 213 - struct scsi_dh_data *(*attach)(struct scsi_device *); 214 - void (*detach)(struct scsi_device *); 215 - int (*activate)(struct scsi_device *, activate_complete, void *); 216 - int (*prep_fn)(struct scsi_device *, struct request *); 217 - int (*set_params)(struct scsi_device *, const char *); 218 - }; 219 - 220 - struct scsi_dh_data { 221 - struct scsi_device_handler *scsi_dh; 222 - struct scsi_device *sdev; 223 - }; 224 205 225 206 #define to_scsi_device(d) \ 226 207 container_of(d, struct scsi_device, sdev_gendev)
+17
include/scsi/scsi_dh.h
··· 55 55 SCSI_DH_NOSYS, 56 56 SCSI_DH_DRIVER_MAX, 57 57 }; 58 + 59 + typedef void (*activate_complete)(void *, int); 60 + struct scsi_device_handler { 61 + /* Used by the infrastructure */ 62 + struct list_head list; /* list of scsi_device_handlers */ 63 + 64 + /* Filled by the hardware handler */ 65 + struct module *module; 66 + const char *name; 67 + int (*check_sense)(struct scsi_device *, struct scsi_sense_hdr *); 68 + int (*attach)(struct scsi_device *); 69 + void (*detach)(struct scsi_device *); 70 + int (*activate)(struct scsi_device *, activate_complete, void *); 71 + int (*prep_fn)(struct scsi_device *, struct request *); 72 + int (*set_params)(struct scsi_device *, const char *); 73 + }; 74 + 58 75 #ifdef CONFIG_SCSI_DH 59 76 extern int scsi_dh_activate(struct request_queue *, activate_complete, void *); 60 77 extern int scsi_dh_attach(struct request_queue *, const char *);