From 5ab64734f30add3ca2e6fdf8a06f1876a3509cf1 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Mon, 6 May 2013 15:58:53 +0000 Subject: [PATCH] Fix byte order of ATA WWN when converting it to SCSI LUN ID. --- sys/cam/ata/ata_xpt.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/cam/ata/ata_xpt.c b/sys/cam/ata/ata_xpt.c index f9c47ba581da..11d26504a363 100644 --- a/sys/cam/ata/ata_xpt.c +++ b/sys/cam/ata/ata_xpt.c @@ -834,6 +834,7 @@ device_fail: if ((path->device->flags & CAM_DEV_UNCONFIGURED) == 0) { struct ccb_pathinq cpi; int16_t *ptr; + int i; ident_buf = &softc->ident_data; for (ptr = (int16_t *)ident_buf; @@ -913,8 +914,10 @@ device_fail: if ((path->device->flags & CAM_DEV_UNCONFIGURED) == 0) path->device->device_id_len = 16; bcopy(&fake_device_id_hdr, path->device->device_id, 8); - bcopy(ident_buf->wwn, - path->device->device_id + 8, 8); + for (i = 0; i < 4; i++) { + ptr = (int16_t *)(path->device->device_id + 8); + ptr[i] = bswap16(ident_buf->wwn[i]); + } } }