mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
We want to have buffered images to speed up dump and, slightly, restore. Right now we use plan file descriptors to write and read images to/from. Making them buffered cannot be gracefully done on plain fds, so introduce a new class. This will also help if (when?) we will want to do more complex changes with images, e.g. store them all in one file or send them directly to the network. For now the cr_img just contains one int _fd variable. This patch chages the prototype of open_image() to return struct cr_img *, pb_(read|write)* to accept one and fixes the compilation of the rest of the code :) Signed-off-by: Pavel Emelyanov <xemul@parallels.com> Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
37 lines
880 B
C
37 lines
880 B
C
#ifndef __CR_LOG_H__
|
|
#define __CR_LOG_H__
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include "criu-log.h"
|
|
|
|
extern int log_init(const char *output);
|
|
extern void log_fini(void);
|
|
extern int log_init_by_pid(void);
|
|
extern void log_closedir(void);
|
|
|
|
extern void log_set_fd(int fd);
|
|
extern int log_get_fd(void);
|
|
|
|
extern void log_set_loglevel(unsigned int loglevel);
|
|
extern unsigned int log_get_loglevel(void);
|
|
|
|
extern int vprint_num(char *buf, int blen, int num, char **ps);
|
|
|
|
extern int write_pidfile(int pid);
|
|
|
|
#define DEFAULT_LOGLEVEL LOG_WARN
|
|
|
|
#define DEFAULT_LOG_FILENAME "criu.log"
|
|
|
|
struct cr_img;
|
|
|
|
extern void print_data(unsigned long addr, unsigned char *data, size_t size);
|
|
extern void print_image_data(struct cr_img *, unsigned int length, int show);
|
|
|
|
static inline int pr_quelled(unsigned int loglevel)
|
|
{
|
|
return log_get_loglevel() < loglevel && loglevel != LOG_MSG;
|
|
}
|
|
|
|
#endif /* __CR_LOG_H__ */
|