Skip to content

Commit

Permalink
idk
Browse files Browse the repository at this point in the history
  • Loading branch information
Rezia23 committed Jun 10, 2021
1 parent 2430635 commit 6b5c0bc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions 3/solution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ struct openFileEntry{
};
class CFileSystem {
public:
CFileSystem(TBlkDev & oldDev) : dev(move(oldDev)){}
CFileSystem(TBlkDev oldDev) : dev((oldDev)){}

static bool CreateFs(const TBlkDev &dev);

Expand Down Expand Up @@ -132,9 +132,10 @@ class CFileSystem {

openFileEntry openFiles[OPEN_FILES_MAX];
size_t filesOpened = 0;
static void writeInfoData(const void * data, size_t len, const TBlkDev & dev, size_t numSectorsUsed){
static void writeInfoData(FileSystemInfo & data, size_t len, const TBlkDev & dev, size_t numSectorsUsed){
char * mem = new char [numSectorsUsed*SECTOR_SIZE];
memcpy(mem, (char * )data, len);
memset(mem, 0, numSectorsUsed*SECTOR_SIZE);
memcpy(mem, &data, len);
dev.m_Write(0, mem, numSectorsUsed);
}
int openExisting(const char * fileName, bool writeMode);
Expand Down Expand Up @@ -418,7 +419,7 @@ bool CFileSystem::CreateFs(const TBlkDev &dev) {
numSectorsForMetadata++;
}
fsInfo.useFirstNBlocks(numSectorsForMetadata);
writeInfoData(&fsInfo, sizeof(fsInfo), dev, numSectorsForMetadata);
writeInfoData(fsInfo, sizeof(fsInfo), dev, numSectorsForMetadata);
return true;
}

Expand Down

0 comments on commit 6b5c0bc

Please sign in to comment.