fix: fix the MS_REMOUNT support
The mount interface can't deal with MS_REMOUNT flag now, fix it. Signed-off-by: Far <yesiyuan2@huawei.com> Change-Id: Id0960c8d92ce767b8d8ef98b3ba2e1d1ab7db15d
This commit is contained in:
parent
527cec6e27
commit
64d15df9ea
|
@ -282,6 +282,12 @@ int FatfsMount(struct MountPoint *mp, unsigned long mountflags,
|
|||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
if (mountflags & MS_REMOUNT) {
|
||||
ret = Remount(mp, mountflags);
|
||||
FsUnlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *ldPath = GetLdPath(mp->mDev);
|
||||
if (ldPath == NULL) {
|
||||
errno = EFAULT;
|
||||
|
@ -289,11 +295,6 @@ int FatfsMount(struct MountPoint *mp, unsigned long mountflags,
|
|||
goto ERROUT;
|
||||
}
|
||||
|
||||
if (mountflags & MS_REMOUNT) {
|
||||
ret = Remount(mp, mountflags);
|
||||
goto ERROUT;
|
||||
}
|
||||
|
||||
fs = (FATFS *)malloc(sizeof(FATFS));
|
||||
if (fs == NULL) {
|
||||
errno = ENOMEM;
|
||||
|
|
|
@ -184,6 +184,12 @@ int LfsMount(struct MountPoint *mp, unsigned long mountflags, const void *data)
|
|||
goto errout;
|
||||
}
|
||||
|
||||
if (mountflags & MS_REMOUNT) {
|
||||
errno = ENOSYS;
|
||||
ret = (int)LOS_NOK;
|
||||
goto errout;
|
||||
}
|
||||
|
||||
mountHdl = (lfs_t *)malloc(sizeof(lfs_t) + sizeof(struct lfs_config));
|
||||
if (mountHdl == NULL) {
|
||||
errno = ENODEV;
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "vfs_config.h"
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
#include "errno.h"
|
||||
#include "vfs_operations.h"
|
||||
#include "los_compiler.h"
|
||||
#include "los_debug.h"
|
||||
|
@ -122,7 +123,7 @@ struct MountPoint *VfsMpFind(const char *path, const char **pathInMp)
|
|||
return bestMp;
|
||||
}
|
||||
|
||||
STATIC struct MountPoint *MountPointInit(const char *target, const char *fsType, unsigned long mountflags)
|
||||
STATIC struct MountPoint *VfsMountPointInit(const char *target, const char *fsType, unsigned long mountflags)
|
||||
{
|
||||
struct MountPoint *mp = NULL;
|
||||
const char *pathInMp = NULL;
|
||||
|
@ -155,6 +156,27 @@ STATIC struct MountPoint *MountPointInit(const char *target, const char *fsType,
|
|||
return mp;
|
||||
}
|
||||
|
||||
STATIC int VfsRemount(const char *source ,const char *target,
|
||||
const char *fsType, unsigned long mountflags,
|
||||
const void *data)
|
||||
{
|
||||
(VOID)source;
|
||||
(VOID)fsType;
|
||||
struct MountPoint *mp;
|
||||
|
||||
mp = VfsMpFind(target, NULL);
|
||||
if (mp == NULL) {
|
||||
errno = EINVAL;
|
||||
return (int)LOS_NOK;
|
||||
}
|
||||
|
||||
LOS_ASSERT(mp->mFs != NULL);
|
||||
LOS_ASSERT(mp->mFs->fsMops != NULL);
|
||||
LOS_ASSERT(mp->mFs->fsMops->mount != NULL);
|
||||
|
||||
return mp->mFs->fsMops->mount(mp, mountflags, data);
|
||||
}
|
||||
|
||||
int LOS_FsMount(const char *source, const char *target,
|
||||
const char *fsType, unsigned long mountflags,
|
||||
const void *data)
|
||||
|
@ -169,7 +191,13 @@ int LOS_FsMount(const char *source, const char *target,
|
|||
|
||||
(void)VfsLock();
|
||||
|
||||
mp = MountPointInit(target, fsType, mountflags);
|
||||
if (mountflags & MS_REMOUNT) {
|
||||
ret = VfsRemount(source, target, fsType, mountflags, data);
|
||||
VfsUnlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
mp = VfsMountPointInit(target, fsType, mountflags);
|
||||
if (mp == NULL) {
|
||||
VfsUnlock();
|
||||
return (int)LOS_NOK;
|
||||
|
|
Loading…
Reference in New Issue