dragonfly.git
5 hours agoRemove NO_OPENSSH variable functionality master
John Marino [Mon, 29 Aug 2016 08:35:26 +0000 (10:35 +0200)]
Remove NO_OPENSSH variable functionality

There doesn't seem to be a legit use case for building with OpenSSL but
without ssh.  Remove the ability to do so to simplify makefiles which
also has the benefit of reducing the number of make.conf options.

The ssh program and openssh private library only consume about 2Mb.

63 min agosys/vfs/hammer: Use typedef'd for struct hammer_inode_data*
Tomohiro Kusumi [Mon, 29 Aug 2016 15:28:02 +0000 (00:28 +0900)]
sys/vfs/hammer: Use typedef'd for struct hammer_inode_data*

The whole hammer code is mix of using struct and typedef'd.
Use typedef'd because majority of the code use typedef'd.

65 min agosys/vfs/hammer: Use typedef'd for struct hammer_snapshot_data*
Tomohiro Kusumi [Mon, 29 Aug 2016 15:25:28 +0000 (00:25 +0900)]
sys/vfs/hammer: Use typedef'd for struct hammer_snapshot_data*

The whole hammer code is mix of using struct and typedef'd.
Use typedef'd because majority of the code use typedef'd.

80 min agosys/vfs/hammer: Add typedefs for ondisk structures without typedefs
Tomohiro Kusumi [Mon, 29 Aug 2016 15:10:18 +0000 (00:10 +0900)]
sys/vfs/hammer: Add typedefs for ondisk structures without typedefs

Some ondisk data structures have typedefs, but others don't.

2 hours agosys/kern: Make struct buf::b_dep a member of union
Tomohiro Kusumi [Mon, 29 Aug 2016 13:13:21 +0000 (22:13 +0900)]
sys/kern: Make struct buf::b_dep a member of union

struct buf::b_dep being a list head is too specific to UFS.
HAMMER or other filesystems want this to be a void* pointer.

It also forces HAMMER or other filesystems to define their own
struct worklist because no such struct is defined outside of
the UFS source which is insane in terms of a kernel structure
for general blk i/o.

Also see 71199586f.

2 hours agosbin/hammer: Fix irrelevant comments
Tomohiro Kusumi [Mon, 29 Aug 2016 11:24:14 +0000 (20:24 +0900)]
sbin/hammer: Fix irrelevant comments

2 hours agosbin/hammer: Sync zone statistics format with print_blockmap()
Tomohiro Kusumi [Mon, 29 Aug 2016 11:16:39 +0000 (20:16 +0900)]
sbin/hammer: Sync zone statistics format with print_blockmap()

2 hours agosbin/hammer: Don't expose softprune specific data structure
Tomohiro Kusumi [Mon, 29 Aug 2016 10:45:37 +0000 (19:45 +0900)]
sbin/hammer: Don't expose softprune specific data structure

Expose softprune function rather than both function and data structure.

19 hours agomount_{cd9660,ntfs}(8): Link dynamically to enable -C again.
Sascha Wildner [Sun, 28 Aug 2016 20:38:08 +0000 (22:38 +0200)]
mount_{cd9660,ntfs}(8): Link dynamically to enable -C again.

19 hours agomount_cd9660(8): Add -b and -j to usage().
Sascha Wildner [Sun, 28 Aug 2016 20:36:54 +0000 (22:36 +0200)]
mount_cd9660(8): Add -b and -j to usage().

20 hours agoif_iwm - Add some pcie device stop code from iwlwifi. Adjust a delay.
Imre Vadász [Sun, 24 Jul 2016 18:54:35 +0000 (20:54 +0200)]
if_iwm - Add some pcie device stop code from iwlwifi. Adjust a delay.

* Make iwm_apm_stop put the device in Uninitialized state, like in iwlwifi.

* Add a device reset from iwlwifi to iwm_apm_stop, and make the DELAY
  after device reset in iwm_apm_init match the duration in iwlwifi.

* Swap iwm_disable_interrupts() and on-board processor reset in
  iwm_stop_device() corresponding to Linux git commit
  03d6c3b0fa4f5f0379cede079ec828a6c999fe43.

Taken-From: Linux iwlwifi

24 hours agoif_iwm - Use htole16 for policy field in struct iwm_time_event_cmd_v2.
Imre Vadász [Sun, 28 Aug 2016 15:46:39 +0000 (17:46 +0200)]
if_iwm - Use htole16 for policy field in struct iwm_time_event_cmd_v2.

* This didn't really matter on DragonFly, which currently only runs on a
  little-endian architecture.

25 hours agosys/vfs/hammer: Remove unused struct hammer_io_list
Tomohiro Kusumi [Sun, 28 Aug 2016 14:13:11 +0000 (23:13 +0900)]
sys/vfs/hammer: Remove unused struct hammer_io_list

This struct is no longer used after 1afb73cf in 2011.

25 hours agosys/vfs/hammer: Use typedef'd for enum hammer_io_type
Tomohiro Kusumi [Sun, 28 Aug 2016 14:08:01 +0000 (23:08 +0900)]
sys/vfs/hammer: Use typedef'd for enum hammer_io_type

