head	1.6;
access;
symbols
	netbsd-11-0-RC4:1.6
	netbsd-11-0-RC3:1.6
	netbsd-11-0-RC2:1.6
	netbsd-11-0-RC1:1.6
	perseant-exfatfs-base-20250801:1.6
	netbsd-11:1.6.0.8
	netbsd-11-base:1.6
	netbsd-10-1-RELEASE:1.4
	perseant-exfatfs-base-20240630:1.6
	perseant-exfatfs:1.6.0.6
	perseant-exfatfs-base:1.6
	netbsd-8-3-RELEASE:1.1.12.1
	netbsd-9-4-RELEASE:1.1.26.2
	netbsd-10-0-RELEASE:1.4
	netbsd-10-0-RC6:1.4
	netbsd-10-0-RC5:1.4
	netbsd-10-0-RC4:1.4
	netbsd-10-0-RC3:1.4
	netbsd-10-0-RC2:1.4
	thorpej-ifq:1.6.0.4
	thorpej-ifq-base:1.6
	thorpej-altq-separation:1.6.0.2
	thorpej-altq-separation-base:1.6
	netbsd-10-0-RC1:1.4
	netbsd-10:1.4.0.20
	netbsd-10-base:1.4
	bouyer-sunxi-drm:1.4.0.18
	bouyer-sunxi-drm-base:1.4
	netbsd-9-3-RELEASE:1.1.26.2
	thorpej-i2c-spi-conf2:1.4.0.16
	thorpej-i2c-spi-conf2-base:1.4
	thorpej-futex2:1.4.0.14
	thorpej-futex2-base:1.4
	thorpej-cfargs2:1.4.0.12
	thorpej-cfargs2-base:1.4
	cjep_sun2x-base1:1.4
	cjep_sun2x:1.4.0.10
	cjep_sun2x-base:1.4
	cjep_staticlib_x-base1:1.4
	netbsd-9-2-RELEASE:1.1.26.2
	cjep_staticlib_x:1.4.0.8
	cjep_staticlib_x-base:1.4
	thorpej-i2c-spi-conf:1.4.0.6
	thorpej-i2c-spi-conf-base:1.4
	thorpej-cfargs:1.4.0.4
	thorpej-cfargs-base:1.4
	thorpej-futex:1.4.0.2
	thorpej-futex-base:1.4
	netbsd-9-1-RELEASE:1.1.26.2
	bouyer-xenpvh-base2:1.3
	phil-wifi-20200421:1.3
	bouyer-xenpvh-base1:1.3
	phil-wifi-20200411:1.3
	bouyer-xenpvh:1.3.0.2
	bouyer-xenpvh-base:1.3
	is-mlppp:1.2.0.4
	is-mlppp-base:1.2
	phil-wifi-20200406:1.3
	netbsd-8-2-RELEASE:1.1.12.1
	ad-namecache-base3:1.2
	netbsd-9-0-RELEASE:1.1.26.1
	netbsd-9-0-RC2:1.1.26.1
	ad-namecache-base2:1.2
	ad-namecache-base1:1.2
	ad-namecache:1.2.0.2
	ad-namecache-base:1.2
	netbsd-9-0-RC1:1.1.26.1
	phil-wifi-20191119:1.2
	netbsd-9:1.1.0.26
	netbsd-9-base:1.1
	phil-wifi-20190609:1.1
	netbsd-8-1-RELEASE:1.1
	netbsd-8-1-RC1:1.1
	isaki-audio2:1.1.0.24
	isaki-audio2-base:1.1
	pgoyette-compat-merge-20190127:1.1
	pgoyette-compat-20190127:1.1
	pgoyette-compat-20190118:1.1
	pgoyette-compat-1226:1.1
	pgoyette-compat-1126:1.1
	pgoyette-compat-1020:1.1
	pgoyette-compat-0930:1.1
	pgoyette-compat-0906:1.1
	pgoyette-compat-0728:1.1
	netbsd-8-0-RELEASE:1.1
	phil-wifi:1.1.0.22
	phil-wifi-base:1.1
	pgoyette-compat-0625:1.1
	netbsd-8-0-RC2:1.1
	pgoyette-compat-0521:1.1
	pgoyette-compat-0502:1.1
	pgoyette-compat-0422:1.1
	netbsd-8-0-RC1:1.1
	pgoyette-compat-0415:1.1
	pgoyette-compat-0407:1.1
	pgoyette-compat-0330:1.1
	pgoyette-compat-0322:1.1
	pgoyette-compat-0315:1.1
	pgoyette-compat:1.1.0.20
	pgoyette-compat-base:1.1
	tls-maxphys:1.1.0.18
	tls-maxphys-base-20171202:1.1
	matt-nb8-mediatek:1.1.0.16
	matt-nb8-mediatek-base:1.1
	nick-nhusb-base-20170825:1.1
	perseant-stdc-iso10646:1.1.0.14
	perseant-stdc-iso10646-base:1.1
	netbsd-8:1.1.0.12
	netbsd-8-base:1.1
	prg-localcount2-base3:1.1
	prg-localcount2-base2:1.1
	prg-localcount2-base1:1.1
	prg-localcount2:1.1.0.10
	prg-localcount2-base:1.1
	pgoyette-localcount-20170426:1.1
	bouyer-socketcan:1.1.0.8
	bouyer-socketcan-base1:1.1
	jdolecek-ncq:1.1.0.6
	jdolecek-ncq-base:1.1
	pgoyette-localcount:1.1.0.4
	pgoyette-localcount-20170320:1.1
	nick-nhusb:1.1.0.2
	nick-nhusb-base-20170204:1.1;
