@@ -1214,7 +1214,7 @@ sg_receive_v4(struct sg_fd *sfp, struct sg_request *srp, void __user *p,
h4p->din_resid = srp->in_resid;
h4p->dout_resid = srp->s_hdr4.out_resid;
h4p->usr_ptr = srp->s_hdr4.usr_ptr;
- h4p->response = (u64)srp->s_hdr4.sbp;
+ h4p->response = (uintptr_t)srp->s_hdr4.sbp;
h4p->request_extra = srp->pack_id;
if (p) {
if (copy_to_user(p, h4p, SZ_SG_IO_V4))
@@ -1779,6 +1779,7 @@ static int
sg_ctl_scsi_id(struct scsi_device *sdev, struct sg_fd *sfp, void __user *p)
{
struct sg_scsi_id ss_id;
+ struct scsi_lun lun8b;
SG_LOG(3, sfp, "%s: SG_GET_SCSI_ID\n", __func__);
ss_id.host_no = sdev->host->host_no;
@@ -1788,8 +1789,9 @@ sg_ctl_scsi_id(struct scsi_device *sdev, struct sg_fd *sfp, void __user *p)
ss_id.scsi_type = sdev->type;
ss_id.h_cmd_per_lun = sdev->host->cmd_per_lun;
ss_id.d_queue_depth = sdev->queue_depth;
- ss_id.unused[0] = 0;
- ss_id.unused[1] = 0;
+ int_to_scsilun(sdev->lun, &lun8b);
+ /* ss_id.scsi_lun is in an anonymous union with 'int unused[2]' */
+ memcpy(ss_id.scsi_lun, lun8b.scsi_lun, 8);
if (copy_to_user(p, &ss_id, sizeof(struct sg_scsi_id)))
return -EFAULT;
return 0;
@@ -170,7 +170,10 @@ typedef struct sg_scsi_id {
int scsi_type; /* TYPE_... defined in scsi/scsi.h */
short h_cmd_per_lun;/* host (adapter) maximum commands per lun */
short d_queue_depth;/* device (or adapter) maximum queue length */
- int unused[2];
+ union {
+ int unused[2]; /* as per version 3 driver */
+ __u8 scsi_lun[8]; /* full 8 byte SCSI LUN [in v4 driver] */
+ };
} sg_scsi_id_t;
/* For backward compatibility v4 driver yields at most SG_MAX_QUEUE of these */