freebsd-src/lib
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
..
atf DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
clang Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to 2018-02-25 13:20:32 +00:00
csu lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
lib80211 DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libalias DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libarchive MFV r328323,328324: 2018-01-24 14:24:17 +00:00
libauditd DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libbegemot DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libblacklist DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libblocksruntime DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libbluetooth lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libbsdstat lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libbsm DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libbsnmp DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libbz2 DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libc Fix typo. 2018-02-27 10:55:33 +00:00
libc_nonshared lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libc++ DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libc++experimental DIRDEPS_BUILD: Connect more libraries. 2017-07-11 00:32:48 +00:00
libcalendar lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libcam SPDX: Small for a license ID tags. 2017-12-27 21:36:37 +00:00
libcapsicum capsicum_helpers: Add EVENT to default stdio rights set 2017-10-08 17:29:43 +00:00
libcasper nv was moved to the 9 section. 2018-02-26 19:08:27 +00:00
libclang_rt Only build tsan and tsan_cxx for amd64, as 32 bit is unsupported. 2017-12-25 13:17:29 +00:00
libcom_err DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libcompat libcompat: Use %hu for unsigned shorts. 2018-02-10 14:45:29 +00:00
libcompiler_rt The routines defined in comparedf2 and comparesf2 are defined in libc 2018-02-02 05:04:43 +00:00
libcrypt lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libcuse DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libcxxrt libcxxrt: Move mangled symbols out of extern "C++" in Version.map 2018-01-23 22:41:13 +00:00
libdevctl DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libdevdctl zfsd: Allow zfsd to work on any type of GEOM provider 2018-02-14 23:52:39 +00:00
libdevinfo Bump number that's an insane number of devices from 1,000 to 10,000. I 2017-12-21 04:21:59 +00:00
libdevstat lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libdl DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libdpv DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libdwarf DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libedit libedit: sort the Makefile in line with NetBSD's version. 2018-01-29 22:38:23 +00:00
libefivar Need to convert '/' back to '\' when creating a path. Ideally, this 2018-01-05 07:09:29 +00:00
libelf DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libelftc libelftc: bump version, tracking import in r320343 2017-07-05 02:58:46 +00:00
libevent DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libexecinfo DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libexpat DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libfetch SPDX: use the Beerware identifier. 2017-11-30 20:33:45 +00:00
libfigpar DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libgcc_eh DIRDEPS_BUILD: libgcc now depends on MK_LLVM_LIBUNWIND 2017-10-31 00:03:36 +00:00
libgcc_s Fix build by escaping a line break. 2018-01-31 21:41:42 +00:00
libgeom lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libgpio DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libgssapi lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libiconv_modules iconv: adding missing break 2018-01-21 21:09:08 +00:00
libifconfig libifconfig: multiple feature additions 2018-02-23 03:11:43 +00:00
libipsec General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
libjail lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libkiconv lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libkvm lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libldns DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
liblzma DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libmagic DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libmd SPDX: some uses of the RSA-MD license. 2017-12-13 16:30:39 +00:00
libmemstat Implement NUMA support in uma(9) and malloc(9). Allocations from specific 2018-01-12 23:25:05 +00:00
libmilter DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libmp lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libmt Add the LTO-8 Type M density code (0x5d, LTO-8M) to libmt and the 2017-11-03 21:04:22 +00:00
libnandfs lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libnetbsd libnetbsd: Make the function declaration of efopen() match the definition 2018-01-16 21:43:21 +00:00
libnetgraph s/NgSendMsgReply/NgSendReplyMsg/ in man to match the code. 2017-11-08 12:34:47 +00:00
libngatm DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libnv lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libopenbsd Fix a few more speelling errors 2017-12-28 01:31:28 +00:00
libopie DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libpam lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libpathconv Disconnect libpathconv tests since they require external perl and do not work with kyua. 2017-10-31 19:52:30 +00:00
libpcap DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libpe Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:37:03 +00:00
libpjdlog lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libpmc Fix pmcstat exit from kernel introduced by r325275. 2018-01-17 16:41:22 +00:00
libpmcstat Fix bug: increment the value of pmcstat_npmcs instead of moving pointer 2018-01-16 09:31:01 +00:00
libproc Use a global extern declaration to appease gcc. 2017-12-06 17:52:01 +00:00
libprocstat lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libradius lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libregex libregex: Mark gnuext test as an expected fail 2018-01-29 14:00:33 +00:00
librpcsec_gss lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
librpcsvc spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
librss DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
librt lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
librtld_db lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libsbuf DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libsdp lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libsm Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:35:36 +00:00
libsmb DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libsmdb Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:35:18 +00:00
libsmutil Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:34:34 +00:00
libsqlite3 DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libstdbuf lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libstdthreads lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libsysdecode Bump date, which I missed in r328014. Thanks to jhb@ for reporting. 2018-01-15 23:12:54 +00:00
libtacplus lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libtelnet Remove redundant include directories which expand to a noop, 2017-07-31 19:07:45 +00:00
libthr libthr: Fix missing break in switch. 2018-01-27 22:27:55 +00:00
libthread_db lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libucl DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libufs This change is some refactoring of Mark Johnston's changes in r329375 2018-03-02 04:34:53 +00:00
libugidfw lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libulog lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libunbound DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libusb lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libusbhid lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libutil humanize_number(3): fix math edge case in rounding large numbers 2017-12-28 22:57:34 +00:00
libvgl lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libvmmapi Add a new variant of the GLA2GPA ioctl for use by the debug server. 2018-02-26 19:19:05 +00:00
libwrap DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libxo DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
liby General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
libypclnt lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
libz DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
libzstd Addd work around for LLVM bug 35023. 2017-11-26 16:41:30 +00:00
msun msun: signed overflow in atan2 2018-02-14 07:59:30 +00:00
ncurses General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
tests Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
Makefile Add libregex, connect it to the build 2018-01-22 02:44:41 +00:00
Makefile.inc