[CRIU] [PATCH 14/14] Spring whitespace cleanup

Kir Kolyshkin kir at openvz.org
Tue Mar 21 15:03:12 PDT 2017


Replace 8-spaces with a tab in code.

Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 criu/arch/ppc64/cpu.c     |  34 ++++++------
 criu/arch/ppc64/crtools.c |  98 ++++++++++++++++-----------------
 criu/arch/x86/restorer.c  |   4 +-
 criu/img-remote-proto.c   | 136 +++++++++++++++++++++++-----------------------
 criu/mem.c                |  22 ++++----
 criu/pstree.c             |   2 +-
 criu/sk-netlink.c         |   4 +-
 criu/sk-packet.c          |   8 +--
 criu/util.c               |   3 +-
 soccr/soccr.c             |  28 +++++-----
 10 files changed, 170 insertions(+), 169 deletions(-)

diff --git a/criu/arch/ppc64/cpu.c b/criu/arch/ppc64/cpu.c
index f90f997..4fcfb06 100644
--- a/criu/arch/ppc64/cpu.c
+++ b/criu/arch/ppc64/cpu.c
@@ -38,8 +38,8 @@ int cpu_dump_cpuinfo(void)
 	int ret = -1;
 
 	img = open_image(CR_FD_CPUINFO, O_DUMP);
-        if (!img)
-                return -1;
+	if (!img)
+		return -1;
 
 	cpu_info.ppc64_entry = &cpu_ppc64_info_ptr;
 	cpu_info.n_ppc64_entry = 1;
@@ -51,7 +51,7 @@ int cpu_dump_cpuinfo(void)
 	ret = pb_write_one(img, &cpu_info, PB_CPUINFO);
 
 	close_image(img);
-        return ret;
+	return ret;
 }
 
 int cpu_validate_cpuinfo(void)
@@ -60,12 +60,12 @@ int cpu_validate_cpuinfo(void)
 	CpuinfoPpc64Entry *cpu_ppc64_entry;
 	struct cr_img *img;
 	int ret = -1;
-        img = open_image(CR_FD_CPUINFO, O_RSTR);
-        if (!img)
-                return -1;
+	img = open_image(CR_FD_CPUINFO, O_RSTR);
+	if (!img)
+		return -1;
 
-        if (pb_read_one(img, &cpu_info, PB_CPUINFO) < 0)
-                goto error;
+	if (pb_read_one(img, &cpu_info, PB_CPUINFO) < 0)
+		goto error;
 
 	if (cpu_info->n_ppc64_entry != 1) {
 		pr_err("No PPC64 related entry in image\n");
@@ -121,22 +121,22 @@ error:
 
 int cpuinfo_dump(void)
 {
-        if (cpu_init())
-                return -1;
+	if (cpu_init())
+		return -1;
 
-        if (cpu_dump_cpuinfo())
-                return -1;
+	if (cpu_dump_cpuinfo())
+		return -1;
 
-        return 0;
+	return 0;
 }
 
 int cpuinfo_check(void)
 {
-        if (cpu_init())
-                return -1;
+	if (cpu_init())
+		return -1;
 
-        if (cpu_validate_cpuinfo())
-                return 1;
+	if (cpu_validate_cpuinfo())
+		return 1;
 
 	return 0;
 }
diff --git a/criu/arch/ppc64/crtools.c b/criu/arch/ppc64/crtools.c
index c4f0df7..ecda5ce 100644
--- a/criu/arch/ppc64/crtools.c
+++ b/criu/arch/ppc64/crtools.c
@@ -239,7 +239,7 @@ static void xfree_tm_state(UserPpc64TmRegsEntry *tme)
 			xfree(tme->vsxstate->vsxregs);
 			xfree(tme->vsxstate);
 		}