locks; strict;
comment	@# @;


1.6
date	2023.06.03.21.26.28;	author lukem;	state Exp;
branches;
next	1.5;
commitid	Ei0aZMNlbMuRXxrE;

1.5
date	2023.06.03.08.52.56;	author lukem;	state Exp;
branches;
next	1.4;
commitid	JFrjk5m11qFkNtrE;

1.4
date	2020.09.06.07.20.29;	author mrg;	state Exp;
branches;
next	1.3;
commitid	IFqEYW6MZdeXkXmC;

1.3
date	2020.03.21.18.43.47;	author riastradh;	state Exp;
branches;
next	1.2;
commitid	CFj2amuNNTTKDi1C;

1.2
date	2019.09.13.02.19.46;	author manu;	state Exp;
branches;
next	1.1;
commitid	wG34NSXnYQKwfNCB;

1.1
date	2017.01.24.11.09.14;	author nonaka;	state Exp;
branches
	1.1.2.1
	1.1.4.1
	1.1.8.1
	1.1.12.1
	1.1.18.1
	1.1.22.1
	1.1.26.1;
next	;
commitid	BVmLyuu73R5U7dDz;

1.1.2.1
date	2017.01.24.11.09.14;	author skrll;	state dead;
branches;
next	1.1.2.2;
commitid	8hwpk1aHl2UuyLEz;

1.1.2.2
date	2017.02.05.13.40.13;	author skrll;	state Exp;
branches;
next	;
commitid	8hwpk1aHl2UuyLEz;

1.1.4.1
date	2017.01.24.11.09.14;	author pgoyette;	state dead;
branches;
next	1.1.4.2;
commitid	jjw7cAwgyKq7RfKz;

1.1.4.2
date	2017.03.20.06.57.15;	author pgoyette;	state Exp;
branches;
next	;
commitid	jjw7cAwgyKq7RfKz;

1.1.8.1
date	2017.01.24.11.09.14;	author nonaka;	state dead;
branches;
next	1.1.8.2;

1.1.8.2
date	2017.01.24.11.09.15;	author nonaka;	state Exp;
branches;
next	;

1.1.12.1
date	2019.09.18.17.30.05;	author martin;	state Exp;
branches;
next	;
commitid	2kCUF3NLaJz9bwDB;

1.1.18.1
date	2017.01.24.11.09.14;	author jdolecek;	state dead;
branches;
next	1.1.18.2;
commitid	XcIYRZTAh1LmerhA;

