Commit Graph

78 Commits

Author SHA1 Message Date
christos 0f179f793d add cgdconfig -l like vnconfig -l 2012-12-05 02:23:20 +00:00
elric 99c563ccca Modify dksubr.c to add a function that sets the disk properties in
the drvctl framework.  And call this new functionality from cgd(4),
the consumer of dksubr.c.  We do this to allow gpt(8) to be able
to label cgd(4) disks.  We also add in some DIOCGSECTORSIZE logic
and we ensure that the WEDGE ioctls are not called on either
uninitialised disks or disks which have not been opened for write
access.
2012-05-25 10:53:46 +00:00
christos 9fc82cfc97 use getdisksize() instead of homebrew() 2011-11-13 23:03:24 +00:00
hannken 2cc7a01f10 Change the vnode locking protocol of VOP_GETATTR() to request at least
a shared lock.  Make all calls outside of file systems respect it.

The calls from file systems need review.

No objections from tech-kern.
2011-10-14 09:23:28 +00:00
jruoho b4a3a8f3ec Adjust the #ifdefs such that ccd(4) and cgd(4) show in
modstat(8) even if built into the kernel.
2011-06-21 06:23:38 +00:00
rmind e225b7bd09 Welcome to 5.99.53! Merge rmind-uvmplock branch:
- Reorganize locking in UVM and provide extra serialisation for pmap(9).
  New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
  the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
  Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
  kernel-lock on some ports).  Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
2011-06-12 03:35:36 +00:00
riastradh 1e0dbea92c Reject unaligned writes to cgd.
Fixes the following PRs:

PR kern/44515 (cgd dies on non-aligned writes to the raw device)
PR kern/44964 (cgd seems to panic on unaligned writes instead of giving EINVAL)

ok christos
2011-05-19 20:34:13 +00:00
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
joerg b6f836a257 Register with pmf. 2010-02-11 18:24:48 +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
dyoung 146411a622 Cosmetic: get out of cgdioctl() early. Instead of
int ret;

        switch (...) {
        case ...:
                ret = ...;
                break;
        }
        return ret;

write:

        switch (...) {
        case ...:
                return ...;
        }
2010-01-20 19:00:47 +00:00
dyoung c95d6a20b9 Get out of cgd_detach() early on error. Do not call disk_destroy(9)
on error, that leaves the cgd_softc in an inconsistent state.

Fixes a crash during shutdown reported by Patrick Welche.  Thanks
to Patrick for reporting and for testing the fix.
2010-01-20 18:55:17 +00:00
dyoung 08d9aa56c1 Provide a more complete modules hook, cgd_modcmd(), derived from
vnd_modcmd().
2010-01-12 23:49:34 +00:00
dyoung 1b379d7ac4 Make cgd(4) into a detachable pseudo-device. Thanks, Jan Danielsson,
for the patches!

I've lightly tested the basics: create cgd0 on vnd0d, initialize with
zeros, newfs /dev/cgd0a, mount, copy files on, unmount, drvctl -d
cgd0.  Works fine.  I also shutdown with a cgd0 configured: detached as
expected.
2010-01-12 21:08:08 +00:00
christos f026e97901 avoid doing extra work by just zeroing/printing real blocksize. 2009-11-10 20:39:36 +00:00
christos 6be7b72df0 add a missing c. 2009-11-10 20:24:30 +00:00
christos 189751127b avoid variable array stack allocation by enforcing and allocating always the
maximum.
2009-11-10 20:05:50 +00:00
tron 119d5d24b7 Backout the last two revisions because the cause panic on LOCKDEBUG
kernels. Problem reported by David Young.
2009-11-10 16:49:53 +00:00
tron c4dacb189a Fix incomplete conversion from stack buffers to heap buffers. 2009-09-11 13:36:37 +00:00
tron 71b58bd028 Don't allocate block buffers on the stack. This can cause stack overflows
in the kernel and breaks SSP builds.
2009-09-11 09:28:34 +00:00
haad 7147ed320b Add work in support for compiling ccd and cgd drivers as a modules. I forgot
to committ when I have written device module autoloading stuff.
2009-06-05 19:21:02 +00:00
apb caccc8126b Pass DIOCCACHESYNC ioctl down to the underlying disk.
Addresses PR 41016.
2009-03-14 17:56:47 +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
christos f63c93ecac PR/38735: Jonathan A. Kollasch: add the ability for cgd to be used on top of wedges 2008-11-21 20:14:20 +00:00
christos 66f8c2438f PR/39525: Joachim Schueth, Frederik Sausmikat:
cgd inadvertently encrypts blkno eight times to generate IV
Add "encblkno1" IV type to encrypt only once, rename old "encblkno" to
"encblkno8" for clarity, and make "encblkno" an alias for "encblkno8"
for backward compatibility.
2008-09-12 16:51:54 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +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
ad 0664a0459b Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
2008-01-04 21:17:40 +00:00
ad 4a780c9ae2 Merge vmlocking2 to head. 2008-01-02 11:48:20 +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
cube 954bc13440 Change dk_lookup() to accept an additional argument of the type enum uio_seg
that tells whether the given path is in user space or kernel space, so it
can tell NDINIT().

While the raidframe calls were ok, both ccd(4) and cgd(4) were passing
pointers to user space data, which leads to strange error on i386, as
reported by Jukka Salmi on current-users.

The issue has been there since last august, I'm actually a bit surprised
that no one in the meantime has used ccd(4) or cgd(4) on an arch where it
would have simply faulted.
2007-06-26 15:22:23 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
cbiere 810b552f37 cgd_ioctl_set():
* Corrected type of keybytes to size_t to prevent a potential buffer
    overflow on 64-bit archs.
  * Fixed incorrect but harmless use of sizeof.
hexprint():
  * Corrected cast to prevent sign extension if char is signed.
2007-01-19 18:59:59 +00:00
christos 491c94e1fc - remove size check; the init functions do it.
- fix size_t/int confusion
- caddr_t -> void *
2006-12-01 15:52:55 +00:00
christos 853fed0ed7 prevent blocksizes > 4K. 2006-11-25 21:13:23 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
xtraeme 4a09170d84 Use __unused in function arguments where appropiate. (hi christos) 2006-10-12 06:56:47 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
ad 3029ac48c7 - Use the LWP cached credentials where sane.
- Minor cosmetic changes.
2006-07-21 16:48:45 +00:00
christos 709b2e6f55 don't allocate too much stuff on the stack. 2006-06-20 03:20:44 +00:00
elad 2867b68bc3 integrate kauth. 2006-05-14 21:42:26 +00:00
xtraeme b2bb747d7c Make this build again (remove unused variable). 2006-01-04 17:16:35 +00:00
yamt 690d424f28 - add simple functions to allocate/free a buffer for i/o.
- make bufpool static.
2006-01-04 10:13:05 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
yamt 464cf44f6c dksubr: do b_blkno -> b_rawblkno translation earlier so that bufq can uses it. 2005-10-18 00:14:43 +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
yamt 5cb036f6e3 add wedge support to xbd and cgd. 2005-08-20 12:03:52 +00:00