aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/scsi_cmnd.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsi/scsi_cmnd.h')
-rw-r--r--include/scsi/scsi_cmnd.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index a5e885a111df..377df4a28512 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -10,6 +10,7 @@
10 10
11struct Scsi_Host; 11struct Scsi_Host;
12struct scsi_device; 12struct scsi_device;
13struct scsi_driver;
13 14
14/* 15/*
15 * MAX_COMMAND_SIZE is: 16 * MAX_COMMAND_SIZE is:
@@ -131,6 +132,11 @@ struct scsi_cmnd {
131 unsigned char tag; /* SCSI-II queued command tag */ 132 unsigned char tag; /* SCSI-II queued command tag */
132}; 133};
133 134
135static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
136{
137 return *(struct scsi_driver **)cmd->request->rq_disk->private_data;
138}
139
134extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t); 140extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t);
135extern struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *, gfp_t); 141extern struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *, gfp_t);
136extern void scsi_put_command(struct scsi_cmnd *); 142extern void scsi_put_command(struct scsi_cmnd *);
@@ -289,17 +295,17 @@ static inline struct scsi_data_buffer *scsi_prot(struct scsi_cmnd *cmd)
289 295
290static inline void set_msg_byte(struct scsi_cmnd *cmd, char status) 296static inline void set_msg_byte(struct scsi_cmnd *cmd, char status)
291{ 297{
292 cmd->result |= status << 8; 298 cmd->result = (cmd->result & 0xffff00ff) | (status << 8);
293} 299}
294 300
295static inline void set_host_byte(struct scsi_cmnd *cmd, char status) 301static inline void set_host_byte(struct scsi_cmnd *cmd, char status)
296{ 302{
297 cmd->result |= status << 16; 303 cmd->result = (cmd->result & 0xff00ffff) | (status << 16);
298} 304}
299 305
300static inline void set_driver_byte(struct scsi_cmnd *cmd, char status) 306static inline void set_driver_byte(struct scsi_cmnd *cmd, char status)
301{ 307{
302 cmd->result |= status << 24; 308 cmd->result = (cmd->result & 0x00ffffff) | (status << 24);
303} 309}
304 310
305#endif /* _SCSI_SCSI_CMND_H */ 311#endif /* _SCSI_SCSI_CMND_H */