Commit Graph

38 Commits

Author SHA1 Message Date
mlelstv 803c93c66f Add flag to enforce file I/O even when bmap/strategy would be possible.
This makes it easier to compare both modes, it also allows coherent
operation between vnd device and image file.
2018-10-07 11:51:26 +00:00
mlelstv 289f3a91a7 getdisksize only operates on device vnodes. Use the ioctl on the underlying
device instead.
2018-09-20 07:18:38 +00:00
riastradh e4da734a80 Tweak whitespace to make this definition more greppable. 2017-07-28 15:52:53 +00:00
dholland 1fbab01a93 More on PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers (I think) all the MI headers outside of external/ (and dist/).
2015-09-06 06:00:59 +00:00
prlw1 bc27eabab7 whitespace police 2015-05-25 20:57:18 +00:00
christos 417a118725 PR/47879: Takahiro HAYASHI: vnd cannot handle disk image larger than 2TiB
change size_t to uint64_t where needed.
2013-06-03 16:42:32 +00:00
hannken 68e229c7e8 When backed by a sparse file limit the number of pending requests.
Should fix PR #45829: "writing to vnd on sparse file blocks on pager_map"
where the pager_map gets exhausted by requests enqueued on a vnd
device and the device worker thread blocks on putpages() needing the map.

While here always sync the underlying vnode before calling biodone().

XXX: vnd should be converted to mutex/condvar.
2012-03-26 16:28:08 +00:00
hannken 117bf62eb2 Make vnd(4) work on sparse files:
- Make the strategy decision a device flag and set VNF_USE_VN_RDWR for
  files known to be sparse.
- Change handle_with_rdwr() to use POSIX_FADV_NOREUSE advise to disable
  read ahead and keep the size of mapped pages below 1 MByte.

No objections on tech-kern@.
2011-06-29 09:12:42 +00:00
rmind 9b6bd2d968 Remove clause 3 (UCB advertising clause) from the University of Utah
copyright.  Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
2011-02-08 20:20:06 +00:00
mrg d56ef50154 actually, put the old definitions back into vndvar.h, under _KERNEL,
as netbsd32 wants access to them.
2010-09-19 09:41:37 +00:00
mrg 94bc17b82c fix the vnd_osize changes on 32 bit platforms with 64 bit alignment for
64 bit integers (eg, sparc).  the problem was that the new 64 bit
element on the end was used for the offsetof() (aka size) for the old
structure, but this includes the padding required, thus the ioctl number
was set wrongly.

move all the supporting code for this inside COMPAT_50, with some renaming
to suit, and kill all the external definitions related to it.


tested on i386, amd64 and sparc.
2010-09-19 07:11:42 +00:00
mrg 6489048a39 add support for COMPAT_50 ioctls. struct vnd_user has a dev_t component
which grew since netbsd 5.0 (hi christos!)

fix a few issues/problems:
- the COMPAT_30 code wasn't used since opt_compat_netbsd.h wasn't included
- move 'struct vnd_ouser' (for COMPAT_30) into vnd.c itself, and call it
  'struct vnd_user30'
- same for VNDIOOCGET -> VNDIOCGET30

now 'vnconfig -l' works on -current with a netbsd-5 binary, using i386.


XXX: there is still a potential problem with the old VNDIOOCSET and
VNDIOOCCLR macros on some platforms like sparc.  there is padding
between the old vnd_osize member and the new vnd_size member on
platforms that want 64 bit values 64 bit aligned, but are 32 bit
otherwise (like sparc.)  64 bit systems already end up with this
member 64 bit aligned, and should be fine.