25 hours agosys/vfs/hammer: Typedef struct on declaration
Tomohiro Kusumi [Sun, 28 Aug 2016 13:27:20 +0000 (22:27 +0900)]
sys/vfs/hammer: Typedef struct on declaration

Most structs in hammer are typedef'd.
Some structs define it on declaration, but others don't.

26 hours agoif_iwm - Fix comments and struct definition for struct iwm_sf_cfg_cmd.
Imre Vadász [Sun, 28 Aug 2016 13:29:09 +0000 (15:29 +0200)]
if_iwm - Fix comments and struct definition for struct iwm_sf_cfg_cmd.

* Use uint32_t instead of "enum iwm_sf_state" for the state field in
  struct iwm_sf_cfg_cmd, because that struct is declared __packed.

Taken-From: FreeBSD (the typos in struct iwm_sf_cfg_cmd comments)

26 hours agoif_iwm - Remove unused wantresp field in iwm_rx_data struct.
Imre Vadász [Sun, 28 Aug 2016 13:21:14 +0000 (15:21 +0200)]
if_iwm - Remove unused wantresp field in iwm_rx_data struct.

26 hours agoif_iwm - Remove two duplicate const qualifiers.
Imre Vadász [Sat, 27 Aug 2016 20:11:59 +0000 (22:11 +0200)]
if_iwm - Remove two duplicate const qualifiers.

28 hours agosys/vfs/hammer: Remove prototypes for not existing functions
Tomohiro Kusumi [Sun, 28 Aug 2016 10:23:52 +0000 (19:23 +0900)]
sys/vfs/hammer: Remove prototypes for not existing functions

28 hours agosys/vfs/hammer: Use typedef'd for struct hammer_mount*
Tomohiro Kusumi [Sun, 28 Aug 2016 11:06:34 +0000 (20:06 +0900)]
sys/vfs/hammer: Use typedef'd for struct hammer_mount*

The whole hammer code is mix of using struct and typedef'd.
Use typedef'd because majority of the code use typedef'd.

The last 17 commits including this one don't affect binary.

28 hours agosys/vfs/hammer: Use typedef'd for struct hammer_node_lock*
Tomohiro Kusumi [Sun, 28 Aug 2016 10:57:03 +0000 (19:57 +0900)]
sys/vfs/hammer: Use typedef'd for struct hammer_node_lock*

The whole hammer code is mix of using struct and typedef'd.
Use typedef'd because majority of the code use typedef'd.

28 hours agosys/vfs/hammer: Use typedef'd for struct hammer_node*
Tomohiro Kusumi [Sun, 28 Aug 2016 10:54:55 +0000 (19:54 +0900)]
sys/vfs/hammer: Use typedef'd for struct hammer_node*

The whole hammer code is mix of using struct and typedef'd.
Use typedef'd because majority of the code use typedef'd.

28 hours agosys/vfs/hammer: Use typedef'd for struct hammer_buffer*
Tomohiro Kusumi [Sun, 28 Aug 2016 10:50:24 +0000 (19:50 +0900)]
sys/vfs/hammer: Use typedef'd for struct hammer_buffer*

The whole hammer code is mix of using struct and typedef'd.
Use typedef'd because majority of the code use typedef'd.

28 hours agosys/vfs/hammer: Use typedef'd for struct hammer_volume*
Tomohiro Kusumi [Sun, 28 Aug 2016 10:22:07 +0000 (19:22 +0900)]
sys/vfs/hammer: Use typedef'd for struct hammer_volume*

The whole hammer code is mix of using struct and typedef'd.
Use typedef'd because majority of the code use typedef'd.

28 hours agosys/vfs/hammer: Use typedef'd for struct hammer_io*
Tomohiro Kusumi [Sun, 28 Aug 2016 10:14:23 +0000 (19:14 +0900)]
sys/vfs/hammer: Use typedef'd for struct hammer_io*

The whole hammer code is mix of using struct and typedef'd.
Use typedef'd because majority of the code use typedef'd.

28 hours agosys/vfs/hammer: Use typedef'd for struct hammer_record*
Tomohiro Kusumi [Sun, 28 Aug 2016 09:10:42 +0000 (18:10 +0900)]
sys/vfs/hammer: Use typedef'd for struct hammer_record*

The whole hammer code is mix of using struct and typedef'd.
Use typedef'd because majority of the code use typedef'd.

28 hours agosys/vfs/hammer: Use typedef'd for struct hammer_inode*
Tomohiro Kusumi [Sun, 28 Aug 2016 09:08:02 +0000 (18:08 +0900)]
sys/vfs/hammer: Use typedef'd for struct hammer_inode*

The whole hammer code is mix of using struct and typedef'd.
Use typedef'd because majority of the code use typedef'd.

29 hours agosys/vfs/hammer: Use typedef'd for struct hammer_transaction*
Tomohiro Kusumi [Sun, 28 Aug 2016 08:58:23 +0000 (17:58 +0900)]
sys/vfs/hammer: Use typedef'd for struct hammer_transaction*

The whole hammer code is mix of using struct and typedef'd.
Use typedef'd because majority of the code use typedef'd.

