summaryrefslogtreecommitdiffstats
path: root/sys/dev/vnd.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Simple size for free(). These are a pleasure to convert when thederaadt2015-08-261-2/+2
| | | | allocation is clearly spelled out as ptr = malloc(sizeof(*ptr), ...)
* obvious sizes for free()deraadt2015-08-251-3/+3
|
* yet more mallocarray() changes.doug2014-12-131-4/+3
| | | | ok tedu@ deraadt@
* convert old b functions to mem functionstedu2014-10-171-5/+5
|
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-4/+4
| | | | after discussions with beck deraadt kettenis.
* Use %llu+DL_GETPSIZE() to show partition size. Replace %li+(long) withkrw2013-11-121-4/+4
| | | | %u for u_int32_t d_secsize.
* Sprinkle (long long) casts where %lld is being used to print daddr_tkrw2013-11-011-2/+3
| | | | | | variables. Some random whitespace/knf repairs encountered on the way. ok miod@ on inspection, feedback & more suggestions from millert@
* final removal of daddr64_t. daddr_t has been 64 bit for a long enoughderaadt2013-06-111-5/+5
| | | | | test period; i think 3 years ago the last bugs fell out. ok otto beck others
* Add a dmesg warning about sloppy disk I/O to vnd(4) devices to helpmatthew2011-08-261-1/+10
| | | | | | identify bad distrib scripts/tools. ok deraadt@
* Revert vnd(4) to its older less strict behavior.matthew2011-07-181-3/+29
| | | | Verified by deraadt@ to fix distrib/sgi/iso.
* Range check vnd_secsize, vnd_ntracks, and vnd_nsectors so that later onderaadt2011-07-121-2/+9
| | | | | they do not get integer truncated on 64-bit machines. ok matthew
* Ack, my last change used size_t for file offsets, but size_t is onlymatthew2011-07-081-2/+2
| | | | | | | 32-bit on 32-bit architectures; we need off_t to support >4GB vnd(4) images. Discovered by, tested, and ok bluhm@
* Refactor vnd(4) to use vn_rdwr() instead of setting up the uio/iovecmatthew2011-07-081-58/+31
| | | | structs and calling vn_lock+VOP_READ/WRITE+VOP_UNLOCK.
* Validate DISKUNIT(dev) in vndstrategy() like we do in othermatthew2011-07-081-31/+15
| | | | | xxstrategy() methods, and punt in validating it in vndread() and vndwrite() (also like we do in other xx{read,write}() methods...).
* Add a vndencryptbuf() function, and refactor vndstrategy() slightly tomatthew2011-07-081-7/+11
| | | | use it instead.
* vndsize() can just return -1; we don't support swapping to vndmatthew2011-07-061-8/+3
| | | | anymore.
* Compact the vnd sc_flags bits.matthew2011-07-061-4/+4
| | | | ok krw@
* Eliminate some sanity checks in vndstrategy() that are now handled bymatthew2011-07-061-26/+3
| | | | bounds_check_with_label().
* vndstrategy() should fail if VNF_HAVELABEL isn't set. This simplifiesmatthew2011-07-061-19/+14
| | | | | | | | | | | | | | | | | the logic slightly and makes vnd(4) more like any other disk driver. To avoid races, this means vndopen() can only set VNF_HAVELABEL if dk_openmask == 0. Otherwise, it's possible for userspace to open rvnd0c, call VNDIOCSET, open vnd0a, then while vndreaddisklabel() (via vndstrategy) is waiting for VOP_READ() to finish, you could issue a read or write on the still open rvnd0c and have VNF_HAVELABEL set but the disklabel might be in a weird state. Note that this makes VNF_HAVELABEL nicely analogous to sd(4)/cd(4)'s SDEV_MEDIA_LOADED flag, which is handled similarly in {sd,cd}{open,close,strategy}. ok dlg@, krw@, deraadt@
* Eliminate redundant buf validation checks in xxstrategy() methods nowmatthew2011-07-061-2/+2
| | | | | | | | | | | | that they're implemented consistently in bounds_check_with_label(). Also, per krw's request, change bounds_check_with_label() to return 0 if the checks succeed, and change the drivers to test == -1 instead of <= 0. (Man page update to follow; intentionally omitting arch/vax/mba/hp.c from this commit because it doesn't even build currently and miod@ promises to kill it soon.) ok krw@
* move the specfs code to a place people can see it; ok guenther thib krwderaadt2011-07-041-3/+2
|
* Cleanup vnd(4) a bit now that it only has one mode of operation andmatthew2011-07-031-22/+11
| | | | | | uses standard disk device numbering. ok deraadt@
* Fix vnd(4) support for read-only files. We can't clear sc_flagsmatthew2011-07-031-2/+2
| | | | | | | | before closing the vnode, because VNDRW() checks for the VNF_READONLY bit and the vnode layer doesn't like it when you close a read-only vnode with FREAD|FWRITE. ok deraadt@
* Refactor some common open/close/detach disk driver code intomatthew2011-06-301-36/+5
| | | | | | subr_disk.c. For now just the MI disk drivers. ok deraadt@, krw@; jsing@ liked the approach too
* looks like the disk_lock method actually does workderaadt2011-06-211-20/+18
|
* explicit_bzero for the crypto keytedu2011-06-201-3/+3
|
* for now, move back to a private rw_lock rather than the disk_lock.deraadt2011-06-201-18/+20
| | | | | we have problems with instantiating new disks ok matthew
* Use disk_lock_nointr() in the xxclose() routines so that they cannotderaadt2011-06-191-4/+3
| | | | | be interrupted. ok matthew
* Use disk_lock/disk_unlock directly and in the same way in these drivers,deraadt2011-06-191-23/+18
| | | | | | rather than using various wrappings. Convert vnd to using the sc_dk rwlock instead of using one of its own. ok matthew
* and in debug code, tooderaadt2011-06-191-2/+2
|
* stop trying to be clever with the softc namederaadt2011-06-191-108/+108
|
* shorted code with a lovely gotoderaadt2011-06-091-19/+7
| | | | ok matthew
* Drop kernel support for the useless DIOCWLABEL ioctl and prune a lotmatthew2011-06-051-14/+1
| | | | | | | | | of silly flag twiddling code in various disk drivers. ok deraadt@, miod@ N.B., users will need a -current disklabel(8) to be able to write new disklabels to disk now.
* Get rid of the wlabel argument to bounds_check_with_label(). It'smatthew2011-06-031-2/+2
| | | | | | | | | never done anything in OpenBSD and just clutters disk drivers with silly flag handling. More cleanup to follow. ok deraadt@, millert@; no objections krw@
* No need to set error to 0, when it is still 0 from the start of the function.deraadt2011-06-021-2/+1
| | | | ok thib matthew
* The vndbufpl is no longer used.deraadt2011-06-021-13/+1
| | | | Spotted by matthew, verified by me.
* Initialize the dv_xname at attach time, so that we don't have to doderaadt2011-06-021-24/+9
| | | | | | this work later. Since the disk always has the same name (the different between svnd and vnd went away), we don't need to do this late anymore. Spotted with matthew.
* In vndclear(), clear all the flag bits. Leaving around a VNF_WLABEL bitderaadt2011-06-021-2/+2
| | | | | | is stupid (verified to be the case). Other flag bits might have lived longer than they should as well, with unknown consequences. Spotted with matthew, too.
* Initialize the dv_unit, because disk_attach will want it later. Beforederaadt2011-06-021-1/+2
| | | | | we were probably only ever reading labels off vnd0. Oops. Spotted by matthew
* Do not bzero the softc when doing VNDIOCCLR, because that trashes thederaadt2011-06-021-7/+3
| | | | | rw_lock and the device_ref Discussed with thib and matthew
* device_ref() by hand, since this is a pseudo-device and was not attachedderaadt2011-06-021-1/+2
| | | | | through config_attach() ok matthew jsing
* Change a few of the more common disk drivers (sd, cd, wd, rd, and vnd)matthew2011-05-311-2/+2
| | | | | | | | | | | | | | | | | | | to return EBUSY if the user tries to modify an open partition's offset or size. Only sadness can result if a user tries this, and rejecting it prevents a race between sdstart() and sdstrategy(). Curiously, there was already code in the kernel and in disklabel(8) to detect/handle this, but it was effectively disabled because the disk drivers always used something like "/* sc->sc_dk.dk_openmask */ 0", and this commented out code has existed since even r1.1 in NetBSD. I had no problems building a release and messing around with disklabel(8) for a bit with this diff. Canarying the more common MI disk drivers until we gain confidence that there aren't any regressions, then we can switch the remaining drivers. "I am surprised you got me convinced that this stuff is safe" deraadt@ ok krw@
* Remove vndshutdown. It is unused.oga2011-05-301-12/+1
| | | | ``sure'' deraadt@
* Remove backwards compatibility for svnd. All new operations must use thederaadt2011-04-251-6/+2
| | | | | | vnd devices nodes, which impliment svnd functionality -- that being the only thing which vnd now supports. Confused? Don't worry, it is documented. ok krw thib
* Remove now unused vndiodone(). ok deraadt@miod2011-04-231-40/+1
|
* The previous code only prevented the vnd from being opened for write injsing2011-04-231-8/+1
| | | | | both simple and non-simple mode. Restore this behaviour by removing the openmask check.
* backout the miod change since it is wrongderaadt2011-04-231-6/+4
|
* Fix regression in vndopen() behaviour introduced in previous commit.miod2011-04-221-4/+6
|
* remove the old style by-pass-the-buffer-cache vnd code.thib2011-04-181-228/+51
| | | | | | this will treat vndX the same as svndX. ok and gcc2 fixes from deraadt@
* Remove bufqs from vnds, as the disk that houses the imagethib2011-04-021-88/+45
| | | | | | | | | backing the vnd also has a bufq. So the buf is just passed between the vnd bufq and the disk bufq (almost immediately). Also see previous revision for more insight. OK deraadt@, dlg@