kib [Mon, 13 Jun 2011 19:40:09 +0000 (19:40 +0000)]
Cherry-pick a single bit from r222958. Do not pass '3' as the sleepflag
to bufobj_wwait() in the ffs_syncvnode(). It only mangles the priority
argument of msleep().
kib [Mon, 13 Jun 2011 19:33:13 +0000 (19:33 +0000)]
MFC r222586:
Fix an infinite loop in vm_object_page_clean() when the
filesystem returns permanent errors for some page writes.
To accomodate the stable/8 locking requirements, vm page queue lock
is taken around the loop in vnode_pager_undirty_pages() which modifies
m->dirty field.
jh [Mon, 13 Jun 2011 15:53:56 +0000 (15:53 +0000)]
MFC r219925:
Recognize "ro", "rdonly", "norw", "rw" and "noro" as equal options in
vfs_equalopts(). This allows vfs_sanitizeopts() to filter redundant
occurrences of these options. It was possible that for example both "ro"
and "rw" options became active concurrently.
rmacklem [Sun, 12 Jun 2011 02:05:59 +0000 (02:05 +0000)]
MFC: r222466
Modify the umount(8) command so that it doesn't do
a sync(2) syscall before unmount(2) for the "-f" case.
This avoids a forced dismount from getting stuck for
an NFS mountpoint in sync() when the server is not
responsive. With this commit, forced dismounts should
normally work for the NFS clients, but can take up to
about 1minute to complete.
rmacklem [Sun, 12 Jun 2011 01:48:31 +0000 (01:48 +0000)]
MFC: r222464
Add a check for MNTK_UNMOUNTF at the beginning of nfs_sync()
in the old NFS client so that a forced dismount doesn't
get stuck in the VFS_SYNC() call that happens before
VFS_UNMOUNT() in dounmount(). Analagous to r222329 for the new NFS client.
An additional change is needed before forced dismounts will work.
gjb [Sat, 11 Jun 2011 00:30:56 +0000 (00:30 +0000)]
MFC 222758, 222759, 222770:
- Document that when running 'su -m <user> -c <command>', <command> is
run within a shell as <user>.
- Bump date
- Attempt to clear up some confusion in the following example, by
stating the '-c' argument is passed to the shell, not to su(1), which
would indicate the login class.
jhb [Fri, 10 Jun 2011 19:16:26 +0000 (19:16 +0000)]
MFC 222532:
- Document the -H option and 'H' key alongside other options and keys
rather than at the bottom of the manpage.
- Remove an obsolete comment about SWAIT being a stale state. It was
resurrected for a different purpose in FreeBSD 5 to mark idle ithreads.
- Add a comment documenting that the SLEEP and LOCK states typically
display the name of the event being waited on with lock names being
prefixed with an asterisk and sleep event names not having a prefix.
jhb [Fri, 10 Jun 2011 19:13:22 +0000 (19:13 +0000)]
MFC 221079:
Generate the network byte order version of the window size structure in a
temporary variable on the stack and then copy that into the output buffer
so that the htons() conversions use aligned accesses.
jhb [Fri, 10 Jun 2011 19:12:00 +0000 (19:12 +0000)]
MFC 222660:
- Rename the Cronyx Omega2-PCI entry to Exar XR17C158 since that is the
real owner of the device ID. Also rename the associated config
function while here.
- Add support for the 2-port and 4-port Exar parts as well: Exar XR17C/D152
and Exar XR17C154.
jhb [Fri, 10 Jun 2011 19:03:17 +0000 (19:03 +0000)]
MFC 222254:
Fix an issue with critical sections and SMP rendezvous handlers.
Specifically, a critical_exit() call that drops the nesting level to zero
has a brief window where the pending preemption flag is set and the
nesting level is set to zero. This is done purposefully to avoid races
where a preemption scheduled by an interrupt could be lost otherwise (see
revision 144777). However, this does mean that if an interrupt fires
during this window and enters and exits a critical section, it may preempt
from the interrupt context. This is generally fine as the interrupt code
is careful to arrange critical sections so that they are not exited until
it is safe to preempt (e.g. interrupts EOI'd and masked if necessary).
However, the SMP rendezvous IPI handler does not quite follow this rule,
and in general a rendezvous can never be preempted. Rendezvous handlers
are also not permitted to schedule threads to execute, so they will not
typically trigger preemptions. SMP rendezvous handlers may use
spinlocks (carefully) such as the rm_cleanIPI() handler used in rmlocks,
but using a spinlock also enters and exits a critical section. If the
interrupted top-half code is in the brief window of critical_exit() where
the nesting level is zero but a preemption is pending, then releasing the
spinlock can trigger a preemption. Because we know that SMP rendezvous
handlers can never schedule a thread, we know that a critical_exit() in
an SMP rendezvous handler will only preempt in this edge case. We also
know that the top-half thread will happily handle the deferred preemption
once the SMP rendezvous has completed, so the preemption will not be lost.
This makes it safe to employ a workaround where we use a nested critical
section in the SMP rendezvous code itself around rendezvous action
routines to prevent any preemptions during an SMP rendezvous. The
workaround intentionally avoids checking for a deferred preemption
when leaving the critical section on the assumption that if there is a
pending preemption it will be handled by the interrupted top-half code.
jhb [Fri, 10 Jun 2011 18:55:58 +0000 (18:55 +0000)]
MFC 222032:
Fix a race in the SMP rendezvous code. Specifically, the write by the
last CPU to to finish the rendezvous action may become visible to
different CPUs at different times. As a result, the CPU that initiated
the rendezvous may exit the rendezvous and drop the lock allowing another
rendezvous to be initiated on the same CPU or a different CPU. In that
case the exit sentinel may be cleared before all CPUs have noticed causing
those CPUs to hang forever.
Workaround this by using a generation count to notice when this race
occurs and to exit the rendezvous in that case.
jhb [Fri, 10 Jun 2011 18:51:22 +0000 (18:51 +0000)]
MFC 220794:
When checking to see if a window update should be sent to the remote peer,
don't force a window update if the window would not actually grow due to
window scaling. Specifically, if the window scaling factor is larger than
2 * MSS, then after the local reader has drained 2 * MSS bytes from the
socket, a window update can end up advertising the same window. If this
happens, the supposed window update actually ends up being a duplicate ACK.
This can result in an excessive number of duplicate ACKs when using a
higher maximum socket buffer size.
jhb [Fri, 10 Jun 2011 18:46:40 +0000 (18:46 +0000)]
MFC 221209:
TCP reuses t_rxtshift to determine the backoff timer used for both the
persist state and the retransmit timer. However, the code that implements
"bad retransmit recovery" only checks t_rxtshift to see if an ACK has been
received in during the first retransmit timeout window. As a result, if
ticks has wrapped over to a negative value and a socket is in the persist
state, it can incorrectly treat an ACK from the remote peer as a
"bad retransmit recovery" and restore saved values such as snd_ssthresh and
snd_cwnd. However, if the socket has never had a retransmit timeout, then
these saved values will be zero, so snd_ssthresh and snd_cwnd will be set
to 0.
If the socket is in fast recovery (this can be caused by excessive
duplicate ACKs such as those fixed by 220794), then each ACK that arrives
triggers either NewReno or SACK partial ACK handling which clamps snd_cwnd
to be no larger than snd_ssthresh. In effect, the socket's send window
is permamently stuck at 0 even though the remote peer is advertising a
much larger window and pending data is only sent via TCP window probes
(so one byte every few seconds).
Fix this by adding a new TCP pcb flag (TF_PREVVALID) that indicates that
the various snd_*_prev fields in the pcb are valid and only perform
"bad retransmit recovery" if this flag is set in the pcb. The flag is set
on the first retransmit timeout that occurs and is cleared on subsequent
retransmit timeouts or when entering the persist state.
rmacklem [Fri, 10 Jun 2011 13:28:14 +0000 (13:28 +0000)]
MFC: r222389
Fix the new NFS client so that it handles NFSv4 state
correctly during a forced dismount. This required that
the exclusive and shared (refcnt) sleep lock functions check
for MNTK_UMOUNTF before sleeping, so that they won't block
while nfscl_umount() is getting rid of the state. As
such, a "struct mount *" argument was added to the locking
functions. I believe the only remaining case where a forced
dismount can get hung in the kernel is when a thread is
already attempting to do a TCP connect to a dead server
when the krpc client structure called nr_client is NULL.
This will only happen just after a "mount -u" with options
that force a new TCP connection is done, so it shouldn't
be a problem in practice.
mav [Fri, 10 Jun 2011 10:43:49 +0000 (10:43 +0000)]
MFC r208582 (by mjacob):
Add a new primitive, XPT_SCAN_TGT, to cover the range between scanning a
whole bus (XPT_SCAN_BUS) and a single lun on that bus (XPT_SCAN_LUN).
It's less resource comsumptive than scanning a whole bus when the
caller knows only one target has changes.
mav [Fri, 10 Jun 2011 10:13:40 +0000 (10:13 +0000)]
MFC r222520:
Add quirks to hint 4K physical sector (Advanced Format) for ATA disks not
reporting it properly (none? of known disks now).
Hitachi and WDC AF disks seem could be identified more or less formally.
For Seagate and Samsung enumerate some found models/series.
For other disks it can be forced with kern.cam.ada.X.quirks=1 tunable.
mav [Fri, 10 Jun 2011 09:57:48 +0000 (09:57 +0000)]
MFC r220686 (by jh):
Move TUNABLE_INT_FETCH() out of the SIM lock to avoid sleeping while
holding the lock. The fix is analogous to r220618 for ada(4).
mav [Fri, 10 Jun 2011 09:51:15 +0000 (09:51 +0000)]
MFC r206112, r208928 (by mjacob):
Rearrange how things are done to avoid dereferencing stale pointers in
the case of immediate unconfigure after configure. Hold the periph an
extra count while we have the task to create sysctl context outstanding
so that the periph doesn't go away unexpectedly.
mav [Fri, 10 Jun 2011 09:18:43 +0000 (09:18 +0000)]
MFC r222652:
Update disk's stripesize and stripeoffset parameters on provider open.
They are media-dependent and may change in run-time, same as sectorsize
and/or mediasize.
SCSI devices return physical sector size and offset via READ CAPACITY(16)
command and so can not report it until media inserted or at least until
probe sequence completed. UNMAP support is also reported there.
mav [Fri, 10 Jun 2011 09:12:09 +0000 (09:12 +0000)]
MFC r221101:
Implement relaxed comparision for hardcoded provider names to make it
ignore adX/adaY difference in both directions to simplify migration to
the CAM-based ATA or back.
mav [Fri, 10 Jun 2011 08:58:13 +0000 (08:58 +0000)]
MFC r222304:
Marvell 88SE91xx controllers are known to report soft-reset completion
without waiting for device readiness (or at least not updating FIS receive
area in time). To workaround that, special quirk was added earlier to wait
for the FIS receive area update. But it was found that under same PCI ID
0x91231b4b and revision 0x11 there are two completely different chip
versions (firmware?): HBA and RAID. The problem is that RAID version in
some cases, such as hot-plug, does not update FIS receive area at all!
To workaround that, differentiate the chip versions by their capabilities,
and, if RAID version found, skip FIS receive area update waiting and read
device signature from the PxSIG register instead. This method doesn't work
for HBA version when PMP attached, so keep using previous workaround there.
mav [Fri, 10 Jun 2011 08:54:52 +0000 (08:54 +0000)]
MFC r222285:
According to SATA specification, when Serial ATA Enclosure Management Bridge
(SEMB) is unable to communicate to Storage Enclosure Processor (SEP), in
response to hard and soft resets it should among other things return value
0x7F in Status register. The weird side is that it means DRQ bit set, which
tells that reset request is not completed. It would be fine if SEMB was the
only device on port. But if SEMB connected to PMP or built into it, it may
block access to other devices sharing same SATA port.
Make some tunings/fixes to soft-reset handling to workaround the issue:
- ahci(4): request CLO on the port after soft reset to ignore DRQ bit;
- siis(4): gracefully reinitialize port after soft reset timeout (hardware
doesn't detect reset request completion in this case);
- mvs(4): if PMP is used, send dummy soft-reset to the PMP port to make it
clear DRQ bit for us.
For now this makes quirks in ata_pmp.c, hiding SEMB ports of SiI3726/SiI4726
PMPs, less important.
mav [Fri, 10 Jun 2011 08:49:38 +0000 (08:49 +0000)]
MFC rr222039:
Add support for "LED" enclosure management messages, defined by the AHCI.
When supported by hardware, this allows to control per-port activity, locate
and fault LEDs via the led(4) API for localization and status reporting
purposes. Supporting AHCI controllers may transmit that information to the
backplane controllers via SGPIO interface. Backplane controllers interpret
received statuses in some way (IBPI standard) to report them using present
indicators.
mav [Fri, 10 Jun 2011 08:32:33 +0000 (08:32 +0000)]
MFC r220929:
According to ATA specifications, when ATAPI master is the only device, it
should respond with all zeroes to any access to slave registers. Test with
PATA devices confirmed such behavior. Unluckily, Intel SATA controllers in
legacy emulation mode behave differently, not making any difference between
ATA and ATAPI devices. It causes false positive slave device detection and,
as result, command timeouts.
To workaround this problem, mask result of legacy-emulated soft-reset with
the device presence information received from the SATA-specific registers.
netchild [Fri, 10 Jun 2011 07:54:38 +0000 (07:54 +0000)]
MFC r221423, r221424, r221426, r221428, r221434:
This is v4l2 support for the linuxulator. This allows to access FreeBSD
native devices which support the v4l2 API from processes running within
the linuxulator, e.g. skype or flash can access the multimedia/pwcbsd
or multimedia/webcamd supplied drivers.
ru [Fri, 10 Jun 2011 06:11:33 +0000 (06:11 +0000)]
MFC r222647:
Don't pass -o1- to groff(1) by default. If ms(7) formatted document
uses the .RP macro, a separate cover page is created as page 0 which
is not otherwise output.
emaste [Fri, 10 Jun 2011 03:27:25 +0000 (03:27 +0000)]
MFC r222589:
There are a couple of structs in mfireg.h with members named 'class'.
These cause problems when trying to include the header in a C++ project.
Rename them to 'evt_class', and track the change in mfi and mfiutil.
rmacklem [Thu, 9 Jun 2011 01:10:39 +0000 (01:10 +0000)]
MFC: r222329
Add a check for MNTK_UNMOUNTF at the beginning of nfs_sync()
in the new NFS client so that a forced dismount doesn't
get stuck in the VFS_SYNC() call that happens before
VFS_UNMOUNT() in dounmount().
Additional changes are needed before forced dismounts will work.
jhb [Wed, 8 Jun 2011 21:32:14 +0000 (21:32 +0000)]
MFC 222328:
For Timedia multiport serial adapters, the first two ports use a SUN1889
which uses a non-standard clock (* 8) while any additional ports use
SUN1699 chips which use a standard clock.
jhb [Wed, 8 Jun 2011 21:29:12 +0000 (21:29 +0000)]
MFC 222093:
Add support for the SIIG Cyber 2S PCIe adapter. It is based on an
Oxford Semiconductor OX16PCI954 but uses only two ports with a non-default
clock rate.
jhb [Wed, 8 Jun 2011 21:10:44 +0000 (21:10 +0000)]
MFC 221208:
Add a 'show progress' command that shows a summary of all in-progress
commands for a given adapter. Specifically, it shows the status of any
drive or volume activities currently in progress similar to the
'drive process' and 'volume progress' commands.
jhb [Wed, 8 Jun 2011 20:57:22 +0000 (20:57 +0000)]
MFC 221182,222760:
Add support for Oxford PCI Express Expresso family devices.
For these devices, the number of supported ports is read from a register
in BAR 0.
Fix bug in the netfront driver that caused excessive packet drops during
receive processing.
Remove unnecessary restrictions on the mbuf chain length built during an
LRO receive. This restriction was copied from the Linux netfront driver
where the LRO implementation cannot handle more than 18 discontinuities.
The FreeBSD implementation has no such restriction.
dchagin [Wed, 8 Jun 2011 03:45:40 +0000 (03:45 +0000)]
MFC r219405:
Extend struct sysvec with new method sv_schedtail, which is used for an
explicit process at fork trampoline path instead of eventhadler(schedtail)
invocation for each child process.
Remove eventhandler(schedtail) code and change linux ABI to use newly added
sysvec method.
While here replace explicit comparing of module sysentvec structure with the
newly created process sysentvec to detect the linux ABI.
MFC r219421:
Remove bogus since r219405 check of the Linux ABI.
rmacklem [Wed, 8 Jun 2011 01:14:31 +0000 (01:14 +0000)]
MFC: r222289
Fix the new NFS client so that it correctly sets the "must_commit"
argument for a write RPC when it succeeds for the first one and
fails for a subsequent RPC within the same call to the function.
This makes it compatible with the old NFS client for this case.
jhb [Tue, 7 Jun 2011 21:48:36 +0000 (21:48 +0000)]
MFC 219968:
Fix some locking nits with the p_state field of struct proc:
- Hold the proc lock while changing the state from PRS_NEW to PRS_NORMAL
in fork to honor the locking requirements. While here, expand the scope
of the PROC_LOCK() on the new process (p2) to avoid some LORs. Previously
the code was locking the new child process (p2) after it had locked the
parent process (p1). However, when locking two processes, the safe order
is to lock the child first, then the parent.
- Fix various places that were checking p_state against PRS_NEW without
having the process locked to use PROC_LOCK(). Every place was already
locking the process, just after the PRS_NEW check.
- Remove or reduce the use of PROC_SLOCK() for places that were checking
p_state against PRS_NEW. The PROC_LOCK() alone is sufficient for reading
the current state.
jhb [Tue, 7 Jun 2011 21:15:43 +0000 (21:15 +0000)]
MFC 221138:
Only align MSI message groups based on the number of messages being
allocated, not the maximum number of messages the device supports. The
spec only requires the former, and I believe I implemented the latter due
to misunderstanding an e-mail. In particular, this fixes an issue where
having several devices that all support 16 messages can run out of
IDT vectors on x86 even though the driver only uses a single message.
nwhitehorn [Tue, 7 Jun 2011 14:36:13 +0000 (14:36 +0000)]
MFC r222666:
Fix a typo derived from a mismerge from mmu_oea that would cause
pmap_sync_icache() to sync random (possibly uncached or nonexisting!)
memory, causing kernel page faults or machine checks, most easily
triggered by using GDB. While here, add an additional safeguard to only
sync cacheable memory.
nwhitehorn [Tue, 7 Jun 2011 14:35:18 +0000 (14:35 +0000)]
MFC r222430:
Require an error instead of a timeout to decide the new-style fan
commands won't work. This prevents a busy system from making smu(4)
suddenly decide its fans use the old-style command set.
MFC r222509, r222510, r222513, r222551, r222552, r222701, r222703,
and some direct modifications to minimize diffs with head.
r222509:
L2 table code. This is enough to get the T4's switch + L2 rewrite
filters working. (All other filters - switch without L2 info rewrite,
steer, and drop - were already fully-functional).
r222510:
- Specialized ingress queues that take interrupts for other ingress
queues. Try to have a set of these per port when possible, fall back
to sharing a common pool between all ports otherwise.
- One control queue per port (used to be one per hardware channel).
- t4_eth_rx now handles Ethernet rx only.
- sysctls to display pidx/cidx for some queues.
r222513:
Update to firmware interface 1.3.10
r222551:
Firmware device log.
r222552:
Provide hit-count with rest of the information about a filter.
r222701:
Allow lazy fill up of freelists.
r222703:
Cause backpressure (instead of dropping frames) on congestion.
MFC r208682 (pjd):
Fix panic when reading label from provider with non power of 2 sector size.
MFC r211900 (pjd):
Use ZFS_CTLDIR_NAME instead of hardcoding ".zfs".
MFC r212543 (imp):
Simplify atomic selection
MFC r213791 (rpaulo):
Pass a format string to panic() and to taskqueue_start_threads().
Found with: clang
MFC r216378 (pjd):
Remove redundant semicolon and empty like.
MFC r218007 (jchandra):
CDDL fixes for MIPS n32.
Provide 64 bit atomic ops, and use 32 bit pointer.
MFC r218725 (dim):
When building libzpool on ia64 or sparc64, don't add the .note.GNU-stack
section.
MFC r219089 (pjd):
Finally... Import the latest open-source ZFS version - (SPA) 28.
Few new things available from now on:
- Data deduplication.
- Triple parity RAIDZ (RAIDZ3).
- zfs diff.
- zpool split.
- Snapshot holds.
- zpool import -F. Allows to rewind corrupted pool to earlier
transaction group.
- Possibility to import pool in read-only mode.
MFC r219090 (pjd):
Commit two more files missed in r219089.
MFC r219092 (pjd):
Use proper lock in assertion.
MFC r219316 (pjd):
Simplify zvol_remove_minors() a bit.
MFC r219317 (pjd):
Make renaming of a ZVOL, ZVOL's parent directory and ZVOL snapshot work.
MFC r219320 (pjd):
Fix libzpool build.
MFC r219404 (pjd):
Correct readdir over ZFS handling.
MFC r219636 (pjd):
Fix potential panic in dbuf_sync_list() relate to spill blocks handling.
MFC r219703 (ae):
The size of zfsboot2 grown up to 64 Kbytes in r219089.
Increase NSECT up to 128 sectors too.
MFC r219959 (pjd):
Properly print characters larger than 127.
MFC r219973 (pjd):
Checking file access on size change is bogus. The checks are done earlier by
VFS where we know if this is truncate(2) or ftruncate(2). If this is the
latter we should depend on the mode the file was opened and not on the current
permission.
MFC r220447 (mm):
Partially fix ZFS compat code for sparc64.
Some endianess bugs still need to be resolved.
MFC r220575 (pjd):
Fix 'zfs list <path>' handling. If the path was found, the 'ret' variable was
uninitialized.
MFC r221112 (marcel):
Fix copy-paste bug.
MFC r221177 (jhb):
Due to space constraints, the UFS boot2 and boot1 use an evil hack where
boot2 calls back into boot1 to perform disk reads. The ZFS MBR boot blocks
do not have the same space constraints, so remove this hack for ZFS.
While here, remove commented out code to support C/H/S addressing from
zfsldr. The ZFS and GPT bootstraps always just use EDD LBA addressing.
MFC r221409 (marius):
Convert the last use of xcopyout() to ddi_copyout() and remove the now
unused xcopyin() as well as xcopyout().
MFC r222050 (mm):
Restore old (v15) behaviour for a recursive snapshot destroy.
(zfs destroy -r pool/dataset@snapshot)
To destroy all descendent snapshots with the same name the top level
snapshot was not required to exist. So if the top level snapshot does
not exist, check permissions of the parent dataset instead.
Filed as Illumos Bug #1043
MFC r222267 (pjd):
Don't access task structure once we call task function.
The task structure might be no longer available.
This also allows to eliminates the need for two tasks in the zio structure.
MFC r222268 (pjd):
Don't pass pointer to name buffer which is on the stack to another thread,
because the stack might be paged out once the other thread tries to use the
data. Instead, just allocate memory.
delphij [Mon, 6 Jun 2011 05:40:52 +0000 (05:40 +0000)]
MFC r222210, 222211, 222287:
- Diff reduction against NetBSD. The most notable change is to zdiff(1)
to handle more file formats including bzip2 and xz.
- Match symbolic link handling behavior with GNU gzip, bzip2 and xz:
When we are operating on a symbolic link pointing to an existing
file, bail out by default, but go ahead if -f is specified.
bcr [Sat, 4 Jun 2011 11:28:44 +0000 (11:28 +0000)]
MFC r222447:
Mention that jumbo frame support is disabled on PCIe VT6130/VT6132
controllers because of TX MAC hangs when trying to send a frame
that is larger than 4K (see r200759).
PR: docs/156742
Submitted by: Michael Moll (kvedulv at kvedulv dot de)
Reviewed by: yongari@
rmacklem [Thu, 2 Jun 2011 20:57:36 +0000 (20:57 +0000)]
MFC: r222075
Add a sanity check for the existence of an "addr" option
to both NFS clients. This avoids the crash reported by
Sergey Kandaurov (pluknet@gmail.com) to the freebsd-fs@
list with subject "[old nfsclient] different nmount()
args passed from mount vs mount_nfs" dated May 17, 2011.
mav [Thu, 2 Jun 2011 07:19:19 +0000 (07:19 +0000)]
MFC r209339:
Core i5, same as previously Core2Duo, found to not set P-state for single
core lower then set on other cores. Do not try to test P-states on attach
on SMP systems. It is hopeless now and will just pollute verbose logs.
If needed, check still can be forced via loader tunable.
mdf [Wed, 1 Jun 2011 18:26:59 +0000 (18:26 +0000)]
Partial MFC of r212370. np@ requested this functionality so I kept in
the cxgb change, but otherwise MFC'd only the new function
sbuf_new_for_sysctl(9) and none of the changed code.
MFC r217830:
Document sbuf_new_for_sysctl(9).
Partial MFC of r217916:
Explicitly wire the user buffer rather than doing it implicitly in
sbuf_new_for_sysctl(9). This allows using an sbuf with a SYSCTL_OUT
drain for extremely large amounts of data where the caller knows that
appropriate references are held, and sleeping is not an issue.
mdf [Wed, 1 Jun 2011 17:36:52 +0000 (17:36 +0000)]
MFC r212365, r212367:
r212365: Refactor sbuf code so that most uses of sbuf_extend() are in
a new sbuf_put_byte(). This makes it easier to add drain
functionality when a buffer would overflow as there are fewer code
points.
r212367: Add drain functionality to sbufs. The drain is a function
that is called when the sbuf internal buffer is filled. For kernel
sbufs with a drain, the internal buffer will never be expanded. For
userland sbufs with a drain, the internal buffer may still be expanded
by sbuf_[v]printf(3).
Sbufs now have three basic uses:
1) static string manipulation. Overflow is marked.
2) dynamic string manipulation. Overflow triggers string growth.
3) drained string manipulation. Overflow triggers draining.
In all cases the manipulation is 'safe' in that overflow is detected and
managed.
Note that r212367 had to be minorly re-implemented to dynamically
allocate space for a function pointer, a void * argument, and an int
error, to not break the ABI/KBI.