diff options
author | Bart Van Assche <bart.vanassche@sandisk.com> | 2015-05-08 11:07:48 +0300 |
---|---|---|
committer | James Bottomley <JBottomley@Odin.com> | 2015-06-01 17:32:43 +0300 |
commit | 07e3842055c391e611dd907c81760f4c705f9acb (patch) | |
tree | 56005ced37b31c082fa984981a8073a241ff3839 /drivers/scsi/scsi_scan.c | |
parent | c5f1ac8b94bd10f97f5aa1a3279ad8e8bbc6311a (diff) | |
download | linux-07e3842055c391e611dd907c81760f4c705f9acb.tar.xz |
Move code that is used both by initiator and target drivers
Move the functions that are used by both the initiator and target
subsystems into scsi_common.c/.h. This change will allow to remove
the initiator SCSI header include directives from most SCSI target
source files in a later patch.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Diffstat (limited to 'drivers/scsi/scsi_scan.c')
-rw-r--r-- | drivers/scsi/scsi_scan.c | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 53a2e3391454..f9f3f8203d42 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -1270,68 +1270,6 @@ static void scsi_sequential_lun_scan(struct scsi_target *starget, } /** - * scsilun_to_int - convert a scsi_lun to an int - * @scsilun: struct scsi_lun to be converted. - * - * Description: - * Convert @scsilun from a struct scsi_lun to a four byte host byte-ordered - * integer, and return the result. The caller must check for - * truncation before using this function. - * - * Notes: - * For a description of the LUN format, post SCSI-3 see the SCSI - * Architecture Model, for SCSI-3 see the SCSI Controller Commands. - * - * Given a struct scsi_lun of: d2 04 0b 03 00 00 00 00, this function - * returns the integer: 0x0b03d204 - * - * This encoding will return a standard integer LUN for LUNs smaller - * than 256, which typically use a single level LUN structure with - * addressing method 0. - **/ -u64 scsilun_to_int(struct scsi_lun *scsilun) -{ - int i; - u64 lun; - - lun = 0; - for (i = 0; i < sizeof(lun); i += 2) - lun = lun | (((u64)scsilun->scsi_lun[i] << ((i + 1) * 8)) | - ((u64)scsilun->scsi_lun[i + 1] << (i * 8))); - return lun; -} -EXPORT_SYMBOL(scsilun_to_int); - -/** - * int_to_scsilun - reverts an int into a scsi_lun - * @lun: integer to be reverted - * @scsilun: struct scsi_lun to be set. - * - * Description: - * Reverts the functionality of the scsilun_to_int, which packed - * an 8-byte lun value into an int. This routine unpacks the int - * back into the lun value. - * - * Notes: - * Given an integer : 0x0b03d204, this function returns a - * struct scsi_lun of: d2 04 0b 03 00 00 00 00 - * - **/ -void int_to_scsilun(u64 lun, struct scsi_lun *scsilun) -{ - int i; - - memset(scsilun->scsi_lun, 0, sizeof(scsilun->scsi_lun)); - - for (i = 0; i < sizeof(lun); i += 2) { - scsilun->scsi_lun[i] = (lun >> 8) & 0xFF; - scsilun->scsi_lun[i+1] = lun & 0xFF; - lun = lun >> 16; - } -} -EXPORT_SYMBOL(int_to_scsilun); - -/** * scsi_report_lun_scan - Scan using SCSI REPORT LUN results * @starget: which target * @bflags: Zero or a mix of BLIST_NOLUN, BLIST_REPORTLUN2, or BLIST_NOREPORTLUN |