Commit Graph

66 Commits

Author SHA1 Message Date
hannken 83b532dd44 - Don't detach configured devices on last close.
- No kmem allocation and biodone() under lock (from rmind@netbsd.org).
2010-11-25 08:53:30 +00:00
hannken cec7ede499 Make md(4) mp-safe. 2010-11-23 09:30:43 +00:00
pooka 22506639fc Don't have a COW (Compiler OW) in case there is no kernel_opt. 2010-11-22 21:10:10 +00:00
hannken c7919375e5 Change md(4) to:
- create md devices on first open and destroy on last close.
- add enough disk label support to make DIOCGDINFO and DIOCGPART work.
- add disk_busy()/disk_unbusy() instrumentation.

Ok: David Young <dyoung@netbsd.org>
2010-11-11 11:07:06 +00:00
dyoung 975667d3ea Take care not to dereference a NULL softc. 2010-01-21 02:14:42 +00:00
snj b094016798 Drop 3rd and 4th clauses. OK gwr@ leo@ (copyright holders). 2009-10-22 20:15:45 +00:00
dyoung 974833df66 Make mdopen() and mdclose() maintain the openmask. md_detach()
depends on the openmask to know whether it should either return
EBUSY because the device is open, or tear the device down.

Alan Barrett reports that this fixes kern/41725, in part: it prevents
the UVM fault, and the kernel detaches /dev/md0a after unmounting
/ on /dev/md0a instead of before.
2009-07-28 17:55:27 +00:00
dyoung 9167c17dd5 Add a detachment hook. Detach md(4) at shutdown. 2009-05-19 20:25:41 +00:00
manu c328d568d4 TFTPROOT loads the RAMdisk through TFTP at boot time. It needs the
network to be functionnal, and therefore must be called after
config_finalize(). Unfortunately, config_finalize() attaches md0
through mdattach(), and when tftproot_getfile() attempts to attach it
later by calling mdattach() again, it gets a failure.

This change checks for the RAMdisk size in mdattach(). If it is zero, then
the RAMdisk has not been loaded yet, and nothing is done. It will be
attached later when tftproot_getfile() will call mdattach()
2009-05-04 16:20:41 +00:00
yamt 70de973662 g/c BUFQ_FOO() macros and use bufq_foo() directly. 2009-01-13 13:33:58 +00:00
drochner c4003ef269 more cleanup: the sc_dev backpointer is unused, remove it 2008-06-16 10:27:47 +00:00
cegger 13a6ae7a5f register NULL pmf handlers. md(4) is supposed to not loose / change when resuming from S3. 2008-06-13 20:05:06 +00:00
cegger 9fca1f317d device_t/softc split
while here, remove unused variables and do some other cleanups
with feedback from cube
2008-06-13 19:55:26 +00:00
drochner 29fbb6a62e Replace the weird method to create instances by config_attach_pseudo()
as everyone else does, and remove the private table of instances which
is replaced by the table in the cfdriver.
This could get more cleanup, and I didn't split device/softc yet.
2008-06-11 10:38:44 +00:00
cegger c1886a2781 use aprint_*_dev and device_xname 2008-04-09 05:47:19 +00:00
ad 2af68666da Merge disk init changes from the vmlocking branch. These seperate init /
destroy of 'struct disk' from attach / detach.
2007-10-08 16:41:05 +00:00
ad eb171eaaa7 It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
2007-07-29 12:50:17 +00:00
dsl 9a71120654 Default MEMORY_DISK_SERVER to 1 instead of using 'undefined' to mean 1. 2007-07-15 08:40:22 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
christos a569a4d291 add missing initializer 2006-09-02 07:01:20 +00:00
thorpej 39cd836ee1 Use device_unit(). 2006-03-28 17:38:24 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
yamt aec75b1cc6 - change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
  have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
  from sys/bufq.h to sys/bufq_impl.h.
  (is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c.  (not tested)
2005-10-15 17:29:10 +00:00
yamt 6b2d8b66a4 merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
  save some resources like pv_entry.  also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
2005-04-01 11:59:21 +00:00
perry f31bd063e9 nuke trailing whitespace 2005-02-27 00:26:58 +00:00
yamt 05f25dcc2a move buffer queue related stuffs from buf.h to their own header, bufq.h. 2004-10-28 07:07:35 +00:00
thorpej b560f85cc5 Use ANSI function decls, sprinkle static. 2004-08-30 00:34:41 +00:00
itojun d2f1c029b9 kill sprintf, use snprintf 2004-04-21 18:40:37 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
thorpej 50e0b3a100 Use aprint_error() where appropriate. 2003-05-13 02:56:13 +00:00
atatat 944cb6f8ff Add /* MEMORY_DISK_SERVER */ comments to the #endifs to match the #ifdefs. 2002-12-11 16:24:38 +00:00
jdolecek e0cc03a09b merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
2002-10-23 09:10:23 +00:00
gehenna 77a6b82b27 Merge the gehenna-devsw branch into the trunk.
This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

	device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
  by using this grammer.

- Added the new naming convention.
  The name of the device switch must be <prefix>_[bc]devsw for auto-generation
  of device switch tables.

- The backward compatibility of loading block/character device
  switch by LKM framework is broken. This is necessary to convert
  from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
  We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
  the LKM framework will refer it to assign device major number dynamically.
2002-09-06 13:18:43 +00:00
hannken 7de36862a8 Rename bufq_init() to bufq_alloc().
Add bufq_free() to remove a buffer queue.
Avoid MALLOC while holding a spinlock.

From Chuck Silvers.
2002-07-21 15:32:17 +00:00
hannken 96ea8912e6 Convert to new device buffer queue interface. 2002-07-20 11:28:07 +00:00
tsutsui cf839323de Call malloc(9) with M_ZERO flag instead of memset() after malloc(). 2002-01-13 19:28:06 +00:00
lukem 2bbe2de647 add RCSIDs 2001-11-13 05:32:49 +00:00
thorpej c8b4ac1b17 bcopy -> memcpy
bzero -> memset
2001-07-07 17:04:01 +00:00
tsutsui 128dae5e7b Fix md_root.c path in comment. 2001-02-08 13:11:31 +00:00
mrg f324eef2d2 remove include of <vm/vm.h> 2000-06-27 17:55:38 +00:00
mrg 2f159a1bac remove/move more mach vm header files:
<vm/pglist.h> -> <uvm/uvm_pglist.h>
	<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
	<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
	<vm/vm_object.h> -> nothing
	<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
2000-06-26 14:20:25 +00:00
thorpej dc59bc1db3 Update for sys/buf.h/disksort_*() changes. 2000-01-21 23:39:55 +00:00
tsutsui a914ad6061 - use the raw partition for ioctl; `control device' is gone.
- remove `sc_flags' member from md_softc
 - add check code whether the md device is configured in mdread/mdwrite
2000-01-21 12:14:53 +00:00
mrg d2397ac5f7 completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
1999-03-24 05:50:49 +00:00
jonathan c9d036d796 defopt MEMORY_DISK_{HOOKS,SERVER,IS_ROOT}. 1999-02-07 09:34:58 +00:00
enami 29e9385ce2 Make this file compile again by removing no longer used `struct
cfdriver md_cd' and related code.
1998-09-01 06:13:33 +00:00
eeh a2dd74ed79 Merge paddr_t changes into the main branch. 1998-08-13 02:10:37 +00:00