Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
16950ecb
Commit
16950ecb
authored
Nov 19, 2009
by
Daniel Lezcano
Committed by
Daniel Lezcano
Nov 19, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change network_netdev function parameter
A mindless change to encapsulate a little more the function. Signed-off-by:
Daniel Lezcano
<
dlezcano@fr.ibm.com
>
parent
33c945e0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
12 deletions
+25
-12
confile.c
src/lxc/confile.c
+25
-12
No files found.
src/lxc/confile.c
View file @
16950ecb
...
@@ -146,20 +146,21 @@ static int config_ip_prefix(struct in_addr *addr)
...
@@ -146,20 +146,21 @@ static int config_ip_prefix(struct in_addr *addr)
return
0
;
return
0
;
}
}
static
struct
lxc_netdev
*
network_netdev
(
const
char
*
key
,
char
*
value
,
static
struct
lxc_netdev
*
network_netdev
(
const
char
*
key
,
c
onst
c
har
*
value
,
struct
lxc_
conf
*
lxc_conf
)
struct
lxc_
list
*
network
)
{
{
struct
lxc_list
*
network
=
&
lxc_conf
->
network
;
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
;
if
(
lxc_list_empty
(
network
))
{
if
(
lxc_list_empty
(
network
))
{
ERROR
(
"network is not created for '%s' option"
,
value
);
ERROR
(
"network is not created for '%s' = '%s' option"
,
key
,
value
);
return
NULL
;
return
NULL
;
}
}
netdev
=
lxc_list_first_elem
(
network
);
netdev
=
lxc_list_first_elem
(
network
);
if
(
!
netdev
)
{
if
(
!
netdev
)
{
ERROR
(
"no network defined for '%s' option"
,
value
);
ERROR
(
"no network device defined for '%s' = '%s' option"
,
key
,
value
);
return
NULL
;
return
NULL
;
}
}
...
@@ -174,6 +175,10 @@ static int network_ifname(char **valuep, char *value)
...
@@ -174,6 +175,10 @@ static int network_ifname(char **valuep, char *value)
}
}
*
valuep
=
strdup
(
value
);
*
valuep
=
strdup
(
value
);
if
(
!*
valuep
)
{
ERROR
(
"failed to dup string '%s'"
,
value
);
return
-
1
;
}
return
0
;
return
0
;
}
}
...
@@ -183,7 +188,7 @@ static int config_network_flags(const char *key, char *value,
...
@@ -183,7 +188,7 @@ static int config_network_flags(const char *key, char *value,
{
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
;
netdev
=
network_netdev
(
key
,
value
,
lxc_conf
);
netdev
=
network_netdev
(
key
,
value
,
&
lxc_conf
->
network
);
if
(
!
netdev
)
if
(
!
netdev
)
return
-
1
;
return
-
1
;
...
@@ -197,7 +202,7 @@ static int config_network_link(const char *key, char *value,
...
@@ -197,7 +202,7 @@ static int config_network_link(const char *key, char *value,
{
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
;
netdev
=
network_netdev
(
key
,
value
,
lxc_conf
);
netdev
=
network_netdev
(
key
,
value
,
&
lxc_conf
->
network
);
if
(
!
netdev
)
if
(
!
netdev
)
return
-
1
;
return
-
1
;
...
@@ -209,7 +214,7 @@ static int config_network_name(const char *key, char *value,
...
@@ -209,7 +214,7 @@ static int config_network_name(const char *key, char *value,
{
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
;
netdev
=
network_netdev
(
key
,
value
,
lxc_conf
);
netdev
=
network_netdev
(
key
,
value
,
&
lxc_conf
->
network
);
if
(
!
netdev
)
if
(
!
netdev
)
return
-
1
;
return
-
1
;
...
@@ -221,11 +226,15 @@ static int config_network_hwaddr(const char *key, char *value,
...
@@ -221,11 +226,15 @@ static int config_network_hwaddr(const char *key, char *value,
{
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
;
netdev
=
network_netdev
(
key
,
value
,
lxc_conf
);
netdev
=
network_netdev
(
key
,
value
,
&
lxc_conf
->
network
);
if
(
!
netdev
)
if
(
!
netdev
)
return
-
1
;
return
-
1
;
netdev
->
hwaddr
=
strdup
(
value
);
netdev
->
hwaddr
=
strdup
(
value
);
if
(
!
netdev
->
hwaddr
)
{
SYSERROR
(
"failed to dup string '%s'"
,
value
);
return
-
1
;
}
return
0
;
return
0
;
}
}
...
@@ -235,11 +244,15 @@ static int config_network_mtu(const char *key, char *value,
...
@@ -235,11 +244,15 @@ static int config_network_mtu(const char *key, char *value,
{
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
;
netdev
=
network_netdev
(
key
,
value
,
lxc_conf
);
netdev
=
network_netdev
(
key
,
value
,
&
lxc_conf
->
network
);
if
(
!
netdev
)
if
(
!
netdev
)
return
-
1
;
return
-
1
;
netdev
->
mtu
=
strdup
(
value
);
netdev
->
mtu
=
strdup
(
value
);
if
(
!
netdev
->
mtu
)
{
SYSERROR
(
"failed to dup string '%s'"
,
value
);
return
-
1
;
}
return
0
;
return
0
;
}
}
...
@@ -252,7 +265,7 @@ static int config_network_ipv4(const char *key, char *value,
...
@@ -252,7 +265,7 @@ static int config_network_ipv4(const char *key, char *value,
struct
lxc_list
*
list
;
struct
lxc_list
*
list
;
char
*
cursor
,
*
slash
,
*
addr
=
NULL
,
*
bcast
=
NULL
,
*
prefix
=
NULL
;
char
*
cursor
,
*
slash
,
*
addr
=
NULL
,
*
bcast
=
NULL
,
*
prefix
=
NULL
;
netdev
=
network_netdev
(
key
,
value
,
lxc_conf
);
netdev
=
network_netdev
(
key
,
value
,
&
lxc_conf
->
network
);
if
(
!
netdev
)
if
(
!
netdev
)
return
-
1
;
return
-
1
;
...
@@ -320,7 +333,7 @@ static int config_network_ipv6(const char *key, char *value, struct lxc_conf *lx
...
@@ -320,7 +333,7 @@ static int config_network_ipv6(const char *key, char *value, struct lxc_conf *lx
char
*
slash
;
char
*
slash
;
char
*
netmask
;
char
*
netmask
;
netdev
=
network_netdev
(
key
,
value
,
lxc_conf
);
netdev
=
network_netdev
(
key
,
value
,
&
lxc_conf
->
network
);
if
(
!
netdev
)
if
(
!
netdev
)
return
-
1
;
return
-
1
;
...
...
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