]>
Commit | Line | Data |
---|---|---|
0ad19a3f | 1 | /* |
2 | * lxc: linux Container library | |
3 | * | |
4 | * (C) Copyright IBM Corp. 2007, 2008 | |
5 | * | |
6 | * Authors: | |
9afe19d6 | 7 | * Daniel Lezcano <daniel.lezcano at free.fr> |
0ad19a3f | 8 | * |
9 | * This library is free software; you can redistribute it and/or | |
10 | * modify it under the terms of the GNU Lesser General Public | |
11 | * License as published by the Free Software Foundation; either | |
12 | * version 2.1 of the License, or (at your option) any later version. | |
13 | * | |
14 | * This library is distributed in the hope that it will be useful, | |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | * Lesser General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU Lesser General Public | |
20 | * License along with this library; if not, write to the Free Software | |
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 | */ | |
23 | #ifndef _utils_h | |
24 | #define _utils_h | |
25 | ||
c797a220 CS |
26 | #include <sys/types.h> |
27 | ||
6e4bb2e0 | 28 | extern int lxc_setup_fs(void); |
7c11d57a | 29 | extern int get_u16(unsigned short *val, const char *arg, int base); |
1b09f2c0 | 30 | extern int mkdir_p(const char *dir, mode_t mode); |
2a59a681 SH |
31 | /* |
32 | * Return a newly allocated buffer containing the default container | |
33 | * path. Caller must free this buffer. | |
34 | */ | |
67e571de | 35 | extern const char *default_lxc_path(void); |
31a95fec SH |
36 | extern const char *default_zfs_root(void); |
37 | extern const char *default_lvm_vg(void); | |
307cf2a6 | 38 | |
e51d4895 DE |
39 | /** |
40 | * BUILD_BUG_ON - break compile if a condition is true. | |
41 | * @condition: the condition which the compiler should know is false. | |
42 | * | |
43 | * If you have some code which relies on certain constants being equal, or | |
44 | * other compile-time-evaluated condition, you should use BUILD_BUG_ON to | |
45 | * detect if someone changes it. | |
46 | * | |
47 | * The implementation uses gcc's reluctance to create a negative array, but | |
48 | * gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments | |
49 | * to inline functions). So as a fallback we use the optimizer; if it can't | |
50 | * prove the condition is false, it will cause a link error on the undefined | |
51 | * "__build_bug_on_failed". This error message can be harder to track down | |
52 | * though, hence the two different methods. | |
53 | */ | |
54 | #ifndef __OPTIMIZE__ | |
55 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | |
56 | #else | |
57 | extern int __build_bug_on_failed; | |
58 | #define BUILD_BUG_ON(condition) \ | |
59 | do { \ | |
60 | ((void)sizeof(char[1 - 2*!!(condition)])); \ | |
61 | if (condition) __build_bug_on_failed = 1; \ | |
62 | } while(0) | |
63 | #endif | |
64 | ||
9be53773 SH |
65 | /* |
66 | * wait on a child we forked | |
67 | */ | |
68 | extern int wait_for_pid(pid_t pid); | |
c797a220 | 69 | extern int lxc_wait_for_pid_status(pid_t pid); |
9be53773 | 70 | |
307cf2a6 | 71 | #endif |