Message ID | 1234151988.8776.4.camel@localhost.localdomain (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
James Bottomley wrote: > On Mon, 2009-02-09 at 11:11 +1100, Benjamin Herrenschmidt wrote: >> The PS3 platform code wants to use some of the standard SCSI types from >> there though, as they are part of the hypervisor ABI. (And in fact it >> can be argued that non-block devices using SCSI do exist, such as >> scanners, no ?) >> >> Any reason other than pre-historical to have blkdev.h shielded like >> that ? > > Actually, I think the fix lies in scsi.h ... we can make that into a > nicely independent protocol header file. Your current woes come because > it pulls in scsi_cmnd.h ... perhaps just getting rid of this will fix > it. > > Can the rest of linux-scsi verify that the fix below doesn't break > something else? > > I found one cockup: block/cmd-filter.c is apparently not including > linuc/blkdev.h directly but via scsi/scsi.h ... I fixed this up. ... > diff --git a/block/cmd-filter.c b/block/cmd-filter.c > diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h I tested this scsi header fix on PS3 and it fixes the BLK_MAX_CDB not defined build error when CONFIG_BLOCK=n. Acked-by: Geoff Levand <geoffrey.levand@am.sony.com>
James Bottomley wrote: > Actually, I think the fix lies in scsi.h ... we can make that into a > nicely independent protocol header file. Your current woes come because > it pulls in scsi_cmnd.h ... perhaps just getting rid of this will fix > it. > > Can the rest of linux-scsi verify that the fix below doesn't break > something else? > > I found one cockup: block/cmd-filter.c is apparently not including > linuc/blkdev.h directly but via scsi/scsi.h ... I fixed this up. > Tested the patch and it fixes the issue. Thanks -Sachin
diff --git a/block/cmd-filter.c b/block/cmd-filter.c index 504b275..572bbc2 100644 --- a/block/cmd-filter.c +++ b/block/cmd-filter.c @@ -22,6 +22,7 @@ #include <linux/spinlock.h> #include <linux/capability.h> #include <linux/bitops.h> +#include <linux/blkdev.h> #include <scsi/scsi.h> #include <linux/cdrom.h> diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 80d7f60..084478e 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h @@ -9,7 +9,8 @@ #define _SCSI_SCSI_H #include <linux/types.h> -#include <scsi/scsi_cmnd.h> + +struct scsi_cmnd; /* * The maximum number of SG segments that we will put inside a @@ -439,22 +440,6 @@ static inline int scsi_is_wlun(unsigned int lun) #define host_byte(result) (((result) >> 16) & 0xff) #define driver_byte(result) (((result) >> 24) & 0xff) -static inline void set_msg_byte(struct scsi_cmnd *cmd, char status) -{ - cmd->result |= status << 8; -} - -static inline void set_host_byte(struct scsi_cmnd *cmd, char status) -{ - cmd->result |= status << 16; -} - -static inline void set_driver_byte(struct scsi_cmnd *cmd, char status) -{ - cmd->result |= status << 24; -} - - #define sense_class(sense) (((sense) >> 4) & 0x7) #define sense_error(sense) ((sense) & 0xf) #define sense_valid(sense) ((sense) & 0x80); diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 855bf95..43b50d3 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -291,4 +291,19 @@ static inline struct scsi_data_buffer *scsi_prot(struct scsi_cmnd *cmd) #define scsi_for_each_prot_sg(cmd, sg, nseg, __i) \ for_each_sg(scsi_prot_sglist(cmd), sg, nseg, __i) +static inline void set_msg_byte(struct scsi_cmnd *cmd, char status) +{ + cmd->result |= status << 8; +} + +static inline void set_host_byte(struct scsi_cmnd *cmd, char status) +{ + cmd->result |= status << 16; +} + +static inline void set_driver_byte(struct scsi_cmnd *cmd, char status) +{ + cmd->result |= status << 24; +} + #endif /* _SCSI_SCSI_CMND_H */