File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,7 +38,9 @@ ScsiBlockCmds::ScsiBlockCmds() {
3838 &ScsiBlockCmds::get_error_recovery_page);
3939}
4040
41- void ScsiBlockCmds::init_block_device (uint8_t medium_type, uint8_t dev_flags) {
41+ void ScsiBlockCmds::init_block_device (uint8_t medium_type, uint8_t dev_flags,
42+ uint8_t density_code)
43+ {
4244 this ->medium_type = medium_type;
4345 this ->device_flags = dev_flags;
4446
@@ -215,13 +217,11 @@ int ScsiBlockCmds::read_capacity() {
215217}
216218
217219int ScsiBlockCmds::format_block_descriptors (uint8_t * out_ptr) {
218- uint8_t density_code = 0 ;
219-
220220 uint32_t nblocks = std::min ((int64_t )this ->blk_dev ->get_size_in_blocks (),
221221 (int64_t )0xFFFFFFFFUL );
222222
223223 WRITE_DWORD_BE_A (&out_ptr[0 ], nblocks);
224- WRITE_DWORD_BE_A (&out_ptr[4 ], (density_code << 24 ) |
224+ WRITE_DWORD_BE_A (&out_ptr[4 ], (this -> density_code << 24 ) |
225225 (this ->blk_dev ->get_block_size () & 0xFFFFFF ));
226226
227227 return 8 ;
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ class ScsiBlockCmds : public ScsiCommonCmds {
3838 this ->blk_dev = blk_dev_obj;
3939 }
4040
41- void init_block_device (uint8_t medium_type, uint8_t dev_flags);
41+ void init_block_device (uint8_t medium_type, uint8_t dev_flags, uint8_t density_code );
4242
4343 virtual int read_new ();
4444 virtual int write_new ();
@@ -64,6 +64,7 @@ class ScsiBlockCmds : public ScsiCommonCmds {
6464
6565 uint8_t medium_type = 0 ;
6666 uint8_t device_flags = 0 ;
67+ uint8_t density_code = 0 ;
6768};
6869
6970#endif // SCSI_BLOCK_COMMANDS_H
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ void ScsiHardDisk::insert_image(std::string filename) {
6565
6666 this ->is_writeable = true ;
6767
68- this ->init_block_device (0 , 0 );
68+ this ->init_block_device (0 , 0 , 0 );
6969}
7070
7171void ScsiHardDisk::process_command () {
You can’t perform that action at this time.
0 commit comments