Commit Graph

54 Commits

Author SHA1 Message Date
mlelstv
ff9a9860d6 GPTs are defined in terms of physical blocks.
- Fix reading of GPT for devices with non-512byte sectors
- Fix bounds check to use DEV_BSIZE units.
2010-01-25 14:51:03 +00:00
bouyer
5d530cfdab struct buf::b_iodone is not called at splbio() any more.
Make sure non-MPsafe iodone callbacks raise the SPL as appropriate.
Fix buffer corruption issue I noticed in dk(4), and probable similar
issues in vnd(4) and cgd(4).
2010-01-23 18:31:04 +00:00
jakllsch
a70f4ed596 Implement and use a dkminphys() that calls the parent device's minphys
function with b_dev temporarily adjusted to the parent device's dev_t.

Fixes PR/37390.
2009-12-27 01:37:17 +00:00
pooka
3446f432fa dkwedge_list() is currently called only from ioctl routines where
l == curlwp.  Since there is no perceived case where we'd ever want
to copy the list to non-curlwp, simplify the code a bit.
(the struct lwp * argument could probably be dropped too, but
that's another commit)
2009-09-08 21:14:33 +00:00
pooka
48575b808e grow some _KERNEL_POT 2009-09-07 13:59:38 +00:00
pooka
f926eb58c3 Remove autoconf dependency on vfs and dk:
opendisk() -> kern/subr_disk_open.c
config_handle_wedges -> dev/dkwedge/dk.c
2009-09-06 16:18:55 +00:00
haad
a0a1dfda1b Add support for DIOCGDISKINFO for wedges. This fixes regression after my
DIOCGDISKINFO commit to fsck/partutil.c.

Tested by me and adegroot@.
2009-08-06 16:00:49 +00:00
dyoung
5a4d67314b Extract a lot of code from dkwedge_del(), and move it to dkwedge_detach()
to create a comprehensive detachment hook.  Let that hook run at
shutdown.  Now, 'drvctl -d dk0' actually deletes a wedge if it is
not in-use (otherwise fails w/ EBUSY), and wedges are gracefully
detached from their "parent" at shutdown.
2009-07-21 19:41:00 +00:00
dyoung
7242213311 Extract subroutine dklastclose(). This is a step toward detachable
dk(4).
2009-07-02 00:56:48 +00:00
cegger
529e91fca1 struct device * -> device_t, no functional changes intended. 2009-05-12 14:16:35 +00:00
cegger
32c4940900 struct cfdata * -> cfdata_t, no functional changes intended. 2009-05-12 12:10:29 +00:00
yamt
70de973662 g/c BUFQ_FOO() macros and use bufq_foo() directly. 2009-01-13 13:33:58 +00:00
reinoud
f6a70673ba Mark a buffer busy in getnewbuf() when it came from the pool_cache since
its not on a free list.

Also change buf_init() to not automatically mark buffers `busy' since this
only makes sense for bufcache buffers.

Mark all buf_init'd buffers 'busy' on the places where they ought to be
flagged as such to not confuse the buffer cache.

Fixes PR 38923.
2008-06-17 14:53:10 +00:00
ad
a22432a7bc dkwedge_read: don't place struct buf on the stack. 2008-06-03 12:14:08 +00:00
chris
39f46f7a42 Call buf_destroy when finished with an on-stack struct buf.
Spotted by LOCKDEBUG, because the condvars were already initialised.
2008-06-01 11:38:26 +00:00
plunky
fcf1772a80 after the "struct disk" is finished with, it should be
destroyed with disk_destroy(9) to stave off LOCKDEBUG
panics.
2008-05-03 08:23:41 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
agc
e7debae8a8 Fix a minor nit in a comment 2008-04-10 09:31:51 +00:00
cegger
b90893744b use aprint_*_dev and device_xname 2008-04-06 08:33:31 +00:00
ad
a9ca7a3734 Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
2008-03-21 21:54:58 +00:00
cube
5e306eb1c9 Split device_t/softc. Well, there's not much to split there, as the
device_t didn't contain the softc anyway.

This driver should be re-structured so it doesn't have to manage its own
set of softcs.
2008-03-04 13:51:18 +00:00
ad
df774def20 Hold v_interlock when adjust v_writecount. 2008-01-30 15:42:52 +00:00
ad
4a780c9ae2 Merge vmlocking2 to head. 2008-01-02 11:48:20 +00:00
jmcneill
4c1d81b2b5 Merge jmcneill-pm branch. 2007-12-09 20:27:42 +00:00
pooka
61e8303e9d Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start.  In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
2007-11-26 19:01:26 +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
ad
b5a9ff06f1 Replace some uses of lockmgr(). 2007-07-21 19:51:47 +00:00
ad
88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
dyoung
1ee8f4a418 Extract common code from i386, xen, and sparc64, creating
config_handle_wedges() and read_disk_sectors().  On x86, handle_wedges()
is a thin wrapper for config_handle_wedges().  Share opendisk()
across architectures.

Add kernel code in support of specifying a root partition by wedge
name.  E.g., root specifications "wedge:wd0a", "wedge:David's Root
Volume" are possible.  (Patches for config(1) coming soon.)

In support of moving disks between architectures (esp. i386 <->
evbmips), I've written a routine convertdisklabel() that ensures
that the raw partition is at RAW_DISK by following these steps:

        0 If we have read a disklabel that has a RAW_PART with
          p_offset == 0 and p_size != 0, then use that raw partition.

        1 If we have read a disklabel that has both partitions 'c'
          and 'd', and RAW_PART has p_offset != 0 or p_size == 0,
          but the other partition is suitable for a raw partition
          (p_offset == 0, p_size != 0), then swap the two partitions
          and use the new raw partition.

        2 If the architecture's raw partition is 'd', and if there
          is no partition 'd', but there is a partition 'c' that
          is suitable for a raw partition, then copy partition 'c'
          to partition 'd'.

        3 Determine the drive's last sector, using either the
          d_secperunit the drive reported, or by guessing (0x1fffffff).
          If we cannot read the drive's last sector, then fail.

        4 If we have read a disklabel that has no partition slot
          RAW_PART, then create a partition RAW_PART.  Make it span
          the whole drive.

        5 If there are fewer than MAXPARTITIONS partitions,
          then "slide" the unsuitable raw partition RAW_PART, and
          subsequent partitions, into partition slots RAW_PART+1
          and subsequent slots.  Create a raw partition at RAW_PART.
          Make it span the whole drive.

The convertdisklabel() procedure can probably stand to be simplified,
but it ought to deal with all but an extraordinarily broken disklabel,
now.

i386: compiled and tested, sparc64: compiled, evbmips: compiled.
2007-06-24 01:43:34 +00:00
christos
c659aeb199 Unwedge the previous change. Always increment the number of rawopens if the
open is successful.
2007-06-16 18:11:33 +00:00
dyoung
f6eded5ef7 Fix two bugs:
1 In dkopen(), do not leave dk_rawopens > 0 if the open ultimately
  failed for some reason.

2 Add a dkdump() implementation by Martin Husemann for writing
  system dumps to wedges.  Tiny modifications by me.  Lightly tested
  on an evbmips box.
2007-06-09 02:26:27 +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
yamt
5c1ff058e4 dkwedge_discover: open a device as read-only. 2007-02-15 16:04:12 +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
uebayasi
3f9b6523d1 Typo in comment. 2006-09-18 07:47:13 +00:00
dbj
f7434c5451 avoid diagnostic panic if both blk and chr wedge are open at the same time 2006-08-24 21:57:11 +00:00
ad
3029ac48c7 - Use the LWP cached credentials where sane.
- Minor cosmetic changes.
2006-07-21 16:48:45 +00:00
elad
2867b68bc3 integrate kauth. 2006-05-14 21:42:26 +00:00
thorpej
086b31316b A couple of fixes from dbj@:
- dkwedge_del(): Don't compute a minor number based on partitions, because
  wedges don't have partitions.  Just provide the unit number to vdevgone().
- dkopen(): Make sure we release all of the locks we've acquired should
  opening the parent device fail.
2006-04-06 17:55:43 +00:00
thorpej
7e075c58fe Implement dksize(). 2006-04-06 17:17:45 +00:00
yamt
ec5a93183a merge yamt-uio_vmspace branch.
- use vmspace rather than proc or lwp where appropriate.
  the latter is more natural to specify an address space.
  (and less likely to be abused for random purposes.)
- fix a swdmover race.
2006-03-01 12:38:10 +00:00
yamt
690d424f28 - add simple functions to allocate/free a buffer for i/o.
- make bufpool static.
2006-01-04 10:13:05 +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
nathanw
ff56508626 Set sc->sc_cfdata.cf_fstate to FSTATE_STAR rather than FSTATE_NOTFOUND
so that config_detach() doesn't panic.

(XXX this points to some disagreement between config_attach_pseudo()
and config_detach() over the correct role of pseudo-device cfdata)
2005-09-28 18:25:19 +00:00
christos
2914522ed1 avoid variable shadowing. 2005-05-29 22:13:33 +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