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
f0ca2726
Commit
f0ca2726
authored
Dec 10, 2013
by
James Hunt
Committed by
Stéphane Graber
Dec 10, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make public API string method parameters const where possible.
Signed-off-by:
James Hunt
<
james.hunt@ubuntu.com
>
Acked-by:
Stéphane Graber
<
stgraber@ubuntu.com
>
parent
448e272d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
16 deletions
+17
-16
lxccontainer.c
src/lxc/lxccontainer.c
+11
-10
lxccontainer.h
src/lxc/lxccontainer.h
+6
-6
No files found.
src/lxc/lxccontainer.c
View file @
f0ca2726
...
@@ -68,7 +68,7 @@
...
@@ -68,7 +68,7 @@
lxc_log_define
(
lxc_container
,
lxc
);
lxc_log_define
(
lxc_container
,
lxc
);
static
bool
file_exists
(
char
*
f
)
static
bool
file_exists
(
c
onst
c
har
*
f
)
{
{
struct
stat
statbuf
;
struct
stat
statbuf
;
...
@@ -1565,7 +1565,7 @@ err:
...
@@ -1565,7 +1565,7 @@ err:
goto
out
;
goto
out
;
}
}
static
char
**
lxcapi_get_ips
(
struct
lxc_container
*
c
,
c
har
*
interface
,
char
*
family
,
int
scope
)
static
char
**
lxcapi_get_ips
(
struct
lxc_container
*
c
,
c
onst
char
*
interface
,
const
char
*
family
,
int
scope
)
{
{
int
i
,
count
=
0
;
int
i
,
count
=
0
;
struct
ifaddrs
*
interfaceArray
=
NULL
,
*
tempIfAddr
=
NULL
;
struct
ifaddrs
*
interfaceArray
=
NULL
,
*
tempIfAddr
=
NULL
;
...
@@ -2112,7 +2112,7 @@ const char *lxc_get_version(void)
...
@@ -2112,7 +2112,7 @@ const char *lxc_get_version(void)
return
LXC_VERSION
;
return
LXC_VERSION
;
}
}
static
int
copy_file
(
c
har
*
old
,
char
*
new
)
static
int
copy_file
(
c
onst
char
*
old
,
const
char
*
new
)
{
{
int
in
,
out
;
int
in
,
out
;
ssize_t
len
,
ret
;
ssize_t
len
,
ret
;
...
@@ -2640,7 +2640,7 @@ int get_next_index(const char *lxcpath, char *cname)
...
@@ -2640,7 +2640,7 @@ int get_next_index(const char *lxcpath, char *cname)
}
}
}
}
static
int
lxcapi_snapshot
(
struct
lxc_container
*
c
,
char
*
commentfile
)
static
int
lxcapi_snapshot
(
struct
lxc_container
*
c
,
c
onst
c
har
*
commentfile
)
{
{
int
i
,
flags
,
ret
;
int
i
,
flags
,
ret
;
struct
lxc_container
*
c2
;
struct
lxc_container
*
c2
;
...
@@ -2859,7 +2859,7 @@ out_free:
...
@@ -2859,7 +2859,7 @@ out_free:
return
-
1
;
return
-
1
;
}
}
static
bool
lxcapi_snapshot_restore
(
struct
lxc_container
*
c
,
c
har
*
snapname
,
char
*
newname
)
static
bool
lxcapi_snapshot_restore
(
struct
lxc_container
*
c
,
c
onst
char
*
snapname
,
const
char
*
newname
)
{
{
char
clonelxcpath
[
MAXPATHLEN
];
char
clonelxcpath
[
MAXPATHLEN
];
int
ret
;
int
ret
;
...
@@ -2910,7 +2910,7 @@ static bool lxcapi_snapshot_restore(struct lxc_container *c, char *snapname, cha
...
@@ -2910,7 +2910,7 @@ static bool lxcapi_snapshot_restore(struct lxc_container *c, char *snapname, cha
return
b
;
return
b
;
}
}
static
bool
lxcapi_snapshot_destroy
(
struct
lxc_container
*
c
,
char
*
snapname
)
static
bool
lxcapi_snapshot_destroy
(
struct
lxc_container
*
c
,
c
onst
c
har
*
snapname
)
{
{
int
ret
;
int
ret
;
char
clonelxcpath
[
MAXPATHLEN
];
char
clonelxcpath
[
MAXPATHLEN
];
...
@@ -2947,13 +2947,14 @@ static bool lxcapi_may_control(struct lxc_container *c)
...
@@ -2947,13 +2947,14 @@ static bool lxcapi_may_control(struct lxc_container *c)
return
lxc_try_cmd
(
c
->
name
,
c
->
config_path
)
==
0
;
return
lxc_try_cmd
(
c
->
name
,
c
->
config_path
)
==
0
;
}
}
static
bool
add_remove_device_node
(
struct
lxc_container
*
c
,
c
har
*
src_path
,
char
*
dest_path
,
bool
add
)
static
bool
add_remove_device_node
(
struct
lxc_container
*
c
,
c
onst
char
*
src_path
,
const
char
*
dest_path
,
bool
add
)
{
{
int
ret
;
int
ret
;
struct
stat
st
;
struct
stat
st
;
char
path
[
MAXPATHLEN
];
char
path
[
MAXPATHLEN
];
char
value
[
MAX_BUFFER
];
char
value
[
MAX_BUFFER
];
char
*
directory_path
=
NULL
,
*
p
;
char
*
directory_path
=
NULL
;
const
char
*
p
;
/* make sure container is running */
/* make sure container is running */
if
(
!
c
->
is_running
(
c
))
{
if
(
!
c
->
is_running
(
c
))
{
...
@@ -3032,12 +3033,12 @@ out:
...
@@ -3032,12 +3033,12 @@ out:
return
false
;
return
false
;
}
}
static
bool
lxcapi_add_device_node
(
struct
lxc_container
*
c
,
c
har
*
src_path
,
char
*
dest_path
)
static
bool
lxcapi_add_device_node
(
struct
lxc_container
*
c
,
c
onst
char
*
src_path
,
const
char
*
dest_path
)
{
{
return
add_remove_device_node
(
c
,
src_path
,
dest_path
,
true
);
return
add_remove_device_node
(
c
,
src_path
,
dest_path
,
true
);
}
}
static
bool
lxcapi_remove_device_node
(
struct
lxc_container
*
c
,
c
har
*
src_path
,
char
*
dest_path
)
static
bool
lxcapi_remove_device_node
(
struct
lxc_container
*
c
,
c
onst
char
*
src_path
,
const
char
*
dest_path
)
{
{
return
add_remove_device_node
(
c
,
src_path
,
dest_path
,
false
);
return
add_remove_device_node
(
c
,
src_path
,
dest_path
,
false
);
}
}
...
...
src/lxc/lxccontainer.h
View file @
f0ca2726
...
@@ -436,7 +436,7 @@ struct lxc_container {
...
@@ -436,7 +436,7 @@ struct lxc_container {
* \note The returned array is allocated, so the caller must free it.
* \note The returned array is allocated, so the caller must free it.
* \note The returned array is terminated with a \c NULL entry.
* \note The returned array is terminated with a \c NULL entry.
*/
*/
char
**
(
*
get_ips
)(
struct
lxc_container
*
c
,
c
har
*
interface
,
char
*
family
,
int
scope
);
char
**
(
*
get_ips
)(
struct
lxc_container
*
c
,
c
onst
char
*
interface
,
const
char
*
family
,
int
scope
);
/*!
/*!
* \brief Retrieve the specified cgroup subsystem value for the container.
* \brief Retrieve the specified cgroup subsystem value for the container.
...
@@ -628,7 +628,7 @@ struct lxc_container {
...
@@ -628,7 +628,7 @@ struct lxc_container {
*
*
* \note \p commentfile may be \c NULL but this is discouraged.
* \note \p commentfile may be \c NULL but this is discouraged.
*/
*/
int
(
*
snapshot
)(
struct
lxc_container
*
c
,
char
*
commentfile
);
int
(
*
snapshot
)(
struct
lxc_container
*
c
,
c
onst
c
har
*
commentfile
);
/*!
/*!
* \brief Obtain a list of container snapshots.
* \brief Obtain a list of container snapshots.
...
@@ -661,7 +661,7 @@ struct lxc_container {
...
@@ -661,7 +661,7 @@ struct lxc_container {
* (representing \c /var/lib/lxcsnaps/c1/snap0). If \p newname is \p c2,
* (representing \c /var/lib/lxcsnaps/c1/snap0). If \p newname is \p c2,
* then \c snap0 will be copied to \c /var/lib/lxc/c2.
* then \c snap0 will be copied to \c /var/lib/lxc/c2.
*/
*/
bool
(
*
snapshot_restore
)(
struct
lxc_container
*
c
,
c
har
*
snapname
,
char
*
newname
);
bool
(
*
snapshot_restore
)(
struct
lxc_container
*
c
,
c
onst
char
*
snapname
,
const
char
*
newname
);
/*!
/*!
* \brief Destroy the specified snapshot.
* \brief Destroy the specified snapshot.
...
@@ -671,7 +671,7 @@ struct lxc_container {
...
@@ -671,7 +671,7 @@ struct lxc_container {
*
*
* \return \c true on success, else \c false.
* \return \c true on success, else \c false.
*/
*/
bool
(
*
snapshot_destroy
)(
struct
lxc_container
*
c
,
char
*
snapname
);
bool
(
*
snapshot_destroy
)(
struct
lxc_container
*
c
,
c
onst
c
har
*
snapname
);
/*!
/*!
* \brief Determine if the caller may control the container.
* \brief Determine if the caller may control the container.
...
@@ -694,7 +694,7 @@ struct lxc_container {
...
@@ -694,7 +694,7 @@ struct lxc_container {
*
*
* \return \c true on success, else \c false.
* \return \c true on success, else \c false.
*/
*/
bool
(
*
add_device_node
)(
struct
lxc_container
*
c
,
c
har
*
src_path
,
char
*
dest_path
);
bool
(
*
add_device_node
)(
struct
lxc_container
*
c
,
c
onst
char
*
src_path
,
const
char
*
dest_path
);
/*!
/*!
* \brief Remove specified device from the container.
* \brief Remove specified device from the container.
...
@@ -706,7 +706,7 @@ struct lxc_container {
...
@@ -706,7 +706,7 @@ struct lxc_container {
*
*
* \return \c true on success, else \c false.
* \return \c true on success, else \c false.
*/
*/
bool
(
*
remove_device_node
)(
struct
lxc_container
*
c
,
c
har
*
src_path
,
char
*
dest_path
);
bool
(
*
remove_device_node
)(
struct
lxc_container
*
c
,
c
onst
char
*
src_path
,
const
char
*
dest_path
);
};
};
/*!
/*!
...
...
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