diff options
author | Michael Brown <mcb30@etherboot.org> | 2009-08-09 15:30:07 +0100 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2009-08-10 19:30:41 +0100 |
commit | d94479468010ba2f64bc8664585e9c3491129303 (patch) | |
tree | fb48575d8470301f17e2a6ecd997fba2f40cef0f /src/net | |
parent | 976f12c50120637410f30c17f8fbfcd5a49ed8fd (diff) | |
download | ipxe-d94479468010ba2f64bc8664585e9c3491129303.zip ipxe-d94479468010ba2f64bc8664585e9c3491129303.tar.gz ipxe-d94479468010ba2f64bc8664585e9c3491129303.tar.bz2 |
[scsi] Generalise iscsi_parse_lun() to scsi_parse_lun()
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/tcp/iscsi.c | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/src/net/tcp/iscsi.c b/src/net/tcp/iscsi.c index 973718e..74da05d 100644 --- a/src/net/tcp/iscsi.c +++ b/src/net/tcp/iscsi.c @@ -1606,42 +1606,6 @@ enum iscsi_root_path_component { }; /** - * Parse iSCSI LUN - * - * @v iscsi iSCSI session - * @v lun_string LUN string representation (as per RFC4173) - * @ret rc Return status code - */ -static int iscsi_parse_lun ( struct iscsi_session *iscsi, - const char *lun_string ) { - union { - uint64_t u64; - uint16_t u16[4]; - } lun; - char *p; - int i; - - memset ( &lun, 0, sizeof ( lun ) ); - if ( lun_string ) { - p = ( char * ) lun_string; - - for ( i = 0 ; i < 4 ; i++ ) { - lun.u16[i] = htons ( strtoul ( p, &p, 16 ) ); - if ( *p == '\0' ) - break; - if ( *p != '-' ) - return -EINVAL; - p++; - } - if ( *p ) - return -EINVAL; - } - - iscsi->lun = lun.u64; - return 0; -} - -/** * Parse iSCSI root path * * @v iscsi iSCSI session @@ -1679,7 +1643,7 @@ static int iscsi_parse_root_path ( struct iscsi_session *iscsi, iscsi->target_port = strtoul ( rp_comp[RP_PORT], NULL, 10 ); if ( ! iscsi->target_port ) iscsi->target_port = ISCSI_PORT; - if ( ( rc = iscsi_parse_lun ( iscsi, rp_comp[RP_LUN] ) ) != 0 ) { + if ( ( rc = scsi_parse_lun ( rp_comp[RP_LUN], &iscsi->lun ) ) != 0 ) { DBGC ( iscsi, "iSCSI %p invalid LUN \"%s\"\n", iscsi, rp_comp[RP_LUN] ); return rc; |