CVS commit: src/usr.sbin/user

2009-12-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Dec 31 19:59:31 UTC 2009

Modified Files:
src/usr.sbin/user: user.c usermgmt.conf.5

Log Message:
Add new keyword gid_range to usermgmt.conf which specifies a default
GID range for groupadd(8).


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/usr.sbin/user/user.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/user/usermgmt.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/doc

2009-12-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Dec 31 22:54:40 UTC 2009

Modified Files:
src/doc: CHANGES

Log Message:
mention tzcode update


To generate a diff of this commit:
cvs rdiff -u -r1.1338 -r1.1339 src/doc/CHANGES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/kern

2010-01-02 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jan  2 15:20:39 UTC 2010

Modified Files:
src/sys/kern: subr_pool.c

Log Message:
Move initialization of pool_allocator_lock before its first use.
This failed on archs where a mutex isn't initialized to a zero
value.

Defer allocation of pool log to the logging action, if allocation
fails, it will be retried the next time something is logged.

Clear pool log on allocation so that ddb doesn't crash when showing
so far unused log entries.


To generate a diff of this commit:
cvs rdiff -u -r1.178 -r1.179 src/sys/kern/subr_pool.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/kern

2010-01-02 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jan  3 01:07:19 UTC 2010

Modified Files:
src/sys/kern: subr_pool.c

Log Message:
Pools are created way before the pool subsystem mutexes are
initialized.

Ignore also pool_allocator_lock while the system is in cold state.

When the system has left cold state, uvm_init() should have
also initialized the pool subsystem and the mutexes are
ready to use.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/kern/subr_pool.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/dkwedge

2010-01-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Jan 25 14:51:03 UTC 2010

Modified Files:
src/sys/dev/dkwedge: dk.c dkwedge_gpt.c

Log Message:
GPTs are defined in terms of physical blocks.
- Fix reading of GPT for devices with non-512byte sectors
- Fix bounds check to use DEV_BSIZE units.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/dkwedge/dk.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/dkwedge/dkwedge_gpt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/msdosfs

2010-01-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Jan 25 15:30:44 UTC 2010

Modified Files:
src/sys/fs/msdosfs: msdosfs_vfsops.c

Log Message:
Fetch sector size also from wedges.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/fs/msdosfs/msdosfs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/fs/msdosfs

2010-01-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jan 31 10:30:41 UTC 2010

Modified Files:
src/sys/fs/msdosfs: msdosfs_vfsops.c

Log Message:
Replace individual queries for partition information with
new helper function.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/fs/msdosfs/msdosfs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/ufs/ext2fs

2010-01-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jan 31 10:36:20 UTC 2010

Modified Files:
src/sys/ufs/ext2fs: ext2fs_vfsops.c

Log Message:
Replace individual queries for partition information with
new helper function.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/ufs/ext2fs/ext2fs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/ufs/ffs

2010-01-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jan 31 10:50:23 UTC 2010

Modified Files:
src/sys/ufs/ffs: ffs_vfsops.c

Log Message:
Replace individual queries for partition information with
new helper function.


To generate a diff of this commit:
cvs rdiff -u -r1.254 -r1.255 src/sys/ufs/ffs/ffs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/ufs/ffs

2010-01-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jan 31 10:54:10 UTC 2010

Modified Files:
src/sys/ufs/ffs: ffs_vfsops.c fs.h

Log Message:
Fix block shift to work with different device block sizes.

Unlike other filesystems this has some side issues because
the shift values are stored in the superblock and because
userland utitlies share the same fsbtodb macros.

- the kernel now ignores the value stored in the superblock.
- the macro adaption is only done for defined(_KERNEL) code.


To generate a diff of this commit:
cvs rdiff -u -r1.255 -r1.256 src/sys/ufs/ffs/ffs_vfsops.c
cvs rdiff -u -r1.54 -r1.55 src/sys/ufs/ffs/fs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/x86/x86

2010-01-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jan 31 11:39:55 UTC 2010

Modified Files:
src/sys/arch/x86/x86: ipmi.c

Log Message:
Release buffer in case a receive failed.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/x86/x86/ipmi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sbin

2010-01-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jan 31 16:04:35 UTC 2010

Modified Files:
src/sbin/fsck_ffs: setup.c
src/sbin/newfs: mkfs.c

Log Message:
Skip handling of APPLEUFS_LABEL if it is smaller than a device block.
In particular:

- newfs will not try to erase the label
- fsck_ffs will not try to validate the label

This lets newfs and fsck work on 2048-byte-per-sector media.

Does Apple UFS support such media and how?


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sbin/fsck_ffs/setup.c
cvs rdiff -u -r1.106 -r1.107 src/sbin/newfs/mkfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm

2010-02-07 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Feb  7 15:51:29 UTC 2010

Modified Files:
src/sys/uvm: uvm_swap.c

Log Message:
Use filesystem blocks to address filesystem objects. f_iosize just
happens to be the same for current filesystems.


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/uvm/uvm_swap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/dkwedge

2010-02-07 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Feb  7 16:04:31 UTC 2010

Modified Files:
src/sys/dev/dkwedge: dk.c

Log Message:
d_psize routine returns a number of blocks or -1 on error.
d_dump routine returns 0 or an error code.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/dkwedge/dk.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm

2010-02-07 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Feb  7 23:25:07 UTC 2010

Modified Files:
src/sys/uvm: uvm_fault.c

Log Message:
Make UVMHIST build again.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/uvm/uvm_fault.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm

2010-02-07 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Feb  8 00:01:39 UTC 2010

Modified Files:
src/sys/uvm: uvm_fault.c

Log Message:
Move assertion to make check more clear.


To generate a diff of this commit:
cvs rdiff -u -r1.164 -r1.165 src/sys/uvm/uvm_fault.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm

2010-02-07 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Feb  8 00:02:50 UTC 2010

Modified Files:
src/sys/uvm: uvm_fault.c

Log Message:
pgo_get needs the page array to be initialized.


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 src/sys/uvm/uvm_fault.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/ufs/ffs

2010-02-10 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Feb 11 00:06:16 UTC 2010

Modified Files:
src/sys/ufs/ffs: ffs_vfsops.c

Log Message:
There is no code left that uses disk size data, so don't query it.
This also failed when querying the simulated block device from mfs.
Fixes PR kern/42782.


To generate a diff of this commit:
cvs rdiff -u -r1.257 -r1.258 src/sys/ufs/ffs/ffs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/ufs/ext2fs

2010-02-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Feb 11 19:50:34 UTC 2010

Modified Files:
src/sys/ufs/ext2fs: ext2fs_vfsops.c

Log Message:
There is no code left that uses disk size data, so don't query it.


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/ufs/ext2fs/ext2fs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/dumplfs

2010-02-16 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Feb 16 18:57:54 UTC 2010

Modified Files:
src/usr.sbin/dumplfs: dumplfs.c

Log Message:
Read the padded superblocks to avoid problems with disks that have
larger sectors than 512 Bytes.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/dumplfs/dumplfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/libexec/lfs_cleanerd

2010-02-16 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Feb 16 23:13:13 UTC 2010

Modified Files:
src/libexec/lfs_cleanerd: lfs_cleanerd.c

Log Message:
Read the padded superblocks to avoid problems with disks that have
larger sectors than 512 Bytes.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/libexec/lfs_cleanerd/lfs_cleanerd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2010-02-16 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Feb 16 23:20:31 UTC 2010

Modified Files:
src/sbin/fsck_lfs: dir.c inode.c kernelops.h lfs.c pass1.c pass4.c
pass6.c segwrite.c segwrite.h setup.c vars.c vnode.c
src/sbin/newfs_lfs: make_lfs.c newfs.c
src/sys/ufs/lfs: lfs.h lfs_balloc.c lfs_bio.c lfs_inode.c lfs_segment.c
lfs_subr.c lfs_syscalls.c lfs_vfsops.c

Log Message:
Three changes in a single commit.

- drop the notion of frags (LFS fragments) vs fsb (FFS fragments)
  The code uses a complicated unity function that just makes the
  code difficult to understand.

- support larger sector sizes. Fix disk address computations
  to use DEV_BSIZE in the kernel as required by device drivers
  and to use sector sizes in userland.

- Fix several locking bugs in lfs_bio.c and lfs_subr.c.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sbin/fsck_lfs/dir.c
cvs rdiff -u -r1.41 -r1.42 src/sbin/fsck_lfs/inode.c
cvs rdiff -u -r1.3 -r1.4 src/sbin/fsck_lfs/kernelops.h
cvs rdiff -u -r1.31 -r1.32 src/sbin/fsck_lfs/lfs.c
cvs rdiff -u -r1.29 -r1.30 src/sbin/fsck_lfs/pass1.c
cvs rdiff -u -r1.16 -r1.17 src/sbin/fsck_lfs/pass4.c
cvs rdiff -u -r1.22 -r1.23 src/sbin/fsck_lfs/pass6.c
cvs rdiff -u -r1.19 -r1.20 src/sbin/fsck_lfs/segwrite.c
cvs rdiff -u -r1.2 -r1.3 src/sbin/fsck_lfs/segwrite.h
cvs rdiff -u -r1.36 -r1.37 src/sbin/fsck_lfs/setup.c
cvs rdiff -u -r1.13 -r1.14 src/sbin/fsck_lfs/vars.c
cvs rdiff -u -r1.10 -r1.11 src/sbin/fsck_lfs/vnode.c
cvs rdiff -u -r1.15 -r1.16 src/sbin/newfs_lfs/make_lfs.c
cvs rdiff -u -r1.24 -r1.25 src/sbin/newfs_lfs/newfs.c
cvs rdiff -u -r1.132 -r1.133 src/sys/ufs/lfs/lfs.h
cvs rdiff -u -r1.68 -r1.69 src/sys/ufs/lfs/lfs_balloc.c
cvs rdiff -u -r1.116 -r1.117 src/sys/ufs/lfs/lfs_bio.c
cvs rdiff -u -r1.121 -r1.122 src/sys/ufs/lfs/lfs_inode.c
cvs rdiff -u -r1.214 -r1.215 src/sys/ufs/lfs/lfs_segment.c
cvs rdiff -u -r1.73 -r1.74 src/sys/ufs/lfs/lfs_subr.c
cvs rdiff -u -r1.135 -r1.136 src/sys/ufs/lfs/lfs_syscalls.c
cvs rdiff -u -r1.282 -r1.283 src/sys/ufs/lfs/lfs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sbin/gpt

2010-02-20 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 20 08:47:10 UTC 2010

Modified Files:
src/sbin/gpt: gpt.c

Log Message:
Initialize device_name before opendisk to avoid
unable to open device '(null)' error messages
when the opendisk fails.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sbin/gpt/gpt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/ufs/ffs

2010-02-21 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Feb 21 13:55:58 UTC 2010

Modified Files:
src/sys/ufs/ffs: ffs_alloc.c

Log Message:
For the UVM_PAGE_TRKOWN test do not require that the relevant pages
must exist.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/ufs/ffs/ffs_alloc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sbin/fsck_lfs

2010-02-21 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Feb 21 16:24:21 UTC 2010

Modified Files:
src/sbin/fsck_lfs: lfs.c

Log Message:
dev_bsize wasn't initialized. The actual value doesn't matter since
the same value is used to compute byte offsets into the special file
but a value of zero causes a division by zero.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sbin/fsck_lfs/lfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/ufs/ffs

2010-02-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Feb 23 20:41:41 UTC 2010

Modified Files:
src/sys/ufs/ffs: ffs_wapbl.c

Log Message:
Replace individual queries for partition information with
new helper function.
Use this information to query physical sector sizes for WAPBL
instead of hardcoded defaults.
No longer limits physical sector sizes to 512 bytes.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/ufs/ffs/ffs_wapbl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/kern

2010-02-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Feb 23 20:51:26 UTC 2010

Modified Files:
src/sys/kern: vfs_wapbl.c

Log Message:
Use correct offset to block number calculations.

Also change access to filesystem blocks to be done by fragment instead
of by physical block. Fragments are the fundamental blocks of the
filesystem.

For a theoretical filesystem that accesses the disk in smaller units
than stored in mp-mnt_fs_bshift, the assumption might be wrong. But
this will also break other subsystems. The value mp-mnt_dev_bshift
which formerly represents the physical sector size is currently only
virtual in NetBSD (always DEV_BSIZE).


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/kern/vfs_wapbl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/kern

2010-02-26 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Feb 26 22:24:07 UTC 2010

Modified Files:
src/sys/kern: vfs_wapbl.c

Log Message:
mnt_fs_bshift is the filesystem block size, not the fragment size.

