Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _SCSI_SCSI_DRIVER_H
0003 #define _SCSI_SCSI_DRIVER_H
0004 
0005 #include <linux/blk_types.h>
0006 #include <linux/device.h>
0007 #include <scsi/scsi_cmnd.h>
0008 
0009 struct module;
0010 struct request;
0011 
0012 struct scsi_driver {
0013     struct device_driver    gendrv;
0014 
0015     void (*rescan)(struct device *);
0016     blk_status_t (*init_command)(struct scsi_cmnd *);
0017     void (*uninit_command)(struct scsi_cmnd *);
0018     int (*done)(struct scsi_cmnd *);
0019     int (*eh_action)(struct scsi_cmnd *, int);
0020     void (*eh_reset)(struct scsi_cmnd *);
0021 };
0022 #define to_scsi_driver(drv) \
0023     container_of((drv), struct scsi_driver, gendrv)
0024 
0025 extern int scsi_register_driver(struct device_driver *);
0026 #define scsi_unregister_driver(drv) \
0027     driver_unregister(drv);
0028 
0029 extern int scsi_register_interface(struct class_interface *);
0030 #define scsi_unregister_interface(intf) \
0031     class_interface_unregister(intf)
0032 
0033 /* make sure not to use it with passthrough commands */
0034 static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
0035 {
0036     return to_scsi_driver(cmd->device->sdev_gendev.driver);
0037 }
0038 
0039 #endif /* _SCSI_SCSI_DRIVER_H */