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
a9ff89ba
Unverified
Commit
a9ff89ba
authored
Jan 12, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: move lxc-autostart to API symbols only
Closes #2073. Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
a6993015
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
170 additions
and
3 deletions
+170
-3
lxc_autostart.c
src/lxc/tools/lxc_autostart.c
+3
-3
tool_list.h
src/lxc/tools/tool_list.h
+167
-0
No files found.
src/lxc/tools/lxc_autostart.c
View file @
a9ff89ba
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
...
@@ -26,8 +27,8 @@
...
@@ -26,8 +27,8 @@
#include <lxc/lxccontainer.h>
#include <lxc/lxccontainer.h>
#include "arguments.h"
#include "arguments.h"
#include "
log
.h"
#include "
tool_list
.h"
#include "utils.h"
#include "
tool_
utils.h"
static
struct
lxc_list
*
accumulate_list
(
char
*
input
,
char
*
delimiter
,
struct
lxc_list
*
str_list
);
static
struct
lxc_list
*
accumulate_list
(
char
*
input
,
char
*
delimiter
,
struct
lxc_list
*
str_list
);
...
@@ -355,7 +356,6 @@ int main(int argc, char *argv[])
...
@@ -355,7 +356,6 @@ int main(int argc, char *argv[])
if
(
lxc_log_init
(
&
log
))
if
(
lxc_log_init
(
&
log
))
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
lxc_log_options_no_override
();
/* REMOVE IN LXC 3.0 */
/* REMOVE IN LXC 3.0 */
setenv
(
"LXC_UPDATE_CONFIG_FORMAT"
,
"1"
,
0
);
setenv
(
"LXC_UPDATE_CONFIG_FORMAT"
,
"1"
,
0
);
...
...
src/lxc/tools/tool_list.h
0 → 100644
View file @
a9ff89ba
/*
* lxc: linux Container library
*
* (C) Copyright IBM Corp. 2007, 2008
*
* Authors:
* Daniel Lezcano <daniel.lezcano at free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __LXC_LIST_H
#define __LXC_LIST_H
#include <stdio.h>
struct
lxc_list
{
void
*
elem
;
struct
lxc_list
*
next
;
struct
lxc_list
*
prev
;
};
#define lxc_init_list(l) \
{ \
.next = l, .prev = l \
}
/*
* Iterate through an lxc list. An example for an idiom would be:
*
* struct lxc_list *iterator;
* lxc_list_for_each(iterator, list) {
* type *tmp;
* tmp = iterator->elem;
* }
*/
#define lxc_list_for_each(__iterator, __list) \
for (__iterator = (__list)->next; __iterator != __list; \
__iterator = __iterator->next)
/* Iterate safely through an lxc list. An example for an appropriate use case
* would be:
*
* struct lxc_list *cur, *next;
* lxc_list_for_each_safe(cur, list, next) {
* type *tmp;
* tmp = cur->elem;
* }
*/
#define lxc_list_for_each_safe(__iterator, __list, __next) \
for (__iterator = (__list)->next, __next = __iterator->next; \
__iterator != __list; __iterator = __next, __next = __next->next)
/* Initalize list. */
static
inline
void
lxc_list_init
(
struct
lxc_list
*
list
)
{
list
->
elem
=
NULL
;
list
->
next
=
list
->
prev
=
list
;
}
/* Add an element to a list. See lxc_list_add() and lxc_list_add_tail() for an
* idiom.
*/
static
inline
void
lxc_list_add_elem
(
struct
lxc_list
*
list
,
void
*
elem
)
{
list
->
elem
=
elem
;
}
/* Retrieve first element of list. */
static
inline
void
*
lxc_list_first_elem
(
struct
lxc_list
*
list
)
{
return
list
->
next
->
elem
;
}
/* Retrieve last element of list. */
static
inline
void
*
lxc_list_last_elem
(
struct
lxc_list
*
list
)
{
return
list
->
prev
->
elem
;
}
/* Determine if list is empty. */
static
inline
int
lxc_list_empty
(
struct
lxc_list
*
list
)
{
return
list
==
list
->
next
;
}
/* Workhorse to be called from lxc_list_add() and lxc_list_add_tail(). */
static
inline
void
__lxc_list_add
(
struct
lxc_list
*
new
,
struct
lxc_list
*
prev
,
struct
lxc_list
*
next
)
{
next
->
prev
=
new
;
new
->
next
=
next
;
new
->
prev
=
prev
;
prev
->
next
=
new
;
}
/* Idiom to add an element to the beginning of an lxc list:
*
* struct lxc_list *tmp = malloc(sizeof(*tmp));
* if (tmp == NULL)
* return 1;
* lxc_list_add_elem(tmp, elem);
* lxc_list_add(list, tmp);
*/
static
inline
void
lxc_list_add
(
struct
lxc_list
*
head
,
struct
lxc_list
*
list
)
{
__lxc_list_add
(
list
,
head
,
head
->
next
);
}
/* Idiom to add an element to the end of an lxc list:
*
* struct lxc_list *tmp = malloc(sizeof(*tmp));
* if (tmp == NULL)
* return 1;
* lxc_list_add_elem(tmp, elem);
* lxc_list_add_tail(list, tmp);
*/
static
inline
void
lxc_list_add_tail
(
struct
lxc_list
*
head
,
struct
lxc_list
*
list
)
{
__lxc_list_add
(
list
,
head
->
prev
,
head
);
}
/* Idiom to remove an element from a list:
* struct lxc_list *cur, *next;
* lxc_list_for_each_safe(cur, list, next) {
* lxc_list_del(cur);
* free(cur->elem);
* free(cur);
* }
*/
static
inline
void
lxc_list_del
(
struct
lxc_list
*
list
)
{
struct
lxc_list
*
next
,
*
prev
;
next
=
list
->
next
;
prev
=
list
->
prev
;
next
->
prev
=
prev
;
prev
->
next
=
next
;
}
/* Return length of the list. */
static
inline
size_t
lxc_list_len
(
struct
lxc_list
*
list
)
{
size_t
i
=
0
;
struct
lxc_list
*
iter
;
lxc_list_for_each
(
iter
,
list
)
{
i
++
;
}
return
i
;
}
#endif
/* __LXC_LIST_H */
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