LXC
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
src
lxc
lxccontainer.h
Go to the documentation of this file.
1
23
#ifndef __LXC_CONTAINER_H
24
#define __LXC_CONTAINER_H
25
#include <malloc.h>
26
#include <semaphore.h>
27
#include <stdbool.h>
28
#include <stdlib.h>
29
#include <stdint.h>
30
31
#include <
lxc/attach_options.h
>
32
33
#ifdef __cplusplus
34
extern
"C"
{
35
#endif
36
37
#define LXC_CLONE_KEEPNAME (1 << 0)
38
#define LXC_CLONE_KEEPMACADDR (1 << 1)
39
#define LXC_CLONE_SNAPSHOT (1 << 2)
40
#define LXC_CLONE_KEEPBDEVTYPE (1 << 3)
41
#define LXC_CLONE_MAYBE_SNAPSHOT (1 << 4)
42
#define LXC_CLONE_MAXFLAGS (1 << 5)
43
#define LXC_CREATE_QUIET (1 << 0)
44
#define LXC_CREATE_MAXFLAGS (1 << 1)
46
struct bdev_specs;
47
48
struct
lxc_snapshot
;
49
50
struct
lxc_lock
;
51
55
struct
lxc_container
{
56
// private fields
61
char
*name;
62
67
char
*configfile;
68
73
char
*pidfile;
74
79
struct
lxc_lock
*slock;
80
85
struct
lxc_lock
*privlock;
86
92
int
numthreads;
93
100
struct
lxc_conf *lxc_conf;
101
102
// public fields
104
char
*
error_string
;
105
107
int
error_num
;
108
110
bool
daemonize
;
111
113
char
*
config_path
;
114
122
bool (*
is_defined
)(
struct
lxc_container
*c);
123
133
const
char
*(*state)(
struct
lxc_container
*c);
134
142
bool (*
is_running
)(
struct
lxc_container
*c);
143
151
bool (*
freeze
)(
struct
lxc_container
*c);
152
160
bool (*
unfreeze
)(
struct
lxc_container
*c);
161
170
pid_t (*
init_pid
)(
struct
lxc_container
*c);
171
181
bool (*
load_config
)(
struct
lxc_container
*c,
const
char
*alt_file);
182
192
bool (*
start
)(
struct
lxc_container
*c,
int
useinit,
char
*
const
argv[]);
193
207
bool (*
startl
)(
struct
lxc_container
*c,
int
useinit, ...);
208
216
bool (*
stop
)(
struct
lxc_container
*c);
217
227
bool (*
want_daemonize
)(
struct
lxc_container
*c,
bool
state
);
228
239
bool (*
want_close_all_fds
)(
struct
lxc_container
*c,
bool
state
);
240
250
char
*(*config_file_name)(
struct
lxc_container
*c);
251
264
bool (*
wait
)(
struct
lxc_container
*c,
const
char
*
state
,
int
timeout);
265
275
bool (*
set_config_item
)(
struct
lxc_container
*c,
const
char
*key,
const
char
*value);
276
286
bool (*
destroy
)(
struct
lxc_container
*c);
287
296
bool (*
save_config
)(
struct
lxc_container
*c,
const
char
*alt_file);
297
315
bool (*
create
)(
struct
lxc_container
*c,
const
char
*t,
const
char
*bdevtype,
316
struct
bdev_specs
*specs,
int
flags,
char
*
const
argv[]);
317
338
bool (*
createl
)(
struct
lxc_container
*c,
const
char
*t,
const
char
*bdevtype,
339
struct
bdev_specs
*specs,
int
flags, ...);
340
349
bool (*
rename
)(
struct
lxc_container
*c,
const
char
*newname);
350
358
bool (*
reboot
)(
struct
lxc_container
*c);
359
370
bool (*
shutdown
)(
struct
lxc_container
*c,
int
timeout);
371
377
void (*
clear_config
)(
struct
lxc_container
*c);
378
389
bool (*
clear_config_item
)(
struct
lxc_container
*c,
const
char
*key);
390
409
int (*
get_config_item
)(
struct
lxc_container
*c,
const
char
*key,
char
*retv,
int
inlen);
410
411
422
char
* (*get_running_config_item)(
struct
lxc_container
*c,
const
char
*key);
423
445
int (*
get_keys
)(
struct
lxc_container
*c,
const
char
*key,
char
*retv,
int
inlen);
446
457
char
** (*get_interfaces)(
struct
lxc_container
*c);
458
473
char
** (*get_ips)(
struct
lxc_container
*c,
const
char
* interface,
const
char
* family,
int
scope);
474
490
int (*
get_cgroup_item
)(
struct
lxc_container
*c,
const
char
*subsys,
char
*retv,
int
inlen);
491
501
bool (*
set_cgroup_item
)(
struct
lxc_container
*c,
const
char
*subsys,
const
char
*value);
502
519
const
char
*(*get_config_path)(
struct
lxc_container
*c);
520
530
bool (*
set_config_path
)(
struct
lxc_container
*c,
const
char
*path);
531
562
struct
lxc_container
*(*clone)(
struct
lxc_container
*c,
const
char
*newname,
563
const
char
*lxcpath,
int
flags,
const
char
*bdevtype,
564
const
char
*bdevdata, uint64_t newsize,
char
**hookargs);
565
584
int (*
console_getfd
)(
struct
lxc_container
*c,
int
*ttynum,
int
*masterfd);
585
603
int (*
console
)(
struct
lxc_container
*c,
int
ttynum,
604
int
stdinfd,
int
stdoutfd,
int
stderrfd,
int
escape);
605
619
int (*
attach
)(
struct
lxc_container
*c,
lxc_attach_exec_t
exec_function,
620
void
*exec_payload,
lxc_attach_options_t
*options, pid_t *attached_process);
621
633
int (*
attach_run_wait
)(
struct
lxc_container
*c,
lxc_attach_options_t
*options,
const
char
*program,
const
char
*
const
argv[]);
634
646
int (*
attach_run_waitl
)(
struct
lxc_container
*c,
lxc_attach_options_t
*options,
const
char
*program,
const
char
*arg, ...);
647
664
int (*
snapshot
)(
struct
lxc_container
*c,
const
char
*commentfile);
665
678
int (*
snapshot_list
)(
struct
lxc_container
*c,
struct
lxc_snapshot
**snapshots);
679
697
bool (*
snapshot_restore
)(
struct
lxc_container
*c,
const
char
*snapname,
const
char
*newname);
698
707
bool (*
snapshot_destroy
)(
struct
lxc_container
*c,
const
char
*snapname);
708
718
bool (*
may_control
)(
struct
lxc_container
*c);
719
730
bool (*
add_device_node
)(
struct
lxc_container
*c,
const
char
*src_path,
const
char
*dest_path);
731
742
bool (*
remove_device_node
)(
struct
lxc_container
*c,
const
char
*src_path,
const
char
*dest_path);
743
};
744
748
struct
lxc_snapshot
{
749
char
*
name
;
750
char
*
comment_pathname
;
751
char
*
timestamp
;
752
char
*
lxcpath
;
758
void (*
free
)(
struct
lxc_snapshot
*s);
759
};
760
761
765
struct
bdev_specs
{
766
char
*
fstype
;
767
uint64_t
fssize
;
768
struct
{
769
char
*
zfsroot
;
770
} zfs;
771
struct
{
772
char
*
vg
;
773
char
*
lv
;
774
char
*
thinpool
;
775
} lvm;
776
char
*
dir
;
777
};
778
787
struct
lxc_container
*
lxc_container_new
(
const
char
*name,
const
char
*configpath);
788
796
int
lxc_container_get
(
struct
lxc_container
*c);
797
808
int
lxc_container_put
(
struct
lxc_container
*c);
809
822
int
lxc_get_wait_states
(
const
char
**states);
823
831
const
char
*
lxc_get_global_config_item
(
const
char
*key);
832
839
const
char
*
lxc_get_version
(
void
);
840
852
int
list_defined_containers
(
const
char
*lxcpath,
char
***names,
struct
lxc_container
***cret);
853
868
int
list_active_containers
(
const
char
*lxcpath,
char
***names,
struct
lxc_container
***cret);
869
884
int
list_all_containers
(
const
char
*lxcpath,
char
***names,
struct
lxc_container
***cret);
885
889
void
lxc_log_close
(
void
);
890
891
#ifdef __cplusplus
892
}
893
#endif
894
895
#endif
Generated on Wed Dec 23 2015 04:20:50 for LXC by
1.8.1.2