Commit graph

442 commits

Author SHA1 Message Date
Warner Losh
3c857567c1 stand: Rename ZFSSRC to SAZFSSRC to avoid confusion
ZFSSRC is abiguous on its surface and too clos to ZFSTOP, so rename it
to SAZFSSRC.

Sponsored by:		Netflix
Reviewed by:		tsoome
Differential Revision:	https://reviews.freebsd.org/D53901
2025-11-24 17:50:26 -07:00
Warner Losh
05346243df stand: Move from OZFS to ZFSTOP
Use ZFSTOP instead of OZFS. They are the saame thing.

Sponsored by:		Netflix
Reviewed by:		tsoome
Differential Revision:	https://reviews.freebsd.org/D53900
2025-11-24 17:35:46 -07:00
Mark Johnston
4d6801a6b5 stand: Teach the zfs loader about dynamic gang headers
There is a pool feature, dynamic_gang_header, that is enabled by default
in new pools.  When this feature is active, gang headers may be larger
than 512 bytes.  The loader needs to be taught to cope with that.

Try using the vdev ashift to pick the gang block header size.  If the
checksum fails, fall back to the old gang block header size.

This is based on a patch by Paul Dagnelie, with testing, bug-fixing and
some simplifications from me.

PR:		289690
Co-authored by:	Paul Dagnelie <paul.dagnelie@klarasystems.com>
Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D53578
2025-11-06 16:02:33 +00:00
Robert Clausecker
90fa789cfa sys/crypto: import md5c.c C rewrite
The reimplementation is a bit cleaner than the original code,
although it is also slightly slower. This shouldn't matter too
much as we will have asm code for the major platforms.

The code is unrolled when built in the kernel or user space, but
not when in libsa, as to reduce the code size.

Differential Revision:	https://reviews.freebsd.org/D45670
Reviewed by:	jrtc27, imp
Approved by:	markj (mentor)
MFC after:	1 month
2025-10-24 12:16:58 +02:00
Robert Clausecker
73a9b273d3 sys: move sys/kern/md[45].c to sys/crypto
Both files are used by kernel and userspace.
Move them to sys/crypto where they belong.

No functional changes intended.

In preparation of D45670.

Reviewed by:	markj
Approved by:	markj (mentor)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D52909
2025-10-24 12:16:46 +02:00
Olivier Certner
d3bfcd6640
libsa: smbios: Detect less-than-64-bit platforms via __SIZEOF_SIZE_T__
What we really want here is to know if pointers can refer to 64-bit
addresses, regardless of whether they also hold other information (such
as capabilities in CHERI).  __SIZEOF_SIZE_T__ is probably the closest
indication to that piece of information, so let's use it.  __ILP32__
wasn't wrong in practice though, as we don't support 32-bit CHERI
hardware (and likely never will).

Consistently with this change, test whether we can actually address the
64-bit SMBIOS's structure table by converting the end address to
'size_t' and checking whether its value is preserved.

Suggested by:   jhb (for the __ILP32__ => __SIZEOF_SIZE_T__ part)
Reviewed by:    jhb, imp
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49318
2025-10-07 10:14:41 +02:00
Warner Losh
dd747d7bcb Revert "stand: Use calloc instead of malloc for initialization of filesystem devsw"
This reverts commit dfafdbdfc3. There's no
author, and also problems with it. I'll redo it.

Sponsored by:		Netflix
2025-09-02 09:23:02 -06:00
null
dfafdbdfc3 stand: Use calloc instead of malloc for initialization of filesystem devsw
This change is required for https://reviews.freebsd.org/D49355, so that
we can check if d_dev is uninitialized by checking if it's NULL.

Reviewed by:		imp
Differential Revision:	https://reviews.freebsd.org/D49705
2025-09-01 15:57:14 -06:00
Kirk McKusick
690ae8a202 Bail out of corrupt directory entries during boot
A directory with a zero-valued d_reclen causes boot to hang, This
patch checks for directory entries with value zero and bails out
rather than spin forever. The hope is that the user has other options.

Sadly this was reported on Jun 16 2015 and is just now attended to
as part of a sweep of old unclosed phabricator reports.

