Commit Graph

45 Commits

Author SHA1 Message Date
ad
4a780c9ae2 Merge vmlocking2 to head. 2008-01-02 11:48:20 +00:00
riz
42a4e6ef13 As discussed on tech-userlevel, add NetBSD GPT partition types for
swap, ffs, lfs, raidframe, ccd and cgd.  gpt(8) now defaults to
NetBSD ffs if no type is given, but previous FreeBSD types are
still recognized in the DKWEDGE_AUTODISCOVER code.
2007-12-28 19:53:09 +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
dyoung
48beaaeef0 Reduce code duplication in validate_label(). Extract some lengthy
code to give it 8 more columns of horizontal space, creating
addwedges() in this way.
2007-06-09 02:10:30 +00:00
scw
5764a76889 Remove support for NetBSD/{,evb}sh5. 2007-04-08 09:35:21 +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
martin
2fdb6bb1bd Make this compilable from userland 2007-03-01 21:38:17 +00:00
martin
dd8b45ebc6 Split the disklabel checksum function into two, so we can pass the
length separately.
Use this for foreign-endianess labels in wedge autodiscovery, and
calculate the checksum of those before we swap various fields in the
label.
2007-03-01 21:30:50 +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
christos
71aa807296 use a c99 initializer 2006-09-13 00:48:03 +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
martin
b28babedf4 Backout previous - it is already dealt with at the config level. 2006-08-13 19:17:11 +00:00
martin
4ada5572ad Make the discovery methods optional (as they were already declared
in conf/files)
2006-08-13 18:45:08 +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
christos
1ac8da90ae As core requested, remove vinum 2006-02-25 01:27:20 +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
thorpej
092726cfb1 Make this compile again. 2005-01-01 19:29:59 +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
e2be7a929e Implement the DIOCCACHESYNC ioctl; we just pass it along to the parent. 2004-10-26 22:50:16 +00:00
thorpej
40efd0eeef Check d_magic2 once, and not d_magic twice. Pointed out by tsarna. 2004-10-23 19:45:32 +00:00
thorpej
dfc3ead10a MBR partition table support for wedges, enabled by the DKWEDGE_METHOD_MBR
option.
2004-10-23 17:25:14 +00:00
thorpej
d80e5712b6 - Adjust minor number usage for wedges; minor number directly maps to
unit now.  Don't pretend wedges have "partitions".
- Fix a buglet related to opening char and block devices of a wedge
  at the same time.
- Add dkwedge_set_bootwedge(), that MD code can call to set booted_device
  and booted_wedge appropriately when MD code knows the parent disk and
  the start/size of the wedge that was booted from.
2004-10-23 17:16:45 +00:00
thorpej
ffb78793fc Use config_attach_pseudo() to create device instances in the device
tree for created wedges.  This is necessary for setroot().
2004-10-15 04:42:09 +00:00
thorpej
563a66a36f Add a parsing module for 4.4BSD/NetBSD disklabels. This module supports
disklabels nested inside an MBR "NetBSD" or "386BSD" partition (first
one found is considered authoritative for the disk), or in one of several
known locations for various NetBSD platforms.  It can read native or other-
endian disklabels (code is there, but not tested).

If you want to play with this, exercise caution; you can't currently
mountroot on a wedge (setroot() needs some work).  Enabled by the
DKWEDGE_METHOD_BSDLABEL kernel option.
2004-10-04 01:16:39 +00:00
thorpej
3cb291f243 Move wedge code to a subdirectory, as suggested by Christos. 2004-10-04 01:07:25 +00:00