Commit 291aa3f6 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

headers: Add extern specificator to functions

We really have a mess of extern/non-extern declaration
of functions in our headers. Always use extern for
unification purpose.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 39752a14
......@@ -6,9 +6,9 @@
#define CR_DEFAULT_SERVICE_ADDRESS "/var/run/criu_service.socket"
#define MAX_MSG_SIZE 1024
int cr_service(bool deamon_mode);
extern int cr_service(bool deamon_mode);
int send_criu_dump_resp(int socket_fd, bool success, bool restored);
extern int send_criu_dump_resp(int socket_fd, bool success, bool restored);
extern struct _cr_service_client *cr_service_client;
extern unsigned int service_sk_ino;
......
......@@ -9,24 +9,24 @@
#define CR_FD_PERM (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH)
int check_img_inventory(void);
int write_img_inventory(void);
void kill_inventory(void);
extern int check_img_inventory(void);
extern int write_img_inventory(void);
extern void kill_inventory(void);
#define LAST_PID_PATH "/proc/sys/kernel/ns_last_pid"
int cr_dump_tasks(pid_t pid);
int cr_pre_dump_tasks(pid_t pid);
int cr_restore_tasks(void);
int cr_show(int pid);
int convert_to_elf(char *elf_path, int fd_core);
int cr_check(void);
int cr_exec(int pid, char **opts);
extern int cr_dump_tasks(pid_t pid);
extern int cr_pre_dump_tasks(pid_t pid);
extern int cr_restore_tasks(void);
extern int cr_show(int pid);
extern int convert_to_elf(char *elf_path, int fd_core);
extern int cr_check(void);
extern int cr_exec(int pid, char **opts);
void restrict_uid(unsigned int uid, unsigned int gid);
extern void restrict_uid(unsigned int uid, unsigned int gid);
struct proc_status_creds;
bool may_dump(struct proc_status_creds *);
extern bool may_dump(struct proc_status_creds *);
struct _CredsEntry;
bool may_restore(struct _CredsEntry *);
extern bool may_restore(struct _CredsEntry *);
#endif /* __CR_CRTOOLS_H__ */
......@@ -24,13 +24,13 @@ extern struct cr_fdset *glob_fdset;
extern struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX];
struct cr_fdset *cr_task_fdset_open(int pid, int mode);
struct cr_fdset *cr_fdset_open_range(int pid, int from, int to,
unsigned long flags);
extern struct cr_fdset *cr_task_fdset_open(int pid, int mode);
extern struct cr_fdset *cr_fdset_open_range(int pid, int from, int to,
unsigned long flags);
#define cr_fdset_open(pid, type, flags) cr_fdset_open_range(pid, \
_CR_FD_##type##_FROM, _CR_FD_##type##_TO, flags)
struct cr_fdset *cr_glob_fdset_open(int mode);
extern struct cr_fdset *cr_glob_fdset_open(int mode);
void close_cr_fdset(struct cr_fdset **cr_fdset);
extern void close_cr_fdset(struct cr_fdset **cr_fdset);
#endif /* __CR_FDSET_H__ */
......@@ -145,6 +145,6 @@ extern int close_old_fds(struct pstree_item *me);
#define LREMAP_PARAM "link-remap"
int shared_fdt_prepare(struct pstree_item *item);
extern int shared_fdt_prepare(struct pstree_item *item);
#endif /* __CR_FILES_H__ */
......@@ -71,10 +71,10 @@ extern bool ns_per_id;
extern int open_image_dir(void);
extern void close_image_dir(void);
int open_image_at(int dfd, int type, unsigned long flags, ...);
extern int open_image_at(int dfd, int type, unsigned long flags, ...);
#define open_image(typ, flags, ...) open_image_at(get_service_fd(IMG_FD_OFF), typ, flags, ##__VA_ARGS__)
int open_pages_image(unsigned long flags, int pm_fd);
int open_pages_image_at(int dfd, unsigned long flags, int pm_fd);
void up_page_ids_base(void);
extern int open_pages_image(unsigned long flags, int pm_fd);
extern int open_pages_image_at(int dfd, unsigned long flags, int pm_fd);
extern void up_page_ids_base(void);
#endif /* __CR_IMAGE_H__ */
......@@ -23,8 +23,8 @@ struct kid_elem {
unsigned idx;
};
u32 kid_generate_gen(struct kid_tree *tree,
struct kid_elem *elem, int *new_id);
void kid_show_tree(struct kid_tree *tree);
extern u32 kid_generate_gen(struct kid_tree *tree,
struct kid_elem *elem, int *new_id);
extern void kid_show_tree(struct kid_tree *tree);
#endif /* __CR_KCMP_IDS_H__ */
......@@ -8,9 +8,9 @@
* of run-time information about current kernel
*/
int kerndat_init(void);
int kerndat_init_rst(void);
int kerndat_get_dirty_track(void);
extern int kerndat_init(void);
extern int kerndat_init_rst(void);
extern int kerndat_get_dirty_track(void);
extern dev_t kerndat_shmem_dev;
extern bool kerndat_has_dirty_track;
......
......@@ -2,7 +2,7 @@
#define __CR_MOUNT_H__
extern int mntns_root;
int mntns_collect_root(pid_t pid);
extern int mntns_collect_root(pid_t pid);
struct proc_mountinfo;
......@@ -12,7 +12,7 @@ extern struct fstype *find_fstype_by_name(char *fst);
struct cr_fdset;
extern int dump_mnt_ns(int pid, int ns_id);
int prepare_mnt_ns(int pid);
extern int prepare_mnt_ns(int pid);
extern int pivot_root(const char *new_root, const char *put_old);
......
......@@ -25,13 +25,13 @@ extern unsigned long current_ns_mask;
extern const struct fdtype_ops nsfile_dump_ops;
extern struct collect_image_info nsfile_cinfo;
int dump_namespaces(struct pstree_item *item, unsigned int ns_flags);
int prepare_namespace(struct pstree_item *item, unsigned long clone_flags);
int try_show_namespaces(int pid);
extern int dump_namespaces(struct pstree_item *item, unsigned int ns_flags);
extern int prepare_namespace(struct pstree_item *item, unsigned long clone_flags);
extern int try_show_namespaces(int pid);
int switch_ns(int pid, struct ns_desc *nd, int *rst);
int restore_ns(int rst, struct ns_desc *nd);
extern int switch_ns(int pid, struct ns_desc *nd, int *rst);
extern int restore_ns(int rst, struct ns_desc *nd);
int dump_task_ns_ids(struct pstree_item *);
extern int dump_task_ns_ids(struct pstree_item *);
#endif /* __CR_NS_H__ */
......@@ -4,9 +4,9 @@
#include "list.h"
struct cr_fdset;
int dump_net_ns(int pid, int ns_id);
int prepare_net_ns(int pid);
int netns_pre_create(void);
extern int dump_net_ns(int pid, int ns_id);
extern int prepare_net_ns(int pid);
extern int netns_pre_create(void);
struct veth_pair {
struct list_head node;
......@@ -20,8 +20,8 @@ extern void network_unlock(void);
extern struct ns_desc net_ns_desc;
#include "protobuf/netdev.pb-c.h"
int write_netdev_img(NetDeviceEntry *nde, struct cr_fdset *fds);
int read_ns_sys_file(char *path, char *buf, int len);
int restore_link_parms(NetDeviceEntry *nde, int nlsk);
extern int write_netdev_img(NetDeviceEntry *nde, struct cr_fdset *fds);
extern int read_ns_sys_file(char *path, char *buf, int len);
extern int restore_link_parms(NetDeviceEntry *nde, int nlsk);
#endif /* __CR_NET_H__ */
......@@ -2,10 +2,10 @@
#define __CR_NETFILTER_H__
struct inet_sk_desc;
int nf_lock_connection(struct inet_sk_desc *);
int nf_unlock_connection(struct inet_sk_desc *);
extern int nf_lock_connection(struct inet_sk_desc *);
extern int nf_unlock_connection(struct inet_sk_desc *);
struct inet_sk_info;
int nf_unlock_connection_info(struct inet_sk_info *);
extern int nf_unlock_connection_info(struct inet_sk_info *);
#endif /* __CR_NETFILTER_H__ */
......@@ -91,11 +91,11 @@ struct page_pipe {
struct iovec *holes; /* holes */
};
struct page_pipe *create_page_pipe(unsigned int nr, struct iovec *);
void destroy_page_pipe(struct page_pipe *p);
int page_pipe_add_page(struct page_pipe *p, unsigned long addr);
int page_pipe_add_hole(struct page_pipe *p, unsigned long addr);
extern struct page_pipe *create_page_pipe(unsigned int nr, struct iovec *);
extern void destroy_page_pipe(struct page_pipe *p);
extern int page_pipe_add_page(struct page_pipe *p, unsigned long addr);
extern int page_pipe_add_hole(struct page_pipe *p, unsigned long addr);
void debug_show_page_pipe(struct page_pipe *pp);
extern void debug_show_page_pipe(struct page_pipe *pp);
#endif /* __CR_PAGE_PIPE_H__ */
......@@ -66,6 +66,6 @@ struct page_read {
unsigned id; /* for logging */
};
int open_page_read(int pid, struct page_read *);
extern int open_page_read(int pid, struct page_read *);
#endif /* __CR_PAGE_READ_H__ */
#ifndef __CR_PAGE_XFER__H__
#define __CR_PAGE_XFER__H__
int cr_page_server(bool daemon_mode);
extern int cr_page_server(bool daemon_mode);
/*
* page_xfer -- transfer pages into image file.
......@@ -26,11 +26,11 @@ struct page_xfer {
};
};
int open_page_xfer(struct page_xfer *xfer, int fd_type, long id);
extern int open_page_xfer(struct page_xfer *xfer, int fd_type, long id);
struct page_pipe;
int page_xfer_dump_pages(struct page_xfer *, struct page_pipe *,
unsigned long off);
int connect_to_page_server(void);
int disconnect_from_page_server(void);
extern int page_xfer_dump_pages(struct page_xfer *, struct page_pipe *,
unsigned long off);
extern int connect_to_page_server(void);
extern int disconnect_from_page_server(void);
#endif /* __CR_PAGE_XFER__H__ */
......@@ -50,6 +50,6 @@ struct collect_image_info {
#define COLLECT_SHARED 0x1 /* use shared memory for obj-s */
#define COLLECT_OPTIONAL 0x2 /* image file may be missing */
int collect_image(struct collect_image_info *);
extern int collect_image(struct collect_image_info *);
#endif /* __CR_PROTOBUF_H__ */
......@@ -59,7 +59,7 @@ extern bool pid_in_pstree(pid_t pid);
struct task_entries;
extern struct task_entries *task_entries;
int get_task_ids(struct pstree_item *);
extern int get_task_ids(struct pstree_item *);
extern struct _TaskKobjIdsEntry *root_ids;
extern void core_entry_free(CoreEntry *core);
......
......@@ -44,25 +44,25 @@ enum {
/*
* Disables SHARED and SHREMAP allocations, turns on PRIVATE
*/
void rst_mem_switch_to_private(void);
extern void rst_mem_switch_to_private(void);
/*
* Reports a cookie of a current shared buffer position, that
* can later be used in rst_mem_cpos() to find out the object
* pointer.
*/
unsigned long rst_mem_cpos(int type);
void *rst_mem_remap_ptr(unsigned long pos, int type);
extern unsigned long rst_mem_cpos(int type);
extern void *rst_mem_remap_ptr(unsigned long pos, int type);
/*
* Allocate and free objects. We don't need to free arbitrary
* object, thus allocation is simple (linear) and only the
* last object can be freed (pop-ed from buffer).
*/
void *rst_mem_alloc(unsigned long size, int type);
void rst_mem_free_last(int type);
extern void *rst_mem_alloc(unsigned long size, int type);
extern void rst_mem_free_last(int type);
/*
* Routines to remap SHREMAP and PRIVATE into restorer address space
*/
unsigned long rst_mem_remap_size(void);
int rst_mem_remap(void *to);
extern unsigned long rst_mem_remap_size(void);
extern int rst_mem_remap(void *to);
#endif /* __CR_RST_MALLOC__H__ */
......@@ -21,16 +21,16 @@ struct shmem_info {
futex_t lock;
};
int prepare_shmem_pid(int pid);
int prepare_shmem_restore(void);
void show_saved_shmems(void);
int get_shmem_fd(int pid, VmaEntry *vi);
extern int prepare_shmem_pid(int pid);
extern int prepare_shmem_restore(void);
extern void show_saved_shmems(void);
extern int get_shmem_fd(int pid, VmaEntry *vi);
extern unsigned long nr_shmems;
extern unsigned int rst_shmems;
int cr_dump_shmem(void);
int add_shmem_area(pid_t pid, VmaEntry *vma);
extern int cr_dump_shmem(void);
extern int add_shmem_area(pid_t pid, VmaEntry *vma);
static always_inline struct shmem_info *
find_shmem(struct shmem_info *shmems, int nr, unsigned long shmid)
......
......@@ -43,8 +43,8 @@ struct inet_sk_info {
struct list_head rlist;
};
int inet_bind(int sk, struct inet_sk_info *);
int inet_connect(int sk, struct inet_sk_info *);
extern int inet_bind(int sk, struct inet_sk_info *);
extern int inet_connect(int sk, struct inet_sk_info *);
struct rst_tcp_sock {
int sk;
......@@ -68,16 +68,16 @@ static inline void tcp_repair_off(int fd)
pr_perror("Failed to turn off repair mode on socket (%d)", ret);
}
void tcp_locked_conn_add(struct inet_sk_info *);
void rst_unlock_tcp_connections(void);
void cpt_unlock_tcp_connections(void);
extern void tcp_locked_conn_add(struct inet_sk_info *);
extern void rst_unlock_tcp_connections(void);
extern void cpt_unlock_tcp_connections(void);
int dump_one_tcp(int sk, struct inet_sk_desc *sd);
int restore_one_tcp(int sk, struct inet_sk_info *si);
extern int dump_one_tcp(int sk, struct inet_sk_desc *sd);
extern int restore_one_tcp(int sk, struct inet_sk_info *si);
#define SK_EST_PARAM "tcp-established"
int check_tcp(void);
extern int check_tcp(void);
extern int rst_tcp_socks_add(int fd, bool reuseaddr);
#endif /* __CR_SK_INET_H__ */
......@@ -11,8 +11,8 @@ struct vma_area;
extern struct collect_image_info packet_sk_cinfo;
int dump_socket_map(struct vma_area *vma);
int get_socket_fd(int pid, VmaEntry *vma);
extern int dump_socket_map(struct vma_area *vma);
extern int get_socket_fd(int pid, VmaEntry *vma);
extern int packet_receive_one(struct nlmsghdr *h, void *arg);
......
......@@ -17,8 +17,8 @@ enum {
RESTORE_TIME_NS_STATS,
};
void timing_start(int t);
void timing_stop(int t);
extern void timing_start(int t);
extern void timing_stop(int t);
enum {
CNT_PAGES_SCANNED,
......@@ -35,12 +35,12 @@ enum {
RESTORE_CNT_NR_STATS,
};
void cnt_add(int c, unsigned long val);
extern void cnt_add(int c, unsigned long val);
#define DUMP_STATS 1
#define RESTORE_STATS 2
int init_stats(int what);
void write_stats(int what);
extern int init_stats(int what);
extern void write_stats(int what);
#endif /* __CR_STATS_H__ */
......@@ -8,9 +8,9 @@
#include "protobuf/netdev.pb-c.h"
extern const struct fdtype_ops tunfile_dump_ops;
int dump_tun_link(NetDeviceEntry *nde, struct cr_fdset *fds);
int restore_one_tun(NetDeviceEntry *nde, int nlsk);
extern int dump_tun_link(NetDeviceEntry *nde, struct cr_fdset *fds);
extern int restore_one_tun(NetDeviceEntry *nde, int nlsk);
extern struct collect_image_info tunfile_cinfo;
int check_tun(void);
extern int check_tun(void);
#endif /* __CR_TUN_H__ */
......@@ -61,6 +61,6 @@ static inline int recv_fd(int sock)
return fd;
}
int open_detach_mount(char *dir);
extern int open_detach_mount(char *dir);
#endif /* __CR_UTIL_NET_H__ */
......@@ -140,12 +140,12 @@ extern int reopen_fd_as_safe(char *file, int line, int new_fd, int old_fd, bool
#define reopen_fd_as(new_fd, old_fd) reopen_fd_as_safe(__FILE__, __LINE__, new_fd, old_fd, false)
#define reopen_fd_as_nocheck(new_fd, old_fd) reopen_fd_as_safe(__FILE__, __LINE__, new_fd, old_fd, true)
void close_proc(void);
int open_pid_proc(pid_t pid);
int close_pid_proc(void);
int set_proc_fd(int fd);
extern void close_proc(void);
extern int open_pid_proc(pid_t pid);
extern int close_pid_proc(void);
extern int set_proc_fd(int fd);
int do_open_proc(pid_t pid, int flags, const char *fmt, ...);
extern int do_open_proc(pid_t pid, int flags, const char *fmt, ...);
#define __open_proc(pid, flags, fmt, ...) \
({ \
......@@ -233,9 +233,9 @@ static inline dev_t kdev_to_odev(u32 kdev)
#endif
}
int copy_file(int fd_in, int fd_out, size_t bytes);
bool is_anon_inode(struct statfs *statfs);
int is_anon_link_type(int lfd, char *type);
extern int copy_file(int fd_in, int fd_out, size_t bytes);
extern bool is_anon_inode(struct statfs *statfs);
extern int is_anon_link_type(int lfd, char *type);
#define is_hex_digit(c) \
(((c) >= '0' && (c) <= '9') || \
......
#ifndef __CR_UTS_NS_H__
#define __CR_UTS_NS_H__
int dump_uts_ns(int ns_pid, int ns_id);
int prepare_utsns(int pid);
extern int dump_uts_ns(int ns_pid, int ns_id);
extern int prepare_utsns(int pid);
extern struct ns_desc uts_ns_desc;
......
......@@ -25,9 +25,9 @@ struct vma_area {
unsigned long *ppage_bitmap; /* parent's existent pages */
};
int collect_mappings(pid_t pid, struct vm_area_list *vma_area_list);
void free_mappings(struct vm_area_list *vma_area_list);
bool privately_dump_vma(struct vma_area *vma);
extern int collect_mappings(pid_t pid, struct vm_area_list *vma_area_list);
extern void free_mappings(struct vm_area_list *vma_area_list);
extern bool privately_dump_vma(struct vma_area *vma);
#define vma_area_is(vma_area, s) vma_entry_is(&((vma_area)->vma), s)
#define vma_area_len(vma_area) vma_entry_len(&((vma_area)->vma))
......
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