|
@ -245,6 +245,7 @@ LOCAL int lfsFuncIoctl(LFS_FILE_DESC *pfd, int cmd, _Vx_ioctl_arg_t arg) |
|
|
int ret = OK; |
|
|
int ret = OK; |
|
|
const char *name; |
|
|
const char *name; |
|
|
DIR *dirp; |
|
|
DIR *dirp; |
|
|
|
|
|
size_t offset; |
|
|
struct lfs_info info; |
|
|
struct lfs_info info; |
|
|
lfsDrvCtrl *pDrvCtrl = pfd->ctrl; |
|
|
lfsDrvCtrl *pDrvCtrl = pfd->ctrl; |
|
|
|
|
|
|
|
@ -282,6 +283,15 @@ LOCAL int lfsFuncIoctl(LFS_FILE_DESC *pfd, int cmd, _Vx_ioctl_arg_t arg) |
|
|
strncpy(dirp->dd_dirent.d_name, info.name, _PARM_NAME_MAX + 1); |
|
|
strncpy(dirp->dd_dirent.d_name, info.name, _PARM_NAME_MAX + 1); |
|
|
dirp->dd_dirent.d_name[_PARM_NAME_MAX - 1] = EOS; |
|
|
dirp->dd_dirent.d_name[_PARM_NAME_MAX - 1] = EOS; |
|
|
break; |
|
|
break; |
|
|
|
|
|
case FIOSEEK: |
|
|
|
|
|
if (pfd->isDir) { |
|
|
|
|
|
errnoSet(EINVAL); |
|
|
|
|
|
ret = ERROR; |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
offset = (size_t)arg; |
|
|
|
|
|
lfs_file_seek(&pDrvCtrl->fsh, &pfd->u.file, offset, LFS_SEEK_SET); |
|
|
|
|
|
break; |
|
|
case FIOUNLINK: |
|
|
case FIOUNLINK: |
|
|
name = (const char *)arg; |
|
|
name = (const char *)arg; |
|
|
ret = lfs_remove(&pDrvCtrl->fsh, name); |
|
|
ret = lfs_remove(&pDrvCtrl->fsh, name); |
|
@ -290,8 +300,8 @@ LOCAL int lfsFuncIoctl(LFS_FILE_DESC *pfd, int cmd, _Vx_ioctl_arg_t arg) |
|
|
ret = OK; |
|
|
ret = OK; |
|
|
break; |
|
|
break; |
|
|
default: |
|
|
default: |
|
|
printf("unsupport ioctl: %d\n", cmd); |
|
|
printf("lfs unsupport ioctl: %d\n", cmd); |
|
|
errnoSet(EINVAL); |
|
|
errnoSet(ENOTSUP); |
|
|
ret = ERROR; |
|
|
ret = ERROR; |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
@ -355,7 +365,7 @@ LOCAL int lfsFlashProg(const struct lfs_config *cfg, lfs_block_t block, lfs_off_ |
|
|
lfsDrvCtrl *pDrvCtrl = cfg->context; |
|
|
lfsDrvCtrl *pDrvCtrl = cfg->context; |
|
|
UINT8 *buffers[2]; |
|
|
UINT8 *buffers[2]; |
|
|
|
|
|
|
|
|
buffers[0] = buffer; |
|
|
buffers[0] = (void *)buffer; |
|
|
buffers[1] = NULL; |
|
|
buffers[1] = NULL; |
|
|
pos = pDrvCtrl->flashOffset + block * cfg->block_size + off; |
|
|
pos = pDrvCtrl->flashOffset + block * cfg->block_size + off; |
|
|
|
|
|
|
|
|