Commit fbaa9185 authored by Pavel Emelyanov's avatar Pavel Emelyanov

ext: Sweep external resources code into separate files.

Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent a8f16a95
ccflags-y += -iquote criu/$(ARCH)
obj-y += action-scripts.o
obj-y += external.o
obj-y += aio.o
obj-y += bfd.o
obj-y += bitmap.o
......
......@@ -17,6 +17,7 @@
#include "crtools.h"
#include "cr_options.h"
#include "external.h"
#include "util.h"
#include "log.h"
#include "cpu.h"
......
......@@ -24,6 +24,7 @@
#include "compiler.h"
#include "crtools.h"
#include "cr_options.h"
#include "external.h"
#include "sockets.h"
#include "files.h"
#include "sk-inet.h"
......@@ -193,19 +194,6 @@ static size_t parse_size(char *optarg)
return (size_t)atol(optarg);
}
int add_external(char *key)
{
struct external *ext;
ext = xmalloc(sizeof(*ext));
if (!ext)
return -1;
ext->id = key;
list_add(&ext->node, &opts.external);
return 0;
}
bool deprecated_ok(char *what)
{
if (opts.deprecated_ok)
......
#include "list.h"
#include "cr_options.h"
#include "xmalloc.h"
#include "external.h"
int add_external(char *key)
{
struct external *ext;
ext = xmalloc(sizeof(*ext));
if (!ext)
return -1;
ext->id = key;
list_add(&ext->node, &opts.external);
return 0;
}
bool external_lookup_id(char *id)
{
struct external *ext;
list_for_each_entry(ext, &opts.external, node)
if (!strcmp(ext->id, id))
return true;
return false;
}
char *external_lookup_by_key(char *key)
{
struct external *ext;
int len = strlen(key);
list_for_each_entry(ext, &opts.external, node) {
if (strncmp(ext->id, key, len))
continue;
if (ext->id[len] == ':')
return ext->id + len + 1;
}
return NULL;
}
......@@ -28,6 +28,7 @@
#include "proc_parse.h"
#include "pstree.h"
#include "fault-injection.h"
#include "external.h"
#include "protobuf.h"
#include "images/regfile.pb-c.h"
......
......@@ -1649,30 +1649,6 @@ int inherit_fd_fini()
return 0;
}
bool external_lookup_id(char *id)
{
struct external *ext;
list_for_each_entry(ext, &opts.external, node)
if (!strcmp(ext->id, id))
return true;
return false;
}
char *external_lookup_by_key(char *key)
{
struct external *ext;
int len = strlen(key);
list_for_each_entry(ext, &opts.external, node) {
if (strncmp(ext->id, key, len))
continue;
if (ext->id[len] == ':')
return ext->id + len + 1;
}
return NULL;
}
int open_transport_socket()
{
int sock;
......
......@@ -47,11 +47,6 @@ struct irmap_path_opt {
struct irmap *ir;
};
struct external {
struct list_head node;
char *id;
};
struct cr_options {
int final_state;
char *show_dump_file;
......@@ -126,6 +121,4 @@ extern struct cr_options opts;
extern void init_opts(void);
extern int add_external(char *key);
#endif /* __CR_OPTIONS_H__ */
#ifndef __CR_EXTERNAL_H__
#define __CR_EXTERNAL_H__
struct external {
struct list_head node;
char *id;
};
extern int add_external(char *key);
extern bool external_lookup_id(char *id);
extern char *external_lookup_by_key(char *id);
#endif
......@@ -191,9 +191,7 @@ extern void inherit_fd_log(void);
extern int inherit_fd_resolve_clash(int fd);
extern int inherit_fd_fini(void);
extern bool external_lookup_id(char *id);
extern int inherit_fd_lookup_id(char *id);
extern char *external_lookup_by_key(char *id);
extern bool inherited_fd(struct file_desc *, int *fdp);
......
......@@ -30,6 +30,7 @@
#include "path.h"
#include "autofs.h"
#include "files-reg.h"
#include "external.h"
#include "images/mnt.pb-c.h"
#include "images/binfmt-misc.pb-c.h"
......
......@@ -28,6 +28,7 @@
#include "file-ids.h"
#include "files-reg.h"
#include "namespaces.h"
#include "external.h"
#include "protobuf.h"
#include "images/tty.pb-c.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment