mkfs: Use -b size=<size> for xfs (RHBZ#981715).

(cherry picked from commit 3201e7556424bd305ec39ac49dd84c0471f64544)
cmd: Allow callers to override file-closing behaviour after fork.

This allows us to send file descriptors directly to child processes,
eg. using /dev/fd/<N>.

(cherry picked from commit aecb5f4b33107935191099dbd5559113f59ee51c)
info: disk-format et al: Fix error message when no file exists (RHBZ#981663).

$ guestfish disk-format /etc/nosuchfile

Instead of this obscure double error message:

  libguestfs: error: qemu-img info: JSON parse error: parse error: premature EOF
                       (right here) ------^
  libguestfs: error: qemu-img info: /etc/nosuchfile: qemu-img info exited with error status 1.
  To see full error messages you may need to enable debugging.
  See http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs

You will now see this simpler error:

  libguestfs: error: disk info: /etc/nosuchfile: No such file or directory

Thanks: Bo Fan.
(cherry picked from commit d50cb7bbb4cc18f69ea1425e9f5cee9685825f95)
info: Fix double-call to error function when qemu-img info command fails (RHBZ#981663).

Previously if the 'qemu-img info --output json' command failed, then
the stdout callback would be called first with a zero-length buffer.
Since a zero-length buffer cannot be valid JSON (in this context)
don't produce a separate error message.

However do catch the case when qemu-img info might produce no output
and no error (if that were to happen -- it does not happen at the
moment).

(cherry picked from commit 28e08776824dd3152638e647259c2f4701a0a577)
tests: Add a regression test for all disk_* info commands (RHBZ#981663).

(cherry picked from commit 2311fb0632a64cfa2bab8bf65c82ffaa042d619e)
launch: appliance: Fix a double-free if kernel linking fails (RHBZ#983218).

This also simplifies the code which takes the building_lock around
guestfs___build_appliance.

Thanks Attila Fazekas for the detailed bug report.

(cherry picked from commit ae78381287771a781f939f26a414fc8cfdc05fd6)
acls: Improve documentation for acl_set_file (RHBZ#985269).

Thanks: Bo Fan.
(cherry picked from commit 758a2262f5f4033de3400bbe00fac2f85310b4ff)
RHEL 7: Emphasize libguestfs-winsupport package (RHBZ#627468).

This RHEL-only patch changes the error messages when the
inspection code cannot find an operating system inside the guest
image.  For a Windows guest this may happen because the user has not
installed the separate 'libguestfs-winsupport' package.  Therefore we
emphasize that the user may need to install this package.

Notes:

(1) In RHEL there are two pieces of inspection code, the old Perl code
(deprecated upstream) and the new C core inspection API.  Therefore
this patch has to touch two places with essentially the same change.

(2) This patch doesn't try to be clever and detect if it was a Windows
guest.  This should reduce the chance of failure.

Output from (Perl) virt-inspector now looks like this:

 $ virt-inspector disk.img
 No operating system could be detected inside this disk image.

 This may be because the file is not a disk image, or is not a virtual machine
 image, or because the OS type is not understood by virt-inspector.

 If you feel this is an error, please file a bug report including as much
 information about the disk image as possible.

 RHEL notice
 -------------
 libguestfs will return this error for Microsoft Windows guests if the
 separate 'libguestfs-winsupport' package is not installed. If the
 guest is running Microsoft Windows, please try again after installing
 'libguestfs-winsupport'.

Output from guestfish (ie. C core inspection API) now looks like this:

 $ guestfish -i disk.img
 guestfish: no operating system was found on this disk

 RHEL notice
 -------------
 libguestfs will return this error for Microsoft Windows guests if the
 separate 'libguestfs-winsupport' package is not installed. If the
 guest is running Microsoft Windows, please try again after installing
 'libguestfs-winsupport'.
RHEL 7: Remove libguestfs live (RHBZ#798980).

This isn't supported in RHEL 7.
RHEL 7: Exclude iptables from the appliance (RHBZ#858648).
RHEL 7: Ignore /etc/release if /etc/redhat-release exists (RHBZ#873219).

If the user has created /etc/release on a RHEL machine, don't
mis-detect the OS as NetBSD.
RHEL 7: Remove 9p APIs from RHEL (RHBZ#921710).