Commit graph

145225 commits

Author SHA1 Message Date
Robert Watson 3055e123d7 Do a bit of struct ifnet cleanup in preparation for 8.0: group function
pointers together, move padding to the bottom of the structure, and add
two new integer spares due to attrition over time.  Remove unused spare
"flags" field, we can use one of the spare ints if we need it later.

This change requires a rebuild of device driver modules that depend on
the layout of ifnet for binary compatibility reasons.

Discussed with:	kmacy
2009-03-01 12:42:54 +00:00
Bjoern A. Zeeb 2bebb49117 Add size-guards evaluated at compile-time to the main struct vnet_*
which are not in a module of their own like gif.

Single kernel compiles and universe will fail if the size of the struct
changes. Th expected values are given in sys/vimage.h.
See the comments where how to handle this.

Requested by:	peter
2009-03-01 11:01:00 +00:00
Bjoern A. Zeeb 3cf840d540 Add the infrastructure and expected sizeof() values for each supported
architecture to implement size-guards on the vimage vnet_* structures.

As CTASSERT_EQUAL() needs special compile time options we back it
by CTASSERT() in the default case. Unfortunately CTASSERT() triggers
first, thus add an option to allow compilation with CTASSERT_EQUAL() only.

See the comments how to get new values if you trigger the assert
and what to do in that case.

Reviewed by:	rwatson, zec (earlier versions)
2009-03-01 09:51:50 +00:00
Ed Schouten c4d4bcdaf6 Improve my previous changes to the TTY code: also remove memcpy().
It's better to just use internal language constructs, because it is
likely the compiler has a better opinion on whether to perform inlining,
which is very likely to happen to struct winsize.

Submitted by:	Christoph Mallon <christoph mallon gmx de>
2009-03-01 09:50:13 +00:00
Bjoern A. Zeeb dddba71dc7 Add the new compile-time assertion macro CTASSERT_EQUAL().
It takes a positive integer constant (the expected value) and
another positive integer, usually compile-time evaluated,
e.g. CTASSERT_EQUAL(FOO_EXPECTED_SIZE, sizeof (struct foo));

While the classic CTASSERT() gives:
 error: size of array '__assert60' is negative
this gives you:
 In function '__ctassert_equal_at_line_60':
 warning: '__expected_42_but_got[464ul]' is used uninitialized in this function
and you can directly see the difference in the expected and the
real value.

CTASSERT_EQUAL() needs special compile time options to trigger
thus keep it locally to this header. If it proves to be of general
interest it can be moved to systm.h.

Submitted by:	jmallett
Reviewed by:	sam, warner, rwatson, jmallett (earlier versions)
2009-03-01 09:35:41 +00:00
Sam Leffler ca38400838 use ansi prototypes
Submitted by:	Pawel Worach <pawel.worach@gmail.com>
2009-03-01 08:01:38 +00:00
Rong-En Fan 624aa124ee - Remove kH (kp_kll) from screen. It has the identical key sequence as
@7 (kp_end). As ncurses has the limitation that it returns the first
  matched key symbol, you can not use END in ncurses based program under
  screen (like ports/misc/mc).

We did similar changes to xterm entry last year for exactly the same reason.

PR:		132199
Submitted by:	Timur I. Bakeyev <timur at FreeBSD.org>
MFC after:	2 month
2009-03-01 07:08:46 +00:00
David Schultz c7b756bf24 Fix a typo in the previous commit.
Submitted by:	Mel <mel@rachie.is-a-geek.net>
2009-03-01 06:27:03 +00:00
Xin LI a8da143ab8 Add a missing .El. 2009-03-01 05:47:14 +00:00
Xin LI 00d949789a "-isoC-99" should be spelled without 'c'. 2009-03-01 05:44:28 +00:00
Bruce M Simpson a4128a43c8 In sys/tree.h:
* Add RB_FOREACH_FROM() which continues traversal *at*
   the y-node provided. There is no pre-increment.
 * Nuke RB_FOREACH_SAFE as it was buggy; it would omit the final node.
 * Replace RB_FOREACH_SAFE() with a working implementation
   derived from RB_FOREACH_FROM().
   The key observation is that we now only check the loop-control
   variable, but still cache the next member pointer.
 * Add RB_FOREACH_REVERSE_FROM() which continues backwards
   traversal *at* the y-node provided. There is no pre-increment.
   Typically this is used to back out of allocations made
   whilst walking an RB-tree.
 * Add RB_FOREACH_REVERSE_SAFE() which performs insertion and
   deletion safe backwards traversal.
2009-03-01 04:57:23 +00:00
Robert Watson 8e5057ed20 Remove unreachable code for generating RST segments from tcp_twcheck();
this code became stale when T/TCP support was removed.

Discussed with:	bz, sam
MFC after:	1 month
2009-02-28 22:58:52 +00:00
Alexander Motin ea74abd5f5 Revert my ata_identify()/ata_reinit() related changes: r189166, r189091
and partially r188903. Revert breaks new drives detection on reinit to the
state as it was before me, but fixes series of new bugs reported by some
people.

