Commit Graph

125 Commits

Author SHA1 Message Date
mlelstv
a85ccad97b missed one exit path with the previous change. 2016-05-29 13:11:21 +00:00
mlelstv
5699db66ce release openlock mutex before closing parent device. 2016-05-29 12:48:40 +00:00
christos
4a60b18fe2 Fix tyop 2016-04-28 00:35:24 +00:00
christos
5f6148474c Fix error message. 2016-04-28 00:33:54 +00:00
christos
f2a7ea8367 Add dkwedge_find_by_parent() 2016-04-27 02:19:12 +00:00
mlelstv
b5733512ba Allow dump to raidframe component which is a wedge.
N.B. ordinary devices check the partition type only in the xxxsize routine.
2016-01-15 07:48:22 +00:00
mlelstv
9da52a83e5 Return error in dkopen when dk_open_parent fails. Also change dk_open_parent
to pass error code to caller.
XXX: Pullups
2015-12-27 00:47:47 +00:00
christos
4270ff4bc4 Skip protective MBR early too. 2015-12-02 01:09:49 +00:00
mlelstv
a4f2b41710 sc_size is already measured in sectors. 2015-11-28 13:41:31 +00:00
christos
8a6acf0efa remove incorrect comment (from kre) 2015-10-10 23:39:43 +00:00
jmcneill
d9483ce0a0 print wedge announcement in one line instead of two 2015-10-06 11:22:40 +00:00
pooka
89cb80befc Rename variable to avoid -Wshadow warnings with some compilers. 2015-08-25 11:08:59 +00:00
jakllsch
45dc116cb7 Quadruple GPT partition entry count limit (to 512 entries or 64KiB).
The UEFI 2.3.1 specification states that:
"A minimum of 16,384 bytes of space must be reserved for the GPT Partition Entry Array."
and [the size of a partition entry shall be a power of two greater than 128]
and that [the defined fields of a partition entry total 128 bytes].

Clamping the entries means that no partitions on the drive will be detected,
as this will result in an incorrect partition entry array CRC. This change
reduces the likelyhood of useless partitions, while still not allowing a
huge kernel memory allocation to load the partition entries into.

In the future this code should probably be reworked to checksum and evaluate
the partition array in chunks while still limiting the number of GPT
wedges added per drive to something reasonable.
2015-08-23 18:40:15 +00:00
mlelstv
1e8c46e3c4 No longer access the disk driver directly.
If there is an open wedge, temporarily reference its vnode.
Otherwise try to open the block device.
2015-08-22 07:48:14 +00:00
mlelstv
862a433dd4 revert the previous 2015-08-22 07:42:46 +00:00
mlelstv
819c32b42c when scanning for disklabels, close block device only when this was
the first open. The device driver doesn't do reference counting.

This is still subject to race conditions.
2015-08-20 23:08:33 +00:00
christos
d7460da79c Look at the bzb flags to mark partition as swap. Requested by John D. Baker.
XXX: Pullup-7
2015-01-24 02:58:56 +00:00
christos
ed5aa85bd1 - Use NODEV instead of 0
- Return EBUSY if there was no label
2015-01-02 01:14:22 +00:00
christos
c60db2e923 make more drivers use disk_ioctl, and add a dev parameter to it so that
we can merge the "easy" disklabel ioctls to it. Ultimately all this will
go do dk_ioctl once all the drivers have been converted.
2014-12-31 19:52:04 +00:00
mlelstv
bdddf44518 disk_blocksize and disk_set_info relay the same information
to the disk subsystem.

Make disk_set_info also set blocksize shift values.
Remove every call to disk_blocksize.

Keep disk_blocksize for ABI compatibility, make it also set dg_secsize.
2014-12-31 08:24:50 +00:00
mlelstv
9c0686ce5c Really provide disk properties, the old code computed values that were
never attached to the device.
2014-12-08 17:45:12 +00:00
mlelstv
c3fa2622e8 fix iobuf setup, cleanup 2014-11-22 11:59:33 +00:00
mlelstv
0c1adb76c8 Implement DIOCMWEDGES ioctl that triggers wedge autodiscovery.
Also fix a reference counting bug and clean up some code.
2014-11-04 07:50:39 +00:00
mlelstv
bab799b6cf get sector size from disk structure. 2014-11-04 07:46:26 +00:00
mlelstv
69a00310d4 Handle disks with non DEV_BSIZE sectors. 2014-11-04 07:45:45 +00:00
mlelstv
6f5687b0bb Be less noisy when handling wedge name conflicts. 2014-11-04 07:43:00 +00:00
snj
f0a7346d21 src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
2014-10-18 08:33:23 +00:00
apb
bb7c004bd3 When converting a disklabel partition type integer to a wedge partition
type string, use the strings defined in DKW_PTYPE_* in <sys/disk.h>, not
the strings defined in FSTYPE_DEFN in <sys/disklabel.h>.