Reported-by:  Daniel O'Connor darius-dons.net.au
Differential  Revision: https://reviews.freebsd.org/D2844
MFC-after:    1 week
Sponsored-by: Netflix
2025-08-21 22:33:48 -07:00
Kyle Evans
510e473ff3 stand: add a mechanism to avoid env var propagation to kenv
Our only user of this at the moment is teken.{fg,bg}_color.  These are
special because teken is a library common to both the kernel and the
loader, and we want to avoid having special vars to control the loader
vs. the kernel.  Ideally, if a user wants a different set of console
colors, then they set the appropriate teken variable and it
Just Works(TM) everywhere.  We can't just avoid setting the env vars,
because we specifically want to install a hook to adjust how loader is
drawn.

This allows us to avoid breaking a kernel config(5) that has some
default teken colors set with our defaults.  That's a valid
configuration, even if it might seem weird that they don't want to set
colors in both loader and the kernel -- they may not anticipate spending
any time in loader, and thus prefer to just let it do its default
behavior.

NOKENV is expected to be unset if the value is overwritten, rather than
acting as a persistent marker that we do not want the value to persist
under any circumstance.  We can always add another flag bit later for
persistence if we find a use for that, but most variables are fine to
carry over.  This is mostly needed for environment variables that we
really just want to set a hook for.

Future work could expand this to break it out to the scripted
interfaces.  We have discussed some options like a new built-in command,
or adding a flag to the existing `set` command, but haven't really come
up with a concrete plan to avoid confusion.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D50888
2025-08-21 22:48:29 -05:00
Simon J. Gerraty
5bfb3045d2 Allow secure-netboot
When doing file verification, tftp needs to be able to handle multiple
open files concurrently.
We also need tftp_stat() to provide useful values for st_dev and st_ino.

Allow an architecture to define NETPROTO_DEFAULT.
The default is NET_NFS for backwards compatability.

In net_parse_rootpath() fix parsing of
<scheme>://<ip>[:<port]/<path>
and ensure we return INADDR_NONE unless we successfully
parsed an addr, so we don't end up clobbering rootip obtained
from bootp().

Sponsored by:   Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D51187
2025-08-20 15:49:53 -07:00
Simon J. Gerraty
b44cc1b479 loader: do not try to open directories with TFTP
Attempting to mount or even open / with some tftp servers
causes a several minute delay in boot.

Since opening a directory via TFTP does not make sense, we
avoid it.  We don't know if using TFTP until after net_open()
has been called.

Add an is_tftp() accessor to avoid everyone having to include
all the net* headers.

Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D51447
2025-08-20 15:45:54 -07:00
Simon J. Gerraty
aaf65a13c0 stand: add fs_ops.fs_flag
To avoid a layering violation in open() allow fs_ops to
indicate that devopen() should be skipped.

This is only true for pkgfs.

Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D51684
2025-08-20 15:42:35 -07:00
Gleb Smirnoff
fe2418f26e libsa/zfs: inline vdev_init_from_label() into vdev_probe()
This function is used only once and also pulls three variables from the
nvlist that the only caller have already pulled out.

Reviewed by:		mav, imp
Differential Revision:	https://reviews.freebsd.org/D52031
2025-08-20 07:53:20 -07:00
Gleb Smirnoff
a1572e202a libsa/zfs: further improve handling of stale labels
Fix two problems with 6dd0803ffd.  First problem is that situation when
newer label was read before stale one, was handled differently to reverse
order case.  Second problem is that vdev_free() would free the fully
initialized leaf vdev that carried stale label.  In a case when vdev
carries a stale label, but is still referenced by a different label with
new a configuration, we don't want to free it, but rather insert it into
the new configuration.

o Provide a helper function nvlist_find_vdev_guid() that checks presence
  of certain GUID in a label.
o In top level vdev store the GUID of vdev used to instantiate top vdev.
o Cover all possible cases in the block in vdev_probe() where we encounter
  a known configuration.  Make the diagnostic print more informative and
  looking same regardless of probe order.  Make this whole block easier to
  read reducing one level of indentation for a price of a single comparison
  at runtime.

Reviewed by:		mav, imp
Differential Revision:	https://reviews.freebsd.org/D51913
Fixes:			6dd0803ffd
2025-08-20 07:52:20 -07:00
Gleb Smirnoff
9dbd8ee116 libsa/zfs: refactor vdev tree for better resiliency against stale disks
Before this change in vdev_insert() we would avoid inserting a duplicate
vdev to the list of children, however this duplicate being unlinked from
the parent is still stored on the global list with initialized v_guid.
Such leaked duplicate can later be returned by vdev_find().  After
6dd0803ffd such leaked vdev may be freed or pointing to a freed parent,
which leads to a loader crash.  Note that the leak problem was there
before 6dd0803ffd.