Unconditional queueing of ata_completed() calls can lead to deadlock if
due to timeout ata_reinit() was called at the same thread by previous
ata_completed(). Calling of ata_identify() on ata_reinit() in current
implementation opens numerous races and deadlocks.

Problems I was touching here are still exist and should be addresed, but
probably in different way.
2009-02-28 22:07:15 +00:00
Andrew Thompson fef11cb704 Move the NORELEASE check to after the recurse count decrement and bailout, this
is not counted as actually releasing the lock.
2009-02-28 19:10:43 +00:00
Andrew Thompson f35aaff035 A couple of style nits in the last commit
- unwrap short lines
 - move variable initialisation out of the declaration.
2009-02-28 17:20:00 +00:00
Andrew Thompson f5f145ba07 - Remove the usb interface number from the device nodes as it is not needed.
- Do not recreate the device nodes in set_alt_interface as the endpoints do not
  change.

Submitted by:	Hans Petter Selasky
2009-02-28 17:14:03 +00:00
Ed Schouten 802cb57e34 Add memmove() to the kernel, making the kernel compile with Clang.
When copying big structures, LLVM generates calls to memmove(), because
it may not be able to figure out whether structures overlap. This caused
linker errors to occur. memmove() is now implemented using bcopy().
Ideally it would be the other way around, but that can be solved in the
future. On ARM we don't do add anything, because it already has
memmove().

Discussed on:	arch@
Reviewed by:	rdivacky
2009-02-28 16:21:25 +00:00
Ed Schouten b57fd79960 Fix compilation of newkey(8) with WITHOUT_NIS=yes.
Increasing WARNS seems to have broken compilation of this utility.
Instead of lowering WARNS, just fix to code to compile properly.

Submitted by:	<bf2006a yahoo com>
Tested by:	bms
2009-02-28 16:16:37 +00:00
David Schultz 8e31b96c07 Use getline() instead of fgets(). This enables nl(1) to handle
arbitrarily long lines and embedded NULs. The new functionality is
nugatory, but adding it is a simple way to improve the exposure of
getline() in -CURRENT.
2009-02-28 15:53:36 +00:00
Ed Schouten 4b2d6aaf4b Replace bcopy() calls inside the TTY layer with memcpy()/strlcpy().
In all these cases the buffers never overlap. Program names are also
likely to be shorter, so use a regular strlcpy() to copy p_comm.
2009-02-28 14:20:26 +00:00
Alexander Motin 84b59262f1 Rework device probing by moving ata_getparam() call from ata_identify() to
drivers' probe routines. It allows not to sleep and so not drop Giant inside
ata_identify() critical section and so avoid crash if it reentered on
request timeout. Reentering of probe call checked inside of it.

Give device own knowledge about it's type (ata/atapi/atapicam). It is not
a good idea to ask channel status for device type inside ata_getparam().

Add softc memory deallocation on device destruction.
2009-02-28 11:25:05 +00:00
Robert Watson cd86ae77ec Remove PRIV_ROOT -- all system privileges must now be explicitly named
in support of forthcoming work on a fine-grained privilege mechanism.

