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

Re: [Xen-devel] [PATCH V3 2/6] libxl_read_file_contents: fix reading sysfs file

Chunyan Liu writes ("[PATCH V3 2/6] libxl_read_file_contents: fix reading sysfs 
> Sysfs file has size=4096 but actual file content is less than that.


Is there any danger that the actual size might be >4096 ?

> Current libxl_read_file_contents will treat it as error when file size
> and actual file content differs, so reading sysfs file content with
> this function always fails. Fix it so that we can reuse this function
> to get sysfs file content in later pvusb work.

I'm uncomfortable with removing an error check from this function for
all its call sites.

I think, sadly, that we are going to need a new function - at least, a
new entrypoint.

We don't want to repeat the whole of libxl__read_file_contents.

Perhaps the bulk should be made into libxl__read_file_contents_core
which takes a boolean instructing whether to tolerate magically
shrinking files ?

Setting that boolean probably ought to arrange to insist that the
function gets eof, in case the file is actually bigger rather than
smaller than the size.

Ian, Wei ?


Xen-devel mailing list



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