this most likely results in the old ioctl numbers being wrong and
the code won't match/run ever (ENOTTY.)
2010-09-19 05:50:28 +00:00
uebayasi e2cb3fd64f Protect multiple inclusion. 2009-12-14 03:11:22 +00:00
dsl b2df25db53 Make vnd_size (the returned size) 64 bit, keeping old field for ioctl
compatibility. Both fields are now unsigned.
Add compatibility for the old ioctl size.
Detect and error files which are definitely sparse (va_bytes < va_size).
Part of fix for PR/41873.
2009-12-06 16:33:18 +00:00
dyoung ee9d8d96c8 Straggler from last vnd(4) commit: #define VNF_CLEARING. 2009-04-30 22:36:10 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
cube e567de2f43 Split device_t/softc and other related cosmetic changes. 2008-03-04 23:03:29 +00:00
ad 88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
elad 2867b68bc3 integrate kauth. 2006-05-14 21:42:26 +00:00
cube 6527a45571 Have vnd(4) devices automatically created when the user tries to
configure one.  That removes the compile-time constant that limits the
number of vnds.

Thanks xtraeme@ for testing.
2006-02-01 03:15:33 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
yamt aec75b1cc6 - change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
  have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
  from sys/bufq.h to sys/bufq_impl.h.
  (is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c.  (not tested)
2005-10-15 17:29:10 +00:00
christos 758a209d23 64 bit inode changes. 2005-08-19 02:03:49 +00:00
hubertf 673730506c Add support for reading cloop2 compressed filesystem image,
enable by putting VND_COMPRESSION into kernel config file.
Written by Cliff Wright, polished up slightly by me.
2005-07-17 00:08:27 +00:00
bouyer 007f04c4a8 Make vnd do I/O to the underlying file from thread context. This
allows the strategy routine to be called from interrupt context, fixes
PR kern/29775 by Juan RP.
Now that pool_get() is only called from thread context, change PR_NOWAIT to
PR_WAITOK. Fix PR kern/26272 by Juergen Hannken-Illjes.
OK'd by thorpej@
2005-03-30 19:23:08 +00:00
perry f31bd063e9 nuke trailing whitespace 2005-02-27 00:26:58 +00:00
agc aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
thorpej 4aef050969 Add DIOCKLABEL support. Fixes PR kern/21605 (Luke Mewburn). 2003-05-17 16:11:52 +00:00
drochner ea7f1bd035 Add a VNDIOF_FORCE flag which forces unconfiguration if the emulated
disk is still in use.
Not for everyday use, but we have to face eg USB flash drives being
unplugged at the wrong time, and this is a way to simulate this without
wearing out the connectors.
2003-04-11 16:11:49 +00:00
yamt 77312f97f8 read-only configuration support. 2003-03-27 15:34:36 +00:00
hannken 96ea8912e6 Convert to new device buffer queue interface. 2002-07-20 11:28:07 +00:00
atatat 851e916f1b Provide a means for vnconfig to indicate which devices are in use, and
by which files (hmm...why can't I unmount that file system over
there).  Currently this is just the device and inode number of the
file backing the vnd, but hopefully consing up full pathnames can be
done at some point.
2002-06-21 19:09:29 +00:00
jdolecek bd134c34ac only define struct vnd_softc if _KERNEL is defined 2000-03-20 13:17:47 +00:00
thorpej dc59bc1db3 Update for sys/buf.h/disksort_*() changes. 2000-01-21 23:39:55 +00:00
thorpej 6056af462f Use the pool allocator for vndxfer and vndbuf structures. 1998-07-31 02:24:26 +00:00
pk 1743d97bd7 Pull over fixes from vm_swap.c:
- guard against synchronous I/O completion
	- avoid race conditions
	- use bgetvp/brelvp to properly maintain the vnode holdcount
	  and clean/dirty buffer lists.
1997-12-02 13:54:48 +00:00
jtc 324ce8d6cb Fix tipo inherited from old version of TNF copyright template. 1997-10-09 07:37:50 +00:00
thorpej 5029dd336b Add full disklabel and partition support to the vnd driver, allowing much
greater flexibility in its use.  Additionally, add support for "geometry
emulation".  This allows the "geometry" of the "disk" to be specified
at config time, providing near-perfect emulation of disklabel-less floppies,
CD-ROMs, etc., including non-512-byte sectors.  If a geometry is not
specified at config time, a default based on 1M cylinders will be used.
1997-06-23 21:03:55 +00:00