29 hours agosys/vfs/hammer: Use typedef'd for struct hammer_node_ondisk*
Tomohiro Kusumi [Sun, 28 Aug 2016 08:39:50 +0000 (17:39 +0900)]
sys/vfs/hammer: Use typedef'd for struct hammer_node_ondisk*

The whole hammer code is mix of using struct and typedef'd.
Use typedef'd because majority of the code use typedef'd.

29 hours agosys/vfs/hammer: Use typedef'd for struct hammer_btree_leaf_elm*
Tomohiro Kusumi [Sun, 28 Aug 2016 08:28:43 +0000 (17:28 +0900)]
sys/vfs/hammer: Use typedef'd for struct hammer_btree_leaf_elm*

The whole hammer code is mix of using struct and typedef'd.
Use typedef'd because majority of the code use typedef'd.

29 hours agosys/vfs/hammer: Use typedef'd for struct hammer_base_elm*
Tomohiro Kusumi [Sun, 28 Aug 2016 07:57:19 +0000 (16:57 +0900)]
sys/vfs/hammer: Use typedef'd for struct hammer_base_elm*

The whole hammer code is mix of using struct and typedef'd.
Use typedef'd because majority of the code use typedef'd.

29 hours agosys/vfs/hammer: Use typedef'd for union hammer_data_ondisk*
Tomohiro Kusumi [Sun, 28 Aug 2016 07:50:56 +0000 (16:50 +0900)]
sys/vfs/hammer: Use typedef'd for union hammer_data_ondisk*

The whole hammer code is mix of using struct and typedef'd.
Use typedef'd because majority of the code use typedef'd.

29 hours agosys/vfs/hammer: Use typedef'd for struct hammer_pseudofs_data*
Tomohiro Kusumi [Sun, 28 Aug 2016 07:48:42 +0000 (16:48 +0900)]
sys/vfs/hammer: Use typedef'd for struct hammer_pseudofs_data*

The whole hammer code is mix of using struct and typedef'd.
Use typedef'd because majority of the code use typedef'd.

29 hours agosys/vfs/hammer: Conform to typical hammer code format
Tomohiro Kusumi [Sun, 28 Aug 2016 07:46:09 +0000 (16:46 +0900)]
sys/vfs/hammer: Conform to typical hammer code format

29 hours agosys/vfs/hammer: Use typedef'd for struct hammer_volume_ondisk*
Tomohiro Kusumi [Sun, 28 Aug 2016 07:38:55 +0000 (16:38 +0900)]
sys/vfs/hammer: Use typedef'd for struct hammer_volume_ondisk*

The whole hammer code is mix of using struct and typedef'd.
Use typedef'd because majority of the code use typedef'd.

29 hours agosys/vfs/hammer: Use typedef'd for struct hammer_blockmap_xxx*
Tomohiro Kusumi [Sun, 28 Aug 2016 07:22:30 +0000 (16:22 +0900)]
sys/vfs/hammer: Use typedef'd for struct hammer_blockmap_xxx*

The whole hammer code is mix of using struct and typedef'd.
Use typedef'd because majority of the code use typedef'd.

30 hours agoLink mount_msdos(8) dynamically.
Sascha Wildner [Sun, 28 Aug 2016 09:30:24 +0000 (11:30 +0200)]
Link mount_msdos(8) dynamically.

This makes -L and -D work properly.

It used to work statically linked but that code was all overwritten
in 0d5acd7467.

Tested-by: Ivan Bezrodny <ivan.bezrodny@gmail.com>
30 hours ago<sys/iconv.h>: Fix typo in a comment (taken from FreeBSD).
Sascha Wildner [Sun, 28 Aug 2016 09:26:41 +0000 (11:26 +0200)]
<sys/iconv.h>: Fix typo in a comment (taken from FreeBSD).

30 hours agokernel/libiconv: Sync with FreeBSD.
Sascha Wildner [Sun, 28 Aug 2016 09:25:45 +0000 (11:25 +0200)]
kernel/libiconv: Sync with FreeBSD.

30 hours agolibkiconv: Sync a bit with FreeBSD.
Sascha Wildner [Sun, 28 Aug 2016 09:24:17 +0000 (11:24 +0200)]
libkiconv: Sync a bit with FreeBSD.

* Adds kiconv_lookupconv() and kiconv_lookupcs().

* It also moves libkiconv to /lib in preparation for linking various
  mount_*(8) tools which have locale/charset support dynamically.

32 hours agolibkiconv: Remove dead code.
Sascha Wildner [Sun, 28 Aug 2016 08:14:34 +0000 (10:14 +0200)]
libkiconv: Remove dead code.

ICONV_DLOPEN is never defined on DragonFly because we build iconv()
into libc by default.

44 hours agogcc50: Upgrade version 5.3.1 => 5.4.1 + 3 months
John Marino [Sun, 28 Aug 2016 00:30:07 +0000 (02:30 +0200)]
gcc50: Upgrade version 5.3.1 => 5.4.1 + 3 months

44 hours agoMerge branch 'vendor/GCC50'
John Marino [Sat, 27 Aug 2016 20:25:21 +0000 (22:25 +0200)]
Merge branch 'vendor/GCC50'

44 hours agoUpdate gcc-50 to SVN version 239798 (gcc-5-branch) vendor/GCC50
John Marino [Sun, 28 Aug 2016 00:05:50 +0000 (02:05 +0200)]
Update gcc-50 to SVN version 239798 (gcc-5-branch)

