[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH V6 2/7] libxl_read_file_contents: add new entry to read sysfs file



On Tue, Aug 11, 2015 at 08:37:09PM -0600, Chun Yan Liu wrote:
[...]
> > > + 
> > > +        if (rs < datalen) { 
> > > +            if (ferror(f)) { 
> > >                  LOGE(ERROR, "failed to read %s", filename); 
> > > -            else if (feof(f)) 
> > > -                LOG(ERROR, "%s changed size while we were reading it", 
> > > -             filename); 
> > > -            else 
> > > +                goto xe; 
> > > +            } else if (feof(f)) { 
> > > +                if (tolerate_shrinking_file) { 
> > > +                    datalen = rs; 
> > > +                } else { 
> > > +                    LOG(ERROR, "%s shrunk size while we were reading 
> > > it", 
> > > +                        filename); 
> > > +                    goto xe; 
> > > +                } 
> > > +            } else { 
> > >                  abort(); 
> > > -            goto xe; 
> > > +            } 
> >  
> > This is a bit bikeshedding, but you can leave "goto xe" out of two `if' 
> > to reduce patch size. 
> 
> I guess you mean if (ferror(f)) and if (feof(f)) ? We can't leave 'goto xe' 
> outside,
> since in if (feof(f)) && if (tolerate_shrinking_file), it's not error but an 
> expected
> result in sysfs case.   
> 

Oh, right. I missed that tolerate_shrinking_file check. Sorry for the
noise.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.