This corrects a problem introduced in revision 1.21 dated 2014-08-18.
That change was intended to add additional case to the list, but it
accidentally also changed from the strings in the DKW_PTYPE_* macros to
the strings in the FSTYPE_DEFN macro.  Many of the strings are the same,
but there are differences such as "RAID" versus "raidframe" and "MSDOS"
versus "FAT".

XXX: There seems to be no good reason for the differences in string
names for partition types.  One or both of the lists should probably be
edited to align them.
2014-08-30 09:35:10 +00:00
riastradh
cc5c10ea14 Make dk(4) discard from partition start, not from disk start.
Otherwise, anything mounted with `-o discard' will pretty quickly
munch itself up and barf up an unrecoverably corrupted file system!

XXX pullup to netbsd-7
2014-08-28 19:37:46 +00:00
apb
922995f705 Use FSTYPE_DEFN from <sys/disklabel.h> to generate case branches for
conversions from all known disklabel fstypes to strings.  This replaces
the hand-coded list of conversions for only a few of the known types.
2014-08-18 14:18:59 +00:00
apb
1ed52851f5 Don't ignore unrecognised partition types in BSD disklabels;
instead, add them with wedge partition type "unknown#%u", where
%u is the underlying numeric partition type from the BSD disklabel.
2014-08-18 13:46:07 +00:00
dholland
890e036b3c Implement d_discard for dk. This closes PR 47940. 2014-07-25 08:23:56 +00:00
dholland
f9228f4225 Add d_discard to all struct cdevsw instances I could find.
All have been set to "nodiscard"; some should get a real implementation.
2014-07-25 08:10:31 +00:00
dholland
8c70ef39af Add d_discard to all struct bdevsw instances I could find.
I've set them all to nodiscard. Some of them (wd, dk, vnd, ld,
raidframe, maybe cgd) should be implemented for real.
2014-07-25 08:02:18 +00:00
christos
223a7bd55f add dkwedge_get_parent_name(). 2014-04-03 15:24:20 +00:00
martin
aad6ef8bb5 Bring back the playstation2 port - now that a toolchain for it is
available again.
2014-03-31 11:25:47 +00:00
dholland
a68f9396b6 Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
2014-03-16 05:20:22 +00:00
skrll
6d3ceb1d61 Rename NetBSD/hp700 to NetBSD/hppa.
Unfortunately our VCS isn't very helpful here.
2014-02-24 07:23:38 +00:00
soren
dcaf98cac2 Don't complain about not being able to open empty removable media drives. 2013-08-03 18:30:57 +00:00
christos
7b845fa9dc phase 1 of disk geometry cleanup:
- centralize the geometry -> plist code so that we don't have
	  n useless copies of it.
2013-05-29 00:47:48 +00:00
chs
cbab9cadce split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
2012-10-27 17:17:22 +00:00
mlelstv
5741661f64 Make detection of root on wedges (dk(4)) machine independent. Remove
MD code for x86, xen, sparc64.
2012-06-10 17:05:18 +00:00
mlelstv
c6cfd0f5c9 Use the label's packname to create wedge names instead of the classic
device names. Fall back to classic device names when the label has an
empty name or the default name 'fictitious'.
2012-06-07 16:15:31 +00:00
drochner
d4145bf15d minor mostly cosmetical fixes: use designated type for device major
numbers, typo in comment, misuse of minor()
(the latter one is not cosmetical, but would only affect systems
with more than 256 disk wedges)
2012-04-27 18:15:55 +00:00
christos
cc0b3c1656 recognize apple disks. 2012-04-07 05:36:10 +00:00
christos
5d992415ee use the partition sector size. 2012-04-07 05:09:09 +00:00
jmcneill
d2b1c474ba Add an FSILENT flag and use it to suppress "Medium Not Present" scsipi
spam when trying to access offline drives at boot.
2011-07-30 12:08:36 +00:00
rmind
e225b7bd09 Welcome to 5.99.53! Merge rmind-uvmplock branch:
- Reorganize locking in UVM and provide extra serialisation for pmap(9).
  New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
  the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
  Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
  kernel-lock on some ports).  Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
2011-06-12 03:35:36 +00:00
christos
b1b063f09f check rawvp before doing ioctl or strategy. 2011-03-03 03:39:08 +00:00
christos
0437d56b01 Make error checking consistent, possibly fixes PR/44652. 2011-02-28 18:28:20 +00:00