kernel - Expand cpu_topology_nodes[] array
* Double the size of the array, which stores nodes as well as leafs
in the cpu topology tree. The array was being blown out in early
boot before if there were more than 128 CPUs.
* Add a KKASSERT() to catch any remaining issue, in case the tree
winds up being more complex and requires more nodes.
Reported-by: ivadasz
kernel - Move primary lockf management into struct vnode
* Move lockf management out of per-filesystem in-memory inodes and
into the general vnode structure. This will make follow-on work
easier and removes unnecessary code from various filesystem
implementations.
* Remove related implementations from fs code except for smbfs.
* Add optimization to avoid allocating struct lockf for LK_GETLK.
Allows filesystem lock scans to avoid allocating struct lockf
unnecessarily. Suggested by ryao.
* Just enable for existing filesystems that previously implemented it
in this commit. There may be a follow-up to enable it in the
default VOPS for all vnodes.
dd(1): Sync with FreeBSD
New features:
- Added conv=fsync flag
- Added conv=fdatasync flag
- Added oflag=fsync and oflag=sync flags
- Added iflag=fullblock flag
- Added iflag=direct and oflag=direct flags that set O_DIRECT
Fixes:
- Fixed SIGINT handling.
kern: Clean up malloc_uninit()
* Correct the diagnostic log message by omitting the CPU id, which
doesn't apply here. The unfreed bytes must be summed from all CPUs.
* Clean up excess INVARIANTS ifdef's by using '__debugvar' instead.
kern: Remove the little-use kvasnprintf() and kvasfree()
The kvasnprintf() requires a known max length, so it's basically the
same as kmalloc()+kvsnprintf(). Therefore, it's different to vasprintf()
and is of little use. Actually, the DRM subsystem implements its
kvasprintf(), the vasprintf() equivalent.
For simplicity, just remove kvasnprintf()+kvasfree() and convert
existing code to either use a buffer array or manually call kmalloc().
bsd.dep.mk: Fix mkdep(1) parameter order
I'll need to use ${MKDEP} to set extra compiler flags (e.g.,
`-include .../header.h`) in the forthcoming GDB. This would break the
${_MKDEPSRCDIR} because mkdep(1) would pass all remaining arguments to
${CC} once it comes across an unknown argument.
So move ${MKDEP} after ${_MKDEPSRCDIR} to fix the parameter order.
This is a follow-up fix to commit
dec8bf51d1d328f09ffaaf9e4c5a458a346ef590.
gmp: Update and rewrite makefiles
* Update the makefiles to build the imported 6.3.0.
* Split the building of file generation tools into a separate makefile
in the `tools/` subdirectory, and move the library building to the
`lib/` subdirectory.
* Use <bsd.hostprog.mk> to build the generation tools.
* Keep `gmp.h` at the main directory so there is no `config.h` that
may possibly confuse the GMP users, such as the case with MPC that's
got fixed in commit 140e2138b6e2614a71884aa87702138fe3691e53.
* Re-organize the sources in a separate `Makefile.src`. Just copy the
`mpn_objs_in_libgmp` list from the generated Makefile, and thus
greatly simplify the makefile rules.
* Adjust cc80/cc120 to use the updated `libgmp.a` location.
bsd.hostprog.mk: Reimplement to support multiple programs
Introduce PROGS and PROGS_CXX together with per-program variables to
support the multiple-program mode, allowing to build multiple programs
with one makefile. This mode can help simplify the makefiles as well as
the hierarchies.
The original single-program mode is kept backward compatible.
mpc: Fix inclusion paths to correctly include its own 'config.h'
It wrongly included the GMP's 'config.h', as the '../gmp/' directory has
both 'gmp.h' and 'config.h'.
libncurses: Remove obsolete targets from libtic's Makefile
The <bsd.hostlib.mk> already handles the 'afterdepend' and 'install'
targets, so no need to manually define them.
world: Remove obsolete 'build-tools' uses for host programs
These host programs (except share/syscons/mapsmk) are built with
<bsd.hostprog.mk>, which has replaced the 'build-tools' target in 2004.
So just remove the obsolete 'build-tools' target as well as the
'install' target.
Also remove the 'build-tools' target from <bsd.sys.mk>.
kernel: Fix two bugs in gptinit()
* Fix the wrong type for 'table_lba'; should be 'uint64_t' instead of
'uint32_t', and fix the read to use le64toh().
* Allow the partition table has entries more than 128 (MAX_GPT_ENTRIES).
The UEFI specification basically has no upper limit, but we limit to
parsing the first 128 (MAX_GPT_ENTRIES) entries.
This actually happens with a Proxmox v9.2 ISO, which uses GPT and
allocates 44 blocks for the partition table, so there are 176 entries.
For example, here is the gpt(8) of a USB stick written with this ISO:
```
Disk da8: 57.3GB (120225792 512-byte sectors)
Start Sectors Size Index Contents
0 1 512B - PMBR
1 1 512B - Primary GPT header
[13 lines not shown]