未验证 提交 ba23a26f 编写于 作者: O openharmony_ci 提交者: Gitee

!928 Fix : 内核告警清理

Merge pull request !928 from yinjiaming/fix
......@@ -478,7 +478,6 @@ static int PthreadGetCputime(clockid_t clockID, struct timespec *ats)
uint64_t runtime;
UINT32 intSave;
UINT32 tid = GetTidFromClockID(clockID);
if (OS_TID_CHECK_INVALID(tid)) {
return -EINVAL;
}
......
......@@ -42,7 +42,7 @@
#ifdef __cplusplus
#if __cplusplus
extern "C"{
extern "C" {
#endif
#endif /* __cplusplus */
......
......@@ -343,7 +343,8 @@ static FRESULT init_cluster(DIR_FILE *pdfp, DIR *dp_new, FATFS *fs, int type, co
return FR_OK;
}
static int fatfs_create_obj(struct Vnode *parent, const char *name, int mode, struct Vnode **vpp, BYTE type, const char *target)
static int fatfs_create_obj(struct Vnode *parent, const char *name, int mode, struct Vnode **vpp,
BYTE type, const char *target)
{
struct Vnode *vp = NULL;
FATFS *fs = (FATFS *)parent->originMount->data;
......
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
......@@ -244,8 +244,9 @@ extern int chattr(const char *pathname, struct IATTR *attr);
*
* @retval #0 On success.
* @retval #-1 On failure with errno set.
* @retval CONTINE_NUTTX_FCNTL doesn't support some cmds in VfsFcntl, needs to continue going through Nuttx vfs operation.</li>
*
* @retval CONTINE_NUTTX_FCNTL doesn't support some cmds in VfsFcntl, needs to continue going through
* Nuttx vfs operation.</li>
*
* @par Dependency:
* <ul><li>fs.h</li></ul>
* @see None
......
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
......@@ -682,7 +682,6 @@ int VfsJffs2Rmdir(struct Vnode *parentVnode, struct Vnode *targetVnode, const ch
LOS_MuxLock(&g_jffs2FsLock, (uint32_t)JFFS2_WAITING_FOREVER);
ret = jffs2_rmdir(parentInode, targetInode, (const unsigned char *)path);
if (ret == 0) {
(void)jffs2_iput(targetInode);
}
......@@ -809,7 +808,6 @@ int VfsJffs2Unlink(struct Vnode *parentVnode, struct Vnode *targetVnode, const c
LOS_MuxLock(&g_jffs2FsLock, (uint32_t)JFFS2_WAITING_FOREVER);
ret = jffs2_unlink(parentInode, targetInode, (const unsigned char *)path);
if (ret == 0) {
(void)jffs2_iput(targetInode);
}
......
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
......@@ -154,7 +154,8 @@ static int FsCacheInfoFill(struct SeqBuf *buf, void *arg)
VnodeHold();
LosBufPrintf(buf, "\n=================================================================\n");
LosBufPrintf(buf, "VnodeAddr ParentAddr DataAddr VnodeOps Hash Ref Type Gid Uid Mode\n");
LosBufPrintf(buf,
"VnodeAddr ParentAddr DataAddr VnodeOps Hash Ref Type Gid Uid Mode\n");
vnodeVirtual = VnodeListProcess(buf, GetVnodeVirtualList());
vnodeFree = VnodeListProcess(buf, GetVnodeFreeList());
vnodeActive = VnodeListProcess(buf, GetVnodeActiveList());
......
......@@ -62,8 +62,8 @@ int OsShellCmdWriteProc(int argc, char **argv)
if (argc == WRITEPROC_ARGC) {
value = argv[0];
path = argv[2];
len = strlen(value) + 1; /* +1:add the \0 */
path = argv[2]; // 2: index of path
len = strlen(value) + 1; /* + 1:add the \0 */
if (strncmp(argv[1], ">>", strlen(">>")) == 0) {
if ((realpath(path, realPath) == NULL) || (strncmp(realPath, rootProcDir, strlen(rootProcDir)) != 0)) {
PRINT_ERR("No such file or directory\n");
......
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
......@@ -304,7 +304,7 @@ int epoll_wait(int epfd, FAR struct epoll_event *evs, int maxevents, int timeout
int pollSize;
epHead = EpollGetDataBuff(epfd);
if (epHead== NULL) {
if (epHead == NULL) {
set_errno(EBADF);
return -1;
}
......
......@@ -225,7 +225,6 @@ static char *vfs_normalize_fullpath(const char *directory, const char *filename,
/* it's a absolute path, use it directly */
fullpath = strdup(filename); /* copy string */
if (fullpath == NULL) {
*pathname = NULL;
set_errno(ENOMEM);
......@@ -258,11 +257,10 @@ int vfs_normalize_path(const char *directory, const char *filename, char **pathn
}
#ifdef VFS_USING_WORKDIR
if (directory == NULL)
{
if (directory == NULL) {
spin_lock_irqsave(&curr->files->workdir_lock, lock_flags);
directory = curr->files->workdir;
}
}
#else
if ((directory == NULL) && (filename[0] != '/')) {
PRINT_ERR("NO_WORKING_DIR\n");
......@@ -275,20 +273,18 @@ int vfs_normalize_path(const char *directory, const char *filename, char **pathn
if ((filename[0] != '/') && (strlen(directory) + namelen + 2 > TEMP_PATH_MAX)) {
#ifdef VFS_USING_WORKDIR
if (dir_flags == TRUE)
{
if (dir_flags == TRUE) {
spin_unlock_irqrestore(&curr->files->workdir_lock, lock_flags);
}
}
#endif
return -ENAMETOOLONG;
}
fullpath = vfs_normalize_fullpath(directory, filename, pathname, namelen);
#ifdef VFS_USING_WORKDIR
if (dir_flags == TRUE)
{
if (dir_flags == TRUE) {
spin_unlock_irqrestore(&curr->files->workdir_lock, lock_flags);
}
}
#endif
if (fullpath == NULL) {
return -get_errno();
......@@ -308,7 +304,7 @@ int vfs_normalize_path(const char *directory, const char *filename, char **pathn
int vfs_normalize_pathat(int dirfd, const char *filename, char **pathname)
{
/* Get path by dirfd*/
/* Get path by dirfd */
char *relativeoldpath = NULL;
char *fullpath = NULL;
int ret = 0;
......
......@@ -132,19 +132,19 @@ int VfsPermissionCheck(uint fuid, uint fgid, uint fileMode, int accMode)
#ifdef VFS_USING_WORKDIR
static int SetWorkDir(const char *dir, size_t len)
{
errno_t ret;
uint lock_flags;
LosProcessCB *curr = OsCurrProcessGet();
spin_lock_irqsave(&curr->files->workdir_lock, lock_flags);
ret = strncpy_s(curr->files->workdir, PATH_MAX, dir, len);
curr->files->workdir[PATH_MAX - 1] = '\0';
spin_unlock_irqrestore(&curr->files->workdir_lock, lock_flags);
if (ret != EOK) {
return -1;
}
return 0;
errno_t ret;
uint lock_flags;
LosProcessCB *curr = OsCurrProcessGet();
spin_lock_irqsave(&curr->files->workdir_lock, lock_flags);
ret = strncpy_s(curr->files->workdir, PATH_MAX, dir, len);
curr->files->workdir[PATH_MAX - 1] = '\0';
spin_unlock_irqrestore(&curr->files->workdir_lock, lock_flags);
if (ret != EOK) {
return -1;
}
return 0;
}
#endif
......@@ -155,7 +155,6 @@ int chdir(const char *path)
char *fullpath_bak = NULL;
struct stat statBuff;
if (!path) {
set_errno(EFAULT);
return -1;
......
......@@ -57,7 +57,6 @@ int utime(const char *path, const struct utimbuf *ptimes)
/* Sanity checks */
if (path == NULL) {
ret = -EINVAL;
goto errout;
......
此差异已折叠。
/*
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
......@@ -239,7 +239,7 @@ BOOL VnodeInUseIter(const struct Mount *mount)
return FALSE;
}
int VnodeHold()
int VnodeHold(void)
{
int ret = LOS_MuxLock(&g_vnodeMux, LOS_WAIT_FOREVER);
if (ret != LOS_OK) {
......@@ -248,7 +248,7 @@ int VnodeHold()
return ret;
}
int VnodeDrop()
int VnodeDrop(void)
{
int ret = LOS_MuxUnlock(&g_vnodeMux);
if (ret != LOS_OK) {
......@@ -583,7 +583,7 @@ int VnodeCreate(struct Vnode *parent, const char *name, int mode, struct Vnode *
return 0;
}
int VnodeDevInit()
int VnodeDevInit(void)
{
struct Vnode *devNode = NULL;
struct Mount *devMount = NULL;
......@@ -616,7 +616,7 @@ int VnodeGetattr(struct Vnode *vnode, struct stat *buf)
return LOS_OK;
}
struct Vnode *VnodeGetRoot()
struct Vnode *VnodeGetRoot(void)
{
return g_rootVnode;
}
......@@ -697,7 +697,7 @@ LIST_HEAD* GetVnodeActiveList()
return &g_vnodeActiveList;
}
int VnodeClearCache()
int VnodeClearCache(void)
{
struct Vnode *item = NULL;
struct Vnode *nextItem = NULL;
......
......@@ -50,8 +50,8 @@ extern "C" {
* Rwlock object.
*/
typedef struct OsRwlock {
INT32 magic:24; /**< Magic number */
INT32 rwCount:8; /**< Times of locking the rwlock, rwCount > 0 when rwkick is read mode, rwCount < 0
INT32 magic : 24; /**< Magic number */
INT32 rwCount : 8; /**< Times of locking the rwlock, rwCount > 0 when rwkick is read mode, rwCount < 0
when the rwlock is write mode, rwCount = 0 when the lock is free. */
VOID *writeOwner; /**< The current write thread that is locking the rwlock */
LOS_DL_LIST readList; /**< Read waiting list */
......
......@@ -58,7 +58,7 @@
#define ip_addr_set_val(dest, src) do { \
IP_SET_TYPE_VAL(*dest, IP_GET_TYPE(src)); \
if(IP_IS_V6_VAL(*(src))) { \
if (IP_IS_V6_VAL(*(src))) { \
ip6_addr_set(ip_2_ip6(dest), ip_2_ip6(src)); \
} else { \
ip4_addr_set(ip_2_ip4(dest), ip_2_ip4(src)); \
......
......@@ -365,19 +365,19 @@ int print_netif(struct netif *netif, char *print_buf, unsigned int buf_len)
ret = snprintf_s(tmp, buf_len, (buf_len - 1), "\tRX packets:%u ",
netif->mib2_counters.ifinucastpkts + netif->mib2_counters.ifinnucastpkts);
if ((ret <= 0) || ((unsigned int)ret >= buf_len))
goto out;
goto out;
tmp += ret;
buf_len -= (unsigned int)ret;
ret = snprintf_s(tmp, buf_len, (buf_len - 1), "errors:%u ", netif->mib2_counters.ifinerrors);
if ((ret <= 0) || ((unsigned int)ret >= buf_len))
goto out;
goto out;
tmp += ret;
buf_len -= (unsigned int)ret;
ret = snprintf_s(tmp, buf_len, (buf_len - 1), "dropped:%u ", netif->mib2_counters.ifindiscards);
if ((ret <= 0) || ((unsigned int)ret >= buf_len))
goto out;
goto out;
tmp += ret;
buf_len -= (unsigned int)ret;
......@@ -1031,12 +1031,12 @@ u32_t lwip_ifconfig(int argc, const char **argv)
#if LWIP_ARP && LWIP_ENABLE_IP_CONFLICT_SIGNAL
if ((ifconfig_cmd.option & IFCONFIG_OPTION_SET_IP) && IP_IS_V4_VAL((ifconfig_cmd.ip_addr))) {
/* Create the semaphore for ip conflict detection. */
if (sys_sem_new(&ip_conflict_detect, 0) != ERR_OK) {
sys_sem_free(&ifconfig_cmd.cb_completed);
PRINTK("ifconfig: internal error\n");
return 1;
}
is_ip_conflict_signal = 1;
if (sys_sem_new(&ip_conflict_detect, 0) != ERR_OK) {
sys_sem_free(&ifconfig_cmd.cb_completed);
PRINTK("ifconfig: internal error\n");
return 1;
}
is_ip_conflict_signal = 1;
}
#endif /* LWIP_ARP && LWIP_ENABLE_IP_CONFLICT_SIGNAL */
......@@ -1057,8 +1057,8 @@ u32_t lwip_ifconfig(int argc, const char **argv)
sys_sem_free(&ifconfig_cmd.cb_completed);
#if LWIP_ARP && LWIP_ENABLE_IP_CONFLICT_SIGNAL
if ((ifconfig_cmd.option & IFCONFIG_OPTION_SET_IP) && IP_IS_V4_VAL((ifconfig_cmd.ip_addr))) {
is_ip_conflict_signal = 0;
sys_sem_free(&ip_conflict_detect);
is_ip_conflict_signal = 0;
sys_sem_free(&ip_conflict_detect);
}
#endif /* LWIP_ARP && LWIP_ENABLE_IP_CONFLICT_SIGNAL */
......@@ -1076,37 +1076,37 @@ u32_t lwip_ifconfig(int argc, const char **argv)
ifconfig_cmd.cb_print_buf[PRINT_BUF_LEN - 1] = '\0';
PRINTK("%s", ifconfig_cmd.cb_print_buf);
#if LWIP_ARP && LWIP_ENABLE_IP_CONFLICT_SIGNAL
/* Pend 2 seconds for waiting the arp reply if the ip is already in use.*/
/* Pend 2 seconds for waiting the arp reply if the ip is already in use. */
if ((ifconfig_cmd.option & IFCONFIG_OPTION_SET_IP) && IP_IS_V4_VAL((ifconfig_cmd.ip_addr))) {
err = (err_t)sys_arch_sem_wait(&ip_conflict_detect, DUP_ARP_DETECT_TIME);
is_ip_conflict_signal = 0;
sys_sem_free(&ip_conflict_detect);
if (err < 0) {
/* The result neither conflict nor timeout. */
PRINT_ERR("ifconfig: internal error\n");
sys_sem_free(&ifconfig_cmd.cb_completed);
return 1;
} else if (err < DUP_ARP_DETECT_TIME) {
/* Duplicate use of new ip, restore it to the old one. */
PRINT_ERR("ifconfig: ip conflict!\n");
ip_addr_set_ip4_u32_val(ifconfig_cmd.ip_addr, old_ip4addr);
ret = tcpip_callback(lwip_ifconfig_internal, &ifconfig_cmd);
if (ret != ERR_OK) {
sys_sem_free(&ifconfig_cmd.cb_completed);
PRINTK("%s : tcpip_callback failed in line %d : errnu %d", __FUNCTION__, __LINE__, ret);
return 1;
err = (err_t)sys_arch_sem_wait(&ip_conflict_detect, DUP_ARP_DETECT_TIME);
is_ip_conflict_signal = 0;
sys_sem_free(&ip_conflict_detect);
if (err < 0) {
/* The result neither conflict nor timeout. */
PRINT_ERR("ifconfig: internal error\n");
sys_sem_free(&ifconfig_cmd.cb_completed);
return 1;
} else if (err < DUP_ARP_DETECT_TIME) {
/* Duplicate use of new ip, restore it to the old one. */
PRINT_ERR("ifconfig: ip conflict!\n");
ip_addr_set_ip4_u32_val(ifconfig_cmd.ip_addr, old_ip4addr);
ret = tcpip_callback(lwip_ifconfig_internal, &ifconfig_cmd);
if (ret != ERR_OK) {
sys_sem_free(&ifconfig_cmd.cb_completed);
PRINTK("%s : tcpip_callback failed in line %d : errnu %d", __FUNCTION__, __LINE__, ret);
return 1;
}
(void)sys_arch_sem_wait(&ifconfig_cmd.cb_completed, 0);
sys_sem_free(&ifconfig_cmd.cb_completed);
ifconfig_cmd.cb_print_buf[PRINT_BUF_LEN - 1] = '\0';
PRINTK("%s", ifconfig_cmd.cb_print_buf);
return 1;
}
(void)sys_arch_sem_wait(&ifconfig_cmd.cb_completed, 0);
sys_sem_free(&ifconfig_cmd.cb_completed);
ifconfig_cmd.cb_print_buf[PRINT_BUF_LEN - 1] = '\0';
PRINTK("%s", ifconfig_cmd.cb_print_buf);
return 1;
}
}
#endif /* LWIP_ARP && LWIP_ENABLE_IP_CONFLICT_SIGNAL */
#if LWIP_IPV6
if ((ifconfig_cmd.option & IFCONFIG_OPTION_SET_IP) && IP_IS_V6_VAL(ifconfig_cmd.ip_addr)) {
/* Pend 2 seconds for waiting the arp reply if the ip is already in use.*/
/* Pend 2 seconds for waiting the arp reply if the ip is already in use. */
retval = sys_arch_sem_wait(&dup_addr_detect, DUP_ARP_DETECT_TIME);
is_dup_detect_initialized = 0;
sys_sem_free(&dup_addr_detect);
......@@ -1191,7 +1191,6 @@ void lwip_arp_show_internal(struct netif *netif, char *printf_buf, unsigned int
|| (state == ETHARP_STATE_STATIC)
#endif /* ETHARP_SUPPORT_STATIC_ENTRIES */
) && arp_table[i].netif) {
if (strcmp(netif_get_name(netif), netif_get_name(arp_table[i].netif)) != 0) {
continue;
}
......@@ -1305,7 +1304,7 @@ void lwip_arp_internal(void *arg)
for (netif = netif_list; netif != NULL; netif = netif->next) {
ret = etharp_delete_arp_entry(netif, &ipaddr);
if (ret == ERR_OK) {
/*only can del success one time*/
/* only can del success one time */
break;
}
}
......@@ -1387,7 +1386,7 @@ u32_t lwip_arp(int argc, const char **argv)
goto arp_error;
}
i += 2;
argc -= 2;
argc -= 2; // 2: number of used parameters
} else if (strcmp("-d", argv[i]) == 0 && (argc > 1)) {
/* arp delete */
arp_cmd.option = ARP_OPTION_DEL;
......@@ -1399,8 +1398,8 @@ u32_t lwip_arp(int argc, const char **argv)
}
i += 2;
argc -= 2;
} else if (strcmp("-s", argv[i]) == 0 && (argc > 2)) {
argc -= 2; // 2: number of used parameters
} else if (strcmp("-s", argv[i]) == 0 && (argc > 2)) { // 2: require more than 2 parameters
/* arp add */
char *digit = NULL;
u32_t macaddrlen = strlen(argv[i + 2]) + 1;
......@@ -1418,7 +1417,7 @@ u32_t lwip_arp(int argc, const char **argv)
goto arp_error;
}
/*cannot add an arp entry of 127.*.*.* */
/* cannot add an arp entry of 127.*.*.* */
if ((arp_cmd.ipaddr & (u32_t)0x0000007fUL) == (u32_t)0x0000007fUL) {
PRINTK("IP address is not correct!\n");
goto arp_error;
......@@ -1452,7 +1451,7 @@ u32_t lwip_arp(int argc, const char **argv)
}
i += 3;
argc -= 3;
argc -= 3; // 3: number of used parameters
} else {
goto arp_error;
}
......@@ -1727,7 +1726,7 @@ LWIP_STATIC int osPingFunc(u32_t destip, u32_t cnt, u32_t interval, u32_t data_l
break;
}
intrvl -= 1000;
sys_msleep(1000);
sys_msleep(1000); // 1000: delay 1 s
if (ping_kill == 1)
break;
} while (intrvl > 0);
......@@ -1819,7 +1818,7 @@ u32_t osShellPing(int argc, const char **argv)
count = ret;
count_set = 1;
i += 2;
argc -= 2;
argc -= 2; // 2: nuber of arguments that has been checked
} else if (strcmp("-t", argv[i]) == 0) {
count = 0; /* ping forerver */
count_set = 1;
......@@ -1834,7 +1833,7 @@ u32_t osShellPing(int argc, const char **argv)
interval = ret;
i += 2;
argc -= 2;
argc -= 2; // 2:number of arguments that has been checked
} else if (strcmp("-l", argv[i]) == 0 && (argc > 1)) {
ret = atoi(argv[i + 1]);
if (ret < 0 || ret > (int)(LWIP_MAX_UDP_RAW_SEND_SIZE - sizeof(struct icmp_echo_hdr))) {
......@@ -1844,7 +1843,7 @@ u32_t osShellPing(int argc, const char **argv)
}
data_len = ret;
i += 2;
argc -= 2;
argc -= 2; // 2: number of elements has been checked
} else if (strcmp("-k", argv[i]) == 0) {
if (ping_taskid > 0) {
ping_kill = 1; /* stop the current ping task */
......@@ -1896,7 +1895,7 @@ u32_t osShellPing(int argc, const char **argv)
stPingTask.auwArgs[0] = dst_ipaddr.addr; /* network order */
stPingTask.auwArgs[1] = count;
stPingTask.auwArgs[2] = interval;
stPingTask.auwArgs[3] = data_len;
stPingTask.auwArgs[3] = data_len; // 3: index of data length
ret = LOS_TaskCreate((UINT32 *)(&ping_taskid), &stPingTask);
if (ret != LOS_OK) {
PRINTK("ping_task create failed 0x%08x.\n", ret);
......@@ -1923,7 +1922,7 @@ ping_error:
SHELLCMD_ENTRY(ping_shellcmd, CMD_TYPE_EX, "ping", XARGS, (CmdCallBackFunc)osShellPing);
#endif /* LOSCFG_SHELL */
#else /* LWIP_EXT_POLL_SUPPORT*/
#else /* LWIP_EXT_POLL_SUPPORT */
u32_t osShellPing(int argc, const char **argv)
{
......@@ -2076,7 +2075,7 @@ FAILURE:
SHELLCMD_ENTRY(ping_shellcmd, CMD_TYPE_EX, "ping", XARGS, (CmdCallBackFunc)osShellPing);
#endif /* LOSCFG_SHELL */
#endif /* LWIP_EXT_POLL_SUPPORT*/
#endif /* LWIP_EXT_POLL_SUPPORT */
#if LWIP_IPV6
u32_t osShellPing6(int argc, const char **argv)
......@@ -2311,6 +2310,7 @@ REDUCE_SELECT_TIME:
PRINTK("--- %s ping statistics ---\n", argv[ping6_params.host_index]);
PRINTK("%d packets transmitted, %d received, %.2f%% packet loss, time %dms\n",
nsent, nrecieve, (float)(((float)(nsent - nrecieve)) * ((float)(100)) / ((float)(nsent))),
/* 1000: convert seconds to milliseconds, 1000000: convert nanoseconds to milliseconds */
((last.tv_sec - first.tv_sec) * 1000 + (last.tv_nsec - first.tv_nsec) / 1000000));
if (nrecieve) {
/* Display rtt stats only if at least one packet is received */
......@@ -2629,7 +2629,7 @@ usage:
SHELLCMD_ENTRY(ntpdate_shellcmd, CMD_TYPE_EX, "ntpdate", XARGS, (CmdCallBackFunc)osShellNtpdate);
#endif /* LOSCFG_SHELL_CMD_DEBUG */
#endif /* LWIP_SNTP*/
#endif /* LWIP_SNTP */
#if LWIP_DNS
u32_t osShellDns(int argc, const char **argv)
......@@ -2866,7 +2866,7 @@ int netstat_tcp_recvq(struct tcp_pcb *tpcb)
case NETCONN_UDP_IPV6:
#endif
case NETCONN_UDP:
SYS_ARCH_GET(((unsigned int)conn->recv_avail /*+ conn->lrcv_left*/), retVal);
SYS_ARCH_GET(((unsigned int)conn->recv_avail), retVal); // + conn->lrcv_left
break;
default:
retVal = 0; /* ur... very ugly, damn DHCP DNS and SNTP */
......@@ -2922,7 +2922,7 @@ int netstat_udp_sendq6(struct udp_pcb *upcb)
#else
ret = netstat_get_udp_sendQLen6(upcb, neighbor_cache[idx].q);
if (ret >= 0) {
retLen += ret;
retLen += ret;
}
#endif
return retLen;
......@@ -2966,10 +2966,10 @@ int netstat_udp_sendq(struct udp_pcb *upcb)
#else
ret = netstat_get_udp_sendQLen(upcb, arp_table[arpidx].q);
if (ret > 0) {
retLen += ret;
if (retLen <= 0) { // overflow, set rteLen = -1 to indicate
retLen = -1;
}
retLen += ret;
if (retLen <= 0) { // overflow, set rteLen = -1 to indicate
retLen = -1;
}
}
#endif
}
......@@ -2992,7 +2992,7 @@ int netstat_netconn_recvq(const struct netconn *conn)
case NETCONN_PKT_RAW:
#endif
case NETCONN_UDP:
SYS_ARCH_GET(((unsigned int)conn->recv_avail /*+ conn->lrcv_left*/), retVal);
SYS_ARCH_GET(((unsigned int)conn->recv_avail), retVal); // + conn->lrcv_left
break;
default:
retVal = 0; /* ur... very ugly, damn DHCP DNS and SNTP */
......@@ -3271,10 +3271,10 @@ void netstat_internal(void *ctx)
recvQlen = netstat_netconn_recvq(rpcb->recv_arg);
sendQlen = netstat_netconn_sendq(rpcb->recv_arg);
proto = rpcb->protocol;//raw_proto;
proto = rpcb->protocol; // raw_proto;
iRet = snprintf_s((char *)(entry_buf + entry_buf_offset), entry_buf_len, entry_buf_len - 1,
"%-8s%-12d%-12d%-20s%-20s%-16u%-16d\n",
"raw", recvQlen, sendQlen, local_ip_port, remote_ip_port, proto, /*rpcb->hdrincl*/0);
"raw", recvQlen, sendQlen, local_ip_port, remote_ip_port, proto, 0); // rpcb->hdrincl
if ((iRet <= 0) || ((u32_t)(iRet) >= entry_buf_len)) {
goto out;
}
......@@ -3297,7 +3297,8 @@ void netstat_internal(void *ctx)
sendQlen = netstat_netconn_sendq(rpcb->recv_arg);
for (netif = netif_list; netif != NULL; netif = netif->next) {
if (netif_get_index(netif)/*netif->ifindex*/ == rpcb->netif_idx/*index*/) {
/* netif->ifindex and index */
if (netif_get_index(netif) == rpcb->netif_idx) {
(void)snprintf_s((char *)netif_name, IFNAMSIZ, IFNAMSIZ - 1, "%s", netif_get_name(netif));
break;
}
......@@ -3307,7 +3308,7 @@ void netstat_internal(void *ctx)
(void)snprintf_s((char *)netif_name, IFNAMSIZ, IFNAMSIZ - 1, "%s", "None");
}
proto = rpcb->protocol;//ntohs(rpcb->proto.eth_proto);
proto = rpcb->protocol; // ntohs(rpcb->proto.eth_proto);
iRet = snprintf_s((char *)(entry_buf + entry_buf_offset), entry_buf_len, entry_buf_len - 1,
"%-12s%-12d%-12d%-16x%-12s\n", "pkt-raw", recvQlen, sendQlen, proto, netif_name);
......@@ -3884,4 +3885,4 @@ SHELLCMD_ENTRY(reboot_shellcmd, CMD_TYPE_EX, "reboot", XARGS, (CmdCallBackFunc)o
#endif /* LOSCFG_SHELL_CMD_DEBUG */
#endif
#endif //LWIP_ENABLE_LOS_SHELL_CMD
#endif // LWIP_ENABLE_LOS_SHELL_CMD
......@@ -435,9 +435,9 @@ LWIP_STATIC void handle_discover(struct netif *netif, struct dhcps *dhcps,
}
#else
else {
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE,
("handle_discover: sendto(OFFER, IP_ADDR_BROADCAST, DHCP_CLIENT_PORT)\n"));
(void)udp_sendto_if_src(dhcps->pcb, out_msg, IP_ADDR_BROADCAST, DHCP_CLIENT_PORT, netif, &(netif->ip_addr));
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE,
("handle_discover: sendto(OFFER, IP_ADDR_BROADCAST, DHCP_CLIENT_PORT)\n"));
(void)udp_sendto_if_src(dhcps->pcb, out_msg, IP_ADDR_BROADCAST, DHCP_CLIENT_PORT, netif, &(netif->ip_addr));
}
#endif
......
......@@ -412,7 +412,7 @@ int ip6addr_aton(const char *cp, ip6_addr_t *addr)
int squash_pos = ipv6_blocks;
int i;
const char *s = cp;
const char *ss = cp-1;
const char *ss = cp - 1;
for (; ; s++) {
if (current_block_index >= ipv6_blocks) {
......
......@@ -98,10 +98,10 @@ driverif_output(struct netif *netif, struct pbuf *p)
#if PF_PKT_SUPPORT
if (all_pkt_raw_pcbs != NULL) {
p->flags = (u16_t)(p->flags & ~(PBUF_FLAG_LLMCAST | PBUF_FLAG_LLBCAST | PBUF_FLAG_HOST));
p->flags |= PBUF_FLAG_OUTGOING;
(void)raw_pkt_input(p, netif, NULL);
}
p->flags = (u16_t)(p->flags & ~(PBUF_FLAG_LLMCAST | PBUF_FLAG_LLBCAST | PBUF_FLAG_HOST));
p->flags |= PBUF_FLAG_OUTGOING;
(void)raw_pkt_input(p, netif, NULL);
}
#endif
#if ETH_PAD_SIZE
......
......@@ -803,12 +803,10 @@ static u8_t lwip_ioctl_internal_SIOCSIFHWADDR(struct ifreq *ifr)
}
#endif
else {
/* bring netif down to clear all Neighbor Cache Entry */
(void)netif_set_down(netif);
ret = netif_set_hwaddr(netif, (const unsigned char *)ifr->ifr_hwaddr.sa_data, netif->hwaddr_len);
if (ret != ERR_OK) {
(void)netif_set_up(netif);
return err_to_errno(ret);
......@@ -979,7 +977,6 @@ static u8_t lwip_ioctl_internal_SIOCGIFFLAGS(struct ifreq *ifr)
#endif /* LWIP_IGMP || LWIP_IPV6_MLD */
#if LWIP_DHCP
//if ((netif->flags & NETIF_FLAG_DHCP) != 0) {
if (dhcp_supplied_address(netif)) {
ifr->ifr_flags = (short)((unsigned short)ifr->ifr_flags | IFF_DYNAMIC);
} else {
......@@ -1090,7 +1087,6 @@ static u8_t lwip_ioctl_internal_SIOCSIFNAME(struct ifreq *ifr)
#endif
netif = netif_find(ifr->ifr_name);
if (netif == NULL) {
return ENODEV;
} else if (netif->link_layer_type == LOOPBACK_IF) {
......@@ -1165,7 +1161,6 @@ static u8_t lwip_ioctl_internal_SIOCGIFMTU(struct ifreq *ifr)
/* get netif hw addr */
netif = netif_find(ifr->ifr_name);
if (netif == NULL) {
return ENODEV;
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册