This is equivalent to the gcc 5.4 release + 3 months

Last Changed Date: 2016-08-27 02:16:05 +0200 (Sat, 27 Aug 2016)

2 days agosbin/hammer: Use . for pfs-status if no arg
Tomohiro Kusumi [Sat, 27 Aug 2016 09:29:45 +0000 (18:29 +0900)]
sbin/hammer: Use . for pfs-status if no arg

hammer pfs-status can take 1 or more args unlike other pfs-xxx,
so allow 0 arg for default ".".

2 days agosys/vfs/hammer: Remove wrong comment
Tomohiro Kusumi [Sat, 27 Aug 2016 03:48:57 +0000 (12:48 +0900)]
sys/vfs/hammer: Remove wrong comment

2 days agosbin/hammer: Use "objid" for inode#
Tomohiro Kusumi [Sat, 27 Aug 2016 02:13:30 +0000 (11:13 +0900)]
sbin/hammer: Use "objid" for inode#

"objid" is a commonly used one in kprintf as well as this command.
so change "obj", "ino" to "objid" which are all inode#.

4 days agosbin/newfs_hammer: Set HAMMER_OBJTYPE_DIRECTORY for ondisk PFS#0 data
Tomohiro Kusumi [Thu, 25 Aug 2016 12:40:12 +0000 (21:40 +0900)]
sbin/newfs_hammer: Set HAMMER_OBJTYPE_DIRECTORY for ondisk PFS#0 data

Ondisk PFS data is a record part of the root ip (inode) when
a new PFS is created via ioctl, so it's normal for ondisk PFS
data to have HAMMER_OBJTYPE_DIRECTORY for obj_type. It's
rather insane that PFS#0 (the only PFS created without ioctl)
has 0 (HAMMER_OBJTYPE_UNKNOWN) for obj_type while the root ip
(not PFS root but HAMMER root) is apparently a directory.

Although PFS#0 and the rest of the PFS are a bit different,
PFS ioctls treat all the ondisk PFS data in the same fashion.
Having consistent obj_type value for the same data type is
considered better than not having.

This change does affect 1 byte of ondisk PFS#0 data initially
created by newfs_hammer, but doesn't break compatibility.
Also see hammer_mkroot_pseudofs().

5 days agoacpi: Save I/O ports for I/O ports range, as long as its reasonable.
Sepherosa Ziehau [Wed, 24 Aug 2016 11:36:33 +0000 (19:36 +0800)]
acpi: Save I/O ports for I/O ports range, as long as its reasonable.

Reported-by: karu.pruun <karu.pruun gmail com>
5 days agosbin/hammer: Sync dce7ae2c format with zone statistics
Tomohiro Kusumi [Wed, 24 Aug 2016 10:54:31 +0000 (19:54 +0900)]
sbin/hammer: Sync dce7ae2c format with zone statistics

Add "zone #" and change "next_tid" to "vol0_next_tid".

5 days agoCorrect some spelling mistakes/typos in manual pages.
Sascha Wildner [Wed, 24 Aug 2016 11:51:14 +0000 (13:51 +0200)]
Correct some spelling mistakes/typos in manual pages.

6 days agolib/libhammer: Fix segmentation fault by null dereference
Tomohiro Kusumi [Tue, 23 Aug 2016 14:48:35 +0000 (23:48 +0900)]
lib/libhammer: Fix segmentation fault by null dereference

If libhammer cares about mountpoints of hammer and null,
it needs to care about the case where pfs0 happens to be NULL.
This occurs when a PFS(>#0) is null mounted on the mountpoint of PFS#0.

This commit avoids segmentation fault, but that doesn't mean the
result is correct. It's basically that this library doesn't fully
consider the complexity of ondisk PFS data within HAMMER's B-Tree.

6 days agoAdd/fix some HISTORY sections in bin/ manual pages.
Sascha Wildner [Tue, 23 Aug 2016 13:21:05 +0000 (15:21 +0200)]
Add/fix some HISTORY sections in bin/ manual pages.

Submitted-by: Sevan Janiyan
Dragonfly-bugs: 2937-2945

6 days agosbin/hammer: Don't print mountpoint of PFS
Tomohiro Kusumi [Tue, 23 Aug 2016 10:59:26 +0000 (19:59 +0900)]
sbin/hammer: Don't print mountpoint of PFS

/sbin/hammer should not care if PFS are null mounted or where PFS are
mounted. It has nothing to do with the filesystem itself. PFS is just
a pointer to jump into a subset of HAMMER's B-Tree (clustered by
localization parameter). Just because DragonFly's installer used to
use PFS (not anymore) and null mount by default doesn't mean /sbin
/hammer needs to provide null mount info.

If someone does mount PFS to somewhere and want to know where PFS are
mounted, one needs to just type mount. In fact this is much better
than getting mountpoints info via hammer info command because mount(8)
doesn't use hammer's ioctl which may cause B-Tree lookup, but instead
retrieves mountpoints directly from vfs.

Also note that printing such info gives users wrong assumption that
PFS in HAMMER is something equivalent of ZFS (created out of storage
zpool) which is not true. As mentioned above, PFS is just a pointer to
a subset of a single HAMMER filesystem. These are not independent fs.