Revert to physical block size. This is fine as long as filesystem
and log stay on a similar physical medium.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/kern/vfs_wapbl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/vfs_wapbl.c
diff -u src/sys/kern/vfs_wapbl.c:1.31 src/sys/kern/vfs_wapbl.c:1.32
--- src/sys/kern/vfs_wapbl.c:1.31	Tue Feb 23 20:51:25 2010
+++ src/sys/kern/vfs_wapbl.c	Fri Feb 26 22:24:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_wapbl.c,v 1.31 2010/02/23 20:51:25 mlelstv Exp $	*/
+/*	$NetBSD: vfs_wapbl.c,v 1.32 2010/02/26 22:24:07 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #define WAPBL_INTERNAL
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_wapbl.c,v 1.31 2010/02/23 20:51:25 mlelstv Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_wapbl.c,v 1.32 2010/02/26 22:24:07 mlelstv Exp $);
 
 #include sys/param.h
 #include sys/bitops.h
@@ -319,7 +319,7 @@
 	daddr_t logpbn;
 	int error;
 	int log_dev_bshift = ilog2(blksize);
-	int fs_dev_bshift = mp-mnt_fs_bshift; /* XXX */
+	int fs_dev_bshift = log_dev_bshift;
 	int run;
 
 	WAPBL_PRINTF(WAPBL_PRINT_OPEN, (wapbl_start: vp=%p off=% PRId64



CVS commit: src/sys/kern

2010-02-26 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Feb 26 22:24:07 UTC 2010

Modified Files:
src/sys/kern: vfs_wapbl.c

Log Message:
mnt_fs_bshift is the filesystem block size, not the fragment size.

Revert to physical block size. This is fine as long as filesystem
and log stay on a similar physical medium.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/kern/vfs_wapbl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




CVS commit: src/usr.sbin/dumpfs

2010-02-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 27 09:05:59 UTC 2010

Modified Files:
src/usr.sbin/dumpfs: dumpfs.8 dumpfs.c

Log Message:
Add support to print the WAPBL journal.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/dumpfs/dumpfs.8
cvs rdiff -u -r1.53 -r1.54 src/usr.sbin/dumpfs/dumpfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/dumpfs

2010-02-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 27 09:53:33 UTC 2010

Modified Files:
src/usr.sbin/dumpfs: dumpfs.c

Log Message:
Print both commit headers, even for disks with larger block sizes.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/usr.sbin/dumpfs/dumpfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/dumpfs/dumpfs.c
diff -u src/usr.sbin/dumpfs/dumpfs.c:1.54 src/usr.sbin/dumpfs/dumpfs.c:1.55
--- src/usr.sbin/dumpfs/dumpfs.c:1.54	Sat Feb 27 09:05:59 2010
+++ src/usr.sbin/dumpfs/dumpfs.c	Sat Feb 27 09:53:33 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dumpfs.c,v 1.54 2010/02/27 09:05:59 mlelstv Exp $	*/
+/*	$NetBSD: dumpfs.c,v 1.55 2010/02/27 09:53:33 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1983, 1992, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = @(#)dumpfs.c	8.5 (Berkeley) 4/29/95;
 #else
-__RCSID($NetBSD: dumpfs.c,v 1.54 2010/02/27 09:05:59 mlelstv Exp $);
+__RCSID($NetBSD: dumpfs.c,v 1.55 2010/02/27 09:53:33 mlelstv Exp $);
 #endif
 #endif /* not lint */
 
@@ -755,7 +755,7 @@
 			skip = blklen;
 
 			boff = bno * DEV_BSIZE;
-			if (bno = 2 
+			if (bno * DEV_BSIZE = 2 * blklen 
 			  ((head = tail  (boff  tail || boff = head)) ||
 			  (head  tail  (boff = head  boff  tail
 continue;



CVS commit: src/usr.sbin/dumpfs

2010-02-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 27 09:53:33 UTC 2010

Modified Files:
src/usr.sbin/dumpfs: dumpfs.c

Log Message:
Print both commit headers, even for disks with larger block sizes.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/usr.sbin/dumpfs/dumpfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys

2010-02-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 27 12:04:20 UTC 2010

Modified Files:
src/sys/kern: vfs_wapbl.c
src/sys/ufs/ffs: ffs_wapbl.c

Log Message:
Store physical block numbers in superblock that point to the journal.
Calculate position of both commit headers correctly for disks with
large sectors.
Correct calculation of circular buffer size.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/kern/vfs_wapbl.c
cvs rdiff -u -r1.14 -r1.15 src/sys/ufs/ffs/ffs_wapbl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/vfs_wapbl.c
diff -u src/sys/kern/vfs_wapbl.c:1.32 src/sys/kern/vfs_wapbl.c:1.33
--- src/sys/kern/vfs_wapbl.c:1.32	Fri Feb 26 22:24:07 2010
+++ src/sys/kern/vfs_wapbl.c	Sat Feb 27 12:04:19 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_wapbl.c,v 1.32 2010/02/26 22:24:07 mlelstv Exp $	*/
+/*	$NetBSD: vfs_wapbl.c,v 1.33 2010/02/27 12:04:19 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #define WAPBL_INTERNAL
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_wapbl.c,v 1.32 2010/02/26 22:24:07 mlelstv Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_wapbl.c,v 1.33 2010/02/27 12:04:19 mlelstv Exp $);
 
 #include sys/param.h
 #include sys/bitops.h
@@ -344,6 +344,10 @@
 	if (blksize % DEV_BSIZE)
 		return EINVAL;
 
+	/* Kernel uses DEV_BSIZE units */
+	off = btodb(off  log_dev_bshift);
+	count = btodb(count  log_dev_bshift);
+
 	/* XXXTODO: verify that the full load is writable */
 
 	/*
@@ -379,7 +383,7 @@
 
 	/* Reserve two log device blocks for the commit headers */
 	wl-wl_circ_off = 2wl-wl_log_dev_bshift;
-	wl-wl_circ_size = ((count * blksize) - wl-wl_circ_off);
+	wl-wl_circ_size = ((count * DEV_BSIZE) - wl-wl_circ_off);
 	/* truncate the log usage to a multiple of log_dev_bshift */
 	wl-wl_circ_size = wl-wl_log_dev_bshift;
 	wl-wl_circ_size = wl-wl_log_dev_bshift;
@@ -1855,7 +1859,8 @@
 	 */
 
 	error = wapbl_write(wc, wc-wc_len, wl-wl_devvp,
-	wl-wl_logpbn + wc-wc_generation % 2);
+	wl-wl_logpbn +
+	((wc-wc_generation % 2)  (wc-wc_log_dev_bshift - DEV_BSHIFT)));
 	if (error)
 		return error;
 
@@ -2256,6 +2261,10 @@
 		return EINVAL;
 
 #ifdef _KERNEL
+	/* Kernel uses DEV_BSIZE units */
+	off = btodb(off  log_dev_bshift);
+	count = btodb(count  log_dev_bshift);
+
 #if 0
 	/* XXX vp-v_size isn't reliably set for VBLK devices,
 	 * especially root.  However, we might still want to verify

Index: src/sys/ufs/ffs/ffs_wapbl.c
diff -u src/sys/ufs/ffs/ffs_wapbl.c:1.14 src/sys/ufs/ffs/ffs_wapbl.c:1.15
--- src/sys/ufs/ffs/ffs_wapbl.c:1.14	Tue Feb 23 20:41:41 2010
+++ src/sys/ufs/ffs/ffs_wapbl.c	Sat Feb 27 12:04:19 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_wapbl.c,v 1.14 2010/02/23 20:41:41 mlelstv Exp $	*/
+/*	$NetBSD: ffs_wapbl.c,v 1.15 2010/02/27 12:04:19 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2003,2006,2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ffs_wapbl.c,v 1.14 2010/02/23 20:41:41 mlelstv Exp $);
+__KERNEL_RCSID(0, $NetBSD: ffs_wapbl.c,v 1.15 2010/02/27 12:04:19 mlelstv Exp $);
 
 #define WAPBL_INTERNAL
 
@@ -553,6 +553,10 @@
 		*countp = (logend - logstart);
 		*extradatap = 0;
 
+		/* convert to physical block numbers */
+		*startp = dbtob(*startp) / secsize;
+		*countp = dbtob(*countp) / secsize;
+
 		fs-fs_journallocs[UFS_WAPBL_EPART_ADDR] = *startp;
 		fs-fs_journallocs[UFS_WAPBL_EPART_COUNT] = *countp;
 		fs-fs_journallocs[UFS_WAPBL_EPART_BLKSZ] = *blksizep;
@@ -568,6 +572,10 @@
 		  startp, countp, extradatap);
 		ffs_sync(mp, MNT_WAIT, FSCRED);
 
+		/* convert to physical block numbers */
+		*startp = dbtob(*startp) / secsize;
+		*countp = dbtob(*countp) / secsize;
+
 		fs-fs_journallocs[UFS_WAPBL_INFS_ADDR] = *startp;
 		fs-fs_journallocs[UFS_WAPBL_INFS_COUNT] = *countp;
 		fs-fs_journallocs[UFS_WAPBL_INFS_BLKSZ] = *blksizep;



CVS commit: src/sys

2010-02-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 27 12:04:20 UTC 2010

Modified Files:
src/sys/kern: vfs_wapbl.c
src/sys/ufs/ffs: ffs_wapbl.c

Log Message:
Store physical block numbers in superblock that point to the journal.
Calculate position of both commit headers correctly for disks with
large sectors.
Correct calculation of circular buffer size.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/kern/vfs_wapbl.c
cvs rdiff -u -r1.14 -r1.15 src/sys/ufs/ffs/ffs_wapbl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/dumpfs

2010-02-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 27 12:07:40 UTC 2010

Modified Files:
src/usr.sbin/dumpfs: dumpfs.c

Log Message:
Adjust for change in kernel that stores physical block numbers
in superblock that point to the journal.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/dumpfs/dumpfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/dumpfs/dumpfs.c
diff -u src/usr.sbin/dumpfs/dumpfs.c:1.56 src/usr.sbin/dumpfs/dumpfs.c:1.57
--- src/usr.sbin/dumpfs/dumpfs.c:1.56	Sat Feb 27 10:49:58 2010
+++ src/usr.sbin/dumpfs/dumpfs.c	Sat Feb 27 12:07:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dumpfs.c,v 1.56 2010/02/27 10:49:58 wiz Exp $	*/
+/*	$NetBSD: dumpfs.c,v 1.57 2010/02/27 12:07:40 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1983, 1992, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = @(#)dumpfs.c	8.5 (Berkeley) 4/29/95;
 #else
-__RCSID($NetBSD: dumpfs.c,v 1.56 2010/02/27 10:49:58 wiz Exp $);
+__RCSID($NetBSD: dumpfs.c,v 1.57 2010/02/27 12:07:40 mlelstv Exp $);
 #endif
 #endif /* not lint */
 
@@ -750,12 +750,12 @@
 		count  = afs.fs_journallocs[1];
 		blklen = afs.fs_journallocs[2];
 
-		for (bno=0; bnocount; bno += skip / DEV_BSIZE) {
+		for (bno=0; bnocount; bno += skip / blklen) {
 
 			skip = blklen;
 
-			boff = bno * DEV_BSIZE;
-			if (bno * DEV_BSIZE = 2 * blklen 
+			boff = bno * blklen;
+			if (bno * blklen = 2 * blklen 
 			  ((head = tail  (boff  tail || boff = head)) ||
 			  (head  tail  (boff = head  boff  tail
 continue;
@@ -763,7 +763,7 @@
 			printf(journal block %lu offset %lld\n,
 (unsigned long)bno, (long long) boff);
 
-			if (lseek(fd, (off_t)(off*DEV_BSIZE) + boff, SEEK_SET)
+			if (lseek(fd, (off_t)(off*blklen) + boff, SEEK_SET)
 			== (off_t)-1)
 return (1);
 			if (read(fd, jbuf, blklen) != (ssize_t)blklen) {
@@ -791,8 +791,10 @@
 break;
 			}
 
-			if (blklen)
-skip = (skip + blklen - 1) / blklen * blklen;
+			if (blklen == 0)
+break;
+
+			skip = (skip + blklen - 1) / blklen * blklen;
 			if (skip == 0)
 break;
 



CVS commit: src/usr.sbin/dumpfs

2010-02-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 27 12:07:40 UTC 2010

Modified Files:
src/usr.sbin/dumpfs: dumpfs.c

Log Message:
Adjust for change in kernel that stores physical block numbers
in superblock that point to the journal.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/dumpfs/dumpfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/kern

2010-02-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 27 16:51:03 UTC 2010

Modified Files:
src/sys/kern: vfs_wapbl.c

Log Message:
Move block number computations to callers of wapl_read/wapl_write and
conditionally build DEV_BSIZE adjustments for kernel. fsck_ffs shares
the same code but accesses physical blocks.

Also compute correct block numbers for each physical sector.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/kern/vfs_wapbl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/vfs_wapbl.c
diff -u src/sys/kern/vfs_wapbl.c:1.33 src/sys/kern/vfs_wapbl.c:1.34
--- src/sys/kern/vfs_wapbl.c:1.33	Sat Feb 27 12:04:19 2010
+++ src/sys/kern/vfs_wapbl.c	Sat Feb 27 16:51:03 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_wapbl.c,v 1.33 2010/02/27 12:04:19 mlelstv Exp $	*/
+/*	$NetBSD: vfs_wapbl.c,v 1.34 2010/02/27 16:51:03 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #define WAPBL_INTERNAL
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vfs_wapbl.c,v 1.33 2010/02/27 12:04:19 mlelstv Exp $);
+__KERNEL_RCSID(0, $NetBSD: vfs_wapbl.c,v 1.34 2010/02/27 16:51:03 mlelstv Exp $);
 
 #include sys/param.h
 #include sys/bitops.h
@@ -344,10 +344,6 @@
 	if (blksize % DEV_BSIZE)
 		return EINVAL;
 
-	/* Kernel uses DEV_BSIZE units */
-	off = btodb(off  log_dev_bshift);
-	count = btodb(count  log_dev_bshift);
-
 	/* XXXTODO: verify that the full load is writable */
 
 	/*
@@ -383,7 +379,7 @@
 
 	/* Reserve two log device blocks for the commit headers */
 	wl-wl_circ_off = 2wl-wl_log_dev_bshift;
-	wl-wl_circ_size = ((count * DEV_BSIZE) - wl-wl_circ_off);
+	wl-wl_circ_size = ((count * blksize) - wl-wl_circ_off);
 	/* truncate the log usage to a multiple of log_dev_bshift */
 	wl-wl_circ_size = wl-wl_log_dev_bshift;
 	wl-wl_circ_size = wl-wl_log_dev_bshift;
@@ -740,6 +736,7 @@
 	size_t slen;
 	off_t off = *offp;
 	int error;
+	daddr_t pbn;
 
 	KDASSERT(((len  wl-wl_log_dev_bshift) 
 	wl-wl_log_dev_bshift) == len);
@@ -748,16 +745,22 @@
 		off = wl-wl_circ_off;
 	slen = wl-wl_circ_off + wl-wl_circ_size - off;
 	if (slen  len) {
-		error = wapbl_write(data, slen, wl-wl_devvp,
-		wl-wl_logpbn + btodb(off));
+		pbn = wl-wl_logpbn + (off  wl-wl_log_dev_bshift);
+#ifdef _KERNEL
+		pbn = btodb(pbn  wl-wl_log_dev_bshift);
+#endif
+		error = wapbl_write(data, slen, wl-wl_devvp, pbn);
 		if (error)
 			return error;
 		data = (uint8_t *)data + slen;
 		len -= slen;
 		off = wl-wl_circ_off;
 	}
-	error = wapbl_write(data, len, wl-wl_devvp,
-			wl-wl_logpbn + btodb(off));
+	pbn = wl-wl_logpbn + (off  wl-wl_log_dev_bshift);
+#ifdef _KERNEL
+	pbn = btodb(pbn  wl-wl_log_dev_bshift);
+#endif
+	error = wapbl_write(data, len, wl-wl_devvp, pbn);
 	if (error)
 		return error;
 	off += len;
@@ -1832,6 +1835,7 @@
 	struct timespec ts;
 	int error;
 	int force = 1;
+	daddr_t pbn;
 
 	/* XXX Calc checksum here, instead we do this for now */
 	error = VOP_IOCTL(wl-wl_devvp, DIOCCACHESYNC, force, FWRITE, FSCRED);
@@ -1858,9 +1862,11 @@
 	 * over second commit header before trying to write both headers.
 	 */
 
-	error = wapbl_write(wc, wc-wc_len, wl-wl_devvp,
-	wl-wl_logpbn +
-	((wc-wc_generation % 2)  (wc-wc_log_dev_bshift - DEV_BSHIFT)));
+	pbn = wl-wl_logpbn + (wc-wc_generation % 2);
+#ifdef _KERNEL
+	pbn = btodb(pbn  wc-wc_log_dev_bshift);
+#endif
+	error = wapbl_write(wc, wc-wc_len, wl-wl_devvp, pbn);
 	if (error)
 		return error;
 
@@ -2183,23 +2189,31 @@
 	size_t slen;
 	off_t off = *offp;
 	int error;
+	daddr_t pbn;
 
 	KASSERT(((len  wr-wr_log_dev_bshift) 
 	wr-wr_log_dev_bshift) == len);
+
 	if (off  wr-wr_circ_off)
 		off = wr-wr_circ_off;
 	slen = wr-wr_circ_off + wr-wr_circ_size - off;
 	if (slen  len) {
-		error = wapbl_read(data, slen, wr-wr_devvp,
-		wr-wr_logpbn + (off  wr-wr_log_dev_bshift));
+		pbn = wr-wr_logpbn + (off  wr-wr_log_dev_bshift);
+#ifdef _KERNEL
+		pbn = btodb(pbn  wr-wr_log_dev_bshift);
+#endif
+		error = wapbl_read(data, slen, wr-wr_devvp, pbn);
 		if (error)
 			return error;
 		data = (uint8_t *)data + slen;
 		len -= slen;
 		off = wr-wr_circ_off;
 	}
-	error = wapbl_read(data, len, wr-wr_devvp,
-	wr-wr_logpbn + (off  wr-wr_log_dev_bshift));
+	pbn = wr-wr_logpbn + (off  wr-wr_log_dev_bshift);
+#ifdef _KERNEL
+	pbn = btodb(pbn  wr-wr_log_dev_bshift);
+#endif
+	error = wapbl_read(data, len, wr-wr_devvp, pbn);
 	if (error)
 		return error;
 	off += len;
@@ -2247,6 +2261,7 @@
 	/* Use this until we read the actual log header */
 	int log_dev_bshift = ilog2(blksize);
 	size_t used;
+	daddr_t pbn;
 
 	WAPBL_PRINTF(WAPBL_PRINT_REPLAY,
 	(wapbl_replay_start: vp=%p off=%PRId64  count=%zu blksize=%zu\n,
@@ -2261,10 +2276,6 @@
 		return EINVAL;
 
 #ifdef _KERNEL
-	/* Kernel uses DEV_BSIZE units */
-	off = btodb(off  log_dev_bshift);
-	count = btodb(count  log_dev_bshift);
-
 #if 0
 	/* XXX 

CVS commit: src/sys/kern

2010-02-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 27 16:51:03 UTC 2010

Modified Files:
src/sys/kern: vfs_wapbl.c

Log Message:
Move block number computations to callers of wapl_read/wapl_write and
conditionally build DEV_BSIZE adjustments for kernel. fsck_ffs shares
the same code but accesses physical blocks.

Also compute correct block numbers for each physical sector.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/kern/vfs_wapbl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sbin/fsck_ffs

2010-03-06 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Mar  6 11:31:40 UTC 2010

Modified Files:
src/sbin/fsck_ffs: wapbl.c

Log Message:
When clearing a log on failure, not only ask the kernel to ignore an
existing log but to remove it on next mount.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sbin/fsck_ffs/wapbl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sbin/fsck_ffs

2010-03-06 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Mar  6 11:31:40 UTC 2010

Modified Files:
src/sbin/fsck_ffs: wapbl.c

Log Message:
When clearing a log on failure, not only ask the kernel to ignore an
existing log but to remove it on next mount.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sbin/fsck_ffs/wapbl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/fsck_ffs/wapbl.c
diff -u src/sbin/fsck_ffs/wapbl.c:1.4 src/sbin/fsck_ffs/wapbl.c:1.5
--- src/sbin/fsck_ffs/wapbl.c:1.4	Sun Sep 13 14:25:28 2009
+++ src/sbin/fsck_ffs/wapbl.c	Sat Mar  6 11:31:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: wapbl.c,v 1.4 2009/09/13 14:25:28 bouyer Exp $	*/
+/*	$NetBSD: wapbl.c,v 1.5 2010/03/06 11:31:40 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2005,2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #define WAPBL_INTERNAL
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wapbl.c,v 1.4 2009/09/13 14:25:28 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: wapbl.c,v 1.5 2010/03/06 11:31:40 mlelstv Exp $);
 
 #include sys/stat.h
 #include sys/time.h
@@ -170,6 +170,7 @@
 			}
 			pwarn(CLEARING EXISTING JOURNAL\n);
 			sblock-fs_flags = ~FS_DOWAPBL;
+			sblock-fs_journal_flags = UFS_WAPBL_FLAGS_CLEAR_LOG;
 			sbdirty();
 			ret = FSCK_EXIT_CHECK_FAILED;
 		} else {
@@ -198,6 +199,7 @@
 }
 pwarn(CLEARING EXISTING JOURNAL\n);
 sblock-fs_flags = ~FS_DOWAPBL;
+sblock-fs_journal_flags = UFS_WAPBL_FLAGS_CLEAR_LOG;
 sblock-fs_journal_location =
 UFS_WAPBL_JOURNALLOC_NONE;
 sbdirty();
@@ -215,6 +217,7 @@
 	}
 	pwarn(CLEARING EXISTING JOURNAL\n);
 	sblock-fs_flags = ~FS_DOWAPBL;
+	sblock-fs_journal_flags = UFS_WAPBL_FLAGS_CLEAR_LOG;
 	sbdirty();
 	ret = FSCK_EXIT_CHECK_FAILED;
 }



Re: CVS commit: src/sys

2013-04-28 Thread Michael van Elst
On Sun, Apr 28, 2013 at 10:56:10AM +0200, Michael van Elst wrote:

  We now get a deadlock between mountlist_lock and mnt_unmounting,
  seen between dounmount() and do_sys_sync() for example.
 
 Do you have a PR showing how to produce that deadlock?

I can see the problem now.

-- 
Michael van Elst
Internet: mlel...@serpens.de
A potential Snark may lurk in every tree.


Re: CVS commit: src/sys

2013-04-28 Thread Michael van Elst
On Sun, Apr 28, 2013 at 01:50:37PM +0200, J. Hannken-Illjes wrote:

  The locking order hasn't been changed, but the faulty tryenter has been
  replaced with an enter.
 
 Sure -- and that is the problem.  The locking order was wrong and you
 removed the hack/workaround without fixing the lock order.

I now release the mnt_unmounting lock before aquiring the mountlist_lock.
This opens a race condition for a concurrent umount that I prevent by
raising the nest counter. With this change I can no longer provoke
the deadlock.

The only difference should now be that vfs_hooks_unmount() is called
outside the unmounting lock. But since it is operating on an already
detached mountpoint (if it is used at all) before it is destroyed,
that should be harmless.

What do you think?

Index: vfs_mount.c
===
RCS file: /cvsroot/src/sys/kern/vfs_mount.c,v
retrieving revision 1.18
diff -u -r1.18 vfs_mount.c
--- vfs_mount.c 26 Apr 2013 22:27:16 -  1.18
+++ vfs_mount.c 28 Apr 2013 14:30:55 -
@@ -866,6 +866,18 @@
}
mutex_exit(mp-mnt_updating);
vfs_scrubvnlist(mp);
+
+   /*
+* release mnt_umounting lock here, because other code calls
+* vfs_busy() while holding the mountlist_lock.
+*
+* mark filesystem as busy to prevent further umounts
+* after mnt_umounting lock is gone
+*/
+   ++mp-mnt_busynest;
+   KASSERT(mp-mnt_busynest != 0);
+   mutex_exit(mp-mnt_unmounting);
+
mutex_enter(mountlist_lock);
if ((coveredvp = mp-mnt_vnodecovered) != NULLVP)
coveredvp-v_mountedhere = NULL;
@@ -877,7 +889,7 @@
if (used_syncer)
mutex_exit(syncer_mutex);
vfs_hooks_unmount(mp);
-   mutex_exit(mp-mnt_unmounting);
+
vfs_destroy(mp);/* reference from mount() */
if (coveredvp != NULLVP) {
vrele(coveredvp);



Greetings,
-- 
Michael van Elst
Internet: mlel...@serpens.de
A potential Snark may lurk in every tree.


Re: CVS commit: src/sys

2013-04-28 Thread Michael van Elst
On Sun, Apr 28, 2013 at 06:03:44PM +0200, J. Hannken-Illjes wrote:

 Unfortunately this also opens a race for do_sys_sync to succeed with
 vfs_busy() and call ffs_sync() with mp-mnt_data == NULL - BOMB.

Setting IMNT_GONE earlier while holding umounting lock would prevent this
because it lets dounmount() and vfs_busy() fail. But then we have a
mountpoint in the list with that flag set. Do you know any side effects
of this?


Greetings,
-- 
Michael van Elst
Internet: mlel...@serpens.de
A potential Snark may lurk in every tree.


Re: CVS commit: src/sys

2013-04-28 Thread Michael van Elst
On Sun, Apr 28, 2013 at 06:36:36PM +0200, Michael van Elst wrote:
 On Sun, Apr 28, 2013 at 06:03:44PM +0200, J. Hannken-Illjes wrote:
 
  Unfortunately this also opens a race for do_sys_sync to succeed with
  vfs_busy() and call ffs_sync() with mp-mnt_data == NULL - BOMB.
 
 Setting IMNT_GONE earlier while holding umounting lock would prevent this
 because it lets dounmount() and vfs_busy() fail. But then we have a
 mountpoint in the list with that flag set. Do you know any side effects
 of this?

Here is a diff.

Index: sys/kern/vfs_mount.c
===
RCS file: /cvsroot/src/sys/kern/vfs_mount.c,v
retrieving revision 1.18
diff -u -r1.18 vfs_mount.c
--- sys/kern/vfs_mount.c26 Apr 2013 22:27:16 -  1.18
+++ sys/kern/vfs_mount.c28 Apr 2013 16:40:32 -
@@ -866,18 +866,29 @@
}
mutex_exit(mp-mnt_updating);
vfs_scrubvnlist(mp);
+
+   /*
+* release mnt_umounting lock here, because other code calls
+* vfs_busy() while holding the mountlist_lock.
+*
+* mark filesystem as gone to prevent further umounts
+* after mnt_umounting lock is gone, this also prevents
+* vfs_busy() from succeeding.
+*/
+   mp-mnt_iflag |= IMNT_GONE;
+   mutex_exit(mp-mnt_unmounting);
+
mutex_enter(mountlist_lock);
if ((coveredvp = mp-mnt_vnodecovered) != NULLVP)
coveredvp-v_mountedhere = NULL;
CIRCLEQ_REMOVE(mountlist, mp, mnt_list);
-   mp-mnt_iflag |= IMNT_GONE;
mutex_exit(mountlist_lock);
if (TAILQ_FIRST(mp-mnt_vnodelist) != NULL)
panic(unmount: dangling vnode);
if (used_syncer)
mutex_exit(syncer_mutex);
vfs_hooks_unmount(mp);
-   mutex_exit(mp-mnt_unmounting);
+
vfs_destroy(mp);/* reference from mount() */
if (coveredvp != NULLVP) {
vrele(coveredvp);

-- 
Michael van Elst
Internet: mlel...@serpens.de
A potential Snark may lurk in every tree.


Re: CVS commit: src/sys/dev

2015-05-05 Thread Michael van Elst
On Tue, May 05, 2015 at 07:47:09PM -0400, Greg Troxel wrote:
 
 Michael van Elst mlel...@netbsd.org writes:
 
  Modified Files:
  src/sys/dev: dksubr.c
 
  Log Message:
  warn about labels only when built with DIAGNOSTIC
 
 This feels like an abuse of DIAGNOSTIC, which is supposed to be about
 asserts for detecting internal inconsistencies, not changing the
 behavior of how the kernel responds to external inputs.
 
 I don't have any problem with warnings for dodgy external input being
 generally enabled, or having a separate verbose option.   I can't see
 any reason not to have them, as it's not like new labels appearing is a
 high-rate event that would dos the log.


The warnings are restricted to diagnostic kernels only because they
did fill the log on some systems, i.e. those where we provide images
for SD cards of unspecified size. Every device-open (for a device that
happens to already use the dksubr routines) prints the warning,
not just every newly detected bad label.

Saying that, some device drivers have private code that does the
same, some don't or do it in a different way. This excercise is
more about making things more consistent. When we have a method
to keep the noise down to a sane level, it's no problem to enable
the warnings again in a default kernel.


Greetings,
-- 
Michael van Elst
Internet: mlel...@serpens.de
A potential Snark may lurk in every tree.


Re: CVS commit: src/sys

2015-08-27 Thread Michael van Elst
On Thu, Aug 27, 2015 at 07:55:39PM +0200, Manuel Bouyer wrote:

  Of course that prevents multiple threads to call diskstart.
 
 does it implies that this prevents multiple outstanding transactions
 to the controller ?

No, it doesn't.

If I understand this correctly, then the old (non-MPSAFE) code is serialized
by KERNEL_LOCK. Only one thread can enter the block device strategy routine
and it will queue a buffer and serially send as many buffers to the
controller as it has openings.

The current code will effectively do the same. But in the MPSAFE case
(currently enabled for ld(4)), there is no KERNEL_LOCK. So multiple threads
can queue buffers in parallel (every queue has an individual lock)
and the controller start routine has another lock for hardware access.
Multiple threads can call the start routine, but for most controllers,
this will be serialized again by the hardware access lock.

My last suggestion would serialize the start routine in the caller
to prevent a race condition.

For most controllers there is no difference wether the serialization
happens in the caller or inside the start routine. But if you have
some hardware with multiple channels that can be accessed in parallel
without locking, or that even requires significant CPU assitance,
the serialization might hurt.
But it won't be worse than the non-MPSAFE case.



Greetings,
-- 
Michael van Elst
Internet: mlel...@serpens.de
A potential Snark may lurk in every tree.


Re: CVS commit: src/sys

2015-08-27 Thread Michael van Elst
On Thu, Aug 27, 2015 at 03:43:52PM +0200, J. Hannken-Illjes wrote:
 
 This was the intention with bufq_peek.  All current bufq strategies
 seem to keep the current buf the same over bufq_peek .. bufq_get
 even if more work comes in via bufq_put.

The whole bufq_peek, use_the_buffer_for_something, bufq_get
sequence, must then run serialized and allow the use part to
recurse into the start routine.

This works fine as is in almost all drivers (dksubr is used by only 3
so far) with KERNEL_LOCK and nestable splbio()/splx() calls.

How do you suggest to do it without?

-- 
Michael van Elst
Internet: mlel...@serpens.de
A potential Snark may lurk in every tree.


Re: CVS commit: src/sys

2015-08-27 Thread Michael van Elst
On Thu, Aug 27, 2015 at 01:26:45PM +0200, Michael van Elst wrote:
 On Thu, Aug 27, 2015 at 11:48:15AM +0200, J. Hannken-Illjes wrote:
 
  Looks racy: what if two threads run  dk_strategy() - dk_start() and
  both get EAGAIN.  Will it leak a buffer when the second thread tries
  to save bp and dksc-sc_deferred already holds the buffer from the
  first thread?
 
 Looks like it. sc_deferred probably needs to become a fcfs bufq.
 Currently this could happen for the ld driver (others are not MP_SAFE).


Maybe just this, a second thread is allowed to queue buffers,
but the loop is again single-threaded.

Of course that prevents multiple threads to call diskstart.


--- sys/dev/dksubr.c27 Aug 2015 05:51:50 -  1.74
+++ sys/dev/dksubr.c27 Aug 2015 17:25:03 -
@@ -301,6 +301,10 @@
if (bp != NULL)
bufq_put(dksc-sc_bufq, bp);
 
+   if (dksc-sc_busy)
+   goto done;
+   dksc-sc_busy = true;
+
/*
 * Peeking at the buffer queue and committing the operation
 * only after success isn't atomic.
@@ -339,6 +343,8 @@
bp = bufq_get(dksc-sc_bufq);
}
 
+   dksc-sc_busy = false;
+done:
mutex_exit(dksc-sc_iolock);
 }




-- 
Michael van Elst
Internet: mlel...@serpens.de
A potential Snark may lurk in every tree.


Re: CVS commit: src/sys

2015-08-27 Thread Michael van Elst
On Thu, Aug 27, 2015 at 04:31:38PM +0200, J. Hannken-Illjes wrote:

 Another approach is to enqueue the buffer from dk_strategy(), use
 dk_start() without bp to notify the device.  The device start
 routine would take buffers from the queue and start them until
 it gets out of resources and the device would call its start
 routine on completion of a request.

This basically drops the idea of a common dksubr and replicates the
code again into all device drivers, leading to the zoo that we already have.


-- 
Michael van Elst
Internet: mlel...@serpens.de
A potential Snark may lurk in every tree.


Re: CVS commit: src/sys

2015-08-27 Thread Michael van Elst
On Thu, Aug 27, 2015 at 11:48:15AM +0200, J. Hannken-Illjes wrote:

 disk_busy(dksc-sc_dkdev);
 +   mutex_exit(dksc-sc_iolock);
 error = dkd-d_diskstart(dksc-sc_dev, bp);
 +   mutex_enter(dksc-sc_iolock);
 if (error == EAGAIN) {
 +   dksc-sc_deferred = bp;
 disk_unbusy(dksc-sc_dkdev, 0, (bp-b_flags  
 B_READ));
 break;
 }
 
 Looks racy: what if two threads run  dk_strategy() - dk_start() and
 both get EAGAIN.  Will it leak a buffer when the second thread tries
 to save bp and dksc-sc_deferred already holds the buffer from the
 first thread?

Looks like it. sc_deferred probably needs to become a fcfs bufq.
Currently this could happen for the ld driver (others are not MP_SAFE).

It would be simpler if you could unget something into the original
bufq.



Greetings,
-- 
Michael van Elst
Internet: mlel...@serpens.de
A potential Snark may lurk in every tree.


Re: CVS commit: src/sys/dev

2015-11-28 Thread Michael van Elst
On Sun, Nov 29, 2015 at 08:10:01AM +1100, matthew green wrote:
> "Michael van Elst" writes:
> > Module Name:src
> > Committed By:   mlelstv
> > Date:   Sat Nov 28 14:45:24 UTC 2015
> > 
> > Modified Files:
> > src/sys/dev: cgd.c
> > 
> > Log Message:
> > Inherit sector size from underlying disk to support disks with
> > sector sizes other than 512 bytes.
> > 
> > The CGD disk image depends on disk geometry as it encodes the block
> > number into each block. You cannot copy an image between disks
> > with different sector sizes.
> 
> could you update cgd.4 with this info?  or perhaps cgdconfig.8?


I had hoped there would be some discussion wether this behaviour
should stay before we document it.



-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CVS commit: src/sys/compat/netbsd32

2016-11-16 Thread Michael van Elst
On Tue, Nov 15, 2016 at 07:44:52PM +0900, Rin Okuyama wrote:
> On 2016/11/15 19:26, Martin Husemann wrote:
> >On Tue, Nov 15, 2016 at 07:23:09PM +0900, Rin Okuyama wrote:
> >>This results in build failure for most ARM environments:
> >>
> >>  http://releng.netbsd.org/builds/HEAD/201611140950Z/
> >>
> >>I think that NTP stuff should be protected by "#ifdef NTP".
> >>Can I commit the attached patch?
> >
> >Sounds good, but don't you need to add #include "opt_ntp.h" to
> >netbsd32_ioctl.c ?
> 
> Thank you so much! I added this. Otherwise, NTP kernel gets
> broken this time...

There is a slight twist.

If NTP isn't defined, the code will call the standard (64bit)
ioctl handler with the assumption that the arg uses the same
layout in 64bit and 32bit mode.

If the ioctl handler is builtin, it won't understand the ioctl either
and everything is fine. But if it is a loaded module, it might be
compiled with different NTP option and so the wrong routine is called.

Fortunately that's just theoretical because the module can't be loaded
when compiled differently (because it references ntp_adjtime). But
that is a different issue and might be solved in the future.

So I suggest to make the compat32 code handle CLOCK_NTP_ADJTIME even
when compiled with !NTP but just return ENOTTY.

N.B. clockctlioctl returns EINVAL for unrecognized ioctl commands,
it should also return ENOTTY.


Greetings,
-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CVS commit: src/sys/compat/netbsd32

2016-11-20 Thread Michael van Elst
On Thu, Nov 17, 2016 at 09:46:09PM +0900, Rin Okuyama wrote:
> On 2016/11/16 18:33, Michael van Elst wrote:
> >So I suggest to make the compat32 code handle CLOCK_NTP_ADJTIME even
> >when compiled with !NTP but just return ENOTTY.
> >
> >N.B. clockctlioctl returns EINVAL for unrecognized ioctl commands,
> >it should also return ENOTTY.
> 
> I wrote a patch. Besides your suggestions, I protected NTP stuff in
> compat50 codes by NTP macro. Is it ok with you?


Looks fine to me.

-- 
    Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CVS commit: src/sys/dev

2017-11-03 Thread Michael van Elst
On Fri, Nov 03, 2017 at 09:22:36AM +0900, Takeshi Nakayama wrote:
> errno 5 is EIO.
> 
> This is why we check WDF_LOADED is not set and !RAW_PART or !S_IFCHR
> in wdopen().  WDF_LOADED is set only in wd_fistopen(), so we cannot
> open disks unless open with RAW_PART and S_IFCHR in the first time.
> 
> Possible fix is remove useless check as follows or introduce
> WDF_OPEN if we want to mimic the sd(4).

Please try

http://ftp.netbsd.org/pub/NetBSD/misc/mlelstv/wd.diff

this is the "introduce WDF_OPEN" that is missing.


Greetings,
-- 
        Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CVS commit: src/sys/sys

2018-04-17 Thread Michael van Elst
On Wed, Apr 18, 2018 at 01:36:23AM +0200, Kamil Rytarowski wrote:

> Looking at other users, everyone except  include
>  in the _KERNEL namespace.

It defines internal kernel data structures. Normal programs must
not see it, that's why it was hidden and finally all uses were removed
from userland, so it only exists in _KERNEL namespace.

But crash(8) is a hybrid, because it is mostly ddb code compiled for
userland.

Anyway, I think sys/pmf.h is only included for the declaration of
pmf_qual_t and that is only used for some function declarations that
are for _KERNEL only. Can you please try:

Index: sys/device.h
===
RCS file: /cvsroot/src/sys/sys/device.h,v
retrieving revision 1.151
diff -p -u -r1.151 device.h
--- sys/device.h4 Mar 2018 07:13:11 -   1.151
+++ sys/device.h18 Apr 2018 04:53:14 -
@@ -84,6 +84,9 @@
 #if defined(_KERNEL) || defined(_KMEMUSER)
 #include 
 #include 
+#endif
+
+#if defined(_KERNEL)
 #include 
 #endif

I'm verifying against a regular build.


Greetings,
-- 
    Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CVS commit: src/sys/sys

2018-04-17 Thread Michael van Elst
On Wed, Apr 18, 2018 at 07:09:34AM +0200, Kamil Rytarowski wrote:

> > Anyway, I think sys/pmf.h is only included for the declaration of
> > pmf_qual_t and that is only used for some function declarations that
> > are for _KERNEL only. Can you please try:


Maybe this:

Index: sys/device.h
===
RCS file: /cvsroot/src/sys/sys/device.h,v
retrieving revision 1.151
diff -p -u -r1.151 device.h
--- sys/device.h4 Mar 2018 07:13:11 -   1.151
+++ sys/device.h18 Apr 2018 05:17:44 -
@@ -84,7 +84,13 @@
 #if defined(_KERNEL) || defined(_KMEMUSER)
 #include 
 #include 
+#endif
+
+#if defined(_KERNEL)
 #include 
+#else if defined(_KMEMUSER) && !defined(_SYS_PMF_H)
+struct pmf_qual;
+typedef struct pmf_qual pmf_qual_t;
 #endif
 
 #include 


Ugly and needs further discussion, but the alternative of moving sys/pmf.h
into userland is probably worse.


Greetings,
-- 
            Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CVS commit: src/sys/sys

2018-04-18 Thread Michael van Elst
On Wed, Apr 18, 2018 at 07:51:01AM +0200, Kamil Rytarowski wrote:
> 
> OK, so assuming that  shall not be exposed to userland - I
> propose this patch:
> 
> http://netbsd.org/~kamil/patch-00047-pmf_h.txt

It's all gross

Exposing sys/pmf.h to userland is probably necessary.


Greetings,
-- 
            Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CVS commit: src/sys/sys

2018-04-17 Thread Michael van Elst
On Tue, Apr 17, 2018 at 05:45:13PM +0200, Kamil Rytarowski wrote:
> On 04.03.2018 08:13, Michael van Elst wrote:
> > Module Name:src
> > Committed By:   mlelstv
> > Date:   Sun Mar  4 07:13:11 UTC 2018
> > 
> > Modified Files:
> > src/sys/sys: device.h
> > 
> > Log Message:
> > Expose device structures to _KMEMUSER
> > 
> > 
> 
> This broke building device.h with _KMEMUSER.
> 
> > @@ -81,7 +81,7 @@
> >  #include 
> >  #include 
> >  
> > -#ifdef _KERNEL
> > +#if defined(_KERNEL) || defined(_KMEMUSER)
> >  #include 
> >  #include 
> >  #include 
> 
> The sys/pmf.h header is not accessible from userland.

True.

What program includes device.h as _KMEMUSER but crash(8) ? There
shouldn't be any.

crash helps itself by including system headers, but that's probably
not a good recipe for everyone.



Greetings,
-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CVS commit: src/sys/dev/scsipi

2018-03-24 Thread Michael van Elst
On Sat, Mar 24, 2018 at 02:50:05AM +0100, Kamil Rytarowski wrote:

> I had to revert this in order to unbreak build.


Please never do that.



-- 
    Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CVS commit: src/sys/kern

2018-10-27 Thread Michael van Elst
On Sat, Oct 27, 2018 at 09:41:17AM +, m...@netbsd.org wrote:
> >  * file.
> >  */
> > if ((error = (*so->so_send)(so, mtod(m_serv, struct sockaddr *), NULL,
> > -   m_outbuf, NULL, 0, l)) != 0)
> > +   m_outbuf, NULL, 0, l)) != 0) {
> > DPRINTF(("%s():%d tftproot: sosend returned %d\n", 
> > __func__, __LINE__, error));
> > +   }
> >  
> > /* Freed by the protocol */
> > m_outbuf = NULL;
> > 
> 
> Looks like a significant functional change, possibly even worth pulling
> up?  (We should probably clean up #define DPRINTF(x) /* empty */)


The TFTPROOT option isn't enabled anywhere and didn't compile. So
pulling up now is a bit premature.



Greetings,
-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CVS commit: src/sys/kern

2019-01-10 Thread Michael van Elst
On Thu, Jan 10, 2019 at 05:50:30PM +0100, Christoph Badura wrote:
> 
> If you hadn't reversed the order of
> 
> tftproot_dhcpboot()
> if (md_is_root) ...
> rootspec = bootspec
> 
> that would wouldn't have need fixing because tftproot_dhcpboot() sets
> md_is_root.

It needed fixing because:

- md0 doesn't exist before it is opened for the first time.
- that's one reason why setting rootspec didn't work as intendend


> Why was the order reversed anyway?  Can you please explain?

It's not about the order but about separating different cases.
The setroot code is riddled with side effects.


> Can you also please respond to the review remarks?

I asked you for a review, it never appeared.


> And what about the timing?  Can you please explain what exactly the
> idea was to jump in, make these changes, and rush in after you noticed
> someone else was working on that code?  That seemed pretty rude to me.
> These changes don't look like they were particularly urgent.
> 
> I ask you to kindly refrain from making uncoordinated changes to code that
> other people are working on.

I am working on this since a few months and committed it now before the branch
to -9 after asking (several times) for a review.



Greetings,
-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CVS commit: src/sys/kern

2019-01-12 Thread Michael van Elst
On Fri, Jan 11, 2019 at 08:22:23PM +0100, Christoph Badura wrote:
> 
> What exactly did your change do to improve the awareness of these side
> effects?  I'm at a loss when it comes to that.

You noticed that some side effects were already removed.


> Here's more defects and functionality changes:
> 
> - The old code did "if (md_is_root) configure md0 as root or panic".  Now
>   it does something different.

Yes, it no longer panics. Fine with me.


> - The old code did "if (tftproot_dhcpboot(bootdv) != 0) boothowto |= 
> RB_ASKNAME;".
>   Now it does something different.  It isn't even guaranteed that
>   RB_ASKNAME gets set, because bootdv is likely not null.

The tftp code is a weird hack, abusing part of the the INSTALL kernel
(== md0) handling and the NFS root handling. So the intention was
to ensure that TFTP booting still works while the code is rewritten.


> - tftproot_dhcpboot() returning 0 does not always indicate that the
>   memory disk was successfully initialized.  md_is_root being set, however,
>   reliably does.  Now md0 is configured anyway.

So your complaint is that I didn't yet fix a bug in the tftpboot code.


> - The order *does* matter, because the first thing tftproot_dhcpboot()
>   does is check for rootspec != NULL.  In the old code rootspec should
>   only have been set by config(8).  Now it can be overridden by bootspec.
>   Another functional change.

It can obviously be overriden by bootspec, that's what bootspec is supposed
to do. It lets the bootloader and thus the user specify a root device without
recompiling a kernel.


> - Overriding rootspec with bootspec doesn't obey the necessary protocol.
>   See my message to tech-kern from yesterday.  (This one is old, though.)

There is no 'protocol'. I'm moving it into something more structured,
that you may call 'protocol' at some point in the future.


> I'm getting the impression, that you do not understand the code very well.

The code is a conglomerate of various hacks and ad-hoc decisions that
always caused problems. See exactly your problem with the raidframe
root hack.


> You asked me privately to review a file for you with no indication
> whatsoever that there was any urgency to it or that you wanted to commit
> soon.  Nevertheless I made time that same day to review it, but ran out of
> time to write it up for you.  You didn't come back to me before
> committing, so I commented publically.
> https://mail-index.netbsd.org/source-changes-d/2019/01/05/msg010893.html

So there was no review and at the same time you accuse me of not
answering your review.


> Anyway, what was the urgency?  Were you somehow under the impression that
> the branch was taking place last weekend and you had to rush these
> poorly tested and poorly understood changes in without you having the time to
> contact the private reviewer about the status?

There is no urgency, there is a requirement that the code is seen and
used by others.




Greetings,
-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CVS commit: src/sys/dev/usb

2019-01-24 Thread Michael van Elst
On Thu, Jan 24, 2019 at 03:51:02PM +0100, Robert Swindells wrote:
> "Michael van Elst"  wrote:
> > Module Name:src
> > Committed By:   mlelstv
> > Date:   Sat Jan  5 07:56:07 UTC 2019
> > 
> > Modified Files:
> >src/sys/dev/usb: if_mue.c if_muevar.h
> > 
> > Log Message:
> > Enable multiple outstanding transfers.
> > 
> > iperf3 now shows 250MBit/s for sending and 225MBit/s for receiving.
> 
> Which device was this tested on ?
> 
> It doesn't work at all for me on a LAN7500.

Tested on an RPI3b+ which is LAN7800.

But I now see some inconsistent performance for receiving.

Example: client is netbsd-8/i386 re0, server is RPI3b+

% iperf3 -c jowlson 

[  6] local 10.28.5.2 port 54509 connected to 10.28.5.23 port 5201
[ ID] Interval   Transfer Bandwidth   Retr  Cwnd
[  6]   0.00-1.00   sec  12.8 MBytes   107 Mbits/sec0   55.1 KBytes   
[  6]   1.00-2.00   sec  23.7 MBytes   199 Mbits/sec0   28.3 KBytes   
[  6]   2.00-3.00   sec  25.7 MBytes   216 Mbits/sec0   41.0 KBytes   
[  6]   3.00-4.00   sec  25.6 MBytes   215 Mbits/sec0   28.3 KBytes   
[  6]   4.00-5.00   sec  25.7 MBytes   215 Mbits/sec0   52.3 KBytes   
[  6]   5.00-6.00   sec  25.6 MBytes   214 Mbits/sec0   46.7 KBytes   
[  6]   6.00-7.00   sec  25.6 MBytes   215 Mbits/sec0   53.7 KBytes   
[  6]   7.00-8.00   sec  25.7 MBytes   215 Mbits/sec0   31.1 KBytes   
[  6]   8.00-9.00   sec  25.6 MBytes   215 Mbits/sec0   31.1 KBytes   
[  6]   9.00-10.00  sec  25.7 MBytes   215 Mbits/sec0   38.2 KBytes   
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval   Transfer Bandwidth   Retr
[  6]   0.00-10.00  sec   242 MBytes   203 Mbits/sec0 sender
[  6]   0.00-10.00  sec   241 MBytes   202 Mbits/sec  receiver

Example2: client is netbsd-7/amd64 wm0

Connecting to host jowlson, port 5201
[  6] local 10.28.5.19 port 64879 connected to 10.28.5.23 port 5201
[ ID] Interval   Transfer Bandwidth   Retr  Cwnd
[  6]   0.00-1.00   sec  14.3 MBytes   120 Mbits/sec0   2.83 KBytes   
[  6]   1.00-2.01   sec  12.1 MBytes  99.9 Mbits/sec0   2.83 KBytes   
[  6]   2.01-3.00   sec  4.82 MBytes  41.0 Mbits/sec1   41.0 KBytes   
[  6]   3.00-4.00   sec  17.5 MBytes   147 Mbits/sec0   29.7 KBytes   
[  6]   4.00-5.00   sec  2.23 MBytes  18.6 Mbits/sec0   2.83 KBytes   
[  6]   5.00-6.01   sec  8.12 MBytes  68.0 Mbits/sec1   2.83 KBytes   
[  6]   6.01-7.00   sec  2.89 MBytes  24.4 Mbits/sec1   24.0 KBytes   
[  6]   7.00-8.01   sec  6.67 MBytes  55.5 Mbits/sec0   1.41 KBytes   
[  6]   8.01-9.00   sec  7.06 MBytes  59.7 Mbits/sec4   4.24 KBytes   
[  6]   9.00-10.01  sec  6.43 MBytes  53.4 Mbits/sec0   2.83 KBytes   
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval   Transfer Bandwidth   Retr
[  6]   0.00-10.01  sec  82.1 MBytes  68.8 Mbits/sec7 sender
[  6]   0.00-10.01  sec  82.0 MBytes  68.7 Mbits/sec  receiver

notice the Retr column, somewhere packets get lost.

The reverse direction (-R) is fine in both setups.


Greetings,
-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CVS commit: src/sys/ufs/ufs

2019-02-24 Thread Michael van Elst
On Sun, Feb 24, 2019 at 10:13:40PM +0100, Tobias Nygren wrote:
> On Sun, 24 Feb 2019 19:06:40 +
> Michael van Elst  wrote:
> 
> > To generate a diff of this commit:
> > cvs rdiff -u -r1.242 -r1.243 src/sys/ufs/ufs/ufs_vnops.c
> 
> > +   rawbuf -= dropend;
> 
> I guess this should be rawbufmax, not rawbuf.

Yes, already fixed.

-- 
        Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CVS commit: src/sys/dev/usb

2019-02-07 Thread Michael van Elst
On Fri, Feb 08, 2019 at 07:12:28AM +0900, Rin Okuyama wrote:
> Hi,
> 
> What compiler options (or version, architecture, etc.) do you use?
> I want to enable that warnings, but I cannot even with WARNS=5.

The warnings came for assertions, so you need to build with DIAGNOSTIC,
which is default for all archs.

Greetings,
-- 
        Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CVS commit: src/sys/dev/usb

2019-02-07 Thread Michael van Elst
On Fri, Feb 08, 2019 at 07:12:28AM +0900, Rin Okuyama wrote:
> Hi,
> 
> What compiler options (or version, architecture, etc.) do you use?

That was just default settings for amd64 (and same for evbarm).

> I want to enable that warnings, but I cannot even with WARNS=5.

I suspect most warnings are automatically enabled when building a
release, but not when only building a kernel.


Greetings,
-- 
        Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CVS commit: src/sys/dev/usb

2019-02-09 Thread Michael van Elst
On Sat, Feb 09, 2019 at 05:15:51PM +0900, Rin Okuyama wrote:
> On 2019/02/08 7:51, Michael van Elst wrote:
> > On Fri, Feb 08, 2019 at 07:12:28AM +0900, Rin Okuyama wrote:
> > > Hi,
> > > 
> > > What compiler options (or version, architecture, etc.) do you use?
> > > I want to enable that warnings, but I cannot even with WARNS=5.
> > 
> > The warnings came for assertions, so you need to build with DIAGNOSTIC,
> > which is default for all archs.
> 
> Ah, thanks. That's why WARN=5 build passes for modules.

And that's why I see it for modules:

Index: sys/modules/Makefile.inc
===
RCS file: /cvsroot/src/sys/modules/Makefile.inc,v
retrieving revision 1.6
diff -p -u -r1.6 Makefile.inc
--- sys/modules/Makefile.inc11 Sep 2011 18:38:02 -  1.6
+++ sys/modules/Makefile.inc9 Feb 2019 10:53:03 -
@@ -1,7 +1,7 @@
 #  $NetBSD: Makefile.inc,v 1.6 2011/09/11 18:38:02 mbalmer Exp $
 
 S!=cd ${.PARSEDIR}/..;pwd
-CPPFLAGS+= -I${NETBSDSRCDIR}/common/include
+CPPFLAGS+= -I${NETBSDSRCDIR}/common/include -DDIAGNOSTIC
 USE_FORT=  no
 WARNS?=        3


Greetings,
-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CVS commit: src/sys/dev/usb

2019-02-09 Thread Michael van Elst
On Sat, Feb 09, 2019 at 05:18:13PM +0900, Rin Okuyama wrote:
> Hi,
> 
> On 2019/02/08 23:16, sc dying wrote:
> > xhci_device_bulk_abort() at netbsd:xhci_device_bulk_abort+0x1c
> > usbd_ar_pipe() at netbsd:usbd_ar_pipe+0x1e9
> > usbd_abort_pipe() at netbsd:usbd_abort_pipe+0x27
> > axen_stop() at netbsd:axen_stop+0xc4

> Can you tell me how to reproduce this failure?
> "ifconfig down" works for me on RPI3B+.

this could be an issue with the xhci code.


Greetings,
-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CVS commit: src/sys/dev/usb

2019-01-30 Thread Michael van Elst
On Wed, Jan 30, 2019 at 08:05:56PM +0900, Rin Okuyama wrote:
> 
> I tested a StarTech USB21000S2 adapter. It works both on RPI3B and
> amd64 box with ehci(4) (ThinkPad X60). Revision is same as Z-TEK
> ZE582; both have product ID of 0x7500 (LAN7500).
> 
> There may be problem with the host controller?

pinebook uses ehci too.

Do multiple outstanding requests show an advantage on your LAN7500
devices?


Greetings,
-- 
            Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CVS commit: src/sys/dev/usb

2019-01-31 Thread Michael van Elst
On Thu, Jan 31, 2019 at 02:51:44PM +0900, Rin Okuyama wrote:
> On 2019/01/30 21:26, Michael van Elst wrote:
> > Do multiple outstanding requests show an advantage on your LAN7500
> > devices?
> 
> Yes. There is significant improvement in receiving performance.

Then lets see if the chip revision makes a difference, I'll prepare
a patch.


> By the way, I find that the system hangs silently by
> "ifconfig mueN down" or detaching LAN7500 from USB port when
> multiple outstanding requests are enabled. This does not occur
> when MUE_TX_LIST_CNT = MUE_RX_LIST_CNT = 1. Do you have any ideas
> to fix it?

ifconfig down calls mue_stop() which call mue_reset() but which is
a dummy (the call to mue_chip_init is commented out). It should still
abort the transfers which should be enough.

The RPI3 (LAN7800) doesn't have this problem.


Greetings,
-- 
    Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CVS commit: src/sys/dev/usb

2019-01-28 Thread Michael van Elst
On Mon, Jan 28, 2019 at 06:31:01PM +0900, Rin Okuyama wrote:
> Hi,
> 
> On 2019/01/25 4:18, Michael van Elst wrote:
> > On Thu, Jan 24, 2019 at 03:51:02PM +0100, Robert Swindells wrote:
> > > It doesn't work at all for me on a LAN7500.
> > Tested on an RPI3b+ which is LAN7800.

> It works for me with LAN7500 (Z-TEK ZE582) on RPI3B+ and amd64 boxes.
> Could you please describe more in details how it fails?

According to Robert it fails completely and even stalls the USB stack.
He's using a Startech USB2.0 Ethernet adapter with a pinebook.


> > notice the Retr column, somewhere packets get lost.
> > The reverse direction (-R) is fine in both setups.
> 
> Hmm, similar problem occurs for me with LAN7800 and LAN7500
> when client is

I haven't found where the packets get lost. Since it happends for
the 'faster' senders, it's probably dropping packets on receive,
but I don't see any errors reported by the driver.



Greetings,
-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


CVS commit: src/sys/dev/scsipi

2019-05-26 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun May 26 08:12:41 UTC 2019

Modified Files:
src/sys/dev/scsipi: scsipi_ioctl.c

Log Message:
Add sanity checks to SCIOCCOMMAND, adapter drivers might be confused or trigger
assertions (e.g. umass).


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/scsipi/scsipi_ioctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/scsipi/scsipi_ioctl.c
diff -u src/sys/dev/scsipi/scsipi_ioctl.c:1.70 src/sys/dev/scsipi/scsipi_ioctl.c:1.71
--- src/sys/dev/scsipi/scsipi_ioctl.c:1.70	Mon Sep  3 16:29:33 2018
+++ src/sys/dev/scsipi/scsipi_ioctl.c	Sun May 26 08:12:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsipi_ioctl.c,v 1.70 2018/09/03 16:29:33 riastradh Exp $	*/
+/*	$NetBSD: scsipi_ioctl.c,v 1.71 2019/05/26 08:12:41 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scsipi_ioctl.c,v 1.70 2018/09/03 16:29:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsipi_ioctl.c,v 1.71 2019/05/26 08:12:41 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_freebsd.h"
@@ -328,10 +328,18 @@ scsipi_do_ioctl(struct scsipi_periph *pe
 		struct scsi_ioctl *si;
 		int len;
 
+		len = screq->datalen;
+
+		/*
+		 * If there is data, there must be a data buffer and a direction specified
+		 */
+		if (len > 0 && (screq->databuf == NULL ||
+		(screq->flags & (SCCMD_READ|SCCMD_WRITE)) == 0))
+			return (EINVAL);
+
 		si = si_get();
 		si->si_screq = *screq;
 		si->si_periph = periph;
-		len = screq->datalen;
 		if (len) {
 			si->si_iov.iov_base = screq->databuf;
 			si->si_iov.iov_len = len;



CVS commit: src/sys/dev/scsipi

2019-05-26 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun May 26 08:12:41 UTC 2019

Modified Files:
src/sys/dev/scsipi: scsipi_ioctl.c

Log Message:
Add sanity checks to SCIOCCOMMAND, adapter drivers might be confused or trigger
assertions (e.g. umass).


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/scsipi/scsipi_ioctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/usb

2019-05-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun May 26 04:52:07 UTC 2019

Modified Files:
src/sys/dev/usb: if_mue.c if_muevar.h

Log Message:
usbd_transfer may sleep, add a mutex to prevent a race in mue_start.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/usb/if_mue.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/if_muevar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/if_mue.c
diff -u src/sys/dev/usb/if_mue.c:1.45 src/sys/dev/usb/if_mue.c:1.46
--- src/sys/dev/usb/if_mue.c:1.45	Thu May 23 13:10:52 2019
+++ src/sys/dev/usb/if_mue.c	Sun May 26 04:52:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mue.c,v 1.45 2019/05/23 13:10:52 msaitoh Exp $	*/
+/*	$NetBSD: if_mue.c,v 1.46 2019/05/26 04:52:07 mlelstv Exp $	*/
 /*	$OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $	*/
 
 /*
@@ -20,7 +20,7 @@
 /* Driver for Microchip LAN7500/LAN7800 chipsets. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.45 2019/05/23 13:10:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.46 2019/05/26 04:52:07 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -958,6 +958,7 @@ mue_attach(device_t parent, device_t sel
 		sc->mue_tx_list_cnt = MUE_TX_LIST_CNT;
 	}
 	sc->mue_txbufsz = MUE_TX_BUFSIZE;
+	mutex_init(>mue_usb_lock, MUTEX_DEFAULT, IPL_NET);
 
 	/* Find endpoints. */
 	id = usbd_get_interface_descriptor(sc->mue_iface);
@@ -1819,6 +1820,8 @@ mue_start(struct ifnet *ifp)
 		return;
 	}
 
+	mutex_enter(>mue_usb_lock);
+
 	idx = cd->mue_tx_prod;
 	while (cd->mue_tx_cnt < (int)sc->mue_tx_list_cnt) {
 		IFQ_POLL(>if_snd, m);
@@ -1834,15 +1837,16 @@ mue_start(struct ifnet *ifp)
 		bpf_mtap(ifp, m, BPF_D_OUT);
 		m_freem(m);
 
-		idx = (idx + 1) % sc->mue_tx_list_cnt;
 		cd->mue_tx_cnt++;
-
+		idx = (idx + 1) % sc->mue_tx_list_cnt;
 	}
 	cd->mue_tx_prod = idx;
 
 	if (cd->mue_tx_cnt >= (int)sc->mue_tx_list_cnt)
 		ifp->if_flags |= IFF_OACTIVE;
 
+	mutex_exit(>mue_usb_lock);
+
 	/* Set a timeout in case the chip goes out to lunch. */
 	ifp->if_timer = 5;
 }

Index: src/sys/dev/usb/if_muevar.h
diff -u src/sys/dev/usb/if_muevar.h:1.7 src/sys/dev/usb/if_muevar.h:1.8
--- src/sys/dev/usb/if_muevar.h:1.7	Wed Feb  6 08:28:11 2019
+++ src/sys/dev/usb/if_muevar.h	Sun May 26 04:52:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_muevar.h,v 1.7 2019/02/06 08:28:11 rin Exp $	*/
+/*	$NetBSD: if_muevar.h,v 1.8 2019/05/26 04:52:07 mlelstv Exp $	*/
 /*	$OpenBSD: if_muereg.h,v 1.1 2018/08/03 01:50:15 kevlo Exp $	*/
 
 /*
@@ -121,6 +121,8 @@ struct mue_softc {
 
 	unsigned		mue_rx_list_cnt;
 	unsigned		mue_tx_list_cnt;
+
+	kmutex_t		mue_usb_lock;
 };
 
 #endif /* _IF_MUEVAR_H_ */



CVS commit: src/sys/dev/usb

2019-05-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun May 26 04:52:07 UTC 2019

Modified Files:
src/sys/dev/usb: if_mue.c if_muevar.h

Log Message:
usbd_transfer may sleep, add a mutex to prevent a race in mue_start.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/usb/if_mue.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/if_muevar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/usb

2019-05-26 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun May 26 17:48:47 UTC 2019

Modified Files:
src/sys/dev/usb: if_mue.c

Log Message:
Also destroy the mutex. Thanks chs@ for noticing.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/usb/if_mue.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/usb

2019-05-26 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun May 26 17:48:47 UTC 2019

Modified Files:
src/sys/dev/usb: if_mue.c

Log Message:
Also destroy the mutex. Thanks chs@ for noticing.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/usb/if_mue.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/if_mue.c
diff -u src/sys/dev/usb/if_mue.c:1.46 src/sys/dev/usb/if_mue.c:1.47
--- src/sys/dev/usb/if_mue.c:1.46	Sun May 26 04:52:07 2019
+++ src/sys/dev/usb/if_mue.c	Sun May 26 17:48:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mue.c,v 1.46 2019/05/26 04:52:07 mlelstv Exp $	*/
+/*	$NetBSD: if_mue.c,v 1.47 2019/05/26 17:48:47 mlelstv Exp $	*/
 /*	$OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $	*/
 
 /*
@@ -20,7 +20,7 @@
 /* Driver for Microchip LAN7500/LAN7800 chipsets. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.46 2019/05/26 04:52:07 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.47 2019/05/26 17:48:47 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1113,6 +1113,7 @@ mue_detach(device_t self, int flags)
 	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->mue_udev, sc->mue_dev);
 
 	mutex_destroy(>mue_mii_lock);
+	mutex_destroy(>mue_usb_lock);
 
 	return 0;
 }



CVS commit: src/sbin/atactl

2019-05-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri May 31 05:47:22 UTC 2019

Modified Files:
src/sbin/atactl: atactl.8

Log Message:
Mention SATL support.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sbin/atactl/atactl.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sbin/atactl

2019-05-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri May 31 05:47:22 UTC 2019

Modified Files:
src/sbin/atactl: atactl.8

Log Message:
Mention SATL support.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sbin/atactl/atactl.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/atactl/atactl.8
diff -u src/sbin/atactl/atactl.8:1.29 src/sbin/atactl/atactl.8:1.30
--- src/sbin/atactl/atactl.8:1.29	Sun Mar  3 04:51:57 2019
+++ src/sbin/atactl/atactl.8	Fri May 31 05:47:22 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: atactl.8,v 1.29 2019/03/03 04:51:57 mrg Exp $
+.\"	$NetBSD: atactl.8,v 1.30 2019/05/31 05:47:22 mlelstv Exp $
 .\"
 .\" Copyright (c) 1998, 2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -48,6 +48,10 @@ control devices which reside on standard
 the ATA bus itself.
 It is used by specifying a device or bus to manipulate,
 the command to perform, and any arguments the command may require.
+.Pp
+You may also control devices which are inside a SCSI enclosure, this
+includes many USB disks. In this case ATA commands are passed through
+the SCSI layer using SATL commands.
 .Sh DEVICE COMMANDS
 The following commands may be used on IDE and ATA devices.
 Note that not all devices support all commands.
@@ -279,6 +283,8 @@ command written by
 significantly enhanced the
 .Cm smart status
 support.
+.An Michael van Elst
+added support for SATL.
 .Sh BUGS
 The output from the
 .Cm identify
@@ -295,3 +301,5 @@ The
 .Cm smart status
 command currently guesses the vendor attribute name table to use,
 and may be wrong or miss supported devices.
+.Pp
+SATL bus commands don't work yet.



CVS commit: src/sys/dev/usb

2019-05-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu May 30 21:44:50 UTC 2019

Modified Files:
src/sys/dev/usb: umass_scsipi.c

Log Message:
ATA passthrough commands, supported by many SPC-2 disks, require more
sense data.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/usb/umass_scsipi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/umass_scsipi.c
diff -u src/sys/dev/usb/umass_scsipi.c:1.61 src/sys/dev/usb/umass_scsipi.c:1.62
--- src/sys/dev/usb/umass_scsipi.c:1.61	Thu Mar 28 10:44:29 2019
+++ src/sys/dev/usb/umass_scsipi.c	Thu May 30 21:44:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass_scsipi.c,v 1.61 2019/03/28 10:44:29 kardel Exp $	*/
+/*	$NetBSD: umass_scsipi.c,v 1.62 2019/05/30 21:44:49 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 2001, 2003, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.61 2019/03/28 10:44:29 kardel Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.62 2019/05/30 21:44:49 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -458,7 +458,7 @@ umass_scsipi_cb(struct umass_softc *sc, 
 			cmdlen = UFI_COMMAND_LENGTH;	/* XXX */
 		else
 			cmdlen = sizeof(scbus->sc_sense_cmd);
-		if (periph->periph_version < 0x05) /* SPC-3 */
+		if (periph->periph_version < 0x04) /* SPC-2 */
 			senselen = 18;
 		else
 			senselen = sizeof(xs->sense);
@@ -498,6 +498,7 @@ umass_scsipi_sense_cb(struct umass_softc
 {
 	UMASSHIST_FUNC(); UMASSHIST_CALLED();
 	struct scsipi_xfer *xs = priv;
+	size_t extra;
 
 	DPRINTFM(UDMASS_CMD, "sc %#jx: xs=%#jx residue=%jd status=%jd",
 	(uintptr_t)sc, (uintptr_t)xs, residue, status);
@@ -507,7 +508,9 @@ umass_scsipi_sense_cb(struct umass_softc
 	case STATUS_CMD_OK:
 	case STATUS_CMD_UNKNOWN:
 		/* getting sense data succeeded */
-		if (residue == 0 || residue == 14)/* XXX */
+		extra = sizeof(xs->sense.scsi_sense)
+		  - sizeof(xs->sense.scsi_sense.extra_bytes);
+		if (residue <= extra)
 			xs->error = XS_SENSE;
 		else
 			xs->error = XS_SHORTSENSE;



CVS commit: src/sys/dev/usb

2019-05-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu May 30 21:44:50 UTC 2019

Modified Files:
src/sys/dev/usb: umass_scsipi.c

Log Message:
ATA passthrough commands, supported by many SPC-2 disks, require more
sense data.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/usb/umass_scsipi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sbin/atactl

2019-05-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu May 30 21:32:08 UTC 2019

Modified Files:
src/sbin/atactl: atactl.c

Log Message:
Add support for ATA command pass-through to SCSI devices.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sbin/atactl/atactl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sbin/atactl

2019-05-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu May 30 21:32:08 UTC 2019

Modified Files:
src/sbin/atactl: atactl.c

Log Message:
Add support for ATA command pass-through to SCSI devices.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sbin/atactl/atactl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/atactl/atactl.c
diff -u src/sbin/atactl/atactl.c:1.82 src/sbin/atactl/atactl.c:1.83
--- src/sbin/atactl/atactl.c:1.82	Sun Mar  3 04:51:57 2019
+++ src/sbin/atactl/atactl.c	Thu May 30 21:32:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: atactl.c,v 1.82 2019/03/03 04:51:57 mrg Exp $	*/
+/*	$NetBSD: atactl.c,v 1.83 2019/05/30 21:32:08 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2019 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: atactl.c,v 1.82 2019/03/03 04:51:57 mrg Exp $");
+__RCSID("$NetBSD: atactl.c,v 1.83 2019/05/30 21:32:08 mlelstv Exp $");
 #endif
 
 
@@ -54,6 +54,9 @@ __RCSID("$NetBSD: atactl.c,v 1.82 2019/0
 #include 
 #include 
 
+#include 
+#include 
+
 struct ata_smart_error {
 	struct {
 		uint8_t device_control;
@@ -90,6 +93,53 @@ struct ata_smart_errorlog {
 	uint8_t			checksum;
 } __packed;
 
+#define SCSI_ATA_PASS_THROUGH_16	0x85
+struct scsi_ata_pass_through_16 {
+	uint8_t			opcode;
+	uint8_t			byte2;
+#define SATL_NODATA	0x06
+#define SATL_PIO_IN	0x08
+#define SATL_PIO_OUT	0x0a
+#define	SATL_EXTEND	0x01
+	uint8_t			byte3;
+#define SATL_CKCOND	0x20
+#define SATL_READ	0x08
+#define SATL_BLOCKS	0x04
+#define SATL_LEN(x)	((x) & 0x03)
+	uint8_t			features[2];
+	uint8_t			sector_count[2];
+	uint8_t			lba[6];
+	uint8_t			device;
+	uint8_t			ata_cmd;
+	uint8_t			control;
+} __packed;
+
+#define SCSI_ATA_PASS_THROUGH_12	0xa1
+struct scsi_ata_pass_through_12 {
+	uint8_t			opcode;
+	uint8_t			byte2;
+	uint8_t			byte3;
+	uint8_t			features[1];
+	uint8_t			sector_count[1];
+	uint8_t			lba[3];
+	uint8_t			device;
+	uint8_t			ata_cmd;
+	uint8_t			reserved;
+	uint8_t			control;
+} __packed;
+
+struct scsi_ata_return_descriptor {
+	uint8_t			descr;
+#define SCSI_ATA_RETURN_DESCRIPTOR	9
+	uint8_t			additional_length;
+	uint8_t			extend;
+	uint8_t			error;
+	uint8_t			sector_count[2];
+	uint8_t			lba[6];
+	uint8_t			device;
+	uint8_t			status;
+} __packed;
+
 struct command {
 	const char *cmd_name;
 	const char *arg_names;
@@ -103,6 +153,8 @@ struct bitinfo {
 
 __dead static void	usage(void);
 static void	ata_command(struct atareq *);
+static int	satl_command(struct atareq *, int);
+static const uint8_t *satl_return_desc(const uint8_t *, size_t, uint8_t);
 static void	print_bitinfo(const char *, const char *, u_int,
 const struct bitinfo *);
 static void	print_bitinfo2(const char *, const char *, u_int, u_int,
@@ -119,6 +171,7 @@ static void	fillataparams(void);
 static int	is_smart(void);
 
 static int	fd;/* file descriptor for device */
+static int	use_satl;			/* tunnel through SATL */
 static const	char *dvname;			/* device name */
 static char	dvname_store[MAXPATHLEN];	/* for opendisk(3) */
 static const	char *cmdname;			/* command user issued */
@@ -531,10 +584,25 @@ ata_command(struct atareq *req)
 {
 	int error;
 
-	error = ioctl(fd, ATAIOCCOMMAND, req);
-
-	if (error == -1)
-		err(1, "ATAIOCCOMMAND failed");
+	switch (use_satl) {
+	case 0:
+		error = ioctl(fd, ATAIOCCOMMAND, req);
+		if (error == 0)
+			break;
+		if (errno != ENOTTY)
+			err(1, "ATAIOCCOMMAND failed");
+		use_satl = 1;
+		/* FALLTHROUGH */
+	case 1:
+		error = satl_command(req, 16);
+		if (error == 0)
+			return;
+		use_satl = 2;
+		/* FALLTHROUGH */
+	case 2:
+		(void) satl_command(req, 12);
+		return;
+	}
 
 	switch (req->retsts) {
 
@@ -562,6 +630,191 @@ ata_command(struct atareq *req)
 }
 
 /*
+ * Wrapper that calls SCIOCCOMMAND for a tunneled ATA command
+ */
+static int
+satl_command(struct atareq *req, int cmdlen)
+{
+	scsireq_t sreq;
+	int error;
+	union {
+		struct scsi_ata_pass_through_12 cmd12;
+		struct scsi_ata_pass_through_16 cmd16;
+	} c;
+	uint8_t b2, b3;
+	const uint8_t *desc;
+
+	b2 = SATL_NODATA;
+	if (req->datalen > 0) {
+		if (req->flags & ATACMD_READ)
+			b2 = SATL_PIO_IN;
+		else
+			b2 = SATL_PIO_OUT;
+	}
+
+	b3 = SATL_BLOCKS;
+	if (req->datalen > 0) {
+		b3 |= 2; /* sector count holds count */
+	} else {
+		b3 |= SATL_CKCOND;
+	}
+	if (req->datalen == 0 || req->flags & ATACMD_READ)
+		b3 |= SATL_READ;
+
+	switch (cmdlen) {
+	case 16:
+		c.cmd16.opcode = SCSI_ATA_PASS_THROUGH_16;
+		c.cmd16.byte2 = b2;
+		c.cmd16.byte3 = b3;
+		c.cmd16.features[0] = 0;
+		c.cmd16.features[1] = req->features;
+		c.cmd16.sector_count[0] = 0;
+		c.cmd16.sector_count[1] = req->sec_count;
+		c.cmd16.lba[0] = 0;
+		c.cmd16.lba[1] = req->sec_num;
+		c.cmd16.lba[2] = 0;
+		c.cmd16.lba[3] = req->cylinder;
+		c.cmd16.lba[4] = 0;
+		c.cmd16.lba[5] = req->cylinder >> 8;
+		c.cmd16.device = 0;
+		c.cmd16.ata_cmd = req->command;
+		c.cmd16.control = 0;

CVS commit: xsrc/external/mit/xdm/dist/greeter

2019-06-06 Thread Michael van Elst
Module Name:xsrc
Committed By:   mlelstv
Date:   Fri Jun  7 05:01:55 UTC 2019

Modified Files:
xsrc/external/mit/xdm/dist/greeter: Login.c

Log Message:
Add visible padding to edit fields.
Vertically: 25% of field height.
Horizontally: 25% of character width.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 xsrc/external/mit/xdm/dist/greeter/Login.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: xsrc/external/mit/xdm/dist/greeter

2019-06-06 Thread Michael van Elst
Module Name:xsrc
Committed By:   mlelstv
Date:   Fri Jun  7 05:01:55 UTC 2019

Modified Files:
xsrc/external/mit/xdm/dist/greeter: Login.c

Log Message:
Add visible padding to edit fields.
Vertically: 25% of field height.
Horizontally: 25% of character width.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 xsrc/external/mit/xdm/dist/greeter/Login.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xdm/dist/greeter/Login.c
diff -u xsrc/external/mit/xdm/dist/greeter/Login.c:1.4 xsrc/external/mit/xdm/dist/greeter/Login.c:1.5
--- xsrc/external/mit/xdm/dist/greeter/Login.c:1.4	Fri Jun  7 04:29:02 2019
+++ xsrc/external/mit/xdm/dist/greeter/Login.c	Fri Jun  7 05:01:55 2019
@@ -255,7 +255,7 @@ static XtResource resources[] = {
 
 #define Y_ASCENT(w)	max (F_ASCENT(prompt), F_ASCENT(text))
 #define Y_DESCENT(w)	max (F_DESCENT(prompt), F_DESCENT(text))
-#define Y_INC(w)	(Y_ASCENT(w) + Y_DESCENT(w))
+#define Y_INC(w)	((Y_ASCENT(w) + Y_DESCENT(w)) * 5 / 4)
 
 #define CURSOR_W	5
 
@@ -332,7 +332,8 @@ XmuXftTextWidth(Display *dpy, XftFont *f
 #define PROMPT_W(w)	(w->core.width - PROMPT_X(w) - 2 * TEXT_X_INC(w) - LOGO_W(w))
 #define PROMPT_H(w)	Y_INC(w)
 
-#define VALUE_X(w,n)	(PROMPT_X(w) + CUR_PROMPT_W(w,n))
+#define VALUE_HPAD(w,n)	(TEXT_X_INC(w)/8)
+#define VALUE_X(w,n)	(PROMPT_X(w) + CUR_PROMPT_W(w,n) + VALUE_HPAD(w,n))
 #define VALUE_Y(w,n)	(PROMPT_Y(w,n))
 #define VALUE_W(w,n)	(PROMPT_W(w) - VALUE_X(w,n) + PROMPT_X(w) - CURSOR_W)
 #define VALUE_H(w,n)	Y_INC(w)
@@ -384,7 +385,7 @@ realizeValue (LoginWidget w, int cursor,
 	text[i] = 0;
 }
 
-x = VALUE_X (w,promptNum);
+x = VALUE_X (w,promptNum) + VALUE_HPAD(w,promptNum);
 y = VALUE_Y (w,promptNum);
 
 height = Y_INC(w);
@@ -468,7 +469,8 @@ realizeCursor (LoginWidget w, GC gc)
 	return;
 }
 
-x = VALUE_X (w, w->login.activePrompt);
+x = VALUE_X (w, w->login.activePrompt)
+  + VALUE_HPAD(w, w->login.activePrompt);
 y = VALUE_Y (w, w->login.activePrompt);
 ascent = F_ASCENT(text);
 descent = F_DESCENT(text);
@@ -742,7 +744,8 @@ draw_it (LoginWidget w)
 	int in_frame_x = VALUE_X(w,p) - w->login.inframeswidth;
 	int in_frame_y = VALUE_Y(w,p) - Y_ASCENT(w) - w->login.inframeswidth;
 
-	int in_width = VALUE_W(w,p) + CURSOR_W + 2 * w->login.inframeswidth;
+	int in_width = VALUE_W(w,p) + CURSOR_W + 2 * w->login.inframeswidth
+		+ 2 * VALUE_HPAD(w,p);
 	int in_height = Y_INC(w) + 2 * w->login.inframeswidth;
 
 	GC topLeftGC, botRightGC, inpGC;



CVS commit: xsrc/external/mit/xdm/dist/greeter

2019-06-06 Thread Michael van Elst
Module Name:xsrc
Committed By:   mlelstv
Date:   Fri Jun  7 05:49:37 UTC 2019

Modified Files:
xsrc/external/mit/xdm/dist/greeter: Login.c

Log Message:
Center padding around edit fields.
Correct greeting text horizontal position for Logo padding.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 xsrc/external/mit/xdm/dist/greeter/Login.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xdm/dist/greeter/Login.c
diff -u xsrc/external/mit/xdm/dist/greeter/Login.c:1.5 xsrc/external/mit/xdm/dist/greeter/Login.c:1.6
--- xsrc/external/mit/xdm/dist/greeter/Login.c:1.5	Fri Jun  7 05:01:55 2019
+++ xsrc/external/mit/xdm/dist/greeter/Login.c	Fri Jun  7 05:49:37 2019
@@ -255,7 +255,7 @@ static XtResource resources[] = {
 
 #define Y_ASCENT(w)	max (F_ASCENT(prompt), F_ASCENT(text))
 #define Y_DESCENT(w)	max (F_DESCENT(prompt), F_DESCENT(text))
-#define Y_INC(w)	((Y_ASCENT(w) + Y_DESCENT(w)) * 5 / 4)
+#define Y_INC(w)	(Y_ASCENT(w) + Y_DESCENT(w))
 
 #define CURSOR_W	5
 
@@ -316,7 +316,7 @@ XmuXftTextWidth(Display *dpy, XftFont *f
 
 #define GREETING(w)	((w)->login.secure_session  && !(w)->login.allow_access ?\
 (w)->login.greeting : (w)->login.unsecure_greet)
-#define GREET_X(w)	((int)((w->core.width - \
+#define GREET_X(w)	((int)((w->core.width - LOGO_W(w) + LOGO_PAD(w) - \
 			 	STRING_WIDTH (greet, GREETING(w))) / 2))
 #define GREET_Y(w)	(GREETING(w)[0] ? 2 * GREET_Y_INC (w) : 0)
 #define GREET_W(w)	(max (STRING_WIDTH (greet, w->login.greeting), \
@@ -333,6 +333,7 @@ XmuXftTextWidth(Display *dpy, XftFont *f
 #define PROMPT_H(w)	Y_INC(w)
 
 #define VALUE_HPAD(w,n)	(TEXT_X_INC(w)/8)
+#define VALUE_VPAD(w,n)	((Y_INC(w)+3)/4)
 #define VALUE_X(w,n)	(PROMPT_X(w) + CUR_PROMPT_W(w,n) + VALUE_HPAD(w,n))
 #define VALUE_Y(w,n)	(PROMPT_Y(w,n))
 #define VALUE_W(w,n)	(PROMPT_W(w) - VALUE_X(w,n) + PROMPT_X(w) - CURSOR_W)
@@ -388,7 +389,7 @@ realizeValue (LoginWidget w, int cursor,
 x = VALUE_X (w,promptNum) + VALUE_HPAD(w,promptNum);
 y = VALUE_Y (w,promptNum);
 
-height = Y_INC(w);
+height = VALUE_H(w,promptNum);
 width = VALUE_W(w,promptNum);
 
 offset = VALUE_SHOW_START(w, promptNum);
@@ -742,11 +743,13 @@ draw_it (LoginWidget w)
 for (p = 0; p < NUM_PROMPTS ; p++)
 {
 	int in_frame_x = VALUE_X(w,p) - w->login.inframeswidth;
-	int in_frame_y = VALUE_Y(w,p) - Y_ASCENT(w) - w->login.inframeswidth;
+	int in_frame_y = VALUE_Y(w,p) - Y_ASCENT(w) - w->login.inframeswidth
+		- VALUE_VPAD(w,p);
 
 	int in_width = VALUE_W(w,p) + CURSOR_W + 2 * w->login.inframeswidth
 		+ 2 * VALUE_HPAD(w,p);
-	int in_height = Y_INC(w) + 2 * w->login.inframeswidth;
+	int in_height = VALUE_H(w,p) + 2 * w->login.inframeswidth
+		+ 2 * VALUE_VPAD(w,p);
 
 	GC topLeftGC, botRightGC, inpGC;
 
@@ -788,12 +791,8 @@ draw_it (LoginWidget w)
 }
 
 if (GREETING(w)[0]) {
-	int gx = GREET_X(w);
-
-#ifdef XPM
-	gx -= ((w->login.logoWidth/2) + w->login.logoPadding);
-#endif
-	DRAW_STRING (greet, gx, GREET_Y(w), GREETING(w), strlen (GREETING(w)));
+	DRAW_STRING (greet, GREET_X(w), GREET_Y(w),
+		 GREETING(w), strlen (GREETING(w)));
 }
 for (p = 0; p < NUM_PROMPTS ; p++) {
 	if (PROMPT_STATE(w, p) != LOGIN_PROMPT_NOT_SHOWN) {



CVS commit: xsrc/external/mit/xdm/dist/greeter

2019-06-06 Thread Michael van Elst
Module Name:xsrc
Committed By:   mlelstv
Date:   Fri Jun  7 04:00:43 UTC 2019

Modified Files:
xsrc/external/mit/xdm/dist/greeter: Login.c

Log Message:
Cursor position was two pixels off to the left.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 xsrc/external/mit/xdm/dist/greeter/Login.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xdm/dist/greeter/Login.c
diff -u xsrc/external/mit/xdm/dist/greeter/Login.c:1.2 xsrc/external/mit/xdm/dist/greeter/Login.c:1.3
--- xsrc/external/mit/xdm/dist/greeter/Login.c:1.2	Sat Jun  1 07:54:12 2019
+++ xsrc/external/mit/xdm/dist/greeter/Login.c	Fri Jun  7 04:00:43 2019
@@ -506,6 +506,8 @@ realizeCursor (LoginWidget w, GC gc)
 	break;
 }
 
+x += 2;
+
 XFillRectangle (XtDisplay (w), XtWindow (w), gc,
 		x, y - ascent + 1, 1, ascent + descent - 2);
 



CVS commit: xsrc/external/mit/xdm/dist/greeter

2019-06-06 Thread Michael van Elst
Module Name:xsrc
Committed By:   mlelstv
Date:   Fri Jun  7 04:00:43 UTC 2019

Modified Files:
xsrc/external/mit/xdm/dist/greeter: Login.c

Log Message:
Cursor position was two pixels off to the left.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 xsrc/external/mit/xdm/dist/greeter/Login.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: xsrc/external/mit/xdm/dist/greeter

2019-06-06 Thread Michael van Elst
Module Name:xsrc
Committed By:   mlelstv
Date:   Fri Jun  7 04:29:03 UTC 2019

Modified Files:
xsrc/external/mit/xdm/dist/greeter: Login.c

Log Message:
Respect the outer border width for sizing the widget horizontally.
Add it twice so that the greeting text can neither trash nor touch
the border.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 xsrc/external/mit/xdm/dist/greeter/Login.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xdm/dist/greeter/Login.c
diff -u xsrc/external/mit/xdm/dist/greeter/Login.c:1.3 xsrc/external/mit/xdm/dist/greeter/Login.c:1.4
--- xsrc/external/mit/xdm/dist/greeter/Login.c:1.3	Fri Jun  7 04:00:43 2019
+++ xsrc/external/mit/xdm/dist/greeter/Login.c	Fri Jun  7 04:29:02 2019
@@ -345,7 +345,7 @@ XmuXftTextWidth(Display *dpy, XftFont *f
 #define FAIL_W(w)	max(ERROR_W(w, w->login.failMsg), \
 			ERROR_W(w, w->login.passwdChangeMsg))
 
-#define PAD_X(w)	(2 * (PROMPT_X(w) + max (GREET_X_INC(w), FAIL_X_INC(w
+#define PAD_X(w)	(2 * (PROMPT_X(w) + max (GREET_X_INC(w), FAIL_X_INC(w)) + 4*w->login.outframewidth))
 #define PAD_Y(w)	(max (max (Y_INC(w), GREET_Y_INC(w)),\
 			 FAIL_Y_INC(w)))
 



CVS commit: xsrc/external/mit/xdm/dist/greeter

2019-06-06 Thread Michael van Elst
Module Name:xsrc
Committed By:   mlelstv
Date:   Fri Jun  7 04:29:03 UTC 2019

Modified Files:
xsrc/external/mit/xdm/dist/greeter: Login.c

Log Message:
Respect the outer border width for sizing the widget horizontally.
Add it twice so that the greeting text can neither trash nor touch
the border.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 xsrc/external/mit/xdm/dist/greeter/Login.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/usb

2019-05-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed May 29 08:23:54 UTC 2019

Modified Files:
src/sys/dev/usb: if_mue.c

Log Message:
mutexes are destroyed unconditionally in detach, so also init them
unconditionally.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/usb/if_mue.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/usb

2019-05-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed May 29 09:04:01 UTC 2019

Modified Files:
src/sys/dev/usb: if_mue.c

Log Message:
don't use a spin lock, the USB host driver may need to take other locks.
stop watchdog timer early to prevent calling txeof twice.
allow more output after USB error by clearing OACTIVE in error path.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/usb/if_mue.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2019-05-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu May 30 16:04:29 UTC 2019

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1360 -r1.1361 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1359 -r1.1360 src/sys/dev/pci/pcidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1360 src/sys/dev/pci/pcidevs.h:1.1361
--- src/sys/dev/pci/pcidevs.h:1.1360	Mon Apr 15 09:01:49 2019
+++ src/sys/dev/pci/pcidevs.h	Thu May 30 16:04:28 2019
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.1360 2019/04/15 09:01:49 msaitoh Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1361 2019/05/30 16:04:28 mlelstv Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1372 2019/04/15 09:01:28 msaitoh Exp
+ *	NetBSD: pcidevs,v 1.1373 2019/05/30 16:04:04 mlelstv Exp
  */
 
 /*
@@ -7699,6 +7699,7 @@
 #define	PCI_PRODUCT_VIATECH_VT3351_IOAPIC	0x5351		/* VT3351 I/O APIC Interrupt Controller */
 #define	PCI_PRODUCT_VIATECH_P4M900_IOAPIC	0x5364		/* CN896/P4M900 IOAPIC */
 #define	PCI_PRODUCT_VIATECH_VT8237S_SATA	0x5372		/* VT8237S Integrated SATA Controller */
+#define	PCI_PRODUCT_VIATECH_VT8237S_SATA_2	0x7372		/* VT8237S Integrated SATA Controller */
 #define	PCI_PRODUCT_VIATECH_VT86C100A	0x6100		/* VT86C100A (Rhine-II) 10/100 Ethernet */
 #define	PCI_PRODUCT_VIATECH_VT8251_SATA	0x6287		/* VT8251 Integrated SATA Controller */
 #define	PCI_PRODUCT_VIATECH_P4M900_6	0x6364		/* CN896/P4M900 Security Device */
@@ -7709,6 +7710,7 @@
 #define	PCI_PRODUCT_VIATECH_VT8231	0x8231		/* VT8231 PCI-ISA Bridge */
 #define	PCI_PRODUCT_VIATECH_VT8231_PWR	0x8235		/* VT8231 Power Management Controller */
 #define	PCI_PRODUCT_VIATECH_VT8363_PPB	0x8305		/* VT8363 (Apollo KT133) PCI to AGP Bridge */
+#define	PCI_PRODUCT_VIATECH_VX855	0x8409		/* VX855 PCI-LPC Bridge */
 #define	PCI_PRODUCT_VIATECH_CX700	0x8324		/* CX700 PCI-LPC Bridge */
 #define	PCI_PRODUCT_VIATECH_VX800	0x8353		/* VX800/VX820 PCI-LPC Bridge */
 #define	PCI_PRODUCT_VIATECH_VT8371_PPB	0x8391		/* VT8371 (Apollo KX133) PCI-PCI Bridge */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1359 src/sys/dev/pci/pcidevs_data.h:1.1360
--- src/sys/dev/pci/pcidevs_data.h:1.1359	Mon Apr 15 09:01:49 2019
+++ src/sys/dev/pci/pcidevs_data.h	Thu May 30 16:04:28 2019
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1359 2019/04/15 09:01:49 msaitoh Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1360 2019/05/30 16:04:28 mlelstv Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1372 2019/04/15 09:01:28 msaitoh Exp
+ *	NetBSD: pcidevs,v 1.1373 2019/05/30 16:04:04 mlelstv Exp
  */
 
 /*
@@ -13521,6 +13521,8 @@ static const uint16_t pci_products[] = {
 	35741, 8536, 0,
 	PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8237S_SATA, 
 	36368, 692, 8584, 6384, 0,
+	PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8237S_SATA_2, 
+	36368, 692, 8584, 6384, 0,
 	PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT86C100A, 
 	36402, 36412, 5748, 5646, 0,
 	PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8251_SATA, 
@@ -13541,18 +13543,20 @@ static const uint16_t pci_products[] = {
 	36423, 3749, 7007, 6384, 0,
 	PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8363_PPB, 
 	35712, 35719, 35727, 615, 6938, 8410, 6492, 0,
+	PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VX855, 
+	36430, 29886, 6492, 0,
 	PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_CX700, 
 	35835, 29886, 6492, 0,
 	PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VX800, 
-	36430, 29886, 6492, 0,
+	36436, 29886, 6492, 0,
 	PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8371_PPB, 
 	35754, 35719, 35761, 8397, 6492, 0,
 	PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8501AGP, 
-	35774, 35719, 35781, 36442, 6492, 0,
+	35774, 35719, 35781, 36448, 6492, 0,
 	PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C597AGP, 
-	35895, 35719, 35904, 36442, 6492, 0,
+	35895, 35719, 35904, 36448, 6492, 0,
 	PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C598AGP, 
-	35909, 35719, 35918, 36442, 6492, 0,
+	35909, 35719, 35918, 36448, 6492, 0,
 	PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8605AGP, 
 	35924, 35719, 35931, 35940, 23598, 6492, 0,
 	PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VX900_IDE, 
@@ -13562,15 +13566,15 @@ static const uint16_t pci_products[] = {
 	PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_P4M900_PPB_1, 
 	35741, 8397, 6492, 0,
 	PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8633AGP, 
-	36450, 35719, 7182, 36457, 36442, 6492, 0,
+	36456, 35719, 7182, 36463, 36448, 6492, 0,
 	PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8366AGP, 
-	36149, 35719, 36156, 36442, 6492, 0,
+	36149, 35719, 36156, 36448, 6492, 0,
 	

CVS commit: src/sys/dev/pci

2019-05-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu May 30 16:04:29 UTC 2019

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1360 -r1.1361 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1359 -r1.1360 src/sys/dev/pci/pcidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2019-05-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu May 30 16:04:04 UTC 2019

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
add IDs for SATA controllers VT8237S and VX855


To generate a diff of this commit:
cvs rdiff -u -r1.1372 -r1.1373 src/sys/dev/pci/pcidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2019-05-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu May 30 16:04:04 UTC 2019

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
add IDs for SATA controllers VT8237S and VX855


To generate a diff of this commit:
cvs rdiff -u -r1.1372 -r1.1373 src/sys/dev/pci/pcidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1372 src/sys/dev/pci/pcidevs:1.1373
--- src/sys/dev/pci/pcidevs:1.1372	Mon Apr 15 09:01:28 2019
+++ src/sys/dev/pci/pcidevs	Thu May 30 16:04:04 2019
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1372 2019/04/15 09:01:28 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1373 2019/05/30 16:04:04 mlelstv Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -7692,6 +7692,7 @@ product VIATECH VT8237A_SATA_2	0x5337	VT
 product VIATECH VT3351_IOAPIC	0x5351	VT3351 I/O APIC Interrupt Controller
 product VIATECH P4M900_IOAPIC	0x5364	CN896/P4M900 IOAPIC
 product VIATECH VT8237S_SATA	0x5372	VT8237S Integrated SATA Controller
+product VIATECH VT8237S_SATA_2 0x7372  VT8237S Integrated SATA Controller
 product VIATECH VT86C100A	0x6100	VT86C100A (Rhine-II) 10/100 Ethernet
 product VIATECH VT8251_SATA	0x6287	VT8251 Integrated SATA Controller
 product VIATECH P4M900_6	0x6364	CN896/P4M900 Security Device
@@ -7702,6 +7703,7 @@ product VIATECH P4M900_7	0x7364	CN896/P4
 product VIATECH VT8231		0x8231	VT8231 PCI-ISA Bridge
 product VIATECH VT8231_PWR	0x8235	VT8231 Power Management Controller
 product VIATECH VT8363_PPB	0x8305	VT8363 (Apollo KT133) PCI to AGP Bridge
+product VIATECH VX855  0x8409  VX855  PCI-LPC Bridge
 product VIATECH CX700		0x8324	CX700 PCI-LPC Bridge
 product VIATECH VX800		0x8353	VX800/VX820 PCI-LPC Bridge
 product VIATECH VT8371_PPB	0x8391	VT8371 (Apollo KX133) PCI-PCI Bridge



CVS commit: src/lib/libpam/modules/pam_ssh

2019-06-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jun  1 07:15:39 UTC 2019

Modified Files:
src/lib/libpam/modules/pam_ssh: pam_ssh.c

Log Message:
Fix key loading logic and add log message when rejecting an unencrypted key.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/lib/libpam/modules/pam_ssh/pam_ssh.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libpam/modules/pam_ssh/pam_ssh.c
diff -u src/lib/libpam/modules/pam_ssh/pam_ssh.c:1.26 src/lib/libpam/modules/pam_ssh/pam_ssh.c:1.27
--- src/lib/libpam/modules/pam_ssh/pam_ssh.c:1.26	Sun Aug 26 08:54:03 2018
+++ src/lib/libpam/modules/pam_ssh/pam_ssh.c	Sat Jun  1 07:15:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pam_ssh.c,v 1.26 2018/08/26 08:54:03 christos Exp $	*/
+/*	$NetBSD: pam_ssh.c,v 1.27 2019/06/01 07:15:39 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2003 Networks Associates Technology, Inc.
@@ -38,7 +38,7 @@
 #ifdef __FreeBSD__
 __FBSDID("$FreeBSD: src/lib/libpam/modules/pam_ssh/pam_ssh.c,v 1.40 2004/02/10 10:13:21 des Exp $");
 #else
-__RCSID("$NetBSD: pam_ssh.c,v 1.26 2018/08/26 08:54:03 christos Exp $");
+__RCSID("$NetBSD: pam_ssh.c,v 1.27 2019/06/01 07:15:39 mlelstv Exp $");
 #endif
 
 #include 
@@ -119,13 +119,14 @@ pam_ssh_load_key(const char *dir, const 
 	 * accept only an empty passphrase.
 	 */
 	r = sshkey_load_private(fn, "", , );
-	if (r && !(*passphrase == '\0' && nullok)) {
+	if (r == 0 && !(*passphrase == '\0' && nullok)) {
+		openpam_log(PAM_LOG_DEBUG, "rejected unencrypted key from %s", fn);
 		sshkey_free(key);
 		free(comment);
 		return (NULL);
 	}
 	if (r)
-		sshkey_load_private(fn, passphrase, , );
+		r = sshkey_load_private(fn, passphrase, , );
 	if (r) {
 		openpam_log(PAM_LOG_DEBUG, "failed to load key from %s", fn);
 		if (comment != NULL)



CVS commit: src/lib/libpam/modules/pam_ssh

2019-06-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jun  1 07:15:39 UTC 2019

Modified Files:
src/lib/libpam/modules/pam_ssh: pam_ssh.c

Log Message:
Fix key loading logic and add log message when rejecting an unencrypted key.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/lib/libpam/modules/pam_ssh/pam_ssh.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/ata

2019-06-06 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Jun  6 20:41:04 UTC 2019

Modified Files:
src/sys/dev/ata: wd.c

Log Message:
Count only the initial start of a transfer, not the retries.
Should fix kern/54166.

Thanks to macallan@ for spotting the issue.


To generate a diff of this commit:
cvs rdiff -u -r1.450 -r1.451 src/sys/dev/ata/wd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ata/wd.c
diff -u src/sys/dev/ata/wd.c:1.450 src/sys/dev/ata/wd.c:1.451
--- src/sys/dev/ata/wd.c:1.450	Fri May 24 06:01:05 2019
+++ src/sys/dev/ata/wd.c	Thu Jun  6 20:41:04 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: wd.c,v 1.450 2019/05/24 06:01:05 mlelstv Exp $ */
+/*	$NetBSD: wd.c,v 1.451 2019/06/06 20:41:04 mlelstv Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.450 2019/05/24 06:01:05 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.451 2019/06/06 20:41:04 mlelstv Exp $");
 
 #include "opt_ata.h"
 #include "opt_wd.h"
@@ -734,7 +734,8 @@ wdstart1(struct wd_softc *wd, struct buf
 		xfer->c_bio.flags |= ATA_FUA;
 	}
 
-	wd->inflight++;
+	if (xfer->c_retries == 0)
+		wd->inflight++;
 	switch (wd->atabus->ata_bio(wd->drvp, xfer)) {
 	case ATACMD_TRY_AGAIN:
 		panic("wdstart1: try again");
@@ -989,7 +990,9 @@ noerror:	if ((xfer->c_bio.flags & ATA_CO
 
 	ata_free_xfer(wd->drvp->chnl_softc, xfer);
 
+	mutex_enter(>sc_lock);
 	wd->inflight--;
+	mutex_exit(>sc_lock);
 	dk_done(dksc, bp);
 	dk_start(dksc, NULL);
 }



CVS commit: src/sys/dev/ata

2019-06-06 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Jun  6 20:41:04 UTC 2019

Modified Files:
src/sys/dev/ata: wd.c

Log Message:
Count only the initial start of a transfer, not the retries.
Should fix kern/54166.

Thanks to macallan@ for spotting the issue.


To generate a diff of this commit:
cvs rdiff -u -r1.450 -r1.451 src/sys/dev/ata/wd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



  1   2   3   4   5   6   7   >