fix: toybox命令升级

【背景】liteos_a toybox 命令升级升级

【修改方案】
1、help命令列表不支持命令删除。
2、cp命令和mv命令拷贝文件失败和文件损坏等问题修复。
3、修复du命令统计nfs文件大小为0问题修复。
4、修复ls命令nfs文件时间打印信息有误问题。
5、更新命令不支持入参列表。

re #I41N2A

Signed-off-by: yansira <yansira@hotmail.com>
Change-Id: I5f5b82e33ba9193ae06e9547182d5b7bac0a3b44
This commit is contained in:
Kiita 2021-07-19 19:20:52 +08:00
parent aaa9018acf
commit 76f45b3fb2
5 changed files with 24 additions and 9 deletions

View File

@ -1,7 +1,6 @@
CONFIG_GETTY=y
CONFIG_MDEV=y
CONFIG_MDEV_CONF=y
# CONFIG_BASENAME is not set
# CONFIG_CAL is not set
# CONFIG_CAT is not set
# CONFIG_CATV is not set
# CONFIG_CKSUM is not set
# CONFIG_CRC32 is not set
@ -13,6 +12,7 @@ CONFIG_MDEV_CONF=y
# CONFIG_CUT is not set
# CONFIG_DF is not set
# CONFIG_DIRNAME is not set
# CONFIG_ECHO is not set
# CONFIG_ENV is not set
# CONFIG_EXPAND is not set
# CONFIG_FALSE is not set
@ -178,3 +178,9 @@ CONFIG_MDEV_CONF=y
# CONFIG_SEQ is not set
# CONFIG_SU is not set
# CONFIG_SYNC is not set
#
# pending (see toys/pending/README)
#
# CONFIG_GETTY is not set
# CONFIG_MDEV is not set
# CONFIG_MDEV_CONF is not set

View File

@ -1416,6 +1416,9 @@ int fatfs_stat(struct Vnode *vp, struct stat* sp)
time = fattime_transfer(finfo->fdate, finfo->ftime);
sp->st_mtime = time;
/* Adapt to kstat member "long tv_sec" */
sp->__st_mtim32.tv_sec = (long)time;
unlock_fs(fs, FR_OK);
return 0;
}

View File

@ -807,6 +807,11 @@ int VfsJffs2Stat(struct Vnode *pVnode, struct stat *buf)
buf->st_mtime = node->i_mtime;
buf->st_ctime = node->i_ctime;
/* Adapt to kstat member long tv_sec */
buf->__st_atim32.tv_sec = (long)node->i_atime;
buf->__st_mtim32.tv_sec = (long)node->i_mtime;
buf->__st_ctim32.tv_sec = (long)node->i_ctime;
LOS_MuxUnlock(&g_jffs2FsLock);
return 0;

View File

@ -1206,7 +1206,7 @@ OUT:
return ret;
}
int SysStat(const char *path, struct stat *buf)
int SysStat(const char *path, struct kstat *buf)
{
int ret;
char *pathRet = NULL;
@ -1225,7 +1225,7 @@ int SysStat(const char *path, struct stat *buf)
goto OUT;
}
ret = LOS_ArchCopyToUser(buf, &bufRet, sizeof(struct stat));
ret = LOS_ArchCopyToUser(buf, &bufRet, sizeof(struct kstat));
if (ret != 0) {
ret = -EFAULT;
}
@ -1237,7 +1237,7 @@ OUT:
return ret;
}
int SysLstat(const char *path, struct stat *buffer)
int SysLstat(const char *path, struct kstat *buffer)
{
int ret;
char *pathRet = NULL;
@ -1256,7 +1256,7 @@ int SysLstat(const char *path, struct stat *buffer)
goto OUT;
}
ret = LOS_ArchCopyToUser(buffer, &bufRet, sizeof(struct stat));
ret = LOS_ArchCopyToUser(buffer, &bufRet, sizeof(struct kstat));
if (ret != 0) {
ret = -EFAULT;
}

View File

@ -55,6 +55,7 @@
#include "time.h"
#include "sys/time.h"
#include "sys/stat.h"
#include "sys/kstat.h"
#ifdef LOSCFG_FS_VFS
#include "sys/socket.h"
#include "dirent.h"
@ -252,8 +253,8 @@ extern int SysFtruncate(int fd, off_t length);
extern int SysStatfs(const char *path, struct statfs *buf);
extern int SysStatfs64(const char *path, size_t sz, struct statfs *buf);
extern int SysStat(const char *path, struct stat *buf);
extern int SysLstat(const char *path, struct stat *buffer);
extern int SysStat(const char *path, struct kstat *buf);
extern int SysLstat(const char *path, struct kstat *buffer);
extern int SysFstat(int fildes, struct stat *buf);
extern int SysStatx(int fd, const char *restrict path, int flag, unsigned mask, struct statx *restrict stx);
extern int SysFsync(int fd);