dragonfly.git
17 years ago- Describe new 802.11 options
Sepherosa Ziehau [Thu, 18 May 2006 14:24:34 +0000 (14:24 +0000)]
- Describe new 802.11 options
- Describe missing options for bridge(4)

Obtained-from: FreeBSD
Reviewed-by: swildner
17 years agoSync 802.11 support with FreeBSD6:
Sepherosa Ziehau [Thu, 18 May 2006 13:51:46 +0000 (13:51 +0000)]
Sync 802.11 support with FreeBSD6:
    "it includes completed 802.11g, WPA, 802.11i, 802.1x, WME/WMM, AP-side
     power-save, crypto plugin framework, authenticator plugin framework,
     and access control plugin frameowrk."

Reoriganize the layout of netproto/802_11: put generic 802.11 layer, crypto
modules, authentication module and access control module into their own
directories.  Header files are still in their original place.

Nuke all of the mutexing in generic 802.11, reorganize ieee80211_node table
scanning a little bit.

Rename FreeBSD's m_append() to ieee80211_mbuf_append(), rename FreeBSD's
m_unshare() to ieee80211_mbuf_clone() and put them into
netproto/802_11/wlan/ieee80211_dragonly.c
They are not generic enough for public using, at least for now.
Pointed-out-by: hsu
Expose ieee80211_add_{ssid, xrates, rates}() which are used by acx(4)

Keep using opencrypto's AES implmentation for 802.11 CCMP crypto module

Sync ifconfig(8)'s 802.11 support with FreeBSD6

Update acx(4) and ndis(4) for the new 802.11 support

Sync iwi(4), ipw(4), wi(4) and ray(4) with FreeBSD6

For iwi(4):
- Fix ieee80211_node leakage
- Use a bitmap instead of FreeBSD's "unit number alloctor" to allocate IBSS node

Add generic 802.11 layer and crypto modules into GENERIC and LINT,
authentication module and access module are only added to LINT