Also note that hammer info still has bugs due to bugs from libhammer
and its attached ioctl as mentioned in e0f42079, including things under
investigation now. Whatever it is, hammer info needs to be rewritten
(as a different command like hammer fsinfo) in short and straight
forward code like other commands, without unnecessary abstraction.
I've been fixing and adding missing stuff to this hammer info command,
however hammer info is basically going nowhere because this command is
too tightly attached to libhammer.

6 days agoAllow make.conf to override ssh's xauth location.
Peter Avalos [Mon, 22 Aug 2016 22:09:18 +0000 (15:09 -0700)]
Allow make.conf to override ssh's xauth location.

This allows dports to install xauth based on the make.conf definition,
and was the original reason this functionality was added in eb12d1cc.
Note that this is a slightly different implementation than eb12d1cc.
This centralizes the definition instead of scattering it across multiple
Makefiles. Also, since we're doing this via a Makefile, revert the
change to vendor code in e00185f1.

Requested-by: swildner, marino
7 days agosbin/hammer: Make sizetostr() print B if <1KB
Tomohiro Kusumi [Mon, 22 Aug 2016 12:23:32 +0000 (21:23 +0900)]
sbin/hammer: Make sizetostr() print B if <1KB

7 days agosbin/hammer: Add print_blockmap() for common blockmap output format
Tomohiro Kusumi [Sun, 21 Aug 2016 12:16:19 +0000 (21:16 +0900)]
sbin/hammer: Add print_blockmap() for common blockmap output format

This is for hammer blockmap,checkmap,show,show-undo commands.
These hammer commands print blockmap information prior to checking
whatever filesystem structure they're looking for, with slightly
different format but essentially the same thing.

print_blockmap() defines a common format so that these commands
can print blockmap information in the same format. print_blockmap()
is based on hammer blockmap command's output format since it has
the best readable format.

8 days agosbin/hammer: Make get_buffer() static
Tomohiro Kusumi [Sun, 21 Aug 2016 07:49:54 +0000 (16:49 +0900)]
sbin/hammer: Make get_buffer() static

This is always called via other get functions (but not directly)
from various hammer commands.

8 days agobuildworld - bootstrap compatibility compiling older DragonFly's
zrj [Sun, 21 Aug 2016 08:30:47 +0000 (11:30 +0300)]
buildworld - bootstrap compatibility compiling older DragonFly's

* Fix buildworld issue bootstrapping gencat/uudecode utilities which does not
  expect newer header files (POSIX getline general visibility from <stdio.h>).

Could be MFC'd to DragonFly 4.6 branch for easier switching <-> master.

8 days agolib/libexecinfo: Fix sysctl wrong argument order.
zrj [Sat, 20 Aug 2016 15:10:40 +0000 (18:10 +0300)]
lib/libexecinfo: Fix sysctl wrong argument order.

Not fatal, procfs fallback should still work (provided /proc is mounted).
Thus fix and prefer using the KERN_PROC_PATHNAME variant.

8 days agosed(1): Fix issue with basename()/dirname() invoke.
zrj [Sat, 20 Aug 2016 14:41:23 +0000 (17:41 +0300)]
sed(1): Fix issue with basename()/dirname() invoke.

Use copies when calling these POSIX functions.

Taken-from: FreeBSD r303047

8 days agolibc/readpassphrase: Sync with OpenBSD
zrj [Fri, 19 Aug 2016 11:07:27 +0000 (14:07 +0300)]
libc/readpassphrase: Sync with OpenBSD

Mainly for better terminal and signal handling.
Also include few fixes done by FreeBSD.

Taken-from: FreeBSD

8 days agoSync arc4random() with OpenBSD a bit.
zrj [Fri, 19 Aug 2016 10:39:18 +0000 (13:39 +0300)]
Sync arc4random() with OpenBSD a bit.

Simplify calculation of "2**32 % upper_bound".
While there, perform some stylistic changes.

Taken-from: OpenBSD

8 days agosbin/hammer: Remove unused AssertOnFailure
Tomohiro Kusumi [Sun, 21 Aug 2016 06:45:30 +0000 (15:45 +0900)]
sbin/hammer: Remove unused AssertOnFailure

After the previous commit, AssertOnFailure is no longer needed
as a global variable. It can be removed or replaced with DebugOpt
which is what AssertOnFailure was based on in some commands.

8 days agosbin/hammer: Remove AssertOnFailure assertion in blockmap lookup
Tomohiro Kusumi [Sun, 21 Aug 2016 06:07:30 +0000 (15:07 +0900)]
sbin/hammer: Remove AssertOnFailure assertion in blockmap lookup

This isn't necessary as blockmap_lookup() callers are going to
check returned offset and/or *errorp value. Callers don't want
blockmap_lookup() to kill the process instantly via errx()
especially when the callers are diagnostic commands like hammer
show or blockmap or checkmap.

This is also the only place where AssertOnFailure needs to be
a global variable. Once this gets removed, other ones can be
removed or changed to local variables.

