dragonfly.git
8 years agodm_target_delay.4: Clean up a wee bit.
Sascha Wildner [Mon, 12 Oct 2015 07:14:40 +0000 (09:14 +0200)]
dm_target_delay.4: Clean up a wee bit.

8 years agoRevert "kernel/scsi: Fix sense information printing in bootverbose."
Sascha Wildner [Mon, 12 Oct 2015 06:56:03 +0000 (08:56 +0200)]
Revert "kernel/scsi: Fix sense information printing in bootverbose."

This reverts commit f5c36c3e4c612f366cb62cfdfeb4097e1d585ca8.

This needs more investigation. The revert is slightly different in that it
uses just "#if 0" for now.

8 years agosys/dev/disk/dm: Add manpage for dm_target_delay(4)
Tomohiro Kusumi [Sun, 11 Oct 2015 06:21:32 +0000 (15:21 +0900)]
sys/dev/disk/dm: Add manpage for dm_target_delay(4)

Note that crypt, striped, and delay (this commit) are the
only dm targets with manpage.

linear seems to be the missing manpage for dm targets that
is currently available (usable) in DragonFly. linear is
actually redirected to dm(4) with no independent manpage.

zero and error are only mentioned as "mostly for testing"
in dm(4) manpage. These have no specific table params.
These are not kernel modules.

8 years agosys/dev/disk/dm: Remove unused prototype and wrong comments
Tomohiro Kusumi [Sat, 10 Oct 2015 17:52:05 +0000 (02:52 +0900)]
sys/dev/disk/dm: Remove unused prototype and wrong comments

8 years agosys/dev/disk/dm: Separate dm_dev_rem_dev() from dm_dev_rem()
Tomohiro Kusumi [Sat, 10 Oct 2015 16:18:51 +0000 (01:18 +0900)]
sys/dev/disk/dm: Separate dm_dev_rem_dev() from dm_dev_rem()

dm_dev_rem() should be separated into two functions where
one takes *dmv and the other takes name,uuid,minor for args.

If a caller has a pointer to dm device, then it basically
never use the rest. If not the caller may use all the rest.

dm_dev_rem() currently taking all four args makes it more
complicated than it should. Also this is closer to the
original NetBSD implementation.

8 years agosys/dev/disk/dm: Cleanups
Tomohiro Kusumi [Sat, 10 Oct 2015 15:04:21 +0000 (00:04 +0900)]
sys/dev/disk/dm: Cleanups

8 years agosys/dev/disk/dm: Change unused dev types to reserved
Tomohiro Kusumi [Sat, 10 Oct 2015 13:44:22 +0000 (22:44 +0900)]
sys/dev/disk/dm: Change unused dev types to reserved

DM_DELETING_DEV and DM_SPARE_DEV have never been used
by dm core in both DragonFly and NetBSD, nor are they
name of dm targets. Also remove irrelevant comment.

8 years agosys/dev/disk/dm: Add dm-delay target
Tomohiro Kusumi [Fri, 2 Oct 2015 18:01:38 +0000 (03:01 +0900)]
sys/dev/disk/dm: Add dm-delay target

Examples
=====
  # newfs_hammer -L TEST /dev/da3 > /dev/null
  # mount_hammer /dev/da3 /HAMMER
  # hammer volume-list /HAMMER
  /dev/da3
  # cd /HAMMER
  # time git clone /usr/local/src/dragonfly
  Cloning into 'dragonfly'...
  done.
  Checking out files: 100% (34298/34298), done.
  git clone /usr/local/src/dragonfly 2.88s user 4.26s system 48% cpu 14.577 total

