Commit Graph

214 Commits

Author SHA1 Message Date
dholland
8f6ed30d57 Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

Update all namei call sites accordingly. Add a pathbuf(9) man page and
update namei(9).

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.
2010-11-19 06:44:33 +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
riz
580e1452c1 Add wedge (dk(4)) support to vnd(4) devices. 2010-06-24 21:20:23 +00:00
hannken
1423e65b26 Clean up vnode lock operations pass 2:
VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
2010-06-24 12:58:48 +00:00
pooka
b6d93fa026 For the nfs throttling kludge, test against v_tag == VT_NFS instead
of v_op (the latter imposes linkage).
2010-03-02 21:32:29 +00:00
mlelstv
d2fd323d98 Properly register blocksize with disk(9) framework. 2010-01-31 15:40:08 +00:00
bouyer
5d530cfdab struct buf::b_iodone is not called at splbio() any more.
Make sure non-MPsafe iodone callbacks raise the SPL as appropriate.
Fix buffer corruption issue I noticed in dk(4), and probable similar
issues in vnd(4) and cgd(4).
2010-01-23 18:31:04 +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
ec63b8722d Re-use DK_BUSY(). 2009-08-07 00:08:07 +00:00
dyoung
c88ea823f8 At the bottom of vndclear(), clear VNF_CLEARING: it is no longer
needed to exclude vndopen(), and it will prevent subsequent opens
if we leave it.
2009-07-07 19:51:22 +00:00
dyoung
ec3ba2c85b In vndopen(), release the lock before returning ENXIO. 2009-07-02 02:06:11 +00:00
cegger
ed4086f2eb struct cfdata * -> cfdata_t, no functional changes intended. 2009-05-07 09:13:13 +00:00
ad
b5dc34151d Unneeded LK_CANRECURSE. 2009-05-06 22:38:42 +00:00
dyoung
c968789de1 Flesh out vnd_detach(). Let the system detach vnd(4) at shutdown. Stop
vnd_ioctl(VNDIOCCLR) from racing with vndopen() to call vndclear().
2009-04-30 20:34:08 +00:00
dyoung
b44d7cdf40 Fix spelling. if( -> if (. No functional change intended. 2009-04-30 16:38:12 +00:00
dyoung
114a99200c Use NULL instead of (type *)0. Delete extraneous parentheses. No
functional change intended.
2009-04-30 16:07:50 +00:00
cegger
c363a9cb62 bzero -> memset 2009-03-18 16:00:08 +00:00
apb
2a86bfea6b Add FSYNC_CACHE flag to the VOP_FSYNC() call for the DIOCCACHESYNC ioctl.
PR 41015.
2009-03-14 18:00:37 +00:00
christos
19b058b35e PR/41015: Alan Barrett: vnd driver does not implement DIOCCACHESYNC 2009-03-14 16:33:25 +00:00
haad
7aa7bdd03c Add support for the MODULAR framework to the vnd driver. Enable building of
vnd.kmod by default.
2009-02-05 17:32:10 +00:00
yamt
70de973662 g/c BUFQ_FOO() macros and use bufq_foo() directly. 2009-01-13 13:33:58 +00:00
cegger
08ebead94e make this compile 2009-01-11 09:51:38 +00:00
christos
461a86f9bd merge christos-time_t 2009-01-11 02:45:45 +00:00
bouyer
fec31ce43e Check that vnd is not NULL before using it, return ENXIO if it is.
Avoids a panic when vnconfig -uF is used on a busy vnd.
2008-11-19 18:38:36 +00:00
ad
0efea177e3 Remove LKMs and switch to the module framework, pass 1.
Proposed on tech-kern@.
2008-11-12 12:35:50 +00:00
ad
3704b6874f PR kern/38872 vnconfig panics with rw lock error
Pass IO_NODELOCKED where needed.
2008-09-24 07:57:30 +00:00
kardel
b6ecf59844 buf_destroy() an embedded buffer before returning memory to pool
issue detected by LOCKDEBUG panicing about "allocation contains active lock"
2008-07-19 13:58:08 +00:00
cegger
d9fad28f12 Disable the check introduced in rev. 1.184. It works in first place, but not in second place.
The new check is not enough to detect sparse files reliably.
per discussion with bouyer
2008-06-17 09:01:56 +00:00
cegger
75946855ff Checking if the underlying file system supports VOP_BMAP and VOP_STRATEGY does not imply that works.
Test if VOP_BMAP actually works before using bmap/strategy.

When you create an image with

dd if=/dev/zero of=./netbsd.img bs=1m count=1 seek=1000

then the current check actually determines the "file system"
in the image supports VOP_BMAP and VOP_STRATEGY, but VOP_BMAP can't
translate any logical block numbers which results in EIO failures.

When you try to access the image in a Xen DomU you see all disk operations
failing. Therefore test if VOP_BMAP actually works and fall back to
VOP_READ/VOP_WRITE if it doesn't.

This makes a Xen DomU installation working. When you boot your fresh
installed Xen DomU with a valid disklabel and file system in the image,
VOP_BMAP actually works and is used.

This allows you to create an image with dd as above on the Dom0 and
run a DomU installation or to quickly create another virtual disk for
an existing DomU without having to create a disklabel and file system
by hand.
2008-06-14 11:44:57 +00:00
cegger
826cd7b39b add closing bracket in debug message 2008-06-14 07:52:36 +00:00
cegger
fc8fd752ef device_private(device_lookup()) -> device_lookup_private()
ok cube@
2008-06-10 22:53:08 +00:00
ad
2bbb14eaa4 Back out previous. It broke the build. 2008-05-05 13:41:29 +00:00
ad
b407147f14 Move zlib out of net/ and into kern/. It would probably be better to use
the reachover Makefiles and libz, but this is already here and it works.
2008-05-04 23:07:09 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
cegger
c1886a2781 use aprint_*_dev and device_xname 2008-04-09 05:47:19 +00:00
ad
a9ca7a3734 Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
2008-03-21 21:54:58 +00:00
cube
e567de2f43 Split device_t/softc and other related cosmetic changes. 2008-03-04 23:03:29 +00:00
ad
4a780c9ae2 Merge vmlocking2 to head. 2008-01-02 11:48:20 +00:00
riz
0673bc57e4 Add disk-info properties to vnd(4), for use by userland tools
such as gpt(8).
2007-12-18 23:22:18 +00:00
smb
472e153a90 Add power management hooks 2007-12-12 03:54:27 +00:00
pooka
db06a930e6 Remove cn_lwp from struct componentname. curlwp should be used
from on.  The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
2007-12-08 19:29:36 +00:00
pooka
61e8303e9d Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start.  In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
2007-11-26 19:01:26 +00:00
ad
2af68666da Merge disk init changes from the vmlocking branch. These seperate init /
destroy of 'struct disk' from attach / detach.
2007-10-08 16:41:05 +00:00
ad
eb171eaaa7 It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
2007-07-29 12:50:17 +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
hannken
e956461048 Remove calls to now obsolete vn_start_write() and vn_finished_write(). 2007-04-07 15:06:53 +00:00
ad
59d979c5f1 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-12 18:18:22 +00:00
yamt
073d78105b use b_bcount where appropriate rather than keeping b_resid sync with it.
no functional changes.
2007-03-09 05:28:37 +00:00