First, in vdev_insert() free conflicting vdev and return the existing one.
Update callers accordingly.  There is only one caller that actually may
encounter this condition.

Second, eliminate global list of vdevs and make vdev_find() to work
recursively on the tree that a caller must provide.  Of course, a chance
of GUID collision between members of different pools is extremely low. The
main motivation here is just to increase code robustness and fully isolate
the data structures of different pools being tasted by the loader, and
make easier debugging of bugs like the one being fixed.

Reviewed by:		mav, imp
Differential Revision:	https://reviews.freebsd.org/D51912
Fixes:			6dd0803ffd
2025-08-20 07:51:21 -07:00
Gleb Smirnoff
8ef5016f73 libsa/zfs: simplify vdev_find_previous()
An empty list case is properly covered by the cycle.
Don't pass pointer to vdev being looked up, pass just id.

Reviewed by:		mav, imp
Differential Revision:	https://reviews.freebsd.org/D51911
2025-08-20 07:51:14 -07:00
Gleb Smirnoff
de055556a0 libsa/zfs: ignore labels with zero txg
Zero txg means this vdev has been correctly removed from the pool.  For
reference see module/zfs/vdev_removal.c in OpenZFS.  It calls
vdev_label_init(vd, 0, VDEV_LABEL_REMOVE), and second argument there is
the txg to write.

Reviewed by:		tsoome, mav, imp
Differential Revision:	https://reviews.freebsd.org/D51910
2025-08-20 07:51:08 -07:00
Gleb Smirnoff
5d5d03356e libsa/zfs: remove unused variable
In vdev_init_from_label() we obtain the pool guid but don't use it.

Reviewed by:		tsoome, mav, imp
Differential Revision:	https://reviews.freebsd.org/D51909
2025-08-20 07:50:58 -07:00
Toomas Soome
d439a15512 libsa: ip fragment reassembly is buggy
Well, it does not really work and we are getting retransmits.
To replicate, set nfs.read_size large enough.

What needs to happen is, we read ethernet packet, if it has
IPv4 payload and that payload is fragment, we create reassembly
queue (sorted by growing fragment offset) and on last
fragment, we can build complete packet. Once done properly,
the network load can utilize larger read sizes.

While there, move ARP (and other) processing out of readipv4().

Reviewed by:	imp
Differential Revision: https://reviews.freebsd.org/D51690
2025-08-08 10:10:08 +03:00
Martin Matuska
df58e8b150 zfs: merge openzfs/zfs@8302b6e32
Notable upstream pull request merges:
 #16853 894edd084 Add TXG timestamp database
 #17004 -multiple Implement dynamic gang header sizes
 #17405 dea0fc969 ZVOL: Return early, if volmode is ZFS_VOLMODE_NONE
                  on FreeBSD side
 #17455 cf146460c Default to zfs_bclone_wait_dirty=1
 #17481 523d9d600 Validate mountpoint on path-based unmount using statx
 #17482 92da9e0e9 ZVOL: Implement zvol_alloc() function on FreeBSD side
 #17489 dee62e074 spa: ZIO_TASKQ_ISSUE: Use symbolic priority
 #17496 bf846dcb7 Release topology restrictions on special/dedup
 #17497 4e92aee23 Relax special_small_blocks restrictions
 #17503 ea38787f2 Revert "Fix incorrect expected error in ztest"
 #17505 be1e991a1 Allow and prefer special vdevs as ZIL
 #17506 ee0cb4cb8 ztest: Fix false positive of ENOSPC handling
 #17507 92d3b4ee2 zio: rename `io_reexecute` as `io_post`;
                  use it for the direct IO checksum error flag
 #17508 6af8db61b metaslab: don't pass whole zio to throttle reserve APIs
 #17518 4c2a7f85d FreeBSD: Add support for _PC_HAS_HIDDENSYSTEM
 #17521 d7ab07dfb ZIL: Force writing of open LWB on suspend
 #17524 b6e8db509 zpool/zfs: Add '-a|--all' option to scrub, trim,
                  initialize
 #17531 c1e51c55f Correct weight recalculation of space-based metaslabs
 #17533 d323fbf49 FreeBSD: zfs_putpages: don't undirty pages until
                  after write completes
 #17536 b21e04e8d Fix zdb pool/ with -k
 #17537 -multiple Userspace tunables
 #17540 2957eabbe Add support for FreeBSD's Solaris style extended
                  attribute interface
 #17547 4bd7a2eaa zdb: fix checksum calculation for decompressed blocks
 #17551 -multiple cleanup: remove var init/update
 #17561 0f8a1105e Skip dbuf_evict_one() from dbuf_evict_notify()
                  for reclaim thread
 #17563 10a78e264 Faster checksum benchmark on system boot
 #17564 00ce064d8 spa: update blkptr diagram to include vdev padding
                  on encrypted blocks
 #17565 -multiple Physical rewrite
 #17566 fc885f308 Don't use wrong weight when passivating group
 #17572 f70c85086 BRT: Fix ZAP entry endianness
 #17575 0b6fd024a ZVOL: Unify zvol minors operations and improve error
                  handling
 #17581 cb5e7e097 range_tree: Provide more debug details upon unexpected
                  add/remove
 #17587 -multiple Fix two issues with dynamic gang headers

