Plug up the lock lock leakage when exporting to a short buffer.

Reported by:	Alexander Leidinger
Submitted by:	mjg
MFC after:	1 week
Change i_gen in UFS to an unsigned type.

Missed format specifier.

Reported by:	mdf
MFC after:	4 weeks
Don't assume that UFS on-disk format of a directory is the same as
defined by <sys/dirent.h>

Always start parsing at DIRBLKSIZ aligned offset, skip first entries if
uio_offset is not DIRBLKSIZ aligned. Return EINVAL if buffer is too
small for single entry.

Preallocate buffer for cookies. Cookies will be replaced with d_off
field in struct dirent at later point.

Skip entries with zero inode number.

Stop mangling dirent in ufs_extattr_iterate_directory().

Reviewed by:	kib
Sponsored by:	Google Summer Of Code 2011