[Devel] [PATCH 02/22] Add format and message buffers to ctx and make err_str bigger

serue at us.ibm.com serue at us.ibm.com
Fri Oct 30 16:00:24 PDT 2009


From: Serge E. Hallyn <serue at us.ibm.com>

Signed-off-by: Serge E. Hallyn <serue at us.ibm.com>
---
 checkpoint/sys.c                 |    5 +++++
 include/linux/checkpoint_types.h |   18 +++++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/checkpoint/sys.c b/checkpoint/sys.c
index c888a12..0a486f0 100644
--- a/checkpoint/sys.c
+++ b/checkpoint/sys.c
@@ -249,6 +249,11 @@ static struct ckpt_ctx *ckpt_ctx_alloc(int fd, unsigned long uflags,
 	spin_lock_init(&ctx->lock);
 #endif
 
+	mutex_init(&ctx->msg_buf_mutex);
+	spin_lock_init(&ctx->err_string_lock);
+	spin_lock_init(&ctx->fmt_buf_lock);
+	ctx->err_string_len = 0;
+
 	err = -EBADF;
 	ctx->file = fget(fd);
 	if (!ctx->file)
diff --git a/include/linux/checkpoint_types.h b/include/linux/checkpoint_types.h
index 5cc11d9..46c58fb 100644
--- a/include/linux/checkpoint_types.h
+++ b/include/linux/checkpoint_types.h
@@ -59,7 +59,6 @@ struct ckpt_ctx {
 	struct path fs_mnt;     /* container root (FIXME) */
 
 	struct task_struct *tsk;/* checkpoint: current target task */
-	char err_string[256];	/* checkpoint: error string */
 	int errno;		/* restart: errno that caused failure */
 
 	struct list_head pgarr_list;	/* page array to dump VMA contents */
@@ -85,6 +84,23 @@ struct ckpt_ctx {
 	struct list_head task_status;   /* list of status for each task */
 	spinlock_t lock;
 #endif
+
+#define CKPT_MSG_BUFSZ 1024
+	/* err_string holds specific checkpoint error strings which may
+	 * be crafted in a context where we can't write it out yet */
+	char err_string[CKPT_MSG_BUFSZ];
+	spinlock_t err_string_lock;
+	int err_string_len;
+
+	/* fmt_buf holds the result of processing an enhanced format
+	 * string for use in crafting msg_buf */
+	char fmt_buf[CKPT_MSG_BUFSZ];
+	spinlock_t fmt_buf_lock;
+
+	/* msg_buf holds messages for writing to user log and syslog */
+	char msg_buf[CKPT_MSG_BUFSZ];
+	int msg_buf_len;
+	struct mutex msg_buf_mutex;
 };
 
 #endif /* __KERNEL__ */
-- 
1.6.1

_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list