8 days agosbin/hammer: Drop bug fix by 750beaef after 9376f71b
Tomohiro Kusumi [Sun, 21 Aug 2016 02:02:57 +0000 (11:02 +0900)]
sbin/hammer: Drop bug fix by 750beaef after 9376f71b

Since ondisk PFS data is no longer degraded or updated,
a bug fix made by 750beaef in 2015 can be removed.

8 days agosbin/hammer: Don't ioctl(SET_PFS) before attempt to destroy PFS
Tomohiro Kusumi [Thu, 18 Aug 2016 14:00:44 +0000 (23:00 +0900)]
sbin/hammer: Don't ioctl(SET_PFS) before attempt to destroy PFS

This is part 1/2 of what's mentioned in below post.
Two ondisk PFS data (deleted PFS followed by undeleted PFS data) will
still appear with this commit, like what's mentioned in below post.
(This comes from HAMMER's flushing mechanism, so it's basically a bad
idea to try to fix it unless it's possible without touching core part
of HAMMER's flusher code, provided that this extra ondisk PFS data
does nothing bad. This may be fixed in the future as part 2/2 patch.)

http://lists.dragonflybsd.org/pipermail/users/2016-August/313004.html

This part 1/2 patch alone is still effective even without part 2/2.

If the PFS is successfully destroyed, the ondisk PFS data written by
ioctl(HAMMERIOC_SET_PSEUDOFS) prior to destroying (which is the code
removed by this commit) gets shadowed by the one with deleted flag,
so no one is to (or no one needs to) access that.

If failed to destroy the PFS, the original ondisk PFS data is restored
using a copy of the original data, so ioctl(HAMMERIOC_SET_PSEUDOFS)
prior to destroying is still unnecessary. Also see 750beaef.
Restoring part by 750beaef could be removed too since the PFS is not
downgraded or updated anymore.

9 days agosys/vfs/hammer: Add comments on filesystem capacity
Tomohiro Kusumi [Sat, 20 Aug 2016 04:14:54 +0000 (13:14 +0900)]
sys/vfs/hammer: Add comments on filesystem capacity

9 days agosys/vfs/hammer: Integrate ondisk uint32 reserveds into []
Tomohiro Kusumi [Sat, 20 Aug 2016 04:01:56 +0000 (13:01 +0900)]
sys/vfs/hammer: Integrate ondisk uint32 reserveds into []

Reserved field id's aren't in order from 00 to 11, so keeping them
with id's isn't that important, but rather confusing.

Also remove obsolete comment from ddfdf542 in 2008.
The idea of "birth time" was never explained in neither source nor
commit messages.

10 days agokernel/msdosfs: Add pathconf(3) support for FILESIZEBITS.
Sascha Wildner [Thu, 18 Aug 2016 20:10:16 +0000 (22:10 +0200)]
kernel/msdosfs: Add pathconf(3) support for FILESIZEBITS.

10 days agokernel/msdosfs: Sort pathconf cases in msdosfs_pathconf().
Sascha Wildner [Thu, 18 Aug 2016 20:08:12 +0000 (22:08 +0200)]
kernel/msdosfs: Sort pathconf cases in msdosfs_pathconf().

While here, break a long line.

10 days agokernel/vfs: Sort pathconf cases in the default pathconf.
Sascha Wildner [Thu, 18 Aug 2016 20:03:11 +0000 (22:03 +0200)]
kernel/vfs: Sort pathconf cases in the default pathconf.

11 days agosys/vfs/hammer: Remove unused HAMMER_IOC_PFS_XXX macros
Tomohiro Kusumi [Thu, 18 Aug 2016 14:25:11 +0000 (23:25 +0900)]
sys/vfs/hammer: Remove unused HAMMER_IOC_PFS_XXX macros

These were added in 5fa5c92f in 2008, but never used.

11 days agosbin/hammer: Remove if(QuietOpt) conditionals in hammer show/checkmap
Tomohiro Kusumi [Thu, 18 Aug 2016 12:35:39 +0000 (21:35 +0900)]
sbin/hammer: Remove if(QuietOpt) conditionals in hammer show/checkmap

mostly since it doesn't make much difference anyway.

The only QuietOpt conditional left is for print_record(elm) in
print_btree_elm() which makes amount of output text quite diffrent.

11 days agosbin/hammer: Add inode size check to hammer show
Tomohiro Kusumi [Thu, 18 Aug 2016 11:33:58 +0000 (20:33 +0900)]
sbin/hammer: Add inode size check to hammer show

Do the same sanity check as what hammer_crc_set|test_leaf()
do in kernel space.

11 days agosbin/hammer: Minor hammer show cleanups
Tomohiro Kusumi [Thu, 18 Aug 2016 11:28:55 +0000 (20:28 +0900)]
sbin/hammer: Minor hammer show cleanups

12 days agosys/vfs/hammer: Fix wrong comment and unnecessary argument
Tomohiro Kusumi [Wed, 17 Aug 2016 11:08:01 +0000 (20:08 +0900)]
sys/vfs/hammer: Fix wrong comment and unnecessary argument

B-Tree code isn't aware of PFS (or other HAMMER record types built
on top of B-Tree) by design. In fact pfsm argument is unused and
no longer necessary after sometime in 2008.

