Commit Graph

36 Commits

Author SHA1 Message Date
christos e7ae23fd9e include "ioconf.h" to get the 'void <driver>attach(int count);' prototype. 2015-08-20 14:40:16 +00:00
mlelstv bdddf44518 disk_blocksize and disk_set_info relay the same information
to the disk subsystem.

Make disk_set_info also set blocksize shift values.
Remove every call to disk_blocksize.

Keep disk_blocksize for ABI compatibility, make it also set dg_secsize.
2014-12-31 08:24:50 +00:00
justin 1d1c6d781a devmajor_t not int 2014-10-02 21:01:38 +00:00
dholland f9228f4225 Add d_discard to all struct cdevsw instances I could find.
All have been set to "nodiscard"; some should get a real implementation.
2014-07-25 08:10:31 +00:00
dholland 8c70ef39af Add d_discard to all struct bdevsw instances I could find.
I've set them all to nodiscard. Some of them (wd, dk, vnd, ld,
raidframe, maybe cgd) should be implemented for real.
2014-07-25 08:02:18 +00:00
pgoyette e5a29159a9 Make dksubr.c into a module, and make the cgd and dm modules depend on
it.

Now that cgd is completely modularized, descend into modules/cgd to
actually create the module.
2013-12-28 19:25:07 +00:00
christos 0fbaa47180 remove unused variables 2013-10-18 19:56:30 +00:00
christos 7b845fa9dc phase 1 of disk geometry cleanup:
- centralize the geometry -> plist code so that we don't have
	  n useless copies of it.
2013-05-29 00:47:48 +00:00
elad 0c9d8d15c9 Replace the remaining KAUTH_GENERIC_ISSUSER authorization calls with
something meaningful. All relevant documentation has been updated or
written.

Most of these changes were brought up in the following messages:

    http://mail-index.netbsd.org/tech-kern/2012/01/18/msg012490.html
    http://mail-index.netbsd.org/tech-kern/2012/01/19/msg012502.html
    http://mail-index.netbsd.org/tech-kern/2012/02/17/msg012728.html

Thanks to christos, manu, njoly, and jmmv for input.

Huge thanks to pgoyette for spinning these changes through some build
cycles and ATF.
2012-03-13 18:40:26 +00:00
christos 789f5516b0 Now that we have allowed operator to access the control node, make sure
that he cannot cause damage, by only allowing the superuser to do ioctls
that can cause damage.
2010-12-23 20:07:13 +00:00
mlelstv 75268cff3f make dm aware of physical sector sizes.
For aggregates of multiple disks we use the largest sector size from
all disks. For standard power-of-2 sizes this is the same as the least
common multiple. We still require proper alignment of the targets in
the mapping table.

ok by haad@
2010-12-23 14:58:13 +00:00
haad 08d72eb06c I have forgot to fix dm_dev_counter here, too. 2010-12-06 09:12:23 +00:00
haad 1a571ae457 Add old file describing locking schema used in dm driver. 2010-10-23 21:18:54 +00:00
haad 2b4880da46 In rome do as romans do. If I will get EEXIST from devsw_attach don't exit and
continue. This unbreaks usage of libdm in RUMP.
2010-10-09 12:56:06 +00:00
haad fb8751aba4 Add support for DIOCCACHESYNC ioctl for dm devices. Add new sync function
pointer to dm_target_t because that is the only part of dm which know real
block device. disk_ioctl_switch parses whole device table and for every
entry it calls particular sync routine which propagates DIOCCACHESYNC
to real disk.

While I was here implement some KNF fixes and remove unneeded symbols from
dm.h.

Problem reported on port-xen@ by Hugo Silva.
2010-05-18 15:10:38 +00:00
jakllsch c2ca7b837e Fix build of i386 ALL kernel with patch from Greg A. Woods in PR/43056. 2010-03-26 15:46:04 +00:00
jakllsch 165a0cf70b Rework module/builtin code so it works in both cases.
(Tested recently in the module case, slightly less recently as builtin.)

<haad> [if it works] go for it
2010-03-23 15:09:45 +00:00
haad 0d21743f10 Disable disk_ioctl_switch fo device-mapper control device. 2010-03-12 16:26:26 +00:00
jakllsch dd483616f8 Use RUN_ONCE(9) again. (Everyone happy now?) 2010-02-27 00:31:57 +00:00
jakllsch 7d0469d4c4 Use correct prototype for dmattach(). 2010-02-26 23:52:43 +00:00
haad 58c910bce8 Fix device-mapper to work in builtin case. This commit fixes
PR: 42799