Facilitated by:	bz, thompsa, rink
2009-02-28 10:44:39 +00:00
Ed Schouten c2c1433327 Fix compilation of fstat.
The udev should now be obtained from the dosmount instead of the denode.
2009-02-28 10:40:37 +00:00
Ed Schouten 6cf4a02c5e Add missing POSIX 1003.1-2008 open(2) flag; O_TTY_INIT.
On FreeBSD, this is the default behaviour. According to the spec, we may
give this flag a value of zero, but I'd rather not do this. If we define
it to a non-zero value, we can always change default behaviour without
changing the ABI. This is very unlikely to happen, though.
2009-02-28 10:10:30 +00:00
David Schultz 7fb2aa104f Tests for getdelim(). 2009-02-28 06:39:39 +00:00
David Schultz e2ef8d9b1d Add a file containing tests for simple format specifiers.
Currently it only has tests for a few sign issues with integer
formats, including PR 131880.
2009-02-28 06:37:10 +00:00
David Schultz f04a5a6c81 Tests for wcscasecmp(), wcsnlen(), and stpncpy(). 2009-02-28 06:34:04 +00:00
David Schultz 58b0fe7252 Make `less -R' not crash all the time. 2009-02-28 06:27:23 +00:00
David Schultz 353ce11c8b Replace a dozen lines of code with a call to strnlen() / wcsnlen(). 2009-02-28 06:06:57 +00:00
David Schultz 9c5cb6d8ae Add restrict qualifiers.
I missed this file in my previous commit.
2009-02-28 06:05:37 +00:00
David Schultz 69099ba2ec - Add getdelim(), getline(), stpncpy(), strnlen(), wcsnlen(),
wcscasecmp(), and wcsncasecmp().
- Make some previously non-standard extensions visible
  if POSIX_VISIBLE >= 200809.
- Use restrict qualifiers in stpcpy().
- Declare off_t and size_t in stdio.h.
- Bump __FreeBSD_version in case the new symbols (particularly
  getline()) cause issues with ports.

Reviewed by:	standards@
2009-02-28 06:00:58 +00:00
David Schultz 8bc369a3e1 Define a macro for POSIX.1-2008 here until a future groff import
includes one.
2009-02-28 05:47:41 +00:00
David Schultz bb2b0604e1 Add visibility constants for POSIX.1-2008. 2009-02-28 05:24:05 +00:00
David Schultz e00a6d21eb Add restrict qualifiers to the parameters to strlcpy() and strlcat().
The annotation mainly just serves as a hint that they're not intended
for use with overlapping strings.
2009-02-28 05:15:02 +00:00
David Schultz dce7ffd6df Mark memmem() __pure. 2009-02-28 05:08:35 +00:00
David Schultz 0881683b36 Make sure %zd treats negative arguments properly on 32-bit platforms.
Fix harmless but related bugs in %_$zd and %_$tu.

PR:		131880
MFC after:	1 week
2009-02-28 04:58:18 +00:00
Robert Noland 51e39089c9 Initialize the vblank structures at load time. Previously we did this
at irq install/uninstall time, but when we vt switch, we uninstall the
irq handler.  When the irq handler is reinstalled, the modeset ioctl
happens first.  The modeset ioctl is supposed to tell us that we can
disable vblank interrupts if there are no active consumers.  This will
fail after a vt switch until another modeset ioctl is called via dpms
or xrandr.  Leading to cases where either interrupts are on and can't
be disabled, or worse, no interrupts at all.

MFC after:	2 weeks
2009-02-28 02:37:55 +00:00
Robert Noland 45de2347c4 Add a tuneable to allow disabling msi on drm at runtime.
Suggested by:	jhb@

MFC after:	2 weeks
2009-02-27 23:50:55 +00:00
Alexander Motin 8363eacca1 Copy/paste bug fix for previos commit. 2009-02-27 23:49:26 +00:00
Warner Losh d03c67b198 Move to new usb stack that puts the front-end bus attachments with the
usb stack rather than with the rest of the processor support code.
Not sure that's a good idea, as we were moving away from it, but this
fixes the build in the mean time so we can have that discussion.
2009-02-27 23:12:28 +00:00
Andrew Thompson 50230f983b Change the last references to PRIV_ROOT. /dev/usb used to be world writable so
further root checks were needed, this isnt the case anymore but just change it
to PRIV_DRIVER until it can be investigated later.

Spotted by:	rwatson
2009-02-27 22:12:15 +00:00
Andrew Thompson a09d8d7315 Remove ic_update_mcast calls that are not implemented.
Spotted by:	sam
Pointy hat:	me
2009-02-27 21:50:15 +00:00
Andrew Thompson 77ddf3d34a Partial sync to //depot/projects/usb
- Reissue the ctrl request on failure
- Ensure Tx and ctrl requests are not interleaved
- Add promisc callbacks

Obtained from:	Hans Petter Selasky
2009-02-27 21:14:29 +00:00
Randall Stewart 8aae94933f Fix the add stream feature of strm-reset to really work:
- Fix the copy, we can't do a blind copy but must transfer
   the data from the old to the new.
 - Fix the ACK processing so we properly stop retransmitting
   the thing.
 - Fix it so if we get a retran we will properly reply with
   the saved response without doing anything.

MFC after:	1 month
2009-02-27 20:54:45 +00:00
John Baldwin c72ae1423b - Hold a reference on the cdev a filesystem is mounted from in the mount.
- Remove the cdev pointers from the denode and instead use the mountpoint's
  reference to call dev2udev() in getattr().

Reviewed by:	kib, julian
2009-02-27 20:00:15 +00:00
Alexander Motin 2c4c54b7a8 Merge rev. 188615, 188812 changes from old-USB to USB2 driver. 2009-02-27 19:27:33 +00:00
Sam Leffler f5f5ccc004 really enable usb1 2009-02-27 19:26:23 +00:00
David Christensen 0e38e31f49 - Update copyright to 2009.
- Only enable split header operation when ZERO_COPY_SOCKETS is enabled in
  the kernel.

Submitted by:	davidch
MFC after:	1 week
2009-02-27 19:25:06 +00:00
Sam Leffler 64881623dc o enable PREEMPTION
o turn off a bunch of stuff that's unlikely to be used
o add flash support
o use mii instead of miibus to save space
o enable tdma support
o configure legacy usb as usb2 works only on 2348 w/ 64M configs
2009-02-27 19:23:55 +00:00
Sam Leffler ec38a2fd9b o add -HEAD to avoid build conflicts
o switch to a more common flash config
2009-02-27 19:21:35 +00:00