dragonfly.git
8 years agolibc/regex: Fix a reference of an uninitialized variable.
Sascha Wildner [Fri, 16 Oct 2015 07:28:54 +0000 (09:28 +0200)]
libc/regex: Fix a reference of an uninitialized variable.

If tre_bt_mem_alloc() fails, xfree() would have been called on an
uninitialized 'buf' variable.

8 years agosys/dev/disk/dm: Simplify list eviction
Tomohiro Kusumi [Thu, 15 Oct 2015 18:00:11 +0000 (03:00 +0900)]
sys/dev/disk/dm: Simplify list eviction

Similar to 64c24ea.

8 years agosys/dev/disk/dm: Make rename ioctl return ENOSYS
Tomohiro Kusumi [Thu, 15 Oct 2015 13:17:39 +0000 (22:17 +0900)]
sys/dev/disk/dm: Make rename ioctl return ENOSYS

This isn't implemented, so don't let dmsetup complete as if
/dev/mapper/xxx is successfully renamed.

8 years agoUpdate the pciconf(8) database.
Sascha Wildner [Thu, 15 Oct 2015 11:24:26 +0000 (13:24 +0200)]
Update the pciconf(8) database.

October 11, 2015 snapshot from http://pciids.sourceforge.net/

8 years agoMakefile_upgrade.inc: Remove the correct file.
Sascha Wildner [Thu, 15 Oct 2015 10:04:14 +0000 (12:04 +0200)]
Makefile_upgrade.inc: Remove the correct file.

Reported-by: marino
8 years ago<tgmath.h>: Revert to using the C11 _Generic keyword if it is available.
Sascha Wildner [Wed, 14 Oct 2015 22:29:13 +0000 (00:29 +0200)]
<tgmath.h>: Revert to using the C11 _Generic keyword if it is available.

This commit brings back FreeBSD's version of <tgmath.h> which has this
optimization over OpenBSD's and compiles much faster when _Generic is
part of the language.

8 years ago<tgmath.h>: Use the base version over GCC's version of this header.
Sascha Wildner [Wed, 14 Oct 2015 21:01:15 +0000 (23:01 +0200)]
<tgmath.h>: Use the base version over GCC's version of this header.

Not sure how it crept into gcc50 again, since we did this exact same
commit already for gcc47 and gcc44 before that.

Generally, we want standard headers to be under our control (the next
commit is a nice example why) and not under the compiler's. C11's
<stdatomic.h> header is still on the TODO list for that.

8 years agosys/dev/disk/dm: Fix race on pdev create
Tomohiro Kusumi [Mon, 12 Oct 2015 03:07:31 +0000 (12:07 +0900)]
sys/dev/disk/dm: Fix race on pdev create

List lookup and insert need to be atomic otherwise more than
one dm_pdev_t* for the same underlying device could exist.
Running the following two concurrently reproduces the race
where ${DEV} is the common underlying device.

=====(A)
  #!/usr/local/bin/bash
  kldload dm_target_linear
  while [ 1 ]; do
   dmsetup create linear1 --table "0 1000 linear ${DEV} 0"
   dmsetup remove /dev/mapper/linear1
  done

=====(B)
  #!/usr/local/bin/bash
  kldload dm_target_delay
  while [ 1 ]; do
   dmsetup create delay1 --table "0 1000 delay ${DEV} 0 10"
   dmsetup remove /dev/mapper/delay1
  done

8 years agosys/dev/disk/dm: Ignore zero-filled uuid on inserting a dm device
Tomohiro Kusumi [Tue, 13 Oct 2015 05:55:56 +0000 (14:55 +0900)]
sys/dev/disk/dm: Ignore zero-filled uuid on inserting a dm device

PR2843
http://bugs.dragonflybsd.org/issues/2843

dm targets that use dmsetup(8) without dedicated high-level
commands are almost unusable without this fix.

8 years agosys/vfs/hammer: Panic with "for redo" on insufficient FIFO for redo
Tomohiro Kusumi [Mon, 12 Oct 2015 12:58:17 +0000 (21:58 +0900)]
sys/vfs/hammer: Panic with "for redo" on insufficient FIFO for redo

hammer_generate_undo() and hammer_generate_redo() both have
the same panic message "insufficient undo FIFO space!".

Add "for redo" for hammer_generate_redo() so it's easier to
distinguish which one users are talking about when they report
these.

Since 903fdd05 hammer uses hpanic() with __func__ embedded
instead of raw panic(), but this is still considered useful
given that users don't necessary care kernel internal.

8 years agosys/dev/disk/dm: Cleanups
Tomohiro Kusumi [Mon, 12 Oct 2015 10:10:36 +0000 (19:10 +0900)]
sys/dev/disk/dm: Cleanups

Remove a space from
dm_table_entry_t * table_en,
struct buf * bp,
dm_dev_t * dmv,
etc

No binary change.