REwork fix commited by jak@ to be more readable and remove unneeded ifdef _MODULE.
2010-02-25 23:37:39 +00:00
jakllsch 6fc9836341 Be sure to config_cfattach_attach() in dmattach().
Loosely based on patch from Brian Brombacher,
with other inspriation from vnd(4).

This should fix PR kern/42799.

While here, a few prototype, style and namespace pollution-related changes.
2010-02-25 20:48:58 +00:00
pooka 5b81af7179 Fix this for non-module (which, i guess, is only i386/ALL).
XXX: autoconfusion vs. modules is an intolerable mess of stepping
on each others' toes.
2010-01-08 00:27:48 +00:00
haad 66ff911808 Refactor dmioctl to by cleaner and to copyout dictionary in case when something
went wrong.
2010-01-03 22:55:25 +00:00
haad c52cab8857 KNF police, remove unnecessary whitespaces and tabulators. Refactor dmioctl
to not use prop_dictionary_copy* functions if NetBSD_DM_IOCTL command was
not called on device. If disk_ioctl returms anything else then ENOTTY exit
from dmioctl.
2010-01-03 22:44:10 +00:00
haad b9ba4842ce Hook device-mapper to autoconf framework. Add dm_attach, dm_match and dm_detach
routines used by autoconf users. Change dm_dev_remove_ioctl to call dm_detach.

This should be primary used by kernel to disable devices during shutdown of
system with nested disk devices.

Requested by dyoung@.
2010-01-03 22:22:23 +00:00
haad 36fe06980c Add private lock to dm_dev_t used for mutual exclusion for diks(9) api
routines. This change fixes PR kern/42532.
2009-12-29 23:37:47 +00:00
haad 8181298188 Add support for DM_QUERY_INACTIVE_TABLE_FLAG to dm_table_status and dm_table_deps
this flag was introduced to dm->lvm protocol in 4.16.0 version of it. Restore
vrsion check functionality and sent back actual kernel driver version.
2009-12-06 14:33:46 +00:00
joerg 336cbcc88d Don't spam the console with debug messages. 2009-10-16 21:23:08 +00:00
jakllsch f6c1b3e09a Some fixes for dm(4).
- Limit accesses to the size of the volume.
   This fixes a KASSERT in physio_biodone().
 - Change dm_table_size() to return the size of the volume in
   DEV_BSIZE units.  It was reporting it in DEV_BSIZE^2 units.
 - Remove a bit of trailing whitespace.

ok haad
2009-06-27 16:10:25 +00:00
haad f5b48500f1 Add support for DIOCGDISKINFO to disk like device drivers. Change
partutil.c::getdiskinfo to use it to get disk geometry info.
Use DIOCGWEDGEINFO ioctl to get information about partition size, if disk
driver doesn't support it use old DIOCGDINFO. This patch adds support for
wedge like devices(lvm logical volumes, ZFS zvol partitions) to newfs and
other tools.

No objections on tech-userlevel@.
2009-06-05 21:52:31 +00:00
haad ba7fcfeeb5 Use functions from disk(9) framework. Initialize disk/disklabel during
dm_device_create_ioctl, before calling dmgetdisklabel.
Use disk_busy/disk_unbusy in dmstrategy to display LVM LV's in iostat
output.
2009-04-06 22:58:10 +00:00
agc dc733729ad Move back to printing the minor device as a 32-bit entity 2009-01-22 04:56:06 +00:00
haad 44e4eeea57 Disable unloading of dm driver when there are any devices defined. This means
that we have to run lvm vgchange -a n before modunload in NetBSD.

We really need to disable module unloading only for mounted devices, I have
to look at vfs_hooks for mount/umount calls and find way how to mark devices
as mounted in dm driver.
2009-01-16 00:46:12 +00:00
haad ae10a6c772 Fix aprint_debug after christos-time_t merge. 2009-01-11 11:44:23 +00:00
haad c9d0c62a0c Merge the haad-dm branch to -current. This branch adds LVM functionality to
the base NetBSD system. It uses Linux LVM2 tools and our BSD licensed
device-mapper driver.

The device-mapper driver can be used to create virtual block devices which
maps virtual blocks to real with target mapping called target. Currently
these targets are available a linear, zero, error and a snapshot (this is
work in progress and doesn't work yet).

The lvm2tools adds lvm and dmsetup binary to based system, where the lvm
tool is used to manage and administer whole LVM and the dmestup is used to
communicate iwith device-mapper kernel driver. With these tools also
a libdevmapper library is instaled to the base system.

Building of tools and driver is currently disable and can be enabled with
MKLVM=yes in mk.conf. I will add sets lists and rc.d script soon.

Oked by agc@ and cube@.
2008-12-19 15:24:03 +00:00