提交 88358ab3 编写于 作者: O openharmony_ci 提交者: Gitee

!480 A核代码告警清零

Merge pull request !480 from wangchen/a_codex
......@@ -59,17 +59,17 @@ int uname(struct utsname *name)
if (name == NULL) {
return -EFAULT;
}
(VOID)strncpy_s(name->sysname, sizeof(name->sysname), KERNEL_NAME, strlen(KERNEL_NAME) + 1);
(VOID)strncpy_s(name->nodename, sizeof(name->nodename), "hisilicon", strlen("hisilicon") + 1);
ret = snprintf_s(name->version, sizeof(name->version), sizeof(name->version) - 1, "%s %u.%u.%u.%u %s %s",
(VOID)strcpy_s(name->sysname, sizeof(name->sysname), KERNEL_NAME);
(VOID)strcpy_s(name->nodename, sizeof(name->nodename), "hisilicon");
ret = sprintf_s(name->version, sizeof(name->version), "%s %u.%u.%u.%u %s %s",
KERNEL_NAME, KERNEL_MAJOR, KERNEL_MINOR, KERNEL_PATCH, KERNEL_ITRE, __DATE__, __TIME__);
if (ret < 0) {
return -EIO;
}
cpuInfo = LOS_CpuInfo();
(VOID)strncpy_s(name->machine, sizeof(name->machine), cpuInfo, sizeof(name->machine));
ret = snprintf_s(name->release, sizeof(name->release), sizeof(name->release) - 1, "%u.%u.%u.%u",
(VOID)strcpy_s(name->machine, sizeof(name->machine), cpuInfo);
ret = sprintf_s(name->release, sizeof(name->release), "%u.%u.%u.%u",
KERNEL_MAJOR, KERNEL_MINOR, KERNEL_PATCH, KERNEL_ITRE);
if (ret < 0) {
return -EIO;
......
......@@ -239,7 +239,7 @@ static mode_t fatfs_get_mode(BYTE attribute, mode_t fs_mode)
return fs_mode;
}
static enum VnodeType fatfstype_2_vnodetype(BYTE type)
static enum VnodeType fatfstype_2_vnodetype(BYTE type)
{
switch (type) {
case AM_ARC:
......@@ -292,7 +292,8 @@ static FRESULT init_cluster(DIR_FILE *pdfp, DIR *dp_new, FATFS *fs, int type, co
} else {
/* Write the dir cluster */
mem_set(dir, 0, SS(fs));
mem_set(dir + DIR_Name, ' ', 11); /* Create "." entry */
/* 11, the The max length of of the short file name, Create "." entry */
mem_set(dir + DIR_Name, ' ', 11);
dir[DIR_Name] = '.';
dir[DIR_Attr] = AM_DIR;
st_clust(fs, dir, *clust);
......
......@@ -37,12 +37,11 @@
#define _MAX_ENTRYLENGTH 16 /* MAX virtual partition name length */
#define _MAX_VIRVOLUMES 5 /* MAX virtual partition number */
typedef struct virtual_partition_info
{
char *devpartpath; /* need set virtual partition, e.g. /dev/mmcblk0p0 */
int virpartnum; /* virtual partition numbers, MAX number is 5 */
double virpartpercent[_MAX_VIRVOLUMES]; /* every virtual partition percent,e.g 0.6,0.3,0.1 */
char virpartname[_MAX_VIRVOLUMES][_MAX_ENTRYLENGTH + 1]; /* every virtual partition name, MAX length is 16 */
typedef struct virtual_partition_info {
char *devpartpath; /* need set virtual partition, e.g. /dev/mmcblk0p0 */
int virpartnum; /* virtual partition numbers, MAX number is 5 */
double virpartpercent[_MAX_VIRVOLUMES]; /* every virtual partition percent,e.g 0.6,0.3,0.1 */
char virpartname[_MAX_VIRVOLUMES][_MAX_ENTRYLENGTH + 1]; /* every virtual partition name, MAX length is 16 */
} virpartinfo;
extern char g_devPartName[DISK_NAME + 1];
......
......@@ -205,7 +205,7 @@ int VfsJffs2Lookup(struct Vnode *parentVnode, const char *path, int len, struct
if (newVnode) {
if (newVnode->data == NULL) {
LOS_Panic("#####VfsHashGet error#####\n");
}
}
newVnode->parent = parentVnode;
*ppVnode = newVnode;
return 0;
......@@ -591,13 +591,16 @@ int VfsJffs2Chattr(struct Vnode *pVnode, struct IATTR *attr)
int VfsJffs2Rmdir(struct Vnode *parentVnode, struct Vnode *targetVnode, const char *path)
{
int ret;
struct jffs2_inode *parentInode = (struct jffs2_inode *)parentVnode->data;
struct jffs2_inode *targetInode = (struct jffs2_inode *)targetVnode->data;
struct jffs2_inode *parentInode = NULL;
struct jffs2_inode *targetInode = NULL;
if (!parentVnode || !targetVnode) {
return -EINVAL;
}
parentInode = (struct jffs2_inode *)parentVnode->data;
targetInode = (struct jffs2_inode *)targetVnode->data;
LOS_MuxLock(&g_jffs2FsLock, (uint32_t)JFFS2_WAITING_FOREVER);
ret = jffs2_rmdir(parentInode, targetInode, (const unsigned char *)path);
......
......@@ -40,7 +40,8 @@
#define CLEAR_PATH_CACHE "clear pathcache"
#define CLEAR_PAGE_CACHE "clear pagecache"
static char* VnodeTypeToStr(enum VnodeType type) {
static char* VnodeTypeToStr(enum VnodeType type)
{
switch (type) {
case VNODE_TYPE_UNKNOWN:
return "UKN";
......@@ -135,9 +136,9 @@ static int PageCacheMapProcess(struct SeqBuf *buf)
static int FsCacheInfoFill(struct SeqBuf *buf, void *arg)
{
int vnodeFree= 0;
int vnodeActive= 0;
int vnodeVirtual= 0;
int vnodeFree = 0;
int vnodeActive = 0;
int vnodeVirtual = 0;
int vnodeTotal = 0;
int pathCacheTotal = 0;
......
......@@ -43,7 +43,7 @@ struct PathCache {
LIST_ENTRY hashEntry; /* list entry for buckets in the hash table */
uint8_t nameLen; /* length of path component */
#ifdef LOSCFG_DEBUG_VERSION
int hit; /* cache hit count*/
int hit; /* cache hit count */
#endif
char name[0]; /* path component name */
};
......
......@@ -39,7 +39,7 @@
typedef LOS_DL_LIST LIST_HEAD;
typedef LOS_DL_LIST LIST_ENTRY;
#define VNODE_FLAG_MOUNT_NEW (1 << 0) /* new mount vnode*/
#define VNODE_FLAG_MOUNT_NEW (1 << 0) /* new mount vnode */
#define VNODE_FLAG_MOUNT_ORIGIN (1 << 1) /* origin vnode */
#define V_CREATE (1 << 0)
......@@ -76,18 +76,17 @@ typedef LOS_DL_LIST LIST_ENTRY;
#define CHG_MTIME 32
#define CHG_CTIME 64
struct IATTR
{
/* This structure is used for record vnode attr. */
unsigned int attr_chg_valid;
unsigned int attr_chg_flags;
unsigned attr_chg_mode;
unsigned attr_chg_uid;
unsigned attr_chg_gid;
unsigned attr_chg_size;
unsigned attr_chg_atime;
unsigned attr_chg_mtime;
unsigned attr_chg_ctime;
struct IATTR {
/* This structure is used for record vnode attr. */
unsigned int attr_chg_valid;
unsigned int attr_chg_flags;
unsigned attr_chg_mode;
unsigned attr_chg_uid;
unsigned attr_chg_gid;
unsigned attr_chg_size;
unsigned attr_chg_atime;
unsigned attr_chg_mtime;
unsigned attr_chg_ctime;
};
/*
......
......@@ -385,6 +385,7 @@ int VnodeLookup(const char *path, struct Vnode **result, uint32_t flags)
if (currentDir == NULL || *currentDir == '\0') {
// return target or parent vnode as result
*result = currentVnode;
goto OUT_FREE_PATH;
} else if (VfsVnodePermissionCheck(currentVnode, EXEC_OP)) {
ret = -EACCES;
goto OUT_FREE_PATH;
......
......@@ -71,19 +71,19 @@
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
#endif
#define REPLACE_INTERFACE(dst, src, type, func) {\
if (((type *)src)->func != NULL) {\
((type *)dst)->func = ((type *)src)->func;\
} else {\
PRINT_ERR("%s->%s is NULL!\n", #src, #func);\
}\
#define REPLACE_INTERFACE(dst, src, type, func) { \
if (((type *)src)->func != NULL) { \
((type *)dst)->func = ((type *)src)->func; \
} else { \
PRINT_ERR("%s->%s is NULL!\n", #src, #func); \
} \
}
#define INVOKE_INTERFACE(adapter, type, func) {\
if (((type *)adapter)->func != NULL) {\
((type *)adapter)->func();\
} else {\
PRINT_ERR("%s->%s is NULL!\n", #adapter, #func);\
}\
#define INVOKE_INTERFACE(adapter, type, func) { \
if (((type *)adapter)->func != NULL) { \
((type *)adapter)->func(); \
} else { \
PRINT_ERR("%s->%s is NULL!\n", #adapter, #func); \
} \
}
/* ------------ local prototypes ------------ */
......@@ -296,36 +296,36 @@ static INT32 HiDumperIoctl(struct file *filep, INT32 cmd, unsigned long arg)
INT32 ret = 0;
switch (cmd) {
case HIDUMPER_DUMP_ALL:
INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpSysInfo);
INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpCpuUsage);
INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpMemUsage);
INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpTaskInfo);
break;
case HIDUMPER_CPU_USAGE:
INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpCpuUsage);
break;
case HIDUMPER_MEM_USAGE:
INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpMemUsage);
break;
case HIDUMPER_TASK_INFO:
INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpTaskInfo);
break;
case HIDUMPER_INJECT_KERNEL_CRASH:
INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, InjectKernelCrash);
break;
case HIDUMPER_DUMP_FAULT_LOG:
INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpFaultLog);
break;
case HIDUMPER_MEM_DATA:
if (g_adapter.DumpMemData != NULL) {
g_adapter.DumpMemData((struct MemDumpParam *)arg);
}
break;
default:
ret = EPERM;
PRINTK("Invalid CMD: 0x%x\n", (UINT32)cmd);
break;
case HIDUMPER_DUMP_ALL:
INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpSysInfo);
INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpCpuUsage);
INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpMemUsage);
INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpTaskInfo);
break;
case HIDUMPER_CPU_USAGE:
INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpCpuUsage);
break;
case HIDUMPER_MEM_USAGE:
INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpMemUsage);
break;
case HIDUMPER_TASK_INFO:
INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpTaskInfo);
break;
case HIDUMPER_INJECT_KERNEL_CRASH:
INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, InjectKernelCrash);
break;
case HIDUMPER_DUMP_FAULT_LOG:
INVOKE_INTERFACE(&g_adapter, struct HiDumperAdapter, DumpFaultLog);
break;
case HIDUMPER_MEM_DATA:
if (g_adapter.DumpMemData != NULL) {
g_adapter.DumpMemData((struct MemDumpParam *)arg);
}
break;
default:
ret = EPERM;
PRINTK("Invalid CMD: 0x%x\n", (UINT32)cmd);
break;
}
return ret;
......
......@@ -48,8 +48,9 @@ STATIC CHAR *g_cmdLine = NULL;
STATIC UINT64 g_alignSize = 0;
STATIC struct BootArgs g_bootArgs[MAX_ARGS_NUM] = {0};
INT32 LOS_GetCmdLine() {
int ret = 0;
INT32 LOS_GetCmdLine()
{
int ret;
g_cmdLine = (CHAR *)malloc(COMMAND_LINE_SIZE);
if (g_cmdLine == NULL) {
......@@ -117,7 +118,8 @@ ERROUT:
return LOS_NOK;
}
VOID LOS_FreeCmdLine() {
VOID LOS_FreeCmdLine()
{
if (g_cmdLine != NULL) {
free(g_cmdLine);
g_cmdLine = NULL;
......@@ -153,12 +155,13 @@ STATIC INT32 GetBootargs(CHAR **args)
#endif
}
INT32 LOS_ParseBootargs() {
INT32 LOS_ParseBootargs()
{
INT32 idx = 0;
INT32 ret;
CHAR *args;
CHAR *argName;
CHAR *argValue;
CHAR *args = NULL;
CHAR *argName = NULL;
CHAR *argValue = NULL;
ret = GetBootargs(&args);
if (ret != LOS_OK) {
......@@ -183,7 +186,8 @@ INT32 LOS_ParseBootargs() {
return LOS_OK;
}
INT32 LOS_GetArgValue(CHAR *argName, CHAR **argValue) {
INT32 LOS_GetArgValue(CHAR *argName, CHAR **argValue)
{
INT32 idx = 0;
while (idx < MAX_ARGS_NUM) {
......@@ -200,7 +204,8 @@ INT32 LOS_GetArgValue(CHAR *argName, CHAR **argValue) {
return LOS_NOK;
}
UINT64 LOS_GetAlignsize() {
UINT64 LOS_GetAlignsize()
{
return g_alignSize;
}
......@@ -224,7 +229,7 @@ UINT64 LOS_SizeStrToNum(CHAR *value)
if ((ret <= 0) || (decOffset < (strlen(value) - 1))) {
goto ERROUT;
}
if (strlen(endPos) == 0) {
return num;
} else if (strcasecmp(endPos, "k") == 0) {
......
......@@ -97,7 +97,7 @@ STATIC INT32 AddEmmcParts(INT32 rootAddr, INT32 rootSize, INT32 userAddr, INT32
return LOS_NOK;
}
LOS_Msleep(10); /* waiting for device identification */
LOS_Msleep(10); /* 100, sleep time. waiting for device identification */
INT32 diskId = los_alloc_diskid_byname(node_name);
if (diskId < 0) {
......@@ -156,11 +156,12 @@ STATIC INT32 AddPartitions(CHAR *dev, UINT64 rootAddr, UINT64 rootSize, UINT64 u
}
STATIC INT32 ParseRootArgs(CHAR **dev, CHAR **fstype, UINT64 *rootAddr, UINT64 *rootSize, UINT32 *mountFlags) {
STATIC INT32 ParseRootArgs(CHAR **dev, CHAR **fstype, UINT64 *rootAddr, UINT64 *rootSize, UINT32 *mountFlags)
{
INT32 ret;
CHAR *rootAddrStr;
CHAR *rootSizeStr;
CHAR *rwTag;
CHAR *rootAddrStr = NULL;
CHAR *rootSizeStr = NULL;
CHAR *rwTag = NULL;
ret = LOS_GetArgValue("root", dev);
if (ret != LOS_OK) {
......@@ -187,7 +188,7 @@ STATIC INT32 ParseRootArgs(CHAR **dev, CHAR **fstype, UINT64 *rootAddr, UINT64 *
} else {
*rootSize = LOS_SizeStrToNum(rootSizeStr);
}
ret = LOS_GetArgValue("ro", &rwTag);
if (ret == LOS_OK) {
*mountFlags = MS_RDONLY;
......@@ -198,10 +199,11 @@ STATIC INT32 ParseRootArgs(CHAR **dev, CHAR **fstype, UINT64 *rootAddr, UINT64 *
return LOS_OK;
}
STATIC INT32 ParseUserArgs(UINT64 rootAddr, UINT64 rootSize, UINT64 *userAddr, UINT64 *userSize) {
STATIC INT32 ParseUserArgs(UINT64 rootAddr, UINT64 rootSize, UINT64 *userAddr, UINT64 *userSize)
{
INT32 ret;
CHAR *userAddrStr;
CHAR *userSizeStr;
CHAR *userAddrStr = NULL;
CHAR *userSizeStr = NULL;
ret = LOS_GetArgValue("useraddr", &userAddrStr);
if (ret != LOS_OK) {
......@@ -220,7 +222,8 @@ STATIC INT32 ParseUserArgs(UINT64 rootAddr, UINT64 rootSize, UINT64 *userAddr, U
return LOS_OK;
}
STATIC INT32 MountPartitions(CHAR *fsType, UINT32 mountFlags) {
STATIC INT32 MountPartitions(CHAR *fsType, UINT32 mountFlags)
{
INT32 ret;
INT32 err;
......@@ -275,7 +278,8 @@ STATIC INT32 MountPartitions(CHAR *fsType, UINT32 mountFlags) {
return LOS_OK;
}
STATIC INT32 CheckValidation(UINT64 rootAddr, UINT64 rootSize, UINT64 userAddr, UINT64 userSize) {
STATIC INT32 CheckValidation(UINT64 rootAddr, UINT64 rootSize, UINT64 userAddr, UINT64 userSize)
{
UINT64 alignSize = LOS_GetAlignsize();
if (alignSize == 0) {
......@@ -291,10 +295,11 @@ STATIC INT32 CheckValidation(UINT64 rootAddr, UINT64 rootSize, UINT64 userAddr,
return LOS_OK;
}
INT32 OsMountRootfs() {
INT32 OsMountRootfs()
{
INT32 ret;
CHAR *dev;
CHAR *fstype;
CHAR *dev = NULL;
CHAR *fstype = NULL;
UINT64 rootAddr;
UINT64 rootSize;
UINT64 userAddr;
......
......@@ -758,5 +758,3 @@ ULONG_T LOS_RbAddNode(LosRbTree *pstTree, LosRbNode *pstNew)
return TRUE;
}
......@@ -423,6 +423,7 @@ STATIC VOID EchoToTerminal(CONSOLE_CB *consoleCB, struct file *filep, const stru
STATIC VOID StoreReadChar(CONSOLE_CB *consoleCB, char ch, INT32 readcount)
{
/* 3, store read char len need to minus \b */
if ((readcount == EACH_CHAR) && (consoleCB->fifoIn <= (CONSOLE_FIFO_SIZE - 3))) {
if (ch == '\b') {
if (!ConsoleFifoEmpty(consoleCB)) {
......
......@@ -103,7 +103,7 @@ STATIC UINT32 OsCirBufWriteLoop(CirBuf *cirbufCB, const CHAR *buf, UINT32 size)
UINT32 LOS_CirBufWrite(CirBuf *cirbufCB, const CHAR *buf, UINT32 size)
{
UINT32 cpSize = 0;
UINT32 cpSize;
if ((cirbufCB == NULL) || (buf == NULL) || (size == 0)) {
return 0;
......
......@@ -61,7 +61,7 @@ STATIC VOID InitLevelCall(const CHAR *name, const UINT32 level, struct ModuleIni
#ifdef LOS_INIT_DEBUG
UINT64 startNsec, endNsec;
UINT64 totalTime = 0;
UINT64 singleTime = 0;
UINT64 singleTime;
UINT32 ret = LOS_OK;
#endif
......@@ -71,7 +71,7 @@ STATIC VOID InitLevelCall(const CHAR *name, const UINT32 level, struct ModuleIni
#endif
g_initCurrentLevel = level;
g_initCurrentModule = initLevelList[level];
} else {
} else {
while (g_initCurrentLevel < level) {
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册