Пример #1
0
FSStatus
FSOpenDirAsync(FSClient *client, FSCmdBlock *block, const char *path, be_val<FSDirectoryHandle> *handle, uint32_t flags, FSAsyncData *asyncData)
{
   assert(asyncData->callback);
   auto result = FSOpenDir(client, block, path, handle, flags);
   FSAsyncCallback cb = static_cast<uint32_t>(asyncData->callback);
   cb(client, block, result, asyncData->param);
   return result;
}
Пример #2
0
FSStatus
SAVEOpenDir(FSClient *client,
            FSCmdBlock *block,
            uint8_t account,
            const char *path,
            be_val<FSDirectoryHandle> *handle,
            uint32_t flags)
{
   auto fsPath = internal::getSavePath(account, path);
   return FSOpenDir(client, block, fsPath.path().c_str(), handle, flags);
}
static DIR_ITER* FSDrvDirOpen(struct _reent* r, DIR_ITER* dirState, const char* path) {
    FSDirHandle* handle = (FSDirHandle*) dirState->dirStruct;

    FSStatus err = FSOpenDir(fsClient, fsCmdBlock, path, handle, FS_RET_ALL_ERROR);
    if(err != FS_STATUS_OK) {
        FSDrvReportError(r);
        return NULL;
    }

    return dirState;
}
Пример #4
0
static DIR_ITER *sd_fat_diropen_r (struct _reent *r, DIR_ITER *dirState, const char *path)
{
    sd_fat_private_t *dev = sd_fat_get_device_data(path);
    if(!dev) {
        r->_errno = ENODEV;
        return NULL;
    }

    sd_fat_dir_entry_t *dirIter = (sd_fat_dir_entry_t *)dirState->dirStruct;

    OSLockMutex(dev->pMutex);

    char *real_path = sd_fat_real_path(path, dev);
    if(!real_path) {
        r->_errno = ENOMEM;
        OSUnlockMutex(dev->pMutex);
        return NULL;
    }

    int dirHandle;

    int result = FSOpenDir(dev->pClient, dev->pCmd, real_path, (FSDirectoryHandle*)&dirHandle, -1);

    free(real_path);

    OSUnlockMutex(dev->pMutex);

    if(result < 0)
    {
        r->_errno = result;
        return NULL;
    }

    dirIter->dev = dev;
    dirIter->dirHandle = dirHandle;

    return dirState;
}