@@ -91,7 +91,7 @@ scsi::~scsi()
91
91
// 0: pointer
92
92
// 1: size of data
93
93
// 2: how much is allowed to be written of it by iSCSI layer
94
- std::optional<scsi_response> scsi::send (const uint64_t lun, const uint8_t *const CDB, const size_t size, std::tuple <uint8_t *, size_t > data)
94
+ std::optional<scsi_response> scsi::send (const uint64_t lun, const uint8_t *const CDB, const size_t size, std::pair <uint8_t *, size_t > data)
95
95
{
96
96
assert (size >= 16 );
97
97
@@ -397,11 +397,11 @@ std::optional<scsi_response> scsi::send(const uint64_t lun, const uint8_t *const
397
397
DOLOG (logging::ll_debug, " scsi::send" , lun_identifier, " WRITE_1x parameters invalid" );
398
398
response.sense_data = vr.value ();
399
399
}
400
- else if (std::get< 0 >( data) ) {
401
- DOLOG (logging::ll_debug, " scsi::send" , lun_identifier, " write command includes data (%zu bytes)" , std::get< 1 >( data) );
400
+ else if (data. first ) {
401
+ DOLOG (logging::ll_debug, " scsi::send" , lun_identifier, " write command includes data (%zu bytes)" , data. second );
402
402
403
403
size_t expected_size = transfer_length * backend_block_size;
404
- size_t received_size = std::get< 1 >( data) ;
404
+ size_t received_size = data. second ;
405
405
size_t received_blocks = received_size / backend_block_size;
406
406
if (received_blocks)
407
407
DOLOG (logging::ll_debug, " scsi::send" , lun_identifier, " WRITE_xx to LBA %" PRIu64 " is %zu in bytes, %zu bytes" , lba, lba * backend_block_size, received_size);
@@ -411,7 +411,7 @@ std::optional<scsi_response> scsi::send(const uint64_t lun, const uint8_t *const
411
411
412
412
uint32_t work_n_blocks = std::min (transfer_length, uint32_t (received_blocks));
413
413
if (received_blocks > 0 ) {
414
- rc = write (lba, work_n_blocks, std::get< 0 >( data) );
414
+ rc = write (lba, work_n_blocks, data. first );
415
415
ok = rc == scsi_rw_result::rw_ok;
416
416
}
417
417
@@ -422,7 +422,7 @@ std::optional<scsi_response> scsi::send(const uint64_t lun, const uint8_t *const
422
422
// received_blocks is rounded down above
423
423
rc = read (lba + work_n_blocks, 1 , temp_buffer);
424
424
if (rc == scsi_rw_result::rw_ok) {
425
- memcpy (temp_buffer, &std::get< 0 >( data) [work_n_blocks * backend_block_size], fragment_size);
425
+ memcpy (temp_buffer, &data. first [work_n_blocks * backend_block_size], fragment_size);
426
426
rc = write (lba + received_blocks, 1 , temp_buffer);
427
427
}
428
428
@@ -597,8 +597,8 @@ std::optional<scsi_response> scsi::send(const uint64_t lun, const uint8_t *const
597
597
598
598
auto block_size = b->get_block_size ();
599
599
auto expected_data_size = block_size * block_count * 2 ;
600
- if (expected_data_size != std::get< 1 >( data) )
601
- DOLOG (logging::ll_warning, " scsi::send" , lun_identifier, " COMPARE AND WRITE: data count mismatch (%zu versus %zu)" , size_t (expected_data_size), std::get< 1 >( data) );
600
+ if (expected_data_size != data. second )
601
+ DOLOG (logging::ll_warning, " scsi::send" , lun_identifier, " COMPARE AND WRITE: data count mismatch (%zu versus %zu)" , size_t (expected_data_size), data. second );
602
602
603
603
response.amount_of_data_expected = expected_data_size;
604
604
@@ -612,7 +612,7 @@ std::optional<scsi_response> scsi::send(const uint64_t lun, const uint8_t *const
612
612
response.sense_data = error_compare_and_write_count ();
613
613
}
614
614
else {
615
- auto result = cmpwrite (lba, block_count, &std::get< 0 >( data) [block_count * block_size], &std::get< 0 >( data) [0 ]);
615
+ auto result = cmpwrite (lba, block_count, &data. first [block_count * block_size], &data. first [0 ]);
616
616
617
617
if (result == scsi_rw_result::rw_ok)
618
618
response.type = ir_empty_sense;
@@ -674,9 +674,9 @@ std::optional<scsi_response> scsi::send(const uint64_t lun, const uint8_t *const
674
674
else if (opcode == o_unmap) {
675
675
DOLOG (logging::ll_debug, " scsi::send" , lun_identifier, " UNMAP" );
676
676
677
- const uint8_t *const pd = std::get< 0 >( data) ;
677
+ const uint8_t *const pd = data. first ;
678
678
scsi_rw_result rc = rw_ok;
679
- for (size_t i=8 ; i<std::get< 1 >( data) ; i+= 16 ) {
679
+ for (size_t i=8 ; i<data. second ; i+= 16 ) {
680
680
uint64_t lba = get_uint64_t (&pd[i]);
681
681
uint32_t transfer_length = get_uint32_t (&pd[i + 8 ]);
682
682
@@ -742,11 +742,11 @@ std::optional<scsi_response> scsi::send(const uint64_t lun, const uint8_t *const
742
742
DOLOG (logging::ll_debug, " scsi::send" , lun_identifier, " WRITE_SAME parameters invalid" );
743
743
response.sense_data = vr.value ();
744
744
}
745
- else if (std::get< 0 >( data) ) {
746
- DOLOG (logging::ll_debug, " scsi::send" , lun_identifier, " WRITE SAME command includes data (%zu bytes)" , std::get< 1 >( data) );
745
+ else if (data. first ) {
746
+ DOLOG (logging::ll_debug, " scsi::send" , lun_identifier, " WRITE SAME command includes data (%zu bytes)" , data. second );
747
747
748
- size_t received_size = std::get< 1 >( data) ;
749
- size_t received_blocks = received_size / backend_block_size;
748
+ size_t received_size = data. second ;
749
+ size_t received_blocks = received_size / backend_block_size;
750
750
751
751
bool ok = true ;
752
752
@@ -763,7 +763,7 @@ std::optional<scsi_response> scsi::send(const uint64_t lun, const uint8_t *const
763
763
for (uint32_t i=0 ; i<transfer_length; i++) {
764
764
rc = response.r2t .write_same_is_unmap ?
765
765
trim (lba, 1 ) :
766
- write (lba, 1 , std::get< 0 >( data) );
766
+ write (lba, 1 , data. first );
767
767
if (rc != rw_ok)
768
768
break ;
769
769
0 commit comments