Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
214f44e9
K
Kernel Liteos A
项目概览
OpenHarmony
/
Kernel Liteos A
1 年多 前同步成功
通知
460
Star
414
Fork
55
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel Liteos A
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
214f44e9
编写于
9月 09, 2021
作者:
M
mucor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: syscall review bugfix
close: #149BPF Signed-off-by:
N
mucor
<
mucorwang@gmail.com
>
上级
19b39b1b
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
74 addition
and
26 deletion
+74
-26
fs/jffs2/src/vfs_jffs2.c
fs/jffs2/src/vfs_jffs2.c
+2
-5
fs/vfs/operation/vfs_procfd.c
fs/vfs/operation/vfs_procfd.c
+0
-4
fs/vfs/path_cache.c
fs/vfs/path_cache.c
+1
-0
syscall/fs_syscall.c
syscall/fs_syscall.c
+71
-17
未找到文件。
fs/jffs2/src/vfs_jffs2.c
浏览文件 @
214f44e9
...
...
@@ -686,7 +686,6 @@ int VfsJffs2Symlink(struct Vnode *parentVnode, struct Vnode **newVnode, const ch
ssize_t
VfsJffs2Readlink
(
struct
Vnode
*
vnode
,
char
*
buffer
,
size_t
bufLen
)
{
ssize_t
ret
=
0
;
struct
jffs2_inode
*
inode
=
NULL
;
struct
jffs2_inode_info
*
f
=
NULL
;
ssize_t
targetLen
;
...
...
@@ -705,14 +704,12 @@ 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
;
ret
=
-
EFAULT
;
LOS_MuxUnlock
(
&
g_jffs2FsLock
);
return
-
EFAULT
;
}
buffer
[
cnt
]
=
'\0'
;
LOS_MuxUnlock
(
&
g_jffs2FsLock
);
if
(
ret
<
0
)
{
return
ret
;
}
return
cnt
;
}
...
...
fs/vfs/operation/vfs_procfd.c
浏览文件 @
214f44e9
...
...
@@ -59,10 +59,6 @@ void FileTableUnLock(struct fd_table_s *fdt)
static
int
AssignProcessFd
(
const
struct
fd_table_s
*
fdt
,
int
minFd
)
{
if
(
fdt
==
NULL
)
{
return
VFS_ERROR
;
}
if
(
minFd
>=
fdt
->
max_fds
)
{
set_errno
(
EINVAL
);
return
VFS_ERROR
;
...
...
fs/vfs/path_cache.c
浏览文件 @
214f44e9
...
...
@@ -128,6 +128,7 @@ struct PathCache *PathCacheAlloc(struct Vnode *parent, struct Vnode *vnode, cons
ret
=
strncpy_s
(
pc
->
name
,
len
+
1
,
name
,
len
);
if
(
ret
!=
LOS_OK
)
{
free
(
pc
);
return
NULL
;
}
...
...
syscall/fs_syscall.c
浏览文件 @
214f44e9
...
...
@@ -450,8 +450,16 @@ OUT:
int
SysSymlink
(
const
char
*
target
,
const
char
*
linkpath
)
{
int
ret
;
char
*
targetRet
=
NULL
;
char
*
pathRet
=
NULL
;
if
(
target
!=
NULL
)
{
ret
=
UserPathCopy
(
target
,
&
targetRet
);
if
(
ret
!=
0
)
{
goto
OUT
;
}
}
if
(
linkpath
!=
NULL
)
{
ret
=
UserPathCopy
(
linkpath
,
&
pathRet
);
if
(
ret
!=
0
)
{
...
...
@@ -459,7 +467,7 @@ int SysSymlink(const char *target, const char *linkpath)
}
}
ret
=
symlink
(
target
,
pathRet
);
ret
=
symlink
(
target
Ret
,
pathRet
);
if
(
ret
<
0
)
{
ret
=
-
get_errno
();
}
...
...
@@ -468,6 +476,10 @@ OUT:
if
(
pathRet
!=
NULL
)
{
(
void
)
LOS_MemFree
(
OS_SYS_MEM_ADDR
,
pathRet
);
}
if
(
targetRet
!=
NULL
)
{
(
void
)
LOS_MemFree
(
OS_SYS_MEM_ADDR
,
targetRet
);
}
return
ret
;
}
...
...
@@ -606,6 +618,7 @@ int SysMount(const char *source, const char *target, const char *filesystemtype,
int
ret
;
char
*
sourceRet
=
NULL
;
char
*
targetRet
=
NULL
;
char
*
dataRet
=
NULL
;
char
fstypeRet
[
FILESYSTEM_TYPE_MAX
+
1
]
=
{
0
};
if
(
!
IsCapPermit
(
CAP_FS_MOUNT
))
{
...
...
@@ -642,7 +655,14 @@ int SysMount(const char *source, const char *target, const char *filesystemtype,
#endif
}
ret
=
mount
(
sourceRet
,
targetRet
,
(
filesystemtype
?
fstypeRet
:
NULL
),
mountflags
,
data
);
if
(
data
!=
NULL
)
{
ret
=
UserPathCopy
(
data
,
&
dataRet
);
if
(
ret
!=
0
)
{
goto
OUT
;
}
}
ret
=
mount
(
sourceRet
,
targetRet
,
(
filesystemtype
?
fstypeRet
:
NULL
),
mountflags
,
dataRet
);
if
(
ret
<
0
)
{
ret
=
-
get_errno
();
}
...
...
@@ -654,6 +674,9 @@ OUT:
if
(
targetRet
!=
NULL
)
{
(
void
)
LOS_MemFree
(
OS_SYS_MEM_ADDR
,
targetRet
);
}
if
(
dataRet
!=
NULL
)
{
(
void
)
LOS_MemFree
(
OS_SYS_MEM_ADDR
,
dataRet
);
}
return
ret
;
}
...
...
@@ -1327,9 +1350,12 @@ ssize_t SysReadv(int fd, const struct iovec *iov, int iovcnt)
/* Process fd convert to system global fd */
fd
=
GetAssociatedSystemFd
(
fd
);
if
((
iov
==
NULL
)
||
(
iovcnt
<=
0
)
||
(
iovcnt
>
IOV_MAX
))
{
ret
=
vfs_readv
(
fd
,
iov
,
iovcnt
,
NULL
);
return
-
get_errno
();
if
((
iov
==
NULL
)
||
(
iovcnt
<
0
)
||
(
iovcnt
>
IOV_MAX
))
{
return
-
EINVAL
;
}
if
(
iovcnt
==
0
)
{
return
0
;
}
ret
=
UserIovCopy
(
&
iovRet
,
iov
,
iovcnt
,
&
valid_iovcnt
);
...
...
@@ -1363,6 +1389,11 @@ ssize_t SysWritev(int fd, const struct iovec *iov, int iovcnt)
if
((
iovcnt
<
0
)
||
(
iovcnt
>
IOV_MAX
))
{
return
-
EINVAL
;
}
if
(
iovcnt
==
0
)
{
return
0
;
}
if
(
iov
==
NULL
)
{
return
-
EFAULT
;
}
...
...
@@ -1545,21 +1576,26 @@ char *SysGetcwd(char *buf, size_t n)
{
char
*
ret
=
NULL
;
char
*
bufRet
=
NULL
;
size_t
bufLen
=
n
;
int
retVal
;
bufRet
=
(
char
*
)
LOS_MemAlloc
(
OS_SYS_MEM_ADDR
,
n
);
if
(
bufLen
>
PATH_MAX
)
{
bufLen
=
PATH_MAX
;
}
bufRet
=
(
char
*
)
LOS_MemAlloc
(
OS_SYS_MEM_ADDR
,
bufLen
);
if
(
bufRet
==
NULL
)
{
return
(
char
*
)(
intptr_t
)
-
ENOMEM
;
}
(
void
)
memset_s
(
bufRet
,
n
,
0
,
n
);
(
void
)
memset_s
(
bufRet
,
bufLen
,
0
,
bufLe
n
);
ret
=
getcwd
((
buf
?
bufRet
:
NULL
),
n
);
ret
=
getcwd
((
buf
?
bufRet
:
NULL
),
bufLe
n
);
if
(
ret
==
NULL
)
{
(
void
)
LOS_MemFree
(
OS_SYS_MEM_ADDR
,
bufRet
);
return
(
char
*
)(
intptr_t
)
-
get_errno
();
}
retVal
=
LOS_ArchCopyToUser
(
buf
,
bufRet
,
n
);
retVal
=
LOS_ArchCopyToUser
(
buf
,
bufRet
,
bufLe
n
);
if
(
retVal
!=
0
)
{
(
void
)
LOS_MemFree
(
OS_SYS_MEM_ADDR
,
bufRet
);
return
(
char
*
)(
intptr_t
)
-
EFAULT
;
...
...
@@ -1749,6 +1785,14 @@ int SysSymlinkat(const char *target, int dirfd, const char *linkpath)
{
int
ret
;
char
*
pathRet
=
NULL
;
char
*
targetRet
=
NULL
;
if
(
target
!=
NULL
)
{
ret
=
UserPathCopy
(
target
,
&
targetRet
);
if
(
ret
!=
0
)
{
goto
OUT
;
}
}
if
(
linkpath
!=
NULL
)
{
ret
=
UserPathCopy
(
linkpath
,
&
pathRet
);
...
...
@@ -1762,7 +1806,7 @@ int SysSymlinkat(const char *target, int dirfd, const char *linkpath)
dirfd
=
GetAssociatedSystemFd
(
dirfd
);
}
ret
=
symlinkat
(
target
,
dirfd
,
pathRet
);
ret
=
symlinkat
(
target
Ret
,
dirfd
,
pathRet
);
if
(
ret
<
0
)
{
ret
=
-
get_errno
();
}
...
...
@@ -1771,6 +1815,10 @@ OUT:
if
(
pathRet
!=
NULL
)
{
(
void
)
LOS_MemFree
(
OS_SYS_MEM_ADDR
,
pathRet
);
}
if
(
targetRet
!=
NULL
)
{
(
void
)
LOS_MemFree
(
OS_SYS_MEM_ADDR
,
targetRet
);
}
return
ret
;
}
...
...
@@ -1924,9 +1972,12 @@ ssize_t SysPreadv(int fd, const struct iovec *iov, int iovcnt, long loffset, lon
/* Process fd convert to system global fd */
fd
=
GetAssociatedSystemFd
(
fd
);
if
((
iov
==
NULL
)
||
(
iovcnt
<=
0
)
||
(
iovcnt
>
IOV_MAX
))
{
ret
=
preadv
(
fd
,
iov
,
iovcnt
,
offsetflag
);
return
-
get_errno
();
if
((
iov
==
NULL
)
||
(
iovcnt
<
0
)
||
(
iovcnt
>
IOV_MAX
))
{
return
-
EINVAL
;
}
if
(
iovcnt
==
0
)
{
return
0
;
}
ret
=
UserIovCopy
(
&
iovRet
,
iov
,
iovcnt
,
&
valid_iovcnt
);
...
...
@@ -1959,9 +2010,12 @@ ssize_t SysPwritev(int fd, const struct iovec *iov, int iovcnt, long loffset, lo
/* Process fd convert to system global fd */
fd
=
GetAssociatedSystemFd
(
fd
);
if
((
iov
==
NULL
)
||
(
iovcnt
<=
0
)
||
(
iovcnt
>
IOV_MAX
))
{
ret
=
pwritev
(
fd
,
iov
,
iovcnt
,
offsetflag
);
return
-
get_errno
();
if
((
iov
==
NULL
)
||
(
iovcnt
<
0
)
||
(
iovcnt
>
IOV_MAX
))
{
return
-
EINVAL
;
}
if
(
iovcnt
==
0
)
{
return
0
;
}
ret
=
UserIovCopy
(
&
iovRet
,
iov
,
iovcnt
,
&
valid_iovcnt
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录