Compare commits
48 Commits
feature_ID
...
weekly_202
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d1fd22b1c | ||
|
|
efa336ab26 | ||
|
|
0b05a46691 | ||
|
|
177f32283f | ||
|
|
6888193e3f | ||
|
|
6c352a7b10 | ||
|
|
73a9587f02 | ||
|
|
cbd03bd7e0 | ||
|
|
8d55bb1d8c | ||
|
|
e7daa28200 | ||
|
|
987a722d2d | ||
|
|
ccdfa72431 | ||
|
|
557a71c1c3 | ||
|
|
569aecb6ea | ||
|
|
8c0b7d0f38 | ||
|
|
c488817b32 | ||
|
|
43d47a27e3 | ||
|
|
a83f916298 | ||
|
|
8dbfd3846e | ||
|
|
f34762c105 | ||
|
|
043e84dfcb | ||
|
|
453c376198 | ||
|
|
204d7a4abb | ||
|
|
f2861a84bf | ||
|
|
96b2d557ac | ||
|
|
ffa11535ca | ||
|
|
b581207045 | ||
|
|
5105249ecf | ||
|
|
a61e2cf16e | ||
|
|
39e25c5220 | ||
|
|
5541965365 | ||
|
|
edd2223083 | ||
|
|
22392965b5 | ||
|
|
d906bb91ea | ||
|
|
51f6a20723 | ||
|
|
325ea29df3 | ||
|
|
c2f9f6705f | ||
|
|
71e51d8813 | ||
|
|
e0b4fcb23d | ||
|
|
7d62d3d62b | ||
|
|
69f3bf3a2a | ||
|
|
2590e34346 | ||
|
|
660b314f90 | ||
|
|
44ec199465 | ||
|
|
7437408f65 | ||
|
|
1134332a58 | ||
|
|
8099f6578d | ||
|
|
059c1c22b1 |
3
Makefile
3
Makefile
@@ -82,9 +82,6 @@ endif
|
||||
ifeq ($(LOSCFG_STORAGE_SPINAND), y)
|
||||
FSTYPE = yaffs2
|
||||
endif
|
||||
ifeq ($(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7), y)
|
||||
FSTYPE = jffs2
|
||||
endif
|
||||
ROOTFS_DIR = $(OUT)/rootfs
|
||||
ROOTFS_ZIP = $(OUT)/rootfs.zip
|
||||
|
||||
|
||||
1
OAT.xml
1
OAT.xml
@@ -23,6 +23,7 @@
|
||||
<licensefile></licensefile>
|
||||
<policylist>
|
||||
<policy name="projectPolicy" desc="">
|
||||
<policyitem type="copyright" name="Huawei Technologies Co., Ltd. All rights reserved." path=".*" desc="original liteos copyright"/>
|
||||
<policyitem type="copyright" name="Huawei Device Co., Ltd. All rights reserved." path=".*" desc="original liteos copyright"/>
|
||||
<policyitem type="license" name="BSD-3-Clause" path=".*" desc="Liteos kernel use bsd3 license"/>
|
||||
</policy>
|
||||
|
||||
@@ -180,7 +180,8 @@ static void LmsStrcpyTest(void)
|
||||
return;
|
||||
}
|
||||
char *testStr = "bbbbbbbbbbbbbbbbb";
|
||||
printf("[LmsStrcpyTest] strcpy overflow error should be triggered, src string buf size:%d\n", strlen(testStr) + 1);
|
||||
printf("[LmsStrcpyTest] strcpy overflow error should be triggered, src string buf size:%d\n",
|
||||
(int)strlen(testStr) + 1);
|
||||
strcpy(buf, testStr);
|
||||
free(buf);
|
||||
printf("\n-------- LmsStrcpyTest End --------\n");
|
||||
|
||||
@@ -62,7 +62,7 @@ int main(int argc, char **argv)
|
||||
PerfStop(fd);
|
||||
} else if ((argc == THREE_ARGS) && strcmp(argv[1], "read") == 0) {
|
||||
size_t size = strtoul(argv[THREE_ARGS - 1], NULL, 0);
|
||||
if (size <= 0) {
|
||||
if (size == 0) {
|
||||
goto EXIT:
|
||||
}
|
||||
|
||||
|
||||
@@ -1437,10 +1437,8 @@ u32_t lwip_tftp_get_file_by_filename_to_rawmem(u32_t ulHostAddr,
|
||||
{
|
||||
s32_t iSockNum = TFTP_NULL_INT32;
|
||||
u32_t ulSrcStrLen;
|
||||
u32_t lDestStrLen;
|
||||
u32_t ulSize;
|
||||
u32_t ulRecvSize = TFTP_NULL_UINT32;
|
||||
s32_t iErrCode;
|
||||
u32_t ulErrCode;
|
||||
u16_t usReadReq;
|
||||
u16_t usTempServPort;
|
||||
|
||||
@@ -70,7 +70,7 @@ static void TraceRead(int fd, size_t size)
|
||||
{
|
||||
ssize_t i;
|
||||
ssize_t len;
|
||||
if (size <= 0) {
|
||||
if (size == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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:
|
||||
|
||||
@@ -39,10 +39,6 @@ kernel_module(module_name) {
|
||||
|
||||
include_dirs = [ "$LITEOSTOPDIR/fs/jffs2/include" ]
|
||||
|
||||
if (defined(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7)) {
|
||||
include_dirs += [ "//device/qemu/drivers/cfiflash" ]
|
||||
}
|
||||
|
||||
public_configs = [ ":public" ]
|
||||
}
|
||||
|
||||
|
||||
@@ -36,10 +36,6 @@ LOCAL_SRCS := $(wildcard src/*.c)
|
||||
LOCAL_INCLUDE := \
|
||||
-I $(LITEOSTOPDIR)/fs/jffs2/include
|
||||
|
||||
ifeq ($(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7), y)
|
||||
LOCAL_INCLUDE += -I $(LITEOSTOPDIR)/../../device/qemu/drivers/cfiflash
|
||||
endif
|
||||
|
||||
LOCAL_FLAGS := $(LOCAL_INCLUDE)
|
||||
|
||||
include $(MODULE)
|
||||
|
||||
@@ -39,11 +39,6 @@
|
||||
#include "fs/driver.h"
|
||||
#include "mtd/mtd_legacy_lite.h"
|
||||
|
||||
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
|
||||
#include "cfiflash.h"
|
||||
#endif
|
||||
|
||||
|
||||
#define DRIVER_NAME_ADD_SIZE 3
|
||||
pthread_mutex_t g_mtdPartitionLock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
@@ -134,17 +129,10 @@ static VOID MtdNorParamAssign(partition_param *spinorParam, const struct MtdDev
|
||||
* you can change the SPIBLK_NAME or SPICHR_NAME to NULL.
|
||||
*/
|
||||
spinorParam->flash_mtd = (struct MtdDev *)spinorMtd;
|
||||
#ifndef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
|
||||
spinorParam->flash_ops = GetDevSpinorOps();
|
||||
spinorParam->char_ops = GetMtdCharFops();
|
||||
spinorParam->blockname = SPIBLK_NAME;
|
||||
spinorParam->charname = SPICHR_NAME;
|
||||
#else
|
||||
spinorParam->flash_ops = GetCfiBlkOps();
|
||||
spinorParam->char_ops = NULL;
|
||||
spinorParam->blockname = CFI_DRIVER;
|
||||
spinorParam->charname = NULL;
|
||||
#endif
|
||||
spinorParam->partition_head = g_spinorPartitionHead;
|
||||
spinorParam->block_size = spinorMtd->eraseSize;
|
||||
}
|
||||
@@ -158,11 +146,7 @@ static VOID MtdDeinitSpinorParam(VOID)
|
||||
|
||||
static partition_param *MtdInitSpinorParam(partition_param *spinorParam)
|
||||
{
|
||||
#ifndef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
|
||||
struct MtdDev *spinorMtd = GetMtd("spinor");
|
||||
#else
|
||||
struct MtdDev *spinorMtd = GetCfiMtdDev();
|
||||
#endif
|
||||
if (spinorMtd == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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:
|
||||
@@ -1409,7 +1409,7 @@ DWORD fattime_format(time_t time)
|
||||
ftime |= ((DWORD)((st.tm_year > YEAR_OFFSET) ? (st.tm_year - YEAR_OFFSET) : 0)) << FTIME_YEAR_OFFSET;
|
||||
ftime <<= FTIME_DATE_OFFSET;
|
||||
|
||||
ftime = (DWORD)st.tm_sec / SEC_MULTIPLIER;
|
||||
ftime |= (DWORD)st.tm_sec / SEC_MULTIPLIER;
|
||||
ftime |= ((DWORD)st.tm_min) << FTIME_MIN_OFFSET;
|
||||
ftime |= ((DWORD)st.tm_hour) << FTIME_HR_OFFSET;
|
||||
|
||||
@@ -2167,7 +2167,7 @@ int fatfs_symlink(struct Vnode *parentVnode, struct Vnode **newVnode, const char
|
||||
ssize_t fatfs_readlink(struct Vnode *vnode, char *buffer, size_t bufLen)
|
||||
{
|
||||
int ret;
|
||||
FRESULT res = FR_OK;
|
||||
FRESULT res;
|
||||
DWORD clust;
|
||||
QWORD sect;
|
||||
DIR_FILE *dfp = (DIR_FILE *)(vnode->data);
|
||||
|
||||
@@ -49,7 +49,7 @@ struct Mount {
|
||||
LIST_HEAD vnodeList; /* list of vnodes */
|
||||
int vnodeSize; /* size of vnode list */
|
||||
LIST_HEAD activeVnodeList; /* list of active vnodes */
|
||||
int activeVnodeSize; /* szie of active vnodes list */
|
||||
int activeVnodeSize; /* size of active vnodes list */
|
||||
void *data; /* private data */
|
||||
uint32_t hashseed; /* Random seed for vfshash */
|
||||
unsigned long mountFlags; /* Flags for mount */
|
||||
|
||||
@@ -2311,7 +2311,7 @@ diff -Nupr old/fs/jffs2/erase.c new/fs/jffs2/erase.c
|
||||
diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
|
||||
--- old/fs/jffs2/file.c 2022-05-09 17:22:53.000000000 +0800
|
||||
+++ new/fs/jffs2/file.c 2022-05-10 09:43:14.250000000 +0800
|
||||
@@ -9,325 +9,34 @@
|
||||
@@ -9,335 +9,30 @@
|
||||
* For licensing information, see the file 'LICENCE' in this directory.
|
||||
*
|
||||
*/
|
||||
@@ -2336,32 +2336,35 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
|
||||
- loff_t pos, unsigned len, unsigned flags,
|
||||
- struct page **pagep, void **fsdata);
|
||||
-static int jffs2_readpage (struct file *filp, struct page *pg);
|
||||
-
|
||||
-int jffs2_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
|
||||
-{
|
||||
- struct inode *inode = filp->f_mapping->host;
|
||||
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
|
||||
- int ret;
|
||||
-
|
||||
- ret = file_write_and_wait_range(filp, start, end);
|
||||
- if (ret)
|
||||
- return ret;
|
||||
|
||||
- inode_lock(inode);
|
||||
- /* Trigger GC to flush any pending writes for this inode */
|
||||
- jffs2_flush_wbuf_gc(c, inode->i_ino);
|
||||
- inode_unlock(inode);
|
||||
+static unsigned char gc_buffer[PAGE_SIZE]; //avoids malloc when user may be under memory pressure
|
||||
|
||||
- return 0;
|
||||
-}
|
||||
|
||||
-const struct file_operations jffs2_file_operations =
|
||||
-int jffs2_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
|
||||
+unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c,
|
||||
+ struct jffs2_inode_info *f,
|
||||
+ unsigned long offset,
|
||||
+ unsigned long *priv)
|
||||
{
|
||||
- struct inode *inode = filp->f_mapping->host;
|
||||
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
|
||||
+ /* FIXME: This works only with one file system mounted at a time */
|
||||
int ret;
|
||||
-
|
||||
- ret = file_write_and_wait_range(filp, start, end);
|
||||
+ ret = jffs2_read_inode_range(c, f, gc_buffer,
|
||||
+ offset & ~(PAGE_SIZE-1), PAGE_SIZE);
|
||||
if (ret)
|
||||
- return ret;
|
||||
-
|
||||
- inode_lock(inode);
|
||||
- /* Trigger GC to flush any pending writes for this inode */
|
||||
- jffs2_flush_wbuf_gc(c, inode->i_ino);
|
||||
- inode_unlock(inode);
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-const struct file_operations jffs2_file_operations =
|
||||
-{
|
||||
- .llseek = generic_file_llseek,
|
||||
- .open = generic_file_open,
|
||||
- .read_iter = generic_file_read_iter,
|
||||
@@ -2395,9 +2398,8 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
|
||||
- struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
|
||||
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
|
||||
- unsigned char *pg_buf;
|
||||
+ /* FIXME: This works only with one file system mounted at a time */
|
||||
int ret;
|
||||
|
||||
- int ret;
|
||||
-
|
||||
- jffs2_dbg(2, "%s(): ino #%lu, page at offset 0x%lx\n",
|
||||
- __func__, inode->i_ino, pg->index << PAGE_SHIFT);
|
||||
-
|
||||
@@ -2436,18 +2438,15 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
|
||||
-{
|
||||
- struct jffs2_inode_info *f = JFFS2_INODE_INFO(pg->mapping->host);
|
||||
- int ret;
|
||||
+ ret = jffs2_read_inode_range(c, f, gc_buffer,
|
||||
+ offset & ~(PAGE_SIZE-1), PAGE_SIZE);
|
||||
+ if (ret)
|
||||
+ return ERR_PTR(ret);
|
||||
|
||||
-
|
||||
- mutex_lock(&f->sem);
|
||||
- ret = jffs2_do_readpage_unlock(pg->mapping->host, pg);
|
||||
- mutex_unlock(&f->sem);
|
||||
- return ret;
|
||||
+ return ERR_PTR(ret);
|
||||
+ return gc_buffer;
|
||||
}
|
||||
-
|
||||
|
||||
-static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
|
||||
- loff_t pos, unsigned len, unsigned flags,
|
||||
- struct page **pagep, void **fsdata)
|
||||
@@ -2458,20 +2457,15 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
|
||||
- struct page *pg;
|
||||
- struct inode *inode = mapping->host;
|
||||
- struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
|
||||
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
|
||||
- pgoff_t index = pos >> PAGE_SHIFT;
|
||||
- uint32_t pageofs = index << PAGE_SHIFT;
|
||||
- int ret = 0;
|
||||
-
|
||||
- pg = grab_cache_page_write_begin(mapping, index, flags);
|
||||
- if (!pg)
|
||||
- return -ENOMEM;
|
||||
- *pagep = pg;
|
||||
-
|
||||
- jffs2_dbg(1, "%s()\n", __func__);
|
||||
-
|
||||
- if (pageofs > inode->i_size) {
|
||||
- /* Make new hole frag from old EOF to new page */
|
||||
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
|
||||
- struct jffs2_raw_inode ri;
|
||||
- struct jffs2_full_dnode *fn;
|
||||
- uint32_t alloc_len;
|
||||
@@ -2482,7 +2476,7 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
|
||||
- ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len,
|
||||
- ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE);
|
||||
- if (ret)
|
||||
- goto out_page;
|
||||
- goto out_err;
|
||||
-
|
||||
- mutex_lock(&f->sem);
|
||||
- memset(&ri, 0, sizeof(ri));
|
||||
@@ -2512,7 +2506,7 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
|
||||
- ret = PTR_ERR(fn);
|
||||
- jffs2_complete_reservation(c);
|
||||
- mutex_unlock(&f->sem);
|
||||
- goto out_page;
|
||||
- goto out_err;
|
||||
- }
|
||||
- ret = jffs2_add_full_dnode_to_inode(c, f, fn);
|
||||
- if (f->metadata) {
|
||||
@@ -2527,7 +2521,7 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
|
||||
- jffs2_free_full_dnode(fn);
|
||||
- jffs2_complete_reservation(c);
|
||||
- mutex_unlock(&f->sem);
|
||||
- goto out_page;
|
||||
- goto out_err;
|
||||
- }
|
||||
- jffs2_complete_reservation(c);
|
||||
- inode->i_size = pageofs;
|
||||
@@ -2535,6 +2529,19 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- * While getting a page and reading data in, lock c->alloc_sem until
|
||||
- * the page is Uptodate. Otherwise GC task may attempt to read the same
|
||||
- * page in read_cache_page(), which causes a deadlock.
|
||||
- */
|
||||
- mutex_lock(&c->alloc_sem);
|
||||
- pg = grab_cache_page_write_begin(mapping, index, flags);
|
||||
- if (!pg) {
|
||||
- ret = -ENOMEM;
|
||||
- goto release_sem;
|
||||
- }
|
||||
- *pagep = pg;
|
||||
-
|
||||
- /*
|
||||
- * Read in the page if it wasn't already present. Cannot optimize away
|
||||
- * the whole page write case until jffs2_write_end can handle the
|
||||
- * case of a short-copy.
|
||||
@@ -2543,19 +2550,20 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
|
||||
- mutex_lock(&f->sem);
|
||||
- ret = jffs2_do_readpage_nolock(inode, pg);
|
||||
- mutex_unlock(&f->sem);
|
||||
- if (ret)
|
||||
- goto out_page;
|
||||
- if (ret) {
|
||||
- unlock_page(pg);
|
||||
- put_page(pg);
|
||||
- goto release_sem;
|
||||
- }
|
||||
- }
|
||||
- jffs2_dbg(1, "end write_begin(). pg->flags %lx\n", pg->flags);
|
||||
- return ret;
|
||||
-
|
||||
-out_page:
|
||||
- unlock_page(pg);
|
||||
- put_page(pg);
|
||||
-release_sem:
|
||||
- mutex_unlock(&c->alloc_sem);
|
||||
-out_err:
|
||||
- return ret;
|
||||
+ /* Do nothing */
|
||||
}
|
||||
|
||||
-}
|
||||
-
|
||||
-static int jffs2_write_end(struct file *filp, struct address_space *mapping,
|
||||
- loff_t pos, unsigned len, unsigned copied,
|
||||
- struct page *pg, void *fsdata)
|
||||
@@ -2653,7 +2661,8 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
|
||||
- unlock_page(pg);
|
||||
- put_page(pg);
|
||||
- return writtenlen > 0 ? writtenlen : ret;
|
||||
-}
|
||||
+ /* Do nothing */
|
||||
}
|
||||
diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
|
||||
--- old/fs/jffs2/fs.c 2022-05-09 17:22:53.000000000 +0800
|
||||
+++ new/fs/jffs2/fs.c 2022-05-10 16:13:37.830000000 +0800
|
||||
@@ -2769,7 +2778,11 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
|
||||
ri->version = cpu_to_je32(++f->highest_version);
|
||||
+ ri->uid = cpu_to_je16(inode->i_uid);
|
||||
+ ri->gid = cpu_to_je16(inode->i_gid);
|
||||
+
|
||||
|
||||
- ri->uid = cpu_to_je16((ivalid & ATTR_UID)?
|
||||
- from_kuid(&init_user_ns, iattr->ia_uid):i_uid_read(inode));
|
||||
- ri->gid = cpu_to_je16((ivalid & ATTR_GID)?
|
||||
- from_kgid(&init_user_ns, iattr->ia_gid):i_gid_read(inode));
|
||||
+ if (ivalid & CHG_UID) {
|
||||
+ if (((c_uid != inode->i_uid) || (attr->attr_chg_uid != inode->i_uid)) && (!IsCapPermit(CAP_CHOWN))) {
|
||||
+ jffs2_complete_reservation(c);
|
||||
@@ -2791,16 +2804,7 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
|
||||
+ ri->gid = cpu_to_je16(attr->attr_chg_gid);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- ri->uid = cpu_to_je16((ivalid & ATTR_UID)?
|
||||
- from_kuid(&init_user_ns, iattr->ia_uid):i_uid_read(inode));
|
||||
- ri->gid = cpu_to_je16((ivalid & ATTR_GID)?
|
||||
- from_kgid(&init_user_ns, iattr->ia_gid):i_gid_read(inode));
|
||||
-
|
||||
- if (ivalid & ATTR_MODE)
|
||||
- ri->mode = cpu_to_jemode(iattr->ia_mode);
|
||||
- else
|
||||
- ri->mode = cpu_to_jemode(inode->i_mode);
|
||||
+
|
||||
+ if (ivalid & CHG_MODE) {
|
||||
+ if (!IsCapPermit(CAP_FOWNER) && (c_uid != inode->i_uid)) {
|
||||
+ jffs2_complete_reservation(c);
|
||||
@@ -2814,6 +2818,10 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- if (ivalid & ATTR_MODE)
|
||||
- ri->mode = cpu_to_jemode(iattr->ia_mode);
|
||||
- else
|
||||
- ri->mode = cpu_to_jemode(inode->i_mode);
|
||||
+ if (ivalid & CHG_ATIME) {
|
||||
+ if ((c_uid != inode->i_uid) || (attr->attr_chg_uid != inode->i_uid)) {
|
||||
+ return -EPERM;
|
||||
@@ -2823,7 +2831,7 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
|
||||
+ } else {
|
||||
+ ri->atime = cpu_to_je32(inode->i_atime);
|
||||
+ }
|
||||
+
|
||||
|
||||
+ if (ivalid & CHG_MTIME) {
|
||||
+ if ((c_uid != inode->i_uid) || (attr->attr_chg_uid != inode->i_uid)) {
|
||||
+ return -EPERM;
|
||||
@@ -2875,7 +2883,7 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
|
||||
if (IS_ERR(new_metadata)) {
|
||||
jffs2_complete_reservation(c);
|
||||
jffs2_free_raw_inode(ri);
|
||||
@@ -147,23 +140,20 @@ int jffs2_do_setattr (struct inode *inod
|
||||
@@ -147,23 +140,20 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
|
||||
return PTR_ERR(new_metadata);
|
||||
}
|
||||
/* It worked. Update the inode */
|
||||
@@ -2908,7 +2916,7 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
|
||||
f->metadata = NULL;
|
||||
} else {
|
||||
f->metadata = new_metadata;
|
||||
@@ -182,315 +172,201 @@ int jffs2_do_setattr (struct inode *inod
|
||||
@@ -182,315 +172,201 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
|
||||
We are protected from a simultaneous write() extending i_size
|
||||
back past iattr->ia_size, because do_truncate() holds the
|
||||
generic inode semaphore. */
|
||||
@@ -2927,31 +2935,43 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
|
||||
{
|
||||
- struct inode *inode = d_inode(dentry);
|
||||
- int rc;
|
||||
-
|
||||
- rc = setattr_prepare(dentry, iattr);
|
||||
- if (rc)
|
||||
- return rc;
|
||||
-
|
||||
- rc = jffs2_do_setattr(inode, iattr);
|
||||
- if (!rc && (iattr->ia_valid & ATTR_MODE))
|
||||
- rc = posix_acl_chmod(inode, inode->i_mode);
|
||||
+ /* We can forget about this inode for now - drop all
|
||||
+ * the nodelists associated with it, etc.
|
||||
+ */
|
||||
+ struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
|
||||
+ struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
|
||||
+
|
||||
+ jffs2_do_clear_inode(c, f);
|
||||
+}
|
||||
|
||||
- rc = setattr_prepare(dentry, iattr);
|
||||
- if (rc)
|
||||
- return rc;
|
||||
+static struct jffs2_inode *ilookup(struct super_block *sb, uint32_t ino)
|
||||
+{
|
||||
+ struct jffs2_inode *node = NULL;
|
||||
|
||||
- rc = jffs2_do_setattr(inode, iattr);
|
||||
- if (!rc && (iattr->ia_valid & ATTR_MODE))
|
||||
- rc = posix_acl_chmod(inode, inode->i_mode);
|
||||
+ if (sb->s_root == NULL) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
|
||||
- return rc;
|
||||
+ jffs2_do_clear_inode(c, f);
|
||||
+ // Check for this inode in the cache
|
||||
+ Jffs2NodeLock();
|
||||
+ (void)Jffs2HashGet(&sb->s_node_hash_lock, &sb->s_node_hash[0], sb, ino, &node);
|
||||
+ Jffs2NodeUnlock();
|
||||
+ return node;
|
||||
}
|
||||
|
||||
-int jffs2_statfs(struct dentry *dentry, struct kstatfs *buf)
|
||||
+static struct jffs2_inode *ilookup(struct super_block *sb, uint32_t ino)
|
||||
+struct jffs2_inode *new_inode(struct super_block *sb)
|
||||
{
|
||||
- struct jffs2_sb_info *c = JFFS2_SB_INFO(dentry->d_sb);
|
||||
- unsigned long avail;
|
||||
+ struct jffs2_inode *node = NULL;
|
||||
|
||||
-
|
||||
- buf->f_type = JFFS2_SUPER_MAGIC;
|
||||
- buf->f_bsize = 1 << PAGE_SHIFT;
|
||||
- buf->f_blocks = c->flash_size >> PAGE_SHIFT;
|
||||
@@ -2970,47 +2990,35 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
|
||||
- spin_unlock(&c->erase_completion_lock);
|
||||
-
|
||||
- buf->f_bavail = buf->f_bfree = avail >> PAGE_SHIFT;
|
||||
+ if (sb->s_root == NULL) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ struct jffs2_inode *inode = NULL;
|
||||
|
||||
- return 0;
|
||||
+ // Check for this inode in the cache
|
||||
+ Jffs2NodeLock();
|
||||
+ (void)Jffs2HashGet(&sb->s_node_hash_lock, &sb->s_node_hash[0], sb, ino, &node);
|
||||
+ Jffs2NodeUnlock();
|
||||
+ return node;
|
||||
}
|
||||
-}
|
||||
+ inode = zalloc(sizeof (struct jffs2_inode));
|
||||
+ if (inode == NULL)
|
||||
+ return 0;
|
||||
|
||||
+ D2(PRINTK("malloc new_inode %x ####################################\n",
|
||||
+ inode));
|
||||
|
||||
-
|
||||
-void jffs2_evict_inode (struct inode *inode)
|
||||
+struct jffs2_inode *new_inode(struct super_block *sb)
|
||||
{
|
||||
-{
|
||||
- /* We can forget about this inode for now - drop all
|
||||
- * the nodelists associated with it, etc.
|
||||
- */
|
||||
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
|
||||
- struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
|
||||
+ struct jffs2_inode *inode = NULL;
|
||||
+ inode->i_sb = sb;
|
||||
+ inode->i_ino = 1;
|
||||
+ inode->i_nlink = 1; // Let JFFS2 manage the link count
|
||||
+ inode->i_size = 0;
|
||||
+ LOS_ListInit((&(inode->i_hashlist)));
|
||||
|
||||
- jffs2_dbg(1, "%s(): ino #%lu mode %o\n",
|
||||
- __func__, inode->i_ino, inode->i_mode);
|
||||
- truncate_inode_pages_final(&inode->i_data);
|
||||
- clear_inode(inode);
|
||||
- jffs2_do_clear_inode(c, f);
|
||||
+ inode = zalloc(sizeof (struct jffs2_inode));
|
||||
+ if (inode == NULL)
|
||||
+ return 0;
|
||||
+
|
||||
+ D2(PRINTK("malloc new_inode %x ####################################\n",
|
||||
+ inode));
|
||||
+
|
||||
+ inode->i_sb = sb;
|
||||
+ inode->i_ino = 1;
|
||||
+ inode->i_nlink = 1; // Let JFFS2 manage the link count
|
||||
+ inode->i_size = 0;
|
||||
+ LOS_ListInit((&(inode->i_hashlist)));
|
||||
+
|
||||
+ return inode;
|
||||
}
|
||||
|
||||
@@ -3075,16 +3083,16 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
|
||||
- inode->i_ctime = ITIME(je32_to_cpu(latest_node.ctime));
|
||||
-
|
||||
- set_nlink(inode, f->inocache->pino_nlink);
|
||||
-
|
||||
- inode->i_blocks = (inode->i_size + 511) >> 9;
|
||||
+ inode->i_atime = je32_to_cpu(latest_node.atime);
|
||||
+ inode->i_mtime = je32_to_cpu(latest_node.mtime);
|
||||
+ inode->i_ctime = je32_to_cpu(latest_node.ctime);
|
||||
+ inode->i_nlink = f->inocache->pino_nlink;
|
||||
|
||||
- inode->i_blocks = (inode->i_size + 511) >> 9;
|
||||
- switch (inode->i_mode & S_IFMT) {
|
||||
+ (void)mutex_unlock(&f->sem);
|
||||
|
||||
- switch (inode->i_mode & S_IFMT) {
|
||||
-
|
||||
- case S_IFLNK:
|
||||
- inode->i_op = &jffs2_symlink_inode_operations;
|
||||
- inode->i_link = f->target;
|
||||
@@ -3154,20 +3162,21 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
|
||||
jffs2_dbg(1, "jffs2_read_inode() returning\n");
|
||||
- unlock_new_inode(inode);
|
||||
- return inode;
|
||||
-
|
||||
+ Jffs2NodeUnlock();
|
||||
|
||||
-error_io:
|
||||
- ret = -EIO;
|
||||
-error:
|
||||
- mutex_unlock(&f->sem);
|
||||
- iget_failed(inode);
|
||||
- return ERR_PTR(ret);
|
||||
-}
|
||||
+ Jffs2NodeUnlock();
|
||||
+ return inode;
|
||||
}
|
||||
|
||||
-void jffs2_dirty_inode(struct inode *inode, int flags)
|
||||
-{
|
||||
- struct iattr iattr;
|
||||
-
|
||||
|
||||
- if (!(inode->i_state & I_DIRTY_DATASYNC)) {
|
||||
- jffs2_dbg(2, "%s(): not calling setattr() for ino #%lu\n",
|
||||
- __func__, inode->i_ino);
|
||||
@@ -3186,16 +3195,19 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
|
||||
- iattr.ia_ctime = inode->i_ctime;
|
||||
-
|
||||
- jffs2_do_setattr(inode, &iattr);
|
||||
+ return inode;
|
||||
}
|
||||
-}
|
||||
+// -------------------------------------------------------------------------
|
||||
+// Decrement the reference count on an inode. If this makes the ref count
|
||||
+// zero, then this inode can be freed.
|
||||
|
||||
-int jffs2_do_remount_fs(struct super_block *sb, struct fs_context *fc)
|
||||
-{
|
||||
+int jffs2_iput(struct jffs2_inode *i)
|
||||
{
|
||||
- struct jffs2_sb_info *c = JFFS2_SB_INFO(sb);
|
||||
-
|
||||
- if (c->flags & JFFS2_SB_FLAG_RO && !sb_rdonly(sb))
|
||||
- return -EROFS;
|
||||
|
||||
-
|
||||
- /* We stop if it was running, then restart if it needs to.
|
||||
- This also catches the case where it was stopped and this
|
||||
- is just a remount to restart it.
|
||||
@@ -3206,12 +3218,9 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
|
||||
- jffs2_flush_wbuf_pad(c);
|
||||
- mutex_unlock(&c->alloc_sem);
|
||||
- }
|
||||
+// -------------------------------------------------------------------------
|
||||
+// Decrement the reference count on an inode. If this makes the ref count
|
||||
+// zero, then this inode can be freed.
|
||||
+
|
||||
+int jffs2_iput(struct jffs2_inode *i)
|
||||
+{
|
||||
-
|
||||
- if (!(fc->sb_flags & SB_RDONLY))
|
||||
- jffs2_start_garbage_collect_thread(c);
|
||||
+ // Called in jffs2_find
|
||||
+ // (and jffs2_open and jffs2_ops_mkdir?)
|
||||
+ // super.c jffs2_fill_super,
|
||||
@@ -3233,9 +3242,6 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
|
||||
+ free(i);
|
||||
+ Jffs2NodeUnlock();
|
||||
|
||||
- if (!(fc->sb_flags & SB_RDONLY))
|
||||
- jffs2_start_garbage_collect_thread(c);
|
||||
-
|
||||
- fc->sb_flags |= SB_NOATIME;
|
||||
return 0;
|
||||
}
|
||||
@@ -3342,7 +3348,7 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
|
||||
{
|
||||
/*
|
||||
* Pick a inocache hash size based on the size of the medium.
|
||||
@@ -510,117 +386,17 @@ static int calculate_inocache_hashsize(u
|
||||
@@ -510,118 +386,17 @@ static int calculate_inocache_hashsize(uint32_t flash_size)
|
||||
return hashsize;
|
||||
}
|
||||
|
||||
@@ -3438,8 +3444,9 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
|
||||
- jffs2_free_ino_caches(c);
|
||||
- jffs2_free_raw_node_refs(c);
|
||||
- kvfree(c->blocks);
|
||||
- out_inohash:
|
||||
- jffs2_clear_xattr_subsystem(c);
|
||||
- jffs2_sum_exit(c);
|
||||
- out_inohash:
|
||||
- kfree(c->inocache_list);
|
||||
- out_wbuf:
|
||||
- jffs2_flash_cleanup(c);
|
||||
@@ -3448,8 +3455,7 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
|
||||
-}
|
||||
-
|
||||
void jffs2_gc_release_inode(struct jffs2_sb_info *c,
|
||||
- struct jffs2_inode_info *f)
|
||||
+ struct jffs2_inode_info *f)
|
||||
struct jffs2_inode_info *f)
|
||||
{
|
||||
- iput(OFNI_EDONI_2SFFJ(f));
|
||||
+ struct jffs2_inode *node = OFNI_EDONI_2SFFJ(f);
|
||||
@@ -3464,7 +3470,7 @@ diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
|
||||
struct jffs2_inode_cache *ic;
|
||||
|
||||
if (unlinked) {
|
||||
@@ -668,72 +444,9 @@ struct jffs2_inode_info *jffs2_gc_fetch_
|
||||
@@ -669,72 +444,9 @@ struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c,
|
||||
Just iget() it, and if read_inode() is necessary that's OK.
|
||||
*/
|
||||
inode = jffs2_iget(OFNI_BS_2SFFJ(c), inum);
|
||||
@@ -5556,7 +5562,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
|
||||
|
||||
#define DEFAULT_EMPTY_SCAN_SIZE 256
|
||||
|
||||
@@ -74,7 +73,7 @@ static int file_dirty(struct jffs2_sb_in
|
||||
@@ -74,7 +73,7 @@ static int file_dirty(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb)
|
||||
return ret;
|
||||
if ((ret = jffs2_scan_dirty_space(c, jeb, jeb->free_size)))
|
||||
return ret;
|
||||
@@ -5565,15 +5571,13 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
|
||||
think it's recoverable now. */
|
||||
jeb->dirty_size += jeb->wasted_size;
|
||||
c->dirty_size += jeb->wasted_size;
|
||||
@@ -95,40 +94,26 @@ int jffs2_scan_medium(struct jffs2_sb_in
|
||||
@@ -95,40 +94,26 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
|
||||
unsigned char *flashbuf = NULL;
|
||||
uint32_t buf_size = 0;
|
||||
struct jffs2_summary *s = NULL; /* summary info collected by the scan process */
|
||||
-#ifndef __ECOS
|
||||
- size_t pointlen, try_size;
|
||||
+ struct super_block *sb = NULL;
|
||||
+ struct MtdNorDev *device = NULL;
|
||||
|
||||
-
|
||||
- ret = mtd_point(c->mtd, 0, c->mtd->size, &pointlen,
|
||||
- (void **)&flashbuf, NULL);
|
||||
- if (!ret && pointlen < c->mtd->size) {
|
||||
@@ -5586,6 +5590,9 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
|
||||
- if (ret && ret != -EOPNOTSUPP)
|
||||
- jffs2_dbg(1, "MTD point failed %d\n", ret);
|
||||
-#endif
|
||||
+ struct super_block *sb = NULL;
|
||||
+ struct MtdNorDev *device = NULL;
|
||||
+
|
||||
if (!flashbuf) {
|
||||
/* For NAND it's quicker to read a whole eraseblock at a time,
|
||||
apparently */
|
||||
@@ -5613,7 +5620,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
|
||||
}
|
||||
|
||||
if (jffs2_sum_active()) {
|
||||
@@ -140,7 +125,9 @@ int jffs2_scan_medium(struct jffs2_sb_in
|
||||
@@ -140,7 +125,9 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5624,7 +5631,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
|
||||
struct jffs2_eraseblock *jeb = &c->blocks[i];
|
||||
|
||||
cond_resched();
|
||||
@@ -269,19 +256,12 @@ int jffs2_scan_medium(struct jffs2_sb_in
|
||||
@@ -269,14 +256,10 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
@@ -5634,20 +5641,13 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
|
||||
}
|
||||
ret = 0;
|
||||
out:
|
||||
- if (buf_size)
|
||||
- kfree(flashbuf);
|
||||
-#ifndef __ECOS
|
||||
- else
|
||||
- mtd_unpoint(c->mtd, 0, c->mtd->size);
|
||||
-#endif
|
||||
- jffs2_sum_reset_collected(s);
|
||||
- kfree(s);
|
||||
+
|
||||
+ kfree(flashbuf);
|
||||
+
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -411,7 +391,7 @@ static int jffs2_scan_xref_node(struct j
|
||||
out_buf:
|
||||
if (buf_size)
|
||||
kfree(flashbuf);
|
||||
@@ -413,7 +396,7 @@ static int jffs2_scan_xref_node(struct jffs2_sb_info *c, struct jffs2_eraseblock
|
||||
if (!ref)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -5656,7 +5656,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
|
||||
* and AFTER xattr_ref is marked as a dead xref,
|
||||
* ref->xid is used to store 32bit xid, xd is not used
|
||||
* ref->ino is used to store 32bit inode-number, ic is not used
|
||||
@@ -484,10 +464,10 @@ static int jffs2_scan_eraseblock (struct
|
||||
@@ -486,10 +469,10 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
struct jffs2_sum_marker *sm;
|
||||
void *sumptr = NULL;
|
||||
uint32_t sumlen;
|
||||
@@ -5669,7 +5669,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
|
||||
if (je32_to_cpu(sm->magic) == JFFS2_SUM_MAGIC) {
|
||||
sumptr = buf + je32_to_cpu(sm->offset);
|
||||
sumlen = c->sector_size - je32_to_cpu(sm->offset);
|
||||
@@ -500,13 +480,13 @@ static int jffs2_scan_eraseblock (struct
|
||||
@@ -502,13 +485,13 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
buf_len = sizeof(*sm);
|
||||
|
||||
/* Read as much as we want into the _end_ of the preallocated buffer */
|
||||
@@ -5686,7 +5686,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
|
||||
if (je32_to_cpu(sm->magic) == JFFS2_SUM_MAGIC) {
|
||||
sumlen = c->sector_size - je32_to_cpu(sm->offset);
|
||||
sumptr = buf + buf_size - sumlen;
|
||||
@@ -521,18 +501,15 @@ static int jffs2_scan_eraseblock (struct
|
||||
@@ -523,18 +506,15 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
sumptr = kmalloc(sumlen, GFP_KERNEL);
|
||||
if (!sumptr)
|
||||
return -ENOMEM;
|
||||
@@ -5709,7 +5709,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
|
||||
}
|
||||
}
|
||||
|
||||
@@ -543,7 +520,7 @@ static int jffs2_scan_eraseblock (struct
|
||||
@@ -545,7 +525,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
|
||||
if (buf_size && sumlen > buf_size)
|
||||
kfree(sumptr);
|
||||
@@ -5718,7 +5718,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
|
||||
If it returns positive, that's a block classification
|
||||
(i.e. BLK_STATE_xxx) so return that too.
|
||||
If it returns zero, fall through to full scan. */
|
||||
@@ -605,7 +582,7 @@ full_scan:
|
||||
@@ -607,7 +587,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
/* Now ofs is a complete physical flash offset as it always was... */
|
||||
ofs += jeb->offset;
|
||||
|
||||
@@ -5727,7 +5727,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
|
||||
|
||||
dbg_summary("no summary found in jeb 0x%08x. Apply original scan.\n",jeb->offset);
|
||||
|
||||
@@ -698,7 +675,7 @@ scan_more:
|
||||
@@ -700,7 +680,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
scan_end = buf_len;
|
||||
goto more_empty;
|
||||
}
|
||||
@@ -5736,7 +5736,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
|
||||
/* See how much more there is to read in this eraseblock... */
|
||||
buf_len = min_t(uint32_t, buf_size, jeb->offset + c->sector_size - ofs);
|
||||
if (!buf_len) {
|
||||
@@ -948,7 +925,7 @@ scan_more:
|
||||
@@ -950,7 +930,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
jffs2_dbg(1, "Block at 0x%08x: free 0x%08x, dirty 0x%08x, unchecked 0x%08x, used 0x%08x, wasted 0x%08x\n",
|
||||
jeb->offset, jeb->free_size, jeb->dirty_size,
|
||||
jeb->unchecked_size, jeb->used_size, jeb->wasted_size);
|
||||
@@ -5745,7 +5745,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
|
||||
/* mark_node_obsolete can add to wasted !! */
|
||||
if (jeb->wasted_size) {
|
||||
jeb->dirty_size += jeb->wasted_size;
|
||||
@@ -976,7 +953,6 @@ struct jffs2_inode_cache *jffs2_scan_mak
|
||||
@@ -978,7 +958,6 @@ struct jffs2_inode_cache *jffs2_scan_make_ino_cache(struct jffs2_sb_info *c, uin
|
||||
pr_notice("%s(): allocation of inode cache failed\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
@@ -5753,7 +5753,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
|
||||
|
||||
ic->ino = ino;
|
||||
ic->nodes = (void *)ic;
|
||||
@@ -1067,7 +1043,7 @@ static int jffs2_scan_dirent_node(struct
|
||||
@@ -1069,7 +1048,7 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
pseudo_random += je32_to_cpu(rd->version);
|
||||
|
||||
/* Should never happen. Did. (OLPC trac #4184)*/
|
||||
@@ -5762,7 +5762,7 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
|
||||
if (checkedlen < rd->nsize) {
|
||||
pr_err("Dirent at %08x has zeroes in name. Truncating to %d chars\n",
|
||||
ofs, checkedlen);
|
||||
@@ -1079,7 +1055,7 @@ static int jffs2_scan_dirent_node(struct
|
||||
@@ -1081,7 +1060,7 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
memcpy(&fd->name, rd->name, checkedlen);
|
||||
fd->name[checkedlen] = 0;
|
||||
|
||||
@@ -5771,7 +5771,248 @@ diff -Nupr old/fs/jffs2/scan.c new/fs/jffs2/scan.c
|
||||
if (crc != je32_to_cpu(rd->name_crc)) {
|
||||
pr_notice("%s(): Name CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",
|
||||
__func__, ofs, je32_to_cpu(rd->name_crc), crc);
|
||||
@@ -1104,7 +1080,7 @@ static int jffs2_scan_dirent_node(struct
|
||||
@@ -1106,7 +1085,7 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
fd->next = NULL;
|
||||
fd->version = je32_to_cpu(rd->version);
|
||||
fd->ino = je32_to_cpu(rd->ino);
|
||||
- fd->nhash = full_name_hash(NULL, fd->name, checkedlen);
|
||||
+ fd->nhash = full_name_hash(fd->name, checkedlen);
|
||||
fd->type = rd->type;
|
||||
jffs2_add_fd_to_list(c, fd, &ic->scan_dents);
|
||||
|
||||
diff
|
||||
@@ -9,18 +9,17 @@
|
||||
*
|
||||
*/
|
||||
|
||||
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
-
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/slab.h>
|
||||
-#include <linux/mtd/mtd.h>
|
||||
#include <linux/pagemap.h>
|
||||
-#include <linux/crc32.h>
|
||||
#include <linux/compiler.h>
|
||||
#include "nodelist.h"
|
||||
#include "summary.h"
|
||||
#include "debug.h"
|
||||
+#include "mtd_dev.h"
|
||||
+#include "los_typedef.h"
|
||||
+#include "los_crc32.h"
|
||||
|
||||
#define DEFAULT_EMPTY_SCAN_SIZE 256
|
||||
|
||||
@@ -74,7 +73,7 @@ static int file_dirty(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb)
|
||||
return ret;
|
||||
if ((ret = jffs2_scan_dirty_space(c, jeb, jeb->free_size)))
|
||||
return ret;
|
||||
- /* Turned wasted size into dirty, since we apparently
|
||||
+ /* Turned wasted size into dirty, since we apparently
|
||||
think it's recoverable now. */
|
||||
jeb->dirty_size += jeb->wasted_size;
|
||||
c->dirty_size += jeb->wasted_size;
|
||||
@@ -95,40 +94,26 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
|
||||
unsigned char *flashbuf = NULL;
|
||||
uint32_t buf_size = 0;
|
||||
struct jffs2_summary *s = NULL; /* summary info collected by the scan process */
|
||||
-#ifndef __ECOS
|
||||
- size_t pointlen, try_size;
|
||||
-
|
||||
- ret = mtd_point(c->mtd, 0, c->mtd->size, &pointlen,
|
||||
- (void **)&flashbuf, NULL);
|
||||
- if (!ret && pointlen < c->mtd->size) {
|
||||
- /* Don't muck about if it won't let us point to the whole flash */
|
||||
- jffs2_dbg(1, "MTD point returned len too short: 0x%zx\n",
|
||||
- pointlen);
|
||||
- mtd_unpoint(c->mtd, 0, pointlen);
|
||||
- flashbuf = NULL;
|
||||
- }
|
||||
- if (ret && ret != -EOPNOTSUPP)
|
||||
- jffs2_dbg(1, "MTD point failed %d\n", ret);
|
||||
-#endif
|
||||
+ struct super_block *sb = NULL;
|
||||
+ struct MtdNorDev *device = NULL;
|
||||
+
|
||||
if (!flashbuf) {
|
||||
/* For NAND it's quicker to read a whole eraseblock at a time,
|
||||
apparently */
|
||||
if (jffs2_cleanmarker_oob(c))
|
||||
- try_size = c->sector_size;
|
||||
+ buf_size = c->sector_size;
|
||||
else
|
||||
- try_size = PAGE_SIZE;
|
||||
+ buf_size = PAGE_SIZE;
|
||||
|
||||
jffs2_dbg(1, "Trying to allocate readbuf of %zu "
|
||||
- "bytes\n", try_size);
|
||||
+ "bytes\n", buf_size);
|
||||
|
||||
- flashbuf = mtd_kmalloc_up_to(c->mtd, &try_size);
|
||||
+ flashbuf = kmalloc(buf_size, GFP_KERNEL);
|
||||
if (!flashbuf)
|
||||
return -ENOMEM;
|
||||
|
||||
jffs2_dbg(1, "Allocated readbuf of %zu bytes\n",
|
||||
- try_size);
|
||||
-
|
||||
- buf_size = (uint32_t)try_size;
|
||||
+ buf_size);
|
||||
}
|
||||
|
||||
if (jffs2_sum_active()) {
|
||||
@@ -140,7 +125,9 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
|
||||
}
|
||||
}
|
||||
|
||||
- for (i=0; i<c->nr_blocks; i++) {
|
||||
+ sb = OFNI_BS_2SFFJ(c);
|
||||
+ device = (struct MtdNorDev*)(sb->s_dev);
|
||||
+ for (i=device->blockStart; i<c->nr_blocks + device->blockStart; i++) {
|
||||
struct jffs2_eraseblock *jeb = &c->blocks[i];
|
||||
|
||||
cond_resched();
|
||||
@@ -269,14 +256,10 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
- spin_lock(&c->erase_completion_lock);
|
||||
- jffs2_garbage_collect_trigger(c);
|
||||
- spin_unlock(&c->erase_completion_lock);
|
||||
}
|
||||
ret = 0;
|
||||
out:
|
||||
- jffs2_sum_reset_collected(s);
|
||||
- kfree(s);
|
||||
+ kfree(flashbuf);
|
||||
out_buf:
|
||||
if (buf_size)
|
||||
kfree(flashbuf);
|
||||
@@ -413,7 +396,7 @@ static int jffs2_scan_xref_node(struct jffs2_sb_info *c, struct jffs2_eraseblock
|
||||
if (!ref)
|
||||
return -ENOMEM;
|
||||
|
||||
- /* BEFORE jffs2_build_xattr_subsystem() called,
|
||||
+ /* BEFORE jffs2_build_xattr_subsystem() called,
|
||||
* and AFTER xattr_ref is marked as a dead xref,
|
||||
* ref->xid is used to store 32bit xid, xd is not used
|
||||
* ref->ino is used to store 32bit inode-number, ic is not used
|
||||
@@ -486,10 +469,10 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
struct jffs2_sum_marker *sm;
|
||||
void *sumptr = NULL;
|
||||
uint32_t sumlen;
|
||||
-
|
||||
+
|
||||
if (!buf_size) {
|
||||
/* XIP case. Just look, point at the summary if it's there */
|
||||
- sm = (void *)buf + c->sector_size - sizeof(*sm);
|
||||
+ sm = (struct jffs2_sum_marker *)((uint8_t *)buf + c->sector_size - sizeof(*sm));
|
||||
if (je32_to_cpu(sm->magic) == JFFS2_SUM_MAGIC) {
|
||||
sumptr = buf + je32_to_cpu(sm->offset);
|
||||
sumlen = c->sector_size - je32_to_cpu(sm->offset);
|
||||
@@ -502,13 +485,13 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
buf_len = sizeof(*sm);
|
||||
|
||||
/* Read as much as we want into the _end_ of the preallocated buffer */
|
||||
- err = jffs2_fill_scan_buf(c, buf + buf_size - buf_len,
|
||||
+ err = jffs2_fill_scan_buf(c, buf + buf_size - buf_len,
|
||||
jeb->offset + c->sector_size - buf_len,
|
||||
- buf_len);
|
||||
+ buf_len);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
- sm = (void *)buf + buf_size - sizeof(*sm);
|
||||
+ sm = (struct jffs2_sum_marker *)((uint8_t *)buf + buf_size - sizeof(*sm));
|
||||
if (je32_to_cpu(sm->magic) == JFFS2_SUM_MAGIC) {
|
||||
sumlen = c->sector_size - je32_to_cpu(sm->offset);
|
||||
sumptr = buf + buf_size - sumlen;
|
||||
@@ -523,18 +506,15 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
sumptr = kmalloc(sumlen, GFP_KERNEL);
|
||||
if (!sumptr)
|
||||
return -ENOMEM;
|
||||
- memcpy(sumptr + sumlen - buf_len, buf + buf_size - buf_len, buf_len);
|
||||
+ memcpy((uint8_t *)sumptr + sumlen - buf_len, buf + buf_size - buf_len, buf_len);
|
||||
}
|
||||
if (buf_len < sumlen) {
|
||||
/* Need to read more so that the entire summary node is present */
|
||||
- err = jffs2_fill_scan_buf(c, sumptr,
|
||||
+ err = jffs2_fill_scan_buf(c, sumptr,
|
||||
jeb->offset + c->sector_size - sumlen,
|
||||
- sumlen - buf_len);
|
||||
- if (err) {
|
||||
- if (sumlen > buf_size)
|
||||
- kfree(sumptr);
|
||||
+ sumlen - buf_len);
|
||||
+ if (err)
|
||||
return err;
|
||||
- }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -545,7 +525,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
|
||||
if (buf_size && sumlen > buf_size)
|
||||
kfree(sumptr);
|
||||
- /* If it returns with a real error, bail.
|
||||
+ /* If it returns with a real error, bail.
|
||||
If it returns positive, that's a block classification
|
||||
(i.e. BLK_STATE_xxx) so return that too.
|
||||
If it returns zero, fall through to full scan. */
|
||||
@@ -607,7 +587,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
/* Now ofs is a complete physical flash offset as it always was... */
|
||||
ofs += jeb->offset;
|
||||
|
||||
- noise = 10;
|
||||
+ noise = 1;
|
||||
|
||||
dbg_summary("no summary found in jeb 0x%08x. Apply original scan.\n",jeb->offset);
|
||||
|
||||
@@ -700,7 +680,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
scan_end = buf_len;
|
||||
goto more_empty;
|
||||
}
|
||||
-
|
||||
+
|
||||
/* See how much more there is to read in this eraseblock... */
|
||||
buf_len = min_t(uint32_t, buf_size, jeb->offset + c->sector_size - ofs);
|
||||
if (!buf_len) {
|
||||
@@ -950,7 +930,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
jffs2_dbg(1, "Block at 0x%08x: free 0x%08x, dirty 0x%08x, unchecked 0x%08x, used 0x%08x, wasted 0x%08x\n",
|
||||
jeb->offset, jeb->free_size, jeb->dirty_size,
|
||||
jeb->unchecked_size, jeb->used_size, jeb->wasted_size);
|
||||
-
|
||||
+
|
||||
/* mark_node_obsolete can add to wasted !! */
|
||||
if (jeb->wasted_size) {
|
||||
jeb->dirty_size += jeb->wasted_size;
|
||||
@@ -978,7 +958,6 @@ struct jffs2_inode_cache *jffs2_scan_make_ino_cache(struct jffs2_sb_info *c, uin
|
||||
pr_notice("%s(): allocation of inode cache failed\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
- memset(ic, 0, sizeof(*ic));
|
||||
|
||||
ic->ino = ino;
|
||||
ic->nodes = (void *)ic;
|
||||
@@ -1069,7 +1048,7 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
pseudo_random += je32_to_cpu(rd->version);
|
||||
|
||||
/* Should never happen. Did. (OLPC trac #4184)*/
|
||||
- checkedlen = strnlen(rd->name, rd->nsize);
|
||||
+ checkedlen = strnlen((const char *)rd->name, rd->nsize);
|
||||
if (checkedlen < rd->nsize) {
|
||||
pr_err("Dirent at %08x has zeroes in name. Truncating to %d chars\n",
|
||||
ofs, checkedlen);
|
||||
@@ -1081,7 +1060,7 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
memcpy(&fd->name, rd->name, checkedlen);
|
||||
fd->name[checkedlen] = 0;
|
||||
|
||||
- crc = crc32(0, fd->name, checkedlen);
|
||||
+ crc = crc32(0, fd->name, rd->nsize);
|
||||
if (crc != je32_to_cpu(rd->name_crc)) {
|
||||
pr_notice("%s(): Name CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",
|
||||
__func__, ofs, je32_to_cpu(rd->name_crc), crc);
|
||||
@@ -1106,7 +1085,7 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
fd->next = NULL;
|
||||
fd->version = je32_to_cpu(rd->version);
|
||||
fd->ino = je32_to_cpu(rd->ino);
|
||||
|
||||
@@ -780,7 +780,6 @@ ssize_t VfsJffs2Readlink(struct Vnode *vnode, char *buffer, size_t bufLen)
|
||||
|
||||
cnt = (bufLen - 1) < targetLen ? (bufLen - 1) : targetLen;
|
||||
if (LOS_CopyFromKernel(buffer, bufLen, (const char *)f->target, cnt) != 0) {
|
||||
cnt = 0;
|
||||
LOS_MuxUnlock(&g_jffs2FsLock);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ struct ProcData {
|
||||
#define S_IALLUGO (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
|
||||
|
||||
/**
|
||||
* Interface for modules using proc below internal proc moudule;
|
||||
* Interface for modules using proc below internal proc module;
|
||||
*/
|
||||
/**
|
||||
* @ingroup procfs
|
||||
|
||||
@@ -62,8 +62,9 @@ static struct ProcDirEntry g_procRootDirEntry = {
|
||||
|
||||
int ProcMatch(unsigned int len, const char *name, struct ProcDirEntry *pn)
|
||||
{
|
||||
if (len != pn->nameLen)
|
||||
if (len != pn->nameLen) {
|
||||
return 0;
|
||||
}
|
||||
return !strncmp(name, pn->name, len);
|
||||
}
|
||||
|
||||
@@ -387,8 +388,9 @@ static void FreeProcEntry(struct ProcDirEntry *entry)
|
||||
|
||||
void ProcFreeEntry(struct ProcDirEntry *pn)
|
||||
{
|
||||
if (atomic_dec_and_test(&pn->count))
|
||||
if (atomic_dec_and_test(&pn->count)) {
|
||||
FreeProcEntry(pn);
|
||||
}
|
||||
}
|
||||
|
||||
static void RemoveProcEntryTravalsal(struct ProcDirEntry *pn)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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:
|
||||
|
||||
@@ -33,10 +33,6 @@ MODULE_NAME := rootfs
|
||||
|
||||
LOCAL_SRCS := $(wildcard los_rootfs.c los_bootargs.c)
|
||||
|
||||
ifeq ($(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7), y)
|
||||
LOCAL_INCLUDE += -I $(LITEOSTOPDIR)/../../device/qemu/drivers/cfiflash
|
||||
endif
|
||||
|
||||
LOCAL_FLAGS := $(LOCAL_INCLUDE)
|
||||
|
||||
include $(MODULE)
|
||||
|
||||
@@ -32,14 +32,10 @@
|
||||
#include "los_base.h"
|
||||
#include "string.h"
|
||||
|
||||
#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND) || defined(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7)
|
||||
#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND)
|
||||
#include "mtd_list.h"
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
|
||||
#include "cfiflash.h"
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_STORAGE_EMMC
|
||||
#include "disk.h"
|
||||
#endif
|
||||
@@ -98,19 +94,6 @@ INT32 LOS_GetCmdLine(VOID)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
|
||||
struct MtdDev *mtd = GetCfiMtdDev();
|
||||
if (mtd == NULL) {
|
||||
PRINT_ERR("Get CFI mtd failed!\n");
|
||||
goto ERROUT;
|
||||
}
|
||||
g_alignSize = mtd->eraseSize;
|
||||
ret = mtd->read(mtd, CFIFLASH_BOOTARGS_ADDR, COMMAND_LINE_SIZE, g_cmdLine);
|
||||
if (ret == COMMAND_LINE_SIZE) {
|
||||
return LOS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
PRINT_ERR("Read cmdline error!\n");
|
||||
ERROUT:
|
||||
free(g_cmdLine);
|
||||
|
||||
@@ -37,15 +37,11 @@
|
||||
#include "sys/stat.h"
|
||||
#include "sys/types.h"
|
||||
|
||||
#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND) || defined(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7)
|
||||
#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND)
|
||||
#include "mtd_list.h"
|
||||
#include "mtd_partition.h"
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
|
||||
#include "cfiflash.h"
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_STORAGE_EMMC
|
||||
#include "disk.h"
|
||||
#include "ff.h"
|
||||
@@ -128,14 +124,7 @@ STATIC INT32 AddEmmcParts(INT32 rootAddr, INT32 rootSize, INT32 userAddr, INT32
|
||||
|
||||
STATIC INT32 AddPartitions(CHAR *dev, UINT64 rootAddr, UINT64 rootSize, UINT64 userAddr, UINT64 userSize)
|
||||
{
|
||||
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
|
||||
if ((strcmp(dev, "cfi-flash") == 0) && (rootAddr != CFIFLASH_ROOT_ADDR)) {
|
||||
PRINT_ERR("Error rootAddr, must be %#0x!\n", CFIFLASH_ROOT_ADDR);
|
||||
return LOS_NOK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND) || defined(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7)
|
||||
#if defined(LOSCFG_STORAGE_SPINOR) || defined(LOSCFG_STORAGE_SPINAND)
|
||||
INT32 ret;
|
||||
INT32 blk0 = 0;
|
||||
INT32 blk2 = 2;
|
||||
|
||||
@@ -59,12 +59,6 @@
|
||||
#define ROOTFS_ADDR 0x600000
|
||||
#define ROOTFS_SIZE 0x800000
|
||||
#define USERFS_SIZE 0x80000
|
||||
#elif defined (LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7)
|
||||
#define ROOT_DEV_NAME "/dev/cfiflash0"
|
||||
#define USER_DEV_NAME "/dev/cfiflash2"
|
||||
#define ROOTFS_ADDR CFIFLASH_ROOT_ADDR
|
||||
#define ROOTFS_SIZE 0x1B00000
|
||||
#define USERFS_SIZE (CFIFLASH_CAPACITY - ROOTFS_ADDR - ROOTFS_SIZE)
|
||||
#elif defined (LOSCFG_STORAGE_EMMC)
|
||||
#define ROOT_DEV_NAME "/dev/mmcblk0p0"
|
||||
#ifdef LOSCFG_PLATFORM_PATCHFS
|
||||
|
||||
@@ -581,8 +581,8 @@ static OsBcacheBlock *AllocNewBlock(OsBcache *bc, BOOL read, UINT64 num)
|
||||
DelBlock(bc, prefer);
|
||||
}
|
||||
|
||||
if (prefer->used) {
|
||||
MergeSyncBlocks(bc, prefer);
|
||||
if (prefer->used) { /* do not combine with next check */
|
||||
MergeSyncBlocks(bc, prefer); /* prefer->used may be changed here */
|
||||
}
|
||||
|
||||
if (prefer->used) {
|
||||
|
||||
@@ -160,7 +160,7 @@ typedef int VfsHashCmp(struct Vnode *vnode, void *arg);
|
||||
|
||||
int VnodesInit(void);
|
||||
int VnodeDevInit(void);
|
||||
int VnodeAlloc(struct VnodeOps *vop, struct Vnode **vnode);
|
||||
int VnodeAlloc(struct VnodeOps *vop, struct Vnode **newVnode);
|
||||
int VnodeFree(struct Vnode *vnode);
|
||||
int VnodeLookup(const char *path, struct Vnode **vnode, uint32_t flags);
|
||||
int VnodeLookupFullpath(const char *fullpath, struct Vnode **vnode, uint32_t flags);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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:
|
||||
|
||||
@@ -353,7 +353,7 @@ static struct file_operations_vfs g_errorFileOps = {
|
||||
.unlink = ErrorFopUnlink,
|
||||
};
|
||||
|
||||
static struct Mount* GetDevMountPoint(struct Vnode *dev)
|
||||
static struct Mount* GetDevMountPoint(const struct Vnode *dev)
|
||||
{
|
||||
struct Mount *mnt = NULL;
|
||||
LIST_HEAD *mntList = GetMountList();
|
||||
@@ -394,7 +394,7 @@ static void FilePreClose(struct file *filep, const struct file_operations_vfs *o
|
||||
}
|
||||
}
|
||||
|
||||
static void FileDisableAndClean(struct Mount *mnt)
|
||||
static void FileDisableAndClean(const struct Mount *mnt)
|
||||
{
|
||||
struct filelist *flist = &tg_filelist;
|
||||
struct file *filep = NULL;
|
||||
@@ -435,7 +435,7 @@ static void VnodeTryFree(struct Vnode *vnode)
|
||||
vnode->fop = &g_errorFileOps;
|
||||
}
|
||||
|
||||
static void VnodeTryFreeAll(struct Mount *mount)
|
||||
static void VnodeTryFreeAll(const struct Mount *mount)
|
||||
{
|
||||
struct Vnode *vnode = NULL;
|
||||
struct Vnode *nextVnode = NULL;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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:
|
||||
|
||||
@@ -66,7 +66,6 @@ static int iov_trans_to_buf(char *buf, ssize_t totallen, const struct iovec *iov
|
||||
} else {
|
||||
writepart = bytestowrite - ret;
|
||||
curbuf += writepart;
|
||||
totallen -= writepart;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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:
|
||||
@@ -344,7 +344,7 @@ int osShellCmdMount(int argc, const char **argv)
|
||||
|
||||
filessystemtype = (argc >= 4) ? (char *)argv[3] : NULL; /* 4: specify fs type, 3: fs type */
|
||||
mountfalgs = (argc >= 5) ? get_mountflags((const char *)argv[4]) : 0; /* 4: usr option */
|
||||
data = (argc >= 6) ? (char *)argv[5] : NULL; /* 5: usr option data */
|
||||
data = (argc >= 6) ? (char *)argv[5] : NULL; /* 5: usr option data, 6: six args needed for data */
|
||||
|
||||
if (strcmp(argv[1], "0") == 0) {
|
||||
ret = mount((const char *)NULL, fullpath, filessystemtype, mountfalgs, data);
|
||||
@@ -384,7 +384,7 @@ int osShellCmdMount(int argc, const char **argv)
|
||||
}
|
||||
|
||||
mountfalgs = (argc >= 4) ? get_mountflags((const char *)argv[3]) : 0; /* 3: usr option */
|
||||
data = (argc >= 5) ? (char *)argv[4] : NULL; /* 4: usr option data */
|
||||
data = (argc >= 5) ? (char *)argv[4] : NULL; /* 4: usr option data, 5: number of args needed for data */
|
||||
|
||||
if (strcmp(argv[0], "0") == 0) {
|
||||
ret = mount((const char *)NULL, fullpath, argv[2], mountfalgs, data);
|
||||
@@ -761,11 +761,6 @@ static int os_shell_cmd_do_rmdir(const char *pathname)
|
||||
}
|
||||
if (strcmp(dirent->d_name, "..") && strcmp(dirent->d_name, ".")) {
|
||||
size_t fullpath_buf_size = strlen(pathname) + strlen(dirent->d_name) + SEPARATOR_EOF_LEN;
|
||||
if (fullpath_buf_size <= 0) {
|
||||
PRINTK("buffer size is invalid!\n");
|
||||
(void)closedir(d);
|
||||
return -1;
|
||||
}
|
||||
fullpath = (char *)malloc(fullpath_buf_size);
|
||||
if (fullpath == NULL) {
|
||||
PRINTK("malloc failure!\n");
|
||||
|
||||
@@ -70,7 +70,7 @@ VOID OsVmPhysDump(VOID);
|
||||
VOID OsVmPhysUsedInfoGet(UINT32 *usedCount, UINT32 *totalCount);
|
||||
INT32 OsRegionOverlapCheck(LosVmSpace *space, LosVmMapRegion *region);
|
||||
VOID OsDumpPte(VADDR_T vaddr);
|
||||
LosProcessCB *OsGetPIDByAspace(LosVmSpace *space);
|
||||
LosProcessCB *OsGetPIDByAspace(const LosVmSpace *space);
|
||||
CHAR *OsArchFlagsToStr(const UINT32 archFlags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -193,7 +193,7 @@ VOID OsVmmFileRegionFree(struct file *filep, LosProcessCB *processCB);
|
||||
|
||||
LosFilePage *OsPageCacheAlloc(struct page_mapping *mapping, VM_OFFSET_T pgoff);
|
||||
LosFilePage *OsFindGetEntry(struct page_mapping *mapping, VM_OFFSET_T pgoff);
|
||||
LosMapInfo *OsGetMapInfo(LosFilePage *page, LosArchMmu *archMmu, VADDR_T vaddr);
|
||||
LosMapInfo *OsGetMapInfo(const LosFilePage *page, const LosArchMmu *archMmu, VADDR_T vaddr);
|
||||
VOID OsAddMapInfo(LosFilePage *page, LosArchMmu *archMmu, VADDR_T vaddr);
|
||||
VOID OsDelMapInfo(LosVmMapRegion *region, LosVmPgFault *pgFault, BOOL cleanDirty);
|
||||
VOID OsFileCacheFlush(struct page_mapping *mapping);
|
||||
@@ -208,7 +208,7 @@ VOID OsDeletePageCacheLru(LosFilePage *page);
|
||||
VOID OsPageRefDecNoLock(LosFilePage *page);
|
||||
VOID OsPageRefIncLocked(LosFilePage *page);
|
||||
int OsTryShrinkMemory(size_t nPage);
|
||||
VOID OsMarkPageDirty(LosFilePage *fpage, LosVmMapRegion *region, int off, int len);
|
||||
VOID OsMarkPageDirty(LosFilePage *fpage, const LosVmMapRegion *region, int off, int len);
|
||||
|
||||
#ifdef LOSCFG_DEBUG_VERSION
|
||||
VOID ResetPageCacheHitInfo(int *try, int *hit);
|
||||
|
||||
@@ -96,7 +96,7 @@ UINT32 LOS_RwlockDestroy(LosRwlock *rwlock)
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
STATIC UINT32 OsRwlockCheck(LosRwlock *rwlock)
|
||||
STATIC UINT32 OsRwlockCheck(const LosRwlock *rwlock)
|
||||
{
|
||||
if (rwlock == NULL) {
|
||||
return LOS_EINVAL;
|
||||
|
||||
@@ -78,7 +78,6 @@ STATIC VOID OsMoveTmpInfoToUnbInfo(sig_cb *sigcb, INT32 signo)
|
||||
/* delete tmpinfo from tmpList. */
|
||||
*prevHook = tmpInfoNode->next;
|
||||
(VOID)LOS_MemFree(m_aucSysMem0, tmpInfoNode);
|
||||
tmpInfoNode = *prevHook;
|
||||
break;
|
||||
}
|
||||
prevHook = &tmpInfoNode->next;
|
||||
|
||||
@@ -918,7 +918,7 @@ STATIC UINT32 OsMemPoolAdd(VOID *pool, UINT32 size)
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
STATIC UINT32 OsMemPoolDelete(VOID *pool)
|
||||
STATIC UINT32 OsMemPoolDelete(const VOID *pool)
|
||||
{
|
||||
UINT32 ret = LOS_NOK;
|
||||
VOID *nextPool = NULL;
|
||||
|
||||
@@ -271,7 +271,7 @@ VOID OsLockDepCheckOut(SPIN_LOCK_S *lock)
|
||||
{
|
||||
UINT32 intSave;
|
||||
INT32 depth;
|
||||
enum LockDepErrType checkResult = LOCKDEP_SUCCESS;
|
||||
enum LockDepErrType checkResult;
|
||||
VOID *requestAddr = (VOID *)__builtin_return_address(1);
|
||||
LosTaskCB *current = OsCurrTaskGet();
|
||||
LosTaskCB *owner = NULL;
|
||||
|
||||
@@ -208,15 +208,12 @@ UINT32 OsUProcessPmUsage(LosVmSpace *space, UINT32 *sharePm, UINT32 *actualPm)
|
||||
PADDR_T paddr;
|
||||
STATUS_T ret;
|
||||
INT32 shareRef;
|
||||
UINT32 pmSize = 0;
|
||||
|
||||
if (sharePm != NULL) {
|
||||
*sharePm = 0;
|
||||
}
|
||||
|
||||
if (actualPm != NULL) {
|
||||
*actualPm = 0;
|
||||
}
|
||||
|
||||
ret = LOS_MuxAcquire(&space->regionMux);
|
||||
if (ret != 0) {
|
||||
return 0;
|
||||
@@ -240,22 +237,23 @@ UINT32 OsUProcessPmUsage(LosVmSpace *space, UINT32 *sharePm, UINT32 *actualPm)
|
||||
if (sharePm != NULL) {
|
||||
*sharePm += PAGE_SIZE;
|
||||
}
|
||||
if (actualPm != NULL) {
|
||||
*actualPm += PAGE_SIZE / shareRef;
|
||||
}
|
||||
pmSize += PAGE_SIZE / shareRef;
|
||||
} else {
|
||||
if (actualPm != NULL) {
|
||||
*actualPm += PAGE_SIZE;
|
||||
}
|
||||
pmSize += PAGE_SIZE;
|
||||
}
|
||||
}
|
||||
RB_SCAN_SAFE_END(&oldVmSpace->regionRbTree, pstRbNode, pstRbNodeNext)
|
||||
|
||||
(VOID)LOS_MuxRelease(&space->regionMux);
|
||||
return *actualPm;
|
||||
|
||||
if (actualPm != NULL) {
|
||||
*actualPm = pmSize;
|
||||
}
|
||||
|
||||
return pmSize;
|
||||
}
|
||||
|
||||
LosProcessCB *OsGetPIDByAspace(LosVmSpace *space)
|
||||
LosProcessCB *OsGetPIDByAspace(const LosVmSpace *space)
|
||||
{
|
||||
UINT32 pid;
|
||||
UINT32 intSave;
|
||||
@@ -305,7 +303,7 @@ UINT32 OsCountRegionPages(LosVmSpace *space, LosVmMapRegion *region, UINT32 *pss
|
||||
}
|
||||
|
||||
if (pssPages != NULL) {
|
||||
*pssPages = (UINT32)(pss + 0.5);
|
||||
*pssPages = (UINT32)(pss + 0.5); /* 0.5, for page alignment */
|
||||
}
|
||||
|
||||
return regionPages;
|
||||
|
||||
@@ -125,10 +125,10 @@ VOID OsAddMapInfo(LosFilePage *page, LosArchMmu *archMmu, VADDR_T vaddr)
|
||||
page->n_maps++;
|
||||
}
|
||||
|
||||
LosMapInfo *OsGetMapInfo(LosFilePage *page, LosArchMmu *archMmu, VADDR_T vaddr)
|
||||
LosMapInfo *OsGetMapInfo(const LosFilePage *page, const LosArchMmu *archMmu, VADDR_T vaddr)
|
||||
{
|
||||
LosMapInfo *info = NULL;
|
||||
LOS_DL_LIST *immap = &page->i_mmap;
|
||||
const LOS_DL_LIST *immap = &page->i_mmap;
|
||||
|
||||
LOS_DL_LIST_FOR_EACH_ENTRY(info, immap, LosMapInfo, node) {
|
||||
if ((info->archMmu == archMmu) && (info->vaddr == vaddr) && (info->page == page)) {
|
||||
@@ -214,7 +214,7 @@ VOID OsVmmFileRemove(LosVmMapRegion *region, LosArchMmu *archMmu, VM_OFFSET_T pg
|
||||
return;
|
||||
}
|
||||
|
||||
VOID OsMarkPageDirty(LosFilePage *fpage, LosVmMapRegion *region, INT32 off, INT32 len)
|
||||
VOID OsMarkPageDirty(LosFilePage *fpage, const LosVmMapRegion *region, INT32 off, INT32 len)
|
||||
{
|
||||
if (region != NULL) {
|
||||
OsSetPageDirty(fpage->vmPage);
|
||||
|
||||
@@ -233,7 +233,7 @@ LosVmSpace *OsCreateUserVmSpace(VOID)
|
||||
return space;
|
||||
}
|
||||
|
||||
STATIC BOOL OsVmSpaceParamCheck(LosVmSpace *vmSpace)
|
||||
STATIC BOOL OsVmSpaceParamCheck(const LosVmSpace *vmSpace)
|
||||
{
|
||||
if (vmSpace == NULL) {
|
||||
return FALSE;
|
||||
|
||||
@@ -297,7 +297,7 @@ int OsTryShrinkMemory(size_t nPage)
|
||||
LosFilePage *fpage = NULL;
|
||||
LosFilePage *fnext = NULL;
|
||||
|
||||
if (nPage <= 0) {
|
||||
if (nPage == 0) {
|
||||
nPage = VM_FILEMAP_MIN_SCAN;
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ MMAP_DONE:
|
||||
|
||||
STATUS_T LOS_UnMMap(VADDR_T addr, size_t size)
|
||||
{
|
||||
if ((addr <= 0) || (size <= 0)) {
|
||||
if ((addr <= 0) || (size == 0)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -404,7 +404,7 @@ STATIC VOID EchoToTerminal(CONSOLE_CB *consoleCB, struct file *filep, const stru
|
||||
{
|
||||
if (consoleCB->consoleTermios.c_lflag & ECHO) {
|
||||
if (ch == '\b') {
|
||||
(VOID)fops->write(filep, "\b \b", 3);
|
||||
(VOID)fops->write(filep, "\b \b", 3); // 3: length of "\b \b"
|
||||
} else {
|
||||
(VOID)fops->write(filep, &ch, EACH_CHAR);
|
||||
}
|
||||
@@ -709,7 +709,6 @@ STATIC ssize_t DoWrite(CirBufSendCB *cirBufSendCB, CHAR *buffer, size_t bufLen)
|
||||
{
|
||||
INT32 cnt;
|
||||
size_t written = 0;
|
||||
size_t toWrite = bufLen;
|
||||
UINT32 intSave;
|
||||
|
||||
#ifdef LOSCFG_SHELL_DMESG
|
||||
@@ -730,7 +729,6 @@ STATIC ssize_t DoWrite(CirBufSendCB *cirBufSendCB, CHAR *buffer, size_t bufLen)
|
||||
if (cnt <= 0) {
|
||||
break;
|
||||
}
|
||||
toWrite -= cnt;
|
||||
written += cnt;
|
||||
}
|
||||
LOS_SpinUnlockRestore(&g_consoleWriteSpinLock, intSave);
|
||||
@@ -1536,7 +1534,15 @@ STATIC ssize_t WriteToTerminal(const CONSOLE_CB *consoleCB, const CHAR *buffer,
|
||||
|
||||
fd = consoleCB->fd;
|
||||
ret = fs_getfilep(fd, &filep);
|
||||
if (ret < 0) {
|
||||
ret = -EPERM;
|
||||
goto ERROUT;
|
||||
}
|
||||
ret = GetFilepOps(filep, &privFilep, &fileOps);
|
||||
if (ret != ENOERR) {
|
||||
ret = -EINVAL;
|
||||
goto ERROUT;
|
||||
}
|
||||
|
||||
if ((fileOps == NULL) || (fileOps->write == NULL)) {
|
||||
ret = EFAULT;
|
||||
|
||||
@@ -87,7 +87,6 @@ STATIC VOID InitLevelCall(const CHAR *name, const UINT32 level, struct ModuleIni
|
||||
LOS_SpinUnlock(&g_initLock);
|
||||
if (module->hook != NULL) {
|
||||
#ifdef LOS_INIT_DEBUG
|
||||
ret = LOS_OK;
|
||||
startNsec = LOS_CurrNanosec();
|
||||
ret = (UINT32)module->hook();
|
||||
endNsec = LOS_CurrNanosec();
|
||||
|
||||
@@ -51,7 +51,7 @@ STATIC BOOL g_srandInit;
|
||||
|
||||
STATIC INT32 OsELFOpen(const CHAR *fileName, INT32 oflags)
|
||||
{
|
||||
INT32 ret = -LOS_NOK;
|
||||
INT32 ret;
|
||||
INT32 procFd;
|
||||
|
||||
procFd = AllocProcessFd();
|
||||
|
||||
@@ -124,8 +124,8 @@ ATTRIBUTE_NO_SANITIZE_ADDRESS void LmsSetShadowValue(uintptr_t startAddr, uintpt
|
||||
uint32_t startOffset;
|
||||
uint32_t endOffset;
|
||||
|
||||
char shadowValueMask;
|
||||
char shadowValue;
|
||||
unsigned char shadowValueMask;
|
||||
unsigned char shadowValue;
|
||||
|
||||
/* endAddr - 1, then we mark [startAddr, endAddr) to value */
|
||||
LmsMem2Shadow(startAddr, &shadowStart, &startOffset);
|
||||
@@ -266,7 +266,7 @@ ATTRIBUTE_NO_SANITIZE_ADDRESS void LmsPrintMemInfo(uintptr_t addr)
|
||||
}
|
||||
}
|
||||
|
||||
LMS_OUTPUT_INFO("|\t[0x%x | %2d]: ", shadowAddr, shadowOffset);
|
||||
LMS_OUTPUT_INFO("|\t[0x%x | %2u]: ", shadowAddr, shadowOffset);
|
||||
|
||||
for (int x = 0; x < printX; x += LMS_MEM_BYTES_PER_SHADOW_CELL) {
|
||||
LmsGetShadowValue(dumpAddr + x, &shadowValue);
|
||||
@@ -339,7 +339,7 @@ ATTRIBUTE_NO_SANITIZE_ADDRESS static void LmsPrintErrInfo(LmsAddrInfo *info, uin
|
||||
break;
|
||||
}
|
||||
|
||||
LMS_OUTPUT_INFO("Shadow memory address: [0x%x : %d] Shadow memory value: [%d] \n", info->shadowAddr,
|
||||
LMS_OUTPUT_INFO("Shadow memory address: [0x%x : %u] Shadow memory value: [%u] \n", info->shadowAddr,
|
||||
info->shadowOffset, info->shadowValue);
|
||||
|
||||
LMS_OUTPUT_INFO("\n");
|
||||
|
||||
@@ -289,7 +289,7 @@ STATIC UINT32 OsPerfCollectData(Event *event, PerfSampleData *data, PerfRegs *re
|
||||
* return TRUE if user haven't specified any taskId(which is supposed
|
||||
* to instrument the whole system)
|
||||
*/
|
||||
STATIC INLINE BOOL OsFilterId(UINT32 id, UINT32 *ids, UINT8 idsNr)
|
||||
STATIC INLINE BOOL OsFilterId(UINT32 id, const UINT32 *ids, UINT8 idsNr)
|
||||
{
|
||||
UINT32 i;
|
||||
if (!idsNr) {
|
||||
|
||||
@@ -300,7 +300,7 @@ UINT32 LOS_PmRegister(LOS_PmNodeType type, VOID *node)
|
||||
return LOS_EINVAL;
|
||||
}
|
||||
|
||||
STATIC UINT32 OsPmDeviceUnregister(LosPmCB *pm, LosPmDevice *device)
|
||||
STATIC UINT32 OsPmDeviceUnregister(LosPmCB *pm, const LosPmDevice *device)
|
||||
{
|
||||
LOS_SpinLock(&g_pmSpin);
|
||||
if (pm->device == device) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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:
|
||||
@@ -342,7 +342,7 @@ int print_netif(struct netif *netif, char *print_buf, unsigned int buf_len)
|
||||
buf_len -= (unsigned int)ret;
|
||||
|
||||
ret = snprintf_s(tmp, buf_len, (buf_len - 1), " MTU:%d %s", netif->mtu,
|
||||
netif->flags & NETIF_FLAG_UP ? "Running" : "Stop");
|
||||
(netif->flags & NETIF_FLAG_UP) ? "Running" : "Stop");
|
||||
if ((ret <= 0) || ((unsigned int)ret >= buf_len))
|
||||
goto out;
|
||||
tmp += ret;
|
||||
@@ -356,7 +356,8 @@ int print_netif(struct netif *netif, char *print_buf, unsigned int buf_len)
|
||||
buf_len -= (unsigned int)ret;
|
||||
}
|
||||
|
||||
ret = snprintf_s(tmp, buf_len, (buf_len - 1), " %s\n", netif->flags & NETIF_FLAG_LINK_UP ? "Link UP" : "Link Down");
|
||||
ret = snprintf_s(tmp, buf_len, (buf_len - 1), " %s\n",
|
||||
(netif->flags & NETIF_FLAG_LINK_UP) ? "Link UP" : "Link Down");
|
||||
if ((ret <= 0) || ((unsigned int)ret >= buf_len))
|
||||
goto out;
|
||||
tmp += ret;
|
||||
@@ -3019,8 +3020,8 @@ int netstat_netconn_sendq(struct netconn *conn)
|
||||
#if PF_PKT_SUPPORT
|
||||
case NETCONN_PKT_RAW:
|
||||
retVal = 0; /* always be 0 as frame send to driver directly */
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
case NETCONN_UDP:
|
||||
retVal = netstat_udp_sendq(conn->pcb.udp);
|
||||
break;
|
||||
@@ -3797,8 +3798,9 @@ u32_t osShellIpDebug(int argc, const char **argv)
|
||||
PRINTK("%-50s ", acIPv6Addr);
|
||||
|
||||
if (snprintf_s(aclladdr, sizeof(aclladdr), sizeof(aclladdr) - 1, "%02X:%02X:%02X:%02X:%02X:%02X",
|
||||
neighbor_cache[i].lladdr[0], neighbor_cache[i].lladdr[1], neighbor_cache[i].lladdr[2],
|
||||
neighbor_cache[i].lladdr[3], neighbor_cache[i].lladdr[4], neighbor_cache[i].lladdr[5]) < 0) {
|
||||
neighbor_cache[i].lladdr[0], neighbor_cache[i].lladdr[1], /* 0, 1, member number */
|
||||
neighbor_cache[i].lladdr[2], neighbor_cache[i].lladdr[3], /* 2, 3, member number */
|
||||
neighbor_cache[i].lladdr[4], neighbor_cache[i].lladdr[5]) < 0) { /* 4, 5, member number */
|
||||
return LOS_NOK;
|
||||
}
|
||||
PRINTK("%-25s ", aclladdr);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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:
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
|
||||
#if LWIP_PERF
|
||||
|
||||
#define PERF_START do {/* something to do */} while (0)
|
||||
#define PERF_STOP(x) do {/* something to do */} while (0)
|
||||
#define PERF_START do {} while (0) /* something to do */
|
||||
#define PERF_STOP(x) do {} while (0) /* something to do */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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:
|
||||
|
||||
@@ -116,8 +116,8 @@ static UINT16 GetFreeVid(VOID)
|
||||
for (i = 0; i < mapMaxNum; i++) {
|
||||
num = idMap->bitMap[i];
|
||||
for (j = 0; j < INT_BIT_COUNT; j++) {
|
||||
if ((num & (1 << j)) == 0) {
|
||||
num |= 1 << j;
|
||||
if ((num & (1U << j)) == 0) {
|
||||
num |= 1U << j;
|
||||
idMap->bitMap[i] = num;
|
||||
return (INT_BIT_COUNT * i + j);
|
||||
}
|
||||
@@ -160,7 +160,7 @@ static VOID ReleaseVid(UINT16 vid)
|
||||
a = vid >> INT_BIT_SHIFT;
|
||||
b = vid & (INT_BIT_COUNT - 1);
|
||||
|
||||
idMap->bitMap[a] &= ~(1 << b);
|
||||
idMap->bitMap[a] &= ~(1U << b);
|
||||
|
||||
/* shrink bit map */
|
||||
if (mapMaxNum > 1) {
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
#include "los_typedef.h"
|
||||
#include "los_process_pri.h"
|
||||
|
||||
#define INT_BIT_COUNT 32
|
||||
#define INT_BIT_SHIFT 5
|
||||
#define VID_MAP_MAX_NUM 32
|
||||
#define INT_BIT_COUNT 32U
|
||||
#define INT_BIT_SHIFT 5U
|
||||
#define VID_MAP_MAX_NUM 32U
|
||||
|
||||
#define MAX_INVALID_TIMER_VID (VID_MAP_MAX_NUM * INT_BIT_COUNT)
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ INT32 CmdLog(INT32 argc, const CHAR **argv)
|
||||
}
|
||||
} else if (!strncmp(argv[0], "module", strlen(argv[0]) + 1)) {
|
||||
module = strtoul(argv[1], &p, 0);
|
||||
if ((*p != 0) || (module > MODULE4) || (module < MODULE0)) {
|
||||
if ((*p != 0) || (module > MODULE4)) {
|
||||
PRINTK("log %s can't access %s\n", argv[0], argv[1]);
|
||||
PRINTK("not support yet\n");
|
||||
return -1;
|
||||
|
||||
@@ -329,7 +329,7 @@ END:
|
||||
LITE_OS_SEC_TEXT_MINOR UINT32 ShellEntry(UINTPTR param)
|
||||
{
|
||||
CHAR ch;
|
||||
INT32 n = 0;
|
||||
INT32 n;
|
||||
ShellCB *shellCB = (ShellCB *)param;
|
||||
|
||||
CONSOLE_CB *consoleCB = OsGetConsoleByID((INT32)shellCB->consoleID);
|
||||
|
||||
@@ -425,7 +425,7 @@ STATIC VOID OsBufFullWrite(const CHAR *dst, UINT32 logLen)
|
||||
|
||||
STATIC VOID OsWriteTailToHead(const CHAR *dst, UINT32 logLen)
|
||||
{
|
||||
UINT32 writeLen = 0;
|
||||
UINT32 writeLen;
|
||||
UINT32 bufSize = g_logBufSize;
|
||||
UINT32 logSize = g_dmesgInfo->logSize;
|
||||
UINT32 tail = g_dmesgInfo->logTail;
|
||||
|
||||
@@ -83,6 +83,10 @@ int GetFullpath(int fd, const char *path, char **fullpath)
|
||||
fd = GetAssociatedSystemFd(fd);
|
||||
}
|
||||
ret = fs_getfilep(fd, &file);
|
||||
if (ret < 0) {
|
||||
ret = -EPERM;
|
||||
goto OUT;
|
||||
}
|
||||
if (file) {
|
||||
ret = stat(file->f_path, &bufRet);
|
||||
if (!ret) {
|
||||
|
||||
@@ -109,7 +109,7 @@ int SysSetiTimer(int which, const struct itimerval *value, struct itimerval *ova
|
||||
{
|
||||
int ret;
|
||||
struct itimerval svalue;
|
||||
struct itimerval sovalue;
|
||||
struct itimerval sovalue = { 0 };
|
||||
|
||||
if (value == NULL) {
|
||||
errno = EINVAL;
|
||||
@@ -137,7 +137,7 @@ int SysSetiTimer(int which, const struct itimerval *value, struct itimerval *ova
|
||||
int SysGetiTimer(int which, struct itimerval *value)
|
||||
{
|
||||
int ret;
|
||||
struct itimerval svalue;
|
||||
struct itimerval svalue = { 0 };
|
||||
|
||||
if (value == NULL) {
|
||||
errno = EINVAL;
|
||||
@@ -189,7 +189,7 @@ int SysTimerCreate(clockid_t clockID, struct ksigevent *evp, timer_t *timerID)
|
||||
int SysTimerGettime(timer_t timerID, struct itimerspec *value)
|
||||
{
|
||||
int ret;
|
||||
struct itimerspec svalue;
|
||||
struct itimerspec svalue = { 0 };
|
||||
|
||||
if (value == NULL) {
|
||||
errno = EINVAL;
|
||||
@@ -213,7 +213,7 @@ int SysTimerSettime(timer_t timerID, int flags, const struct itimerspec *value,
|
||||
{
|
||||
int ret;
|
||||
struct itimerspec svalue;
|
||||
struct itimerspec soldValue;
|
||||
struct itimerspec soldValue = { 0 };
|
||||
|
||||
if (value == NULL) {
|
||||
errno = EINVAL;
|
||||
@@ -285,7 +285,7 @@ int SysClockSettime(clockid_t clockID, const struct timespec *tp)
|
||||
int SysClockGettime(clockid_t clockID, struct timespec *tp)
|
||||
{
|
||||
int ret;
|
||||
struct timespec stp;
|
||||
struct timespec stp = { 0 };
|
||||
|
||||
if (tp == NULL) {
|
||||
errno = EINVAL;
|
||||
@@ -308,7 +308,7 @@ int SysClockGettime(clockid_t clockID, struct timespec *tp)
|
||||
int SysClockGetres(clockid_t clockID, struct timespec *tp)
|
||||
{
|
||||
int ret;
|
||||
struct timespec stp;
|
||||
struct timespec stp = { 0 };
|
||||
|
||||
if (tp == NULL) {
|
||||
errno = EINVAL;
|
||||
@@ -356,7 +356,7 @@ int SysNanoSleep(const struct timespec *rqtp, struct timespec *rmtp)
|
||||
{
|
||||
int ret;
|
||||
struct timespec srqtp;
|
||||
struct timespec srmtp;
|
||||
struct timespec srmtp = { 0 };
|
||||
|
||||
if (!rqtp || LOS_ArchCopyFromUser(&srqtp, rqtp, sizeof(struct timespec))) {
|
||||
errno = EFAULT;
|
||||
@@ -384,7 +384,7 @@ int SysNanoSleep(const struct timespec *rqtp, struct timespec *rmtp)
|
||||
clock_t SysTimes(struct tms *buf)
|
||||
{
|
||||
clock_t ret;
|
||||
struct tms sbuf;
|
||||
struct tms sbuf = { 0 };
|
||||
|
||||
if (buf == NULL) {
|
||||
errno = EFAULT;
|
||||
@@ -436,7 +436,7 @@ int SysClockGettime64(clockid_t clockID, struct timespec64 *tp)
|
||||
{
|
||||
int ret;
|
||||
struct timespec t;
|
||||
struct timespec64 stp;
|
||||
struct timespec64 stp = { 0 };
|
||||
|
||||
if (tp == NULL) {
|
||||
errno = EINVAL;
|
||||
@@ -463,7 +463,7 @@ int SysClockGetres64(clockid_t clockID, struct timespec64 *tp)
|
||||
{
|
||||
int ret;
|
||||
struct timespec t;
|
||||
struct timespec64 stp;
|
||||
struct timespec64 stp = { 0 };
|
||||
|
||||
if (tp == NULL) {
|
||||
errno = EINVAL;
|
||||
@@ -525,7 +525,7 @@ int SysTimerGettime64(timer_t timerID, struct itimerspec64 *value)
|
||||
{
|
||||
int ret;
|
||||
struct itimerspec val;
|
||||
struct itimerspec64 svalue;
|
||||
struct itimerspec64 svalue = { 0 };
|
||||
|
||||
if (value == NULL) {
|
||||
errno = EINVAL;
|
||||
@@ -584,6 +584,7 @@ int SysTimerSettime64(timer_t timerID, int flags, const struct itimerspec64 *val
|
||||
}
|
||||
|
||||
if (oldValue != NULL) {
|
||||
(void)memset_s(&soldValue, sizeof(struct itimerspec64), 0, sizeof(struct itimerspec64));
|
||||
soldValue.it_interval.tv_sec = oldVal.it_interval.tv_sec;
|
||||
soldValue.it_interval.tv_nsec = oldVal.it_interval.tv_nsec;
|
||||
soldValue.it_value.tv_sec = oldVal.it_value.tv_sec;
|
||||
|
||||
@@ -86,14 +86,14 @@ extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#define TEST_TASK_PARAM_INIT(testTask, task_name, entry, prio) \
|
||||
do { \
|
||||
memset(&testTask, 0, sizeof(TSK_INIT_PARAM_S)); \
|
||||
testTask.pfnTaskEntry = (TSK_ENTRY_FUNC)entry; \
|
||||
testTask.uwStackSize = 0x1000; \
|
||||
testTask.pcName = task_name; \
|
||||
testTask.usTaskPrio = prio; \
|
||||
testTask.uwResved = LOS_TASK_STATUS_DETACHED; \
|
||||
#define TEST_TASK_PARAM_INIT(testTask, task_name, entry, prio) \
|
||||
do { \
|
||||
(void)memset_s(&(testTask), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S)); \
|
||||
testTask.pfnTaskEntry = (TSK_ENTRY_FUNC)entry; \
|
||||
testTask.uwStackSize = 0x1000; \
|
||||
testTask.pcName = task_name; \
|
||||
testTask.usTaskPrio = prio; \
|
||||
testTask.uwResved = LOS_TASK_STATUS_DETACHED; \
|
||||
} while (0);
|
||||
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
|
||||
@@ -50,7 +50,7 @@ VOID RecordIntrTrace(INT32 irq, INT32 direction)
|
||||
VOID ResetIntrTrace(VOID)
|
||||
{
|
||||
g_traceIdx = 0;
|
||||
memset(g_intrTrace, 0, RECORD_SIZE);
|
||||
(void)memset_s(g_intrTrace, RECORD_SIZE, 0, RECORD_SIZE);
|
||||
}
|
||||
|
||||
UINT32 CheckIntrTrace(UINT32 *expect, UINT32 num)
|
||||
|
||||
@@ -44,7 +44,7 @@ static VOID NestingPrioHigh(INT32 irq, VOID *data)
|
||||
{
|
||||
g_intrHandleEnd = 1;
|
||||
UINT32 temp[0x100][2] = {0};
|
||||
memset(temp, 1, sizeof(UINT32) * 0x100 * 2); // 2, buffer size.
|
||||
(void)memset_s(temp, sizeof(UINT32) * 0x100 * 2, 1, sizeof(UINT32) * 0x100 * 2); // 2, buffer size.
|
||||
}
|
||||
|
||||
static VOID TaskF01(VOID)
|
||||
|
||||
@@ -49,13 +49,13 @@ static VOID NestingPrioHigh(INT32 irq, VOID *data)
|
||||
UINT64 curTime;
|
||||
curTime = LOS_CurrNanosec();
|
||||
g_recordTime[g_saveIndex] = curTime - g_intPendTime;
|
||||
if (g_saveIndex == MAX_RECORD_SIZE) {
|
||||
g_saveIndex = 0;
|
||||
}
|
||||
dprintf("curTime = %lld, pendTime = %lld \n", curTime, g_intPendTime);
|
||||
dprintf("%lld\n", curTime - g_intPendTime);
|
||||
dprintf("[swtmr] hwi response time : ##%lld \n", g_recordTime[g_saveIndex]);
|
||||
g_saveIndex++;
|
||||
if (g_saveIndex == MAX_RECORD_SIZE) {
|
||||
g_saveIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static VOID DumpResult()
|
||||
|
||||
@@ -58,7 +58,7 @@ static UINT32 Testcase(void)
|
||||
// 32, number of cycles
|
||||
for (index = 0; index < 32; index++) {
|
||||
task1.usTaskPrio = index;
|
||||
snprintf(acName, 10, "Tsk040A%2d", index); // 10, snprintf size.
|
||||
(void)snprintf_s(acName, TASK_NAME_NUM, TASK_NAME_NUM - 1, "Tsk040A%2d", index);
|
||||
task1.pcName = acName;
|
||||
task1.uwResved = LOS_TASK_STATUS_DETACHED;
|
||||
|
||||
|
||||
@@ -58,9 +58,10 @@ EXIT:
|
||||
static UINT32 Testcase(void)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
LOS_EventInit(&g_eventCb01);
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "Tsk082A";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -142,7 +142,8 @@ static UINT32 Testcase(void)
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
ret = memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.pcName = "Tsk118B";
|
||||
|
||||
@@ -142,7 +142,8 @@ static UINT32 Testcase(void)
|
||||
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
|
||||
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
|
||||
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
ret = memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
task1.pcName = "Tsk118B";
|
||||
|
||||
@@ -80,7 +80,8 @@ static UINT32 Testcase(void)
|
||||
currCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM;
|
||||
#endif
|
||||
|
||||
memset(&task, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
ret = memset_s(&task, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)ItTimeslice001F01;
|
||||
task.usTaskPrio = TASK_PRIO_TEST_TASK + 1;
|
||||
task.pcName = "it_timeslice_001_f01";
|
||||
|
||||
@@ -99,7 +99,8 @@ static UINT32 Testcase(void)
|
||||
currCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM;
|
||||
#endif
|
||||
|
||||
memset(&task, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
ret = memset_s(&task, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)ItTimeslice002F01;
|
||||
task.usTaskPrio = TASK_PRIO_TEST_TASK + 1;
|
||||
task.pcName = "it_timeslice_002_f01";
|
||||
|
||||
@@ -57,8 +57,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk1";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -60,8 +60,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk2";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -56,8 +56,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk3";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -57,8 +57,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk4";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -62,8 +62,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk6";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -88,8 +88,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk7";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -62,8 +62,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk8";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -70,8 +70,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk9";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -62,8 +62,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk10";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -69,8 +69,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk11";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -74,8 +74,8 @@ static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk12";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -75,8 +75,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk13";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -67,8 +67,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk14";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -65,8 +65,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk15";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -60,8 +60,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk16";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -74,8 +74,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EvtTsk18A";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -83,8 +83,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EvtTsk19A";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -84,8 +84,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EvtTsk20A";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -54,8 +54,8 @@ EXIT:
|
||||
static VOID TaskF01(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
|
||||
task1.pcName = "EvtTsk21B";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
@@ -85,8 +85,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EvtTsk21A";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -73,8 +73,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EvtTsk22A";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -92,9 +92,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EvtTsk23A";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -66,8 +66,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk26";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -48,8 +48,9 @@ static VOID SwtmrF01(VOID)
|
||||
|
||||
g_eventMask = g_eventMask | (1 << g_testCount);
|
||||
|
||||
if (g_testCount > 17) // g_testCount > 17, do noting return
|
||||
if (g_testCount > 17) { // g_testCount > 17, do noting return
|
||||
return;
|
||||
}
|
||||
|
||||
ret = LOS_EventWrite(&g_event, g_eventMask);
|
||||
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
|
||||
@@ -81,8 +82,8 @@ static UINT32 Testcase(VOID)
|
||||
|
||||
UINT16 swTmrID;
|
||||
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk27";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -55,10 +55,9 @@ static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
UINT32 event;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
LOS_EventInit(&g_event);
|
||||
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk29";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -52,8 +52,8 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk30";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -83,12 +83,11 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
g_testCount = 0;
|
||||
LOS_EventInit(&g_event);
|
||||
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk32A";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -96,12 +96,11 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
|
||||
g_testCount = 0;
|
||||
LOS_EventInit(&g_event);
|
||||
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk33A";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
@@ -60,9 +60,9 @@ EXIT:
|
||||
static UINT32 Testcase(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S task1;
|
||||
TSK_INIT_PARAM_S task1 = {0};
|
||||
LOS_EventInit(&g_event);
|
||||
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
|
||||
|
||||
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
|
||||
task1.pcName = "EventTsk37";
|
||||
task1.uwStackSize = TASK_STACK_SIZE_TEST;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user