Skip to content

Commit

Permalink
Reuse m_buf and allow for 100 files
Browse files Browse the repository at this point in the history
  • Loading branch information
erichelgeson committed Oct 24, 2023
1 parent 8c4b97a commit eabc7f4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/BlueSCSI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1833,8 +1833,8 @@ byte onModeSense(SCSI_DEVICE *dev, const byte *cdb)
byte onListFiles(SCSI_DEVICE *dev, const byte *cdb) {
File dir;
File file;
// FileEntry names[512];
char names[512] ={0};

memset(m_buf, 0, 4096);
int ENTRY_SIZE = 40;
char name[MAX_MAC_PATH + 1];
dir.open("/shared");
Expand All @@ -1861,11 +1861,11 @@ byte onListFiles(SCSI_DEVICE *dev, const byte *cdb) {
file_entry[37] = (size >> 16) & 0xff;
file_entry[38] = (size >> 8) & 0xff;
file_entry[39] = (size) & 0xff;
memcpy(&(names[ENTRY_SIZE * index]), file_entry, ENTRY_SIZE);
memcpy(&(m_buf[ENTRY_SIZE * index]), file_entry, ENTRY_SIZE);
index = index + 1;
}
dir.close();
writeDataPhase(512, (const byte *)names);
writeDataPhase(4096, (const byte *)m_buf);
return SCSI_STATUS_GOOD;
}

Expand Down Expand Up @@ -1894,7 +1894,7 @@ byte onCountFiles(SCSI_DEVICE *dev, const byte *cdb) {
dir.close();
LOG_FILE.println(index);
LOG_FILE.sync();
if(index > 255) {
if(index > 100) {
dev->m_senseKey = SCSI_SENSE_ILLEGAL_REQUEST;
dev->m_additional_sense_code = OPEN_RETRO_SCSI_TOO_MANY_FILES;
return SCSI_STATUS_CHECK_CONDITION;
Expand Down

0 comments on commit eabc7f4

Please sign in to comment.