Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
communication_ipc
提交
6266c469
C
communication_ipc
项目概览
OpenHarmony
/
communication_ipc
11 个月 前同步成功
通知
20
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
communication_ipc
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6266c469
编写于
12月 30, 2021
作者:
L
liubb_0516
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify coding style
Signed-off-by:
N
liubb_0516
<
liubeibei8@huawei.com
>
上级
17fd9fc5
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
29 addition
and
48 deletion
+29
-48
interfaces/innerkits/c/ipc/BUILD.gn
interfaces/innerkits/c/ipc/BUILD.gn
+1
-1
interfaces/innerkits/c/ipc/include/serializer.h
interfaces/innerkits/c/ipc/include/serializer.h
+1
-1
ipc/native/c/adapter/BUILD.gn
ipc/native/c/adapter/BUILD.gn
+1
-1
ipc/native/c/ipc/include/binder_invoker.h
ipc/native/c/ipc/include/binder_invoker.h
+1
-1
ipc/native/c/ipc/include/binder_types.h
ipc/native/c/ipc/include/binder_types.h
+1
-1
ipc/native/c/ipc/include/sys_binder.h
ipc/native/c/ipc/include/sys_binder.h
+1
-1
ipc/native/c/manager/src/serializer.c
ipc/native/c/manager/src/serializer.c
+23
-42
未找到文件。
interfaces/innerkits/c/ipc/BUILD.gn
浏览文件 @
6266c469
# Copyright (c) 202
0
Huawei Device Co., Ltd.
# Copyright (c) 202
1
Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
...
...
interfaces/innerkits/c/ipc/include/serializer.h
浏览文件 @
6266c469
/*
* Copyright (c) 202
0
Huawei Device Co., Ltd.
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
...
...
ipc/native/c/adapter/BUILD.gn
浏览文件 @
6266c469
# Copyright (c) 202
0
Huawei Device Co., Ltd.
# Copyright (c) 202
1
Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
...
...
ipc/native/c/ipc/include/binder_invoker.h
浏览文件 @
6266c469
/*
* Copyright (c) 202
0
Huawei Device Co., Ltd.
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
...
...
ipc/native/c/ipc/include/binder_types.h
浏览文件 @
6266c469
/*
* Copyright (c) 202
0
Huawei Device Co., Ltd.
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
...
...
ipc/native/c/ipc/include/sys_binder.h
浏览文件 @
6266c469
/*
* Copyright (c) 202
0
Huawei Device Co., Ltd.
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
...
...
ipc/native/c/manager/src/serializer.c
浏览文件 @
6266c469
/*
* Copyright (c) 202
0
Huawei Device Co., Ltd.
* Copyright (c) 202
1
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
...
...
@@ -13,6 +13,7 @@
* limitations under the License.
*/
#include "serializer.h"
#include <stdlib.h>
...
...
@@ -33,7 +34,7 @@
#define IPC_IO_RETURN_IF_FAIL(value) \
do
{
\
if
(
!
(
value
))
{
\
printf
(
"IPC_
ASSERT failed: %s:%d
\n
"
,
__FUNCTION__
,
__LINE__
);
\
printf
(
"IPC_
CHECK failed: %s:%d
\n
"
,
__FUNCTION__
,
__LINE__
);
\
if
(
io
!=
NULL
)
{
\
io
->
flag
|=
IPC_IO_OVERFLOW
;
\
}
\
...
...
@@ -42,7 +43,7 @@
}
while
(
0
)
void
IpcIoInit
(
IpcIo
*
io
,
void
*
buffer
,
size_t
bufferSize
,
size_t
maxobjects
)
void
IpcIoInit
(
IpcIo
*
io
,
void
*
buffer
,
size_t
bufferSize
,
size_t
maxobjects
)
{
if
((
io
==
NULL
)
||
(
buffer
==
NULL
)
||
(
bufferSize
==
0
)
||
(
bufferSize
>
MAX_IO_SIZE
)
||
(
maxobjects
>
MAX_OBJ_NUM
))
{
...
...
@@ -57,14 +58,14 @@ void IpcIoInit(IpcIo* io, void* buffer, size_t bufferSize, size_t maxobjects)
return
;
}
io
->
bufferCur
=
io
->
bufferBase
=
(
char
*
)
buffer
+
objectsSize
;
io
->
offsetsCur
=
io
->
offsetsBase
=
(
size_t
*
)
buffer
;
io
->
bufferCur
=
io
->
bufferBase
=
(
char
*
)
buffer
+
objectsSize
;
io
->
offsetsCur
=
io
->
offsetsBase
=
(
size_t
*
)
buffer
;
io
->
bufferLeft
=
bufferSize
-
objectsSize
;
io
->
offsetsLeft
=
maxobjects
;
io
->
flag
=
IPC_IO_INITIALIZED
;
}
static
bool
IpcIoAvailable
(
IpcIo
*
io
)
static
bool
IpcIoAvailable
(
IpcIo
*
io
)
{
bool
ret
=
false
;
if
(
io
!=
NULL
)
{
...
...
@@ -73,7 +74,7 @@ static bool IpcIoAvailable(IpcIo* io)
return
ret
;
}
static
void
*
IoPush
(
IpcIo
*
io
,
size_t
size
)
static
void
*
IoPush
(
IpcIo
*
io
,
size_t
size
)
{
IPC_IO_RETURN_IF_FAIL
(
io
!=
NULL
);
IPC_IO_RETURN_IF_FAIL
(
IpcIoAvailable
(
io
));
...
...
@@ -83,14 +84,14 @@ static void* IoPush(IpcIo* io, size_t size)
RPC_LOG_ERROR
(
"IoPush IPC_IO_OVERFLOW."
);
return
NULL
;
}
else
{
void
*
ptr
=
io
->
bufferCur
;
void
*
ptr
=
io
->
bufferCur
;
io
->
bufferCur
+=
size
;
io
->
bufferLeft
-=
size
;
return
ptr
;
}
}
static
void
*
IoPop
(
IpcIo
*
io
,
size_t
size
)
static
void
*
IoPop
(
IpcIo
*
io
,
size_t
size
)
{
IPC_IO_RETURN_IF_FAIL
(
io
!=
NULL
);
IPC_IO_RETURN_IF_FAIL
(
IpcIoAvailable
(
io
));
...
...
@@ -101,7 +102,7 @@ static void* IoPop(IpcIo* io, size_t size)
io
->
flag
|=
IPC_IO_OVERFLOW
;
return
NULL
;
}
else
{
void
*
ptr
=
io
->
bufferCur
;
void
*
ptr
=
io
->
bufferCur
;
io
->
bufferCur
+=
size
;
io
->
bufferLeft
-=
size
;
return
ptr
;
...
...
@@ -109,11 +110,11 @@ static void* IoPop(IpcIo* io, size_t size)
}
#ifdef __LINUX__
static
struct
flat_binder_object
*
IoPushBinderObj
(
IpcIo
*
io
)
static
struct
flat_binder_object
*
IoPushBinderObj
(
IpcIo
*
io
)
{
IPC_IO_RETURN_IF_FAIL
(
io
!=
NULL
);
IPC_IO_RETURN_IF_FAIL
(
io
->
offsetsCur
!=
NULL
);
struct
flat_binder_object
*
ptr
=
NULL
;
struct
flat_binder_object
*
ptr
=
NULL
;
ptr
=
IoPush
(
io
,
sizeof
(
struct
flat_binder_object
));
if
((
ptr
!=
NULL
)
&&
io
->
offsetsLeft
)
{
io
->
offsetsLeft
--
;
...
...
@@ -126,9 +127,9 @@ static struct flat_binder_object* IoPushBinderObj(IpcIo* io)
}
}
static
bool
IpcIoPushObject
(
IpcIo
*
io
,
uint32_t
token
,
uint32_t
cookie
)
static
bool
IpcIoPushObject
(
IpcIo
*
io
,
uint32_t
token
,
uint32_t
cookie
)
{
struct
flat_binder_object
*
ptr
=
IoPushBinderObj
(
io
);
struct
flat_binder_object
*
ptr
=
IoPushBinderObj
(
io
);
if
(
ptr
==
NULL
)
{
RPC_LOG_ERROR
(
"Io push object IPC_IO_OVERFLOW."
);
return
false
;
...
...
@@ -140,9 +141,9 @@ static bool IpcIoPushObject(IpcIo* io, uint32_t token, uint32_t cookie)
return
true
;
}
static
bool
IpcIoPushRef
(
IpcIo
*
io
,
uint32_t
handle
,
uint32_t
cookie
)
static
bool
IpcIoPushRef
(
IpcIo
*
io
,
uint32_t
handle
,
uint32_t
cookie
)
{
struct
flat_binder_object
*
ptr
=
IoPushBinderObj
(
io
);
struct
flat_binder_object
*
ptr
=
IoPushBinderObj
(
io
);
if
(
ptr
==
NULL
)
{
RPC_LOG_ERROR
(
"Io push ref IPC_IO_OVERFLOW."
);
return
false
;
...
...
@@ -154,7 +155,7 @@ static bool IpcIoPushRef(IpcIo* io, uint32_t handle, uint32_t cookie)
return
true
;
}
struct
flat_binder_object
*
IpcIoPopRef
(
IpcIo
*
io
)
struct
flat_binder_object
*
IpcIoPopRef
(
IpcIo
*
io
)
{
IPC_IO_RETURN_IF_FAIL
(
io
!=
NULL
);
IPC_IO_RETURN_IF_FAIL
(
io
->
offsetsCur
!=
NULL
);
...
...
@@ -162,7 +163,7 @@ struct flat_binder_object* IpcIoPopRef(IpcIo *io)
io
->
flag
|=
IPC_IO_OVERFLOW
;
return
NULL
;
}
struct
flat_binder_object
*
obj
=
(
struct
flat_binder_object
*
)
IoPop
(
io
,
sizeof
(
struct
flat_binder_object
));
struct
flat_binder_object
*
obj
=
(
struct
flat_binder_object
*
)
IoPop
(
io
,
sizeof
(
struct
flat_binder_object
));
if
(
obj
!=
NULL
)
{
io
->
offsetsCur
++
;
io
->
offsetsLeft
--
;
...
...
@@ -191,7 +192,7 @@ bool ReadRemoteObject(IpcIo *io, SvcIdentity *svc)
if
(
io
==
NULL
||
svc
==
NULL
)
{
return
false
;
}
struct
flat_binder_object
*
obj
=
IpcIoPopRef
(
io
);
struct
flat_binder_object
*
obj
=
IpcIoPopRef
(
io
);
if
(
obj
==
NULL
)
{
RPC_LOG_ERROR
(
"ReadRemoteObject failed: obj is null"
);
return
false
;
...
...
@@ -243,16 +244,6 @@ int32_t ReadFileDescriptor(IpcIo *io)
RPC_LOG_ERROR
(
"ReadFileDescriptor failed: type:%d"
,
obj
->
type
);
return
-
1
;
}
bool
IpcIoPushSvc
(
IpcIo
*
io
,
const
SvcIdentity
*
svc
)
{
return
false
;
}
bool
IpcIoPopSvc
(
IpcIo
*
io
,
SvcIdentity
*
svc
)
{
return
false
;
}
#else
bool
WriteRemoteObject
(
IpcIo
*
io
,
const
SvcIdentity
*
svc
)
{
...
...
@@ -261,33 +252,23 @@ bool WriteRemoteObject(IpcIo *io, const SvcIdentity *svc)
return
false
;
}
bool
WriteFileDescriptor
(
IpcIo
*
io
,
uint32_t
fd
)
bool
WriteFileDescriptor
(
IpcIo
*
io
,
uint32_t
fd
)
{
(
void
)
io
;
(
void
)
fd
;
return
false
;
}
bool
ReadRemoteObject
(
IpcIo
*
io
,
SvcIdentity
*
svc
)
bool
ReadRemoteObject
(
IpcIo
*
io
,
SvcIdentity
*
svc
)
{
(
void
)
io
;
(
void
)
svc
;
return
false
;
}
int32_t
ReadFileDescriptor
(
IpcIo
*
io
)
int32_t
ReadFileDescriptor
(
IpcIo
*
io
)
{
(
void
)
io
;
return
-
1
;
}
bool
IpcIoPushSvc
(
IpcIo
*
io
,
const
SvcIdentity
*
svc
)
{
return
;
}
bool
IpcIoPopSvc
(
IpcIo
*
io
,
SvcIdentity
*
svc
)
{
return
;
}
#endif
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录