jhb [Mon, 17 Mar 2008 22:42:01 +0000 (22:42 +0000)]
Simplify the interrupt code a bit:
- Always include the ie_disable and ie_eoi methods in 'struct intr_event'
and collapse down to one intr_event_create() routine. The disable and
eoi hooks simply aren't used currently in the !INTR_FILTER case.
- Expand 'disab' to 'disable' in a few places.
- Use function casts for arm and i386:intr_eoi_src() instead of wrapper
routines since to trim one extra indirection.
Compiled on: {arm,amd64,i386,ia64,ppc,sparc64} x {FILTER, !FILTER}
Tested on: {amd64,i386} x {FILTER, !FILTER}
scottl [Mon, 17 Mar 2008 17:18:16 +0000 (17:18 +0000)]
Locking in the ses_ioctl handler doesn't have to be so strict because
the referenced data is only obtained/changed in the device open handler,
and the ioctl handler can only run after the open handler. Also fix a
few nearby style issues.
kib [Mon, 17 Mar 2008 13:17:10 +0000 (13:17 +0000)]
Fix two races in the handling of the d_gianttrick for the D_NEEDGIANT
drivers.
In the giant_XXX wrappers for the device methods of the D_NEEDGIANT
drivers, do not dereference the cdev->si_devsw. It is racing with
the destroy_devl() clearing of the si_devsw. Instead, use the
dev_refthread() and return ENXIO for the destroyed device. [1]
The check for the D_INIT in the prep_cdevsw() was not synchronized with
the call of the fini_cdevsw() in destroy_devl(), that under rapid device
creation/destruction may result in the use of uninitialized cdevsw [2].
Change the protocol for the prep_cdevsw(), requiring it to be called
under dev_mtx, where the check for D_INIT is done.
Do not free the memory allocated for the gianttrick cdevsw while holding
the dev_mtx, put it into the free list to be freed later. Reuse the
d_gianttrick pointer to keep the size and layout of the struct cdevsw
(requested by phk). Free the memory in the dev_unlock_and_free(), and do
all the free after the dev_mtx is dropped (suggested by jhb).
phk [Mon, 17 Mar 2008 10:33:23 +0000 (10:33 +0000)]
Add a "spindown" facility to ata-disks: If no requests have been received
for a configurable number of seconds, spin the disk down. Spin it back
up on the next request.
Notice that the timeout is only armed by a request, so to spin down a
disk you may have to do:
marcel [Mon, 17 Mar 2008 00:46:52 +0000 (00:46 +0000)]
Make remote GDB work for AIM processors. For BookE, the kernel
will have a special section, named .PPC.EMB.apuinfo, which will
tell GDB that a BookE processor is targeted and which will
result in GDB using a different register definition. In order
to support remote GDB for BookE, we need the GDB stub in the
kernel look for that section and use the BookE definitions.
mav [Sun, 16 Mar 2008 23:12:17 +0000 (23:12 +0000)]
Remove impossible (hk_peer == NULL) check from ng_address_hook().
Valid hook can't have NULL peer. Even invalid one can't, as it is resets to
deadhook, but not NULL.
mav [Sun, 16 Mar 2008 21:33:12 +0000 (21:33 +0000)]
Add session ID hashing to speedup incoming packets dispatch in case
of many connections working via the same tunnel. For example, in case
of full "client <-> LAC <-> LNS" setup.
pjd [Sun, 16 Mar 2008 21:29:02 +0000 (21:29 +0000)]
- Use wait-free method to manage ui_sbsize and ui_proccnt fields in the
uidinfo structure. This entirely removes contention observed on the
ui_mtxp mutex (as it is now gone).
- Convert the uihashtbl_mtx mutex to a rwlock, as most of the time we just
need to read-lock it.
thompsa [Sun, 16 Mar 2008 19:25:30 +0000 (19:25 +0000)]
Switch the LACP state machine over to its own mutex to protect the internals,
this means that it no longer grabs the lagg rwlock. Use two port table arrays
which list the active ports for Tx and switch between them with an atomic op.
Now the lagg rwlock is only exclusively locked for management (ioctls) and
queuing of lacp control frames isnt needed.
das [Sun, 16 Mar 2008 19:08:53 +0000 (19:08 +0000)]
scandir(3) previously used st_size to obtain an initial estimate
of the array length needed to store all the directory entries.
Although BSD has historically guaranteed that st_size is the size
of the directory file, POSIX does not, and more to the point, some
recent filesystems such as ZFS use st_size to mean something else.
The fix is to not stat the directory at all, set the initial
array size to 32 entries, and realloc it in powers of 2 if that
proves insufficient.
pjd [Sun, 16 Mar 2008 17:55:06 +0000 (17:55 +0000)]
Fix information leak. We can find PIDs of running processes from within
a jail, etc. by simply calling setpriority(PRIO_PROCESS, <PID>, 0) and
checking the return value: 0 means that the process exists and -1 that
it doesn't exist.
alc [Sun, 16 Mar 2008 17:37:19 +0000 (17:37 +0000)]
Simplify the inner loop of vm_fault()'s delete-behind heuristic.
Instead of checking each page for PG_UNMANAGED, perform a one-time
check whether the object is OBJT_PHYS. (PG_UNMANAGED pages only
belong to OBJT_PHYS objects.)
rwatson [Sun, 16 Mar 2008 11:01:32 +0000 (11:01 +0000)]
Remove trailing ';' from C_SYSINIT() macro definition, in keeping
with style(9) recommendation that macros not contain the
terminating ';', leaving that to the invoker. All SYSINIT()
consumers must now provide a trailing ';'.
Unlike the change to remove the ';'s from callers, this change
shouldn't be MFC'd unless we don't mind requiring source changes
to third party modules that might still depend on SYSINIT()
providing its own ';'.
rwatson [Sun, 16 Mar 2008 10:58:09 +0000 (10:58 +0000)]
In keeping with style(9)'s recommendations on macros, use a ';'
after each SYSINIT() macro invocation. This makes a number of
lightweight C parsers much happier with the FreeBSD kernel
source, including cflow's prcc and lxr.
sobomax [Sun, 16 Mar 2008 06:21:30 +0000 (06:21 +0000)]
Properly set size of the file_zone to match kern.maxfiles parameter.
Otherwise the parameter is no-op, since zone by default limits number
of descriptors to some 12K entries. Attempt to allocate more ends up
sleeping on zonelimit.
kientzle [Sat, 15 Mar 2008 11:04:45 +0000 (11:04 +0000)]
Remove the duplicate "archive_format" and "archive_format_name" fields
from the private archive_write structure and fix up all writers to use
the format fields in the base "archive" structure. This error made it
impossible to query the format after setting up a writer because the
write format was stored in an inaccessible place.
kientzle [Sat, 15 Mar 2008 07:10:24 +0000 (07:10 +0000)]
Refactor the mtree code a bit to make the layering clearer: Each
"file" is described by multiple "lines" each possibly containing
multiple "keywords." Incorporate some additions from Joerg Sonnenberger
to handle linked files and correctly deal with backing files on disk.
imp [Sat, 15 Mar 2008 06:44:45 +0000 (06:44 +0000)]
BUS_DMA_ISA is left over from Alpha, and is not used in the tree at
all. The reference in ia64 code is due to cutNpaste in its history
and can safely be removed.
Revired by: cognet, raj, marcel, jhb and maybe one other whom I'm forgetting
kientzle [Sat, 15 Mar 2008 03:49:18 +0000 (03:49 +0000)]
Testability is more important than standards conformance.
Disable the use of PaxHeader.<pid> for the fake pax extension pathname
until I can make the name here settable. Otherwise, tests that try
to compare output to static pre-generated reference files break.
kientzle [Sat, 15 Mar 2008 01:43:59 +0000 (01:43 +0000)]
A subtle point: "pax interchange format" mandates that all strings
(including pathname, gname, uname) be stored in UTF-8. This usually
doesn't cause problems on FreeBSD because the "C" locale on FreeBSD
can convert any byte to Unicode/wchar_t and from there to UTF-8. In
other locales (including the "C" locale on Linux which is really
ASCII), you can get into trouble with pathnames that cannot be
converted to UTF-8.
Libarchive's pax writer truncated pathnames and other strings at the
first nonconvertible character. (ouch!) Other archivers have worked
around this by storing unconvertible pathnames as raw binary, a
practice which has been sanctioned by the Austin group. However,
libarchive's pax reader would segfault reading headers that weren't
proper UTF-8. (ouch!) Since bsdtar defaults to pax format, this
affects bsdtar rather heavily.
To correctly support the new "hdrcharset" header that is going into
SUS and to handle conversion failures in general, libarchive's pax reader
and writer have been overhauled fairly extensively. They used to do
most of the pax header processing using wchar_t (Unicode); they now do
most of it using char so that common logic applies to either UTF-8 or
"binary" strings.
As a bonus, a number of extraneous conversions to/from wchar_t have
been eliminated, which should speed things up just a tad.
Thanks to: Bjoern Jacke for originally reporting this to me
Thanks to: Joerg Sonnenberger for noting a bad typo in my first draft of this
Thanks to: Gunnar Ritter for getting the standard fixed
MFC after: 5 days
jkim [Sat, 15 Mar 2008 01:09:47 +0000 (01:09 +0000)]
- Check device masks and bypass printing headers if capable device does
not exist. /etc/rc.d/mixer tried to restore non-existent recording
source because /var/var/db/mixer*-state contains '=rec' for example.
- Remove hardcoded mixer2 and mixer3 and do the right thing.
- Replace getopt(3) with hand-rolled option parser. It was not able
to handle 'mixer -rec mic' although it is a valid command.
- Make '-s' and '-S' mutualy exclusive as mixer(8) says.
- Do not re-read recording source unless it has been modified.
kientzle [Fri, 14 Mar 2008 23:19:46 +0000 (23:19 +0000)]
Don't lie. If a string can't be converted to a wide (Unicode) string,
return a NULL instead of an incomplete string. Expand the test coverage
to verify the correct behavior here.
kientzle [Fri, 14 Mar 2008 23:09:02 +0000 (23:09 +0000)]
Don't advertise the default block size as a constant; don't
rely on a deprecated value to set the default. This is also
related to a longer-term goal of setting the default block
size based on format and possibly other factors, which makes
it a bad idea to tie this to a published constant.
kientzle [Fri, 14 Mar 2008 23:00:53 +0000 (23:00 +0000)]
New public functions archive_entry_copy_link() and archive_entry_copy_link_w()
override the currently set link value, whether that's a hardlink
or a symlink. Plus documentation update and tests.
kientzle [Fri, 14 Mar 2008 22:40:36 +0000 (22:40 +0000)]
Let archive_entry_clear() accept a NULL pointer and simply do nothing.
In particular, this allows archive_entry_free() to work correctly
for a NULL pointer, which makes it parallel with free(3).
kientzle [Fri, 14 Mar 2008 22:31:57 +0000 (22:31 +0000)]
Rework the versioning implementation and test to match the
new interface. Mark the functions that are going away in
libarchive 3.0.
In particular, archive_version_string() now computes the
string rather than assuming that it will be created by the
build infrastructure. Eventually, this will allow some
simplification of the build infrastructure.
kientzle [Fri, 14 Mar 2008 22:19:50 +0000 (22:19 +0000)]
Rework the versioning information, hopefully for the last time.
* There are now only two public version identifiers: "number" is
a single integer that combines Major/minor/release in a single
value of the form Mmmmrrr. This is easy to compare against for
checking feature support. "string" is a displayable text string
of the form "libarchive M.mm.rr".
* The number is present both as a macro (version of the installed header)
and a function (version of the shared library). The string form
is available only as a function.
* Retain the older version definitions for now, but mark them all
as deprecated, to disappear in libarchive 3.0 (whenever that happens).
* Rework the various deprecation conditionals to use ARCHIVE_VERSION_NUMBER.
An ancillary goal is to reduce the number of @...@ substitutions that
are required. Someday, I might even be able to avoid build-time
processing of archive.h entirely.
emaste [Fri, 14 Mar 2008 21:59:11 +0000 (21:59 +0000)]
Change spelling and eliminate a typo in comments to reduce diffs with
Adaptec's vendor driver. I have some fixes to bring in and this makes
ongoing review of the FreeBSD-Adaptec driver diffs easier.
kientzle [Fri, 14 Mar 2008 20:32:20 +0000 (20:32 +0000)]
A block in a tar file is 512 bytes. Period.
Remove the entirely pointless symbolic constant
and sizeof(unsigned char). (The constant
here is doubly wrong, since not only does
it obscure a basic format constant, it was
never intended to be a tar-specific value,
so could conceivably be changed at some point
in the future.)
jhb [Fri, 14 Mar 2008 19:41:48 +0000 (19:41 +0000)]
Add preliminary support for binding interrupts to CPUs:
- Add a new intr_event method ie_assign_cpu() that is invoked when the MI
code wishes to bind an interrupt source to an individual CPU. The MD
code may reject the binding with an error. If an assign_cpu function
is not provided, then the kernel assumes the platform does not support
binding interrupts to CPUs and fails all requests to do so.
- Bind ithreads to CPUs on their next execution loop once an interrupt
event is bound to a CPU. Only shared ithreads are bound. We currently
leave private ithreads for drivers using filters + ithreads in the
INTR_FILTER case unbound.
- A new intr_event_bind() routine is used to bind an interrupt event to
a CPU.
- Implement binding on amd64 and i386 by way of the existing pic_assign_cpu
PIC method.
- For x86, provide a 'intr_bind(IRQ, cpu)' wrapper routine that looks up
an interrupt source and binds its interrupt event to the specified CPU.
MI code can currently (ab)use this by doing:
intr_bind(rman_get_start(irq_res), cpu);
however, I plan to add a truly MI interface (probably a bus_bind_intr(9))
where the implementation in the x86 nexus(4) driver would end up calling
intr_bind() internally.
Requested by: kmacy, gallatin, jeff
Tested on: {amd64, i386} x {regular, INTR_FILTER}
bz [Fri, 14 Mar 2008 16:25:40 +0000 (16:25 +0000)]
Remove the "Fast " from the
"Fast IPsec: Initialized Security Association Processing." printf.
People kept asking questions about this after the IPsec shuffle.
This still is the Fast IPsec implementation so no worries that it would
be any slower now. There are no functional changes.
bz [Fri, 14 Mar 2008 11:44:30 +0000 (11:44 +0000)]
#if 0 out a currently unsued (and incomplete) function: ip6_ipsec_mtu().
No need to compile 'dead' code.
I am leaving it in because we will have to review the concept and
should use the common function in various places.