K 10 svn:author V 7 asomers K 8 svn:date V 27 2013-10-11T21:24:33.625300Z K 7 svn:log V 1566 Miscellaneous bug fixes in zfsd * Created a new abstract Reader class that provides a common interface to read from both file descriptors and std:istreams, implemented as separate derived classes FDReader and IstreamReader. Changed EventBuffer to get its input from a Reader. Changed CaseFile::DeSerializeFile to open case files as ifstreams instead of as file descriptors. * Eliminated ZFSDaemon::ConnectToDevd's call to set the socket to nonblocking mode. Instead, use an API that never attempts to read more data than is available. EventBuffer::Fill() no longer ignore EAGAIN, which shouldn't happen now that the socket blocks. * Fix two file leaks * Fix file leak in CaseFile::Serialize(): open() without close() * Fix potential file leak in DeSerializeFile(): The exception handler for ZfsdException did not close the open case file. This code path was probably not exercised. * Fix four memory leaks * CaseFile::DeSerialize() was freeing its dirent structure when it had entries, but not when the directory was empty * zfsd did not purge case files on exit. This isn't really a problem because the memory won't leak until the program quits, but it clutters valgrind's output. * ZfsDaemon::RescanSystem() wasn't deleting newly created events after processing them. * DeSerializeFile(): an ifstream was closed() instead of deleted. * Miscellaneous style changes. Submitted by: asomers Approved by: ken (mentor) Sponsored by: Spectra Logic Corporation END