=====
  # newfs_hammer -L TEST /dev/da3 > /dev/null
  # kldload dm
  # dmsetup create delay1 --table '0 234436482 delay /dev/da3 0 10 /dev/da3 0 10'
  # dmsetup ls --tree
  delay1 (255:504430599)
  `- (0:504430623)
  # mount_hammer /dev/mapper/delay1 /HAMMER
  # hammer volume-list /HAMMER
  /dev/mapper/delay1
  # cd /HAMMER
  # time git clone /usr/local/src/dragonfly
  Cloning into 'dragonfly'...
  done.
  Checking out files: 100% (34298/34298), done.
  git clone /usr/local/src/dragonfly 2.78s user 3.91s system 5% cpu 2:05.05 total

8 years agosys/dev/disk/dm: Remove #if0'd code from NetBSD
Tomohiro Kusumi [Fri, 9 Oct 2015 17:35:57 +0000 (02:35 +0900)]
sys/dev/disk/dm: Remove #if0'd code from NetBSD

DragonFly has no bp->b_blkno field.
Linear mapping in DragonFly is done by

bp->b_bio1.bio_offset = (offset - logical_volume_start)
bp->b_bio1.bio_offset += (physical_volume_start)

Also change printf to kprintf.

8 years agosys/dev/disk/dm: Fix wrong ref release
Tomohiro Kusumi [Sat, 3 Oct 2015 20:56:02 +0000 (05:56 +0900)]
sys/dev/disk/dm: Fix wrong ref release

dm_table_release() has released a reference for this target.
Having another release by dm_target_unbusy() leads to panic
whenever a target's init() function returns non zero.

8 years agosys/dev/disk/dm: Don't define target specific defs in dm.h
Tomohiro Kusumi [Sat, 3 Oct 2015 07:29:22 +0000 (16:29 +0900)]
sys/dev/disk/dm: Don't define target specific defs in dm.h

dm targets should not have target local structures, function
prototypes, etc in dm.h which is a header for dm core.
It has no dependency on a certain dm target, and works with
or without a certain dm target.

Targets local structures are usually private data part of dm,
and target local functions are called via pointers. dm core
doesn't recognize these by names or types.

NetBSD had (and still has) it this way, but this change will
not make it any difficult to sync with NetBSD in the future
since NetBSD also isn't likely to use them in dm core by its
design. They're just defined there.

8 years agosys/dev/disk/dm: Remove unused macro MAX_TARGET_STRING_LEN
Tomohiro Kusumi [Sat, 3 Oct 2015 12:42:57 +0000 (21:42 +0900)]
sys/dev/disk/dm: Remove unused macro MAX_TARGET_STRING_LEN

Not sure what this is for and never used in both DragonFly
and NetBSD.

8 years agosys/dev/disk/dm: Fix typos/etc in kprintf
Tomohiro Kusumi [Thu, 1 Oct 2015 17:32:14 +0000 (02:32 +0900)]
sys/dev/disk/dm: Fix typos/etc in kprintf

* Fix typos
* Add missing \n
* Remove \n from \n\n
* Remove unnecessary ' '

8 years agosys/dev/disk/dm: Use dm_table_get_entry()
Tomohiro Kusumi [Thu, 1 Oct 2015 18:34:43 +0000 (03:34 +0900)]
sys/dev/disk/dm: Use dm_table_get_entry()

8 years agosys/dev/disk/dm: Conform to style(9)
Tomohiro Kusumi [Thu, 1 Oct 2015 17:14:18 +0000 (02:14 +0900)]
sys/dev/disk/dm: Conform to style(9)

8 years agosys/dev/disk/dm: Add if(debug) conditional to kprintf in strategy()
Tomohiro Kusumi [Thu, 1 Oct 2015 10:17:44 +0000 (19:17 +0900)]
sys/dev/disk/dm: Add if(debug) conditional to kprintf in strategy()

There are 6 unconditional aprint_debug() in dm strategy which
means there are 6 if(debug) conditional kprintf() for each
dm mapping entry.

Compilers may optimize (it doesn't on my env via buildkernel),
but add if(debug) outside these prints and use aprint_normal().

8 years agosys/dev/disk/dm: Fix DragonFly dm specific whitespace stuff
Tomohiro Kusumi [Wed, 30 Sep 2015 17:08:44 +0000 (02:08 +0900)]
sys/dev/disk/dm: Fix DragonFly dm specific whitespace stuff

These are mostly directly taken from NetBSD but the original
code has no \t$ here and it's better without \t$.

8 years agosys/dev/disk/dm: Include sys/buf.h
Tomohiro Kusumi [Wed, 30 Sep 2015 16:56:07 +0000 (01:56 +0900)]
sys/dev/disk/dm: Include sys/buf.h

Include an appropriate header instead of
struct buf;.

8 years agosys/dev/disk/dm: Make global dm locks static
Tomohiro Kusumi [Wed, 30 Sep 2015 16:25:19 +0000 (01:25 +0900)]
sys/dev/disk/dm: Make global dm locks static

These are all local to each file.

If ever needed by others, it should provide appropriate
interface instead of allowing access to raw lock variables.

8 years agosys/dev/disk/dm: Fix indentation and cleanups
Tomohiro Kusumi [Wed, 30 Sep 2015 14:03:27 +0000 (23:03 +0900)]
sys/dev/disk/dm: Fix indentation and cleanups

8 years agosys/dev/disk/dm: Remove prototype of not existing function
Tomohiro Kusumi [Tue, 29 Sep 2015 12:47:45 +0000 (21:47 +0900)]
sys/dev/disk/dm: Remove prototype of not existing function

8 years agosys/dev/disk/dm: Remove unconditional kprintf in strategy()
Tomohiro Kusumi [Tue, 29 Sep 2015 12:14:33 +0000 (21:14 +0900)]
sys/dev/disk/dm: Remove unconditional kprintf in strategy()

dm-error has unconditional kprintf in strategy originally
brought from the same function in NetBSD, but this is just
bothering considering the purpose of this dm target is to
generate an error.

8 years agousr.bin/undo: Add fopen(3) wrapper
Tomohiro Kusumi [Mon, 28 Sep 2015 13:56:09 +0000 (22:56 +0900)]
usr.bin/undo: Add fopen(3) wrapper

8 years agousr.bin/undo: Fix error handling
Tomohiro Kusumi [Mon, 28 Sep 2015 12:16:59 +0000 (21:16 +0900)]
usr.bin/undo: Fix error handling

As mentioned in the previous commit, collect_history() should
set error variable to errno when open(2) failed.

This commit does this by adding a new wrapper function for
collect_history() and renaming the existing collect_history()
to __collect_history(). The renamed collect_history() takes
const char* instead of fd and updates error if open(2) fails.

This is at least better although the error message changed
by the previous commit is still there without strerror().

8 years agousr.bin/undo: Fix ambiguous and/or wrong error message
Tomohiro Kusumi [Mon, 28 Sep 2015 11:46:40 +0000 (20:46 +0900)]
usr.bin/undo: Fix ambiguous and/or wrong error message

printf("%s: ITERATE ENTIRE HISTORY: %s\n", filename, strerror(error));
in doiterate() doesn't necessary show an appropriate error
message.

There are several collect_history() calls prior to printf()
and this printf() is only showing the result of the last one.
Also from the way collect_history() is being used, open(2)
failure doesn't set error to errno value (error remains 0).
This results in printf() showing "Undefined error: 0" for an
invalid path and possibly hiding the real errno prior to the
last collection.

This commit changes it to "No UNDO history found" without
strerror(), which is never insane. The whole error handling
needs to be changed in order to show an error message that
is right and makes sense in every situation.

=====
e.g. undo -i with invalid path
  # undo -i /not/existing/path
  /not/existing/path: ITERATE ENTIRE HISTORY: Undefined error: 0

8 years agousr.bin/undo: Add missing error propagation
Tomohiro Kusumi [Sun, 27 Sep 2015 10:04:06 +0000 (19:04 +0900)]
usr.bin/undo: Add missing error propagation

collect_dir_history() needs to update *errorp with result of
collect_history() which is result of ioctl().

8 years agousr.bin/undo: Refactoring [2/2]
Tomohiro Kusumi [Mon, 28 Sep 2015 11:05:12 +0000 (20:05 +0900)]
usr.bin/undo: Refactoring [2/2]

Make outFileName and outFilePostfix global.

8 years agousr.bin/undo: Refactoring [1/2]
Tomohiro Kusumi [Mon, 28 Sep 2015 11:01:10 +0000 (20:01 +0900)]
usr.bin/undo: Refactoring [1/2]

Sync with doiterate's arguments order.

8 years agousr.bin/undo: Use CMD_ITERATEALL
Tomohiro Kusumi [Sun, 27 Sep 2015 08:01:46 +0000 (17:01 +0900)]
usr.bin/undo: Use CMD_ITERATEALL

CMD_ITERATEALL hasn't been used although -i and -a set
cmd to CMD_ITERATEALL. This makes doiterate() less readable.
Change (A) to (B) to make it more readable and maintainable.
No funcional changes.

=====(A)
if (cmd == CMD_DUMP) { ... }
else if (RB_ROOT(&tse_tree)) { ... }
else { fprintf(stderr, ...); }

=====(B)
switch (cmd) {
case CMD_DUMP:
    doiterate_dump(); break;
case CMD_ITERATEALL:
    doiterate_iterall(); break;
}

8 years agousr.bin/undo: Remove redundant history collection
Tomohiro Kusumi [Sat, 26 Sep 2015 20:16:15 +0000 (05:16 +0900)]
usr.bin/undo: Remove redundant history collection

collect_history(fd, &error, &tse_tree);
is done right before this unconditionally. If the previous
collect were empty, this collect after if(cmd == CMD_DUMP)
will most likely be empty.

(It also doesn't really matter if the result has changed
before and after if(cmd == CMD_DUMP) conditional since that's
not what this program cares about anyway)

Also see 3260eed4.

8 years agousr.bin/undo: Rename UNDO_FLAG_SETTID[12] to UNDO_FLAG_TID_INDEX[12]
Tomohiro Kusumi [Sat, 26 Sep 2015 19:45:58 +0000 (04:45 +0900)]
usr.bin/undo: Rename UNDO_FLAG_SETTID[12] to UNDO_FLAG_TID_INDEX[12]

"SETTID[12]" doen't represent what these macros are used for,
but rather confusing as it sounds like it has something to do
with the real transaction id.

"SETTID[12]" means tid field isn't hammer's transaction id,
but is placeholder index, so it should have "INDEX" somewhere
in its name.

See 965778c8 for these two macros.

8 years agousr.bin/undo: Fix undo(1) manpage
Tomohiro Kusumi [Sun, 27 Sep 2015 08:55:48 +0000 (17:55 +0900)]
usr.bin/undo: Fix undo(1) manpage

"0x16chars" is not understandable.

8 years agousr.bin/undo: Add path@@ to fake transaction id message
Tomohiro Kusumi [Sat, 26 Sep 2015 18:33:45 +0000 (03:33 +0900)]
usr.bin/undo: Add path@@ to fake transaction id message

8 years agousr.bin/undo: Cleanups
Tomohiro Kusumi [Sat, 26 Sep 2015 18:30:42 +0000 (03:30 +0900)]
usr.bin/undo: Cleanups

8 years agousr.bin/undo: Add missing free(3)
Tomohiro Kusumi [Sat, 26 Sep 2015 12:34:23 +0000 (21:34 +0900)]
usr.bin/undo: Add missing free(3)

8 years agousr.bin/undo: Remove temporary tree handling
Tomohiro Kusumi [Sat, 26 Sep 2015 10:12:54 +0000 (19:12 +0900)]
usr.bin/undo: Remove temporary tree handling

There isn't any requirement to collect history for dryrun,
so temporary rbtree code could get rid of for simplicity.

8 years agosys/vfs/hammer: Add error messages for crc test failure
Tomohiro Kusumi [Fri, 25 Sep 2015 17:04:37 +0000 (02:04 +0900)]
sys/vfs/hammer: Add error messages for crc test failure

Add crc error messages based on the existing error message
in hammer_btree_extract(). The one in hammer_mirror.c is
a part of #if0'd function.

Reported-by: profmakx
Suggested-by: dillon
23:27 (tkusumi) too many error = EIO;  but possibly bad crc ?
23:28 (tkusumi) if bad crc is the case turning on hammer_debug_critical leads to Debugger("CRC FAILED: B-TREE NODE");
23:40 (dillon) it's likely a CRC failure, though I think it should print those out on the console too
23:54 (tkusumi) some bad crc are missing  "CRC DATA @ %016llx/%d FAILED\n"
23:59 (dillon) those could be added for clarity.  Almost universally EIO from hammer means a bad CRC and not an actual disk read error.
23:59 (dillon) USB-connected hard drives seem to get these.  I've never gotten a bad CRC from a SATA-connected HDD via the AHCI driver.

8 years agosbin/mount_hammer: Fix mount(2) error handling
Tomohiro Kusumi [Fri, 25 Sep 2015 12:41:52 +0000 (21:41 +0900)]
sbin/mount_hammer: Fix mount(2) error handling

Move mount(2) error handling code to a newly added function
test_volumes().

* Omit printing strcated volume names since this is obvious
  from an error message for each volume. Also note mount(2)
  could fail when open(2), read(2) and signature check, etc
  don't fail which makes this confusing (see 331432f3).
* Add vol_count check in addition to signature check.

8 years agosbin/mount_hammer: Minor fix and cleanups
Tomohiro Kusumi [Fri, 25 Sep 2015 12:13:03 +0000 (21:13 +0900)]
sbin/mount_hammer: Minor fix and cleanups

(Note that -Werror=cast-qual doesn't allow freeing info->volumes[i].
It was better without const given that blkdevs format arg requires
parsing + strdup)

8 years agodrm: Fix drm_ioctl error return values.
Imre Vadász [Thu, 8 Oct 2015 20:24:44 +0000 (22:24 +0200)]
drm: Fix drm_ioctl error return values.

Fixes some cases where we accidentally returned a negative value
from drm_ioctl().
Also this change converts the ERESTARTSYS error value to EINTR, before
returning it to userspace.

8 years agodrm/i915: Add intel_gmch_remove()
François Tigeot [Sat, 10 Oct 2015 08:32:12 +0000 (10:32 +0200)]
drm/i915: Add intel_gmch_remove()

8 years agotest/tcp_stream: Add option for message size
Sepherosa Ziehau [Fri, 9 Oct 2015 13:40:18 +0000 (21:40 +0800)]
test/tcp_stream: Add option for message size

While I'm here, reorder options string.

8 years agodrm/drm_fops.c: Sync drm_dequeue_event() and drm_read() to Linux-3.17
Imre Vadász [Wed, 7 Oct 2015 19:34:29 +0000 (21:34 +0200)]
drm/drm_fops.c: Sync drm_dequeue_event() and drm_read() to Linux-3.17

This cleans up some event_lock usage differences between code in drm_irq.c
and drm_fops.c.

This fixes/replaces the broken locking in drm_read() since
20c04ff7518d03d534531abe74195e7e7a26a64e, which didn't release event_lock
in all cases.

8 years agokernel/ipfw3: Some build fixes.
Sascha Wildner [Wed, 7 Oct 2015 16:10:36 +0000 (18:10 +0200)]
kernel/ipfw3: Some build fixes.

* ipfw_ctx is now used by another file in the module, so un-staticize
  it.

* Add the new file to sys/conf/files so that building ipfw3 into the
  kernel with "options IPFIREWALL3" doesn't break.

8 years agoipfw3: lookup_state for keep-state and check-state
Bill Yuan [Fri, 2 Oct 2015 01:00:45 +0000 (09:00 +0800)]
ipfw3: lookup_state for keep-state and check-state

8 years agoipfw3: support ip:port in filter from and new filter src-port
Bill Yuan [Thu, 1 Oct 2015 18:19:44 +0000 (02:19 +0800)]
ipfw3: support ip:port in filter from and new filter src-port
1. support ip:port in both filters 'from' and 'to'
2. new filters 'src-port' and 'dst-port'

e.g. block UDP packets to 192.168.1.1:1813
ipfw3 add deny udp to 192.168.1.1:1813
ipfw3 add deny udp to 192.168.1.1 dst-port 1813

8 years agoipfw3: not-in-use keywords
Bill Yuan [Thu, 1 Oct 2015 16:17:01 +0000 (00:17 +0800)]
ipfw3: not-in-use keywords

8 years agoipfw3: layer2 filter with lookup table
Bill Yuan [Thu, 1 Oct 2015 07:26:45 +0000 (15:26 +0800)]
ipfw3: layer2 filter with lookup table

8 years agoipfw3: shorten func show_filter and MACRO
Bill Yuan [Thu, 1 Oct 2015 06:32:35 +0000 (14:32 +0800)]
ipfw3: shorten func show_filter and MACRO

8 years agoipfw3: filtering with lookup table
Bill Yuan [Thu, 1 Oct 2015 05:04:23 +0000 (13:04 +0800)]
ipfw3: filtering with lookup table

8 years agoipfw3: func to (re)name the table
Bill Yuan [Thu, 1 Oct 2015 04:09:09 +0000 (12:09 +0800)]
ipfw3: func to (re)name the table

8 years agoipfw3: func to check if val exists in tbl
Bill Yuan [Thu, 1 Oct 2015 03:12:35 +0000 (11:12 +0800)]
ipfw3: func to check if val exists in tbl

usage:
ipfw3 table <id> test <type> <val>
output:
YES, <val> exists in table <id>
NO, <val> not exists in table <id>

8 years agoipfw3: misc fix
Bill Yuan [Thu, 1 Oct 2015 02:59:20 +0000 (10:59 +0800)]
ipfw3: misc fix

8 years agoipfw3: support lookup tables
Bill Yuan [Thu, 1 Oct 2015 01:26:11 +0000 (09:26 +0800)]
ipfw3: support lookup tables

8 years agodrm - Fix GENMASK()
Matthew Dillon [Tue, 6 Oct 2015 17:18:45 +0000 (10:18 -0700)]
drm - Fix GENMASK()

Fix GENMASK macro bug.  Used in just one place in the register whitelist
code used by the drm ioctl (unclear whether the ioctl was broken by the
bug or not).

Reported-by: Hans Petter Selasky <hselasky@gmail.com>
8 years agokernel/acpi_ec: Fix KTR_ACPI_EC logging for various 8-bit arguments.
Sascha Wildner [Tue, 6 Oct 2015 17:01:14 +0000 (19:01 +0200)]
kernel/acpi_ec: Fix KTR_ACPI_EC logging for various 8-bit arguments.

8 years agokernel/ktr: Make room in KTR_TESTLOG's mask for future format tests.
Sascha Wildner [Mon, 5 Oct 2015 16:02:33 +0000 (18:02 +0200)]
kernel/ktr: Make room in KTR_TESTLOG's mask for future format tests.

8 years agoSync zoneinfo database with tzdata2015g from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Mon, 5 Oct 2015 15:52:53 +0000 (17:52 +0200)]
Sync zoneinfo database with tzdata2015g from ftp://ftp.iana.org/tz/releases

* Turkey's 2015 fall-back transition is scheduled for Nov. 8,
    not Oct. 25. (Thanks to Fatih.)

* Norfolk moves from +1130 to +1100 on 2015-10-04 at 02:00 local time.
    (Thanks to Alexander Krivenyshev.)

* Norfolk observed DST from 1974-10-27 02:00 to 1975-03-02 02:00.

* Fiji's 2016 fall-back transition is scheduled for January 17, not 24.
    (Thanks to Ken Rylander.)

* Fort Nelson, British Columbia will not fall back on 2015-11-01.
    It has effectively been on MST (-0700) since it advanced its clocks
    on 2015-03-08.

* New zone America/Fort_Nelson.  (Thanks to Matt Johnson.)

8 years agokernel/ktr: Add some more meaningful tests to KTR_TESTLOG.
Sascha Wildner [Mon, 5 Oct 2015 11:44:47 +0000 (13:44 +0200)]
kernel/ktr: Add some more meaningful tests to KTR_TESTLOG.

8 years agoktrdump(8): Fix h, hh and t modifiers. Fix i conversion specifier.
Sascha Wildner [Mon, 5 Oct 2015 11:09:19 +0000 (13:09 +0200)]
ktrdump(8): Fix h, hh and t modifiers. Fix i conversion specifier.

8 years agoktrdump(8): Adjust the column headers to the columns.
Sascha Wildner [Sun, 4 Oct 2015 10:18:55 +0000 (12:18 +0200)]
ktrdump(8): Adjust the column headers to the columns.

8 years agoktrdump(8): Fix %#x format printing.
Sascha Wildner [Sat, 3 Oct 2015 22:57:31 +0000 (00:57 +0200)]
ktrdump(8): Fix %#x format printing.

8 years agoSync ACPICA with Intel's version 20150930.
Sascha Wildner [Thu, 1 Oct 2015 15:54:35 +0000 (17:54 +0200)]
Sync ACPICA with Intel's version 20150930.

* Various fixes in the debugger.

* Improved run-time and compile-time typechecking in the interpreter
  and compiler along with options to enable/disable.

* Fix a bit polarity issue of one flag in the NFIT table.

* Add ASL+ support for the ASL Index operator (Index(PKG1, 3) can now
  be written as PKG1[3]).

* In IASL, fixed the file suffix for the preprocesser output file (.i).

For a more detailed list, please see sys/contrib/dev/acpica/changes.txt.

8 years agohier.7: Explain /lib and /libexec. Remove /usr/libexec/sendmail.
Sascha Wildner [Thu, 1 Oct 2015 07:25:39 +0000 (09:25 +0200)]
hier.7: Explain /lib and /libexec. Remove /usr/libexec/sendmail.

/lib and /libexec info taken from FreeBSD.

8 years agokernel/sound: Port MIDI support.
Sascha Wildner [Wed, 30 Sep 2015 17:28:34 +0000 (19:28 +0200)]
kernel/sound: Port MIDI support.

This was dropped without a clear rationale. Our uaudio(4) for example
supports a whole bunch of MIDI devices.

Tested-by: Ben Woolley <tautolog@gmail.com>
8 years agoRevert "sound: Drop midi support"
Sascha Wildner [Wed, 30 Sep 2015 17:21:39 +0000 (19:21 +0200)]
Revert "sound: Drop midi support"

This reverts commit 5bea67f41d941ba13d0b25782f6a3b9a9460e98e.

8 years agorpcbind - Fix crash
Matthew Dillon [Tue, 29 Sep 2015 22:13:06 +0000 (15:13 -0700)]
rpcbind - Fix crash

Bring in 88cb9496ec48 from the FreeBSD repo.

The Sun RPC framework uses a netbuf structure to represent the
transport specific form of a universal transport address.  The
structure is expected to be opaque to consumers.  In the current
implementation, the structure contains a pointer to a buffer
that holds the actual address.

In rpcbind(8), netbuf structures are copied directly, which would
result in two netbuf structures that reference to one shared
address buffer.  When one of the two netbuf structures is freed,
access to the other netbuf structure would result in an undefined
result that may crash the rpcbind(8) daemon.

Fix this by making a copy of the buffer that is going to be freed
instead of doing a shallow copy.

Author:     delphij <delphij@FreeBSD.org>
Security:   FreeBSD-SA-15:24.rpcbind
Security:   CVE-2015-7236

8 years agoi386 removal, part 44/x: Remove a no longer used header.
Sascha Wildner [Mon, 28 Sep 2015 19:53:24 +0000 (21:53 +0200)]
i386 removal, part 44/x: Remove a no longer used header.

8 years agokernel/drm: Use #ifdef __DragonFly__ to mark DragonFly specific stuff.
Sascha Wildner [Mon, 28 Sep 2015 16:09:22 +0000 (18:09 +0200)]
kernel/drm: Use #ifdef __DragonFly__ to mark DragonFly specific stuff.

This is better findable across the tree than some home-rolled
"XXX begin/end" markers. Also prettier.

8 years agodrm/i915: Use gtt.mappable_base
François Tigeot [Sun, 27 Sep 2015 10:16:22 +0000 (12:16 +0200)]
drm/i915: Use gtt.mappable_base

Greatly reducing dependencies on the agp driver.

8 years agodrm: Add io_mapping_map_wc()
François Tigeot [Sun, 27 Sep 2015 09:53:48 +0000 (11:53 +0200)]
drm: Add io_mapping_map_wc()

8 years agodrm: Improve the Linux IO mapping API implementation
François Tigeot [Sun, 27 Sep 2015 09:14:14 +0000 (11:14 +0200)]
drm: Improve the Linux IO mapping API implementation

* Track address space mappings for real this time

8 years agoagp: Fix a bug in intel_gtt_get()
François Tigeot [Sun, 27 Sep 2015 06:10:54 +0000 (08:10 +0200)]
agp: Fix a bug in intel_gtt_get()

mappable_base was not correctly initialized, leading to problems on
some GPU models down the line

8 years agorevoke(2): Use unix socket externalize code to handle revoke.
Sepherosa Ziehau [Thu, 24 Sep 2015 13:50:45 +0000 (21:50 +0800)]
revoke(2): Use unix socket externalize code to handle revoke.

Use revoke token in shared mode in unix socket code and in exclusive
mode in fdrevoke(); mainly to make sure that all fps externalized and
marked FREVOKED will be picked up by later allproc_scan() called by
fdrevoke().

This one greatly simplies the code on unix socket side.  The original
unix socket revoke handling was also kinda broken: it tried to hold
socket reception buffer token w/ all filedesc spin lock being held.

Go-Ahead-by: dillon@
8 years agokernel: Allow fhold() in allfiles_scan_exclusive()
Sepherosa Ziehau [Wed, 23 Sep 2015 12:26:38 +0000 (20:26 +0800)]
kernel: Allow fhold() in allfiles_scan_exclusive()

Before this commit following race could happen, if fhold() is used
during allfiles_scan_exclusive():

      Thread1                      Thread2
         :                            :
         :                      fdrop(fp)
         :                      {
    Scan all fps                  if (f_count-- == 1) {
    (*) fhold(fp) [f_count++]         :
         :                          fo_close(fp);
    Access fp                       Unlink fp from filehead;
    fdrop(fp)                       free(fp);
         :                        }
         :                      }

This could cause use-after-free or double free (since f_count == 1
when fdrop() was called in Thread1, fp will be freed again).

We now handle f_count 1->0 transition specially: hold the filehead
spin lock then do the f_count 1->0 transition, if the f_count 1->0
transition succeeds, the fp is unlinked from the filehead.  This
prevents the above race from happening.  This solution is mainly
based on dillon@'s input.

8 years agosys/vfs/hammer: Fix cppcheck warning
Tomohiro Kusumi [Tue, 22 Sep 2015 16:25:14 +0000 (01:25 +0900)]
sys/vfs/hammer: Fix cppcheck warning

Spotted-by: swildner
8 years agosbin/hammer: Cleanups
Tomohiro Kusumi [Tue, 22 Sep 2015 14:04:46 +0000 (23:04 +0900)]
sbin/hammer: Cleanups

data->inode.obj_type (ot=%02x) should equal that of elm base.

8 years agosbin/hammer: Change hammer show's printf format for elm base
Tomohiro Kusumi [Tue, 22 Sep 2015 15:52:56 +0000 (00:52 +0900)]
sbin/hammer: Change hammer show's printf format for elm base

This commit changes printf format for struct hammer_base_elm
fields. It doesn't change information to be printed, but it
does change the order.

This commit better explains how B-Tree nodes are located in
the B-Tree by having all 5 keys lo:objid:rectype:key:tid in
the same line. Since now that hammer show supports these keys
as search directives, it's better to directly reflect those
of each elm to hammer show's output.

ot (obj_type) isn't one of the 5 keys to compare node elms,
so this could(should) go to the next line.

===== (A) before this commit
...
G------ ELM  8 L lo=00000001 obj=0000000101da3ef7 rt=11 key=4c94cade3f178000 ot=00
         tids=0000000104018590:0000000000000000 suboff=8000000020c78000 mirror=0000000104018590 *
...
G------ ELM  1 R lo=00000002 obj=0000000000000001 rt=15 key=0000000000020000 ot=01
       d tids=00000001007e0ff0:000000010403b9b0

===== (B) with this commit
...
G------ ELM  8 L lo=00000001 obj=0000000101da3ef7 rt=11 key=4c94cade3f178000 tid=0000000104018590
         del=0000000000000000 ot=00 suboff=8000000020c78000 mirror=0000000104018590 *
...
G------ ELM  1 R lo=00000002 obj=0000000000000001 rt=15 key=0000000000020000 tid=00000001007e0ff0
       d del=000000010403b9b0 ot=01

8 years agosbin/hammer: Refactor get_elm_flags()/print_btree_elm() [2/2]
Tomohiro Kusumi [Tue, 22 Sep 2015 08:38:50 +0000 (17:38 +0900)]
sbin/hammer: Refactor get_elm_flags()/print_btree_elm() [2/2]

Call get_elm_flags() from print_btree_elm(). The elm flag
is used and only used when printing elm. This makes things
clear without passing the flag from one function to another.

No functional changes.

8 years agosbin/hammer: Refactor get_elm_flags()/print_btree_elm() [1/2]
Tomohiro Kusumi [Tue, 22 Sep 2015 08:21:10 +0000 (17:21 +0900)]
sbin/hammer: Refactor get_elm_flags()/print_btree_elm() [1/2]

These two functions have way too many arguments and
some of them are redundant that they could be get rid of.

No functional changes.

8 years agosys/vfs/hammer: Adjust raw kprintfs using hkprintf variants
Tomohiro Kusumi [Sat, 12 Sep 2015 23:35:27 +0000 (08:35 +0900)]
sys/vfs/hammer: Adjust raw kprintfs using hkprintf variants

This is part3 of hkprintf related after the following two.
sys/vfs/hammer: Change hkprintf() to macro and add variants [2/2]
sys/vfs/hammer: Change hkprintf() to macro and add variants [1/2]

Above two commits have replaced the existing kprintf calls
using "HAMMER:" or "HAMMER(label)" or function name prefix
with hkprintf and newly added variants, which basically didn't
change actual output other than fixing wrong function names
to the right ones, etc.

This commit continues replacing remaining kprintfs to make
output more understandable than raw kprintf calls with no clue
that they're hammer related.

For example, an error message like
"BIGBLOCK UNDERFLOW\n"
or a debug message like
"rt %3u, xt %3u, tt %3u\n"
become more understanbale with "HAMMER:" prefix or the name
of the function.

This commit is based on the followings.
1. Use hdkprintf which is hkprintf variant with __func__ prefix
   if that kprintf call is used when vfs.hammer.debug_xxx is
   enabled. This implies the messages are only for debugging
   and those are usually better and more understandable with
   a function name prefix as mentioned above. Also this is
   what's been done mostly in the existing hammer code.
2. Use hkprintf which has "HAMMER:" prefix if that kprintf
   call is a regular hammer message that appears in regular
   filesystem operations such as
   "Formatting of valid HAMMER volume %s denied. Erase with dd!\n".
3. Use h[vm]kprintf which are hkprintf variants with hammer
   label prefix "HAMMER(label)" if that kprintf can safely
   access the label via vol or hmp pointer. Some kprintfs in
   hammer does this rather than just "HAMMER:" and this seems
   to be better, however this commit doesn't go far as to
   aggressively replace the existing ones with this because
   a caller safely dereferencing hmp or vol is a different
   topic from merely replacing.

8 years agosbin/hammer: Fix and adjust hammer show's matched character '*'
Tomohiro Kusumi [Mon, 21 Sep 2015 15:00:30 +0000 (00:00 +0900)]
sbin/hammer: Fix and adjust hammer show's matched character '*'

Remove unnecessary space before '*'.
Adjust position of '*' for matched record.

8 years agosbin/hammer: Fix and change hammer show behavior when only lo is used
Tomohiro Kusumi [Mon, 21 Sep 2015 10:34:10 +0000 (19:34 +0900)]
sbin/hammer: Fix and change hammer show behavior when only lo is used

913b6663 has expanded hammer show's B-Tree directive from
lo:objid
to
lo:objid:rectype:key:tid
which allowed hammer show to filter B-Tree iteration in the
same way that the actual filesystem does on B-Tree lookup.

There was an exception in 913b6663 where one could not just
use lo directive, but was forced to use at least the first
two directives lo:objid. If objid wasn't specified then
HAMMER_MIN_OBJID was used for objid by default.

This was to keep compatibility with old behavior before
913b6663 added the rest of the directives (rectype:key:tid),
but this old behavior wasn't really useful for anything and
rather confusing given that all unspecified fields (after
the last specified field) except for objid were wildcard.
See sbin/hammer/hammer.c and sbin/hammer/cmd_show.c before
913b6663 (or really old one like v4.0 era) for details.

This commit normalizes this exceptional behavior and make
all option directives behave the same way. For example, if
*only* lo field is specified, then the rest of the fields
are wildcard. If the first n fields are specified, then the
remaining (5-n) fields are wildcard.

This does change the behavior when *only* lo is specified,
but the change should make the behavior less confusing.

Also update hammer(8) manpage since it hasn't been updated.

8 years agosbin/hammer: Cleanup search directive structure
Tomohiro Kusumi [Mon, 21 Sep 2015 10:26:43 +0000 (19:26 +0900)]
sbin/hammer: Cleanup search directive structure

Remove btree elm fields from hammer show's search directive
struct btree_search, and embed struct hammer_base_elm.

hammer show originally only had localization:obj_id fields for
search directives, so struct btree_search had these two fields,
but since 913b6663 has added (quite long time ago) all the
remaining fields rec_type:key:create_tid, struct btree_search
could simply embed struct hammer_base_elm instead of having 5
fields separately, which makes code clear.

8 years agosbin/hammer: Fix wrong next element boundary test
Tomohiro Kusumi [Mon, 21 Sep 2015 07:25:49 +0000 (16:25 +0900)]
sbin/hammer: Fix wrong next element boundary test

When elm is the current node element to be tested by
test_btree_out_of_range() by hammer show,

1. it's out of range if ((elm + 1) == search),
   if all optional search directives are used.
2. it may not be out or range if ((elm + 1) == search),
   if not all optional search directives are used.

Unused search directives are wildcard, so elm could still
have a subtree with records that meet the search condition
in above case 2.

This existed before test_btree_out_of_range() was added by
the previous commit, and because it's a different topic,
this commit is kept apart from the previous one without
squashed into one.

8 years agosbin/hammer: Add B-Tree helper functions and cleanups
Tomohiro Kusumi [Mon, 21 Sep 2015 05:28:07 +0000 (14:28 +0900)]
sbin/hammer: Add B-Tree helper functions and cleanups

and some cleanups that make no functional changes.

This makes B-Tree search/filtering code using optional search
directives much more readable. Also this makes it easier to
do fix in the next commit (fix wrong next elm boundary test).

8 years agosbin/hammer: Make B-Tree walk a bit more effective
Tomohiro Kusumi [Sun, 20 Sep 2015 07:53:25 +0000 (16:53 +0900)]
sbin/hammer: Make B-Tree walk a bit more effective

hammer show recursively calls print_btree_node() when node
type is internal. If the node is not internal (leaf), it just
prints records with no further B-Tree walk.

Having
node->type == HAMMER_BTREE_TYPE_INTERNAL
check outside the
for (i = 0; i < node->count; ++i) {
is more effective since it doesn't go through unnecessary
for loop (with max count=63) if the node isn't internal.

Also note this looks more sane in the sense that node
contains elms[] and node->type determines union type of elms,
instead of node->type depends on each elms[i].

8 years agosbin/hammer: Fix minor memory leak
Tomohiro Kusumi [Sun, 20 Sep 2015 07:33:03 +0000 (16:33 +0900)]
sbin/hammer: Fix minor memory leak

8 years agosbin/newfs_hammer: Adjust output of -E
Tomohiro Kusumi [Tue, 22 Sep 2015 04:34:24 +0000 (13:34 +0900)]
sbin/newfs_hammer: Adjust output of -E

This commit adjusts and aligns output of -E option of
newfs_hammer with the previous line.

It should use vol->type instead of typing "Device" in
lowercase, since this is what the vol->type is really
made for.

===== before this commit
  # newfs_hammer -E -L TEST /dev/da1 /dev/da2 /dev/da3
  Volume 0 DEVICE /dev/da1        size 111.79GB
  Trimming Device:/dev/da1, sectors (0 -234441648)
  Volume 1 DEVICE /dev/da2        size 111.79GB
  Trimming Device:/dev/da2, sectors (0 -234441648)
  Volume 2 DEVICE /dev/da3        size 111.79GB
  Trimming Device:/dev/da3, sectors (0 -234441648)
  ...

===== with this commit, looks more sane
  # newfs_hammer -E -L TEST /dev/da1 /dev/da2 /dev/da3
  Volume 0 DEVICE /dev/da1        size 111.79GB
  Trimming DEVICE /dev/da1, sectors (0 -234441648)
  Volume 1 DEVICE /dev/da2        size 111.79GB
  Trimming DEVICE /dev/da2, sectors (0 -234441648)
  Volume 2 DEVICE /dev/da3        size 111.79GB
  Trimming DEVICE /dev/da3, sectors (0 -234441648)
  ...

8 years agosbin/newfs_hammer: Remove global variable Eflag
Tomohiro Kusumi [Sun, 20 Sep 2015 04:57:19 +0000 (13:57 +0900)]
sbin/newfs_hammer: Remove global variable Eflag

Eflag could be a local variable after ff8644cb merged
two check_volume() into one.

8 years agosys/vfs/hammer: Remove ambiguous comment
Tomohiro Kusumi [Sat, 19 Sep 2015 06:47:03 +0000 (15:47 +0900)]
sys/vfs/hammer: Remove ambiguous comment

Upper 16 bits of val[1] is always 0 (which equals pfs id of pfs0)
regardless of how many pfs there are.

8 years agosys/vfs/hammer: Fix wrong comment on ambiguous variable name
Tomohiro Kusumi [Sat, 19 Sep 2015 06:28:34 +0000 (15:28 +0900)]
sys/vfs/hammer: Fix wrong comment on ambiguous variable name

hammer_volume_ondisk::vol_name[] is a filesystem label string
specified by newfs_hammer via -L option (see below), but not
the name of the volume like "/dev/da1".

  # grep "ondisk->vol_name" sbin/newfs_hammer -rI
  sbin/newfs_hammer/newfs_hammer.c:       \
  snprintf(ondisk->vol_name, sizeof(ondisk->vol_name), "%s", label);

8 years agosys/vfs/hammer: Fix wrong comment on B-Tree node count
Tomohiro Kusumi [Mon, 21 Sep 2015 04:41:58 +0000 (13:41 +0900)]
sys/vfs/hammer: Fix wrong comment on B-Tree node count

cursor->node->base->count
was right in the early stage of hammer devel,
but it has changed to
cursor->node->ondisk->count

8 years agohammer: Print "B-Tree" (conform to hammer specification)
Tomohiro Kusumi [Sat, 19 Sep 2015 04:35:39 +0000 (13:35 +0900)]
hammer: Print "B-Tree" (conform to hammer specification)

Hammer specification, manpage, comments, etc mostly use
"B-Tree" instead of "btree" or "b-tree".

This commit replaces "btree" and "b-tree" strings that appear
in printf() and hammer(8) with "B-Tree", assuming no user or
userspace triggers anything by these strings.

8 years agohammer: Cleanup hammer(8) manpage
Tomohiro Kusumi [Mon, 21 Sep 2015 11:59:29 +0000 (20:59 +0900)]
hammer: Cleanup hammer(8) manpage

hammer(8) uses "PFS" but not "pfs" unless "pfs" appears in a path.

8 years agohammer: Update hammer(5) manpage
Tomohiro Kusumi [Fri, 18 Sep 2015 23:41:41 +0000 (08:41 +0900)]
hammer: Update hammer(5) manpage

Update links to publication by
dillon@ in 2008
mneumann@ in 2010

8 years agosbin/mount_hammer: Minor fixes and cleanups
Tomohiro Kusumi [Thu, 24 Sep 2015 12:18:29 +0000 (21:18 +0900)]
sbin/mount_hammer: Minor fixes and cleanups

8 years agosbin/mount_hammer: Add CFLAGS+= -I${.CURDIR}/../../sys
Tomohiro Kusumi [Thu, 17 Sep 2015 22:18:14 +0000 (07:18 +0900)]
sbin/mount_hammer: Add CFLAGS+= -I${.CURDIR}/../../sys

just like sbin/hammer and sbin/newfs_hammer.

8 years agosbin/hammer: Remove -DALIST_NO_DEBUG
Tomohiro Kusumi [Thu, 17 Sep 2015 21:44:53 +0000 (06:44 +0900)]
sbin/hammer: Remove -DALIST_NO_DEBUG

-DALIST_NO_DEBUG is no longer necessary.

sys/kern/subr_alist.c was only used in the early stage
of hammer devel, and no longer used.

  # grep ALIST_NO_DEBUG . -rI
  ./sbin/newfs_hammer/Makefile:CFLAGS+= -I${.CURDIR}/../../sys -I${.CURDIR}/../hammer -DALIST_NO_DEBUG
  ./sbin/hammer/Makefile:CFLAGS+= -I${.CURDIR}/../../sys -DALIST_NO_DEBUG
  ./sys/kern/subr_alist.c:#ifndef ALIST_NO_DEBUG

8 years agosbin/newfs_hammer: Remove a local header newfs_hammer.h
Tomohiro Kusumi [Fri, 18 Sep 2015 13:55:04 +0000 (22:55 +0900)]
sbin/newfs_hammer: Remove a local header newfs_hammer.h

newfs_hammer.c is the only file that needs newfs_hammer.h,
and all it does is include other headers, so we really
don't need to have this as a separate header.

Also note that mount_hammer, newfs_hammer2, mount_hammer2
don't have .h as well.