[CRIU] [PATCH] protobuf: add [(criu).hex = true] for masks, flags, etc

Andrew Vagin avagin at parallels.com
Thu Jan 22 06:14:26 PST 2015


On Thu, Jan 22, 2015 at 04:54:48PM +0300, Pavel Emelyanov wrote:
> On 01/22/2015 04:45 PM, Andrey Vagin wrote:
> 
> Aren't flags seen better as %o instead of %x?

It's true only for O_* (O_RDONLY, O_RDWR, etc).

And even they look better in hex;)

> 
> > Signed-off-by: Andrey Vagin <avagin at openvz.org>
> > ---
> >  protobuf/fsnotify.proto    | 19 ++++++++++---------
> >  protobuf/mnt.proto         |  4 +++-
> >  protobuf/netdev.proto      |  3 ++-
> >  protobuf/packet-sock.proto |  3 ++-
> >  protobuf/pagemap.proto     |  4 +++-
> >  protobuf/pipe.proto        |  3 ++-
> >  protobuf/regfile.proto     |  3 ++-
> >  protobuf/sa.proto          | 10 ++++++----
> >  protobuf/signalfd.proto    |  5 +++--
> >  protobuf/sk-inet.proto     |  3 ++-
> >  protobuf/sk-netlink.proto  |  3 ++-
> >  protobuf/sk-unix.proto     |  5 +++--
> >  protobuf/tcp-stream.proto  |  4 +++-
> >  protobuf/timerfd.proto     |  5 +++--
> >  protobuf/tty.proto         |  3 ++-
> >  protobuf/tun.proto         |  3 ++-
> >  protobuf/vma.proto         | 14 ++++++++------
> >  17 files changed, 58 insertions(+), 36 deletions(-)
> > 
> > diff --git a/protobuf/fsnotify.proto b/protobuf/fsnotify.proto
> > index 871f1de..f083560 100644
> > --- a/protobuf/fsnotify.proto
> > +++ b/protobuf/fsnotify.proto
> > @@ -1,11 +1,12 @@
> > +import "opts.proto";
> >  import "fh.proto";
> >  import "fown.proto";
> >  
> >  message inotify_wd_entry {
> >  	required uint32		id		= 1;
> >  	required uint64		i_ino		= 2;
> > -	required uint32		mask		= 3;
> > -	required uint32		ignored_mask	= 4;
> > +	required uint32		mask		= 3 [(criu).hex = true];
> > +	required uint32		ignored_mask	= 4 [(criu).hex = true];
> >  	required uint32		s_dev		= 5;
> >  	required uint32		wd		= 6;
> >  	required fh_entry	f_handle	= 7;
> > @@ -13,7 +14,7 @@ message inotify_wd_entry {
> >  
> >  message inotify_file_entry {
> >  	required uint32		id		= 1;
> > -	required uint32		flags		= 2;
> > +	required uint32		flags		= 2 [(criu).hex = true];
> >  	required fown_entry	fown		= 4;
> >  	repeated inotify_wd_entry wd		= 5;
> >  }
> > @@ -36,9 +37,9 @@ message fanotify_mark_entry {
> >  	required uint32		id		= 1;
> >  	required mark_type	type		= 2;
> >  
> > -	required uint32		mflags		= 3;
> > -	required uint32		mask		= 4;
> > -	required uint32		ignored_mask	= 5;
> > +	required uint32		mflags		= 3 [(criu).hex = true];
> > +	required uint32		mask		= 4 [(criu).hex = true];
> > +	required uint32		ignored_mask	= 5 [(criu).hex = true];
> >  	required uint32		s_dev		= 6;
> >  
> >  	optional fanotify_inode_mark_entry ie	= 7;
> > @@ -47,10 +48,10 @@ message fanotify_mark_entry {
> >  
> >  message fanotify_file_entry {
> >  	required uint32		id		= 1;
> > -	required uint32		flags		= 2;
> > +	required uint32		flags		= 2 [(criu).hex = true];
> >  	required fown_entry	fown		= 3;
> >  
> > -	required uint32		faflags		= 4;
> > -	required uint32		evflags		= 5;
> > +	required uint32		faflags		= 4 [(criu).hex = true];
> > +	required uint32		evflags		= 5 [(criu).hex = true];
> >  	repeated fanotify_mark_entry mark	= 6;
> >  }
> > diff --git a/protobuf/mnt.proto b/protobuf/mnt.proto
> > index 99aa535..343bd6d 100644
> > --- a/protobuf/mnt.proto
> > +++ b/protobuf/mnt.proto
> > @@ -1,3 +1,5 @@
> > +import "opts.proto";
> > +
> >  enum fstype {
> >  	UNSUPPORTED		= 0;
> >  	PROC			= 1;
> > @@ -21,7 +23,7 @@ message mnt_entry {
> >  	required uint32		mnt_id			= 2;
> >  	required uint32		root_dev		= 3;
> >  	required uint32		parent_mnt_id		= 4;
> > -	required uint32		flags			= 5;
> > +	required uint32		flags			= 5 [(criu).hex = true];
> >  
> >  	required string		root			= 6;
> >  	required string		mountpoint		= 7;
> > diff --git a/protobuf/netdev.proto b/protobuf/netdev.proto
> > index 4fa23d3..4410a4a 100644
> > --- a/protobuf/netdev.proto
> > +++ b/protobuf/netdev.proto
> > @@ -1,3 +1,4 @@
> > +import "opts.proto";
> >  import "tun.proto";
> >  
> >  enum nd_type {
> > @@ -17,7 +18,7 @@ message net_device_entry {
> >  	required nd_type type		= 1;
> >  	required uint32  ifindex	= 2;
> >  	required uint32  mtu		= 3;
> > -	required uint32  flags		= 4;
> > +	required uint32  flags		= 4 [(criu).hex = true];
> >  	required string  name		= 5;
> >  
> >  	optional tun_link_entry tun	= 6;
> > diff --git a/protobuf/packet-sock.proto b/protobuf/packet-sock.proto
> > index 058306f..745ecf8 100644
> > --- a/protobuf/packet-sock.proto
> > +++ b/protobuf/packet-sock.proto
> > @@ -1,3 +1,4 @@
> > +import "opts.proto";
> >  import "fown.proto";
> >  import "sk-opts.proto";
> >  
> > @@ -22,7 +23,7 @@ message packet_sock_entry {
> >  	required uint32		id		= 1;
> >  	required uint32		type		= 2;
> >  	required uint32		protocol	= 3;
> > -	required uint32		flags		= 4;
> > +	required uint32		flags		= 4 [(criu).hex = true];
> >  	required uint32		ifindex		= 5;
> >  
> >  	required fown_entry	fown		= 6;
> > diff --git a/protobuf/pagemap.proto b/protobuf/pagemap.proto
> > index a6fcd4d..b492488 100644
> > --- a/protobuf/pagemap.proto
> > +++ b/protobuf/pagemap.proto
> > @@ -1,9 +1,11 @@
> > +import "opts.proto";
> > +
> >  message pagemap_head {
> >  	required uint32 pages_id	= 1;
> >  }
> >  
> >  message pagemap_entry {
> > -	required uint64 vaddr		= 1;
> > +	required uint64 vaddr		= 1 [(criu).hex = true];
> >  	required uint32 nr_pages	= 2;
> >  	optional bool	in_parent	= 3;
> >  }
> > diff --git a/protobuf/pipe.proto b/protobuf/pipe.proto
> > index 675edbc..d374430 100644
> > --- a/protobuf/pipe.proto
> > +++ b/protobuf/pipe.proto
> > @@ -1,8 +1,9 @@
> > +import "opts.proto";
> >  import "fown.proto";
> >  
> >  message pipe_entry {
> >  	required uint32		id		= 1;
> >  	required uint32		pipe_id		= 2;
> > -	required uint32		flags		= 3;
> > +	required uint32		flags		= 3 [(criu).hex = true];
> >  	required fown_entry	fown		= 4;
> >  }
> > diff --git a/protobuf/regfile.proto b/protobuf/regfile.proto
> > index 46bec72..fc5e4b5 100644
> > --- a/protobuf/regfile.proto
> > +++ b/protobuf/regfile.proto
> > @@ -1,8 +1,9 @@
> > +import "opts.proto";
> >  import "fown.proto";
> >  
> >  message reg_file_entry {
> >  	required uint32		id	= 1;
> > -	required uint32		flags	= 2;
> > +	required uint32		flags	= 2 [(criu).hex = true];
> >  	required uint64		pos	= 3;
> >  	required fown_entry	fown	= 5;
> >  	required string		name	= 6;
> > diff --git a/protobuf/sa.proto b/protobuf/sa.proto
> > index d5e5a49..e509910 100644
> > --- a/protobuf/sa.proto
> > +++ b/protobuf/sa.proto
> > @@ -1,6 +1,8 @@
> > +import "opts.proto";
> > +
> >  message sa_entry {
> > -	required uint64	sigaction	= 1;
> > -	required uint64	flags		= 2;
> > -	required uint64	restorer	= 3;
> > -	required uint64	mask		= 4;
> > +	required uint64	sigaction	= 1 [(criu).hex = true];
> > +	required uint64	flags		= 2 [(criu).hex = true];
> > +	required uint64	restorer	= 3 [(criu).hex = true];
> > +	required uint64	mask		= 4 [(criu).hex = true];
> >  }
> > diff --git a/protobuf/signalfd.proto b/protobuf/signalfd.proto
> > index 55372f8..0af2159 100644
> > --- a/protobuf/signalfd.proto
> > +++ b/protobuf/signalfd.proto
> > @@ -1,8 +1,9 @@
> > +import "opts.proto";
> >  import "fown.proto";
> >  
> >  message signalfd_entry {
> >  	required uint32		id		= 1;
> > -	required uint32		flags		= 2;
> > +	required uint32		flags		= 2 [(criu).hex = true];
> >  	required fown_entry	fown		= 3;
> > -	required uint64		sigmask		= 4;
> > +	required uint64		sigmask		= 4 [(criu).hex = true];
> >  };
> > diff --git a/protobuf/sk-inet.proto b/protobuf/sk-inet.proto
> > index dd7064b..fa4d16e 100644
> > --- a/protobuf/sk-inet.proto
> > +++ b/protobuf/sk-inet.proto
> > @@ -1,3 +1,4 @@
> > +import "opts.proto";
> >  import "fown.proto";
> >  import "sk-opts.proto";
> >  
> > @@ -18,7 +19,7 @@ message inet_sk_entry {
> >  	required uint32			state		=  6;
> >  	required uint32			src_port	=  7;
> >  	required uint32			dst_port	=  8;
> > -	required uint32			flags		=  9;
> > +	required uint32			flags		=  9 [(criu).hex = true];
> >  	required uint32			backlog		= 10;
> >  
> >  	repeated uint32			src_addr	= 11;
> > diff --git a/protobuf/sk-netlink.proto b/protobuf/sk-netlink.proto
> > index 593848b..bca533c 100644
> > --- a/protobuf/sk-netlink.proto
> > +++ b/protobuf/sk-netlink.proto
> > @@ -1,3 +1,4 @@
> > +import "opts.proto";
> >  import "fown.proto";
> >  import "sk-opts.proto";
> >  
> > @@ -6,7 +7,7 @@ message netlink_sk_entry {
> >  	required uint32			ino		=  2;
> >  	required uint32			protocol	=  3;
> >  	required uint32			state		=  4;
> > -	required uint32			flags		=  6;
> > +	required uint32			flags		=  6 [(criu).hex = true];
> >  	required uint32			portid		=  7;
> >  	repeated uint32			groups		=  8;
> >  	required uint32			dst_portid	=  9;
> > diff --git a/protobuf/sk-unix.proto b/protobuf/sk-unix.proto
> > index bbe2588..7dd0765 100644
> > --- a/protobuf/sk-unix.proto
> > +++ b/protobuf/sk-unix.proto
> > @@ -1,3 +1,4 @@
> > +import "opts.proto";
> >  import "fown.proto";
> >  import "sk-opts.proto";
> >  
> > @@ -23,8 +24,8 @@ message unix_sk_entry {
> >  	required uint32			ino		=  2;
> >  	required uint32			type		=  3;
> >  	required uint32			state		=  4;
> > -	required uint32			flags		=  5;
> > -	required uint32			uflags		=  6;
> > +	required uint32			flags		=  5 [(criu).hex = true];
> > +	required uint32			uflags		=  6 [(criu).hex = true];
> >  	required uint32			backlog		=  7;
> >  	required uint32			peer		=  8;
> >  	required fown_entry		fown		=  9;
> > diff --git a/protobuf/tcp-stream.proto b/protobuf/tcp-stream.proto
> > index a2db026..59c053e 100644
> > --- a/protobuf/tcp-stream.proto
> > +++ b/protobuf/tcp-stream.proto
> > @@ -1,10 +1,12 @@
> > +import "opts.proto";
> > +
> >  message tcp_stream_entry {
> >  	required uint32		inq_len		= 1;
> >  	required uint32		inq_seq		= 2;
> >  	required uint32		outq_len	= 3; /* unsent and sent data in the send queue*/
> >  	required uint32		outq_seq	= 4;
> >  
> > -	required uint32		opt_mask	= 5; /* TCPI_OPT_ bits */
> > +	required uint32		opt_mask	= 5 [(criu).hex = true]; /* TCPI_OPT_ bits */
> >  	required uint32		snd_wscale	= 6;
> >  	required uint32		mss_clamp	= 7;
> >  	optional uint32		rcv_wscale	= 8;
> > diff --git a/protobuf/timerfd.proto b/protobuf/timerfd.proto
> > index b279952..9e3ba67 100644
> > --- a/protobuf/timerfd.proto
> > +++ b/protobuf/timerfd.proto
> > @@ -1,13 +1,14 @@
> > +import "opts.proto";
> >  import "fown.proto";
> >  
> >  message timerfd_entry {
> >  	required uint32		id		= 1;
> > -	required uint32		flags		= 2;
> > +	required uint32		flags		= 2 [(criu).hex = true];
> >  	required fown_entry	fown		= 3;
> >  
> >  	required uint32		clockid		= 4;
> >  	required uint64		ticks		= 5;
> > -	required uint32		settime_flags	= 6;
> > +	required uint32		settime_flags	= 6 [(criu).hex = true];
> >  
> >  	required uint64		vsec		= 7;
> >  	required uint64		vnsec		= 8;
> > diff --git a/protobuf/tty.proto b/protobuf/tty.proto
> > index 0e67e85..d4afe06 100644
> > --- a/protobuf/tty.proto
> > +++ b/protobuf/tty.proto
> > @@ -1,3 +1,4 @@
> > +import "opts.proto";
> >  import "fown.proto";
> >  
> >  message winsize_entry {
> > @@ -64,6 +65,6 @@ message tty_file_entry {
> >  	required uint32			id		= 1;
> >  	required uint32			tty_info_id	= 2;
> >  
> > -	required uint32			flags		= 3;
> > +	required uint32			flags		= 3 [(criu).hex = true];
> >  	required fown_entry		fown		= 4;
> >  }
> > diff --git a/protobuf/tun.proto b/protobuf/tun.proto
> > index 554a7d9..3d8a927 100644
> > --- a/protobuf/tun.proto
> > +++ b/protobuf/tun.proto
> > @@ -1,3 +1,4 @@
> > +import "opts.proto";
> >  import "fown.proto";
> >  
> >  message tunfile_entry {
> > @@ -7,7 +8,7 @@ message tunfile_entry {
> >  };
> >  
> >  message tun_link_entry {
> > -	required uint32		flags		= 1;
> > +	required uint32		flags		= 1 [(criu).hex = true];
> >  	required int32		owner		= 2;
> >  	required int32		group		= 3;
> >  	required uint32		vnethdr		= 4;
> > diff --git a/protobuf/vma.proto b/protobuf/vma.proto
> > index af88807..b4ff578 100644
> > --- a/protobuf/vma.proto
> > +++ b/protobuf/vma.proto
> > @@ -1,10 +1,12 @@
> > +import "opts.proto";
> > +
> >  message vma_entry {
> > -	required uint64		start	= 1;
> > -	required uint64		end	= 2;
> > +	required uint64		start	= 1 [(criu).hex = true];
> > +	required uint64		end	= 2 [(criu).hex = true];
> >  	required uint64		pgoff	= 3;
> >  	required uint64		shmid	= 4;
> > -	required uint32		prot	= 5;
> > -	required uint32		flags	= 6;
> > +	required uint32		prot	= 5 [(criu).hex = true];
> > +	required uint32		flags	= 6 [(criu).hex = true];
> >  	required uint32		status	= 7;
> >  	/*
> >  	 * This fd thing is unused in the image, it was lost
> > @@ -14,8 +16,8 @@ message vma_entry {
> >  	required sint64		fd	= 8;
> >  
> >  	/* madvise flags bitmap */
> > -	optional uint64		madv	= 9;
> > +	optional uint64		madv	= 9 [(criu).hex = true];
> >  
> >  	/* file status flags */
> > -	optional uint32		fdflags	= 10;
> > +	optional uint32		fdflags	= 10 [(criu).hex = true];
> >  }
> > 
> 


More information about the CRIU mailing list