-                if (tme->gpregs) {
+		if (tme->gpregs) {
 			if (tme->gpregs->gpr)
 				xfree(tme->gpregs->gpr);
 			xfree(tme->gpregs);
@@ -286,25 +286,25 @@ static int copy_tm_regs(user_regs_struct_t *regs, user_fpregs_struct_t *fpregs,
 			CoreEntry *core)
 {
 	UserPpc64TmRegsEntry *tme;
-        UserPpc64RegsEntry *gpregs = core->ti_ppc64->gpregs;
+	UserPpc64RegsEntry *gpregs = core->ti_ppc64->gpregs;
 
 	pr_debug("Copying TM registers\n");
-	        tme = xmalloc(sizeof(*tme));
-        if (!tme)
-                return -1;
+	tme = xmalloc(sizeof(*tme));
+	if (!tme)
+		return -1;
 
 	user_ppc64_tm_regs_entry__init(tme);
 
-        tme->gpregs = allocate_gp_regs();
-        if (!tme->gpregs)
-                goto out_free;
+	tme->gpregs = allocate_gp_regs();
+	if (!tme->gpregs)
+		goto out_free;
 
-        gpregs->has_tfhar       = true;
-        gpregs->tfhar           = fpregs->tm.tm_spr_regs.tfhar;
-        gpregs->has_texasr      = true;
-        gpregs->texasr          = fpregs->tm.tm_spr_regs.texasr;
-        gpregs->has_tfiar       = true;
-        gpregs->tfiar           = fpregs->tm.tm_spr_regs.tfiar;
+	gpregs->has_tfhar	= true;
+	gpregs->tfhar		= fpregs->tm.tm_spr_regs.tfhar;
+	gpregs->has_texasr	= true;
+	gpregs->texasr		= fpregs->tm.tm_spr_regs.texasr;
+	gpregs->has_tfiar	= true;
+	gpregs->tfiar		= fpregs->tm.tm_spr_regs.tfiar;
 
 
 	/* This is the checkpointed state, we must save it in place of the
@@ -315,32 +315,32 @@ static int copy_tm_regs(user_regs_struct_t *regs, user_fpregs_struct_t *fpregs,
 	copy_gp_regs(gpregs, &fpregs->tm.regs);
 
 	if (fpregs->tm.flags & USER_FPREGS_FL_FP) {
-                core->ti_ppc64->fpstate = copy_fp_regs(fpregs->tm.fpregs);
-                if (!core->ti_ppc64->fpstate)
-                        goto out_free;
-        }
+		core->ti_ppc64->fpstate = copy_fp_regs(fpregs->tm.fpregs);
+		if (!core->ti_ppc64->fpstate)
+			goto out_free;
+	}
 
 	if (fpregs->tm.flags & USER_FPREGS_FL_ALTIVEC) {
-                core->ti_ppc64->vrstate = copy_altivec_regs(fpregs->tm.vrregs);
-                if (!core->ti_ppc64->vrstate)
-                        goto out_free;
+		core->ti_ppc64->vrstate = copy_altivec_regs(fpregs->tm.vrregs);
+		if (!core->ti_ppc64->vrstate)
+			goto out_free;
 
-                /*
-                 * Force the MSR_VEC bit of the restored MSR otherwise the
-                 * kernel will not restore them from the signal frame.
-                 */
-                gpregs->msr |= MSR_VEC;
+		/*
+		 * Force the MSR_VEC bit of the restored MSR otherwise the
+		 * kernel will not restore them from the signal frame.
+		 */
+		gpregs->msr |= MSR_VEC;
 
 		if (fpregs->tm.flags & USER_FPREGS_FL_VSX) {
 			core->ti_ppc64->vsxstate = copy_vsx_regs(fpregs->tm.vsxregs);
 			if (!core->ti_ppc64->vsxstate)
 				goto out_free;
 			/*
-                         * Force the MSR_VSX bit of the restored MSR otherwise
-                         * the kernel will not restore them from the signal
-                         * frame.
-                         */
-                        gpregs->msr |= MSR_VSX;
+			 * Force the MSR_VSX bit of the restored MSR otherwise
+			 * the kernel will not restore them from the signal
+			 * frame.
+			 */
+			gpregs->msr |= MSR_VSX;
 		}
 	}
 
@@ -380,7 +380,7 @@ static int __copy_task_regs(user_regs_struct_t *regs,
 		fpstate = &(core->ti_ppc64->fpstate);
 		vrstate = &(core->ti_ppc64->vrstate);
 		vsxstate = &(core->ti_ppc64->vsxstate);
-        }
+	}
 
 	copy_gp_regs(gpregs, regs);
 	if (fpregs->flags & USER_FPREGS_FL_FP) {
@@ -392,22 +392,22 @@ static int __copy_task_regs(user_regs_struct_t *regs,
 		*vrstate = copy_altivec_regs(fpregs->vrregs);
 		if (!*vrstate)
 			return -1;
-                /*
-                 * Force the MSR_VEC bit of the restored MSR otherwise the
-                 * kernel will not restore them from the signal frame.
-                 */
-                gpregs->msr |= MSR_VEC;
+		/*
+		 * Force the MSR_VEC bit of the restored MSR otherwise the
+		 * kernel will not restore them from the signal frame.
+		 */
+		gpregs->msr |= MSR_VEC;
 
 		if (fpregs->flags & USER_FPREGS_FL_VSX) {
 			*vsxstate = copy_vsx_regs(fpregs->vsxregs);
 			if (!*vsxstate)
 				return -1;
-                        /*
-                         * Force the MSR_VSX bit of the restored MSR otherwise
-                         * the kernel will not restore them from the signal
-                         * frame.
-                         */
-                        gpregs->msr |= MSR_VSX;
+			/*
+			 * Force the MSR_VSX bit of the restored MSR otherwise
+			 * the kernel will not restore them from the signal
+			 * frame.
+			 */
+			gpregs->msr |= MSR_VSX;
 		}
 	}
 	return 0;
@@ -441,7 +441,7 @@ int arch_alloc_thread_info(CoreEntry *core)
 
 void arch_free_thread_info(CoreEntry *core)
 {
-        if (CORE_THREAD_ARCH_INFO(core)) {
+	if (CORE_THREAD_ARCH_INFO(core)) {
 		if (CORE_THREAD_ARCH_INFO(core)->fpstate) {
 			xfree(CORE_THREAD_ARCH_INFO(core)->fpstate->fpregs);
 			xfree(CORE_THREAD_ARCH_INFO(core)->fpstate);
@@ -455,11 +455,11 @@ void arch_free_thread_info(CoreEntry *core)
 			xfree(CORE_THREAD_ARCH_INFO(core)->vsxstate);
 		}
 		xfree_tm_state(CORE_THREAD_ARCH_INFO(core)->tmstate);
-                xfree(CORE_THREAD_ARCH_INFO(core)->gpregs->gpr);
-                xfree(CORE_THREAD_ARCH_INFO(core)->gpregs);
-                xfree(CORE_THREAD_ARCH_INFO(core));
-                CORE_THREAD_ARCH_INFO(core) = NULL;
-        }
+		xfree(CORE_THREAD_ARCH_INFO(core)->gpregs->gpr);
+		xfree(CORE_THREAD_ARCH_INFO(core)->gpregs);
+		xfree(CORE_THREAD_ARCH_INFO(core));
+		CORE_THREAD_ARCH_INFO(core) = NULL;
+	}
 }
 
 int restore_fpu(struct rt_sigframe *sigframe, CoreEntry *core)
diff --git a/criu/arch/x86/restorer.c b/criu/arch/x86/restorer.c
index a4ddee5..a663043 100644
--- a/criu/arch/x86/restorer.c
+++ b/criu/arch/x86/restorer.c
@@ -73,8 +73,8 @@ void restore_tls(tls_t *ptls)
 
 		memcpy(stack32, desc, sizeof(user_desc_t));
 		asm volatile (
-		"       mov %1,%%eax                    \n"
-		"       mov %2,%%ebx                    \n"
+		"       mov %1,%%eax			\n"
+		"       mov %2,%%ebx			\n"
 		"	int $0x80			\n"
 		"	mov %%eax,%0			\n"
 		: "=g"(ret)
diff --git a/criu/img-remote-proto.c b/criu/img-remote-proto.c
index 27d6cd3..4f44097 100644
--- a/criu/img-remote-proto.c
+++ b/criu/img-remote-proto.c
@@ -490,38 +490,38 @@ struct rimage *prepare_remote_image(char *path, char *snapshot_id, int open_mode
 
 void *process_local_read(struct wthread *wt)
 {
-    	struct rimage *rimg = NULL;
+	struct rimage *rimg = NULL;
 	int64_t ret;
-        /* TODO - split wait_for_image
-        * in cache - improve the parent stuf
-        * in proxy - do not wait for anything, return no file
-        */
-        rimg = wait_for_image(wt);
-        if (!rimg) {
-                pr_info("No image %s:%s.\n", wt->path, wt->snapshot_id);
-                if (write_reply_header(wt->fd, ENOENT) < 0)
-                        pr_perror("Error writing reply header for unexisting image");
-                close(wt->fd);
-                return NULL;
-        } else {
-                if (write_reply_header(wt->fd, 0) < 0) {
-                    pr_perror("Error writing reply header for %s:%s",
-                        wt->path, wt->snapshot_id);
-                    close(wt->fd);
-                    return NULL;
-                }
-        }
-
-        pthread_mutex_lock(&(rimg->in_use));
-        ret = send_image(wt->fd, rimg, wt->flags, true);
-        if (ret < 0)
-                pr_perror("Unable to send %s:%s to CRIU (sent %ld bytes)",
-                    rimg->path, rimg->snapshot_id, (long)ret);
-        else
-                pr_info("Finished sending %s:%s to CRIU (sent %ld bytes)\n",
-                    rimg->path, rimg->snapshot_id, (long)ret);
-        pthread_mutex_unlock(&(rimg->in_use));
-        return NULL;
+	/* TODO - split wait_for_image
+	 * in cache - improve the parent stuf
+	 * in proxy - do not wait for anything, return no file
+	 */
+	rimg = wait_for_image(wt);
+	if (!rimg) {
+		pr_info("No image %s:%s.\n", wt->path, wt->snapshot_id);
+		if (write_reply_header(wt->fd, ENOENT) < 0)
+			pr_perror("Error writing reply header for unexisting image");
+		close(wt->fd);
+		return NULL;
+	} else {
+		if (write_reply_header(wt->fd, 0) < 0) {
+			pr_perror("Error writing reply header for %s:%s",
+					wt->path, wt->snapshot_id);
+			close(wt->fd);
+			return NULL;
+		}
+	}
+
+	pthread_mutex_lock(&(rimg->in_use));
+	ret = send_image(wt->fd, rimg, wt->flags, true);
+	if (ret < 0)
+		pr_perror("Unable to send %s:%s to CRIU (sent %ld bytes)",
+				rimg->path, rimg->snapshot_id, (long)ret);
+	else
+		pr_info("Finished sending %s:%s to CRIU (sent %ld bytes)\n",
+				rimg->path, rimg->snapshot_id, (long)ret);
+	pthread_mutex_unlock(&(rimg->in_use));
+	return NULL;
 }
 
 static void *process_local_image_connection(void *ptr)
@@ -532,46 +532,46 @@ static void *process_local_image_connection(void *ptr)
 
 	/* NOTE: the code inside this if is shared for both cache and proxy. */
 	if (wt->flags == O_RDONLY)
-            return process_local_read(wt);
+		return process_local_read(wt);
 
 	/* NOTE: IMAGE PROXY ONLY. The image cache receives write connections
 	 * through TCP (see accept_remote_image_connections).
 	 */
-        rimg = prepare_remote_image(wt->path, wt->snapshot_id, wt->flags);
-        ret = recv_image(wt->fd, rimg, 0, wt->flags, true);
-        if (ret < 0) {
-                pr_perror("Unable to receive %s:%s to CRIU (received %ld bytes)",
-                    rimg->path, rimg->snapshot_id, (long)ret);
-                finalize_recv_rimg(NULL);
-                return NULL;
-        }
-        finalize_recv_rimg(rimg);
-        pr_info("Finished receiving %s:%s (received %ld bytes)\n",
-                rimg->path, rimg->snapshot_id, (long)ret);
-
-
-        if (!strncmp(rimg->path, DUMP_FINISH, sizeof(DUMP_FINISH))) {
-                finished = true;
-                shutdown(local_req_fd, SHUT_RD);
-        } else {
-                pthread_mutex_lock(&proxy_to_cache_lock);
-                ret = forward_image(rimg);
-                pthread_mutex_unlock(&proxy_to_cache_lock);
-        }
-
-        finalize_fwd_rimg();
-        if (ret < 0) {
-            pr_perror("Unable to forward %s:%s to Image Cache",
-                    rimg->path, rimg->snapshot_id);
-
-            return NULL;
-        }
-
-        if (finished && !is_forwarding() && !is_receiving()) {
-            pr_info("Closing connection to Image Cache.\n");
-            close(proxy_to_cache_fd);
-            unlock_workers();
-        }
+	rimg = prepare_remote_image(wt->path, wt->snapshot_id, wt->flags);
+	ret = recv_image(wt->fd, rimg, 0, wt->flags, true);
+	if (ret < 0) {
+		pr_perror("Unable to receive %s:%s to CRIU (received %ld bytes)",
+				rimg->path, rimg->snapshot_id, (long)ret);
+		finalize_recv_rimg(NULL);
+		return NULL;
+	}
+	finalize_recv_rimg(rimg);
+	pr_info("Finished receiving %s:%s (received %ld bytes)\n",
+			rimg->path, rimg->snapshot_id, (long)ret);
+
+
+	if (!strncmp(rimg->path, DUMP_FINISH, sizeof(DUMP_FINISH))) {
+		finished = true;
+		shutdown(local_req_fd, SHUT_RD);
+	} else {
+		pthread_mutex_lock(&proxy_to_cache_lock);
+		ret = forward_image(rimg);
+		pthread_mutex_unlock(&proxy_to_cache_lock);
+	}
+
+	finalize_fwd_rimg();
+	if (ret < 0) {
+		pr_perror("Unable to forward %s:%s to Image Cache",
+				rimg->path, rimg->snapshot_id);
+
+		return NULL;
+	}
+
+	if (finished && !is_forwarding() && !is_receiving()) {
+		pr_info("Closing connection to Image Cache.\n");
+		close(proxy_to_cache_fd);
+		unlock_workers();
+	}
 	return NULL;
 }
 
@@ -726,7 +726,7 @@ int64_t send_image(int fd, struct rimage *rimg, int flags, bool close_fd)
 			} else if (rimg->curr_sent_bytes == rimg->curr_sent_buf->nbytes) {
 				if (close_fd)
 					close(fd);
-			       return nblocks*BUF_SIZE + rimg->curr_sent_buf->nbytes;
+				return nblocks*BUF_SIZE + rimg->curr_sent_buf->nbytes;
 			}
 		} else if (errno == EPIPE || errno == ECONNRESET) {
 			pr_warn("Connection for %s:%s was closed early than expected\n",
diff --git a/criu/mem.c b/criu/mem.c
index 4de0e15..3bcf467 100644
--- a/criu/mem.c
+++ b/criu/mem.c
@@ -59,19 +59,19 @@ int do_task_reset_dirty_track(int pid)
 
 	ret = write(fd, cmd, sizeof(cmd));
 	if (ret < 0) {
-               if (errno == EINVAL) /* No clear-soft-dirty in kernel */
-                       ret = 1;
-               else {
-                       pr_perror("Can't reset %d's dirty memory tracker (%d)", pid, errno);
-                       ret = -1;
-               }
-       } else {
-               pr_info(" ... done\n");
-               ret = 0;
+		if (errno == EINVAL) /* No clear-soft-dirty in kernel */
+			ret = 1;
+		else {
+			pr_perror("Can't reset %d's dirty memory tracker (%d)", pid, errno);
+			ret = -1;
+		}
+	} else {
+		pr_info(" ... done\n");
+		ret = 0;
 	}
 
-       close(fd);
-       return ret;
+	close(fd);
+	return ret;
 }
 
 unsigned long dump_pages_args_size(struct vm_area_list *vmas)
diff --git a/criu/pstree.c b/criu/pstree.c
index 5113544..b21e274 100644
--- a/criu/pstree.c
+++ b/criu/pstree.c
@@ -619,7 +619,7 @@ err:
 	return ret;
 }
 
-#define RESERVED_PIDS           300
+#define RESERVED_PIDS		300
 static int get_free_pid()
 {
 	static struct pid *prev, *next;
diff --git a/criu/sk-netlink.c b/criu/sk-netlink.c
index 1101ee8..82f77ae 100644
--- a/criu/sk-netlink.c
+++ b/criu/sk-netlink.c
@@ -16,10 +16,10 @@
 
 struct netlink_sk_desc {
 	struct socket_desc	sd;
-	u32                     portid;
+	u32			portid;
 	u32			*groups;
 	u32			gsize;
-	u32                     dst_portid;
+	u32			dst_portid;
 	u32			dst_group;
 	u8			state;
 	u8			protocol;
diff --git a/criu/sk-packet.c b/criu/sk-packet.c
index 297877a..b97270f 100644
--- a/criu/sk-packet.c
+++ b/criu/sk-packet.c
@@ -28,10 +28,10 @@ struct packet_sock_info {
 };
 
 struct packet_mreq_max {
-	int             mr_ifindex;
-	unsigned short  mr_type;
-	unsigned short  mr_alen;
-	unsigned char   mr_address[MAX_ADDR_LEN];
+	int		mr_ifindex;
+	unsigned short	mr_type;
+	unsigned short	mr_alen;
+	unsigned char	mr_address[MAX_ADDR_LEN];
 };
 
 struct packet_sock_desc {
diff --git a/criu/util.c b/criu/util.c
index eb3aee7..80e7e99 100644
--- a/criu/util.c
+++ b/criu/util.c
@@ -540,7 +540,8 @@ int copy_file(int fd_in, int fd_out, size_t bytes)
 				goto err;
 			}
 		} else
-                        ret = sendfile(fd_out, fd_in, NULL, chunk);
+			ret = sendfile(fd_out, fd_in, NULL, chunk);
+
 		if (ret < 0) {
 			pr_perror("Can't send data to ghost file");
 			ret = -1;
diff --git a/soccr/soccr.c b/soccr/soccr.c
index 7d093b1..70f9935 100644
--- a/soccr/soccr.c
+++ b/soccr/soccr.c
@@ -16,17 +16,17 @@
 #endif
 
 enum {
-        TCPF_ESTABLISHED = (1 << 1),
-        TCPF_SYN_SENT    = (1 << 2),
-        TCPF_SYN_RECV    = (1 << 3),
-        TCPF_FIN_WAIT1   = (1 << 4),
-        TCPF_FIN_WAIT2   = (1 << 5),
-        TCPF_TIME_WAIT   = (1 << 6),
-        TCPF_CLOSE       = (1 << 7),
-        TCPF_CLOSE_WAIT  = (1 << 8),
-        TCPF_LAST_ACK    = (1 << 9),
-        TCPF_LISTEN      = (1 << 10),
-        TCPF_CLOSING     = (1 << 11),
+	TCPF_ESTABLISHED = (1 << 1),
+	TCPF_SYN_SENT    = (1 << 2),
+	TCPF_SYN_RECV    = (1 << 3),
+	TCPF_FIN_WAIT1   = (1 << 4),
+	TCPF_FIN_WAIT2   = (1 << 5),
+	TCPF_TIME_WAIT   = (1 << 6),
+	TCPF_CLOSE       = (1 << 7),
+	TCPF_CLOSE_WAIT  = (1 << 8),
+	TCPF_LAST_ACK    = (1 << 9),
+	TCPF_LISTEN      = (1 << 10),
+	TCPF_CLOSING     = (1 << 11),
 };
 
 /*
@@ -561,9 +561,9 @@ static int send_fin(struct libsoccr_sk *sk, struct libsoccr_sk_data *data,
 		libnet_type = LIBNET_RAW4;
 
 	l = libnet_init(
-		libnet_type,                            /* injection type */
-		NULL,                                   /* network interface */
-		errbuf);                                /* errbuf */
+		libnet_type,		/* injection type */
+		NULL,			/* network interface */
+		errbuf);		/* errbuf */
 	if (l == NULL)
 		return -1;
 
-- 
2.9.3



More information about the CRIU mailing list