Commit Graph

71 Commits

Author SHA1 Message Date
mlelstv 1ce16876f7 d_psize routine returns a number of blocks or -1 on error.
d_dump routine returns 0 or an error code.
2010-02-07 16:04:31 +00:00
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 d6224f4507 Remove support for NetBSD/playstation2. 2009-12-05 16:29:10 +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
jakllsch 76a01a44a6 Allow wedges to be created for all defined partitions on a GPT disk.
Use __arraycount on the GUID to type mapping array.
Add HFS to the list of types with dkw_ptypes.

reviewed by cube.
2008-10-23 19:37:40 +00:00
christos f52ea15353 Recognize apple ufs partitions from Antoine Reilles 2008-06-29 15:13:28 +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
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