summaryrefslogtreecommitdiffstats
path: root/sys/dev/vnd.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Re-enable IO_NOCACHE, and use is in vnd.beck2019-11-271-3/+6
| | | | | | | | | | | | | Ensure that io to a file backing a vnd is IO_SYNC, so IO to a vnd device is both synchronous and not cached in the buffer cache. This allows the "mount" regress to work repeatably, and avoids a situation where when the buffer cache cleaner runs to clear dirty buffers while people are waiting, it actually increases the dirty buffers when the writes to the underlying vnd are also delayed. ok bluhm@
* Correctly re-initialize the nameinfo struct that is re-used forbeck2019-11-031-1/+2
| | | | | | | vn_open when vnconfig'ing from a read-only filesystem. This bug has been with us for a long time and was spotted by Kawamata Yoshihiro <kaw@on.rim.or.jp> after recent changes making vn_open more picky about the structure it is called with.
* Fix vn_open to require an op of 0, and 0 or KERNELPATH only as flags.beck2019-10-061-2/+2
| | | | | | | | sweep tree to correct NDIINT op and flags ahead of time. document the requirement. This allows KERNELPATH to be used to bypass unveil for crash dumps with nosuidcoredump=2 or 3 ok visa@ deraadt@ florian@
* Clean up the parameters of VOP_LOCK() and VOP_UNLOCK(). It is alwaysvisa2018-04-281-3/+3
| | | | | | | curproc that does the locking or unlocking, so the proc parameter is pointless and can be dropped. OK mpi@, deraadt@
* Remove almost unused `flags' argument of suser().mpi2018-02-191-2/+2
| | | | | | | The account flag `ASU' will no longer be set but that makes suser() mpsafe since it no longer mess with a per-process field. No objection from millert@, ok tedu@, bluhm@
* Don't pull in <sys/file.h> just to get fcntl.hguenther2017-12-301-2/+2
| | | | ok deraadt@ krw@
* Avoid additional div0 in case both ntracks & nsectors passed inderaadt2017-07-191-2/+3
| | | | | | via ioctl are 0. Noticed by bluhm ok bluhm millert
* Avoid division by zero of vnd_secsizederaadt2017-07-191-1/+2
| | | | | Found by Ilja Van Sprundel ok claudio kettenis
* p_comm is the process's command and isn't per thread, so move it fromguenther2017-01-211-3/+3
| | | | | | struct proc to struct process. ok deraadt@ kettenis@
* Kill compat for old VNDIOCSET; ok deraadt@jca2016-12-141-31/+1
|
* Revert unrelated bits that snuck in previous.jca2016-11-121-3/+3
|
* Bump VNDNLEN from 90 to 1024 bytes, to avoid "VNDIOCSET: File name too long"jca2016-11-121-3/+33
| | | | | | | Introduce a new ioctl for VNDIOCSET, the old ioctl will stay around for a bit to cope with old vnconfig/mount_vnd. ok deraadt@
* Various printf claim to report the PID, so actually report that and not the TIDguenther2016-10-081-4/+4
| | | | ok kettenis@ tedu@
* Remove the unused flags argument from VOP_UNLOCK().natano2016-03-191-3/+3
| | | | | | torture tested on amd64, i386 and macppc ok beck mpi stefan "the change looks right" deraadt
* 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.