1.1.18.2
date	2017.12.03.11.36.19;	author jdolecek;	state Exp;
branches;
next	;
commitid	XcIYRZTAh1LmerhA;

1.1.22.1
date	2020.04.08.14.07.41;	author martin;	state Exp;
branches;
next	1.1.22.2;
commitid	Qli2aW9E74UFuA3C;

1.1.22.2
date	2020.04.13.08.03.54;	author martin;	state Exp;
branches;
next	;
commitid	X01YhRUPVUDaec4C;

1.1.26.1
date	2019.09.17.19.32.00;	author martin;	state Exp;
branches;
next	1.1.26.2;
commitid	SifblX55NJSXSoDB;

1.1.26.2
date	2020.08.17.10.30.22;	author martin;	state Exp;
branches;
next	;
commitid	kzrtJM5gQmgs7pkC;


desc
@@


1.6
log
@adapt to ${CC_WNO_ADDRESS_OF_PACKED_MEMBER}

Simplify CWARNFLAGS to use ${CC_WNO_ADDRESS_OF_PACKED_MEMBER}
which works for both clang and gcc, and remove compiler-specific
equivalents.
@
text
@#	$NetBSD: Makefile,v 1.5 2023/06/03 08:52:56 lukem Exp $

PROG=		bootx64.efi
OBJFMT=		pei-x86-64
NEWVERSWHAT=	"EFI Boot (x64)"

EXTRA_SOURCES=	efibootx64.c startprog64.S multiboot64.S

COPTS+=		-mno-red-zone
CPPFLAGS+=	-DEFI_FUNCTION_WRAPPER

# Follow the suit of Makefile.kern.inc; needed for the lfs64 union
# accessors -- they don't actually dereference the resulting pointer,
# just use it for type-checking.
CWARNFLAGS+=	${CC_WNO_ADDRESS_OF_PACKED_MEMBER}

.include "${.CURDIR}/../Makefile.efiboot"
@


1.5
log
@bsd.own.mk: rename to CC_WNO_ADDRESS_OF_PACKED_MEMBER

Provide a single variable
	CC_WNO_ADDRESS_OF_PACKED_MEMBER
with options for both clang and gcc, to replace
	CLANG_NO_ADDR_OF_PACKED_MEMBER
	CC_NO_ADDR_OF_PACKED_MEMBER
	GCC_NO_ADDR_OF_PACKED_MEMBER

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.4 2020/09/06 07:20:29 mrg Exp $
d15 1
a15 2
CWARNFLAGS.clang+=	-Wno-error=address-of-packed-member
CWARNFLAGS.gcc+=	${CC_WNO_ADDRESS_OF_PACKED_MEMBER}
@


1.4
log
@add support for new GCC 9 warnings that may be too much to fix
right now.  new address-of-packed-member and format-overflow
warnings have new GCC_NO_ADDR_OF_PACKED_MEMBER amd
GCC_NO_FORMAT_OVERFLOW variables to remove these warnings.

apply to a bunch of the tree.  mostly, these are real bugs that
should be fixed, but in many cases, only by removing the 'packed'
attribute from some structure that doesn't really need it.  (i
looked at many different ones, and while perhaps 60-80% were
already properly aligned, it wasn't clear to me that the uses
were always coming from sane data vs network alignment, so it
doesn't seem safe to remove packed without careful research for
each affect struct.)  clang already warned (and was not erroring)
for many of these cases, but gcc picked up dozens more.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.3 2020/03/21 18:43:47 riastradh Exp $
d16 1
a16 1
CWARNFLAGS.gcc+=	${GCC_NO_ADDR_OF_PACKED_MEMBER}
@


1.3
log
@Fix clang build after packed lfs64 accessor change.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.2 2019/09/13 02:19:46 manu Exp $
d16 1
@


1.2
log
@Add multiboot 2 support to x86 bootloaders

multiboot 2 is required to boot Xen on an EFI system.
This also require a kernel patch for properly discovering
the ACPI RSDP, which is available after 20190912, in
src/sys/arch/x86/acpi/acpi_machdep.c 1.26-1.28

