summaryrefslogtreecommitdiff
path: root/sys/dev/vnd.c
AgeCommit message (Collapse)Author
2016-03-19Remove the unused flags argument from VOP_UNLOCK().natano
torture tested on amd64, i386 and macppc ok beck mpi stefan "the change looks right" deraadt
2015-08-26Simple size for free(). These are a pleasure to convert when theTheo de Raadt
allocation is clearly spelled out as ptr = malloc(sizeof(*ptr), ...)
2015-08-25obvious sizes for free()Theo de Raadt
2014-12-13yet more mallocarray() changes.Doug Hogan
ok tedu@ deraadt@
2014-10-17convert old b functions to mem functionsTed Unangst
2014-07-12add a size argument to free. will be used soon, but for now default to 0.Ted Unangst
after discussions with beck deraadt kettenis.
2013-11-12Use %llu+DL_GETPSIZE() to show partition size. Replace %li+(long) withKenneth R Westerback
%u for u_int32_t d_secsize.
2013-11-01Sprinkle (long long) casts where %lld is being used to print daddr_tKenneth R Westerback
variables. Some random whitespace/knf repairs encountered on the way. ok miod@ on inspection, feedback & more suggestions from millert@
2013-06-11final removal of daddr64_t. daddr_t has been 64 bit for a long enoughTheo de Raadt
test period; i think 3 years ago the last bugs fell out. ok otto beck others
2011-08-26Add a dmesg warning about sloppy disk I/O to vnd(4) devices to helpMatthew Dempsky
identify bad distrib scripts/tools. ok deraadt@
2011-07-18Revert vnd(4) to its older less strict behavior.Matthew Dempsky
Verified by deraadt@ to fix distrib/sgi/iso.
2011-07-12Range check vnd_secsize, vnd_ntracks, and vnd_nsectors so that later onTheo de Raadt
they do not get integer truncated on 64-bit machines. ok matthew
2011-07-08Ack, my last change used size_t for file offsets, but size_t is onlyMatthew Dempsky
32-bit on 32-bit architectures; we need off_t to support >4GB vnd(4) images. Discovered by, tested, and ok bluhm@
2011-07-08Refactor vnd(4) to use vn_rdwr() instead of setting up the uio/iovecMatthew Dempsky
structs and calling vn_lock+VOP_READ/WRITE+VOP_UNLOCK.
2011-07-08Validate DISKUNIT(dev) in vndstrategy() like we do in otherMatthew Dempsky
xxstrategy() methods, and punt in validating it in vndread() and vndwrite() (also like we do in other xx{read,write}() methods...).
2011-07-08Add a vndencryptbuf() function, and refactor vndstrategy() slightly toMatthew Dempsky
use it instead.
2011-07-06vndsize() can just return -1; we don't support swapping to vndMatthew Dempsky
anymore.
2011-07-06Compact the vnd sc_flags bits.Matthew Dempsky
ok krw@
2011-07-06Eliminate some sanity checks in vndstrategy() that are now handled byMatthew Dempsky
bounds_check_with_label().
2011-07-06vndstrategy() should fail if VNF_HAVELABEL isn't set. This simplifiesMatthew Dempsky
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@
2011-07-06Eliminate redundant buf validation checks in xxstrategy() methods nowMatthew Dempsky
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@
2011-07-04move the specfs code to a place people can see it; ok guenther thib krwTheo de Raadt
2011-07-03Cleanup vnd(4) a bit now that it only has one mode of operation andMatthew Dempsky
uses standard disk device numbering. ok deraadt@
2011-07-03Fix vnd(4) support for read-only files. We can't clear sc_flagsMatthew Dempsky
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@
2011-06-30Refactor some common open/close/detach disk driver code intoMatthew Dempsky
subr_disk.c. For now just the MI disk drivers. ok deraadt@, krw@; jsing@ liked the approach too
2011-06-21looks like the disk_lock method actually does workTheo de Raadt
2011-06-20explicit_bzero for the crypto keyTed Unangst
2011-06-20for now, move back to a private rw_lock rather than the disk_lock.Theo de Raadt
we have problems with instantiating new disks ok matthew
2011-06-19Use disk_lock_nointr() in the xxclose() routines so that they cannotTheo de Raadt
be interrupted. ok matthew
2011-06-19Use disk_lock/disk_unlock directly and in the same way in these drivers,Theo de Raadt
rather than using various wrappings. Convert vnd to using the sc_dk rwlock instead of using one of its own. ok matthew
2011-06-19and in debug code, tooTheo de Raadt
2011-06-19stop trying to be clever with the softc nameTheo de Raadt
2011-06-09shorted code with a lovely gotoTheo de Raadt
ok matthew
2011-06-05Drop kernel support for the useless DIOCWLABEL ioctl and prune a lotMatthew Dempsky
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.
2011-06-03Get rid of the wlabel argument to bounds_check_with_label(). It'sMatthew Dempsky
never done anything in OpenBSD and just clutters disk drivers with silly flag handling. More cleanup to follow. ok deraadt@, millert@; no objections krw@
2011-06-02No need to set error to 0, when it is still 0 from the start of the function.Theo de Raadt
ok thib matthew
2011-06-02The vndbufpl is no longer used.Theo de Raadt
Spotted by matthew, verified by me.
2011-06-02Initialize the dv_xname at attach time, so that we don't have to doTheo de Raadt
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.
2011-06-02In vndclear(), clear all the flag bits. Leaving around a VNF_WLABEL bitTheo de Raadt
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.
2011-06-02Initialize the dv_unit, because disk_attach will want it later. BeforeTheo de Raadt
we were probably only ever reading labels off vnd0. Oops. Spotted by matthew
2011-06-02Do not bzero the softc when doing VNDIOCCLR, because that trashes theTheo de Raadt
rw_lock and the device_ref Discussed with thib and matthew
2011-06-02device_ref() by hand, since this is a pseudo-device and was not attachedTheo de Raadt
through config_attach() ok matthew jsing
2011-05-31Change a few of the more common disk drivers (sd, cd, wd, rd, and vnd)Matthew Dempsky
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@
2011-05-30Remove vndshutdown. It is unused.Owain Ainsworth
``sure'' deraadt@
2011-04-25Remove backwards compatibility for svnd. All new operations must use theTheo de Raadt
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
2011-04-23Remove now unused vndiodone(). ok deraadt@Miod Vallat
2011-04-23The previous code only prevented the vnd from being opened for write inJoel Sing
both simple and non-simple mode. Restore this behaviour by removing the openmask check.
2011-04-23backout the miod change since it is wrongTheo de Raadt
2011-04-22Fix regression in vndopen() behaviour introduced in previous commit.Miod Vallat
2011-04-18remove the old style by-pass-the-buffer-cache vnd code.Thordur I. Bjornsson
this will treat vndX the same as svndX. ok and gcc2 fixes from deraadt@