freebsd-skq/usr.bin/mkimg
Marcel Moolenaar 9ba57342c9 SEEK_DATA has interesting behaviour for sparse files on ZFS. A sparse file
with 128K of random data and truncated to 800K can have SEEK_DATA return -1
when given an offset of 128K. On UFS, the SEEK_DATA returns 800K (the size
of the file). SEEK_HOLE on ZFS seems to behave the same as UFS.

To handle this, map -1 to the size of the file (`end') when lseek returns
this for either SEEK_HOLE or SEEK_DATA. When sparse files are not supported
by the file system both `hole' and `data' will now be equal to `end' and we
will treat the entire file as data. This way, the -1 return for SEEK_DATA
on ZFS will end up doing the right thing.

Reported by: gjb@

MFC after:	3 days
2014-11-12 00:10:27 +00:00
..
tests Update baseline files for EBR, MBR and PC98 now that mkimg fills in 2014-10-03 20:54:35 +00:00
apm.c Fix partition alignment and image rounding when any of -P (block size), 2014-09-19 23:16:02 +00:00
bsd.c Fix partition alignment and image rounding when any of -P (block size), 2014-09-19 23:16:02 +00:00
ebr.c Add mkimg_chs() for those schemes that need the LBA broken down into 2014-10-03 20:48:11 +00:00
format.c MFuser/marcel/mkimg: 2014-05-15 19:19:57 +00:00
format.h MFuser/marcel/mkimg: 2014-05-15 19:19:57 +00:00
gpt.c Fix partition alignment and image rounding when any of -P (block size), 2014-09-19 23:16:02 +00:00
image.c SEEK_DATA has interesting behaviour for sparse files on ZFS. A sparse file 2014-11-12 00:10:27 +00:00
image.h Add image_data() for checking whether a sequence of blocks has data. 2014-07-15 04:39:23 +00:00
Makefile Add mkimg_chs() for those schemes that need the LBA broken down into 2014-10-03 20:48:11 +00:00
mbr.c Add mkimg_chs() for those schemes that need the LBA broken down into 2014-10-03 20:48:11 +00:00
mkimg.1 Update the usage message and the man page to account for the new long 2014-09-27 17:58:03 +00:00
mkimg.c Add mkimg_chs() for those schemes that need the LBA broken down into 2014-10-03 20:48:11 +00:00
mkimg.h Add mkimg_chs() for those schemes that need the LBA broken down into 2014-10-03 20:48:11 +00:00
pc98.c Add mkimg_chs() for those schemes that need the LBA broken down into 2014-10-03 20:48:11 +00:00
qcow.c Finish QCOW version 2 and stop making it conditional. 2014-09-24 22:45:03 +00:00
raw.c Add VHD support to mkimg(1). VHD is used by Xen and Microsoft's Hyper-V 2014-07-03 20:31:43 +00:00
scheme.c Fix partition alignment and image rounding when any of -P (block size), 2014-09-19 23:16:02 +00:00
scheme.h Fix partition alignment and image rounding when any of -P (block size), 2014-09-19 23:16:02 +00:00
vhd.c Suffix the cookie constants with ULL to silence warnings from compilers 2014-10-01 20:37:15 +00:00
vmdk.c Create a redundant grain directory and table. Previously we were 2014-08-09 04:47:12 +00:00
vtoc8.c Fix partition alignment and image rounding when any of -P (block size), 2014-09-19 23:16:02 +00:00