Tomohiro Kusumi [Thu, 24 Mar 2016 16:48:30 +0000 (01:48 +0900)]
sbin/hammer: Refactor get_buffer()
buf and buf->ondisk are allocated and freed at the same time.
buf->ondisk is always NULL if buf hasn't existed, but
buf->ondisk is never NULL if buf already exists.
There isn't a situation where buf exists but buf->ondisk is
not malloced or thrown away.
Tomohiro Kusumi [Thu, 24 Mar 2016 10:20:29 +0000 (19:20 +0900)]
sbin/hammer: Add assertion to ensure not to clear modified buffer
get_buffer(isnew=1) should have an assertion here before it
zero clears ondisk buffer. If the buffer is modified but not
written back, get_buffer(isnew=1) will screw up the volume.
Tomohiro Kusumi [Thu, 24 Mar 2016 09:58:02 +0000 (18:58 +0900)]
sbin/hammer: Remove unused buffer use_count
Tomohiro Kusumi [Wed, 23 Mar 2016 08:38:52 +0000 (17:38 +0900)]
sbin/hammer: Remove cache from volume_info
Remove unused cache structure from volume_info.
volume_info doesn't use cache.
modified flag and ref count for volume_info aren't necessary
since it does nothing, other than making the code look more
complex than it actually is.
Also see the previous commit.
Tomohiro Kusumi [Tue, 22 Mar 2016 19:33:32 +0000 (04:33 +0900)]
sbin/hammer: Remove unused buffer 'type' in cache
HAMMER userspace cache is only used by general ondisk buffer.
Ondisk volume header doesn't use the cache structure.
Each program always has to explicitly flush ondisk volume header.
This commit removes buffer 'type' from cache structure since
'type' is always general ondisk buffer (non-volume buffer).
Tomohiro Kusumi [Wed, 23 Mar 2016 07:49:31 +0000 (16:49 +0900)]
sbin/hammer: Minor cleanups
Tomohiro Kusumi [Tue, 22 Mar 2016 15:06:09 +0000 (00:06 +0900)]
sbin/hammer: Use correct type
Tomohiro Kusumi [Tue, 22 Mar 2016 16:22:34 +0000 (01:22 +0900)]
sys/vfs/hammer: Use "%016jx",intmax_t
Some kprintf use long long, others use intmax_t
for HAMMER offsets and B-Tree keys in hexadecimal.
Make them all use intmax_t.
Sascha Wildner [Sun, 27 Mar 2016 14:05:45 +0000 (16:05 +0200)]
msync.2: Use .Dv
Sascha Wildner [Sat, 26 Mar 2016 12:24:09 +0000 (13:24 +0100)]
gettimeofday.2: Clarify better what we mean.
Sascha Wildner [Sat, 26 Mar 2016 12:23:28 +0000 (13:23 +0100)]
setuid.2: Use .Dv
Sascha Wildner [Fri, 25 Mar 2016 22:09:42 +0000 (23:09 +0100)]
kvm_getprocs.3: Use .Dv and start sentences on new lines.
Sascha Wildner [Fri, 25 Mar 2016 21:56:35 +0000 (22:56 +0100)]
sysctl.3: Remove KERN_QUANTUM info. We don't have it.
Peeter Must [Sun, 13 Mar 2016 15:04:40 +0000 (17:04 +0200)]
Include alias "args" in /bin/ps.
* Include alias "args" required by SUSv3.
* Improve argument handling of aliases: allows specification
of different heading as in "ps -o args=MOM".
This will make some ports happier.
Changes obtained from OpenBSD.
Sascha Wildner [Fri, 25 Mar 2016 20:22:58 +0000 (21:22 +0100)]
crypto.9: Fix .Dv typo.
Sascha Wildner [Fri, 25 Mar 2016 20:22:45 +0000 (21:22 +0100)]
bus_generic_print_child.9: Remove wrong whitespace.
Sascha Wildner [Fri, 25 Mar 2016 19:43:57 +0000 (20:43 +0100)]
VFS_SET.9: Adjust list width (we don't have VFCF_DELEGADMIN).
Sascha Wildner [Fri, 25 Mar 2016 19:40:37 +0000 (20:40 +0100)]
BUS_SETUP_INTR.9: Adjust for the removal of INTR_FAST (
f8a09be1e61a).
Peeter Must [Thu, 17 Mar 2016 09:30:09 +0000 (11:30 +0200)]
atrun(8): Fix fscanf() format to read uid and gid from the job file.
Sascha Wildner [Fri, 25 Mar 2016 10:24:20 +0000 (11:24 +0100)]
Revert "Sync ACPICA with Intel's version
20160318."
This reverts commit
9cefb7c89c63c495157c0c77d761030bf2bea9b0.
It is causing issues with acpi_timer which I need to investigate.
Revert it until then so that people don't run into subtle issues.
Sascha Wildner [Thu, 24 Mar 2016 20:13:37 +0000 (21:13 +0100)]
kernel/acpi_timer: Add a missing cpu_enable_intr() after the timer test.
It's not related to the acpi_timer issue two people are seeing with
20160318 currently, but wrong in any case.
Sascha Wildner [Thu, 24 Mar 2016 10:12:35 +0000 (11:12 +0100)]
getrlimit.2: Fix typos in .Dv's
Sascha Wildner [Thu, 24 Mar 2016 09:57:38 +0000 (10:57 +0100)]
fcntl.2: Fix typo in a .Dv
François Tigeot [Tue, 22 Mar 2016 16:34:23 +0000 (17:34 +0100)]
drm/radeon: Partial sync with Linux 3.18
Sascha Wildner [Tue, 22 Mar 2016 21:37:40 +0000 (22:37 +0100)]
kernel/802_11: Add 'static' to some function definitions.
The declarations already have it, so just a cosmetic change.
Sascha Wildner [Tue, 22 Mar 2016 20:39:33 +0000 (21:39 +0100)]
kernel/powermng: Add 'static' to some function definitions.
The declarations already have it, so just a cosmetic change.
Sascha Wildner [Tue, 22 Mar 2016 20:13:05 +0000 (21:13 +0100)]
kernel: Remove an unused variable in acpi.ko's Makefile.
Spotted-by: ivadasz
Sascha Wildner [Tue, 22 Mar 2016 19:04:36 +0000 (20:04 +0100)]
zic(8): Remove a 'register' that crept in in the last commit.
Sascha Wildner [Tue, 22 Mar 2016 18:55:49 +0000 (19:55 +0100)]
zic(8)/zdump(8): Don't warn about abbreviations like '-05'.
These seem to conform (when quoted) to POSIX.1-2001.
The most recent zoneinfo data upgrade experimentally uses such
abbreviations for the new zones it introduces.
Reported-by: zrj
John Marino [Tue, 22 Mar 2016 15:57:15 +0000 (16:57 +0100)]
Add unzip(1). If you can't beat 'em, join 'em
The unzip utility isn't particularly necessary (the version of unzip in
ports is better), but the ports tree does leverage it extensively. I've
been patching around all the resulting failures, but it's easier just to
import unzip(1) from FreeBSD and remove the ports tree modifications.
This tool has also been available in NetBSD since version 6.0, so maybe
bringing it into DragonFly will establish it as a standard BSD utility.
François Tigeot [Tue, 22 Mar 2016 12:35:16 +0000 (13:35 +0100)]
drm/linux: Implement flush_work()
Sascha Wildner [Tue, 22 Mar 2016 11:08:00 +0000 (12:08 +0100)]
Sync zoneinfo database with tzdata2016b from ftp://ftp.iana.org/tz/releases
* New zones Europe/Astrakhan, Europe/Ulyanovsk for the Russian Oblasts
(their post-1970 histories differ), and Asia/Barnaul for Altai Krai
and Altai Republic, Russia. Also, Asia/Sakhalin moves from +10 to
+11 on March 27, 2016. (Thanks to Alexander Krivenyshev for the
heads-up, and to Matt Johnson and Stepan Golosunov for followup.)
* Haiti will not observe DST in 2016. (Thanks to Jean Antoine via
Steffen Thorsen.)
* Palestine's spring-forward transition on March 26, 2016 is at 01:00,
not 00:00. (Thanks to Hannah Kreitem.)
* Europe/Chisinau observed DST during 1990, and switched from +04 to
+03 at 1990-05-06 02:00, instead of switching from +03 to +02.
(Thanks to Stepan Golosunov.)
* 1991 abbreviations in Europe/Samara should be SAMT/SAMST, not
KUYT/KUYST. (Thanks to Stepan Golosunov.)
* Comments in zone tables have been improved.
(Thanks to J William Piggott.)
* In the Theory file, the description of possible time zone
abbreviations in tzdata has been cleaned up, as the old
description was unclear and inconsistent. (Thanks to Alain Mouette
for reporting the problem.)
Sascha Wildner [Tue, 22 Mar 2016 10:50:36 +0000 (11:50 +0100)]
mtree: Use spaces to indent.
John Marino [Tue, 22 Mar 2016 10:38:42 +0000 (11:38 +0100)]
fix typo in llvm generator tool README
John Marino [Tue, 22 Mar 2016 10:37:36 +0000 (11:37 +0100)]
Install bsd.cpu.clang.mk
Imre Vadász [Tue, 15 Mar 2016 22:08:58 +0000 (23:08 +0100)]
sys/boot/Makefile: Build the UEFI bootloader.
Imre Vadász [Sat, 19 Mar 2016 12:21:40 +0000 (13:21 +0100)]
sys/boot/efi: RB_MULTIPLE doesn't exist in DragonFly.
Imre Vadász [Sat, 19 Mar 2016 12:20:52 +0000 (13:20 +0100)]
sys/boot/efi: Define SPECNAMELEN in loader/devicename.c.
* SPECNAMELEN is currently defined in sys/conf.h, which contains too much
other stuff.
Imre Vadász [Thu, 17 Mar 2016 11:46:36 +0000 (12:46 +0100)]
sys/boot/efi: No strtoul in DragonFly's libstand, just use strtol.
Imre Vadász [Thu, 17 Mar 2016 11:53:54 +0000 (12:53 +0100)]
sys/boot/efi: dloader's interact() doesn't take an argument.
Imre Vadász [Thu, 17 Mar 2016 11:52:35 +0000 (12:52 +0100)]
sys/boot/efi: Remove __arm__ and __i386__, s/amd64/x86_64/.
* Keep the __aarch64__ code.
Imre Vadász [Thu, 17 Mar 2016 11:50:24 +0000 (12:50 +0100)]
sys/boot/efi: Remove ZFS and FDT support code.
Imre Vadász [Thu, 17 Mar 2016 11:42:39 +0000 (12:42 +0100)]
sys/boot/efi: Fix EFI_RESERVED_SERVICE declaration in efiapi.h
Imre Vadász [Tue, 15 Mar 2016 22:38:14 +0000 (23:38 +0100)]
sys/boot/efi: Include <stdarg.h> in efinet.c, to fix a build error.
Imre Vadász [Tue, 15 Mar 2016 22:36:06 +0000 (23:36 +0100)]
sys/boot/efi: Use a struct efi_devdesc instead of devdesc for now.
* Using the struct devdesc as in FreeBSD's code would require some
additional updates in the generic bootloader code from FreeBSD.
Imre Vadász [Tue, 15 Mar 2016 22:19:11 +0000 (23:19 +0100)]
sys/boot/efi: Adapt Makefiles for DragonFly.
* MACHINE_CPUARCH -> MACHINE_ARCH
amd64 -> x86_64
libi386 on DragonFly is in pc32/libi386, instead of i386/libi386
Imre Vadász [Tue, 15 Mar 2016 22:26:04 +0000 (23:26 +0100)]
sys/boot/efi: Adapt x86_64/efibind.h header for DragonFly.
* Just replacing #ifdef __FreeBSD__ by #ifdef __DragonFly__.
Imre Vadász [Thu, 17 Mar 2016 10:52:11 +0000 (11:52 +0100)]
sys/boot/efi: Import self_reloc.c from FreeBSD's sys/boot/common.
Imre Vadász [Tue, 15 Mar 2016 21:59:33 +0000 (22:59 +0100)]
sys/boot/efi: Import subset of FreeBSD's sys/boot/efi needed for x86_64.
* Renamed directories sys/boot/efi/include/amd64, and
sys/boot/efi/loader/arch/amd64 to x86_64.
* Renamed sys/boot/efi/loader/arch/amd64/ldscript.amd64 to
ldscript.x86_64.
Imre Vadász [Sat, 12 Mar 2016 15:44:17 +0000 (16:44 +0100)]
sys/boot/common: Don't include libi386.h in module.c for the UEFI loader.
Imre Vadász [Mon, 15 Feb 2016 09:43:34 +0000 (10:43 +0100)]
libstand: Abort nfs_/tftp_open when called for non-network devices.
- Otherwise the (work-in-progress) port of the EFI loader from FreeBSD
crashes when nfs_open() is tried out for a disk device.
- This code isn't compiled for the existing BIOS bootloader (since it's
conditional on "#ifndef __i386__").
Taken-From: FreeBSD
Imre Vadász [Sat, 27 Feb 2016 18:34:02 +0000 (19:34 +0100)]
sys/boot/common: Add "struct stat" forward-declaration in bootstrap.h.
Imre Vadász [Sat, 19 Mar 2016 10:23:26 +0000 (11:23 +0100)]
sys/boot/pc32: Move howto_names definition to sys/boot.h.
Taken-From: FreeBSD
Imre Vadász [Tue, 15 Mar 2016 22:06:24 +0000 (23:06 +0100)]
sys/sys/linker.h: Add MODINFOMD_FW_HANDLE constant, for EFI system table.
* Will be used for passing the EFI System Table from the bootloader.
Taken-From: FreeBSD
Imre Vadász [Thu, 10 Mar 2016 00:14:11 +0000 (01:14 +0100)]
sys/dev/disk/sdhci: Add sdhci_acpi for attaching via acpi resources.
* Only attaches on Bay- and Cherry-Trail atom devices.
* Not fully functional yet. At least this still needs fixes in mmc(4)
(to get eMMC working) and ACPI improvements (for actually getting
SD-card bus power enabled via the _PS0 acpi method).
Tomohiro Kusumi [Mon, 21 Mar 2016 17:29:33 +0000 (02:29 +0900)]
sbin/hammer: Cleanup
Make hammer blockmap look more like typical HAMMER blockmap code.
No functional changes though this commit isn't just renaming of
local variables.
Tomohiro Kusumi [Mon, 21 Mar 2016 10:12:08 +0000 (19:12 +0900)]
sbin/hammer: Make hammer blockmap ignore zone=15 unless -vv
hammer blockmap ignoring UNAVAIL blockmaps for layer1 entries
is default behavior, but ignoring UNAVAIL zones for layer2 is
not default behavior. hammer blockmap will print bunch of lines
with zone=15 (HAMMER_ZONE_UNAVAIL_INDEX) unless the volume size
is (4*n)TB or somewhere close to but smaller than (4*n)TB.
This commit makes it suppress zone=15 unless -vv or more,
which also means this commit changes default behavior of this
command.
Suppressing zone=15 means it ignores layer2 entries mapped to
beyond the volume capacity. This is useful if the purpose of
running hammer blockmap is only to see blockmap mappings for
available (physically existing) big-blocks, and the volume is
much smaller than 4TB. This way you don't get to see bunch of
zone=15 that don't really tell you anything other than crc.
This is usually faster and smaller too, though real users will
almost never use this command anyway.
volume #0 layer1 #0
0 111GB 4TB
|---|----------------|
<-> <-------------->
| zone=15
zone=4,3,8,9,10,11
volume #1 layer1 #0 (layer1 #1024)
0 111GB 4TB
|---|----------------|
<-> <-------------->
| zone=15
zone=4,8,9,10,11
volume #2 layer1 #0 (layer1 #2048)
0 111GB 4TB
|---|----------------|
<-> <-------------->
| zone=15
zone=4,8,9,10,11
# newfs_hammer -L TEST /dev/da1 /dev/da2 /dev/da3 | grep DEVICE
Volume 0 DEVICE /dev/da1 size 111.79GB
Volume 1 DEVICE /dev/da2 size 111.79GB
Volume 2 DEVICE /dev/da3 size 111.79GB
# time hammer -v -f /dev/da1:/dev/da2:/dev/da3 blockmap > out1
hammer -v -f /dev/da1:/dev/da2:/dev/da3 blockmap > out1 0.10s user 0.02s system 60% cpu 0.205 total
# time hammer -vv -f /dev/da1:/dev/da2:/dev/da3 blockmap > out2
hammer -vv -f /dev/da1:/dev/da2:/dev/da3 blockmap > out2 2.10s user 0.99s system 87% cpu 3.519 total
# ls -lh out1 out2
-rw-r--r-- 1 root wheel 5.8M Mar 21 20:10 out1
-rw-r--r-- 1 root wheel 215M Mar 21 20:10 out2
Not too much difference if the volume is large enough.
Using 4.5TiB volume means hammer blockmap -vv can suppress
zone=15 for approximately 3.5TiB of address space from output,
but it contains blockmaps for 4.5TiB by default.
volume #0 layer1 #0/#1
0 4TB 4.5TB 8TB
|--------------------|---|----------------|
<----------------------> <-------------->
zone=4,3,8,9,10,11 zone=15
# newfs_hammer -L TEST /dev/da4 | grep DEVICE
Volume 0 DEVICE /dev/da4 size 4.55TB
# time hammer -v -f /dev/da4 blockmap > out1
hammer -v -f /dev/da4 blockmap > out1 0.95s user 0.24s system 68% cpu 1.755 total
# time hammer -vv -f /dev/da4 blockmap > out2
hammer -vv -f /dev/da4 blockmap > out2 1.66s user 0.49s system 89% cpu 2.385 total
# ls -lh out1 out2
-rw-r--r-- 1 root wheel 81M Mar 21 20:18 out1
-rw-r--r-- 1 root wheel 143M Mar 21 20:19 out2
Tomohiro Kusumi [Mon, 21 Mar 2016 09:57:42 +0000 (18:57 +0900)]
sbin/hammer: Change format of hammer blockmap on -v
Make it print both layer1/2 index and offset if -v or more,
instead of based on verbose level.
This is for the next commit.
Tomohiro Kusumi [Sun, 20 Mar 2016 16:31:48 +0000 (01:31 +0900)]
sys/vfs/hammer: Erase layer2 entries on removing volume
Since hammer volume-del puts layer1 entries back to UNAVAIL,
it should zero clear layer2 entries within those layer1s.
We basically want to get rid of all meta data that belonged
to this volume, not just volume header and layer1 entries.
(Layer2 entries in this volume become unreachable data after
layer1 entries lose an offset to layer2s thus should be zero
cleared.)
This commit makes this function look redundant with two full
loops of layer1/2, but this is what's necessary and makes it
more readable plus easier to conform to the original design
than having for-loop function with callback handlers.
Also see d8d6680 and de75bb2.
Tomohiro Kusumi [Sun, 20 Mar 2016 20:46:53 +0000 (05:46 +0900)]
sys/vfs/hammer: Temporary fix for kernel panic on volume-del
This is a temporary fix for a known race issue mentioned in
http://lists.dragonflybsd.org/pipermail/kernel/2015-August/175027.html
It may be replaced with a better alternative in the future.
The next commit also needs this, otherwise it's not guaranteed
that ondisk buffers are written back to the backing storage.
Matthew Dillon [Mon, 21 Mar 2016 18:33:54 +0000 (11:33 -0700)]
kernel - Fix ig4 operation for certain machines
* Some machine BIOSes use the I2C bus and leave it in a state that causes
interrupts to not work properly due to a pending interrupt having been
latched.
* Refactor the code a bit to clear pending interrupts when I2C is enabled.
This fixes the primary problem.
* Also fix a possible race condition in the interrupt handler where the
interrupt was being cleared after reading the status instead of before.
John Marino [Mon, 21 Mar 2016 17:56:50 +0000 (18:56 +0100)]
Add -march support for CCVER=clang* (new bsd.cpu.clang.mk)
Imre Vadasz [Sun, 20 Mar 2016 20:44:24 +0000 (21:44 +0100)]
kernel/pc64: Improve EFI framebuffer mapping.
* Do a proper pmap_mapdev_attr() via SYSINIT after early boot stuff is
finished.
* Make sure the EFI framebuffer is covered by the direct map, when using
PHYS_TO_DMAP to access the framebuffer as early as possible.
If it isn't covered by the direct memory map, the framebuffer will later
be properly mapped via pmap_mapdev_attr() anyway.
John Marino [Sun, 20 Mar 2016 21:07:44 +0000 (22:07 +0100)]
Import framework to build base clang (version 3.8.0)
This commit has two major components:
1) Set of tools to generate makefiles from LLVM's CMake data.
It greatly assists upgrading base clang from release to release
2) A new directory <root>/llvm_clang that will build and install
clang. It is not hooked into the world build yet.
The process for building clang is described in
tools/tools/llvm_generator/README. Basically the llvm source needs
to be symlinked to contrib/llvm after applying one patch, and then
it can be manually built and installed (and accessible via CCVER and
WORLD_CCVER).
It will not be hooked until the build until clang-built kernel modules
load properly (they load via kldload but not during boot). This was
last tested a few months ago on an llvm-38 dev branch using the customcc
functionality. clang-built worlds and kernels using clang 3.8.0 have
not been tested yet. This commit is meant to facilitate testing and
resolution of any issues with clang.
It was necessary to temporarily modify objformat to enable
WORLD_CCVER=clang to build the world. This modication will be removed
once clang officially replaces gcc47.
Sascha Wildner [Sun, 20 Mar 2016 19:07:56 +0000 (20:07 +0100)]
Sync ACPICA with Intel's version
20160318.
* Arbitrary bit length and offset support for registers defined by the
Generic Address Structure.
* ASL's Concatenate operator now allows any ACPI object to be passed
as an operand.
* Added "const" across the source.
* Various fixes and additions.
For a more detailed list, please see sys/contrib/dev/acpica/changes.txt.
Tested-by: ivadasz, tkusumi
Tomohiro Kusumi [Sun, 20 Mar 2016 09:09:28 +0000 (18:09 +0900)]
sys/vfs/hammer: Fix bug on erasing volume header
deabdbfb in 2015 had a bug in hammer volume-del ioctl which didn't
completely erase the volume header. hammer_ioc_volume_del() needed
to declare an ondisk volume variable instead of a pointer.
Having a pointer here caused bzero against the pointer itself
(within kernel stack of hammer volume-del), and then clear ondisk
volume header using kernel stack image.
The following [A] shows the volume deleted by hammer volume-del
has kernel stack itself for sizeof(struct hammer_volume_ondisk) bytes
which is 1928 bytes. It should be like [B] where 0-1928 bytes are
zero filled. [A] actually happens to erase the filesystem signature
(HAMMER_FSBUF_VOLUME) located at the first 8 bytes of the header
since it equals pointer size in x86_64, but it needs to properly
zero clear the whole header (1928 bytes) for security reason.
[A] Before this commit
# newfs_hammer -L TEST /dev/da2 > /dev/null
# mount_hammer /dev/da2 /HAMMER
# hammer volume-add /dev/da3 /HAMMER
# hammer volume-del /dev/da3 /HAMMER
# od -tx1 -N 1928 /dev/da3
0000000 00 00 00 00 00 00 00 00 40 4d 31 23 e1 ff ff ff
0000020 00 00 00 00 00 00 00 00 00 44 2a 52 e0 ff ff ff
0000040 40 4d 31 23 e1 ff ff ff 18 68 30 c4 00 00 00 00
0000060 30 66 29 1a e1 ff ff ff 18 b6 5b 22 e1 ff ff ff
...
[B] This commit
# newfs_hammer -L TEST /dev/da2 > /dev/null
# mount_hammer /dev/da2 /HAMMER
# hammer volume-add /dev/da3 /HAMMER
# hammer volume-del /dev/da3 /HAMMER
# od -tx1 -N 1928 /dev/da3
0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0003600
[C] sizeof ondisk volume header
# cat ./sizeof.c
#include <stdio.h>
#include <vfs/hammer/hammer_disk.h>
int main(void) {
printf("%d\n", (int)sizeof(struct hammer_volume_ondisk));
return 0;
}
# gcc -Wall -g ./sizeof.c
# ./a.out
1928
Tomohiro Kusumi [Sun, 20 Mar 2016 07:11:19 +0000 (16:11 +0900)]
sbin/hammer: Declare char* at the top of block scope
though gcc compiles without this.
Also change char* to const char*.
These char*s are pointers to argv[].
Sascha Wildner [Sat, 19 Mar 2016 21:14:05 +0000 (22:14 +0100)]
acpidump(8): Use the hint.acpi.0.rsdp kenv to get at the RSDP.
Using the kernel env variable instead of the sysctl can be useful
in some circumstances, for example when ACPICA is deactivated
because a box won't run with it active, yet we want to dump the
ACPI tables to investigate the problem. The kernel env variable,
which is set by the loader, is set even if the ACPICA module
is not loaded or ACPICA has been deactivated completely.
Of course, this won't help if there is a problem with finding the
RSDP itself.
I'll submit this commit upstream to Intel.
Sascha Wildner [Sat, 19 Mar 2016 21:12:29 +0000 (22:12 +0100)]
boot/acpi: Implement hint.acpi.0.rsdp for the legacy bootloader too.
I'm leaving the kernel's own RSDP searching code (acpi_sdt.c) in for
now but it is very unlikely that it will ever be triggered again
after this commit.
Sascha Wildner [Sat, 19 Mar 2016 20:51:42 +0000 (21:51 +0100)]
Sync the kenv(1) utility with FreeBSD.
Some new options and it uses the kenv() system call now.
Sascha Wildner [Sat, 19 Mar 2016 20:49:39 +0000 (21:49 +0100)]
Add a kenv(2) system call for better handling of the kernel environment.
Tomohiro Kusumi [Sat, 19 Mar 2016 07:01:59 +0000 (16:01 +0900)]
sys/vfs/hammer: Add hammer_is_zone_xxx()
Tomohiro Kusumi [Sat, 19 Mar 2016 06:59:33 +0000 (15:59 +0900)]
sys/vfs/hammer: Add HAMMER_ZONE()
Tomohiro Kusumi [Fri, 18 Mar 2016 11:08:51 +0000 (20:08 +0900)]
sys/vfs/hammer: Rename clist to node_list
The name clist comes from 2007 when there were clist and alist.
Rename it to node_list.
General naming rule in hammer is `name`_list.
e.g. target_list, cursor_list, cache_list.
Tomohiro Kusumi [Fri, 18 Mar 2016 10:11:46 +0000 (19:11 +0900)]
sys/vfs/hammer: Remove unused HAMMER_TRANSF_DIDIO
This flag is no longer used after
32fcc103.
Tomohiro Kusumi [Fri, 11 Mar 2016 14:53:44 +0000 (23:53 +0900)]
sys/vfs/hammer: Remove hammer_iterate_l1l2_entries()
This is no longer used.
Also see the previous commit.
Tomohiro Kusumi [Fri, 11 Mar 2016 14:49:15 +0000 (23:49 +0900)]
sys/vfs/hammer: Fix/rewrite hammer_free_freemap()
This commit rewrites hammer_free_freemap() used by hammer volume-del
in order to handle layer2 layout change by the previous commit.
The functional difference (other than the layout difference) is
that this commit through for-loop twice. This is to separate
counting busy layer2 and zero clearing layer1. Layer1 zero clear
should be done only when all layer2 are empty, so no ondisk change
occurs until it's ready to erase ondisk layer1. It previously had
these two in the same loop, which means if the volume consisted
of >1 layer1 it could happen to find out the volume wasn't ready
to remove after it has zero cleared layer1 entry(s).
This commit adds prototype for hammer_iterate_l1l2_entries().
This was added only to avoid compile error for not using it.
hammer_iterate_l1l2_entries() will be removed in the next commit.
(Removing it in this same commit makes default git diff without
any option unclear)
This commit does not affect a volume that was previously added
by hammer volume-add when removing that volume via hammer volume-del
after this commit. HAMMER reads layer2 offset from ondisk layer1
entries (and layer1 layout hasn't changed), so the change made by
the previous commit to conform to the original design doesn't
depend on the code once it's added.
Tomohiro Kusumi [Fri, 11 Mar 2016 14:45:16 +0000 (23:45 +0900)]
sys/vfs/hammer: Fix/rewrite hammer_format_freemap()
hammer volume-add allocates big-blocks that contain layer2 entries
in a different way from newfs_hammer.
0 8M 4T 8T 12T...
------------------|--------------------------> zone-2 address of non-root volume
L2L2L2L2.. L2L2.. <- newfs_hammer
L2L2L2L2.. L2L2.. L2L2.. L2L2.. <- hammer volume-add
This layout difference comes from where
hammer_iterate_l1l2_entries() uses the following code for layer2
entry offset.
layer2_off = phys_off + HAMMER_BLOCKMAP_LAYER2_OFFSET(block_off);
^^^^^^^^ not layer1->phys_offset
Although this works, there isn't really any reason to do it in
a different way from the original design. This commit changes the
layout to the newfs_hammer way by rewriting hammer_format_freemap().
(hammer_iterate_l1l2_entries() is tightly coupled with its callback
handlers that the above layout difference can't be fixed by just
changing phys_off to layer1->phys_offset. layer1->phys_offset
doesn't hold a valid offset at this point until all layer2 entries
are filled in, while doing layer2 stuff requires layer1->phys_offset.
This commit based on the previous 3 commits rewrites hammer_format
_freemap() without using hammer_iterate_l1l2_entries().)
This commit does not affect a volume that was previously added
by hammer volume-add. Also no need to advance HAMMER volume version.
Tomohiro Kusumi [Mon, 7 Mar 2016 13:44:54 +0000 (22:44 +0900)]
sys/vfs/hammer: Remove struct bigblock_stat
Since now that struct bigblock_stat exists only to hold a temporary
counter to count available bigblocks within each layer1 while running
through l1/l2 bigblocks, it can be done using a local variable
defined in hammer_format_freemap().
This commit removes struct bigblock_stat as well as *stat argument
from hammer_format_freemap().
Tomohiro Kusumi [Sat, 5 Mar 2016 16:42:11 +0000 (01:42 +0900)]
sys/vfs/hammer: Remove hammer_test_free_freemap()
hammer_count_bigblocks() added by the previous commit can
test if the volume if free or not by comparing result values,
so hammer_test_free_freemap() is no longer necessary.
Tomohiro Kusumi [Sat, 5 Mar 2016 14:24:28 +0000 (23:24 +0900)]
sys/vfs/hammer: Separate total/free big-block counting from formatting
Add hammer_count_bigblocks() to separate counting total/free big-blocks
from layer1/2 formatting.
This is for the next few commits.
Tomohiro Kusumi [Tue, 15 Mar 2016 22:31:02 +0000 (07:31 +0900)]
sbin/hammer: Remove unnecessary conditional on freemap initialization
if (layer2->zone == 0)
isn't necessary since this function has just zero cleared this
layer2 entry (that will be written back to the storage later).
Tomohiro Kusumi [Wed, 9 Mar 2016 15:03:02 +0000 (00:03 +0900)]
sbin/hammer: Fix writeback against readonly fd
writehammerbuf() needs to return 0 before it attempts to write
if the fd is readonly. Without this check flush_all_volumes()
may fail before all modified volume headers are written back
to the backing storage.
The only reason this hasn't become an issue so far is because
no existing hammer command creates readonly volume_info while
there are rw volume_info that need to be written back, which
could happen depending on the purpose of commands.
Tomohiro Kusumi [Wed, 9 Mar 2016 00:04:20 +0000 (09:04 +0900)]
sbin/hammer: Fix conditional for Hammer_FSId initialization
Hammer_FSId is initialized when no entry in the VolList yet,
but this becomes an issue when a new volume (that hasn't joined
the HAMMER filesystem yet) is the first created volume_info.
If the second volume_info is for the existing HAMMER volume,
it is likely that
bcmp(&Hammer_FSId, &ondisk->vol_fsid, sizeof(Hammer_FSId))
does not match and results in the following error.
"load_volume: %s: FSId does match other volumes!"
The only reason this hasn't become an issue so far is because
no existing hammer command creates volume_info in that order.
Tomohiro Kusumi [Tue, 8 Mar 2016 07:58:03 +0000 (16:58 +0900)]
sbin/hammer: Remove unnecessary if(AssertOnFailure) conditionals
If get_volume(vol_no) fails to find a volume, there is basically
no way that /sbin/hammer can proceed the rest of the process,
so if(AssertOnFailure) isn't necessary.
(buf_offset & HAMMER_OFF_ZONE_MASK) == HAMMER_ZONE_RAW_BUFFER
should be checked unconditionally.
Tomohiro Kusumi [Tue, 8 Mar 2016 06:49:06 +0000 (15:49 +0900)]
sbin/hammer: Remove =0; for some global variables
Tomohiro Kusumi [Tue, 8 Mar 2016 09:32:22 +0000 (18:32 +0900)]
sbin/newfs_hammer: Fix wrong comment
This comment has nothing to do with the code today.
(See
7e1ba5da and
68e079b8 in 2008)
Tomohiro Kusumi [Mon, 7 Mar 2016 19:07:03 +0000 (04:07 +0900)]
sbin/newfs_hammer: Define UndoBufferSize in newfs_hammer
This is only needed and usable by newfs_hammer option -u.
Tomohiro Kusumi [Mon, 7 Mar 2016 18:56:15 +0000 (03:56 +0900)]
sbin/newfs_hammer: Define Boot|MemAreaSize in newfs_hammer
These are only needed and usable by newfs_hammer options -b and -m.
Tomohiro Kusumi [Mon, 7 Mar 2016 16:06:47 +0000 (01:06 +0900)]
sbin/newfs_hammer: Rename format_root() to format_root_directory()
Explicitly mention what root it is.
(HAMMER has root inode/directory, root volume, root PFS)
Tomohiro Kusumi [Mon, 7 Mar 2016 15:34:15 +0000 (00:34 +0900)]
sbin/hammer: Minor fix for format_blockmap()
Take *vol instead of blockmap for the first argument.
Properly set modified flag to 1 (no actual change since newfs_hammer
should have already set it to 1 via format_freemap()).
Add assertion.
Locate this function right above format_freemap().
Tomohiro Kusumi [Wed, 9 Mar 2016 18:20:12 +0000 (03:20 +0900)]
sbin/hammer: Initialize Hammer_FSType before any subcommand
Ondisk volume header fstype uuid is always compared with the
global variable Hammer_FSType uuid whenever volume information
is read from the existing HAMMER volume. Then Hammer_FSType
should be initialized before any hammer command starts whether
each subcommand actually reads from the HAMMER volumes or not.
Tomohiro Kusumi [Mon, 7 Mar 2016 09:57:25 +0000 (18:57 +0900)]
sbin/hammer: Separate setup_volume() into init/load_volume()
Separate setup_volume() into isnew == 0 and 1 case.
setup_volume() taking two args vol_no and isnew is redundant.
Use init_volume() when newly creating a HAMMER volume.
Use load_volume() when the HAMMER volume already exists.
This commit is based on functions added by the previous two commits.
Tomohiro Kusumi [Mon, 7 Mar 2016 09:31:06 +0000 (18:31 +0900)]
sbin/hammer: Add __add_volume()
Extract volume registration code into a separate function.
Tomohiro Kusumi [Mon, 7 Mar 2016 09:23:13 +0000 (18:23 +0900)]
sbin/hammer: Add __alloc_volume()
Extract volume allocation code into a separate function.
Tomohiro Kusumi [Sun, 6 Mar 2016 07:10:38 +0000 (16:10 +0900)]
sbin/hammer: Add get_root_volume()
Add a wrapper for get_volume(HAMMER_ROOT_VOLNO).
Tomohiro Kusumi [Sat, 19 Mar 2016 11:04:41 +0000 (20:04 +0900)]
sbin/hammer: Update blockmap lookup error#
The previous commit has removed -3, so update the existing ones.
We want to keep different numbers for each for debugging purpose
for hammer show command. hammer show prints these error codes.
Note that hammer show on the current production release (4.4)
doesn't directly print error code, but instead prints a string
(that doesn't contain the error code digit within char[]).
hammer show's output format has changed quite a bit in 4.5, and
directly showing error code is one of them. This commit doesn't
confuse 4.4 users, in other words it doesn't make hammer show
print "-3" on what was -4 in 4.4, since 4.4 doesn't print the
code itself.
Tomohiro Kusumi [Sat, 5 Mar 2016 17:47:55 +0000 (02:47 +0900)]
sys/vfs/hammer: Add HAMMER_ROOT_VOLNO
The root volume# is always 0, so hammer userspace can use 0
instead of having a global variable RootVolNo that needs to
be set from -1 to 0 (and only 0).
Ondisk volume header even has fields whose name start with
vol0_xxx. This implies the root volume# is designed to be 0,
but nothing else.
Tomohiro Kusumi [Sun, 6 Mar 2016 07:04:55 +0000 (16:04 +0900)]
sbin/newfs_hammer: Cleanup
(vol_buf_end - vol_buf_beg) is the maximum filesystem size available
for each volume, including big-blocks for layers and UNDO fifo.
Imre Vadász [Thu, 17 Mar 2016 20:25:56 +0000 (21:25 +0100)]
mmcsd(4): Fix typo in disk_create() args. Allows accessing >1 SD-/MMC-card.
* sc->unit was always 0, so only mmcsd0 was accessible.