[CRIU] [PATCH 4/4] protobuf: use generic show function for ipc namespace variables

Kinsbursky Stanislav skinsbursky at openvz.org
Thu Jul 26 04:44:52 EDT 2012


Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>

---
 image.c  |    6 +++---
 ipc_ns.c |   17 +----------------
 2 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/image.c b/image.c
index b4dd7b4..f03ba8b 100644
--- a/image.c
+++ b/image.c
@@ -109,9 +109,9 @@ struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX] = {
 	FD_ENTRY(CREDS,		"creds-%d",	 show_creds), //+
 	FD_ENTRY(UTSNS,		"utsns-%d",	 show_utsns), //+
 	FD_ENTRY(IPCNS_VAR,	"ipcns-var-%d",	 show_ipc_var), //TODO
-	FD_ENTRY(IPCNS_SHM,	"ipcns-shm-%d",	 show_ipc_shm), //TODO
-	FD_ENTRY(IPCNS_MSG,	"ipcns-msg-%d",	 show_ipc_msg), //TODO
-	FD_ENTRY(IPCNS_SEM,	"ipcns-sem-%d",	 show_ipc_sem), //TODO
+	FD_ENTRY(IPCNS_SHM,	"ipcns-shm-%d",	 show_ipc_shm), //+
+	FD_ENTRY(IPCNS_MSG,	"ipcns-msg-%d",	 show_ipc_msg), //+
+	FD_ENTRY(IPCNS_SEM,	"ipcns-sem-%d",	 show_ipc_sem), //+
 	FD_ENTRY(FS,		"fs-%d",	 show_fs), //+
 	FD_ENTRY(REMAP_FPATH,	"remap-fpath",	 show_remap_files), //+
 	FD_ENTRY(GHOST_FILE,	"ghost-file-%x", show_ghost_file), //+
diff --git a/ipc_ns.c b/ipc_ns.c
index ada4063..f35852c 100644
--- a/ipc_ns.c
+++ b/ipc_ns.c
@@ -534,24 +534,9 @@ void show_ipc_shm(int fd, struct cr_options *o)
 				o->show_pages_content);
 }
 
-static void show_ipc_var_entry(int fd)
-{
-	int ret;
-	IpcVarEntry *var;
-
-	ret = pb_read_eof(fd, &var, ipc_var_entry);
-	if (ret <= 0)
-		return;
-	ipc_sysctl_req(var, CTL_SHOW);
-
-	ipc_var_entry__free_unpacked(var, NULL);
-}
-
 void show_ipc_var(int fd, struct cr_options *o)
 {
-	pr_img_head(CR_FD_IPCNS);
-	show_ipc_var_entry(fd);
-	pr_img_tail(CR_FD_IPCNS);
+	pb_show_vertical(fd, ipc_var_entry);
 }
 
 static int prepare_ipc_sem_values(int fd, const IpcSemEntry *entry)



More information about the CRIU mailing list