Obtained from:	OpenZFS
OpenZFS commit:	8302b6e32b
2025-08-07 09:06:31 +02:00
Toomas Soome
733da235aa libsa: errors with pointer conversion
loader ip implementation is using pointer to structure ip to receive
the packet and is using this pointer to cast on other data types
(namely structure arphdr). Problem does arise when those data structures
are declared with different alignment rules and when/if the compiler
does check those rules. To work around and silence warnings, use
void * generic pointer instead.

Error seen with gcc 14 (-Werror=address-of-packed-member).

Reviewed by:    imp
Differential Revision: https://reviews.freebsd.org/D51662
2025-08-01 01:04:32 +03:00
kpowkitty
bfa4759d51 replace raw isprint() w/ isprint() func
Signed-off-by: Kayla Powell (AKA Kat) <kpowkitty@FreeBSD.org>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1740
2025-07-23 00:33:06 -06:00
kpowkitty
87c326e41e libsa: isprint()
libsa is missing isprint().  Adding it with the other isfoo()
functions. Remove a stray copy from fdt too.

Signed-off-by: Kayla Powell (AKA Kat) <kpowkitty@FreeBSD.org>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1740
2025-07-23 00:32:40 -06:00
Simon J. Gerraty
e67aef4190 Add DEBUG_PRINTF to stand.h
stand/ is mostly debugged with printfs, in an ad hoc and sometimes
fragile manner. For example BOOTP_DEBUG in bootp.c cannot be defined
unless NETIF_DEBUG is defined in dev_net.c or build fails for lack of the
symbol debug.

The DEBUG_PRINTF implementation in stand.h addresses that and allows
for more control over debug output.  It is compatible with the
usage in libsecureboot.

Simply define _DEBUG_LEVEL to the desired level of debug
or in the case of libsecureboot _DEBUG_LEVEL_VAR to the variable that
will hold that value - default is _debug which is static so each
translation unit can be controlled independently.

The 1st arg to DEBUG_PRINTF is a level which must be greater than or
equal to _DEBUG_LEVEL_VAR if the printf is to be called.
See libsecureboot for more examples.

Reviewed by:	imp
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D51269
2025-07-17 16:36:17 -07:00
Gleb Smirnoff
6dd0803ffd libsa/zfs: prefer a vdev with newer txg to a stale one
Before this change, the first probed member of a pool would initialize
vdev tree for the pool.  Now, imagine a situation when a machine has a
disk that has been removed from the pool, but the ZFS label was not
erased.  That's a typical scenario - disk goes offline, it is replaced
with a spare, no data changes written to the gone disk.  Then, disk
appears back at boot time and it is the first one to be probed by the
loader.  It has the same pool GUID as all other members and naive loader
would not see a conflict.  Then the disk will be used as source of truth
to read the bootenv.

To fix that, provide vdev_free() that allows to rollback the already
prebuilt vdev tree, so that a new one can be built from scratch.  Upon
encountering a newer configuration for already known top level part of a
pool, call vdev_free() and let vdev_probe() to build a new one.

The change has been tested with loader_lua and userboot.so, but it should
have same effect on the legacy boot1 loader.

