From 291aa3f6d63bc19d4e3dee2ad3944629f7f02751 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Fri, 15 Nov 2013 14:04:48 +0400 Subject: [PATCH] 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: Cyrill Gorcunov Signed-off-by: Pavel Emelyanov --- include/cr-service.h | 4 ++-- include/crtools.h | 26 +++++++++++++------------- include/fdset.h | 10 +++++----- include/files.h | 2 +- include/image.h | 8 ++++---- include/kcmp-ids.h | 6 +++--- include/kerndat.h | 6 +++--- include/mount.h | 4 ++-- include/namespaces.h | 12 ++++++------ include/net.h | 12 ++++++------ include/netfilter.h | 6 +++--- include/page-pipe.h | 10 +++++----- include/page-read.h | 2 +- include/page-xfer.h | 12 ++++++------ include/protobuf.h | 2 +- include/pstree.h | 2 +- include/rst-malloc.h | 14 +++++++------- include/shmem.h | 12 ++++++------ include/sk-inet.h | 16 ++++++++-------- include/sk-packet.h | 4 ++-- include/stats.h | 10 +++++----- include/tun.h | 6 +++--- include/util-pie.h | 2 +- include/util.h | 16 ++++++++-------- include/uts_ns.h | 4 ++-- include/vma.h | 6 +++--- 26 files changed, 107 insertions(+), 107 deletions(-) diff --git a/include/cr-service.h b/include/cr-service.h index 11a0416af..5c38ac303 100644 --- a/include/cr-service.h +++ b/include/cr-service.h @@ -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; diff --git a/include/crtools.h b/include/crtools.h index de35738d5..7c08fd6fc 100644 --- a/include/crtools.h +++ b/include/crtools.h @@ -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__ */ diff --git a/include/fdset.h b/include/fdset.h index 1605347c0..ad62d5e11 100644 --- a/include/fdset.h +++ b/include/fdset.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__ */ diff --git a/include/files.h b/include/files.h index f0564bea0..d491cf1c5 100644 --- a/include/files.h +++ b/include/files.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__ */ diff --git a/include/image.h b/include/image.h index 1f000e839..852d2695f 100644 --- a/include/image.h +++ b/include/image.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__ */ diff --git a/include/kcmp-ids.h b/include/kcmp-ids.h index 76c3522da..e9e91014d 100644 --- a/include/kcmp-ids.h +++ b/include/kcmp-ids.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__ */ diff --git a/include/kerndat.h b/include/kerndat.h index e001ee9d7..738ad049f 100644 --- a/include/kerndat.h +++ b/include/kerndat.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; diff --git a/include/mount.h b/include/mount.h index 9de9b51f2..76f4fed00 100644 --- a/include/mount.h +++ b/include/mount.h @@ -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); diff --git a/include/namespaces.h b/include/namespaces.h index 14061d38f..163de8ecf 100644 --- a/include/namespaces.h +++ b/include/namespaces.h @@ -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__ */ diff --git a/include/net.h b/include/net.h index 6b455733b..eb29cf585 100644 --- a/include/net.h +++ b/include/net.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__ */ diff --git a/include/netfilter.h b/include/netfilter.h index a857d3a96..f3667fc81 100644 --- a/include/netfilter.h +++ b/include/netfilter.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__ */ diff --git a/include/page-pipe.h b/include/page-pipe.h index 698e51bd2..393627bfe 100644 --- a/include/page-pipe.h +++ b/include/page-pipe.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__ */ diff --git a/include/page-read.h b/include/page-read.h index d738a22b8..5a11348d1 100644 --- a/include/page-read.h +++ b/include/page-read.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__ */ diff --git a/include/page-xfer.h b/include/page-xfer.h index a40983b0d..a681eb695 100644 --- a/include/page-xfer.h +++ b/include/page-xfer.h @@ -1,7 +1,7 @@ #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__ */ diff --git a/include/protobuf.h b/include/protobuf.h index d08e9dd63..ae9a65c77 100644 --- a/include/protobuf.h +++ b/include/protobuf.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__ */ diff --git a/include/pstree.h b/include/pstree.h index 3da92c552..c1f7426d8 100644 --- a/include/pstree.h +++ b/include/pstree.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); diff --git a/include/rst-malloc.h b/include/rst-malloc.h index d2aec7af0..df854e6e1 100644 --- a/include/rst-malloc.h +++ b/include/rst-malloc.h @@ -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__ */ diff --git a/include/shmem.h b/include/shmem.h index 6369e50e0..cdb058907 100644 --- a/include/shmem.h +++ b/include/shmem.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) diff --git a/include/sk-inet.h b/include/sk-inet.h index 8e22d151b..e8fc74fc8 100644 --- a/include/sk-inet.h +++ b/include/sk-inet.h @@ -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__ */ diff --git a/include/sk-packet.h b/include/sk-packet.h index 915e5ec9a..4c740c0b9 100644 --- a/include/sk-packet.h +++ b/include/sk-packet.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); diff --git a/include/stats.h b/include/stats.h index 2016b56fd..aa2505089 100644 --- a/include/stats.h +++ b/include/stats.h @@ -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__ */ diff --git a/include/tun.h b/include/tun.h index 2e4e4db63..949543578 100644 --- a/include/tun.h +++ b/include/tun.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__ */ diff --git a/include/util-pie.h b/include/util-pie.h index 0d6b29bee..049696c70 100644 --- a/include/util-pie.h +++ b/include/util-pie.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__ */ diff --git a/include/util.h b/include/util.h index 72a79e9de..298d62389 100644 --- a/include/util.h +++ b/include/util.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') || \ diff --git a/include/uts_ns.h b/include/uts_ns.h index a570507c6..ff499ac65 100644 --- a/include/uts_ns.h +++ b/include/uts_ns.h @@ -1,8 +1,8 @@ #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; diff --git a/include/vma.h b/include/vma.h index bb5e33b09..47c86352c 100644 --- a/include/vma.h +++ b/include/vma.h @@ -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))