aboutsummaryrefslogtreecommitdiff
path: root/stand/common/misc.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-231-2/+0
| | | | | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/ Similar commit in main: (cherry picked from commit 1d386b48a555)
* stand: create common set_currdevWarner Losh2023-01-241-0/+17
| | | | | | | | | | | | | | Pull together the nearly identical copies of set_currdev in i386, userboot and efi. Other boot loaders have variances that might be fine to use the common routine, or not. Since they are harder to test for me, and ofw and uboot do handle these setting differently, leave them be for now. Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D38005 (cherry picked from commit ad70f2e22ef29f94bf5208b3a9a2389575330b06)
* stand: Move dev_cleanup into libsaWarner Losh2023-01-241-11/+0
| | | | | | | | | | | | | | | | Since dev_cleanup() walks through all the devsw devices with dv_cleanup rotuines, move it into libsa rather than having it in 'common'. Logically, it operates only on things that are in libsa, and would never be different for different loaders: either people would call it as is, or they'd do the loop themselves with 'special' things inline between calls to cleanup (not that I think that will ever be needed though). Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D38004 (cherry picked from commit bf020787d5f1b4a1274135b49309f7e9ef3955e1)
* stand: Create common gen_setcurrdev and replace codeWarner Losh2023-01-241-0/+16
| | | | | | | | | | | | Replace 4 identical copies of *_setcurrdev with gen_setcurrdev to avoid having to create a 5th copy. uboot_setcurrdev is actually different and needs to remain separate (even though it's quite similar). Sponsored by: Netflix Reviewed by: fuz@fuz.su, kevans Differential Revision: https://reviews.freebsd.org/D38003 (cherry picked from commit 1c1783d66bc81ebd0c1304b1f613a9403c073915)
* loader: implement mount/unmount rootfsToomas Soome2022-01-131-0/+22
| | | | | | | | | | | We want to keep our root file system open to preserve bcache segment between file accesses, thus reducing physical disk IO. Reviewed by: imp, allanjude, kevans (previous version) Differential Revision: https://reviews.freebsd.org/D30848 MFC after: 1 month (cherry picked from commit b4cb3fe0e39a31e60292018dc9fb7510b3de92bf)
* zalloc_malloc:Free hexdump preceeding buffer when we detect overflowSimon J. Gerraty2020-08-291-40/+0
| | | | | | | | | | | | | | | Move hexdump from stand/common/misc.c to stand/libsa/hexdump.c (svn cp) Disable use of pager - causes linking issue for boot1 can be re-enabled by defining HEXDUMP_PAGER. Reviewed by: stevek, imp MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D26235 Notes: svn path=/head/; revision=364965
* veloader use vectx API for kernel and modulesSimon J. Gerraty2020-03-081-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The vectx API, computes the hash for verifying a file as it is read. This avoids the overhead of reading files twice - once to verify, then again to load. For doing an install via loader, avoiding the need to rewind large files is critical. This API is only used for modules, kernel and mdimage as these are the biggest files read by the loader. The reduction in boot time depends on how expensive the I/O is on any given platform. On a fast VM we see 6% improvement. For install via loader the first file to be verified is likely to be the kernel, so some of the prep work (finding manifest etc) done by verify_file() needs to be factored so it can be reused for vectx_open(). For missing or unrecognized fingerprint entries, we fail in vectx_open() unless verifying is disabled. Otherwise fingerprint check happens in vectx_close() and since this API is only used for files which must be verified (VE_MUST) we panic if we get an incorrect hash. Reviewed by: imp,tsoome MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org//D23827 Notes: svn path=/head/; revision=358744
* loader: alloc_pread() should set errno if malloc failsToomas Soome2020-02-231-0/+1
| | | | | | | We may want to find out why alloc_pread() failed. Notes: svn path=/head/; revision=358260
* Prefer uintXX_t to u_intXX_tWarner Losh2018-03-131-2/+2
| | | | | | | | | A foolish consistency is the hobgoblin of little minds, adored by little statesmen and philosophers and divines. With consistency a great soul has simply nothing to do. -- Ralph Waldo Emerson Notes: svn path=/head/; revision=330864
* There's no tainted data here, tag it as such to avoid the slew ofWarner Losh2018-01-231-0/+1
| | | | | | | | | | | false positives. The files the boot loader reads are assumed to be good. CID: 1006663,1006665,1265013, 1265014 (possibly more) Sponsored by: Netflix Notes: svn path=/head/; revision=328292
* Move sys/boot to stand. Fix all references to new locationWarner Losh2017-11-141-0/+219
Sponsored by: Netflix Notes: svn path=/head/; revision=325834