fix: iccarm编译修复
close: #I5JXMJ Signed-off-by: arvinzzz <zhaotianyu9@huawei.com> Change-Id: I3fbaf459ad4807a44396f319a4d53d3cc1e7700c
This commit is contained in:
parent
63bf098b0f
commit
d0c50a4af0
|
@ -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,6 +33,7 @@
|
|||
#define _LOS_ARCH_ATOMIC_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_interrupt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
|
|
@ -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,6 +33,7 @@
|
|||
#define _LOS_ARCH_ATOMIC_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_interrupt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
|
|
@ -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,6 +33,7 @@
|
|||
#define _LOS_ARCH_ATOMIC_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_interrupt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
|
|
@ -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,6 +33,7 @@
|
|||
#define _LOS_ARCH_ATOMIC_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_interrupt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
|
|
@ -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,6 +33,7 @@
|
|||
#define _LOS_ARCH_ATOMIC_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_interrupt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
|
|
@ -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,6 +33,7 @@
|
|||
#define _LOS_ARCH_ATOMIC_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_interrupt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
|
|
@ -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,6 +33,7 @@
|
|||
#define _LOS_ARCH_ATOMIC_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_interrupt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
|
|
@ -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,6 +33,7 @@
|
|||
#define _LOS_ARCH_ATOMIC_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_interrupt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#define _LOS_ARCH_ATOMIC_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_interrupt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
|
|
@ -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,6 +33,7 @@
|
|||
#define _LOS_ARCH_ATOMIC_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_interrupt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#define _LOS_ARCH_ATOMIC_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_interrupt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#define _LOS_ARCH_ATOMIC_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_interrupt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
|
|
@ -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,6 +33,7 @@
|
|||
#define _LOS_ARCH_ATOMIC_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_interrupt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
|
|
@ -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,6 +33,7 @@
|
|||
#define _LOS_ARCH_ATOMIC_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_interrupt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
|
|
@ -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,6 +33,7 @@
|
|||
#define _LOS_ARCH_ATOMIC_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_interrupt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
|
|
@ -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,6 +33,7 @@
|
|||
#define _LOS_ARCH_ATOMIC_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_interrupt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
|
|
@ -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,6 +33,7 @@
|
|||
#define _LOS_ARCH_ATOMIC_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_interrupt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
|
|
@ -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:
|
||||
|
@ -89,14 +89,14 @@ int LfsMount(struct MountPoint *mp, unsigned long mountflags, const void *data)
|
|||
|
||||
if ((mp == NULL) || (mp->mPath == NULL) || (data == NULL)) {
|
||||
errno = EFAULT;
|
||||
ret = LOS_NOK;
|
||||
ret = (int)LOS_NOK;
|
||||
goto errout;
|
||||
}
|
||||
|
||||
mountHdl = (lfs_t *)malloc(sizeof(lfs_t));
|
||||
if (mountHdl == NULL) {
|
||||
errno = ENODEV;
|
||||
ret = LOS_NOK;
|
||||
ret = (int)LOS_NOK;
|
||||
goto errout;
|
||||
}
|
||||
(void)memset_s(mountHdl, sizeof(lfs_t), 0, sizeof(lfs_t));
|
||||
|
@ -113,7 +113,7 @@ int LfsMount(struct MountPoint *mp, unsigned long mountflags, const void *data)
|
|||
if (ret != 0) {
|
||||
free(mountHdl);
|
||||
errno = LittlefsErrno(ret);
|
||||
ret = LOS_NOK;
|
||||
ret = (int)LOS_NOK;
|
||||
}
|
||||
|
||||
errout:
|
||||
|
@ -126,18 +126,18 @@ int LfsUmount(struct MountPoint *mp)
|
|||
|
||||
if (mp == NULL) {
|
||||
errno = EFAULT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
if (mp->mData == NULL) {
|
||||
errno = ENOENT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
ret = lfs_unmount((lfs_t *)mp->mData);
|
||||
if (ret != 0) {
|
||||
errno = LittlefsErrno(ret);
|
||||
ret = LOS_NOK;
|
||||
ret = (int)LOS_NOK;
|
||||
}
|
||||
|
||||
free(mp->mData);
|
||||
|
@ -151,18 +151,18 @@ int LfsUnlink(struct MountPoint *mp, const char *fileName)
|
|||
|
||||
if ((mp == NULL) || (fileName == NULL)) {
|
||||
errno = EFAULT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
if (mp->mData == NULL) {
|
||||
errno = ENOENT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
ret = lfs_remove((lfs_t *)mp->mData, fileName);
|
||||
if (ret != 0) {
|
||||
errno = LittlefsErrno(ret);
|
||||
ret = LOS_NOK;
|
||||
ret = (int)LOS_NOK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -174,12 +174,12 @@ int LfsMkdir(struct MountPoint *mp, const char *dirName)
|
|||
|
||||
if ((dirName == NULL) || (mp == NULL)) {
|
||||
errno = EFAULT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
if (mp->mData == NULL) {
|
||||
errno = ENOENT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
lfs_t *lfs = (lfs_t *)mp->mData;
|
||||
|
@ -187,7 +187,7 @@ int LfsMkdir(struct MountPoint *mp, const char *dirName)
|
|||
ret = lfs_mkdir(lfs, dirName);
|
||||
if (ret != 0) {
|
||||
errno = LittlefsErrno(ret);
|
||||
ret = LOS_NOK;
|
||||
ret = (int)LOS_NOK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -200,25 +200,25 @@ int LfsRmdir(struct MountPoint *mp, const char *dirName)
|
|||
|
||||
if (mp == NULL) {
|
||||
errno = EFAULT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
if (mp->mData == NULL) {
|
||||
errno = ENOENT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
lfs = (lfs_t *)mp->mData;
|
||||
|
||||
if (dirName == NULL) {
|
||||
errno = EFAULT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
ret = lfs_remove(lfs, dirName);
|
||||
if (ret != 0) {
|
||||
errno = LittlefsErrno(ret);
|
||||
ret = LOS_NOK;
|
||||
ret = (int)LOS_NOK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -230,14 +230,14 @@ int LfsOpendir(struct Dir *dir, const char *dirName)
|
|||
|
||||
if ((dir == NULL) || (dir->dMp == NULL) || (dir->dMp->mData == NULL)) {
|
||||
errno = EFAULT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
lfs_t *lfs = (lfs_t *)dir->dMp->mData;
|
||||
lfs_dir_t *dirInfo = (lfs_dir_t *)malloc(sizeof(lfs_dir_t));
|
||||
if (dirInfo == NULL) {
|
||||
errno = ENOMEM;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
(void)memset_s(dirInfo, sizeof(lfs_dir_t), 0, sizeof(lfs_dir_t));
|
||||
|
@ -254,7 +254,7 @@ int LfsOpendir(struct Dir *dir, const char *dirName)
|
|||
return LOS_OK;
|
||||
|
||||
errout:
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
int LfsReaddir(struct Dir *dir, struct dirent *dent)
|
||||
|
@ -265,12 +265,12 @@ int LfsReaddir(struct Dir *dir, struct dirent *dent)
|
|||
if ((dir == NULL) || (dir->dMp == NULL) || (dir->dMp->mData == NULL) ||
|
||||
(dent == NULL)) {
|
||||
errno = EFAULT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
if (dir->dData == NULL) {
|
||||
errno = EBADF;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
lfs_t *lfs = (lfs_t *)dir->dMp->mData;
|
||||
|
@ -296,7 +296,7 @@ int LfsReaddir(struct Dir *dir, struct dirent *dent)
|
|||
errno = LittlefsErrno(ret);
|
||||
}
|
||||
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
int LfsClosedir(struct Dir *dir)
|
||||
|
@ -305,12 +305,12 @@ int LfsClosedir(struct Dir *dir)
|
|||
|
||||
if ((dir == NULL) || (dir->dMp == NULL) || (dir->dMp->mData == NULL)) {
|
||||
errno = EFAULT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
if (dir->dData == NULL) {
|
||||
errno = EBADF;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
lfs_t *lfs = (lfs_t *)dir->dMp->mData;
|
||||
|
@ -319,7 +319,7 @@ int LfsClosedir(struct Dir *dir)
|
|||
ret = lfs_dir_close(lfs, dirInfo);
|
||||
if (ret != 0) {
|
||||
errno = LittlefsErrno(ret);
|
||||
ret = LOS_NOK;
|
||||
ret = (int)LOS_NOK;
|
||||
}
|
||||
|
||||
free(dirInfo);
|
||||
|
@ -336,13 +336,13 @@ int LfsOpen(struct File *file, const char *pathName, int openFlag)
|
|||
if ((pathName == NULL) || (file == NULL) || (file->fMp == NULL) ||
|
||||
(file->fMp->mData == NULL)) {
|
||||
errno = EFAULT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
lfsHandle = (lfs_file_t *)malloc(sizeof(lfs_file_t));
|
||||
if (lfsHandle == NULL) {
|
||||
errno = ENOMEM;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
int lfsOpenFlag = ConvertFlagToLfsOpenFlag(openFlag);
|
||||
|
@ -368,25 +368,25 @@ int LfsRead(struct File *file, char *buf, size_t len)
|
|||
|
||||
if (buf == NULL) {
|
||||
errno = EFAULT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
if ((file == NULL) || (file->fData == NULL)) {
|
||||
errno = EBADF;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
lfsHandle = (lfs_file_t *)file->fData;
|
||||
mp = file->fMp;
|
||||
if ((mp == NULL) || (mp->mData == NULL)) {
|
||||
errno = EFAULT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
ret = lfs_file_read((lfs_t *)mp->mData, lfsHandle, buf, len);
|
||||
if (ret < 0) {
|
||||
errno = LittlefsErrno(ret);
|
||||
ret = LOS_NOK;
|
||||
ret = (int)LOS_NOK;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -399,25 +399,25 @@ int LfsWrite(struct File *file, const char *buf, size_t len)
|
|||
|
||||
if (buf == NULL) {
|
||||
errno = EFAULT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
if ((file == NULL) || (file->fData == NULL)) {
|
||||
errno = EBADF;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
lfsHandle = (lfs_file_t *)file->fData;
|
||||
mp = file->fMp;
|
||||
if ((mp == NULL) || (mp->mData == NULL)) {
|
||||
errno = EFAULT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
ret = lfs_file_write((lfs_t *)mp->mData, lfsHandle, buf, len);
|
||||
if (ret < 0) {
|
||||
errno = LittlefsErrno(ret);
|
||||
ret = LOS_NOK;
|
||||
ret = (int)LOS_NOK;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -430,20 +430,20 @@ off_t LfsSeek(struct File *file, off_t offset, int whence)
|
|||
|
||||
if ((file == NULL) || (file->fData == NULL)) {
|
||||
errno = EBADF;
|
||||
return LOS_NOK;
|
||||
return (off_t)LOS_NOK;
|
||||
}
|
||||
|
||||
lfsHandle = (lfs_file_t *)file->fData;
|
||||
mp = file->fMp;
|
||||
if ((mp == NULL) || (mp->mData == NULL)) {
|
||||
errno = EFAULT;
|
||||
return LOS_NOK;
|
||||
return (off_t)LOS_NOK;
|
||||
}
|
||||
|
||||
ret = (off_t)lfs_file_seek((lfs_t *)mp->mData, lfsHandle, offset, whence);
|
||||
if (ret < 0) {
|
||||
errno = LittlefsErrno(ret);
|
||||
ret = LOS_NOK;
|
||||
ret = (off_t)LOS_NOK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -451,20 +451,20 @@ off_t LfsSeek(struct File *file, off_t offset, int whence)
|
|||
|
||||
int LfsClose(struct File *file)
|
||||
{
|
||||
INT32 ret;
|
||||
int ret;
|
||||
struct MountPoint *mp = NULL;
|
||||
lfs_file_t *lfsHandle = NULL;
|
||||
|
||||
if ((file == NULL) || (file->fData == NULL)) {
|
||||
errno = EBADF;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
lfsHandle = (lfs_file_t *)file->fData;
|
||||
mp = file->fMp;
|
||||
if ((mp == NULL) || (mp->mData == NULL)) {
|
||||
errno = EFAULT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&g_FslocalMutex);
|
||||
|
@ -473,7 +473,7 @@ int LfsClose(struct File *file)
|
|||
|
||||
if (ret != 0) {
|
||||
errno = LittlefsErrno(ret);
|
||||
ret = LOS_NOK;
|
||||
ret = (int)LOS_NOK;
|
||||
}
|
||||
|
||||
free(file->fData);
|
||||
|
@ -487,18 +487,18 @@ int LfsRename(struct MountPoint *mp, const char *oldName, const char *newName)
|
|||
|
||||
if ((mp == NULL) || (oldName == NULL) || (newName == NULL)) {
|
||||
errno = EFAULT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
if (mp->mData == NULL) {
|
||||
errno = ENOENT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
ret = lfs_rename((lfs_t *)mp->mData, oldName, newName);
|
||||
if (ret != 0) {
|
||||
errno = LittlefsErrno(ret);
|
||||
ret = LOS_NOK;
|
||||
ret = (int)LOS_NOK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -511,12 +511,12 @@ int LfsStat(struct MountPoint *mp, const char *path, struct stat *buf)
|
|||
|
||||
if ((mp == NULL) || (path == NULL) || (buf == NULL)) {
|
||||
errno = EFAULT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
if (mp->mData == NULL) {
|
||||
errno = ENOENT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
ret = lfs_stat((lfs_t *)mp->mData, path, &info);
|
||||
|
@ -529,7 +529,7 @@ int LfsStat(struct MountPoint *mp, const char *path, struct stat *buf)
|
|||
}
|
||||
} else {
|
||||
errno = LittlefsErrno(ret);
|
||||
ret = LOS_NOK;
|
||||
ret = (int)LOS_NOK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -542,19 +542,19 @@ int LfsSync(struct File *file)
|
|||
|
||||
if ((file == NULL) || (file->fData == NULL)) {
|
||||
errno = EBADF;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
if ((file->fMp == NULL) || (file->fMp->mData == NULL)) {
|
||||
errno = EFAULT;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
mp = file->fMp;
|
||||
ret = lfs_file_sync((lfs_t *)mp->mData, (lfs_file_t *)file->fData);
|
||||
if (ret != 0) {
|
||||
errno = LittlefsErrno(ret);
|
||||
ret = LOS_NOK;
|
||||
ret = (int)LOS_NOK;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,9 @@ kernel_module(module_name) {
|
|||
|
||||
deps = [ "//kernel/liteos_m/kal" ]
|
||||
configs += [ "$LITEOSTOPDIR:warn_config" ]
|
||||
cflags = [ "-Wno-parentheses" ]
|
||||
if (!defined(LOSCFG_COMPILER_ICCARM)) {
|
||||
cflags = [ "-Wno-parentheses" ]
|
||||
}
|
||||
}
|
||||
|
||||
config("public") {
|
||||
|
|
|
@ -42,7 +42,7 @@ static struct File g_files[NR_OPEN_DEFAULT];
|
|||
int FileToFd(struct File *file)
|
||||
{
|
||||
if (file == NULL) {
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
return file - g_files + MIN_START_FD;
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ int VfsLock(void)
|
|||
{
|
||||
if (LOS_MuxPend(g_fsMutex, LOS_WAIT_FOREVER) != LOS_OK) {
|
||||
PRINT_ERR("VfsLock failed!");
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
return LOS_OK;
|
||||
|
@ -245,7 +245,7 @@ static int VfsOpen(const char *path, int flags)
|
|||
VFS_ERRNO_SET(ENOMEM);
|
||||
VfsFilePut(file);
|
||||
VfsUnlock();
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
file->fFlags = (UINT32)flags;
|
||||
|
@ -319,7 +319,7 @@ static void VfsDetachFile(const struct File *file)
|
|||
static int VfsClose(int fd)
|
||||
{
|
||||
struct File *file = NULL;
|
||||
int ret = LOS_NOK;
|
||||
int ret = (int)LOS_NOK;
|
||||
|
||||
file = VfsAttachFileWithStatus(fd, FILE_STATUS_CLOSING);
|
||||
if (file == NULL) {
|
||||
|
@ -383,7 +383,7 @@ static ssize_t VfsRead(int fd, char *buff, size_t bytes)
|
|||
static ssize_t VfsWrite(int fd, const void *buff, size_t bytes)
|
||||
{
|
||||
struct File *file = NULL;
|
||||
ssize_t ret = LOS_NOK;
|
||||
ssize_t ret = (ssize_t)LOS_NOK;
|
||||
|
||||
if ((buff == NULL) || (bytes == 0)) {
|
||||
VFS_ERRNO_SET(EINVAL);
|
||||
|
@ -412,7 +412,7 @@ static ssize_t VfsWrite(int fd, const void *buff, size_t bytes)
|
|||
static off_t VfsLseek(int fd, off_t off, int whence)
|
||||
{
|
||||
struct File *file;
|
||||
off_t ret = LOS_NOK;
|
||||
off_t ret = (off_t)LOS_NOK;
|
||||
|
||||
file = VfsAttachFileReady(fd);
|
||||
if (file == NULL) {
|
||||
|
@ -434,7 +434,7 @@ static int VfsStat(const char *path, struct stat *stat)
|
|||
{
|
||||
struct MountPoint *mp = NULL;
|
||||
const char *pathInMp = NULL;
|
||||
int ret = LOS_NOK;
|
||||
int ret = (int)LOS_NOK;
|
||||
|
||||
if ((path == NULL) || (stat == NULL)) {
|
||||
VFS_ERRNO_SET(EINVAL);
|
||||
|
@ -467,7 +467,7 @@ static int VfsStatfs(const char *path, struct statfs *buf)
|
|||
{
|
||||
struct MountPoint *mp = NULL;
|
||||
const char *pathInMp = NULL;
|
||||
int ret = LOS_NOK;
|
||||
int ret = (int)LOS_NOK;
|
||||
|
||||
if ((path == NULL) || (buf == NULL)) {
|
||||
VFS_ERRNO_SET(EINVAL);
|
||||
|
@ -500,7 +500,7 @@ static int VfsUnlink(const char *path)
|
|||
{
|
||||
struct MountPoint *mp = NULL;
|
||||
const char *pathInMp = NULL;
|
||||
int ret = LOS_NOK;
|
||||
int ret = (int)LOS_NOK;
|
||||
|
||||
if (path == NULL) {
|
||||
VFS_ERRNO_SET(EINVAL);
|
||||
|
@ -532,7 +532,7 @@ static int VfsRename(const char *old, const char *new)
|
|||
struct MountPoint *mpNew = NULL;
|
||||
const char *pathInMpOld = NULL;
|
||||
const char *pathInMpNew = NULL;
|
||||
int ret = LOS_NOK;
|
||||
int ret = (int)LOS_NOK;
|
||||
|
||||
if ((old == NULL) || (new == NULL)) {
|
||||
VFS_ERRNO_SET(EINVAL);
|
||||
|
@ -587,7 +587,7 @@ static int VfsIoctl(int fd, int func, ...)
|
|||
va_list ap;
|
||||
unsigned long arg;
|
||||
struct File *file = NULL;
|
||||
int ret = LOS_NOK;
|
||||
int ret = (int)LOS_NOK;
|
||||
|
||||
va_start(ap, func);
|
||||
arg = va_arg(ap, unsigned long);
|
||||
|
@ -612,7 +612,7 @@ static int VfsIoctl(int fd, int func, ...)
|
|||
static int VfsSync(int fd)
|
||||
{
|
||||
struct File *file;
|
||||
int ret = LOS_NOK;
|
||||
int ret = (int)LOS_NOK;
|
||||
|
||||
file = VfsAttachFileReady(fd);
|
||||
if (file == NULL) {
|
||||
|
@ -724,7 +724,7 @@ static struct dirent *VfsReaddir(DIR *d)
|
|||
static int VfsClosedir(DIR *d)
|
||||
{
|
||||
struct MountPoint *mp = NULL;
|
||||
int ret = LOS_NOK;
|
||||
int ret = (int)LOS_NOK;
|
||||
struct Dir *dir = (struct Dir *)d;
|
||||
|
||||
if ((dir == NULL) || (dir->dMp == NULL)) {
|
||||
|
@ -762,7 +762,7 @@ static int VfsMkdir(const char *path, int mode)
|
|||
{
|
||||
struct MountPoint *mp = NULL;
|
||||
const char *pathInMp = NULL;
|
||||
int ret = LOS_NOK;
|
||||
int ret = (int)LOS_NOK;
|
||||
(void)mode;
|
||||
|
||||
if (path == NULL) {
|
||||
|
@ -786,7 +786,7 @@ static int VfsMkdir(const char *path, int mode)
|
|||
ret = mp->mFs->fsFops->mkdir(mp, pathInMp);
|
||||
} else {
|
||||
VFS_ERRNO_SET(ENOTSUP);
|
||||
ret = LOS_NOK;
|
||||
ret = (int)LOS_NOK;
|
||||
}
|
||||
|
||||
VfsUnlock();
|
||||
|
@ -823,7 +823,7 @@ static ssize_t VfsPread(int fd, void *buff, size_t bytes, off_t off)
|
|||
|
||||
if (buff == NULL) {
|
||||
VFS_ERRNO_SET(EFAULT);
|
||||
return LOS_NOK;
|
||||
return (ssize_t)LOS_NOK;
|
||||
}
|
||||
|
||||
if (bytes == 0) {
|
||||
|
@ -832,26 +832,26 @@ static ssize_t VfsPread(int fd, void *buff, size_t bytes, off_t off)
|
|||
|
||||
if (VfsLock() != LOS_OK) {
|
||||
VFS_ERRNO_SET(EAGAIN);
|
||||
return LOS_NOK;
|
||||
return (ssize_t)LOS_NOK;
|
||||
}
|
||||
|
||||
savepos = LOS_Lseek(fd, 0, SEEK_CUR);
|
||||
if (savepos == (off_t)-1) {
|
||||
VfsUnlock();
|
||||
return LOS_NOK;
|
||||
return (ssize_t)LOS_NOK;
|
||||
}
|
||||
|
||||
pos = LOS_Lseek(fd, off, SEEK_SET);
|
||||
if (pos == (off_t)-1) {
|
||||
VfsUnlock();
|
||||
return LOS_NOK;
|
||||
return (ssize_t)LOS_NOK;
|
||||
}
|
||||
|
||||
ret = LOS_Read(fd, buff, bytes);
|
||||
pos = LOS_Lseek(fd, savepos, SEEK_SET);
|
||||
if ((pos == (off_t)-1) && (ret >= 0)) {
|
||||
VfsUnlock();
|
||||
return LOS_NOK;
|
||||
return (ssize_t)LOS_NOK;
|
||||
}
|
||||
|
||||
VfsUnlock();
|
||||
|
@ -865,7 +865,7 @@ static ssize_t VfsPwrite(int fd, const void *buff, size_t bytes, off_t off)
|
|||
|
||||
if (buff == NULL) {
|
||||
VFS_ERRNO_SET(EFAULT);
|
||||
return LOS_NOK;
|
||||
return (ssize_t)LOS_NOK;
|
||||
}
|
||||
|
||||
if (bytes == 0) {
|
||||
|
@ -874,26 +874,26 @@ static ssize_t VfsPwrite(int fd, const void *buff, size_t bytes, off_t off)
|
|||
|
||||
if (VfsLock() != LOS_OK) {
|
||||
VFS_ERRNO_SET(EAGAIN);
|
||||
return LOS_NOK;
|
||||
return (ssize_t)LOS_NOK;
|
||||
}
|
||||
|
||||
savepos = LOS_Lseek(fd, 0, SEEK_CUR);
|
||||
if (savepos == (off_t)-1) {
|
||||
VfsUnlock();
|
||||
return LOS_NOK;
|
||||
return (ssize_t)LOS_NOK;
|
||||
}
|
||||
|
||||
pos = LOS_Lseek(fd, off, SEEK_SET);
|
||||
if (pos == (off_t)-1) {
|
||||
VfsUnlock();
|
||||
return LOS_NOK;
|
||||
return (ssize_t)LOS_NOK;
|
||||
}
|
||||
|
||||
ret = LOS_Write(fd, buff, bytes);
|
||||
pos = LOS_Lseek(fd, savepos, SEEK_SET);
|
||||
if ((pos == (off_t)-1) && (ret >= 0)) {
|
||||
VfsUnlock();
|
||||
return LOS_NOK;
|
||||
return (ssize_t)LOS_NOK;
|
||||
}
|
||||
|
||||
VfsUnlock();
|
||||
|
@ -912,35 +912,35 @@ int LOS_Open(const char *path, int flags, ...)
|
|||
unsigned flagMask = O_RDONLY | O_WRONLY | O_RDWR | O_APPEND | O_CREAT | O_LARGEFILE | O_TRUNC | O_EXCL | O_DIRECTORY;
|
||||
if ((unsigned)flags & ~flagMask) {
|
||||
errno = EINVAL;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
size_t pathLen = strlen(path) + 1;
|
||||
if ((unsigned)pathLen > PATH_MAX) {
|
||||
errno = EINVAL;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
char *canonicalPath = (char *)malloc(pathLen);
|
||||
if (!canonicalPath) {
|
||||
errno = ENOMEM;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
if (GetCanonicalPath(NULL, path, canonicalPath, pathLen) == 0) {
|
||||
FREE_AND_SET_NULL(canonicalPath);
|
||||
errno = ENOMEM;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
if (strcmp(canonicalPath, RANDOM_DEV_PATH) == 0) {
|
||||
FREE_AND_SET_NULL(canonicalPath);
|
||||
if ((O_ACCMODE & (unsigned)flags) != O_RDONLY) {
|
||||
errno = EPERM;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
if ((unsigned)flags & O_DIRECTORY) {
|
||||
errno = ENOTDIR;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
return RANDOM_DEV_FD;
|
||||
}
|
||||
|
@ -949,10 +949,10 @@ int LOS_Open(const char *path, int flags, ...)
|
|||
FREE_AND_SET_NULL(canonicalPath);
|
||||
if ((unsigned)flags & O_DIRECTORY) {
|
||||
errno = EPERM;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
errno = EISDIR;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
FREE_AND_SET_NULL(canonicalPath);
|
||||
#endif
|
||||
|
@ -984,7 +984,7 @@ int LOS_Close(int fd)
|
|||
}
|
||||
#endif
|
||||
|
||||
int ret = LOS_NOK;
|
||||
int ret = (int)LOS_NOK;
|
||||
if (fd >= 0 && fd < CONFIG_NFILE_DESCRIPTORS) {
|
||||
ret = VfsClose(fd);
|
||||
}
|
||||
|
@ -1025,7 +1025,7 @@ ssize_t LOS_Read(int fd, void *buff, size_t bytes)
|
|||
}
|
||||
#endif
|
||||
|
||||
ssize_t ret = LOS_NOK;
|
||||
ssize_t ret = (ssize_t)LOS_NOK;
|
||||
if (fd >= 0 && fd < CONFIG_NFILE_DESCRIPTORS) {
|
||||
ret = VfsRead(fd, buff, bytes);
|
||||
}
|
||||
|
@ -1038,7 +1038,7 @@ ssize_t LOS_Write(int fd, const void *buff, size_t bytes)
|
|||
#ifdef LOSCFG_RANDOM_DEV
|
||||
if (fd == RANDOM_DEV_FD) {
|
||||
errno = EBADF; /* "/dev/random" is readonly */
|
||||
return LOS_NOK;
|
||||
return (ssize_t)LOS_NOK;
|
||||
}
|
||||
#endif
|
||||
#ifdef LOSCFG_NET_LWIP_SACK
|
||||
|
@ -1054,7 +1054,7 @@ ssize_t LOS_Write(int fd, const void *buff, size_t bytes)
|
|||
}
|
||||
#endif
|
||||
|
||||
ssize_t ret = LOS_NOK;
|
||||
ssize_t ret = (ssize_t)LOS_NOK;
|
||||
if (fd >= 0 && fd < CONFIG_NFILE_DESCRIPTORS) {
|
||||
ret = VfsWrite(fd, buff, bytes);
|
||||
}
|
||||
|
@ -1137,7 +1137,7 @@ int LOS_Fstat(int fd, struct stat *buf)
|
|||
int ret;
|
||||
filep = VfsAttachFileReady(fd);
|
||||
if ((filep == NULL) || (filep->fMp == NULL) || filep->fullPath == NULL) {
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
ret = stat(filep->fullPath, buf);
|
||||
VfsDetachFile(filep);
|
||||
|
@ -1169,7 +1169,7 @@ int LOS_Fcntl(int fd, int cmd, ...)
|
|||
|
||||
if (ret < 0) {
|
||||
VFS_ERRNO_SET(-ret);
|
||||
ret = LOS_NOK;
|
||||
ret = (int)LOS_NOK;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -1207,22 +1207,22 @@ ssize_t LOS_Readv(int fd, const struct iovec *iovBuf, int iovcnt)
|
|||
const struct iovec *iov = (const struct iovec *)iovBuf;
|
||||
|
||||
if ((iov == NULL) || (iovcnt <= 0) || (iovcnt > IOV_MAX_CNT)) {
|
||||
return LOS_NOK;
|
||||
return (ssize_t)LOS_NOK;
|
||||
}
|
||||
|
||||
for (i = 0; i < iovcnt; ++i) {
|
||||
if ((SSIZE_MAX - bufLen) < iov[i].iov_len) {
|
||||
return LOS_NOK;
|
||||
return (ssize_t)LOS_NOK;
|
||||
}
|
||||
bufLen += iov[i].iov_len;
|
||||
}
|
||||
if (bufLen == 0) {
|
||||
return LOS_NOK;
|
||||
return (ssize_t)LOS_NOK;
|
||||
}
|
||||
totalLen = bufLen * sizeof(char);
|
||||
buf = (char *)malloc(totalLen);
|
||||
if (buf == NULL) {
|
||||
return LOS_NOK;
|
||||
return (ssize_t)LOS_NOK;
|
||||
}
|
||||
|
||||
totalBytesRead = read(fd, buf, bufLen);
|
||||
|
@ -1238,7 +1238,7 @@ ssize_t LOS_Readv(int fd, const struct iovec *iovBuf, int iovcnt)
|
|||
ret = memcpy_s(readBuf, bytesToRead, curBuf, lenToRead);
|
||||
if (ret != EOK) {
|
||||
free(buf);
|
||||
return LOS_NOK;
|
||||
return (ssize_t)LOS_NOK;
|
||||
}
|
||||
if (totalLen < (size_t)bytesToRead) {
|
||||
break;
|
||||
|
@ -1264,23 +1264,23 @@ ssize_t LOS_Writev(int fd, const struct iovec *iovBuf, int iovcnt)
|
|||
const struct iovec *iov = iovBuf;
|
||||
|
||||
if ((iov == NULL) || (iovcnt <= 0) || (iovcnt > IOV_MAX_CNT)) {
|
||||
return LOS_NOK;
|
||||
return (ssize_t)LOS_NOK;
|
||||
}
|
||||
|
||||
for (i = 0; i < iovcnt; ++i) {
|
||||
if ((SSIZE_MAX - bufLen) < iov[i].iov_len) {
|
||||
VFS_ERRNO_SET(EINVAL);
|
||||
return LOS_NOK;
|
||||
return (ssize_t)LOS_NOK;
|
||||
}
|
||||
bufLen += iov[i].iov_len;
|
||||
}
|
||||
if (bufLen == 0) {
|
||||
return LOS_NOK;
|
||||
return (ssize_t)LOS_NOK;
|
||||
}
|
||||
totalLen = bufLen * sizeof(char);
|
||||
buf = (char *)malloc(totalLen);
|
||||
if (buf == NULL) {
|
||||
return LOS_NOK;
|
||||
return (ssize_t)LOS_NOK;
|
||||
}
|
||||
curBuf = buf;
|
||||
for (i = 0; i < iovcnt; ++i) {
|
||||
|
@ -1292,7 +1292,7 @@ ssize_t LOS_Writev(int fd, const struct iovec *iovBuf, int iovcnt)
|
|||
ret = memcpy_s(curBuf, totalLen, writeBuf, bytesToWrite);
|
||||
if (ret != EOK) {
|
||||
free(buf);
|
||||
return LOS_NOK;
|
||||
return (ssize_t)LOS_NOK;
|
||||
}
|
||||
curBuf += bytesToWrite;
|
||||
totalLen -= bytesToWrite;
|
||||
|
@ -1318,26 +1318,26 @@ int LOS_Access(const char *path, int amode)
|
|||
|
||||
result = stat(path, &buf);
|
||||
if (result != 0) {
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
mode = buf.st_mode;
|
||||
if ((unsigned int)amode & R_OK) {
|
||||
if ((mode & (S_IROTH | S_IRGRP | S_IRUSR)) == 0) {
|
||||
VFS_ERRNO_SET(EACCES);
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
}
|
||||
if ((unsigned int)amode & W_OK) {
|
||||
if ((mode & (S_IWOTH | S_IWGRP | S_IWUSR)) == 0) {
|
||||
VFS_ERRNO_SET(EACCES);
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
}
|
||||
if ((unsigned int)amode & X_OK) {
|
||||
if ((mode & (S_IXOTH | S_IXGRP | S_IXUSR)) == 0) {
|
||||
VFS_ERRNO_SET(EACCES);
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -1345,7 +1345,7 @@ int LOS_Access(const char *path, int amode)
|
|||
|
||||
int LOS_Ftruncate(int fd, off_t length)
|
||||
{
|
||||
int ret = LOS_NOK;
|
||||
int ret = (int)LOS_NOK;
|
||||
struct File *file = NULL;
|
||||
|
||||
if (length <= 0) {
|
||||
|
@ -1379,7 +1379,7 @@ int LOS_Ftruncate(int fd, off_t length)
|
|||
|
||||
ssize_t LOS_Pread(int fd, void *buff, size_t bytes, off_t off)
|
||||
{
|
||||
ssize_t ret = LOS_NOK;
|
||||
ssize_t ret = (ssize_t)LOS_NOK;
|
||||
if (fd >= 0 && fd < CONFIG_NFILE_DESCRIPTORS) {
|
||||
ret = VfsPread(fd, buff, bytes, off);
|
||||
}
|
||||
|
@ -1389,7 +1389,7 @@ ssize_t LOS_Pread(int fd, void *buff, size_t bytes, off_t off)
|
|||
|
||||
ssize_t LOS_Pwrite(int fd, const void *buff, size_t bytes, off_t off)
|
||||
{
|
||||
ssize_t ret = LOS_NOK;
|
||||
ssize_t ret = (ssize_t)LOS_NOK;
|
||||
if (fd >= 0 && fd < CONFIG_NFILE_DESCRIPTORS) {
|
||||
ret = VfsPwrite(fd, buff, bytes, off);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
int OsVfsInit(void)
|
||||
{
|
||||
if (LOS_MuxCreate(&g_fsMutex) != LOS_OK) {
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
#if (LOSCFG_SUPPORT_FATFS == 1)
|
||||
FatFsInit();
|
||||
|
|
|
@ -57,20 +57,20 @@ int OsFsRegister(const char *fsType, struct MountOps *fsMops,
|
|||
struct FileOps *fsFops, struct FsManagement *fsMgt)
|
||||
{
|
||||
if ((fsMops == NULL) || (fsFops == NULL)) {
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
struct FsMap *newfs = (struct FsMap *)malloc(sizeof(struct FsMap));
|
||||
if (newfs == NULL) {
|
||||
PRINT_ERR("Fs register malloc failed, fsType %s.\n", fsType);
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
(void)memset_s(newfs, sizeof(struct FsMap), 0, sizeof(struct FsMap));
|
||||
|
||||
newfs->fsType = strdup(fsType);
|
||||
if (newfs->fsType == NULL) {
|
||||
free(newfs);
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
newfs->fsMops = fsMops;
|
||||
|
|
|
@ -128,11 +128,12 @@ int LOS_FsMount(const char *source, const char *target,
|
|||
{
|
||||
int ret;
|
||||
struct MountPoint *mp = NULL;
|
||||
struct FsMap *mFs = NULL;
|
||||
const char *pathInMp = NULL;
|
||||
|
||||
/* target must begin with '/', for example /system, /data, etc. */
|
||||
if ((target == NULL) || (target[0] != '/')) {
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
(void)VfsLock();
|
||||
|
@ -143,9 +144,8 @@ int LOS_FsMount(const char *source, const char *target,
|
|||
}
|
||||
|
||||
/* Find fsMap coresponding to the fsType */
|
||||
struct FsMap *mFs = VfsFsMapGet(fsType);
|
||||
if ((mFs == NULL) || (mFs->fsMops == NULL) ||
|
||||
(mFs->fsMops->mount == NULL)) {
|
||||
mFs = VfsFsMapGet(fsType);
|
||||
if ((mFs == NULL) || (mFs->fsMops == NULL) || (mFs->fsMops->mount == NULL)) {
|
||||
goto errout;
|
||||
}
|
||||
|
||||
|
@ -187,14 +187,14 @@ errout:
|
|||
free((void *)mp->mDev);
|
||||
free(mp);
|
||||
VfsUnlock();
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
int LOS_FsUmount(const char *target)
|
||||
{
|
||||
struct MountPoint *mp = NULL;
|
||||
const char *pathInMp = NULL;
|
||||
int ret = LOS_NOK;
|
||||
int ret = (int)LOS_NOK;
|
||||
|
||||
(void)VfsLock();
|
||||
if (target == NULL) {
|
||||
|
@ -230,7 +230,7 @@ int LOS_FsUmount(const char *target)
|
|||
errout:
|
||||
PRINT_ERR("umount2 failed, target %s.\n", target);
|
||||
VfsUnlock();
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
static void CloseFdsInMp(struct MountPoint *mp)
|
||||
|
@ -252,7 +252,7 @@ int LOS_FsUmount2(const char *target, int flag)
|
|||
{
|
||||
struct MountPoint *mp = NULL;
|
||||
const char *pathInMp = NULL;
|
||||
int ret = LOS_NOK;
|
||||
int ret = (int)LOS_NOK;
|
||||
|
||||
(void)VfsLock();
|
||||
if (target == NULL) {
|
||||
|
@ -290,5 +290,5 @@ int LOS_FsUmount2(const char *target, int flag)
|
|||
errout:
|
||||
PRINT_ERR("umount2 failed, target %s.\n", target);
|
||||
VfsUnlock();
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
int GetPartIdByPartName(const char *partName)
|
||||
{
|
||||
if (partName == NULL) {
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
/* the character next to p is the partId */
|
||||
|
@ -49,13 +49,13 @@ int GetPartIdByPartName(const char *partName)
|
|||
return atoi(p + 1);
|
||||
}
|
||||
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
int GetDevIdByDevName(const char *dev)
|
||||
{
|
||||
if (dev == NULL) {
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
/* last character is the deviceId */
|
||||
|
@ -64,13 +64,13 @@ int GetDevIdByDevName(const char *dev)
|
|||
return atoi(p);
|
||||
}
|
||||
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
int LOS_DiskPartition(const char *dev, const char *fsType, int *lengthArray,
|
||||
int partnum)
|
||||
{
|
||||
int ret = LOS_NOK;
|
||||
int ret = (int)LOS_NOK;
|
||||
struct FsMap *fMap = VfsFsMapGet(fsType);
|
||||
if ((fMap != NULL) && (fMap->fsMgt != NULL) &&
|
||||
(fMap->fsMgt->fdisk != NULL)) {
|
||||
|
@ -82,7 +82,7 @@ int LOS_DiskPartition(const char *dev, const char *fsType, int *lengthArray,
|
|||
|
||||
int LOS_PartitionFormat(const char *partName, char *fsType, void *data)
|
||||
{
|
||||
int ret = LOS_NOK;
|
||||
int ret = (int)LOS_NOK;
|
||||
|
||||
/* check if the device is mounted by iterate the mp list
|
||||
format is not allowed when the device has been mounted. */
|
||||
|
@ -91,7 +91,7 @@ int LOS_PartitionFormat(const char *partName, char *fsType, void *data)
|
|||
if ((iter->mFs != NULL) && (iter->mFs->fsType != NULL) &&
|
||||
strcmp(iter->mFs->fsType, fsType) == 0) {
|
||||
errno = EBUSY;
|
||||
return LOS_NOK;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
@ -209,7 +209,7 @@ u32_t sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeoutMs)
|
|||
{
|
||||
if (mbox == NULL) {
|
||||
LWIP_DEBUGF(SYS_DEBUG, ("sys_arch_mbox_fetch: mbox is null"));
|
||||
return ERR_ARG;
|
||||
return (u32_t)ERR_ARG;
|
||||
}
|
||||
|
||||
void *ignore = 0; /* if msg==NULL, the fetched msg should be dropped */
|
||||
|
@ -232,7 +232,7 @@ u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg)
|
|||
{
|
||||
if (mbox == NULL) {
|
||||
LWIP_DEBUGF(SYS_DEBUG, ("sys_arch_mbox_tryfetch: mbox is null"));
|
||||
return ERR_ARG;
|
||||
return (u32_t)ERR_ARG;
|
||||
}
|
||||
|
||||
void *ignore = 0; /* if msg==NULL, the fetched msg should be dropped */
|
||||
|
@ -313,7 +313,7 @@ u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeoutMs)
|
|||
{
|
||||
if (sem == NULL) {
|
||||
LWIP_DEBUGF(SYS_DEBUG, ("sys_arch_sem_wait: sem is null"));
|
||||
return ERR_ARG;
|
||||
return (u32_t)ERR_ARG;
|
||||
}
|
||||
|
||||
UINT64 tick = ROUND_UP_DIV((UINT64)timeoutMs * LOSCFG_BASE_CORE_TICK_PER_SECOND, OS_SYS_MS_PER_SECOND);
|
||||
|
|
Loading…
Reference in New Issue