Reviewed by:		tsoome, mav, imp
Differential Revision:	https://reviews.freebsd.org/D51219
2025-07-16 11:15:54 -07:00
Gleb Smirnoff
8e8fd66ca0 libsa/zfs: fail earlier in vdev_probe() if can't find ZPOOL_CONFIG_GUID
Don't store any configuration in memory from such weird label.
2025-07-10 20:26:01 -07:00
Gleb Smirnoff
8949cdd9af libsa/zfs: don't read and store ZPOOL_CONFIG_VDEV_CHILDREN in vdev_probe()
This is just the value from the current label and it is not used in the
function.  Later zfs_spa_init() will call vdev_init_from_nvlist() and
it will obtain the value.
2025-07-10 20:18:36 -07:00
Gleb Smirnoff
03f3dc3189 libsa/zfs: don't hardcode root vdev name, use the real pool name 2025-07-10 20:07:39 -07:00
Gleb Smirnoff
f1eceb963c libsa/zfs: add error printf() in zfs_spa_init()
All other error exits from this function print something.
2025-07-10 20:04:50 -07:00
Brooks Davis
e453e498cb machine/stdarg.h -> sys/stdarg.h
Switch to using sys/stdarg.h for va_list type and va_* builtins.

Make an attempt to insert the include in a sensible place.  Where
style(9) was followed this is easy, where it was ignored, aim for the
first block of sys/*.h headers and don't get too fussy or try to fix
other style bugs.

Reviewed by:	imp
Exp-run by:	antoine (PR 286274)
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1595
2025-06-11 17:39:02 +01:00
Ravi Pokala
3adae4f27d loader: Add the CPU identification string to the data which is visible
in the bootloader.

Reviewed by:	imp
MFC after:	1 week
Sponsored by:	Vdura
Differential Revision: https://reviews.freebsd.org/D49708
2025-04-10 21:01:55 -07:00
Olivier Certner
1ee8714950
libsa: smbios_probe(): Strictly obey specified entry point address
When such an address is known, do not search elsewhere, contrary to what
we are doing on non-EFI boot (see SMBIOS_START and SMBIOS_LENGTH).

Reviewed by:    markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49291
2025-03-11 14:54:10 +01:00
Olivier Certner
9dad0ba286
libsa: smbios_detect(): Return the entry point address
In particular, this allows the caller to know whether the detection was
successful.

Reviewed by:    imp, markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49290
2025-03-11 14:54:10 +01:00
Olivier Certner
c340797e08
libsa: smbios: Allow to run smbios_probe() multiple times
This is in preparation for modifying the EFI loader to favor a v3 table
if present.

As an impact, caller smbios_match() has been changed so that it only
calls smbios_probe() with NULL (non-EFI discovery) once.

While here, expand the original XXXRP comment in smbios_match().

Reviewed by:    imp, markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49289
2025-03-11 14:54:09 +01:00
Olivier Certner
7f005c6699
libsa: smbios: Use 64-bit entry point if table below 4GB on non-EFI boot
On amd64, boot blocks and the non-EFI loader are 32-bit compiled as
clients of BTX, so cannot access addresses beyond 4GB.  However, the
64-bit entry point may refer to a structure table below 4GB, which we
want to use if the BIOS does not provide a 32-bit entry point.  The
situation is similar for powerpc64.

Consequently, always compile-in support for the 64-bit entry point, but
ensure that it is not selected on 32-bit-compiled boot loaders if the
structure table it points to grows beyond 4GB (as it is then not
accessible).

PR:             284460
Reviewed by:    markj
MFC after:      2 weeks
Relnotes:       yes
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49288
2025-03-11 14:54:09 +01:00
Olivier Certner
3f744fb8b2
libsa: smbios: Favor the v3 (64-bit) entry point on non-EFI boot
When both the 32-bit and 64-bit entry points are present, the SMBIOS
specification says that the 64-bit entry point always has at least all
the structures the 32-bit entry point refers.  In other words, the
32-bit entry point is provided for compatibility, so we assume the
64-bit one has more chances to be filled with adequate values.

Doing this also increases consistency with the kernel's smbios(4)
driver.

Reviewed by:    imp, markj
MFC after:      2 weeks
Relnotes:       yes
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49287
2025-03-11 14:54:09 +01:00
Olivier Certner
64fc51a9cf
libsa: smbios: Reject a 64-bit entry point with revision 0
According to the specification, such an entry point may have different
data in bytes at offsets 0x0c to 0x17 (included).  In such a case,
interpreting them as the Structure Table Maximum Size and Address fields
could have catastrophic consequences.

Reviewed by:    imp, markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49286
2025-03-11 14:54:09 +01:00
Olivier Certner
7e61fc7640
libsa: smbios: Stop parsing on an End-of-Table structure
This structure exists since SMBIOS v2.2 and indicates that there are no
structures to be parsed beyond this point.  For backwards compatibility,
the standard recommends that system software ensures that this structure
covers the rest of the SMBIOS structure table area as reported by the
Structure Table Address, and the Structure Table Maximum Size (64-bit
entry point) or the Structure Table Length (32-bit entry point), which
makes existing parsers continue to work correctly as they usually ignore
unknown structure types.  However, this is not a requirement, so be
bullet proof and immediately stop parsing in this case.

Reviewed by:    imp, markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49285
2025-03-11 14:54:09 +01:00
Olivier Certner
d1f351fcb2
libsa: smbios: probe: BCD revision parsing is v2-only code; Expand comments
The code parsing the BCD revision is only meaningful on v2, so move it
away into the appropriate 'if' branch to ease reading (and to avoid
a useless test).

Expand comments.  In particular, make it clear that setting
'smbios.count' to '-1' removes the limit of the number of structures to
parse.

No functional change.

Reviewed by:    imp, markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49284
2025-03-11 14:54:08 +01:00
Olivier Certner
3b2303ba3d
libsa: smbios: Export the used entry point type to the kernel
Via the kenv 'smbios.entry_point_type'.

Reviewed by:    imp, markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49283
2025-03-11 14:54:08 +01:00
Olivier Certner
a39ab17c9a
libsa: smbios: Make 'is_64bit_ep' a field of 'smbios'
No functional change.

Reviewed by:    imp, markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49282
2025-03-11 14:54:08 +01:00
Olivier Certner
2aa0067548
libsa: smbios: Rename 64-bit entry point's guards
Rename HAS_SMBV3 to SMBIOS_64BIT_EP, as it will soon be externally
defined in some cases, and 'isv3' to 'is_64bit_ep'.  These are more
accurate names for what they actually control/indicate.

No functional change.

Reviewed by:    imp, markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49281
2025-03-11 14:54:08 +01:00
Olivier Certner
a609592ddc
libsa: smbios: style(9): Entry point parsing comments
Move the comments so that lines stay of reasonable length.

Remove comments that state the obvious.

Reviewed by:    markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49280
2025-03-11 14:54:07 +01:00
Olivier Certner
085c8bdec5
libsa: smbios: style(9): SMBIOS_GET8(): Split overlong line
No functional change.

Reviewed by:    markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49279
2025-03-11 14:54:02 +01:00
Toomas Soome
e7c0cb7208 loader: dosfs should be able to work with different sector sizes
The current dosfs is only able to use 512B sector sizes, add
support for 4kn disks (incidentally this should also add support
for 1024B and 2048B sectors, have not tested those).

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D49078
2025-03-03 23:54:23 +02:00
Toomas Soome
ccf7b62bd8 loader: allow fs modules to use ioctl()
Currently only directly opened disk device is allowed to access
ioctl() - that is, when file has F_RAW flag set.

The problem is, file systems might need to determine the device parameters,
and we could use already opened device descriptor to communicate this
information.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D49077
2025-03-03 23:52:55 +02:00
Kirk McKusick
aa90fbed15 Standardize the definition of a UFS dinode.
Each program that operates on UFS on-disk inodes defines its own
version of a dinode. They all (of necessity) define the same
layout but use different names. This change adds a definition of
a dinode (a union of a UFS1 on-disk inode and a UFS2 on-disk inode)
as well as a dinodep (a union of a pointer to a UFS1 on-disk inode
and a pointer to a UFS2 on-disk inode) in sys/ufs/ufs/dinode.h.
It then deletes the definitions of dinode and dinodep in all the
programs that operate on them and instead uses these standard
definitions.

No functional change intended.

MFC-after: 1 week
2025-01-27 17:39:45 -08:00
Warner Losh
780f289297 stand: drop inttypes.h from safe list
Nothing uses it anymore, so drop it from the 'safe' list. Also, move
stand/efi/loader/main.c to using machine/_inttypes.h which is all it
really needs.

Sponsored by:		Netflix
2024-11-20 12:49:48 -07:00
Warner Losh
17be774ee7 stand: unistd.h is no longer safe
unistd.h includes too much extra stuff for the boot loader. This creates
a fair amount of namespace pollution and it's best to just make it an
alias for stand.h like the other include files already are.

Sponsored by:		Netflix
2024-11-19 20:35:04 -07:00