There are a few missing bit in this multiboot 2 implementation
(which are unused by Xen):
- Header tags Address, Freambuffer, and Relocatable are ignored
- Tags APM and Network are not provided
- Tags ACPI old and ACP new are only provided for ACPI boot
- Tag boot device does not provides the subpart (BSD disklabel partition)

Notes:
- multiboot2 is disabled in dosboot, otherwise the binary
  gets too big and build fails.
- in src/sys/arch/i386/stand/efiboot, consinit() is renamed
  as efi_consinit() to avoid prototype conflicts in src/sys/sys/systm.h
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.1 2017/01/24 11:09:14 nonaka Exp $
d12 5
@


1.1
log
@Initial commit of native amd64 EFI boot loader.
@
text
@d1 1
a1 1
#	$NetBSD$
d7 1
a7 1
EXTRA_SOURCES=	efibootx64.c startprog64.S
@


1.1.22.1
log
@Merge changes from current as of 20200406
@
text
@a11 5
# Follow the suit of Makefile.kern.inc; needed for the lfs64 union
# accessors -- they don't actually dereference the resulting pointer,
# just use it for type-checking.
CWARNFLAGS.clang+=	-Wno-error=address-of-packed-member

@


1.1.22.2
log
@Mostly merge changes from HEAD upto 20200411
@
text
@d7 1
a7 1
EXTRA_SOURCES=	efibootx64.c startprog64.S multiboot64.S
@


