opnsense-src/usr.sbin/makefs
Alan Somers 1a2920e96a makefs: fix calculation of file sizes
When a new FS image is created we need to calculate how much space each
file is going to consume.
Fix two bugs in that logic:

1) Count the space needed for indirect blocks for large files.
1) Normally the trailing data of a file is written to a block of frag
   size, 4 kB by default.

However for files that use indirect blocks a full block is allocated,
32kB by default.  Take that into account.

Adjust size calculations to match what is done in ffs_mkfs routine:

* Depending on the UFS version the superblock is stored at a different
  offset. Take that into account.
* Add the cylinder group block size.
* All of the above has to be aligned to the block size.

Finally, Remove "ncg" variable. It's always 1 and it was used to
multiply stuff.

PR:		229929
Reviewed by:	mckusick
Sponsored by:	Semihalf
Submitted by:	Kornel Dulęba <mindal@semihalf.com>
Differential Revision:	https://reviews.freebsd.org/D35131
Differential Revision:	https://reviews.freebsd.org/D35132

(cherry picked from commit ecdc04d006)
2022-06-18 08:17:23 -06:00
..
cd9660 makefs(8): Fix a few typos in source code comments 2022-02-09 07:18:33 +01:00
ffs makefs(8): Fix a few typos in source code comments 2022-02-09 07:18:33 +01:00
msdos makefs: Fix warnings and reset WARNS to the default 2022-05-24 09:51:36 -04:00
tests makefs: fix calculation of file sizes 2022-06-18 08:17:23 -06:00
cd9660.c
cd9660.h Fix -Wpointer-sign warnings in makefs and mkimg 2021-01-07 09:26:21 +00:00
ffs.c makefs: fix calculation of file sizes 2022-06-18 08:17:23 -06:00
ffs.h Allocate extra inodes in makefs when leaving free space in UFS images. 2021-04-26 21:08:48 -04:00
Makefile makefs: Fix warnings and reset WARNS to the default 2022-05-24 09:51:36 -04:00
Makefile.depend Update Makefile.depend files 2019-12-11 17:37:53 +00:00
makefs.8 makefs: sort cd9660 sysid entries in man page 2022-06-16 08:49:43 -04:00
makefs.c makefs: add msdosfs (FAT) support 2019-08-20 18:20:45 +00:00
makefs.h Fix -Wpointer-sign warnings in makefs and mkimg 2021-01-07 09:26:21 +00:00
msdos.c Fix contents= being ignored in msdosfs makefs mtree 2019-11-15 18:34:23 +00:00
msdos.h Properly update FSInfo block after generation. 2019-08-23 05:23:45 +00:00
mtree.c makefs: Ignore the "tags" keyword in mtree manifests 2021-04-06 09:07:24 -04:00
walk.c