Unhook awi(4) from GENERIC and LINT temporarily, since as of this commit it
is broken :(  It will be fixed sometime later.

Thank Sam Leffler and many other people for their work on 802.11 support.

Thank Andrew Atrens and Adrian Michael Nida for submitting the patch.

Thank all the people that helped testing 802.11 patches for this commit

Based-on-Patch-Submitted-by:
  Andrew Atrens <atrens@nortelnetworks.com>
  Adrian Michael Nida <nida@musc.edu>

Tested-by:
  Thomas Schlesinger <schlesinger@netcologne.de>
  Johannes Hofmann <Johannes.Hofmann@gmx.de>
  Andrew Thompson <andrew@hijacked.us>
  Erik Wikström <erik-wikstrom@telia.com>

17 years agoFix static array overrun.
Sepherosa Ziehau [Thu, 18 May 2006 12:43:24 +0000 (12:43 +0000)]
Fix static array overrun.

Obtained-from: FreeBSD (Coverity ID: 916)

17 years agop_tracep -> p_tracenode, tracking changes made in recent commits.
Matthew Dillon [Thu, 18 May 2006 08:25:23 +0000 (08:25 +0000)]
p_tracep -> p_tracenode, tracking changes made in recent commits.

17 years agop_tracep -> p_tracenode, tracking changes made in recent commits.
Matthew Dillon [Thu, 18 May 2006 08:17:14 +0000 (08:17 +0000)]
p_tracep -> p_tracenode, tracking changes made in recent commits.

Reported-by: Rumko <rumcic@gmail.com>
17 years agoAdd another mutex tester for Jeff's spinlock code w/ the refcount
Matthew Dillon [Thu, 18 May 2006 02:22:46 +0000 (02:22 +0000)]
Add another mutex tester for Jeff's spinlock code w/ the refcount
optimization.

17 years agoOops, last commit was slightly premature. Fix a bug-a-boo and remove
Matthew Dillon [Wed, 17 May 2006 20:35:33 +0000 (20:35 +0000)]
Oops, last commit was slightly premature.  Fix a bug-a-boo and remove
debugging code.

17 years agoThe ktracing code was not properly matching up VOP_OPEN and VOP_CLOSE calls.
Matthew Dillon [Wed, 17 May 2006 20:20:55 +0000 (20:20 +0000)]
The ktracing code was not properly matching up VOP_OPEN and VOP_CLOSE calls.

Replace the p_tracep tracing vnode in struct proc with a pointer to
a ref-counted ktrace_node.  Ref the node instead of the vnode to prevent
the destruction of the vnode.

17 years agoUse localhost instead of 127.0.0.1, since IPv6 should work as well.
Joerg Sonnenberger [Wed, 17 May 2006 19:22:32 +0000 (19:22 +0000)]
Use localhost instead of 127.0.0.1, since IPv6 should work as well.

17 years agoPass the process (p) instead of the vnode (p->p_tracep) to the kernel tracing
Matthew Dillon [Wed, 17 May 2006 18:30:22 +0000 (18:30 +0000)]
Pass the process (p) instead of the vnode (p->p_tracep) to the kernel tracing
API functions.  This allows the vnode ref to be consolidated into one place.

17 years agoRemove the (unused) copy-on-write support for a vnode's VM object. This
Matthew Dillon [Wed, 17 May 2006 17:47:58 +0000 (17:47 +0000)]
Remove the (unused) copy-on-write support for a vnode's VM object.  This
support originally existed to support the badly implemented and severely
hacked ENABLE_VFS_IOOPT I/O optimization which was removed long ago.

This also removes a bunch of cross-module pollution in UFS.

17 years agoDocument MAKEOBJDIRPREFIX.
Sascha Wildner [Wed, 17 May 2006 14:41:48 +0000 (14:41 +0000)]
Document MAKEOBJDIRPREFIX.

Submitted-by: Trevor Kendall <trevorjk@gmail.com>
17 years agoPer default, restrict recursive queries to 127.0.0.1.
Sascha Wildner [Wed, 17 May 2006 14:25:47 +0000 (14:25 +0000)]
Per default, restrict recursive queries to 127.0.0.1.

Submitted-by: Gary <gary@velocity-servers.net>
OK-by: corecode, joerg
17 years agoRemove isinff and isnanf prototypes. Our isinf and isnan functions are
Sascha Wildner [Wed, 17 May 2006 14:06:37 +0000 (14:06 +0000)]
Remove isinff and isnanf prototypes. Our isinf and isnan functions are
type-variadic. Also remove the isinff(3) manpage I added yesterday
(I had just looked at the prototypes).

Pointed-out-by: joerg
17 years agoAdd isinff(3) manpage.
Sascha Wildner [Wed, 17 May 2006 01:44:24 +0000 (01:44 +0000)]
Add isinff(3) manpage.

17 years agoAttempt to interlock races between the buffer cache and VM backing store
Matthew Dillon [Tue, 16 May 2006 18:20:32 +0000 (18:20 +0000)]
Attempt to interlock races between the buffer cache and VM backing store
that might cause new buffers to be instantiated beyond the new file EOF
during a truncate operation.

Truncate the VM object size before attempting to flush the pages and buffers
in order to prevent new VM pages from being created beyond EOF during the
flush.  Add an extra pass on the buffer cache after truncation to make sure
the buffers have been cleaned out.  Generate a warning to the console if
buffers are found during the extra pass.

If an old buffer were left intact during a truncate, then a re-extension of
the file or directory could have resulted in granting access to the old
buffer which might have had an incorrect cached block number translation
(vs the new block allocated by the extension of the file or directory),
causing new data to be written to the wrong disk block and resulting in
file or directory corruption.  The regular file truncation/extension
code had other checks in it prior to this patch so if this problem could
occur at all before it would have been in the directory code.

There is a small chance that this race was related to reported
ufs: dirbad panics.  The M.O. matches but unfortunately there is still
no smoking gun.

17 years agoRemove vnode lock assertions that are no longer used. Remove the
Matthew Dillon [Tue, 16 May 2006 18:09:20 +0000 (18:09 +0000)]
Remove vnode lock assertions that are no longer used.  Remove the
IS_LOCKING_VFS() macro.  All VFS's are required to be locking VFSs now.

17 years agoEnable TCP wrappers in sshd.
Simon Schubert [Tue, 16 May 2006 16:26:08 +0000 (16:26 +0000)]
Enable TCP wrappers in sshd.

Reported-by: Yiorgos Adamopoulos <adamo@central.tee.gr>
17 years agoAdd a commant, which warns atomic_cmpset_int() is a !I386_CPU function
Sepherosa Ziehau [Tue, 16 May 2006 14:24:06 +0000 (14:24 +0000)]
Add a commant, which warns atomic_cmpset_int() is a !I386_CPU function

Suggested-by: joerg
17 years agoPut atomic_cmpset_int() into central place. This function was defined and
Sepherosa Ziehau [Tue, 16 May 2006 12:34:15 +0000 (12:34 +0000)]
Put atomic_cmpset_int() into central place.  This function was defined and
used in many places.

Reviewed-by: dillon
OK: davidxu

17 years agoRemove all traces of umapfs and associated stuff.
Sascha Wildner [Sun, 14 May 2006 18:07:29 +0000 (18:07 +0000)]
Remove all traces of umapfs and associated stuff.

Discussed-with: dillon

[forced commit to correct message]

17 years ago/tmp/umap.msg
Sascha Wildner [Sun, 14 May 2006 18:00:05 +0000 (18:00 +0000)]
/tmp/umap.msg

17 years agocbb_probe() assumes that the subclass field is unique. This patch further
Matthew Dillon [Sun, 14 May 2006 17:28:36 +0000 (17:28 +0000)]
cbb_probe() assumes that the subclass field is unique. This patch further
qualifies the check to verify that the device belongs to the bus class as
well before claiming the device.

Submitted-by: Chuck Tuffli <ctuffli@gmail.com>
17 years agoNuke duplicated header files, which restores `buildworld'
Sepherosa Ziehau [Sun, 14 May 2006 01:28:54 +0000 (01:28 +0000)]
Nuke duplicated header files, which restores `buildworld'

17 years agoRemove mount_umap.
Matthew Dillon [Sat, 13 May 2006 05:10:42 +0000 (05:10 +0000)]
Remove mount_umap.

17 years agoMost of the fields in vnodeop_desc have been unused for a while now.
Matthew Dillon [Fri, 12 May 2006 22:26:47 +0000 (22:26 +0000)]
Most of the fields in vnodeop_desc have been unused for a while now.
Remove them.

17 years agoUMAPFS has been disabled (and non-working) for a long time. Scrap it
Matthew Dillon [Fri, 12 May 2006 22:07:23 +0000 (22:07 +0000)]
UMAPFS has been disabled (and non-working) for a long time.  Scrap it
entirely.

17 years agoFix spelling and remove hard sentence break.
Sascha Wildner [Fri, 12 May 2006 14:05:39 +0000 (14:05 +0000)]
Fix spelling and remove hard sentence break.

17 years agoRemove Alpha specific header file.
Sascha Wildner [Fri, 12 May 2006 07:43:56 +0000 (07:43 +0000)]
Remove Alpha specific header file.

17 years agoMerge revisions 1.38,1.41 of eval.c from FreeBSD:
YONETANI Tomokazu [Fri, 12 May 2006 01:56:11 +0000 (01:56 +0000)]
Merge revisions 1.38,1.41 of eval.c from FreeBSD:
  PR 28852
  sh -e behaviour was incorrect when && and || statements where used in
  "if" clauses.
revision 1.41 is a fix to a bug in 1.38 that subshells could lose
a non-zero status.

dfly problem reported-by: Johannes Hofmann <Johannes.Hofmann at gmx.de>
OK'ed: dillon@, joerg@

17 years agoFix three bugs in the last commit and document special cases. Tighten
Matthew Dillon [Thu, 11 May 2006 19:50:29 +0000 (19:50 +0000)]
Fix three bugs in the last commit and document special cases.  Tighten
up the count calculation.   The code now passes the /usr/src/test/lockf
system test.

* F_UNLCK wasn't being handled properly in certain cases, resulting in a
  panic.

* The 'next' pointer was not bring properly adjusted when removing an
  element (brange) other then the current element in the scan, resulting
  in a posix lock error.

* The first and last matches were not always being properly merged with
  the created range, resulting in a positive count panic.

Reported-by: Stefan Krueger <skrueger@meinberlikomm.de>
17 years agoRecognize the cpu ident for additional VIA processors.
Matthew Dillon [Thu, 11 May 2006 16:44:43 +0000 (16:44 +0000)]
Recognize the cpu ident for additional VIA processors.

Submitted-by: Gary Allan <dragonfly@gallan.plus.com>
Taken-from: FreeBSD

17 years ago* Remove the following obsolete options from the system:
Sascha Wildner [Thu, 11 May 2006 08:23:20 +0000 (08:23 +0000)]
* Remove the following obsolete options from the system:

  AAC_COMPAT_LINUX
  ACPI_MAX_THREADS
  AVM_A1_PCI
  CD9660_ROOT
  CPU_UPGRADE_HW_CACHE
  DEBUG_LINUX
  DEBUG_TOKENS
  DPT_ALLOW_MEMIO
  IDE_DELAY
  INVARIANT_SUPPORT
  KERNFS
  MFS_ROOT
  MFS_ROOT_SIZE
  NTIMECOUNTER
  OLTR_NO_BULLSEYE_MAC
  OLTR_NO_HAWKEYE_MAC
  OLTR_NO_TMS_MAC
  UGEN_DEBUG
  UHCI_DEBUG
  UHID_DEBUG
  UHUB_DEBUG
  UKBD_DEBUG
  ULPT_DEBUG
  UMASS_DEBUG
  UMS_DEBUG
  VM_KMEM_SIZE
  VM_KMEM_SIZE_MAX
  VM_KMEM_SIZE_SCALE

* Add numerous options to LINT

* Fix typo in options: TWA_FLASH_FIREWARE -> TWA_FLASH_FIRMWARE

* Fix typo in dgb.c: opt_depricated.h -> opt_deprecated.h

* Fix some minor manpage issues

17 years agoCorrect test for fragmented packet.
Jeffrey Hsu [Thu, 11 May 2006 00:52:03 +0000 (00:52 +0000)]
Correct test for fragmented packet.

17 years agoSync with FreeBSD.
Sascha Wildner [Wed, 10 May 2006 15:18:29 +0000 (15:18 +0000)]
Sync with FreeBSD.

17 years agoComment out references to cnw(4). It's unlikely that we'll import it.
Sascha Wildner [Tue, 9 May 2006 07:18:39 +0000 (07:18 +0000)]
Comment out references to cnw(4). It's unlikely that we'll import it.

17 years agoSplit kern/vfs_journal.c. Leave the low level journal support code in
Matthew Dillon [Mon, 8 May 2006 18:45:53 +0000 (18:45 +0000)]
Split kern/vfs_journal.c.  Leave the low level journal support code in
kern/vfs_journal.c and move all the mount-based journaling code and
journaling VNOPS to kern/vfs_jops.c.  This is in preparation for utilizing
the core journaling protocol for userland VFS support.

17 years agoRewrite the POSIX locking code. It was becomming impossible to track
Matthew Dillon [Mon, 8 May 2006 00:38:59 +0000 (00:38 +0000)]
Rewrite the POSIX locking code.  It was becomming impossible to track
down bugs in the previous version due to code complexity (in particular
a large number of undocumented short cuts and gotos), and general lack of
documentation.

The new code uses a more straightforward method for managing the lock list
and is far better documented.  Basically the conflict space is ranged,
if no conflict occurs the new lock is inserted, overlaps are clipped or
removed, and finally a quick optimization to check for and collapse
compatible adjacent locks.

17 years agoAdd a little program that allows one to test posix range locks.
Matthew Dillon [Mon, 8 May 2006 00:30:41 +0000 (00:30 +0000)]
Add a little program that allows one to test posix range locks.

17 years agoRemove the internal F_FLOCK flag. Either F_POSIX or F_FLOCK must be set,
Matthew Dillon [Sun, 7 May 2006 19:17:18 +0000 (19:17 +0000)]
Remove the internal F_FLOCK flag.  Either F_POSIX or F_FLOCK must be set,
so just use F_POSIX to indicate whether its a posix style lock or an flock
style lock.

17 years agolockmgr_kernproc() wasn't checking whether the lockholder as already
Matthew Dillon [Sun, 7 May 2006 00:51:11 +0000 (00:51 +0000)]
lockmgr_kernproc() wasn't checking whether the lockholder as already
LK_KERNTHREAD, resulting in a panic in certain situations.

Reported-by: Stefan Krueger <skrueger@meinberlikomm.de>
17 years agoRecode the streamid selector. The streamid was faked before. Do it for
Matthew Dillon [Sun, 7 May 2006 00:24:58 +0000 (00:24 +0000)]
Recode the streamid selector.  The streamid was faked before.  Do it for
real now, guarenteeing that parallel transactions will have unique stream
identifiers.

In addition, while not required, streamid calculations are such that non
parallel transactions will have a tendancy to use the same id, so someone
observing the streamid's in a journaling stream can easily pick out when
parallel transactions occur.

17 years agoWe have to use pmap_extract() here. If we lose a race against page
Matthew Dillon [Sun, 7 May 2006 00:24:02 +0000 (00:24 +0000)]
We have to use pmap_extract() here.  If we lose a race against page
table cleaning pmap_kextract() could choke on a missing page directory.

17 years agoWe have to use pmap_extract() here. pmap_kextract() will choke on a missing
Matthew Dillon [Sun, 7 May 2006 00:23:08 +0000 (00:23 +0000)]
We have to use pmap_extract() here.  pmap_kextract() will choke on a missing
page directory and the user memory hasn't been touched yet.

17 years agoWe have to use pmap_extract here, pmap_kextract will choke if the page
Matthew Dillon [Sun, 7 May 2006 00:22:37 +0000 (00:22 +0000)]
We have to use pmap_extract here, pmap_kextract will choke if the page
directory is missing and the user memory has not been touched.

17 years agoFix a null pointer indirection, the VM fault rate limiting code only
Matthew Dillon [Sat, 6 May 2006 23:53:34 +0000 (23:53 +0000)]
Fix a null pointer indirection, the VM fault rate limiting code only
applies to processes.

17 years agoRemove the thread argument from all mount->vfs_* function vectors,
Matthew Dillon [Sat, 6 May 2006 18:48:53 +0000 (18:48 +0000)]
Remove the thread argument from all mount->vfs_* function vectors,
replacing it with a ucred pointer when applicable.  This cleans up a
considerable amount of VFS function code that previously delved into
the process structure to get the cred, though some code remains.

Get rid of the compatibility thread argument for hpfs and nwfs.  Our
lockmgr calls are now mostly compatible with NetBSD (which doesn't use a
thread argument either).

Get rid of some complex junk in fdesc_statfs() that nobody uses.

Remove the thread argument from dounmount() as well as various other
filesystem specific procedures (quota calls primarily) which no longer
need it due to the lockmgr, VOP, and VFS cleanups.  These cleanups also
have the effect of making the VFS code slightly less dependant on the
calling thread's context.

17 years agoFix .Os and a .Xr. Expand HISTORY a bit.
Sascha Wildner [Sat, 6 May 2006 17:39:29 +0000 (17:39 +0000)]
Fix .Os and a .Xr. Expand HISTORY a bit.

17 years agoRemove the thread argument from ext2_quotaoff(), ext2_flushfiles(),
Matthew Dillon [Sat, 6 May 2006 16:33:26 +0000 (16:33 +0000)]
Remove the thread argument from ext2_quotaoff(), ext2_flushfiles(),
ext2_mountfs(), and ext2_reload().

17 years agoRemove the thread argument from ffs_flushfiles(), ffs_mountfs(),
Matthew Dillon [Sat, 6 May 2006 16:20:19 +0000 (16:20 +0000)]
Remove the thread argument from ffs_flushfiles(), ffs_mountfs(),
softdep_flushfiles(), ffs_reload(), ufs_quotaon(), and ufs_quotaoff().

17 years agoRemove the thread_t argument from nfs_rslock() and nfs_rsunlock().
Matthew Dillon [Sat, 6 May 2006 16:01:21 +0000 (16:01 +0000)]
Remove the thread_t argument from nfs_rslock() and nfs_rsunlock().

17 years agoThe fdrop() procedure no longer needs a thread argument, remove it.
Matthew Dillon [Sat, 6 May 2006 06:38:39 +0000 (06:38 +0000)]
The fdrop() procedure no longer needs a thread argument, remove it.

17 years agoAdd some ifioctl() td -> ucred changes that were missed.
Matthew Dillon [Sat, 6 May 2006 03:16:44 +0000 (03:16 +0000)]
Add some ifioctl() td -> ucred changes that were missed.

17 years agoThe thread/proc pointer argument in the VFS subsystem originally existed
Matthew Dillon [Sat, 6 May 2006 02:43:15 +0000 (02:43 +0000)]
The thread/proc pointer argument in the VFS subsystem originally existed
for...  well, I'm not sure *WHY* it originally existed when most of the
time the pointer couldn't be anything other then curthread or curproc or
the code wouldn't work.  This is particularly true of lockmgr locks.

Remove the pointer argument from all VOP_*() functions, all fileops functions,
and most ioctl functions.

17 years agoRemove the thread_t argument from vfs_busy() and vfs_unbusy(). Passing a
Matthew Dillon [Fri, 5 May 2006 21:27:58 +0000 (21:27 +0000)]
Remove the thread_t argument from vfs_busy() and vfs_unbusy().  Passing a
thread_t to these functions has always been questionable at best.

17 years agoSimplify vn_lock(), VOP_LOCK(), and VOP_UNLOCK() by removing the thread_t
Matthew Dillon [Fri, 5 May 2006 21:15:11 +0000 (21:15 +0000)]
Simplify vn_lock(), VOP_LOCK(), and VOP_UNLOCK() by removing the thread_t
argument.  These calls now always use the current thread as the lockholder.
Passing a thread_t to these functions has always been questionable at best.

17 years agoRemove the thread pointer argument to lockmgr(). All lockmgr() ops use the
Matthew Dillon [Fri, 5 May 2006 20:15:02 +0000 (20:15 +0000)]
Remove the thread pointer argument to lockmgr().  All lockmgr() ops use the
current thread.

Move the lockmgr code in BUF_KERNPROC to lockmgr_kernproc().  This code
allows the lock owner to be set to a special value so any thread can unlock
the lock and is required for B_ASYNC I/O so biodone() can release the lock.

17 years agoRemove VOP_BWRITE(). This function provided a way for a VFS to override
Matthew Dillon [Fri, 5 May 2006 16:35:11 +0000 (16:35 +0000)]
Remove VOP_BWRITE().  This function provided a way for a VFS to override
the bwrite() function and was used *only* by NFS in order to allow NFS to
handle the B_NEEDCOMMIT flag as part of NFSv3's 2-phase commit operation.
However, over time, the handling of this flag was moved to the strategy code.
Additionally, the kernel now fully supports the redirtying of buffers
during an I/O (which both softupdates and NFS need to be able to do).

The override is no longer needed.  All former calls to VOP_BWRITE() now
simply call bwrite().

17 years agoCleanup procedure prototypes, get rid of extra spaces in pointer decls.
Matthew Dillon [Fri, 5 May 2006 16:15:56 +0000 (16:15 +0000)]
Cleanup procedure prototypes, get rid of extra spaces in pointer decls.

17 years agocorrect "polling" support
Sepherosa Ziehau [Fri, 5 May 2006 14:53:41 +0000 (14:53 +0000)]
correct "polling" support

17 years agoRemove unused label.
Sascha Wildner [Fri, 5 May 2006 09:28:05 +0000 (09:28 +0000)]
Remove unused label.

17 years agoBlock devices generally truncate the size of I/O requests which go past EOF.
Matthew Dillon [Thu, 4 May 2006 18:32:23 +0000 (18:32 +0000)]
Block devices generally truncate the size of I/O requests which go past EOF.
This is exactly what we want when manually reading or writing a block device
such as /dev/ad0s1a, but is not desired when a VFS issues I/O ops on
filesystem buffers.  In such cases, any EOF condition must be considered an
error.

Implement a new filesystem buffer flag B_BNOCLIP, which getblk() and friends
automatically set.  If set, block devices are guarenteed to return an error
if the I/O request is at EOF or would otherwise have to be clipped to EOF.
Block devices further guarentee that b_bcount will not be modified when this
flag is set.

Adjust all block device EOF checks to use the new flag, and clean up the code
while I'm there.  Also, set b_resid in a couple of degenerate cases where
it was not being set.

17 years agoDon't forget to replicate b_cmd, which has been split off of b_flags.
YONETANI Tomokazu [Thu, 4 May 2006 08:00:59 +0000 (08:00 +0000)]
Don't forget to replicate b_cmd, which has been split off of b_flags.

17 years ago- Clarify the definitions of b_bufsize, b_bcount, and b_resid.
Matthew Dillon [Wed, 3 May 2006 20:44:49 +0000 (20:44 +0000)]
- Clarify the definitions of b_bufsize, b_bcount, and b_resid.
- Remove unnecessary assignments based on the clarified fields.
- Add additional checks for premature EOF.

b_bufsize is only used by buffer management entities such as getblk() and
other vnode-backed buffer handling procedures.  b_bufsize is not required
for calls to vn_strategy() or dev_dstrategy().  A number of other subsystems
use it to track the original request size.

b_bcount is the I/O request size, but b_bcount() is allowed to be truncated
by the device chain if the request encompasses EOF (such as on a raw disk
device).  A caller which needs to record the original buffer size verses
the EOF-truncated buffer can compare b_bcount after the I/O against a
recorded copy of the original request size.  This copy can be recorded in
b_bufsize for unmanaged buffers (malloced or getpbuf()'d buffers).

b_resid is always relative to b_bcount, not b_bufsize.  A successful read
that is truncated to the device EOF will thus have a b_resid of 0 and a
truncated b_bcount.

17 years agoDocument the handling of a file holes in ufs_strategy() and clean up
Matthew Dillon [Wed, 3 May 2006 19:57:54 +0000 (19:57 +0000)]
Document the handling of a file holes in ufs_strategy() and clean up
the code flow a little.

17 years agoInvert a mistaken test. Set b_resid to 0 if B_ERROR is not set.
Matthew Dillon [Wed, 3 May 2006 16:34:16 +0000 (16:34 +0000)]
Invert a mistaken test.  Set b_resid to 0 if B_ERROR is not set.

17 years agoRemove the accounting argument from lf_create_range() and lf_destroy_range().
Matthew Dillon [Wed, 3 May 2006 15:20:43 +0000 (15:20 +0000)]
Remove the accounting argument from lf_create_range() and lf_destroy_range().
Integrate p_numposixlocks counting into lf_count_change().  Calculate the
correct delta when changing flags on existing locks.

17 years agoMinor cleanup, plus initialize a few additional fields in the proc
Matthew Dillon [Wed, 3 May 2006 15:18:38 +0000 (15:18 +0000)]
Minor cleanup, plus initialize a few additional fields in the proc
structure so we don't get bitten by them in the future.

17 years agoAdd a missing ohci_waitintr() call that allows polled operation of
Matthew Dillon [Wed, 3 May 2006 15:08:43 +0000 (15:08 +0000)]
Add a missing ohci_waitintr() call that allows polled operation of
bulk transfers to have a chance of working.  Kernel crash dumps
to umass() work with this change.

Submitted-by: Gary <gary@velocity-servers.net>
Taken-from: FreeBSD PR:usb/93720

17 years agoFix a biodone/AR_WAIT case. b_cmd was not getting set to BUF_CMD_DONE,
Matthew Dillon [Wed, 3 May 2006 06:28:01 +0000 (06:28 +0000)]
Fix a biodone/AR_WAIT case.  b_cmd was not getting set to BUF_CMD_DONE,
causing ATA-RAID to timeout.

Reported-by: Stefan Krueger, YONETANI Tomokazu
17 years agoFix an information disclosure issue on AMD cpus. The x87 debug registers,
Matthew Dillon [Tue, 2 May 2006 22:52:24 +0000 (22:52 +0000)]
Fix an information disclosure issue on AMD cpus.  The x87 debug registers,
in particular the last instruction and last data pointers, are not restored
by fxrstor() if there was no pending exception.  Add some dummy FP
instructions (about ~7ns) to 'clean' the registers so a process has no
visibility into another process's FP state.

Submitted-by: Gary <gary@velocity-servers.net>
Taken-from: FreeBSD
Security-Advistory: FreeBSD-SA-06:14.fpu

17 years agoFix a bug in close(). When a descriptor is closed, all process leaders
Matthew Dillon [Tue, 2 May 2006 21:30:43 +0000 (21:30 +0000)]
Fix a bug in close().  When a descriptor is closed, all process leaders
sharing that descriptor table must clear any related POSIX locks.  The
code was looping through all the leaders but passing the wrong process
pointer to VOP_ADVLOCK, resulting in an assertion panic later on in exit1().

Reported-by: Stefan Krueger <skrueger@meinberlikomm.de>
17 years agoThe wrong pointer was being used to calculate the page offset, leading
Matthew Dillon [Tue, 2 May 2006 19:21:50 +0000 (19:21 +0000)]
The wrong pointer was being used to calculate the page offset, leading
to a vmapbuf() assertion.  This bug was introduced in a recent commit.

17 years ago- Add workarounds for dropped interrupts on VIA and ATI controllers.
Matthew Dillon [Tue, 2 May 2006 16:12:01 +0000 (16:12 +0000)]
- Add workarounds for dropped interrupts on VIA and ATI controllers.
- Include more vendor IDs.

Submitted-by: Gary <gary@velocity-servers.net>
Taken-from: FreeBSD/NetBSD

17 years agoPlug memory leak in umass.
Matthew Dillon [Tue, 2 May 2006 16:08:44 +0000 (16:08 +0000)]
Plug memory leak in umass.

Submitted-by: Gary <gary@velocity-servers.net>
Taken-from: FreeBSD/NetBSD

17 years agoSupply a stack pointer for a pure thread context so backtrace works.
Matthew Dillon [Mon, 1 May 2006 16:56:01 +0000 (16:56 +0000)]
Supply a stack pointer for a pure thread context so backtrace works.
Otherwise the 'back' command on a paniced kernel thread may get confused.

17 years ago32bit from 64bit value fixup.
Matthew Dillon [Mon, 1 May 2006 16:27:35 +0000 (16:27 +0000)]
32bit from 64bit value fixup.

fixed a bug comparing sav->key_auth and SADB_AALG_NONE. [From KAME]

Submitted-by: Gary Allan <dragonfly@gallan.plus.com>
Taken-from: FreeBSD4

17 years agomore strict sanity check for ESP tail. [From KAME]
Matthew Dillon [Mon, 1 May 2006 16:26:54 +0000 (16:26 +0000)]
more strict sanity check for ESP tail. [From KAME]

Fix IPv6 error statistics being recorded as IPv4.

m_cat() may free the mbuf on 2nd arg, so m_pkthdr manipulation
has to happen before the call to m_cat(). [May not apply.]

Submitted-by: Gary Allan <dragonfly@gallan.plus.com>
Taken-from: FreeBSD4

17 years agoFix fencepost error causing creation of 0-length mbufs when
Matthew Dillon [Mon, 1 May 2006 16:26:29 +0000 (16:26 +0000)]
Fix fencepost error causing creation of 0-length mbufs when
the boundary between header and data fell on the boundary
between two mbufs.

Submitted-by: Gary Allan <dragonfly@gallan.plus.com>
Taken-from: FreeBSD4

17 years ago32bit from 64bit value fixup. Fix typo.
Matthew Dillon [Mon, 1 May 2006 16:26:09 +0000 (16:26 +0000)]
32bit from 64bit value fixup.  Fix typo.

Submitted-by: Gary Allan <dragonfly@gallan.plus.com>
Taken-from: FreeBSD4

17 years agom_cat() may free the mbuf on 2nd arg, so m_pkthdr manipulation
Matthew Dillon [Mon, 1 May 2006 16:25:41 +0000 (16:25 +0000)]
m_cat() may free the mbuf on 2nd arg, so m_pkthdr manipulation
has to happen before the call to m_cat(). [May not apply.]

Fix IPv6 error statistics being recorded as IPv4.

Submitted-by: Gary Allan <dragonfly@gallan.plus.com>
Taken-from: FreeBSD4

17 years agoPlug xform memory leaks. Don't re-initialize an xform for an SA that
Matthew Dillon [Mon, 1 May 2006 16:24:43 +0000 (16:24 +0000)]
Plug xform memory leaks. Don't re-initialize an xform for an SA that
already has one.

Add a missing 'break;'

Submitted-by: Gary Allan <dragonfly@gallan.plus.com>
Taken-from: FreeBSD4

17 years agoFix kldstat option.
Sascha Wildner [Mon, 1 May 2006 09:22:14 +0000 (09:22 +0000)]
Fix kldstat option.

17 years agoRemove ports(7) reference and reword.
Sascha Wildner [Mon, 1 May 2006 09:06:33 +0000 (09:06 +0000)]
Remove ports(7) reference and reword.

17 years agoDocument recently added devices.
Sascha Wildner [Mon, 1 May 2006 02:06:40 +0000 (02:06 +0000)]
Document recently added devices.

Submitted-by: Gary <gary@velocity-servers.net>
17 years agoAdd missing #includes.
Sascha Wildner [Mon, 1 May 2006 01:32:11 +0000 (01:32 +0000)]
Add missing #includes.

17 years agoRemove buf->b_saveaddr, assert that vmapbuf() is only called on pbuf's. Pass
Matthew Dillon [Sun, 30 Apr 2006 20:23:26 +0000 (20:23 +0000)]
Remove buf->b_saveaddr, assert that vmapbuf() is only called on pbuf's.  Pass
the user pointer and length to vmapbuf() rather then having it try to pull
the information out of the buffer.  vmapbuf() is now responsible for setting
b_data, b_bufsize, and b_bcount.

Also fix a bug in cam_periph_mapmem().  The procedure was failing to unmap
earlier vmapped bufs if later vmapbuf() calls in the loop failed.

17 years agoThe pbuf subsystem now initializes b_kvabase and b_kvasize at startup and
Matthew Dillon [Sun, 30 Apr 2006 18:52:37 +0000 (18:52 +0000)]
The pbuf subsystem now initializes b_kvabase and b_kvasize at startup and
no longer reinitializes these fields in initpbuf().

Users of getpbuf() may no longer modify b_kvabase or b_kvasize.  b_data may
still be modified.

17 years agoAdd some missing manual pages.
Sascha Wildner [Sun, 30 Apr 2006 18:46:39 +0000 (18:46 +0000)]
Add some missing manual pages.

Taken-from: FreeBSD

17 years agoRemove b_xflags. Fold BX_VNCLEAN and BX_VNDIRTY into b_flags as
Matthew Dillon [Sun, 30 Apr 2006 18:25:37 +0000 (18:25 +0000)]
Remove b_xflags.  Fold BX_VNCLEAN and BX_VNDIRTY into b_flags as
B_VNCLEAN and B_VNDIRTY.  Remove BX_AUTOCHAINDONE and recode the
swap pager to use one of the caller data fields in the BIO instead.

17 years agoReplace the the buffer cache's B_READ, B_WRITE, B_FORMAT, and B_FREEBUF
Matthew Dillon [Sun, 30 Apr 2006 17:22:18 +0000 (17:22 +0000)]
Replace the the buffer cache's B_READ, B_WRITE, B_FORMAT, and B_FREEBUF
b_flags with a separate b_cmd field.  Use b_cmd to test for I/O completion
as well (getting rid of B_DONE in the process).  This further simplifies
the setup required to issue a buffer cache I/O.

Remove a redundant header file, bus/isa/i386/isa_dma.h and merge any
discrepancies into bus/isa/isavar.h.

Give ISADMA_READ/WRITE/RAW their own independant flag definitions instead of
trying to overload them on top of B_READ, B_WRITE, and B_RAW.  Add a
routine isa_dmabp() which takes a struct buf pointer and returns the ISA
dma flags associated with the operation.

Remove the 'clear_modify' argument to vfs_busy_pages().  Instead,
vfs_busy_pages() asserts that the buffer's b_cmd is valid and then uses
it to determine the action it must take.

17 years agoAdd NetGear FA-511 support
Sepherosa Ziehau [Sun, 30 Apr 2006 02:02:06 +0000 (02:02 +0000)]
Add NetGear FA-511 support

Obtained-from: FreeBSD
Tested-by: Andrew Thompson <andrew@hijacked.us>
17 years agoBring in SHA256 support from FreeBSD.
Matthew Dillon [Sat, 29 Apr 2006 22:19:26 +0000 (22:19 +0000)]
Bring in SHA256 support from FreeBSD.

Submitted-by: Gary Allan <dragonfly@gallan.plus.com>
Taken-from: FreeBSD

17 years agoBring in some fixes from NetBSD:
Matthew Dillon [Sat, 29 Apr 2006 22:05:21 +0000 (22:05 +0000)]
Bring in some fixes from NetBSD:

- Avoid NULL pointer dereference (ehci.c)
- Abort quickly if we don't have a buffer in all the cases. (uhci.c)
- Only do the software reset if we are dying, like we do in ohci and
  ehci (uhci.c)

Submitted-by: Gary <gary@velocity-servers.net>
Taken-from: NetBSD

17 years agoFix typo.
Sascha Wildner [Fri, 28 Apr 2006 20:16:26 +0000 (20:16 +0000)]
Fix typo.

17 years agoNever generate external references for __cursig().
Sascha Wildner [Fri, 28 Apr 2006 18:23:45 +0000 (18:23 +0000)]
Never generate external references for __cursig().

For what it's worth, this fixes buildkernel with -O0.

__inline-clue-by: joerg

17 years agoMove the error check into the else clause because it only applies there.
Sascha Wildner [Fri, 28 Apr 2006 16:45:34 +0000 (16:45 +0000)]
Move the error check into the else clause because it only applies there.

17 years agoGet rid of pbgetvp() and pbrelvp(). Instead fold the B_PAGING flag directly
Matthew Dillon [Fri, 28 Apr 2006 16:34:02 +0000 (16:34 +0000)]
Get rid of pbgetvp() and pbrelvp().  Instead fold the B_PAGING flag directly
into getpbuf() (the only type of buffer that pbgetvp() could be called on
anyway).  Change related b_flags assignments from '=' to '|='.

Get rid of remaining depdendancies on b_vp.  vn_strategy() now relies solely
on the vp passed to it as an argument.  Remove buffer cache code that sets
b_vp for anonymous pbuf's.

Add a stopgap 'vp' argument to vfs_busy_pages().  This is only really needed
by NFS and the clustering code do to the severely hackish nature of the
NFS and clustering code.

Fix a bug in the ext2fs inode code where vfs_busy_pages() was being called
on B_CACHE buffers.  Add an assertion to vfs_busy_pages() to panic if it
encounters a B_CACHE buffer.

17 years agoRemove non-existant variable from debugging message.
Matthew Dillon [Fri, 28 Apr 2006 16:06:50 +0000 (16:06 +0000)]
Remove non-existant variable from debugging message.

Reported-by: Sascha Wildner <saw@online.de>
17 years agoGet rid of the remaining buffer background bitmap code. It's been turned
Matthew Dillon [Fri, 28 Apr 2006 06:13:56 +0000 (06:13 +0000)]
Get rid of the remaining buffer background bitmap code.  It's been turned
off for a while, and it represents a fairly severe hack to the buffer
cache code that just complicates further development.