[CRIU] [PATCH 3/6] protobuf: use generic show function for creds

Kinsbursky Stanislav skinsbursky at openvz.org
Wed Jul 25 08:06:25 EDT 2012


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

---
 cr-show.c |   32 +-------------------------------
 1 files changed, 1 insertions(+), 31 deletions(-)

diff --git a/cr-show.c b/cr-show.c
index 298ab6d..60562c5 100644
--- a/cr-show.c
+++ b/cr-show.c
@@ -241,39 +241,9 @@ out:
 	pr_img_tail(CR_FD_ITIMERS);
 }
 
-static void show_cap(char *name, int nr, uint32_t *v)
-{
-	int i;
-
-	pr_msg("%s: ", name);
-	for (i = nr - 1; i >= 0; i--)
-		pr_msg("0x%08x", v[i]);
-	pr_msg("\n");
-}
-
 void show_creds(int fd, struct cr_options *o)
 {
-	CredsEntry *ce;
-
-	pr_img_head(CR_FD_CREDS);
-	if (pb_read(fd, &ce, creds_entry) < 0)
-		goto out;
-
-	pr_msg("uid %u  euid %u  suid %u  fsuid %u\n",
-	       ce->uid, ce->euid, ce->suid, ce->fsuid);
-	pr_msg("gid %u  egid %u  sgid %u  fsgid %u\n",
-	       ce->gid, ce->egid, ce->sgid, ce->fsgid);
-
-	show_cap("Inh", ce->n_cap_inh, ce->cap_inh);
-	show_cap("Eff", ce->n_cap_eff, ce->cap_eff);
-	show_cap("Prm", ce->n_cap_prm, ce->cap_prm);
-	show_cap("Bnd", ce->n_cap_bnd, ce->cap_bnd);
-
-	pr_msg("secbits: %#x\n", ce->secbits);
-
-	creds_entry__free_unpacked(ce, NULL);
-out:
-	pr_img_tail(CR_FD_CREDS);
+	pb_show_vertical(fd, creds_entry);
 }
 
 static int show_collect_pstree(int fd_pstree, struct list_head *collect)



More information about the CRIU mailing list