13 days agosbin/hammer: Fix memory leak
Tomohiro Kusumi [Tue, 16 Aug 2016 11:45:44 +0000 (20:45 +0900)]
sbin/hammer: Fix memory leak

strsep moves * by taking **, so the caller need to keep a pointer to strdup'd address.

13 days agosbin/hammer: Refactoring
Tomohiro Kusumi [Tue, 16 Aug 2016 11:11:46 +0000 (20:11 +0900)]
sbin/hammer: Refactoring

2 weeks agosbin/newfs_hammer: Add -h option
Tomohiro Kusumi [Mon, 15 Aug 2016 12:11:31 +0000 (21:11 +0900)]
sbin/newfs_hammer: Add -h option

2 weeks agosbin/newfs_hammer: Add exit_code arg to usage()
Tomohiro Kusumi [Mon, 15 Aug 2016 12:06:14 +0000 (21:06 +0900)]
sbin/newfs_hammer: Add exit_code arg to usage()

2 weeks agosbin/hammer: Cleanups
Tomohiro Kusumi [Mon, 15 Aug 2016 11:48:37 +0000 (20:48 +0900)]
sbin/hammer: Cleanups

2 weeks agosbin/newfs_hammer: Add -C option from hammer(8)
Tomohiro Kusumi [Sun, 14 Aug 2016 15:54:05 +0000 (00:54 +0900)]
sbin/newfs_hammer: Add -C option from hammer(8)

Just to support the same options given that these are both based
on the same volume/buffer structure.

2 weeks agoUpdate the pciconf(8) database.
Sascha Wildner [Mon, 15 Aug 2016 06:45:33 +0000 (08:45 +0200)]
Update the pciconf(8) database.

July 31, 2016 snapshot from http://pciids.sourceforge.net/

2 weeks agosys/vfs/hammer: Drop redundant error initialization
Tomohiro Kusumi [Sun, 14 Aug 2016 06:37:03 +0000 (15:37 +0900)]
sys/vfs/hammer: Drop redundant error initialization

error is always 0 when it hits here.
(It would have already returned non-zero error otherwise)

2 weeks agosys/vfs/hammer: Rename HAMMERIOC_PFS_ITERATE to HAMMERIOC_SCAN_PSEUDOFS
Tomohiro Kusumi [Sat, 13 Aug 2016 07:03:39 +0000 (16:03 +0900)]
sys/vfs/hammer: Rename HAMMERIOC_PFS_ITERATE to HAMMERIOC_SCAN_PSEUDOFS

The name of this ioctl is misleading.
It has nothing to do with iteration, as all it does is a single lookup.
This ioctl is just a variant of the existing HAMMER_IOC_GET_PSEUDOFS
as mentioned in the previous commit.

This commit breaks userspace, and requires buildworld, though it
only affects libhammer and hammer info command. See the previous
commit for justification of doing this.

2 weeks agosys/vfs/hammer: Change/Fix ioctl API for HAMMERIOC_PFS_ITERATE
Tomohiro Kusumi [Sat, 13 Aug 2016 05:52:29 +0000 (14:52 +0900)]
sys/vfs/hammer: Change/Fix ioctl API for HAMMERIOC_PFS_ITERATE

Rewrite hammer_ioc_iterate_pseudofs() as a proper hammer ioctl.
This commit requires buildworld, but it only affects libhammer and
hammer info command.

This ioctl has had lots of design issues as mentioned in 898f9540
and d8c56f70 in 2015. This ioctl is also just a variant of the
existing HAMMER_IOC_GET_PSEUDOFS which originally existed before
HAMMERIOC_PFS_ITERATE was added.

(It can't be replaced with HAMMER_IOC_GET_PSEUDOFS at the moment,
because of the difference in handling ondisk PFS data with deleted
flag set, but it should be replaced or removed in the future.
This interface is too tightly coupled with libhammer that no one
else really needs this, and there is a way to do the same thing
without using this ioctl. There is also a possible bug that comes
from the way this ioctl and libhammer is assuming about PFS data
with deleted flag set)

This commit breaks userspace that's been directly using this ioctl,
but I doubt anyone has done except for libhammer, as the existence
of such an ioctl has never been mentioned in DragonFly manpages or
other documents. Also note that this ioctl was added for libhammer,
so no one else is likely to really care about it.

2 weeks agosbin/hammer: Cleanups
Tomohiro Kusumi [Sat, 13 Aug 2016 04:29:17 +0000 (13:29 +0900)]
sbin/hammer: Cleanups

2 weeks agoUnbreak build.
Peter Avalos [Sun, 14 Aug 2016 02:50:50 +0000 (19:50 -0700)]
Unbreak build.

Somehow I forgot to include version.h in the servconf.c change that
appended our DragonFly-specific VersionAddendum to sshd.

2 weeks agoPatch ssh vendor code for xauth's default location.
Peter Avalos [Sat, 13 Aug 2016 21:54:53 +0000 (14:54 -0700)]
Patch ssh vendor code for xauth's default location.

This puts the change in one obvious place instead of scattering it
around different Makefiles and makes documention correct.

2 weeks agosshd(8): Disable tunneled cleartext passwords.
Peter Avalos [Sat, 13 Aug 2016 20:49:59 +0000 (13:49 -0700)]
sshd(8): Disable tunneled cleartext passwords.