8 years agosys/dev/disk/dm: Simplify list eviction
Tomohiro Kusumi [Mon, 12 Oct 2015 08:23:24 +0000 (17:23 +0900)]
sys/dev/disk/dm: Simplify list eviction

Change
while (!EMPTY(e)) { e = FIRST(); REMOVE(e); do_something(e); }
to less redundant
while ((e = FIRST())) { REMOVE(e); do_something(e); }

8 years agosys/dev/disk/dm: Use dm_pdev_rem()
Tomohiro Kusumi [Mon, 12 Oct 2015 07:36:34 +0000 (16:36 +0900)]
sys/dev/disk/dm: Use dm_pdev_rem()

8 years agosys/dev/disk/dm: Fix cppcheck warning
Tomohiro Kusumi [Mon, 12 Oct 2015 03:40:54 +0000 (12:40 +0900)]
sys/dev/disk/dm: Fix cppcheck warning

8 years agosys/dev/disk/dm: Cleanup DIOCGPART related code
Tomohiro Kusumi [Mon, 12 Oct 2015 02:00:10 +0000 (11:00 +0900)]
sys/dev/disk/dm: Cleanup DIOCGPART related code

8 years agosys/dev/disk/dm: Refactor dmioctl()
Tomohiro Kusumi [Sun, 11 Oct 2015 13:09:34 +0000 (22:09 +0900)]
sys/dev/disk/dm: Refactor dmioctl()

Get rid of if-nest and goto.
This function can be implemented without if-nest and goto,
and this is way easier to understand without lots of comments.

8 years agosocket: Simplify soclose_fast by always sending the close message
Sepherosa Ziehau [Wed, 14 Oct 2015 11:58:47 +0000 (19:58 +0800)]
socket: Simplify soclose_fast by always sending the close message

And unpend asynchronized PRUs at the beginning of soclose_sync();
this prepares for the asynchronized pru_attach.

8 years agosocket: Rename soabort_oncpu -> soabort_direct
Sepherosa Ziehau [Wed, 14 Oct 2015 11:57:04 +0000 (19:57 +0800)]
socket: Rename soabort_oncpu -> soabort_direct

No functional change.

8 years agosocket: Use WAITOK|NULLOK to allocate async connect message
Sepherosa Ziehau [Mon, 12 Oct 2015 13:14:49 +0000 (21:14 +0800)]
socket: Use WAITOK|NULLOK to allocate async connect message

It's better than doing synchronized pru_connect.

8 years agotoken: Cache align pooled tokens
Sepherosa Ziehau [Mon, 12 Oct 2015 13:13:44 +0000 (21:13 +0800)]
token: Cache align pooled tokens

8 years agokern: Split filehead into multiple heads
Sepherosa Ziehau [Mon, 12 Oct 2015 13:13:09 +0000 (21:13 +0800)]
kern: Split filehead into multiple heads

This greatly reduces filehead spinlock contention (almost no contention)
for the test/kq_connect_client.

Suggested-by: dillon@
8 years agokern: Use atomic ops for nfiles and move them out of filehead spinlock
Sepherosa Ziehau [Mon, 12 Oct 2015 13:11:44 +0000 (21:11 +0800)]
kern: Use atomic ops for nfiles and move them out of filehead spinlock

This prepares to split filehead into multiple heads to reduce filehead
spinlock contention.

8 years agolibkvm: Make return value of kvm_getfiles(3) consistent.
Sepherosa Ziehau [Wed, 14 Oct 2015 11:56:05 +0000 (19:56 +0800)]
libkvm: Make return value of kvm_getfiles(3) consistent.

The return value was inconsistent if this function is called on
coredump and on live kernel:
- The leading filehead will trash return value if it is called on
  live kernel.
- Live kernel returns an array of kinfo_file but coredump returns
  an array of file.

It probably only worked when KERN_FILE sysctl returned an array
of files and when the filehead was just a file ptr; or it never
worked (it reversed nfiles' and filehead's kernel address when
reading from coredump).

We now let it return an array of kinfo_file without any weird
leading stuffs.

While I'm here clean it up a little bit (mainly use NULL instead
of 0).

This also paves the way to split filehead.

8 years agotest/kq_connect_client: Make result accurate
Sepherosa Ziehau [Mon, 12 Oct 2015 13:11:09 +0000 (21:11 +0800)]
test/kq_connect_client: Make result accurate

8 years agoFix detach panic introduced by 67616947
Markus Pfeiffer [Tue, 13 Oct 2015 18:42:36 +0000 (19:42 +0100)]
Fix detach panic introduced by 67616947

The panic is caused by an off-by-one error in the comparison.

8 years agokernel/acpi: Restructure _OSC eval func a bit. No functional change.
Sascha Wildner [Mon, 12 Oct 2015 21:22:08 +0000 (23:22 +0200)]
kernel/acpi: Restructure _OSC eval func a bit. No functional change.

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@