MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / CARDDeleteAsync

Function CARDDeleteAsync

src/dolphin/src/card/CARDDelete.c:37–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37s32 CARDDeleteAsync(s32 chan, const char* fileName, CARDCallback callback)
38{
39 CARDControl* card;
40 s32 fileNo;
41 s32 result;
42 CARDDir* dir;
43 CARDDir* ent;
44
45 result = __CARDGetControlBlock(chan, &card);
46 if (result < 0)
47 {
48 return result;
49 }
50 result = __CARDGetFileNo(card, fileName, &fileNo);
51 if (result < 0)
52 {
53 return __CARDPutControlBlock(card, result);
54 }
55 if (__CARDIsOpened(card, fileNo))
56 {
57 return __CARDPutControlBlock(card, CARD_RESULT_BUSY);
58 }
59
60 dir = __CARDGetDirBlock(card);
61 ent = &dir[fileNo];
62 card->startBlock = ent->startBlock;
63 memset(ent, 0xff, sizeof(CARDDir));
64
65 card->apiCallback = callback ? callback : __CARDDefaultApiCallback;
66 result = __CARDUpdateDir(chan, DeleteCallback);
67 if (result < 0)
68 {
69 __CARDPutControlBlock(card, result);
70 }
71 return result;
72}
73
74s32 CARDDelete(s32 chan, const char* fileName)
75{

Callers 1

CARDDeleteFunction · 0.85

Calls 7

__CARDGetControlBlockFunction · 0.85
__CARDGetFileNoFunction · 0.85
__CARDPutControlBlockFunction · 0.85
__CARDIsOpenedFunction · 0.85
__CARDGetDirBlockFunction · 0.85
memsetFunction · 0.85
__CARDUpdateDirFunction · 0.85

Tested by

no test coverage detected