This was previously our default that got wiped away when I removed our
local changes to OpenSSH. It's unlikely that anyone running master saw
any change to their sshd behavior, because they likely had the
PasswordAuthentication line uncommented in their configuration file.

2 weeks ago<sys/errno.h>: Use __BSD_VISIBLE instead of !_POSIX_SOURCE.
Sascha Wildner [Sat, 13 Aug 2016 19:24:19 +0000 (21:24 +0200)]
<sys/errno.h>: Use __BSD_VISIBLE instead of !_POSIX_SOURCE.

_POSIX_SOURCE is no longer set since it was superseded by
_POSIX_C_SOURCE. In other words, #ifndef _POSIX_SOURCE is
always true, unless IEEE Std 1003.1-1988 is explicitly
requested.

While here, clean up the visibility of all errno defines.
Those not mentioned in any standard are __BSD_VISIBLE now.
We can further restrict the standard ones at some later
point.

2 weeks ago<sys/errno.h>: Adjust whitespace (no functional change).
Sascha Wildner [Sat, 13 Aug 2016 19:23:54 +0000 (21:23 +0200)]
<sys/errno.h>: Adjust whitespace (no functional change).

2 weeks agosbin/hammer: Don't include libhammer.h unconditionally
Tomohiro Kusumi [Fri, 12 Aug 2016 13:29:10 +0000 (22:29 +0900)]
sbin/hammer: Don't include libhammer.h unconditionally

Though /sbin/hammer links to libhammer, only two commands use it.

Move SNAPSHOTS_BASE from cmd_cleanup.c to hammer.h.
This macro is defined in both sbin/hammer and libhammer.
It apparently doesn't need to ask an external library for snapshot location.

 # grep libhammer sbin/hammer sbin/newfs_hammer -rIl
 sbin/hammer/cmd_info.c
 sbin/hammer/cmd_snapshot.c
 sbin/hammer/hammer.h

2 weeks agosbin/hammer: Rewrite hammer bstats/iostats
Tomohiro Kusumi [Fri, 12 Aug 2016 12:44:38 +0000 (21:44 +0900)]
sbin/hammer: Rewrite hammer bstats/iostats

- Detach from libhammer.
- Add sysctls that were missing in libhammer.
- It's simply better and clearer without an external library wrappers
  for hammer command itself to just read hammer sysctls.

2 weeks agosys/boot: Unbreak WORLD_CCVER=gcc47
zrj [Tue, 9 Aug 2016 14:29:49 +0000 (17:29 +0300)]
sys/boot: Unbreak WORLD_CCVER=gcc47

Fix -Ox flags mess that exploded boot2_32 image size, by ensuring
that intended -Ox flags were used were needed (gcc50 unaffected).

There is still compilation issue for buildkernel w/ gcc47 but that
-Werror=maybe-uninitialized on i915_gem_stolen.c can wait a bit.

2 weeks agosys.mk: Introduce WORLD_CFLAGS.
zrj [Mon, 8 Aug 2016 15:03:26 +0000 (18:03 +0300)]
sys.mk: Introduce WORLD_CFLAGS.

Main purpose of this flag is to provide user a way to safely add extra
compiler flags to the build system without accidentally removing things
like -pipe or -Ox flags. Also it will help to ensure that none of user
set world flags will propagate to dports compilation to cause ruckus.
CFLAGS is still available as before provided it will be handled with care.

While there, adjust make.conf(5) to promote WORLD_CFLAGS usage instead of
manipulating CFLAGS directly. Also fix typo, ld.gold is default.

2 weeks agosys.mk: Introduce WORLD_CCOPTLEVEL.
zrj [Tue, 9 Aug 2016 12:38:28 +0000 (15:38 +0300)]
sys.mk: Introduce WORLD_CCOPTLEVEL.

After checking out what other compilers than gcc do decided to cave in
and leave 3 recently added NO_* knobs (yep, there are worse compilers).
Not to make matters worse and continue with the work, now pushing just
infrastructure bits for further testing.

WORLD_CCOPTLEVEL controls the optimization level for used -Ox
compiler flag. For now make it default to previous -O.
Also make initial separation between kernel and userland.

Optimization level can be selected globally from /etc/make.conf like:
WORLD_CCOPTLEVEL=2 # valid values are 0,1,2,3,s,g,fast

Use of -O3 and -Ofast is strongly discouraged.

2 weeks agobsd.sys.mk: Make build permissive for pre gcc 5 compilers.
zrj [Tue, 9 Aug 2016 11:42:58 +0000 (14:42 +0300)]
bsd.sys.mk: Make build permissive for pre gcc 5 compilers.

GCC 4.7 4.8 4.9 are known to have certain bugs, so instead of
forcing developers to use NO_WERROR=yes it is better to allow
certain diagnostics to happen, than cripple the primary gcc50.

2 weeks agoxz: Don't use SSE headers for gcc < 5.
zrj [Tue, 9 Aug 2016 10:51:17 +0000 (13:51 +0300)]
xz: Don't use SSE headers for gcc < 5.

liblzma was configured against gcc50 private SSE headers.
Avoid using SSE features for pre gcc5.
Mainly to unbreak WORLD_CCVER=gcc47.