回退 'Pull Request !938 : 修复文件系统不合理的锁操作'
This commit is contained in:
@@ -34,11 +34,3 @@ config FS_VFS
|
||||
|
||||
help
|
||||
Answer Y to enable LiteOS support VFS.
|
||||
|
||||
if FS_VFS
|
||||
config FS_LOCK_TIMEOUT
|
||||
int "Filesystem global lock timeout value in tick. -1 for waiting forever"
|
||||
default -1
|
||||
help
|
||||
The timeout value of getting filesystem lock in tick. -1 for waiting forever
|
||||
endif
|
||||
|
||||
@@ -139,17 +139,6 @@ int LOS_PartitionFormat(const char *partName, char *fsType, void *data);
|
||||
int LOS_FsRegister(const char *fsType, const struct MountOps *fsMops,
|
||||
const struct FileOps *fsFops, const struct FsManagement *fsMgt);
|
||||
|
||||
/*
|
||||
* @brief Lock the whole filesystem to forbid filesystem access.
|
||||
*
|
||||
* @return Return LOS_NOK if error. Return LOS_OK if seccess.
|
||||
*/
|
||||
int LOS_FsLock(void);
|
||||
|
||||
/*
|
||||
* @brief Unlock the whole filesystem to allow filesystem access.
|
||||
*/
|
||||
void LOS_FsUnlock(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
||||
@@ -100,20 +100,20 @@ int PollQueryFd(int fd, struct PollTable *table)
|
||||
UINT32 g_fsMutex;
|
||||
static UINT32 g_dirNum = 0;
|
||||
|
||||
int LOS_FsLock(void)
|
||||
int VfsLock(void)
|
||||
{
|
||||
if (!OsCheckKernelRunning()) {
|
||||
return LOS_OK;
|
||||
}
|
||||
if (LOS_MuxPend(g_fsMutex, (UINT32)LOSCFG_FS_LOCK_TIMEOUT) != LOS_OK) {
|
||||
PRINT_ERR("LOS_FsLock failed!");
|
||||
if (LOS_MuxPend(g_fsMutex, LOS_WAIT_FOREVER) != LOS_OK) {
|
||||
PRINT_ERR("VfsLock failed!");
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
void LOS_FsUnlock(void)
|
||||
void VfsUnlock(void)
|
||||
{
|
||||
if (!OsCheckKernelRunning()) {
|
||||
return;
|
||||
@@ -224,7 +224,7 @@ static int VfsOpen(const char *path, int flags)
|
||||
return fd;
|
||||
}
|
||||
|
||||
if (LOS_FsLock() != LOS_OK) {
|
||||
if (VfsLock() != LOS_OK) {
|
||||
VFS_ERRNO_SET(EAGAIN);
|
||||
return fd;
|
||||
}
|
||||
@@ -234,7 +234,7 @@ static int VfsOpen(const char *path, int flags)
|
||||
(mp->mFs->fsFops == NULL) || (mp->mFs->fsFops->open == NULL)) {
|
||||
/* path is not in any mountpoint */
|
||||
VFS_ERRNO_SET(ENOENT);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return fd;
|
||||
}
|
||||
|
||||
@@ -242,14 +242,14 @@ static int VfsOpen(const char *path, int flags)
|
||||
(flags & (O_CREAT | O_WRONLY | O_RDWR))) {
|
||||
/* can't create file in read only mp */
|
||||
VFS_ERRNO_SET(EACCES);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return fd;
|
||||
}
|
||||
|
||||
file = VfsFileGet();
|
||||
if (file == NULL) {
|
||||
VFS_ERRNO_SET(ENFILE);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return fd;
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ static int VfsOpen(const char *path, int flags)
|
||||
if (file->fullPath == NULL) {
|
||||
VFS_ERRNO_SET(ENOMEM);
|
||||
VfsFilePut(file);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
(void)strcpy_s((char *)file->fullPath, len, path);
|
||||
@@ -279,7 +279,7 @@ static int VfsOpen(const char *path, int flags)
|
||||
VfsFilePut(file);
|
||||
}
|
||||
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return fd;
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ static struct File *VfsAttachFile(int fd, UINT32 status)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (LOS_FsLock() != LOS_OK) {
|
||||
if (VfsLock() != LOS_OK) {
|
||||
VFS_ERRNO_SET(EFAULT);
|
||||
return NULL;
|
||||
}
|
||||
@@ -302,13 +302,13 @@ static struct File *VfsAttachFile(int fd, UINT32 status)
|
||||
file = FdToFile(fd);
|
||||
if ((file == NULL) || (file->fMp == NULL)) {
|
||||
VFS_ERRNO_SET(EBADF);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (file->fStatus != FILE_STATUS_READY) {
|
||||
VFS_ERRNO_SET(EBADF);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ static struct File *VfsAttachFileWithStatus(int fd, int status)
|
||||
static void VfsDetachFile(const struct File *file)
|
||||
{
|
||||
(void)file;
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
}
|
||||
|
||||
static int VfsClose(int fd)
|
||||
@@ -674,7 +674,7 @@ int stat(const char *path, struct stat *stat)
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
|
||||
if (LOS_FsLock() != LOS_OK) {
|
||||
if (VfsLock() != LOS_OK) {
|
||||
VFS_ERRNO_SET(EAGAIN);
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
@@ -682,7 +682,7 @@ int stat(const char *path, struct stat *stat)
|
||||
mp = VfsMpFind(path, &pathInMp);
|
||||
if ((mp == NULL) || (pathInMp == NULL) || (*pathInMp == '\0')) {
|
||||
VFS_ERRNO_SET(ENOENT);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
|
||||
@@ -692,7 +692,7 @@ int stat(const char *path, struct stat *stat)
|
||||
VFS_ERRNO_SET(ENOTSUP);
|
||||
}
|
||||
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
FUNC_ALIAS(stat, _stat, (const char *path, struct stat *stat), int);
|
||||
@@ -708,7 +708,7 @@ int statfs(const char *path, struct statfs *buf)
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
|
||||
if (LOS_FsLock() != LOS_OK) {
|
||||
if (VfsLock() != LOS_OK) {
|
||||
VFS_ERRNO_SET(EAGAIN);
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
@@ -716,7 +716,7 @@ int statfs(const char *path, struct statfs *buf)
|
||||
mp = VfsMpFind(path, &pathInMp);
|
||||
if ((mp == NULL) || (pathInMp == NULL) || (*pathInMp == '\0')) {
|
||||
VFS_ERRNO_SET(ENOENT);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
|
||||
@@ -726,7 +726,7 @@ int statfs(const char *path, struct statfs *buf)
|
||||
VFS_ERRNO_SET(ENOTSUP);
|
||||
}
|
||||
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
|
||||
@@ -741,7 +741,7 @@ int unlink(const char *path)
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
|
||||
if (LOS_FsLock() != LOS_OK) {
|
||||
if (VfsLock() != LOS_OK) {
|
||||
VFS_ERRNO_SET(EAGAIN);
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
@@ -750,13 +750,13 @@ int unlink(const char *path)
|
||||
if ((mp == NULL) || (pathInMp == NULL) || (*pathInMp == '\0') ||
|
||||
(mp->mFs->fsFops->unlink == NULL)) {
|
||||
VFS_ERRNO_SET(ENOENT);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
|
||||
ret = mp->mFs->fsFops->unlink(mp, pathInMp);
|
||||
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
FUNC_ALIAS(unlink, _unlink, (const char *path), int);
|
||||
@@ -774,7 +774,7 @@ int rename(const char *oldpath, const char *newpath)
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
|
||||
if (LOS_FsLock() != LOS_OK) {
|
||||
if (VfsLock() != LOS_OK) {
|
||||
VFS_ERRNO_SET(EAGAIN);
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
@@ -783,27 +783,27 @@ int rename(const char *oldpath, const char *newpath)
|
||||
|
||||
if (pathInMpOld == NULL) {
|
||||
VFS_ERRNO_SET(EINVAL);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
|
||||
if ((mpOld == NULL) || (*pathInMpOld == '\0') ||
|
||||
(mpOld->mFs->fsFops->unlink == NULL)) {
|
||||
VFS_ERRNO_SET(EINVAL);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
|
||||
mpNew = VfsMpFind(newpath, &pathInMpNew);
|
||||
if ((mpNew == NULL) || (pathInMpNew == NULL) || (*pathInMpNew == '\0') || (mpNew->mFs->fsFops->unlink == NULL)) {
|
||||
VFS_ERRNO_SET(EINVAL);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
|
||||
if (mpOld != mpNew) {
|
||||
VFS_ERRNO_SET(EXDEV);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
|
||||
@@ -813,7 +813,7 @@ int rename(const char *oldpath, const char *newpath)
|
||||
VFS_ERRNO_SET(ENOTSUP);
|
||||
}
|
||||
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
|
||||
@@ -861,7 +861,7 @@ DIR *opendir(const char *path)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (LOS_FsLock() != LOS_OK) {
|
||||
if (VfsLock() != LOS_OK) {
|
||||
VFS_ERRNO_SET(EAGAIN);
|
||||
LOSCFG_FS_FREE_HOOK(dir);
|
||||
return NULL;
|
||||
@@ -869,7 +869,7 @@ DIR *opendir(const char *path)
|
||||
|
||||
if (g_dirNum >= LOSCFG_MAX_OPEN_DIRS) {
|
||||
VFS_ERRNO_SET(ENFILE);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
LOSCFG_FS_FREE_HOOK(dir);
|
||||
return NULL;
|
||||
}
|
||||
@@ -877,14 +877,14 @@ DIR *opendir(const char *path)
|
||||
mp = VfsMpFind(path, &pathInMp);
|
||||
if ((mp == NULL) || (pathInMp == NULL)) {
|
||||
VFS_ERRNO_SET(ENOENT);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
LOSCFG_FS_FREE_HOOK(dir);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (mp->mFs->fsFops->opendir == NULL) {
|
||||
VFS_ERRNO_SET(ENOTSUP);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
LOSCFG_FS_FREE_HOOK(dir);
|
||||
return NULL;
|
||||
}
|
||||
@@ -901,7 +901,7 @@ DIR *opendir(const char *path)
|
||||
dir = NULL;
|
||||
}
|
||||
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return (DIR *)dir;
|
||||
}
|
||||
|
||||
@@ -915,7 +915,7 @@ struct dirent *readdir(DIR *dir)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (LOS_FsLock() != LOS_OK) {
|
||||
if (VfsLock() != LOS_OK) {
|
||||
VFS_ERRNO_SET(EAGAIN);
|
||||
return NULL;
|
||||
}
|
||||
@@ -929,7 +929,7 @@ struct dirent *readdir(DIR *dir)
|
||||
VFS_ERRNO_SET(ENOTSUP);
|
||||
}
|
||||
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -947,7 +947,7 @@ int closedir(DIR *dir)
|
||||
|
||||
mp = d->dMp;
|
||||
|
||||
if (LOS_FsLock() != LOS_OK) {
|
||||
if (VfsLock() != LOS_OK) {
|
||||
VFS_ERRNO_SET(EAGAIN);
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
@@ -966,7 +966,7 @@ int closedir(DIR *dir)
|
||||
VFS_ERRNO_SET(EBADF);
|
||||
}
|
||||
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
LOSCFG_FS_FREE_HOOK(d);
|
||||
d = NULL;
|
||||
return MapToPosixRet(ret);
|
||||
@@ -984,7 +984,7 @@ int mkdir(const char *path, mode_t mode)
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
|
||||
if (LOS_FsLock() != LOS_OK) {
|
||||
if (VfsLock() != LOS_OK) {
|
||||
VFS_ERRNO_SET(EAGAIN);
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
@@ -992,7 +992,7 @@ int mkdir(const char *path, mode_t mode)
|
||||
mp = VfsMpFind(path, &pathInMp);
|
||||
if ((mp == NULL) || (pathInMp == NULL) || (*pathInMp == '\0')) {
|
||||
VFS_ERRNO_SET(ENOENT);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
|
||||
@@ -1002,7 +1002,7 @@ int mkdir(const char *path, mode_t mode)
|
||||
VFS_ERRNO_SET(ENOTSUP);
|
||||
}
|
||||
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
|
||||
@@ -1017,7 +1017,7 @@ int rmdir(const char *path)
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
|
||||
if (LOS_FsLock() != LOS_OK) {
|
||||
if (VfsLock() != LOS_OK) {
|
||||
VFS_ERRNO_SET(EAGAIN);
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
@@ -1026,13 +1026,13 @@ int rmdir(const char *path)
|
||||
if ((mp == NULL) || (pathInMp == NULL) || (*pathInMp == '\0') ||
|
||||
(mp->mFs->fsFops->rmdir == NULL)) {
|
||||
VFS_ERRNO_SET(ENOENT);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
|
||||
ret = mp->mFs->fsFops->rmdir(mp, pathInMp);
|
||||
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return MapToPosixRet(ret);
|
||||
}
|
||||
|
||||
@@ -1312,31 +1312,31 @@ ssize_t pread(int fd, void *buff, size_t bytes, off_t off)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (LOS_FsLock() != LOS_OK) {
|
||||
if (VfsLock() != LOS_OK) {
|
||||
VFS_ERRNO_SET(EAGAIN);
|
||||
return MapToPosixRet((int)ret);
|
||||
}
|
||||
|
||||
savepos = lseek(fd, 0, SEEK_CUR);
|
||||
if (savepos == (off_t)-1) {
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return MapToPosixRet((int)ret);
|
||||
}
|
||||
|
||||
pos = lseek(fd, off, SEEK_SET);
|
||||
if (pos == (off_t)-1) {
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return MapToPosixRet((int)ret);
|
||||
}
|
||||
|
||||
ret = read(fd, buff, bytes);
|
||||
pos = lseek(fd, savepos, SEEK_SET);
|
||||
if ((pos == (off_t)-1) && (ret >= 0)) {
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return MapToPosixRet((int)LOS_NOK);
|
||||
}
|
||||
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
|
||||
return MapToPosixRet((int)ret);
|
||||
}
|
||||
@@ -1359,31 +1359,31 @@ ssize_t pwrite(int fd, const void *buff, size_t bytes, off_t off)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (LOS_FsLock() != LOS_OK) {
|
||||
if (VfsLock() != LOS_OK) {
|
||||
VFS_ERRNO_SET(EAGAIN);
|
||||
return MapToPosixRet((int)ret);
|
||||
}
|
||||
|
||||
savepos = lseek(fd, 0, SEEK_CUR);
|
||||
if (savepos == (off_t)-1) {
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return MapToPosixRet((int)ret);
|
||||
}
|
||||
|
||||
pos = lseek(fd, off, SEEK_SET);
|
||||
if (pos == (off_t)-1) {
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return MapToPosixRet((int)ret);
|
||||
}
|
||||
|
||||
ret = write(fd, buff, bytes);
|
||||
pos = lseek(fd, savepos, SEEK_SET);
|
||||
if ((pos == (off_t)-1) && (ret >= 0)) {
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return MapToPosixRet((int)LOS_NOK);
|
||||
}
|
||||
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
|
||||
return MapToPosixRet((int)ret);
|
||||
}
|
||||
|
||||
@@ -41,17 +41,17 @@ struct FsMap *VfsFsMapGet(const char *fsType)
|
||||
{
|
||||
struct FsMap *curr = g_fsMap;
|
||||
|
||||
(void)LOS_FsLock();
|
||||
(void)VfsLock();
|
||||
while (curr != NULL) {
|
||||
if ((curr->fsType != NULL) && (fsType != NULL) &&
|
||||
(strcmp(curr->fsType, fsType) == 0)) {
|
||||
LOS_FsUnlock();
|
||||
(void)VfsUnlock();
|
||||
return curr;
|
||||
}
|
||||
curr = curr->next;
|
||||
}
|
||||
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -86,11 +86,11 @@ int OsFsRegister(const char *fsType, const struct MountOps *fsMops,
|
||||
newfs->fsMgt = fsMgt;
|
||||
newfs->fsRefs = 0;
|
||||
|
||||
(void)LOS_FsLock();
|
||||
(void)VfsLock();
|
||||
newfs->next = g_fsMap;
|
||||
g_fsMap = newfs;
|
||||
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -191,17 +191,17 @@ int mount(const char *source, const char *target,
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
(void)LOS_FsLock();
|
||||
(void)VfsLock();
|
||||
|
||||
if (mountflags & MS_REMOUNT) {
|
||||
ret = VfsRemount(source, target, fsType, mountflags, data);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
mp = VfsMountPointInit(target, fsType, mountflags);
|
||||
if (mp == NULL) {
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ int mount(const char *source, const char *target,
|
||||
mp->mDev = LOSCFG_FS_MALLOC_HOOK(len);
|
||||
if (mp->mDev == NULL) {
|
||||
LOSCFG_FS_FREE_HOOK(mp);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
(void)strcpy_s((char *)mp->mDev, len, source);
|
||||
@@ -231,14 +231,14 @@ int mount(const char *source, const char *target,
|
||||
}
|
||||
|
||||
g_mountPoints = mp;
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return LOS_OK;
|
||||
|
||||
errout:
|
||||
LOSCFG_FS_FREE_HOOK((void *)mp->mPath);
|
||||
LOSCFG_FS_FREE_HOOK((void *)mp->mDev);
|
||||
LOSCFG_FS_FREE_HOOK(mp);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ int umount(const char *target)
|
||||
const char *pathInMp = NULL;
|
||||
int ret = (int)LOS_NOK;
|
||||
|
||||
(void)LOS_FsLock();
|
||||
(void)VfsLock();
|
||||
if (target == NULL) {
|
||||
goto errout;
|
||||
}
|
||||
@@ -276,12 +276,12 @@ int umount(const char *target)
|
||||
LOSCFG_FS_FREE_HOOK((void *)mp->mDev);
|
||||
LOSCFG_FS_FREE_HOOK(mp);
|
||||
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return LOS_OK;
|
||||
|
||||
errout:
|
||||
PRINT_ERR("umount2 failed, target %s.\n", target);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ int umount2(const char *target, int flag)
|
||||
const char *pathInMp = NULL;
|
||||
int ret = (int)LOS_NOK;
|
||||
|
||||
(void)LOS_FsLock();
|
||||
(void)VfsLock();
|
||||
if (target == NULL) {
|
||||
goto errout;
|
||||
}
|
||||
@@ -336,11 +336,11 @@ int umount2(const char *target, int flag)
|
||||
LOSCFG_FS_FREE_HOOK((void *)mp->mDev);
|
||||
LOSCFG_FS_FREE_HOOK(mp);
|
||||
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return LOS_OK;
|
||||
|
||||
errout:
|
||||
PRINT_ERR("umount2 failed, target %s.\n", target);
|
||||
LOS_FsUnlock();
|
||||
VfsUnlock();
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
@@ -52,6 +52,8 @@ extern "C" {
|
||||
extern UINT32 g_fsMutex;
|
||||
|
||||
int OsVfsInit(void);
|
||||
int VfsLock(void);
|
||||
void VfsUnlock(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user