Skip to content

Commit 3c93034

Browse files
authored
Merge pull request #865 from pcm720/ps2hdd-mount-fixes
PS2HDD: make getFileSlot aware of the unit number
2 parents cbca54a + 394e0cc commit 3c93034

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

iop/hdd/apa/src/hdd_fio.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static const char *sizeList[APA_NUMBER_OF_SIZES] = {
8181
static int fioPartitionSizeLookUp(char *str);
8282
static int fioInputBreaker(char const **arg, char *outBuf, int maxout);
8383
static int fioDataTransfer(iomanX_iop_file_t *f, void *buf, int size, int mode);
84-
static int getFileSlot(apa_params_t *params, hdd_file_slot_t **fileSlot);
84+
static int getFileSlot(apa_params_t *params, hdd_file_slot_t **fileSlot, iomanX_iop_file_t *file);
8585
static int ioctl2Transfer(s32 device, hdd_file_slot_t *fileSlot, hddIoctl2Transfer_t *arg);
8686
static void fioGetStatFiller(apa_cache_t *clink1, iox_stat_t *stat);
8787
static int ioctl2AddSub(hdd_file_slot_t *fileSlot, char *argp);
@@ -213,13 +213,13 @@ static int fioGetInput(const char *arg, apa_params_t *params)
213213
return rv;
214214
}
215215

216-
static int getFileSlot(apa_params_t *params, hdd_file_slot_t **fileSlot)
216+
static int getFileSlot(apa_params_t *params, hdd_file_slot_t **fileSlot, iomanX_iop_file_t *file)
217217
{
218218
int i;
219219

220220
for (i = 0; i < apaMaxOpen; i++) {
221221
if (hddFileSlots[i].f)
222-
if (memcmp(hddFileSlots[i].id, &params->id, APA_IDMAX) == 0)
222+
if ((hddFileSlots[i].f->unit == file->unit) && (memcmp(hddFileSlots[i].id, &params->id, APA_IDMAX) == 0))
223223
return -EBUSY; // file is open
224224
}
225225
for (i = 0; i < apaMaxOpen; i++) {
@@ -614,7 +614,7 @@ int hddOpen(iomanX_iop_file_t *f, const char *name, int flags, int mode)
614614
return rv;
615615

616616
WaitSema(fioSema);
617-
if ((rv = getFileSlot(&params, &fileSlot)) == 0) {
617+
if ((rv = getFileSlot(&params, &fileSlot, f)) == 0) {
618618
if (!(f->mode & FIO_O_DIROPEN)) {
619619
if ((rv = apaOpen(f->unit, fileSlot, &params, flags)) == 0) {
620620
fileSlot->f = f;

0 commit comments

Comments
 (0)