[CRIU] [PATCH 2/2] sk-unix: protobuf -- Use string type instead of bytestream

Cyrill Gorcunov gorcunov at openvz.org
Wed Jul 29 08:17:53 PDT 2015


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 protobuf/sk-unix.proto | 2 +-
 sk-unix.c              | 8 ++------
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/protobuf/sk-unix.proto b/protobuf/sk-unix.proto
index e2b5c6806138..aa2bcf7e109c 100644
--- a/protobuf/sk-unix.proto
+++ b/protobuf/sk-unix.proto
@@ -44,5 +44,5 @@ message unix_sk_entry {
 	/*
 	 * Relative socket name may have prefix.
 	 */
-	optional bytes			name_dir	= 14;
+	optional string			name_dir	= 14;
 }
diff --git a/sk-unix.c b/sk-unix.c
index 629557c4b433..75513e5725cb 100644
--- a/sk-unix.c
+++ b/sk-unix.c
@@ -294,9 +294,7 @@ static int dump_one_unix_fd(int lfd, u32 id, const struct fd_parms *p)
 	if (sk->rel_name) {
 		if (resolve_rel_name(sk, p))
 			goto err;
-		ue->has_name_dir = true;
-		ue->name_dir.len  = (size_t)strlen(sk->rel_name->dir) + 1;
-		ue->name_dir.data = (void *)sk->rel_name->dir;
+		ue->name_dir = sk->rel_name->dir;
 	}
 
 	/*
@@ -1199,9 +1197,7 @@ static int collect_one_unixsk(void *o, ProtobufCMessage *base)
 	struct unix_sk_info *ui = o;
 
 	ui->ue = pb_msg(base, UnixSkEntry);
-
-	if (ui->ue->has_name_dir)
-		ui->name_dir = (void *)ui->ue->name_dir.data;
+	ui->name_dir = (void *)ui->ue->name_dir;
 
 	if (ui->ue->name.len) {
 		if (ui->ue->name.len >= UNIX_PATH_MAX) {
-- 
2.4.3



More information about the CRIU mailing list