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
f3aca94f
Unverified
Commit
f3aca94f
authored
Feb 24, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
error_utils: move error helper to separate header
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
976faade
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
37 deletions
+47
-37
Makefile.am
src/lxc/Makefile.am
+2
-0
cgfsng.c
src/lxc/cgroups/cgfsng.c
+1
-0
error_utils.h
src/lxc/error_utils.h
+43
-0
macro.h
src/lxc/macro.h
+0
-37
memory_utils.h
src/lxc/memory_utils.h
+1
-0
No files found.
src/lxc/Makefile.am
View file @
f3aca94f
...
@@ -18,6 +18,7 @@ noinst_HEADERS = api_extensions.h \
...
@@ -18,6 +18,7 @@ noinst_HEADERS = api_extensions.h \
confile_utils.h
\
confile_utils.h
\
criu.h
\
criu.h
\
error.h
\
error.h
\
error_utils.h
\
file_utils.h
\
file_utils.h
\
../include/netns_ifaddrs.h
\
../include/netns_ifaddrs.h
\
initutils.h
\
initutils.h
\
...
@@ -117,6 +118,7 @@ liblxc_la_SOURCES = af_unix.c af_unix.h \
...
@@ -117,6 +118,7 @@ liblxc_la_SOURCES = af_unix.c af_unix.h \
criu.c criu.h
\
criu.c criu.h
\
error.c error.h
\
error.c error.h
\
execute.c
\
execute.c
\
error_utils.h
\
freezer.c
\
freezer.c
\
file_utils.c file_utils.h
\
file_utils.c file_utils.h
\
../include/netns_ifaddrs.c ../include/netns_ifaddrs.h
\
../include/netns_ifaddrs.c ../include/netns_ifaddrs.h
\
...
...
src/lxc/cgroups/cgfsng.c
View file @
f3aca94f
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
#include "commands_utils.h"
#include "commands_utils.h"
#include "conf.h"
#include "conf.h"
#include "config.h"
#include "config.h"
#include "error_utils.h"
#include "log.h"
#include "log.h"
#include "macro.h"
#include "macro.h"
#include "mainloop.h"
#include "mainloop.h"
...
...
src/lxc/error_utils.h
0 → 100644
View file @
f3aca94f
/* SPDX-License-Identifier: LGPL-2.1+ */
#ifndef __LXC_ERROR_UTILS_H
#define __LXC_ERROR_UTILS_H
#define MAX_ERRNO 4095
#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
static
inline
void
*
ERR_PTR
(
long
error
)
{
return
(
void
*
)
error
;
}
static
inline
long
PTR_ERR
(
const
void
*
ptr
)
{
return
(
long
)
ptr
;
}
static
inline
long
IS_ERR
(
const
void
*
ptr
)
{
return
IS_ERR_VALUE
((
unsigned
long
)
ptr
);
}
static
inline
long
IS_ERR_OR_NULL
(
const
void
*
ptr
)
{
return
!
ptr
||
IS_ERR_VALUE
((
unsigned
long
)
ptr
);
}
static
inline
void
*
ERR_CAST
(
const
void
*
ptr
)
{
return
(
void
*
)
ptr
;
}
static
inline
int
PTR_RET
(
const
void
*
ptr
)
{
if
(
IS_ERR
(
ptr
))
return
PTR_ERR
(
ptr
);
else
return
0
;
}
#endif
/* __LXC_ERROR_UTILS_H */
src/lxc/macro.h
View file @
f3aca94f
...
@@ -672,43 +672,6 @@ enum {
...
@@ -672,43 +672,6 @@ enum {
(b) = __tmp; \
(b) = __tmp; \
} while (0)
} while (0)
#define MAX_ERRNO 4095
#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
static
inline
void
*
ERR_PTR
(
long
error
)
{
return
(
void
*
)
error
;
}
static
inline
long
PTR_ERR
(
const
void
*
ptr
)
{
return
(
long
)
ptr
;
}
static
inline
long
IS_ERR
(
const
void
*
ptr
)
{
return
IS_ERR_VALUE
((
unsigned
long
)
ptr
);
}
static
inline
long
IS_ERR_OR_NULL
(
const
void
*
ptr
)
{
return
!
ptr
||
IS_ERR_VALUE
((
unsigned
long
)
ptr
);
}
static
inline
void
*
ERR_CAST
(
const
void
*
ptr
)
{
return
(
void
*
)
ptr
;
}
static
inline
int
PTR_RET
(
const
void
*
ptr
)
{
if
(
IS_ERR
(
ptr
))
return
PTR_ERR
(
ptr
);
else
return
0
;
}
#define min(x, y) \
#define min(x, y) \
({ \
({ \
typeof(x) _min1 = (x); \
typeof(x) _min1 = (x); \
...
...
src/lxc/memory_utils.h
View file @
f3aca94f
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#include <unistd.h>
#include <unistd.h>
#include "macro.h"
#include "macro.h"
#include "error_utils.h"
#define define_cleanup_function(type, cleaner) \
#define define_cleanup_function(type, cleaner) \
static inline void cleaner##_function(type *ptr) \
static inline void cleaner##_function(type *ptr) \
...
...
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