1.1.12.1
log
@Pull up following revision(s) [adapted, via patch]
(requested by manu in ticket #1382):

	sys/arch/i386/include/multiboot2.h: revision 1.1
	sys/arch/i386/stand/lib/exec.c: revision 1.74
	sys/arch/i386/stand/efiboot/efiboot.c: revision 1.11
	sys/arch/i386/stand/efiboot/bootia32/multiboot32.S: revision 1.1
	sys/arch/i386/stand/lib/biosdisk.c: revision 1.52
	sys/arch/i386/stand/efiboot/bootx64/efibootx64.c: revision 1.5
	distrib/sets/lists/comp/md.amd64: revision 1.273
	sys/arch/i386/stand/efiboot/eficons.c: revision 1.7
	sys/arch/i386/stand/efiboot/bootia32/efibootia32.c: revision 1.5
	distrib/sets/lists/comp/md.i386: revision 1.191
	sys/arch/i386/stand/lib/libi386.h: revision 1.45
	sys/arch/i386/stand/lib/bootinfo_memmap.c: revision 1.6
	sys/arch/i386/stand/lib/pread.c: revision 1.8
	sys/arch/i386/stand/efiboot/efiboot.h: revision 1.10
	sys/arch/i386/stand/efiboot/bootia32/Makefile: revision 1.3
	sys/arch/i386/stand/lib/Makefile: revision 1.47
	sys/arch/i386/stand/efiboot/bootx64/Makefile: revision 1.2
	sys/arch/i386/stand/lib/multiboot.S: revision 1.3
	sys/arch/i386/stand/efiboot/bootx64/multiboot64.S: revision 1.1
	sys/arch/i386/stand/efiboot/efimemory.c: revision 1.9
	sys/arch/i386/stand/efiboot/boot.c: revision 1.16
	sys/arch/i386/include/Makefile: revision 1.50
	sys/arch/i386/stand/efiboot/Makefile.efiboot: revision 1.16
	share/man/man8/man8.x86/boot.8: revision 1.20
	sys/arch/i386/stand/boot/Makefile.boot: revision 1.73
	sys/arch/i386/stand/pxeboot/Makefile: revision 1.26
	sys/arch/i386/stand/lib/exec_multiboot1.c: revision 1.1
	sys/arch/i386/stand/netboot/Makefile.netboot: revision 1.11
	sys/arch/i386/stand/lib/exec_multiboot2.c: revision 1.1
	sys/arch/i386/stand/lib/biosdisk.h: revision 1.12
	sys/arch/i386/stand/lib/exec_multiboot2.c: revision 1.2
	sys/arch/i386/stand/dosboot/Makefile: revision 1.32
	sys/external/bsd/gnu-efi/dist/inc/efiapi.h (apply patch)

Add multiboot 2 support to x86 bootloaders

multiboot 2 is required to boot Xen on an EFI system.

This also require a kernel patch for properly discovering
the ACPI RSDP, which is available after 20190912, in
src/sys/arch/x86/acpi/acpi_machdep.c 1.26-1.28

There are a few missing bit in this multiboot 2 implementation
(which are unused by Xen):
- Header tags Address, Freambuffer, and Relocatable are ignored
- Tags APM and Network are not provided
- Tags ACPI old and ACP new are only provided for ACPI boot
- Tag boot device does not provides the subpart (BSD disklabel partition)

Notes:
- multiboot2 is disabled in dosboot, otherwise the binary
  gets too big and build fails.
- in src/sys/arch/i386/stand/efiboot, consinit() is renamed
  as efi_consinit() to avoid prototype conflicts in src/sys/sys/systm.h

Remove debug define.

It remained there unseen because it was misspelled!

Remove obsoeolete BUGS note that UEFI bootloader does not support multiboot

Add new multiboot2.h header.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.2 2019/09/13 02:19:46 manu Exp $
d7 1
a7 1
EXTRA_SOURCES=	efibootx64.c startprog64.S multiboot64.S
@


1.1.26.1
log
@Pull up following revision(s) (requested by manu in ticket #203):

	sys/arch/i386/include/multiboot2.h: revision 1.1
	sys/arch/i386/stand/lib/exec.c: revision 1.74
	sys/arch/i386/stand/efiboot/efiboot.c: revision 1.11
	sys/arch/i386/stand/efiboot/bootia32/multiboot32.S: revision 1.1
	sys/arch/i386/stand/lib/biosdisk.c: revision 1.52
	sys/arch/i386/stand/efiboot/bootx64/efibootx64.c: revision 1.5
	sys/arch/i386/stand/efiboot/eficons.c: revision 1.7
	sys/arch/i386/stand/efiboot/bootia32/efibootia32.c: revision 1.5
	sys/arch/i386/stand/lib/libi386.h: revision 1.45
	sys/arch/i386/stand/lib/bootinfo_memmap.c: revision 1.6
	sys/arch/i386/stand/lib/pread.c: revision 1.8
	sys/arch/i386/stand/efiboot/efiboot.h: revision 1.10
	sys/arch/i386/stand/efiboot/bootia32/Makefile: revision 1.3
	sys/arch/i386/stand/lib/Makefile: revision 1.47
	sys/arch/i386/stand/efiboot/bootx64/Makefile: revision 1.2
	sys/arch/i386/stand/lib/multiboot.S: revision 1.3
	sys/arch/i386/stand/efiboot/bootx64/multiboot64.S: revision 1.1
	sys/arch/i386/stand/efiboot/efimemory.c: revision 1.9
	sys/arch/i386/stand/efiboot/boot.c: revision 1.16
	sys/arch/i386/include/Makefile: revision 1.50
	sys/arch/i386/stand/efiboot/Makefile.efiboot: revision 1.16
	share/man/man8/man8.x86/boot.8: revision 1.20
	sys/arch/i386/stand/boot/Makefile.boot: revision 1.73
	sys/arch/i386/stand/pxeboot/Makefile: revision 1.26
	sys/arch/i386/stand/lib/exec_multiboot1.c: revision 1.1
	sys/arch/i386/stand/netboot/Makefile.netboot: revision 1.11
	sys/arch/i386/stand/lib/exec_multiboot2.c: revision 1.1
	sys/arch/i386/stand/lib/biosdisk.h: revision 1.12
	sys/arch/i386/stand/lib/exec_multiboot2.c: revision 1.2
	sys/arch/i386/stand/dosboot/Makefile: revision 1.32

Add multiboot 2 support to x86 bootloaders

multiboot 2 is required to boot Xen on an EFI system.

This also require a kernel patch for properly discovering
the ACPI RSDP, which is available after 20190912, in
src/sys/arch/x86/acpi/acpi_machdep.c 1.26-1.28

There are a few missing bit in this multiboot 2 implementation
(which are unused by Xen):
- Header tags Address, Freambuffer, and Relocatable are ignored
- Tags APM and Network are not provided
- Tags ACPI old and ACP new are only provided for ACPI boot
- Tag boot device does not provides the subpart (BSD disklabel partition)
Notes:
- multiboot2 is disabled in dosboot, otherwise the binary
  gets too big and build fails.
- in src/sys/arch/i386/stand/efiboot, consinit() is renamed
  as efi_consinit() to avoid prototype conflicts in src/sys/sys/systm.h

Remove debug define.

It remained there unseen because it was misspelled!

Remove obsoeolete BUGS note that UEFI bootloader does not support multiboot
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.1 2017/01/24 11:09:14 nonaka Exp $
d7 1
a7 1
EXTRA_SOURCES=	efibootx64.c startprog64.S multiboot64.S
@


1.1.26.2
log
@Pull up following revision(s) (requested by riastradh in ticket #1050):

	sys/ufs/lfs/lfs_subr.c: revision 1.101
	sys/ufs/lfs/lfs_subr.c: revision 1.102
	sys/ufs/lfs/lfs_inode.c: revision 1.158
	sys/ufs/lfs/lfs_inode.h: revision 1.25
	sys/ufs/lfs/lfs_balloc.c: revision 1.95
	sys/ufs/lfs/lfs_pages.c: revision 1.21
	sys/ufs/lfs/lfs_vnops.c: revision 1.330
	sys/ufs/lfs/lfs_alloc.c: revision 1.140 (patch)
	sys/ufs/lfs/lfs_alloc.c: revision 1.141 (patch)
	lib/libp2k/p2k.c: revision 1.72
	sys/ufs/lfs/lfs.h: revision 1.205
	sys/ufs/lfs/lfs.h: revision 1.206
	sys/ufs/lfs/lfs_segment.c: revision 1.284
	sys/ufs/lfs/lfs.h: revision 1.207
	sys/ufs/lfs/lfs_segment.c: revision 1.285
	sys/ufs/lfs/lfs_debug.c: revision 1.55
	sys/ufs/lfs/lfs_rename.c: revision 1.23
	usr.sbin/dumplfs/dumplfs.c: revision 1.65
	sys/ufs/lfs/lfs_vfsops.c: revision 1.371
	sys/arch/i386/stand/efiboot/bootx64/Makefile: revision 1.3
	sys/ufs/lfs/lfs_vfsops.c: revision 1.372
	sys/ufs/lfs/lfs_vfsops.c: revision 1.373
	sbin/fsck_lfs/pass1.c: revision 1.46
	sys/ufs/lfs/lfs_vnops.c: revision 1.326
	sys/ufs/lfs/lfs_vnops.c: revision 1.327
	sys/ufs/lfs/lfs_vfsops.c: revision 1.375 (patch)
	sys/ufs/lfs/lfs_vnops.c: revision 1.328
	sys/ufs/lfs/lfs_subr.c: revision 1.98
	sys/ufs/lfs/lfs_extern.h: revision 1.116
	sys/ufs/lfs/lfs_vnops.c: revision 1.329
	sys/ufs/lfs/lfs_subr.c: revision 1.99
	sys/ufs/lfs/lfs_extern.h: revision 1.117
	sys/ufs/lfs/lfs_accessors.h: revision 1.49
	sys/ufs/lfs/lfs_extern.h: revision 1.118
	sys/rump/fs/lib/liblfs/Makefile: revision 1.15
	sys/ufs/lfs/lfs_bio.c: revision 1.146 (patch)
	sys/ufs/lfs/lfs_bio.c: revision 1.147
	sys/ufs/lfs/lfs_subr.c: revision 1.100

Fix kassert in lfs by initializing vp first.

Use a marker node to iterate lfs_dchainhd / i_lfs_dchain.

I believe elements can be removed while the lock is dropped,
including the next node we're hanging on to.

Just use VOP_BWRITE for lfs_bwrite_log.
Hope this doesn't cause trouble with vfs_suspend.

Teach lfs to transition ro<->rw.

Prevent new dirops while we issue lfs_flush_dirops.

lfs_flush_dirops assumes (by KASSERT((ip->i_state & IN_ADIROP) == 0))
that vnodes on the dchain will not become involved in active dirops
even while holding no other locks (lfs_lock, v_interlock), so we must
set lfs_writer here.  All other callers already set lfs_writer.

We set fs->lfs_writer++ without explicitly doing lfs_writer_enter
because
(a) we already waited for the dirops to drain, and
(b) we hold lfs_lock and cannot drop it before setting lfs_writer.

Assert lfs_writer where I think we can now prove it.

Serialize access to the splay tree with lfs_lock.

Change some cheap KDASSERT into KASSERT.

Take a reference and fix assertions in lfs_flush_dirops.
Fixes panic:
KASSERT((ip->i_state & IN_ADIROP) == 0) at lfs_vnops.c:1670
lfs_flush_dirops
lfs_check
lfs_setattr
VOP_SETATTR
change_mode
sys_fchmod
syscall

This assertion -- and the assertion that vp->v_uflag has VU_DIROP set
-- is valid only until we release lfs_lock, because we may race with
lfs_unmark_dirop which will remove the nodes and change the flags.

Further, vp itself is valid only as long as it is referenced, which it
is as long as it's on the dchain, but lfs_unmark_dirop drops the
dchain's reference.

Don't lfs_writer_enter while holding v_interlock.

There's no need to lfs_writer_enter at all here, as far as I can see.
lfs_flush_fs will do it for us.

Break deadlock in PR kern/52301.

The lock order is lfs_writer -> lfs_seglock.  The problem in 52301 is
that lfs_segwrite violates this lock order by sometimes doing
lfs_seglock -> lfs_writer, either (a) when doing a checkpoint or (b),
opportunistically, when there are no dirops pending.  Both cases can
deadlock, because dirops sometimes take the seglock (lfs_truncate,
lfs_valloc, lfs_vfree):
(a) There may be dirops pending, and they may be waiting for the
seglock, so we can't wait for them to complete while holding the
seglock.
(b) The test for fs->lfs_dirops == 0 happens unlocked, and the state
may change by the time lfs_writer_enter acquires lfs_lock.

To resolve this in each case:
(a) Do lfs_writer_enter before lfs_seglock, since we will need it
unconditionally anyway.  The worst performance impact of this should
be that some dirops get delayed a little bit.
(b) Create a new lfs_writer_tryenter to use at this point so that the
test for fs->lfs_dirops == 0 and the acquisition of lfs_writer happen
atomically under lfs_lock.

Initialize/destroy lfs_allclean_wakeup in modcmd, not lfs_mountfs.

Fixes reloading lfs.kmod.

In lfs_update, hold lfs_writer around lfs_vflush.

Otherwise, we might do
lfs_vflush
-> lfs_seglock
-> lfs_segwait(SEGM_CKP)
   -> lfs_writer_enter
which is the reverse of the lfs_writer -> lfs_seglock ordering.

Call lfs_orphan in lfs_rename while we're still in the dirop.
lfs_writer_enter can't fail; keep it simple and don't pretend it can.

Assert that mtsleep can't fail either -- it doesn't catch signals and
there's no timeout.

Teach LFS_ORPHAN_NEXTFREE about lfs64.

Dust off the orphan detection code and try to make it work.

Fix !DIAGNOSTIC compile

Fix userland references to LFS_ORPHAN_NEXTFREE.

Forgot to grep for these or do a full distribution build, oops!

Fix missing <sys/evcnt.h> by removing the evcnts instead.

Just wanted to confirm that a race might happen, and indeed it did.
These serve little diagnostic value otherwise.

OR into bp->b_cflags; don't overwrite.

CTASSERT lfs on-disk structure sizes.

Avoid misaligned access to lfs64 on-disk records in memory.
lfs64 directory entries are only 32-bit aligned in order to conserve
space in directory blocks, and we had a hack to stuff a 64-bit inode
in them.  This replaces the hack by __aligned(4) __packed, and goes
further:

1. It's not clear that all the other lfs64 data structures are 64-bit
   aligned on disk to begin with.  We can go through these later and
   upgrade them from
        struct foo64 {
                ...
        } __aligned(4) __packed;
        union foo {
                struct foo64 f64;
                ...
        };
   to
        struct foo64 {
                ...
        };
        union foo {
                struct foo64 f64 __aligned(8);
                ...
        } __aligned(4) __packed;
   if we really want to take advantage of 64-bit memory accesses.
   However, the __aligned(4) __packed must remain on the union
   because:
2. We access even the lfs32 data structures via a union that has
   lfs64 members, and it turns out that compilers will assume access
   through a union with 64-bit aligned members implies the whole
   union has 64-bit alignment, even if we're only accessing a 32-bit
   aligned member.

Fix clang build after packed lfs64 accessor change.

Suppress spurious address-of-packed error in rump lfs too.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.1.26.1 2019/09/17 19:32:00 martin Exp $
a11 5
# Follow the suit of Makefile.kern.inc; needed for the lfs64 union
# accessors -- they don't actually dereference the resulting pointer,
# just use it for type-checking.
CWARNFLAGS.clang+=	-Wno-error=address-of-packed-member

@


1.1.18.1
log
@file Makefile was added on branch tls-maxphys on 2017-12-03 11:36:19 +0000
@
text
@d1 12
@


1.1.18.2
log
@update from HEAD
@
text
@a0 12
#	$NetBSD$

PROG=		bootx64.efi
OBJFMT=		pei-x86-64
NEWVERSWHAT=	"EFI Boot (x64)"

EXTRA_SOURCES=	efibootx64.c startprog64.S

COPTS+=		-mno-red-zone
CPPFLAGS+=	-DEFI_FUNCTION_WRAPPER

.include "${.CURDIR}/../Makefile.efiboot"
@


1.1.8.1
log
@file Makefile was added on branch bouyer-socketcan on 2017-01-24 11:09:15 +0000
@
text
@d1 12
@


1.1.8.2
log
@1468398
@
text
@a0 12
#	$NetBSD: Makefile,v 1.1 2017/01/24 11:09:14 nonaka Exp $

PROG=		bootx64.efi
OBJFMT=		pei-x86-64
NEWVERSWHAT=	"EFI Boot (x64)"

EXTRA_SOURCES=	efibootx64.c startprog64.S

COPTS+=		-mno-red-zone
CPPFLAGS+=	-DEFI_FUNCTION_WRAPPER

.include "${.CURDIR}/../Makefile.efiboot"
@


1.1.4.1
log
@file Makefile was added on branch pgoyette-localcount on 2017-03-20 06:57:15 +0000
@
text
@d1 12
@


1.1.4.2
log
@Sync with HEAD
@
text
@a0 12
#	$NetBSD: Makefile,v 1.1 2017/01/24 11:09:14 nonaka Exp $

PROG=		bootx64.efi
OBJFMT=		pei-x86-64
NEWVERSWHAT=	"EFI Boot (x64)"

EXTRA_SOURCES=	efibootx64.c startprog64.S

COPTS+=		-mno-red-zone
CPPFLAGS+=	-DEFI_FUNCTION_WRAPPER

.include "${.CURDIR}/../Makefile.efiboot"
@


1.1.2.1
log
@file Makefile was added on branch nick-nhusb on 2017-02-05 13:40:13 +0000
@
text
@d1 12
@


1.1.2.2
log
@Sync with HEAD
@
text
@a0 12
#	$NetBSD: Makefile,v 1.1 2017/01/24 11:09:14 nonaka Exp $

PROG=		bootx64.efi
OBJFMT=		pei-x86-64
NEWVERSWHAT=	"EFI Boot (x64)"

EXTRA_SOURCES=	efibootx64.c startprog64.S

COPTS+=		-mno-red-zone
CPPFLAGS+=	-DEFI_FUNCTION_WRAPPER

.include "${.CURDIR}/../Makefile.efiboot"
@


