mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
criu: get rid of config-base.h
It contained definitions for F_{SET,GET}PIPE_SZ, which
we already have in "fcntl.h" - it's not big, can be included instead.
Also it has pipe-size specific definitions, which are used only
in page-pipe.c -- moved them to page-pipe.h.
This will simplify include for config.h from subprojects.
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
ab115f7e36
commit
b76b52795c
7 changed files with 31 additions and 54 deletions
|
|
@ -28,19 +28,12 @@ ifeq ($$(call try-cc,$$(FEATURE_TEST_$(1)),$$(LIBS_FEATURES),$$(DEFINES)),true)
|
|||
endif
|
||||
endef
|
||||
|
||||
CONFIG_BASE := $(SRC_DIR)/criu/include/config-base.h
|
||||
|
||||
$(CONFIG_BASE):
|
||||
@true
|
||||
|
||||
define config-header-rule
|
||||
$(CONFIG_HEADER): $(CONFIG_BASE)
|
||||
$(CONFIG_HEADER): $(SRC_DIR)/scripts/feature-tests.mak
|
||||
$$(call msg-gen, $$@)
|
||||
$(Q) @echo '#ifndef __CR_CONFIG_H__' > $$@
|
||||
$(Q) @echo '#define __CR_CONFIG_H__' >> $$@
|
||||
$(Q) @echo '' >> $$@
|
||||
$(Q) @echo '#include "config-base.h"' >> $$@
|
||||
$(Q) @echo '' >> $$@
|
||||
$(call map,gen-feature-test,$(FEATURES_LIST))
|
||||
ifeq ($$(VDSO),y)
|
||||
$(Q) @echo '#define CONFIG_VDSO' >> $$@
|
||||
|
|
@ -54,5 +47,3 @@ endif
|
|||
endef
|
||||
|
||||
$(eval $(config-header-rule))
|
||||
|
||||
$(CONFIG_HEADER): $(SRC_DIR)/scripts/feature-tests.mak
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
#ifndef __CR_CONFIG_BASE_H__
|
||||
#define __CR_CONFIG_BASE_H__
|
||||
|
||||
#define PAGE_ALLOC_COSTLY_ORDER 3 /* from the kernel source code */
|
||||
struct kernel_pipe_buffer {
|
||||
struct page *page;
|
||||
unsigned int offset, len;
|
||||
const struct pipe_buf_operations *ops;
|
||||
unsigned int flags;
|
||||
unsigned long private;
|
||||
};
|
||||
|
||||
/*
|
||||
* The kernel allocates the linear chunk of memory for pipe buffers.
|
||||
* Allocation of chunks with size more than PAGE_ALLOC_COSTLY_ORDER
|
||||
* fails very often, so we need to restrict the pipe capacity to not
|
||||
* allocate big chunks.
|
||||
*/
|
||||
#define PIPE_MAX_SIZE ((1 << PAGE_ALLOC_COSTLY_ORDER) * PAGE_SIZE / \
|
||||
sizeof(struct kernel_pipe_buffer))
|
||||
|
||||
/* The number of pipes for one chunk */
|
||||
#define NR_PIPES_PER_CHUNK 8
|
||||
|
||||
/*
|
||||
* These things are required to compile on CentOS-6
|
||||
*/
|
||||
#ifndef F_LINUX_SPECIFIC_BASE
|
||||
# define F_LINUX_SPECIFIC_BASE 1024
|
||||
#endif
|
||||
|
||||
#ifndef F_SETPIPE_SZ
|
||||
# define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)
|
||||
#endif
|
||||
|
||||
#ifndef F_GETPIPE_SZ
|
||||
# define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)
|
||||
#endif
|
||||
|
||||
#endif /* __CR_CONFIG_BASE_H__ */
|
||||
|
|
@ -19,12 +19,17 @@ struct f_owner_ex {
|
|||
#define F_GETOWNER_UIDS 17
|
||||
#endif
|
||||
|
||||
/*
|
||||
* These things are required to compile on CentOS-6
|
||||
*/
|
||||
#ifndef F_LINUX_SPECIFIC_BASE
|
||||
#define F_LINUX_SPECIFIC_BASE 1024
|
||||
# define F_LINUX_SPECIFIC_BASE 1024
|
||||
#endif
|
||||
|
||||
#ifndef F_SETPIPE_SZ
|
||||
# define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)
|
||||
#endif
|
||||
|
||||
#ifndef F_GETPIPE_SZ
|
||||
# define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -4,6 +4,27 @@
|
|||
#include <sys/uio.h>
|
||||
#include "common/list.h"
|
||||
|
||||
#define PAGE_ALLOC_COSTLY_ORDER 3 /* from the kernel source code */
|
||||
struct kernel_pipe_buffer {
|
||||
struct page *page;
|
||||
unsigned int offset, len;
|
||||
const struct pipe_buf_operations *ops;
|
||||
unsigned int flags;
|
||||
unsigned long private;
|
||||
};
|
||||
|
||||
/*
|
||||
* The kernel allocates the linear chunk of memory for pipe buffers.
|
||||
* Allocation of chunks with size more than PAGE_ALLOC_COSTLY_ORDER
|
||||
* fails very often, so we need to restrict the pipe capacity to not
|
||||
* allocate big chunks.
|
||||
*/
|
||||
#define PIPE_MAX_SIZE ((1 << PAGE_ALLOC_COSTLY_ORDER) * PAGE_SIZE / \
|
||||
sizeof(struct kernel_pipe_buffer))
|
||||
|
||||
/* The number of pipes for one chunk */
|
||||
#define NR_PIPES_PER_CHUNK 8
|
||||
|
||||
/*
|
||||
* page_pipe is a descriptor of task's virtual memory
|
||||
* with pipes, containing pages.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#undef LOG_PREFIX
|
||||
#define LOG_PREFIX "page-pipe: "
|
||||
|
|
@ -9,6 +8,7 @@
|
|||
#include "util.h"
|
||||
#include "criu-log.h"
|
||||
#include "page-pipe.h"
|
||||
#include "fcntl.h"
|
||||
|
||||
/* can existing iov accumulate the page? */
|
||||
static inline bool iov_grow_page(struct iovec *iov, unsigned long addr)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
#include <arpa/inet.h>
|
||||
#include <linux/falloc.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/stat.h>
|
||||
|
|
@ -17,6 +16,7 @@
|
|||
#include "util.h"
|
||||
#include "protobuf.h"
|
||||
#include "images/pagemap.pb-c.h"
|
||||
#include "fcntl.h"
|
||||
|
||||
static int page_server_sk = -1;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
|
|
@ -17,6 +16,7 @@
|
|||
#include "util.h"
|
||||
#include "images/pipe.pb-c.h"
|
||||
#include "images/pipe-data.pb-c.h"
|
||||
#include "fcntl.h"
|
||||
|
||||
static LIST_HEAD(pipes);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue