[CRIU] [PATCH 7/8] files: add ability to set callbacks for character devices

Andrew Vagin avagin at parallels.com
Tue Dec 10 10:00:21 PST 2013


On Tue, Dec 10, 2013 at 11:44:56AM -0500, Christopher Covington wrote:
> Hi Andrey,
> 
> On 12/10/2013 11:26 AM, Andrey Vagin wrote:
> > The difference in compare with unix sockets is that dump callbacks
> > for character devices can be executed to test, which callback can be
> > used for a given fd.
> [...]
> > --- a/files.c
> > +++ b/files.c
> > @@ -39,6 +39,8 @@
> >  #include "protobuf.h"
> >  #include "protobuf/fs.pb-c.h"
> >  
> > +#include "plugin.h"
> > +
> >  #define FDESC_HASH_SIZE	64
> >  static struct hlist_head file_desc_hash[FDESC_HASH_SIZE];
> >  
> > @@ -276,7 +278,19 @@ static int dump_chrdev(struct fd_parms *p, int lfd, const int fdinfo)
> >  			break;
> >  		/* fallthrough */
> >  	default: {
> > +		cr_plugin_dump_file_t *cb;
> >  		char more[32];
> > +		int ret;
> > +
> > +		ret = cr_plugin_dump_file(lfd, 0, true, &cb);
> > +		if (ret < 0 && ret != CRIU_CB_SKIP)
> > +			return -1;
> > +
> > +		if (ret == 0) {
> > +			p->cb = cb;
> > +			ops = &regfile_dump_ops;
> > +			break;
> > +		}
> >  
> >  		sprintf(more, "%d:%d", maj, minor(p->stat.st_dev));
> >  		return dump_unsupp_fd(p, "chr", more);
> 
> Could calling the callback be done in dump_unsupp_fd, allowing all file types,
> rather than just character devices, to be handled by callbacks? (I'm
> particularly interested in special handling of perf event file descriptors.)

Looks like we can. Thanks. I'm going to send a new version tomorrow.

Thanks,
Andrew

> 
> Thanks,
> Christopher
> 
> -- 
> Employee of Qualcomm Innovation Center, Inc.
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> hosted by the Linux Foundation.


More information about the CRIU mailing list