freebsd-dev/lib/libufs
Kirk McKusick efbf396426 This change is some refactoring of Mark Johnston's changes in r329375
to fix the memory leak that I introduced in r328426. Instead of
trying to clear up the possible memory leak in all the clients, I
ensure that it gets cleaned up in the source (e.g., ffs_sbget ensures
that memory is always freed if it returns an error).

The original change in r328426 was a bit sparse in its description.
So I am expanding on its description here (thanks cem@ and rgrimes@
for your encouragement for my longer commit messages).

In preparation for adding check hashing to superblocks, r328426 is
a refactoring of the code to get the reading/writing of the superblock
into one place. Unlike the cylinder group reading/writing which
ends up in two places (ffs_getcg/ffs_geom_strategy in the kernel
and cgget/cgput in libufs), I have the core superblock functions
just in the kernel (ffs_sbfetch/ffs_sbput in ffs_subr.c which is
already imported into utilities like fsck_ffs as well as libufs to
implement sbget/sbput). The ffs_sbfetch and ffs_sbput functions
take a function pointer to do the actual I/O for which there are
four variants:

    ffs_use_bread / ffs_use_bwrite for the in-kernel filesystem

    g_use_g_read_data / g_use_g_write_data for kernel geom clients

    ufs_use_sa_read for the standalone code (stand/libsa/ufs.c
	but not stand/libsa/ufsread.c which is size constrained)

    use_pread / use_pwrite for libufs

Uses of these interfaces are in the UFS filesystem, geoms journal &
label, libsa changes, and libufs. They also permeate out into the
filesystem utilities fsck_ffs, newfs, growfs, clri, dump, quotacheck,
fsirand, fstyp, and quot. Some of these utilities should probably be
converted to directly use libufs (like dumpfs was for example), but
there does not seem to be much win in doing so.

Tested by: Peter Holm (pho@)
2018-03-02 04:34:53 +00:00
..
block.c lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
bread.3 use .Mt to mark up email addresses consistently (part3) 2014-06-23 08:23:05 +00:00
cgread.3 Fix punctuation. 2018-02-02 00:01:50 +00:00
cgroup.c Correct fsck journal-recovery code to update a cylinder-group 2018-01-17 17:58:24 +00:00
inode.c lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libufs.3 Correct fsck journal-recovery code to update a cylinder-group 2018-01-17 17:58:24 +00:00
libufs.h Refactoring of reading and writing of the UFS/FFS superblock. 2018-01-26 00:58:32 +00:00
Makefile Refactoring of reading and writing of the UFS/FFS superblock. 2018-01-26 00:58:32 +00:00
Makefile.depend DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
sblock.c This change is some refactoring of Mark Johnston's changes in r329375 2018-03-02 04:34:53 +00:00
sbread.3 Refactoring of reading and writing of the UFS/FFS superblock. 2018-01-26 00:58:32 +00:00
type.c Missing disk close in libufs. 2017-12-26 23:16:11 +00:00
ufs_disk_close.3 use .Mt to mark up email addresses consistently (part3) 2014-06-23 08:23:05 +00:00