Linux Container Development
 help / color / mirror / Atom feed
From: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
To: Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
Cc: Containers
	<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
Subject: [RFC][PATCH 3/6][usercr] Minor reorg of restart.c
Date: Tue, 13 Apr 2010 17:52:41 -0700	[thread overview]
Message-ID: <20100414005241.GC13532@us.ibm.com> (raw)
In-Reply-To: <20100414004927.GA13012-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>


From: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Date: Tue, 13 Apr 2010 12:34:28 -0700
Subject: [RFC][PATCH 3/6][usercr] Minor reorg of restart.c

Just a minor reorg to group global variables, declarations, system-call
wrappers and helper functions together. A follow-on patch will combine
the checkpoint and restart functionality into one file and this reorg
would help keep related code together.

Signed-off-by: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
---
 restart.c |   43 +++++++++++++++++++++----------------------
 1 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/restart.c b/restart.c
index c98d377..11628e0 100644
--- a/restart.c
+++ b/restart.c
@@ -68,24 +68,6 @@
  * of the checkpoint image stream.
  */
 
-static struct signal_array signal_array[] = INIT_SIGNAL_ARRAY;
-
-static char *sig2str(int sig)
-{
-	int i = 0;
-
-	do {
-		if (signal_array[i].signum == sig)
-			return signal_array[i].sigstr;
-	} while (signal_array[++i].signum >= 0);
-	return "UNKNOWN SIGNAL";
-}
-
-inline static int restart(pid_t pid, int fd, unsigned long flags, int klogfd)
-{
-	return syscall(__NR_restart, pid, fd, flags, klogfd);
-}
-
 struct hashent {
 	long key;
 	void *data;
@@ -167,6 +149,11 @@ struct ckpt_ctx {
 	char *freezer;
 };
 
+struct pid_swap {
+	pid_t old;
+	pid_t new;
+};
+
 /*
  * TODO: Do we need to direct user-space restart messages to two different
  * 	 fds (like stdout and stderr) or can we just use one ?
@@ -179,6 +166,7 @@ static pid_t global_child_pid;
 static int global_child_status;
 static int global_child_collected;
 static int global_sent_sigint;
+static struct signal_array signal_array[] = INIT_SIGNAL_ARRAY;
 
 /*
  * TODO: Implement an API to let callers choose if/how an interrupt be sent
@@ -244,10 +232,10 @@ static inline pid_t _getpid(void)
 	return syscall(__NR_getpid);
 }
 
-struct pid_swap {
-	pid_t old;
-	pid_t new;
-};
+static inline int restart(pid_t pid, int fd, unsigned long flags, int klogfd)
+{
+	return syscall(__NR_restart, pid, fd, flags, klogfd);
+}
 
 static inline int ckpt_cond_warn(struct ckpt_ctx *ctx, long mask)
 {
@@ -276,6 +264,17 @@ static void report_exit_status(int status, char *str, int debug)
 		ckpt_err("%s\n", msg);
 }
 
+static char *sig2str(int sig)
+{
+	int i = 0;
+
+	do {
+		if (signal_array[i].signum == sig)
+			return signal_array[i].sigstr;
+	} while (signal_array[++i].signum >= 0);
+	return "UNKNOWN SIGNAL";
+}
+
 static void sigchld_handler(int sig)
 {
 	int collected = 0;
-- 
1.6.6.1

  parent reply	other threads:[~2010-04-14  0:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-14  0:49 [RFC][PATCH 0/6][usercr]: Rename/reorg usercr code Sukadev Bhattiprolu
     [not found] ` <20100414004927.GA13012-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-04-14  0:52   ` [RFC][PATCH 1/6][usercr] Change API prefix to cr_ Sukadev Bhattiprolu
2010-04-14  0:52   ` [RFC][PATCH 2/6][usercr] Remove flags parameter to cr_checkpoint() Sukadev Bhattiprolu
2010-04-14  0:52   ` Sukadev Bhattiprolu [this message]
2010-04-14  0:52   ` [RFC][PATCH 4/6][usercr] Move checkpoint() into restart.c Sukadev Bhattiprolu
2010-04-14  0:53   ` [RFC][PATCH 5/6][usercr] Rename restart.c to cr_checkpoint.c Sukadev Bhattiprolu
2010-04-14  0:53   ` [RFC][PATCH 6/6][usercr] Rename common.h to cr_log.h Sukadev Bhattiprolu
2010-04-20 18:07   ` [RFC][PATCH 0/6][usercr]: Rename/reorg usercr code Sukadev Bhattiprolu
     [not found]     ` <20100420180733.GA13874-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-04-25 20:24       ` Oren Laadan
     [not found]         ` <4BD4A501.6070106-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2010-04-26 17:16           ` Sukadev Bhattiprolu
     [not found]             ` <20100426171603.GB27542-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-04-26 18:46               ` Oren Laadan
2010-06-14 21:31           ` Oren Laadan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100414005241.GC13532@us.ibm.com \
    --to=sukadev-23vcf4htsmix0ybbhkvfkdbpr1lh4cv8@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox