Commit Graph

52283 Commits

Author SHA1 Message Date
Ruslan Ermilov
eee6c3361b Bitrot: the ethernet parse type is long standard. 2005-02-12 12:35:56 +00:00
Ruslan Ermilov
7becf838ce Two problems here:
1.  Dependency on netgraph module was broken (wrong version).
2.  Netgraph node type was never destroyed on unload.  This
    was masked by problem #1.

Fixed both by using NETGRAPH_INIT().  Now netgraph node type
is created on module load, as in the rest of netgraph modules.
2005-02-12 12:04:10 +00:00
Gleb Smirnoff
810d5e89f4 Add two new netgraph messages NGM_ETHER_ADD_MULTI and NGM_ETHER_DEL_MULTI,
to join and leave Ethernet multicast membership, respectively. Messages
take MAC address as argument.

Sponsored by:	Rinet ISP
2005-02-12 11:41:32 +00:00
Ruslan Ermilov
953a8b2e6d Removed redundant MODULE_VERSION(). 2005-02-12 11:14:25 +00:00
Gleb Smirnoff
687809752d Make netgraph ISR and callout MPSAFE.
Reviewed by:	rwatson, ru
2005-02-12 09:52:36 +00:00
Warner Losh
1d0fc8fda7 Add comment about MAC mining 2005-02-12 08:27:46 +00:00
Scott Long
ac8be89de5 Remove a shadow declaration of 'error' that caused certain tests to be
pointless.

Submitted by: Coverity Prevent analysis tool
2005-02-12 04:51:19 +00:00
Alan Cox
b85a2011c1 Add lock assertion.
Tested by: jhb
2005-02-12 03:48:54 +00:00
Christian S.J. Peron
84f85aedef Add much needed descriptions for a number of the IPC related sysctl OIDs.
This information will be very useful for people who are tuning applications
which have a dependence on IPC mechanisms.

The following OIDs were documented:

Message queues:
 kern.ipc.msgmax
 kern.ipc.msgmni
 kern.ipc.msgmnb
 kern.ipc.msgtlq
 kern.ipc.msgssz
 kern.ipc.msgseg

Semaphores:
 kern.ipc.semmap
 kern.ipc.semmni
 kern.ipc.semmns
 kern.ipc.semmnu
 kern.ipc.semmsl
 kern.ipc.semopm
 kern.ipc.semume
 kern.ipc.semusz
 kern.ipc.semvmx
 kern.ipc.semaem

Shared memory:
 kern.ipc.shmmax
 kern.ipc.shmmin
 kern.ipc.shmmni
 kern.ipc.shmseg
 kern.ipc.shmall
 kern.ipc.shm_use_phys
 kern.ipc.shm_allow_removed
 kern.ipc.shmsegs

These new descriptions can be viewed using sysctl -d

PR:		kern/65219
Submitted by:	Dan Nelson <dnelson at allantgroup dot com> (modified)
No objections:	developers@
Descriptions reviewed by: gnn
MFC after:	1 week
2005-02-12 01:22:39 +00:00
Vinod Kashyap
fc01f80ec3 Bumped up the driver version, following recent changes. 2005-02-12 01:16:28 +00:00
Warner Losh
c5377c2c88 Really old PCMCIA cards stored the MAC address in the attribute memory
at some offset.  Unlike newer cards, the MAC address wasn't part of
the CIS as a specific FUNCE.  These older cards were having their MAC
address show up as 0:2:4:6:8:a because that's what's in the ROM
locations that would be there in a real ne2000.

This patch allows one to specify the offset for the MAC address for
these cards.  Specify one for the IBM Ethernet II card, as it is one
that has this problem.  One shouldn't specify this unless the MAC
address really isn't in the CIS at all.

Side note: The novell probe likely shouldn't read the MAC address, and
that should be moved to the bus specific attach routine(s), maybe as a
convenience function in if_ed_novell.c.

My IBM Ethernet II (aka Info Mover) now has a believable MAC address.
2005-02-12 00:45:22 +00:00
Gleb Smirnoff
06a411d34c style: fix indentation and spacing.
Submitted by:	ru
2005-02-11 23:17:50 +00:00
Gleb Smirnoff
8c6f962996 Do not trust ipfw: check m_len always, not only after m_dup.
Submitted by:	ru
2005-02-11 23:07:22 +00:00
Gleb Smirnoff
aa4e078a04 - do m_pullup() after m_dup()
- clean style in previous commit

Suggested by:	ru
2005-02-11 22:28:58 +00:00
Poul-Henning Kamp
09dbf9afd3 Make sure the last command byte makes it onto the wire. 2005-02-11 22:24:02 +00:00
Gleb Smirnoff
0a1a279e93 pullup to sizeof struct ip before sending to ip_output.
Suggested by:	ru
2005-02-11 21:26:39 +00:00
Ruslan Ermilov
f165cb7c5d Further embellish rev. 1.180: protect against -fno-strict-aliasing
being already in CFLAGS (as is the case with "make buildkernel").

NB: rev. 1.180 is only needed due to a broken setting of CFLAGS in
tinderbox.
2005-02-11 21:04:20 +00:00
Gleb Smirnoff
19b5577638 Packets from ipfw come with IP header in host byte order. Netgraph works
with net byte order. Change byte order to net in ng_ipfw_input(), change
byte order to host before ip_output(), do not change before ip_input().

In collaboration with:	ru
2005-02-11 20:53:41 +00:00
Poul-Henning Kamp
7fbdc92113 sysctl node vm.stats can not be static (for ia64 reasons). 2005-02-11 16:34:14 +00:00
Maxim Sobolev
ac16ff40c5 Add SIGTHR (32) into list of signals permitted to be delivered to the
suid application. The problem is that Linux applications using old Linux
threads (pre-NPTL) use signal 32 (linux SIGRTMIN) for communication between
thread-processes. If such an linux application is installed suid or sgid
and security.bsd.conservative_signals=1 (default), then permission will be
denied to send such a signal and the application will freeze.

I believe the same will be true for native applications that use libthr,
since libthr uses SIGTHR for implementing conditional variables.

PR:		72922
Submitted by:	Andriy Gapon <avg@icyb.net.ua>
MFC after:	2 weeks
2005-02-11 14:02:42 +00:00
Maxim Sobolev
282fae35d6 Semctl with IPC_STAT command should return zero in case of success.
PR:		73778
Submitted by:	Andriy Gapon <avg@icyb.net.ua>
MFC after:	2 weeks
2005-02-11 13:46:55 +00:00
Poul-Henning Kamp
1121c39497 Make non-SOFTUPDATES kernels compile again.
Integrate the stubfile into the main file now that license issues have been
long resolved.
2005-02-11 08:13:31 +00:00
Warner Losh
d74c567254 Diff reduction with p4. 2005-02-11 07:50:03 +00:00
Poul-Henning Kamp
a3a7ba5989 Improve EOS handling. 2005-02-11 06:57:02 +00:00
Warner Losh
bd019eb78c Eliminate the ED_VENDOR_{PCCARD,LINKSYS} types. These cards really
are NOVELL NE2000 with just a tiny quirk that's non vendor specific.
Instead, use the chip_type of DL100XX instead.  This is more inline
with how the AX88190 support was added, and seems a little cleaner.
2005-02-11 06:02:27 +00:00
Warner Losh
8d50b6af00 Skip PNP probes. If there are isapnp or pnpbios instances of this driver,
then we can support them later.  This keeps the pbio probe from claiming
lots of otherwise unused pnpbios devices on my laptop.
2005-02-11 03:56:13 +00:00
Yoshihiro Takahashi
ff126c43cd Fix build error (s/wd80x3.c/if_ed_wd80x3.c/). 2005-02-11 03:44:03 +00:00
Yoshihiro Takahashi
179c6e9063 Merged from sys/dev/sio/sio.c revision 1.458. 2005-02-11 03:41:34 +00:00
Bill Paul
88d8970dea Merge in patch to support AP scanning via ifconfig and the new
net80211 API.

Submitted by: Stephane E. Potvin sepotvin at videotron dot ca
2005-02-11 02:13:12 +00:00
Max Laier
0afa9c9e2c Adjust TX threshold on every TX underrun. Some supported cards (8139-based)
can retransmit on TX underrun and set TOK in addition to TUND.  Also add a
check to prevent overflow of the addressable threshold.

This fixes some reports of rl(4) slowness, believed to be related to ALTQ
before.

PR:		kern/61448
Submitted by:	Tim Draegen-Gilman <timNOeudaemonSPAMnet> (with changes)
MFC after:	1 week
2005-02-11 01:05:52 +00:00
Ian Dowse
57c037be1c When processing a timeout() callout and returning it to the free
list, set `curr_callout' to NULL. This ensures that we won't attempt
to cancel the current callout if the original callout structure
gets recycled while we wait to acquire Giant.

This is reported to fix an intermittent syscons problem that was
introduced by revision 1.96.
2005-02-11 00:14:00 +00:00
Warner Losh
f7167d3e91 Move enable/disable 16bit access routines into if_ed. Slightly
pessmize the error recover path through edintr by calling these
functions, rather than expanding it inline.  This error path already
does a lot in it, so an extra function call will be lost in the noise.
It also happens rarely.
2005-02-10 23:48:13 +00:00
Warner Losh
0cfebadeb9 use
while (complicated-expr)
		continune;
in preference to
	while (complicated-expr);

since the code generated is identical, and the former is easier to read,
especially for complicated-expr that reach to the end of the line...
2005-02-10 23:31:27 +00:00
Julian Elischer
c96e43721a Remove lots of tab/space errors introduced by massive cut-n-paste action.
Noticed from:	diffs of the last commit.
MFC after:	1 week
2005-02-10 22:38:51 +00:00
Bosko Milekic
0341256576 Implement support for buffers larger than PAGE_SIZE in MemGuard. Adds
a little bit of complexity but performance requirements lacking (this is
a debugging allocator after all), it's really not too bad (still
only 317 lines).

Also add an additional check to help catch really weird 3-threads-involved
races: make memguard_free() write to the first page handed back, always,
before it does anything else.

Note that there is still a problem in VM+PMAP (specifically with
vm_map_protect) w.r.t. MemGuard uses it, but this will be fixed shortly
and this change stands on its own.
2005-02-10 22:36:05 +00:00
Julian Elischer
ade68ea226 Take into account that Pinnacle screwed up their PCI ID in the beginning..
Older cards have it reversed.
Also, use some already defined values instead of magic numbers.

PR:	 73324
Submitted by:	arne_woerner@yahoo.com
MFC after:	1 week
2005-02-10 22:26:28 +00:00
Bosko Milekic
3d2a3ff25e Optimize the way reference counting is performed with Mbufs. We
do not need to perform an extra memory fetch in the Packet (Mbuf+Cluster)
constructor to initialize the reference counter anymore.  The reference
counts are located in a separate memory region (in the slab header,
because this zone is UMA_ZONE_REFCNT), so the memory fetch resulted very
often in a cache miss.  Additionally, and perhaps more significantly,
optimize the free mbuf+cluster (packet) case, which is very common, to
no longer require an atomic operation on free (to verify the reference
counter) if the reference on the cluster has never been increased (also
very common).  Reduces an atomic on mbuf free on average.

Original patch submitted by: Gerrit Nagelhout <gnagelhout@sandvine.com>
2005-02-10 22:23:02 +00:00
John-Mark Gurney
f80d282814 bump the Makefile config versions now that config is 600001...
Forgotten by:	des
2005-02-10 21:15:31 +00:00
Gleb Smirnoff
75737f3423 Add strspn() to libkern.
Ok'ed by:	rwatson
2005-02-10 20:39:39 +00:00
Colin Percival
e5e6a46460 Declare "cnt" (a number of bytes to read or write) as an "ssize_t", not
as a "long" in dofileread() and dofilewrite().

Discussed with:	jhb
2005-02-10 20:19:17 +00:00
Vinod Kashyap
6cc7bd9464 1. Revert back to the way the older driver handled XPT_PATH_INQ. This seems to
fix the problem with device discovery seen by some people.
2. Change to make 3ware CLI/3DM work on amd64.
3. Fix a potential problem that could cause the driver to do strlen(NULL) when
   using older firmware.

Reviewed by:scottl
2005-02-10 18:07:33 +00:00
Sam Leffler
b4b64678d0 rev 1.19 fixed wpa supplicant but broke wpa authenticator; when operating
as an authenticator need to always check for the unicast key in the node
(as was the case before)

Submitted by:	Divy Le Ray
2005-02-10 17:00:48 +00:00
Sam Leffler
f9cd9174fa propagate state kept in the bss node when re-creating the node
on state transitions; this is a stopgap measure, need to rethink
how we do management of this state

Identified by:	Divy Le Ray
2005-02-10 16:59:04 +00:00
Poul-Henning Kamp
1ba212823f Make various vnode related functions static 2005-02-10 12:28:58 +00:00
Poul-Henning Kamp
44dc16a986 Make some file/filedesc related functions static 2005-02-10 12:27:58 +00:00
Poul-Henning Kamp
b1cb412630 Make M_NETGRAPH_ETF static 2005-02-10 12:26:57 +00:00
Poul-Henning Kamp
ebbfc2f82d Make various mountpoint related functions static. 2005-02-10 12:25:38 +00:00
Poul-Henning Kamp
5ece08f57a Make a SYSCTL_NODE static 2005-02-10 12:23:29 +00:00
Poul-Henning Kamp
502a35d60f MD5Pad() should never have been exposed. 2005-02-10 12:20:42 +00:00
Poul-Henning Kamp
adf4157738 Make a some SYSCTL_NODEs and some of FFS's VFS_ methods static. 2005-02-10 12:20:08 +00:00
Poul-Henning Kamp
39a79f0c01 Make three SYSCTL_NODEs static 2005-02-10 12:18:36 +00:00
Poul-Henning Kamp
253de0a143 Make npages static and const. 2005-02-10 12:18:17 +00:00
Poul-Henning Kamp
502a590bf1 make cluster_callback() static 2005-02-10 12:17:48 +00:00
Poul-Henning Kamp
2adc2b87c7 Make a SYSCTL_NODE and a mutex static 2005-02-10 12:16:42 +00:00
Poul-Henning Kamp
85eb15a2ce Make another bunch of SYSCTL_NODEs static 2005-02-10 12:16:08 +00:00
Poul-Henning Kamp
0c898376fa Make a bunch of SYSCTL_NODEs static. 2005-02-10 12:15:49 +00:00
Poul-Henning Kamp
07e95ed633 Make various random things static 2005-02-10 12:10:35 +00:00
Poul-Henning Kamp
66ae53f804 make M_NTFSMNT and ntfs_calccfree() static 2005-02-10 12:09:49 +00:00
Poul-Henning Kamp
9def42f333 Make fdesc_root static 2005-02-10 12:09:15 +00:00
Poul-Henning Kamp
923da43e9b Statification 2005-02-10 12:08:55 +00:00
Poul-Henning Kamp
f70f851c60 Make smbfs_debuglevel private. 2005-02-10 12:07:02 +00:00
Poul-Henning Kamp
271c679c17 don't call vprint with NULL. 2005-02-10 12:06:34 +00:00
Poul-Henning Kamp
87c045d5a2 Statize malloc types.
Don't call vprint with NULL.
2005-02-10 12:05:06 +00:00
Poul-Henning Kamp
df32e67c73 Statize devfs_ops_f 2005-02-10 12:04:26 +00:00
Poul-Henning Kamp
c711aea6ca Make a bunch of malloc types static.
Found by:	src/tools/tools/kernxref
2005-02-10 12:02:37 +00:00
Poul-Henning Kamp
8d63297e2d Add __printflike() to vn_printf() 2005-02-10 08:55:40 +00:00
Poul-Henning Kamp
fe0198779c Don't pass NULL to vprint() 2005-02-10 08:55:08 +00:00
Warner Losh
f2566fc59b Extricate probing of the gwether card (Gateway AT) from the middle of
probing the novell ne[12]000 cards.  It should be its own thing, ala
how we do the dl100xx support doing its own thing at the right time.
For the moment, it is just a function, which makes the mainline of the
generic probe easier to follow.

Also, correct a couple of comments that looked wrong.

# there may be a bug in setting up gwether, in that we set
# sc->rec_page_stop based on memsize, rather than sc->mem_size, so if
# these two are different, then the rec_page_stop will be wrong.  I'm
# hesitant to fix it without real hardware to test with.  Since
# gwether isn't in the hardware list of the man page nor in the commit
# messages, it is hard to know for sure.
2005-02-10 06:09:03 +00:00
Warner Losh
1e379d3696 Remove an ifdef that's been here for a long time. So long, in fact,
that it references a function parameter that's not been passed in for
more than 4 years.

This has been if 0'd since 1994.
2005-02-10 05:34:25 +00:00
Archie Cobbs
25b67768f0 Fix incorrect comment.
Submitted by:	James Bowman <jamesb@acelere.net>
2005-02-10 02:43:26 +00:00
Jeff Roberson
5c18d18b1d - Add more information to the getnewbuf() recycling KTR.
Sponsored by:	Isilon Systems, Inc.
2005-02-10 02:22:56 +00:00
Bernd Walter
d84def1440 Implement interrupt routing for DEC_KN20AA.
Tested by:	wilko
MFC after:	2 weeks
2005-02-10 00:35:31 +00:00
Jeff Roberson
a3caf16e99 - In the softupdates case for ffs_truncate() we use vinvalbuf() to
invalidate pending io and dependencies.  However, vinvalbuf() rightfully
   does not call vnode_pager_setsize() for us.  We must do this here.  This
   could potentially have caused numerous kinds of bugs, but it was
   specifically causing msync() deadlocks because msync() was writing
   flushing pages that should not have been valid.

Sponsored by:	Isilon Systems, Inc.
Reported by:	kkenn
2005-02-09 23:05:20 +00:00
John Baldwin
3b1569715e Fix pc98 compile: merge in changes to use the local APIC timer. Also, add
missing initialization of i8254_intsrc while I am here.
2005-02-09 22:48:22 +00:00
Poul-Henning Kamp
954ad216af Constify. 2005-02-09 20:56:32 +00:00
Warner Losh
969eaf2179 Break out obscure ISA cards into their own files, as well as ne2000
and wd80x3 support.  Make the obscure ISA cards optional, and add
those options to NOTES on i386 (note: the ifdef around the whole code
is for module building).  Tweak pc98 ed support to include wd80x3 too.
Add goo for alpha too.

The affected cards are the 3Com 3C503, HP LAN+ and SIC (whatever that
is).  I couldn't find any of these for sale on ebay, so they are
untested.  If you have one of these cards, and send it to me, I'll
ensure that you have no future problems with it...

Minor cleanups as well by using functions rather than cut and paste
code for some probing operations (where the function call overhead is
lost in the noise).

Remove use of kvtop, since they aren't required anymore.  This driver
needs to get its memory mapped act together, however, and use bus
space.  It doesn't right now.

This reduces the size of if_ed.ko from about 51k to 33k on my laptop.
2005-02-09 20:03:40 +00:00
Max Laier
68198dedf8 Access softc embedded struct ifnet via function macro to make it easier to
untangle struct ifnet and softc/arpcom in the future.

Requested by:	brooks
2005-02-09 19:29:13 +00:00
Wilko Bulte
1217303f75 add support for NetMos NM9805 1284 Printer port
Submitted by: Willy Offermans <W.K.Offermans@TUe.nl>

MFC after: 2 weeks
2005-02-09 18:38:28 +00:00
Warner Losh
13bf0bf2a8 Since we no longer use kvtop, we no longer need machine/md_var.h 2005-02-09 17:37:53 +00:00
Warner Losh
b3f44d7907 If either ed_probe_Novell or ed_attach returns an error, release the
resources too.
2005-02-09 17:35:13 +00:00
Scott Long
7e22e3674b Remove some unused variables. 2005-02-09 17:19:12 +00:00
Ruslan Ermilov
195cf61776 In revision 1.29 timeout() was converted to ng_callout().
The difference is that the callout function installed via the
ng_callout() method is guaranteed to NOT fire after the shutdown
method was run (when a node is marked NGF_INVALID).  Also, the
shutdown method and the callout function are guaranteed to NOT
run at the same time, as both require the writer lock.  Thus
we can safely ignore a zero return value from ng_uncallout()
(callout_stop()) in shutdown methods, and go on with freeing
the node.

The said revision broke the node shutdown -- ng_bridge_timeout()
is no longer fired after ng_bridge_shutdown() was run, resulting
in a memory leak, dead nodes, and inability to unload the module.
Fix this by cancelling the callout on shutdown, and moving part
responsible for freeing a node resources from ng_bridge_timer()
to ng_bridge_shutdown().

Noticed by:	ru
Submitted by:	glebius, ru
2005-02-09 15:14:44 +00:00
Poul-Henning Kamp
365b18aa89 style polishing. 2005-02-09 12:22:16 +00:00
Ruslan Ermilov
da42b93280 Use CFLAGS+=. 2005-02-09 11:50:43 +00:00
Scott Long
29c711f038 Remove the messy locking dance around xpt_done() 2005-02-09 11:50:16 +00:00
Scott Long
ef3cf714a4 Provide locking for the ccb_bioq. This allows xpt_done() to be called without
Giant held.  In camisr(), move the ccb_bioq elements to a temporary local list
and then process the elements off of that list.  This enables the list to be
processed by only taking the ccb_bioq_lock once and only for a very short
time.

ccb_bioq_lock is a leaf mutex, so it's fine to call xpt_done() with other
locks held.  This is just a very minor step in the work to lock CAM, but
it allows us to avoid some messy locking/unlock dances in certain drivers.
2005-02-09 11:44:15 +00:00
David E. O'Brien
36c64d7c3e Fix the standalone module build. 2005-02-09 08:35:24 +00:00
Pawel Jakub Dawidek
e35d3a7828 - Remove g_gate_hold()/g_gate_release() from start/done paths. It saves
4 mutex operations per I/O requests.
- Use only one mutex to protect both (incoming and outgoing) queue.
  As MUTEX_PROFILING(9) shows, there is no big contention for this lock.
- Protect sc_queue_count with queue mutex, instead of doing atomic
  operations on it.
- Remove DROP_GIANT()/PICKUP_GIANT() - ggate is marked as MPSAFE and no
  Giant there.
2005-02-09 08:29:39 +00:00
David E. O'Brien
db0cd7e103 Emblish rev 1.180 to -fno-strict-alias w/-Os & -O3 also. 2005-02-09 07:34:22 +00:00
Warner Losh
887a166c34 Remove DLINK_3, its unused. Remove NETGEAR FA410TX, since it is the
same as the LINKSYS COMBO_ECARD (which also seems to be the same as
another linksys product that also has a modem, but I can't find that
one at the moment).  Remove the PCM100, since it is now no longer
used.
2005-02-09 06:16:27 +00:00
Warner Losh
940e7b9e51 o Remove duplicate LINKSYS ETHERFAST entry.
o The COMBO_ECARD comes in many flavors, it seems, so probe both the DL10019
  and the AX88x90 on it.  Since this seems to work with no ill effects, maybe
  the probing should happen more generally rather than being table driven.
  Need to think more about this.
o Remove PCM100 because it is duplicative (the ETHERFAST is the pcm100 and
  apparently has the same IDs).  It was here for NetBSD because they match
  up an expected MAC address OID, but since we don't bother with that, we
  don't need to be so finely discriminating.
o Minor style nit.
2005-02-09 06:03:36 +00:00
Warner Losh
8a3b3c6288 Remove reference to softc from probe entirely... 2005-02-09 05:55:54 +00:00
Marcel Moolenaar
3ec2e857c1 s/descr/oid_descr/ 2005-02-09 04:48:23 +00:00
Robert Watson
da2ecc1aa6 Add missed merge of ripcbinfo extern. Given how widely used
ripcbinfo is, we should probably add it to an include file.

Spotted by:	mux
2005-02-09 01:12:43 +00:00
Warner Losh
b7baa9d5a2 Minor style cleanup. Get rid of extra {}, extra blank lines and some
continued line indentation.  Should be no functional changes.
2005-02-09 00:50:59 +00:00
John-Mark Gurney
9c21341304 move pmap.h after vm.h include... some of the headers from pmap.h depend
upon vm.h
2005-02-09 00:10:17 +00:00
Warner Losh
374cde5568 o Remove ifdef PC98, since this file has diverged quite a bit from
if_ed_isa.c, and they seem to not be helpful anymore.
o Fix style issues from de-Pification.
o change from _isa_ to _cbus_ to the largest extent possible to reflect that
  this is really for cbus, not isa.
o Use ANSI function definitions.
o Use ed_clear_memory
o eliminate kvtop
2005-02-09 00:06:12 +00:00
Warner Losh
50f30261e7 No need to bzero softc. 2005-02-08 23:58:38 +00:00
Warner Losh
851a243f68 Convenience function to clear memory of the card, and then check to make
sure that it works by reading back as 0.
2005-02-08 23:57:43 +00:00
Jeff Roberson
68f2274d97 - Add a new assert in the getnewvnode(). Assert that the usecount is still
0 to detect getnewvnode() races.
 - Add the vnode address to a few panics near by to help in debugging.

Sponsored by:	Isilon Systems, Inc.
2005-02-08 23:27:10 +00:00
Jeff Roberson
b56dc9a785 - Remove an invalid KASSERT added in recent background write reshuffling.
Sponsored by:	Isilon Systems, Inc.
2005-02-08 23:25:08 +00:00
Robert Watson
62a2c81733 Lock raw IP socket pcb list and PCBs when processing input via
icmp6_rip6_input().

Reviewed by:	gnn
MFC after:	1 week
2005-02-08 22:16:26 +00:00
Pawel Jakub Dawidek
647ceb6a94 - Add debug.watchdog tunable, so we can specify watchdog CPU from loader
which will help to debug hangs on boot.
- Remove 'U' from debug.watchdog sysctl definition, so if we set it to '-1'
  it really shows '-1'.
- Fix comment.

Reviewed by:	rwatson
2005-02-08 22:15:24 +00:00
Colin Percival
79653046d8 Add a new sysctl, "security.jail.chflags_allowed", which controls the
behaviour of chflags within a jail.  If set to 0 (the default), then a
jailed root user is treated as an unprivileged user; if set to 1, then
a jailed root user is treated the same as an unjailed root user.

This is necessary to allow "make installworld" to work inside a jail,
since it attempts to manipulate the system immutable flag on certain
files.

Discussed with:	csjp, rwatson
MFC after:	2 weeks
2005-02-08 21:31:11 +00:00
Poul-Henning Kamp
02f2c6a9d8 Split the vop_vector for ffs1 and ffs2, this is mostly for the different
EXTATTR support.
2005-02-08 21:03:52 +00:00
Poul-Henning Kamp
44787ceb0b Use ffs_truncate() directly instead of UFS_TRUNCATE() 2005-02-08 20:51:00 +00:00
Dag-Erling Smørgrav
d04928f224 Remove type 0x4 (FAT12 <32MB) to make room for type 0x7 (NTFS). 2005-02-08 20:43:04 +00:00
Poul-Henning Kamp
dd19a799b8 Background writes are entirely an FFS/Softupdates thing.
Give FFS vnodes a specific bufwrite method which contains all the
background write stuff and then calls into the default bufwrite()
for the rest of the job.

Remove all the background write related stuff from the normal bufwrite.

This drags the softdep_move_dependencies() back into FFS.

Long term, it is worth looking at simply copying the data into
allocated memory and issuing the bio directly and not create the
"shadow buf" in the first place (just like copy-on-write is done
in snapshots for instance).  I don't think we really gain anything
but complexity from doing this with a buf.
2005-02-08 20:29:10 +00:00
John Baldwin
e8ce55117b Use the local APIC timer to drive the various kernel clocks on SMP machines
rather than forwarding interrupts from the clock devices around using IPIs:
- Add an IDT vector that pushes a clock frame and calls
  lapic_handle_timer().
- Add functions to program the local APIC timer including setting the
  divisor, and setting up the timer to either down a periodic countdown
  or one-shot countdown.
- Add a lapic_setup_clock() function that the BSP calls from
  cpu_init_clocks() to setup the local APIC timer if it is going to be
  used.  The setup uses a one-shot countdown to calibrate the timer.  We
  then program the timer on each CPU to fire at a frequency of hz * 3.
  stathz is defined as freq / 23 (hz * 3 / 23), and profhz is defined as
  freq / 2 (hz * 3 / 2).  This gives the clocks relatively prime divisors
  while keeping a low LCM for the frequency of the clock interrupts.
  Thanks to Peter Jeremy for suggesting this approach.
- Remove the hardclock and statclock forwarding code including the two
  associated IPIs.  The bitmap IPI handler has now effectively degenerated
  to just IPI_AST.
- When the local APIC timer is used we don't turn the RTC on at all, but
  we still enable interrupts on the ISA timer 0 (i8254) for timecounting
  purposes.
2005-02-08 20:25:07 +00:00
Poul-Henning Kamp
88e5b12a20 Drag another softupdates tentacle back into FFS: Now that FFS's
vop_fsync is separate from the internal use we can do the full job
there.
2005-02-08 18:09:11 +00:00
Nate Lawson
7990a18c7b Maxunit is inclusive so fix off-by-one in previous commit. 2005-02-08 18:03:17 +00:00
Nate Lawson
5b68bf38ab Update device_find_child(9) to return the first matching child if unit
is set to -1.

Reviewed by:	dfr, imp
2005-02-08 18:00:29 +00:00
Robert Watson
78e21ab011 Simplify the "and if we're in the debugger, don't use locks" logic,
correcting some misthinking.

Discussed with (really this time):	bde
2005-02-08 17:56:04 +00:00
Poul-Henning Kamp
efd6d9808c Don't use the UFS_* and VFS_* functions where a direct call is possble.
The UFS_ functions are for UFS to call back into VFS.  The VFS functions
are external entry points into the filesystem.
2005-02-08 17:40:01 +00:00
Bill Paul
b545a3b822 Next step on the road to IRPs: create and use an imitation of the
Windows DRIVER_OBJECT and DEVICE_OBJECT mechanism so that we can
simulate driver stacking.

In Windows, each loaded driver image is attached to a DRIVER_OBJECT
structure. Windows uses the registry to match up a given vendor/device
ID combination with a corresponding DRIVER_OBJECT. When a driver image
is first loaded, its DriverEntry() routine is invoked, which sets up
the AddDevice() function pointer in the DRIVER_OBJECT and creates
a dispatch table (based on IRP major codes). When a Windows bus driver
detects a new device, it creates a Physical Device Object (PDO) for
it. This is a DEVICE_OBJECT structure, with semantics analagous to
that of a device_t in FreeBSD. The Windows PNP manager will invoke
the driver's AddDevice() function and pass it pointers to the DRIVER_OBJECT
and the PDO.

The AddDevice() function then creates a new DRIVER_OBJECT structure of
its own. This is known as the Functional Device Object (FDO) and
corresponds roughly to a private softc instance. The driver uses
IoAttachDeviceToDeviceStack() to add this device object to the
driver stack for this PDO. Subsequent drivers (called filter drivers
in Windows-speak) can be loaded which add themselves to the stack.
When someone issues an IRP to a device, it travel along the stack
passing through several possible filter drivers until it reaches
the functional driver (which actually knows how to talk to the hardware)
at which point it will be completed. This is how Windows achieves
driver layering.

Project Evil now simulates most of this. if_ndis now has a modevent
handler which will use MOD_LOAD and MOD_UNLOAD events to drive the
creation and destruction of DRIVER_OBJECTs. (The load event also
does the relocation/dynalinking of the image.) We don't have a registry,
so the DRIVER_OBJECTS are stored in a linked list for now. Eventually,
the list entry will contain the vendor/device ID list extracted from
the .INF file. When ndis_probe() is called and detectes a supported
device, it will create a PDO for the device instance and attach it
to the DRIVER_OBJECT just as in Windows. ndis_attach() will then call
our NdisAddDevice() handler to create the FDO. The NDIS miniport block
is now a device extension hung off the FDO, just as it is in Windows.
The miniport characteristics table is now an extension hung off the
DRIVER_OBJECT as well (the characteristics are the same for all devices
handled by a given driver, so they don't need to be per-instance.)
We also do an IoAttachDeviceToDeviceStack() to put the FDO on the
stack for the PDO. There are a couple of fake bus drivers created
for the PCI and pccard buses. Eventually, there will be one for USB,
which will actually accept USB IRP.s

Things should still work just as before, only now we do things in
the proper order and maintain the correct framework to support passing
IRPs between drivers.

Various changes:

- corrected the comments about IRQL handling in subr_hal.c to more
  accurately reflect reality
- update ndiscvt to make the drv_data symbol in ndis_driver_data.h a
  global so that if_ndis_pci.o and/or if_ndis_pccard.o can see it.
- Obtain the softc pointer from the miniport block by referencing
  the PDO rather than a private pointer of our own (nmb_ifp is no
  longer used)
- implement IoAttachDeviceToDeviceStack(), IoDetachDevice(),
  IoGetAttachedDevice(), IoAllocateDriverObjectExtension(),
  IoGetDriverObjectExtension(), IoCreateDevice(), IoDeleteDevice(),
  IoAllocateIrp(), IoReuseIrp(), IoMakeAssociatedIrp(), IoFreeIrp(),
  IoInitializeIrp()
- fix a few mistakes in the driver_object and device_object definitions
- add a new module, kern_windrv.c, to handle the driver registration
  and relocation/dynalinkign duties (which don't really belong in
  kern_ndis.c).
- made ndis_block and ndis_chars in the ndis_softc stucture pointers
  and modified all references to it
- fixed NdisMRegisterMiniport() and NdisInitializeWrapper() so they
  work correctly with the new driver_object mechanism
- changed ndis_attach() to call NdisAddDevice() instead of ndis_load_driver()
  (which is now deprecated)
- used ExAllocatePoolWithTag()/ExFreePool() in lookaside list routines
  instead of kludged up alloc/free routines
- added kern_windrv.c to sys/modules/ndis/Makefile and files.i386.
2005-02-08 17:23:25 +00:00
Robert Watson
45faa442c3 Don't use VOP_LEASE() with operations on extended attribute backing
files.

Pointed out by:	phk
2005-02-08 17:05:38 +00:00
Poul-Henning Kamp
40854ff546 For snapshots we need all VOP_LOCKs to be exclusive.
The "business class upgrade" was implemented in UFS's VOP_LOCK
implementation ufs_lock() which is the wrong layer, so move it to
ffs_lock().

Also, as long as we have not abandonned advanced vfs-stacking we
should not preclude it from happening: instead of implementing a
copy locally, use the VOP_LOCK_APV(&ufs) to correctly arrive at
vop_stdlock() at the bottom.
2005-02-08 16:25:50 +00:00
Poul-Henning Kamp
d6f622cc2f For snapshots we need all VOP_LOCKs to be exclusive.
The "business class upgrade" was implemented in UFS's VOP_LOCK
implementation ufs_lock() which is the wrong layer, so move it to
ffs_lock().

Also, as long as we have not abandonned advanced vfs-stacking we
should not preclude it from happening: instead of implementing a
copy locally, use the VOP_LOCK_APV(&ufs) to correctly arrive at
vop_stdlock() at the bottom.
2005-02-08 15:54:30 +00:00
Poul-Henning Kamp
32a870da8a Use VOP_STRATEGY_APV() instead of direct dereference, this is more
correct.
2005-02-08 15:40:11 +00:00
Poul-Henning Kamp
119798b384 Add VOP_FOO_APV() which takes a pointer to the vop_vector.
This allows stacked or partitioned filesystems to say "Continue
the normal resolution from here", for instace from FFS to UFS.

Use VNASSERT() instead of KASSERT().
2005-02-08 12:54:32 +00:00
Dag-Erling Smørgrav
04550802d8 merge from geom_vol_ffs.c rev 1.14 (avoid unaligned I/O requests) 2005-02-08 12:34:11 +00:00
Ruslan Ermilov
a921fb33b6 bzero() -> M_ZERO. 2005-02-08 10:31:55 +00:00
Dag-Erling Smørgrav
363de7f683 Take care not to issue unaligned I/O requests while tasting a provider. 2005-02-08 08:04:23 +00:00
Nate Lawson
2a05fbb949 Unroll the loop for calculating the 8.3 filename checksum. In testing
on my P3, microbenchmarks show the unrolled version is 78x faster.  In
actual use (recursive ls), this gives an average of 9% improvement in
system time and 2% improvement in wall time.
2005-02-08 07:51:14 +00:00
Warner Losh
ad6da8a0fc Use ANSI function definitions, tweak a couple of prototypes to match (since
K&R prototypes needed to mismatch in the way that they were mismatched),
rename ds_getmcaf to ed_ds_getmcaf.  Remove a few register keywords.
2005-02-08 06:12:44 +00:00
Warner Losh
c1ed2c9eb2 use fixed types for the calls to ed_pio_readmem, ed_pio_writemem.
Make the special hp versions match the general ones.  Also use fixed
types in the WD80x3_generic probe, and change callers' arrays to
match.  Fix a couple of minor style issues by using newstyle function
definitions in a couple places.
2005-02-08 05:59:43 +00:00
Warner Losh
9d512034e3 Make it possible to unload ed. Move the ed_pccard_detach routine to
if_ed and rename it to ed_detach().  Tell other busses to use this
routine for detach.

Since I don't actually have any non-pccard ed hardware I can test
with, I've only tested with my pccards.

More improvements in this area likely are possible.

Prodded by: rwatson
2005-02-08 05:45:35 +00:00
Warner Losh
442b6e9e8c Fix style bugs introduced in the de__Pification of this code.
Style bug generically noted by: bde
2005-02-08 05:41:54 +00:00
Scott Long
8a87dc6fd9 Fix crashdumps on twe. The twe_immediate_request() path was not only
copying data to a temporary buffer before the I/O, but also copying that
temporary buffer back to the original data location after the I/O.  When
you're dumping kernel heap and stack and protected pages, this is very
very bad.

A belated thanks to Robert Watson for donating hardware for this (and future)
work.

MFC after: 3 days
2005-02-08 03:43:02 +00:00
Peter Wemm
699a8a09d6 MFi386: read from RTC_INTR after writing to RTC_STATUSB 2005-02-08 01:21:24 +00:00
Max Laier
c721916790 Fix sloppy use of "manpage", bump .Dd where applicable and rename RED to
Random Early Detection (not ... Drop) in order to be consistent with other
documentation on ALTQ

Pointed out by:	simon, ru, Brad Davis
2005-02-07 23:20:12 +00:00
John Baldwin
0ba59a6f70 - Implement ibcs2_emul_find() using kern_alternate_path(). This changes
the semantics in that the returned filename to use is now a kernel
  pointer rather than a user space pointer.  This required changing the
  arguments to the CHECKALT*() macros some and changing the various system
  calls that used pathnames to use the kern_foo() functions that can accept
  kernel space filename pointers instead of calling the system call
  directly.
- Use kern_open(), kern_access(), kern_execve(), kern_mkfifo(), kern_mknod(),
  kern_setitimer(), kern_getrusage(), kern_utimes(), kern_unlink(),
  kern_chdir(), kern_chmod(), kern_chown(), kern_symlink(), kern_readlink(),
  kern_select(), kern_statfs(), kern_fstatfs(), kern_stat(), kern_lstat(),
  kern_fstat().
- Drop the unused 'uap' argument from spx_open().
- Replace a stale duplication of vn_access() in xenix_access() lacking
  recent additions such as MAC checks, etc. with a call to kern_access().
2005-02-07 22:02:18 +00:00
John Baldwin
c87b5f76aa - Implement svr4_emul_find() using kern_alternate_path(). This changes
the semantics in that the returned filename to use is now a kernel
  pointer rather than a user space pointer.  This required changing the
  arguments to the CHECKALT*() macros some and changing the various system
  calls that used pathnames to use the kern_foo() functions that can accept
  kernel space filename pointers instead of calling the system call
  directly.
- Use kern_open(), kern_access(), kern_msgctl(), kern_execve(),
  kern_mkfifo(), kern_mknod(), kern_statfs(), kern_fstatfs(),
  kern_setitimer(), kern_stat(), kern_lstat(), kern_fstat(), kern_utimes(),
  kern_pathconf(), and kern_unlink().
2005-02-07 21:53:42 +00:00
John Baldwin
fee4a6af3a Implement a kern_pathconf() wrapper for pathconf() which can take the
filename from either a user space or a kernel space pointer.
2005-02-07 21:46:43 +00:00
John Baldwin
5e85ac176f If the pointer to the new itimerval is NULL in kern_setitimer(), just
read the old value via kern_getitimer().
2005-02-07 21:45:48 +00:00
Gleb Smirnoff
832f26462b Use if_link_state_change() instead of rt_ifmsg(). Remove include net/route.h.
Reviewed by:	wpaul, sam
2005-02-07 19:39:29 +00:00
John Baldwin
f7a2587298 - Use kern_{l,f,}stat() and kern_{f,}statfs() functions rather than
duplicating the contents of the same functions inline.
- Consolidate common code to convert a BSD statfs struct to a Linux struct
  into a static worker function.
2005-02-07 18:47:28 +00:00
John Baldwin
25771ec2a4 Make linux_emul_convpath() a simple wrapper for kern_alternate_path(). 2005-02-07 18:46:05 +00:00
John Baldwin
76951d21d1 - Tweak kern_msgctl() to return a copy of the requested message queue id
structure in the struct pointed to by the 3rd argument for IPC_STAT and
  get rid of the 4th argument.  The old way returned a pointer into the
  kernel array that the calling function would then access afterwards
  without holding the appropriate locks and doing non-lock-safe things like
  copyout() with the data anyways.  This change removes that unsafeness and
  resulting race conditions as well as simplifying the interface.
- Implement kern_foo wrappers for stat(), lstat(), fstat(), statfs(),
  fstatfs(), and fhstatfs().  Use these wrappers to cut out a lot of
  code duplication for freebsd4 and netbsd compatability system calls.
- Add a new lookup function kern_alternate_path() that looks up a filename
  under an alternate prefix and determines which filename should be used.
  This is basically a more general version of linux_emul_convpath() that
  can be shared by all the ABIs thus allowing for further reduction of
  code duplication.
2005-02-07 18:44:55 +00:00
John Baldwin
c90110d639 Various and sundry style fixes. 2005-02-07 18:38:29 +00:00
John Baldwin
0311233ecc Use linux_emul_convpath() rather than linux_emul_find() as
linux_emul_find() is going away.
2005-02-07 18:37:51 +00:00
John Baldwin
d9e9747163 Use the LCONVPATHEXIST() macro rather than it's exact expansion to be
consistent.
2005-02-07 18:37:13 +00:00
John Baldwin
12dd959a7d Use kern_setitimer() to implement linux_alarm() instead of fondling the
real interval timer directly.
2005-02-07 18:36:21 +00:00
John Baldwin
777a3021d3 Use kern_open() directly rather than a stackgap detour via open(). 2005-02-07 18:22:20 +00:00
John Baldwin
01660e7bc2 Drop Giant before calling kthread_exit(). 2005-02-07 18:21:50 +00:00
Matthew N. Dodd
5b525a3230 Avoid using tsleep() in the resume path as it may result in the
system hanging if timer interrupts aren't running yet.

This allows my Thinkpad to resume successfully with APM.

Approved by:	 sos
MFC after:	 2 weeks
2005-02-07 17:14:42 +00:00
Poul-Henning Kamp
9ca72ab21e Add VNASSERT() which is just like KASSERT() but takes a vnode argument
which it will vn_printf() if it triggers.
2005-02-07 12:56:19 +00:00
Yoshihiro Takahashi
88d91a5ad0 Remove unused defines. 2005-02-07 12:23:07 +00:00
Maxim Sobolev
aab8b1b55f Fix the problem with incorrect throttling level reported immediately after
reboot. Safter the reboot the TCC is usually in the Automatic mode, in which
reading current performance level is likely to produce bogus results make sure
to switch it to the On-Demand mode and set to some known performance level.
Unfortunately there is no reliable way to check that TCC is in the Automatic
mode. Reading bit 4 of ACPI Thermal Monitor Control Register produces 0
regardless of the current mode.

MFC after:	1 week
2005-02-07 11:35:24 +00:00
Gleb Smirnoff
ad1376cc73 Improve parsing of hook name.
Submitted by:	ru
2005-02-07 11:16:07 +00:00