Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
5346c35e
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 大约 4 年
通知
14
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
5346c35e
编写于
5月 05, 2012
作者:
S
Sven Eckelmann
提交者:
Antonio Quartulli
6月 18, 2012
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
batman-adv: Return error codes instead of -1 on failures
Signed-off-by:
N
Sven Eckelmann
<
sven@narfation.org
>
上级
e0f5211f
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
58 addition
and
48 deletion
+58
-48
net/batman-adv/bat_debugfs.c
net/batman-adv/bat_debugfs.c
+7
-4
net/batman-adv/bat_iv_ogm.c
net/batman-adv/bat_iv_ogm.c
+1
-1
net/batman-adv/bat_sysfs.c
net/batman-adv/bat_sysfs.c
+1
-1
net/batman-adv/bridge_loop_avoidance.c
net/batman-adv/bridge_loop_avoidance.c
+3
-3
net/batman-adv/hard-interface.c
net/batman-adv/hard-interface.c
+1
-3
net/batman-adv/icmp_socket.c
net/batman-adv/icmp_socket.c
+2
-2
net/batman-adv/main.c
net/batman-adv/main.c
+16
-11
net/batman-adv/originator.c
net/batman-adv/originator.c
+9
-9
net/batman-adv/translation-table.c
net/batman-adv/translation-table.c
+14
-10
net/batman-adv/vis.c
net/batman-adv/vis.c
+4
-4
未找到文件。
net/batman-adv/bat_debugfs.c
浏览文件 @
5346c35e
...
...
@@ -195,13 +195,13 @@ static int debug_log_setup(struct bat_priv *bat_priv)
d
=
debugfs_create_file
(
"log"
,
S_IFREG
|
S_IRUSR
,
bat_priv
->
debug_dir
,
bat_priv
,
&
log_fops
);
if
(
d
)
if
(
!
d
)
goto
err
;
return
0
;
err:
return
1
;
return
-
ENOMEM
;
}
static
void
debug_log_cleanup
(
struct
bat_priv
*
bat_priv
)
...
...
@@ -348,8 +348,11 @@ int debugfs_add_meshif(struct net_device *dev)
if
(
!
bat_priv
->
debug_dir
)
goto
out
;
bat_socket_setup
(
bat_priv
);
debug_log_setup
(
bat_priv
);
if
(
bat_socket_setup
(
bat_priv
)
<
0
)
goto
rem_attr
;
if
(
debug_log_setup
(
bat_priv
)
<
0
)
goto
rem_attr
;
for
(
bat_debug
=
mesh_debuginfos
;
*
bat_debug
;
++
bat_debug
)
{
file
=
debugfs_create_file
(((
*
bat_debug
)
->
attr
).
name
,
...
...
net/batman-adv/bat_iv_ogm.c
浏览文件 @
5346c35e
...
...
@@ -60,7 +60,7 @@ static int bat_iv_ogm_iface_enable(struct hard_iface *hard_iface)
{
struct
batman_ogm_packet
*
batman_ogm_packet
;
uint32_t
random_seqno
;
int
res
=
-
1
;
int
res
=
-
ENOMEM
;
/* randomize initial seqno to avoid collision */
get_random_bytes
(
&
random_seqno
,
sizeof
(
random_seqno
));
...
...
net/batman-adv/bat_sysfs.c
浏览文件 @
5346c35e
...
...
@@ -680,7 +680,7 @@ void sysfs_del_hardif(struct kobject **hardif_obj)
int
throw_uevent
(
struct
bat_priv
*
bat_priv
,
enum
uev_type
type
,
enum
uev_action
action
,
const
char
*
data
)
{
int
ret
=
-
1
;
int
ret
=
-
ENOMEM
;
struct
hard_iface
*
primary_if
=
NULL
;
struct
kobject
*
bat_kobj
;
char
*
uevent_env
[
4
]
=
{
NULL
,
NULL
,
NULL
,
NULL
};
...
...
net/batman-adv/bridge_loop_avoidance.c
浏览文件 @
5346c35e
...
...
@@ -1164,13 +1164,13 @@ int bla_init(struct bat_priv *bat_priv)
bat_priv
->
bcast_duplist_curr
=
0
;
if
(
bat_priv
->
claim_hash
)
return
1
;
return
0
;
bat_priv
->
claim_hash
=
hash_new
(
128
);
bat_priv
->
backbone_hash
=
hash_new
(
32
);
if
(
!
bat_priv
->
claim_hash
||
!
bat_priv
->
backbone_hash
)
return
-
1
;
return
-
ENOMEM
;
batadv_hash_set_lock_class
(
bat_priv
->
claim_hash
,
&
claim_hash_lock_class_key
);
...
...
@@ -1180,7 +1180,7 @@ int bla_init(struct bat_priv *bat_priv)
bat_dbg
(
DBG_BLA
,
bat_priv
,
"bla hashes initialized
\n
"
);
bla_start_timer
(
bat_priv
);
return
1
;
return
0
;
}
/**
...
...
net/batman-adv/hard-interface.c
浏览文件 @
5346c35e
...
...
@@ -306,10 +306,8 @@ int hardif_enable_interface(struct hard_iface *hard_iface,
bat_priv
=
netdev_priv
(
hard_iface
->
soft_iface
);
ret
=
bat_priv
->
bat_algo_ops
->
bat_iface_enable
(
hard_iface
);
if
(
ret
<
0
)
{
ret
=
-
ENOMEM
;
if
(
ret
<
0
)
goto
err_dev
;
}
hard_iface
->
if_num
=
bat_priv
->
num_ifaces
;
bat_priv
->
num_ifaces
++
;
...
...
net/batman-adv/icmp_socket.c
浏览文件 @
5346c35e
...
...
@@ -285,13 +285,13 @@ int bat_socket_setup(struct bat_priv *bat_priv)
d
=
debugfs_create_file
(
ICMP_SOCKET
,
S_IFREG
|
S_IWUSR
|
S_IRUSR
,
bat_priv
->
debug_dir
,
bat_priv
,
&
fops
);
if
(
d
)
if
(
!
d
)
goto
err
;
return
0
;
err:
return
1
;
return
-
ENOMEM
;
}
static
void
bat_socket_add_packet
(
struct
socket_client
*
socket_client
,
...
...
net/batman-adv/main.c
浏览文件 @
5346c35e
...
...
@@ -92,6 +92,7 @@ static void __exit batman_exit(void)
int
mesh_init
(
struct
net_device
*
soft_iface
)
{
struct
bat_priv
*
bat_priv
=
netdev_priv
(
soft_iface
);
int
ret
;
spin_lock_init
(
&
bat_priv
->
forw_bat_list_lock
);
spin_lock_init
(
&
bat_priv
->
forw_bcast_list_lock
);
...
...
@@ -110,30 +111,32 @@ int mesh_init(struct net_device *soft_iface)
INIT_LIST_HEAD
(
&
bat_priv
->
tt_req_list
);
INIT_LIST_HEAD
(
&
bat_priv
->
tt_roam_list
);
if
(
originator_init
(
bat_priv
)
<
1
)
ret
=
originator_init
(
bat_priv
);
if
(
ret
<
0
)
goto
err
;
if
(
tt_init
(
bat_priv
)
<
1
)
ret
=
tt_init
(
bat_priv
);
if
(
ret
<
0
)
goto
err
;
tt_local_add
(
soft_iface
,
soft_iface
->
dev_addr
,
NULL_IFINDEX
);
if
(
vis_init
(
bat_priv
)
<
1
)
ret
=
vis_init
(
bat_priv
);
if
(
ret
<
0
)
goto
err
;
if
(
bla_init
(
bat_priv
)
<
1
)
ret
=
bla_init
(
bat_priv
);
if
(
ret
<
0
)
goto
err
;
atomic_set
(
&
bat_priv
->
gw_reselect
,
0
);
atomic_set
(
&
bat_priv
->
mesh_state
,
MESH_ACTIVE
);
goto
end
;
return
0
;
err:
mesh_free
(
soft_iface
);
return
-
1
;
end:
return
0
;
return
ret
;
}
void
mesh_free
(
struct
net_device
*
soft_iface
)
...
...
@@ -319,12 +322,13 @@ static struct bat_algo_ops *bat_algo_get(char *name)
int
bat_algo_register
(
struct
bat_algo_ops
*
bat_algo_ops
)
{
struct
bat_algo_ops
*
bat_algo_ops_tmp
;
int
ret
=
-
1
;
int
ret
;
bat_algo_ops_tmp
=
bat_algo_get
(
bat_algo_ops
->
name
);
if
(
bat_algo_ops_tmp
)
{
pr_info
(
"Trying to register already registered routing algorithm: %s
\n
"
,
bat_algo_ops
->
name
);
ret
=
-
EEXIST
;
goto
out
;
}
...
...
@@ -337,6 +341,7 @@ int bat_algo_register(struct bat_algo_ops *bat_algo_ops)
!
bat_algo_ops
->
bat_ogm_emit
)
{
pr_info
(
"Routing algo '%s' does not implement required ops
\n
"
,
bat_algo_ops
->
name
);
ret
=
-
EINVAL
;
goto
out
;
}
...
...
@@ -351,7 +356,7 @@ int bat_algo_register(struct bat_algo_ops *bat_algo_ops)
int
bat_algo_select
(
struct
bat_priv
*
bat_priv
,
char
*
name
)
{
struct
bat_algo_ops
*
bat_algo_ops
;
int
ret
=
-
1
;
int
ret
=
-
EINVAL
;
bat_algo_ops
=
bat_algo_get
(
name
);
if
(
!
bat_algo_ops
)
...
...
net/batman-adv/originator.c
浏览文件 @
5346c35e
...
...
@@ -50,7 +50,7 @@ static int compare_orig(const struct hlist_node *node, const void *data2)
int
originator_init
(
struct
bat_priv
*
bat_priv
)
{
if
(
bat_priv
->
orig_hash
)
return
1
;
return
0
;
bat_priv
->
orig_hash
=
hash_new
(
1024
);
...
...
@@ -58,10 +58,10 @@ int originator_init(struct bat_priv *bat_priv)
goto
err
;
start_purge_timer
(
bat_priv
);
return
1
;
return
0
;
err:
return
0
;
return
-
ENOMEM
;
}
void
neigh_node_free_ref
(
struct
neigh_node
*
neigh_node
)
...
...
@@ -488,7 +488,7 @@ static int orig_node_add_if(struct orig_node *orig_node, int max_if_num)
data_ptr
=
kmalloc
(
max_if_num
*
sizeof
(
unsigned
long
)
*
NUM_WORDS
,
GFP_ATOMIC
);
if
(
!
data_ptr
)
return
-
1
;
return
-
ENOMEM
;
memcpy
(
data_ptr
,
orig_node
->
bcast_own
,
(
max_if_num
-
1
)
*
sizeof
(
unsigned
long
)
*
NUM_WORDS
);
...
...
@@ -497,7 +497,7 @@ static int orig_node_add_if(struct orig_node *orig_node, int max_if_num)
data_ptr
=
kmalloc
(
max_if_num
*
sizeof
(
uint8_t
),
GFP_ATOMIC
);
if
(
!
data_ptr
)
return
-
1
;
return
-
ENOMEM
;
memcpy
(
data_ptr
,
orig_node
->
bcast_own_sum
,
(
max_if_num
-
1
)
*
sizeof
(
uint8_t
));
...
...
@@ -528,7 +528,7 @@ int orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num)
ret
=
orig_node_add_if
(
orig_node
,
max_if_num
);
spin_unlock_bh
(
&
orig_node
->
ogm_cnt_lock
);
if
(
ret
==
-
1
)
if
(
ret
==
-
ENOMEM
)
goto
err
;
}
rcu_read_unlock
();
...
...
@@ -554,7 +554,7 @@ static int orig_node_del_if(struct orig_node *orig_node,
chunk_size
=
sizeof
(
unsigned
long
)
*
NUM_WORDS
;
data_ptr
=
kmalloc
(
max_if_num
*
chunk_size
,
GFP_ATOMIC
);
if
(
!
data_ptr
)
return
-
1
;
return
-
ENOMEM
;
/* copy first part */
memcpy
(
data_ptr
,
orig_node
->
bcast_own
,
del_if_num
*
chunk_size
);
...
...
@@ -573,7 +573,7 @@ static int orig_node_del_if(struct orig_node *orig_node,
data_ptr
=
kmalloc
(
max_if_num
*
sizeof
(
uint8_t
),
GFP_ATOMIC
);
if
(
!
data_ptr
)
return
-
1
;
return
-
ENOMEM
;
memcpy
(
data_ptr
,
orig_node
->
bcast_own_sum
,
del_if_num
*
sizeof
(
uint8_t
));
...
...
@@ -612,7 +612,7 @@ int orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num)
hard_iface
->
if_num
);
spin_unlock_bh
(
&
orig_node
->
ogm_cnt_lock
);
if
(
ret
==
-
1
)
if
(
ret
==
-
ENOMEM
)
goto
err
;
}
rcu_read_unlock
();
...
...
net/batman-adv/translation-table.c
浏览文件 @
5346c35e
...
...
@@ -181,14 +181,14 @@ int tt_len(int changes_num)
static
int
tt_local_init
(
struct
bat_priv
*
bat_priv
)
{
if
(
bat_priv
->
tt_local_hash
)
return
1
;
return
0
;
bat_priv
->
tt_local_hash
=
hash_new
(
1024
);
if
(
!
bat_priv
->
tt_local_hash
)
return
0
;
return
-
ENOMEM
;
return
1
;
return
0
;
}
void
tt_local_add
(
struct
net_device
*
soft_iface
,
const
uint8_t
*
addr
,
...
...
@@ -491,14 +491,14 @@ static void tt_local_table_free(struct bat_priv *bat_priv)
static
int
tt_global_init
(
struct
bat_priv
*
bat_priv
)
{
if
(
bat_priv
->
tt_global_hash
)
return
1
;
return
0
;
bat_priv
->
tt_global_hash
=
hash_new
(
1024
);
if
(
!
bat_priv
->
tt_global_hash
)
return
0
;
return
-
ENOMEM
;
return
1
;
return
0
;
}
static
void
tt_changes_list_free
(
struct
bat_priv
*
bat_priv
)
...
...
@@ -1773,11 +1773,15 @@ void handle_tt_response(struct bat_priv *bat_priv,
int
tt_init
(
struct
bat_priv
*
bat_priv
)
{
if
(
!
tt_local_init
(
bat_priv
))
return
0
;
int
ret
;
if
(
!
tt_global_init
(
bat_priv
))
return
0
;
ret
=
tt_local_init
(
bat_priv
);
if
(
ret
<
0
)
return
ret
;
ret
=
tt_global_init
(
bat_priv
);
if
(
ret
<
0
)
return
ret
;
tt_start_timer
(
bat_priv
);
...
...
net/batman-adv/vis.c
浏览文件 @
5346c35e
...
...
@@ -626,7 +626,7 @@ static int generate_vis_packet(struct bat_priv *bat_priv)
best_tq
=
find_best_vis_server
(
bat_priv
,
info
);
if
(
best_tq
<
0
)
return
-
1
;
return
best_tq
;
}
for
(
i
=
0
;
i
<
hash
->
size
;
i
++
)
{
...
...
@@ -878,7 +878,7 @@ int vis_init(struct bat_priv *bat_priv)
int
hash_added
;
if
(
bat_priv
->
vis_hash
)
return
1
;
return
0
;
spin_lock_bh
(
&
bat_priv
->
vis_hash_lock
);
...
...
@@ -929,7 +929,7 @@ int vis_init(struct bat_priv *bat_priv)
spin_unlock_bh
(
&
bat_priv
->
vis_hash_lock
);
start_vis_timer
(
bat_priv
);
return
1
;
return
0
;
free_info:
kfree
(
bat_priv
->
my_vis_info
);
...
...
@@ -937,7 +937,7 @@ int vis_init(struct bat_priv *bat_priv)
err:
spin_unlock_bh
(
&
bat_priv
->
vis_hash_lock
);
vis_quit
(
bat_priv
);
return
0
;
return
-
ENOMEM
;
}
/* Decrease the reference count on a hash item info */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录