fix: toybox update

【背景】liteos_a toybox 命令已知问题修复

【修改方案】
1、修复ls 统计文件大小问题。

Signed-off-by: yansira <yansira@hotmail.com>
Change-Id: I64c41d3970650a434409f332b2659e31bb9223ab
This commit is contained in:
Kiita 2021-08-03 21:16:42 +08:00
parent d169cad6b4
commit c3245b3ce3
1 changed files with 9 additions and 1 deletions

View File

@ -449,6 +449,8 @@ static int fatfs_create_obj(struct Vnode *parent, const char *name, int mode, st
dp_new->obj.objsize = 0;
} else if (type == AM_LNK) {
dp_new->obj.objsize = strlen(target);
} else {
finfo_new->fsize = fs->csize * SS(fs);
}
ret = VnodeAlloc(&fatfs_vops, &vp);
@ -558,6 +560,7 @@ int fatfs_lookup(struct Vnode *parent, const char *path, int len, struct Vnode *
vp->mode = fatfs_get_mode(finfo->fattrib, fs->fs_mode);
if (finfo->fattrib & AM_DIR) {
vp->type = VNODE_TYPE_DIR;
finfo->fsize = fs->csize * SS(fs);
} else {
vp->type = VNODE_TYPE_REG;
}
@ -1182,6 +1185,7 @@ int fatfs_mount(struct Mount *mnt, struct Vnode *blk_device, const void *data)
dfp->fno.ftime = 0;
dfp->fno.fattrib = AM_DIR;
dfp->fno.sclst = 0;
dfp->fno.fsize = fs->csize * SS(fs);
dfp->fno.fname[0] = '/'; /* Mark as root dir */
dfp->fno.fname[1] = '\0';
LOS_ListInit(&(dfp->fno.fp_list));
@ -1413,7 +1417,11 @@ int fatfs_stat(struct Vnode *vp, struct stat* sp)
sp->st_gid = fs->fs_gid;
sp->st_size = finfo->fsize;
sp->st_blksize = fs->csize * SS(fs);
sp->st_blocks = finfo->fsize ? ((finfo->fsize - 1) / SS(fs) / fs->csize + 1) : 0;
if (finfo->fattrib & AM_ARC) {
sp->st_blocks = finfo->fsize ? ((finfo->fsize - 1) / SS(fs) / fs->csize + 1) : 0;
} else {
sp->st_blocks = fs->csize;
}
time = fattime_transfer(finfo->fdate, finfo->ftime);
sp->st_mtime = time;