summaryrefslogtreecommitdiff
path: root/sys/dev/vnd.c
AgeCommit message (Collapse)Author
2018-04-28Clean up the parameters of VOP_LOCK() and VOP_UNLOCK(). It is alwaysVisa Hankala
curproc that does the locking or unlocking, so the proc parameter is pointless and can be dropped. OK mpi@, deraadt@
2018-02-19Remove almost unused `flags' argument of suser().Martin Pieuchot
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@
2017-12-30Don't pull in <sys/file.h> just to get fcntl.hPhilip Guenther
ok deraadt@ krw@
2017-07-19Avoid additional div0 in case both ntracks & nsectors passed inTheo de Raadt
via ioctl are 0. Noticed by bluhm ok bluhm millert
2017-07-19Avoid division by zero of vnd_secsizeTheo de Raadt
Found by Ilja Van Sprundel ok claudio kettenis
2017-01-21p_comm is the process's command and isn't per thread, so move it fromPhilip Guenther
struct proc to struct process. ok deraadt@ kettenis@
2016-12-14Kill compat for old VNDIOCSET; ok deraadt@Jeremie Courreges-Anglas
2016-11-12Revert unrelated bits that snuck in previous.Jeremie Courreges-Anglas
2016-11-12Bump VNDNLEN from 90 to 1024 bytes, to avoid "VNDIOCSET: File name too long"Jeremie Courreges-Anglas
Introduce a new ioctl for VNDIOCSET, the old ioctl will stay around for a bit to cope with old vnconfig/mount_vnd. ok deraadt@
2016-10-08Various printf claim to report the PID, so actually report that and not the TIDPhilip Guenther
ok kettenis@ tedu@
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