Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PPSi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
PPSi
Commits
0dd8be02
Commit
0dd8be02
authored
Mar 05, 2013
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pp_net_path: remove inited field, ->init knows
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
a991e7e2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
17 deletions
+27
-17
posix-socket.c
arch-gnu-linux/posix-socket.c
+7
-0
wrpc-socket.c
arch-wrpc/wrpc-socket.c
+9
-6
ppsi.h
include/ppsi/ppsi.h
+0
-1
bare-socket.c
lib-bare/bare-socket.c
+10
-4
state-initializing.c
proto-standard/state-initializing.c
+1
-6
No files found.
arch-gnu-linux/posix-socket.c
View file @
0dd8be02
...
...
@@ -337,13 +337,20 @@ static int posix_open_ch(struct pp_instance *ppi, char *ifname, int chtype)
return
0
;
}
static
int
posix_net_exit
(
struct
pp_instance
*
ppi
);
/*
* Inits all the network stuff
*/
/* This function must be able to be called twice, and clean-up internally */
int
posix_net_init
(
struct
pp_instance
*
ppi
)
{
int
i
;
if
(
NP
(
ppi
)
->
ch
[
0
].
fd
)
posix_net_exit
(
ppi
);
/* The buffer is inside ppi, but we need to set pointers and align */
pp_prepare_pointers
(
ppi
);
...
...
arch-wrpc/wrpc-socket.c
View file @
0dd8be02
...
...
@@ -100,8 +100,17 @@ static int wrpc_net_send(struct pp_instance *ppi, void *pkt, int len,
return
snt
;
}
static
int
wrpc_net_exit
(
struct
pp_instance
*
ppi
)
{
ptpd_netif_close_socket
(
NP
(
ppi
)
->
ch
[
PP_NP_EVT
].
custom
);
return
0
;
}
/* This function must be able to be called twice, and clean-up internally */
static
int
wrpc_net_init
(
struct
pp_instance
*
ppi
)
{
if
(
NP
(
ppi
)
->
ch
[
PP_NP_EVT
].
custom
)
wrpc_net_exit
(
ppi
);
pp_prepare_pointers
(
ppi
);
wrpc_open_ch
(
ppi
);
...
...
@@ -109,12 +118,6 @@ static int wrpc_net_init(struct pp_instance *ppi)
}
static
int
wrpc_net_exit
(
struct
pp_instance
*
ppi
)
{
ptpd_netif_close_socket
(
NP
(
ppi
)
->
ch
[
PP_NP_EVT
].
custom
);
return
0
;
}
struct
pp_network_operations
wrpc_net_ops
=
{
.
init
=
wrpc_net_init
,
.
exit
=
wrpc_net_exit
,
...
...
include/ppsi/ppsi.h
View file @
0dd8be02
...
...
@@ -132,7 +132,6 @@ struct pp_net_path {
Integer32
mcast_addr
;
/* FIXME: only ipv4/udp */
int
ptp_offset
;
int
inited
;
};
/*
...
...
lib-bare/bare-socket.c
View file @
0dd8be02
...
...
@@ -118,8 +118,18 @@ static int bare_open_ch(struct pp_instance *ppi, char *ifname)
return
-
1
;
}
static
int
bare_net_exit
(
struct
pp_instance
*
ppi
)
{
return
sys_shutdown
(
NP
(
ppi
)
->
ch
[
PP_NP_GEN
].
fd
,
SHUT_RDWR
);
}
/* This function must be able to be called twice, and clean-up internally */
static
int
bare_net_init
(
struct
pp_instance
*
ppi
)
{
/* Here, socket may not be 0 (do we have stdin even if bare) */
if
(
NP
(
ppi
)
->
ch
[
PP_NP_GEN
].
fd
)
bare_net_exit
(
ppi
);
/* The buffer is inside ppi, but we need to set pointers and align */
pp_prepare_pointers
(
ppi
);
...
...
@@ -135,10 +145,6 @@ static int bare_net_init(struct pp_instance *ppi)
return
-
1
;
}
static
int
bare_net_exit
(
struct
pp_instance
*
ppi
)
{
return
sys_shutdown
(
NP
(
ppi
)
->
ch
[
PP_NP_GEN
].
fd
,
SHUT_RDWR
);
}
struct
pp_network_operations
bare_net_ops
=
{
.
init
=
bare_net_init
,
...
...
proto-standard/state-initializing.c
View file @
0dd8be02
...
...
@@ -18,14 +18,9 @@ int pp_initializing(struct pp_instance *ppi, unsigned char *pkt, int plen)
struct
pp_runtime_opts
*
opt
=
OPTS
(
ppi
);
int
ret
=
0
;
if
(
NP
(
ppi
)
->
inited
)
ppi
->
n_ops
->
exit
(
ppi
);
if
(
ppi
->
n_ops
->
init
(
ppi
)
<
0
)
if
(
ppi
->
n_ops
->
init
(
ppi
)
<
0
)
/* it must handle being called twice */
goto
failure
;
NP
(
ppi
)
->
inited
=
1
;
port
->
portState
=
PPS_INITIALIZING
;
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment