head	1.2;
access;
symbols
	netbsd-11-0-RC4:1.2
	netbsd-11-0-RC3:1.2
	netbsd-11-0-RC2:1.2
	netbsd-11-0-RC1:1.2
	perseant-exfatfs-base-20250801:1.2
	netbsd-11:1.2.0.112
	netbsd-11-base:1.2
	netbsd-10-1-RELEASE:1.2
	perseant-exfatfs-base-20240630:1.2
	perseant-exfatfs:1.2.0.110
	perseant-exfatfs-base:1.2
	netbsd-8-3-RELEASE:1.2
	netbsd-9-4-RELEASE:1.2
	netbsd-10-0-RELEASE:1.2
	netbsd-10-0-RC6:1.2
	netbsd-10-0-RC5:1.2
	netbsd-10-0-RC4:1.2
	netbsd-10-0-RC3:1.2
	netbsd-10-0-RC2:1.2
	thorpej-ifq:1.2.0.108
	thorpej-ifq-base:1.2
	thorpej-altq-separation:1.2.0.106
	thorpej-altq-separation-base:1.2
	netbsd-10-0-RC1:1.2
	netbsd-10:1.2.0.104
	netbsd-10-base:1.2
	bouyer-sunxi-drm:1.2.0.102
	bouyer-sunxi-drm-base:1.2
	netbsd-9-3-RELEASE:1.2
	thorpej-i2c-spi-conf2:1.2.0.100
	thorpej-i2c-spi-conf2-base:1.2
	thorpej-futex2:1.2.0.98
	thorpej-futex2-base:1.2
	thorpej-cfargs2:1.2.0.96
	thorpej-cfargs2-base:1.2
	cjep_sun2x-base1:1.2
	cjep_sun2x:1.2.0.94
	cjep_sun2x-base:1.2
	cjep_staticlib_x-base1:1.2
	netbsd-9-2-RELEASE:1.2
	cjep_staticlib_x:1.2.0.92
	cjep_staticlib_x-base:1.2
	thorpej-i2c-spi-conf:1.2.0.90
	thorpej-i2c-spi-conf-base:1.2
	thorpej-cfargs:1.2.0.88
	thorpej-cfargs-base:1.2
	thorpej-futex:1.2.0.86
	thorpej-futex-base:1.2
	netbsd-9-1-RELEASE:1.2
	bouyer-xenpvh-base2:1.2
	phil-wifi-20200421:1.2
	bouyer-xenpvh-base1:1.2
	phil-wifi-20200411:1.2
	bouyer-xenpvh:1.2.0.84
	bouyer-xenpvh-base:1.2
	is-mlppp:1.2.0.82
	is-mlppp-base:1.2
	phil-wifi-20200406:1.2
	netbsd-8-2-RELEASE:1.2
	ad-namecache-base3:1.2
	netbsd-9-0-RELEASE:1.2
	netbsd-9-0-RC2:1.2
	ad-namecache-base2:1.2
	ad-namecache-base1:1.2
	ad-namecache:1.2.0.80
	ad-namecache-base:1.2
	netbsd-9-0-RC1:1.2
	phil-wifi-20191119:1.2
	netbsd-9:1.2.0.78
	netbsd-9-base:1.2
	phil-wifi-20190609:1.2
	netbsd-8-1-RELEASE:1.2
	netbsd-8-1-RC1:1.2
	isaki-audio2:1.2.0.76
	isaki-audio2-base:1.2
	pgoyette-compat-merge-20190127:1.2
	pgoyette-compat-20190127:1.2
	pgoyette-compat-20190118:1.2
	pgoyette-compat-1226:1.2
	pgoyette-compat-1126:1.2
	pgoyette-compat-1020:1.2
	pgoyette-compat-0930:1.2
	pgoyette-compat-0906:1.2
	jdolecek-ncqfixes:1.2.0.74
	jdolecek-ncqfixes-base:1.2
	netbsd-7-2-RELEASE:1.2
	pgoyette-compat-0728:1.2
	netbsd-8-0-RELEASE:1.2
	phil-wifi:1.2.0.72
	phil-wifi-base:1.2
	pgoyette-compat-0625:1.2
	netbsd-8-0-RC2:1.2
	pgoyette-compat-0521:1.2
	pgoyette-compat-0502:1.2
	pgoyette-compat-0422:1.2
	netbsd-8-0-RC1:1.2
	pgoyette-compat-0415:1.2
	pgoyette-compat-0407:1.2
	pgoyette-compat-0330:1.2
	pgoyette-compat-0322:1.2
	pgoyette-compat-0315:1.2
	netbsd-7-1-2-RELEASE:1.2
	pgoyette-compat:1.2.0.70
	pgoyette-compat-base:1.2
	netbsd-7-1-1-RELEASE:1.2
	tls-maxphys-base-20171202:1.2
	matt-nb8-mediatek:1.2.0.68
	matt-nb8-mediatek-base:1.2
	nick-nhusb-base-20170825:1.2
	perseant-stdc-iso10646:1.2.0.66
	perseant-stdc-iso10646-base:1.2
	netbsd-8:1.2.0.64
	netbsd-8-base:1.2
	prg-localcount2-base3:1.2
	prg-localcount2-base2:1.2
	prg-localcount2-base1:1.2
	prg-localcount2:1.2.0.62
	prg-localcount2-base:1.2
	pgoyette-localcount-20170426:1.2
	bouyer-socketcan-base1:1.2
	jdolecek-ncq:1.2.0.60
	jdolecek-ncq-base:1.2
	pgoyette-localcount-20170320:1.2
	netbsd-7-1:1.2.0.58
	netbsd-7-1-RELEASE:1.2
	netbsd-7-1-RC2:1.2
	nick-nhusb-base-20170204:1.2
	netbsd-7-nhusb-base-20170116:1.2
	bouyer-socketcan:1.2.0.56
	bouyer-socketcan-base:1.2
	pgoyette-localcount-20170107:1.2
	netbsd-7-1-RC1:1.2
	nick-nhusb-base-20161204:1.2
	pgoyette-localcount-20161104:1.2
	netbsd-7-0-2-RELEASE:1.2
	nick-nhusb-base-20161004:1.2
	localcount-20160914:1.2
	netbsd-7-nhusb:1.2.0.54
	netbsd-7-nhusb-base:1.2
	pgoyette-localcount-20160806:1.2
	pgoyette-localcount-20160726:1.2
	pgoyette-localcount:1.2.0.52
	pgoyette-localcount-base:1.2
	nick-nhusb-base-20160907:1.2
	nick-nhusb-base-20160529:1.2
	netbsd-7-0-1-RELEASE:1.2
	nick-nhusb-base-20160422:1.2
	nick-nhusb-base-20160319:1.2
	nick-nhusb-base-20151226:1.2
	netbsd-7-0:1.2.0.50
	netbsd-7-0-RELEASE:1.2
	nick-nhusb-base-20150921:1.2
	netbsd-7-0-RC3:1.2
	netbsd-7-0-RC2:1.2
	netbsd-7-0-RC1:1.2
	nick-nhusb-base-20150606:1.2
	nick-nhusb-base-20150406:1.2
	nick-nhusb:1.2.0.48
	nick-nhusb-base:1.2
	netbsd-5-2-3-RELEASE:1.1
	netbsd-5-1-5-RELEASE:1.1
	netbsd-6-0-6-RELEASE:1.2
	netbsd-6-1-5-RELEASE:1.2
	netbsd-7:1.2.0.46
	netbsd-7-base:1.2
	yamt-pagecache-base9:1.2
	yamt-pagecache-tag8:1.2
	netbsd-6-1-4-RELEASE:1.2
	netbsd-6-0-5-RELEASE:1.2
	tls-earlyentropy:1.2.0.44
	tls-earlyentropy-base:1.2
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.2
	riastradh-drm2-base3:1.2
	netbsd-6-1-3-RELEASE:1.2
	netbsd-6-0-4-RELEASE:1.2
	netbsd-5-2-2-RELEASE:1.1
	netbsd-5-1-4-RELEASE:1.1
	netbsd-6-1-2-RELEASE:1.2
	netbsd-6-0-3-RELEASE:1.2
	netbsd-5-2-1-RELEASE:1.1
	netbsd-5-1-3-RELEASE:1.1
	rmind-smpnet-nbase:1.2
	netbsd-6-1-1-RELEASE:1.2
	riastradh-drm2-base2:1.2
	riastradh-drm2-base1:1.2
	riastradh-drm2:1.2.0.42
	riastradh-drm2-base:1.2
	rmind-smpnet:1.2.0.34
	rmind-smpnet-base:1.2
	netbsd-6-1:1.2.0.40
	netbsd-6-0-2-RELEASE:1.2
	netbsd-6-1-RELEASE:1.2
	khorben-n900:1.2.0.38
	netbsd-6-1-RC4:1.2
	netbsd-6-1-RC3:1.2
	agc-symver:1.2.0.36
	agc-symver-base:1.2
	netbsd-6-1-RC2:1.2
	netbsd-6-1-RC1:1.2
	yamt-pagecache-base8:1.2
	netbsd-5-2:1.1.0.14
	netbsd-6-0-1-RELEASE:1.2
	yamt-pagecache-base7:1.2
	netbsd-5-2-RELEASE:1.1
	netbsd-5-2-RC1:1.1
	matt-nb6-plus-nbase:1.2
	yamt-pagecache-base6:1.2
	netbsd-6-0:1.2.0.32
	netbsd-6-0-RELEASE:1.2
	netbsd-6-0-RC2:1.2
	tls-maxphys:1.2.0.30
	tls-maxphys-base:1.2
	matt-nb6-plus:1.2.0.28
	matt-nb6-plus-base:1.2
	netbsd-6-0-RC1:1.2
	jmcneill-usbmp-base10:1.2
	yamt-pagecache-base5:1.2
	jmcneill-usbmp-base9:1.2
	yamt-pagecache-base4:1.2
	jmcneill-usbmp-base8:1.2
	jmcneill-usbmp-base7:1.2
	jmcneill-usbmp-base6:1.2
	jmcneill-usbmp-base5:1.2
	jmcneill-usbmp-base4:1.2
	jmcneill-usbmp-base3:1.2
	jmcneill-usbmp-pre-base2:1.2
	jmcneill-usbmp-base2:1.2
	netbsd-6:1.2.0.26
	netbsd-6-base:1.2
	netbsd-5-1-2-RELEASE:1.1
	netbsd-5-1-1-RELEASE:1.1
	jmcneill-usbmp:1.2.0.24
	jmcneill-usbmp-base:1.2
	jmcneill-audiomp3:1.2.0.22
	jmcneill-audiomp3-base:1.2
	yamt-pagecache-base3:1.2
	yamt-pagecache-base2:1.2
	yamt-pagecache:1.2.0.20
	yamt-pagecache-base:1.2
	rmind-uvmplock-nbase:1.2
	cherry-xenmp:1.2.0.18
	cherry-xenmp-base:1.2
	bouyer-quota2-nbase:1.2
	bouyer-quota2:1.2.0.16
	bouyer-quota2-base:1.2
	jruoho-x86intr:1.2.0.14
	jruoho-x86intr-base:1.2
	matt-mips64-premerge-20101231:1.2
	matt-nb5-pq3:1.1.0.12
	matt-nb5-pq3-base:1.1
	netbsd-5-1:1.1.0.10
	netbsd-5-1-RELEASE:1.1
	uebayasi-xip-base4:1.2
	uebayasi-xip-base3:1.2
	yamt-nfs-mp-base11:1.2
	netbsd-5-1-RC4:1.1
	uebayasi-xip-base2:1.2
	yamt-nfs-mp-base10:1.2
	netbsd-5-1-RC3:1.1
	netbsd-5-1-RC2:1.1
	uebayasi-xip-base1:1.2
	netbsd-5-1-RC1:1.1
	rmind-uvmplock:1.2.0.12
	rmind-uvmplock-base:1.2
	yamt-nfs-mp-base9:1.2
	uebayasi-xip:1.2.0.10
	uebayasi-xip-base:1.2
	netbsd-5-0-2-RELEASE:1.1
	matt-premerge-20091211:1.2
	yamt-nfs-mp-base8:1.2
	yamt-nfs-mp-base7:1.2
	netbsd-5-0-1-RELEASE:1.1
	jymxensuspend-base:1.2
	yamt-nfs-mp-base6:1.2
	yamt-nfs-mp-base5:1.2
	yamt-nfs-mp-base4:1.2
	jym-xensuspend-nbase:1.2
	yamt-nfs-mp:1.2.0.8
	yamt-nfs-mp-base3:1.2
	nick-hppapmap-base4:1.2
	nick-hppapmap-base3:1.2
	netbsd-5-0:1.1.0.8
	netbsd-5-0-RELEASE:1.1
	netbsd-5-0-RC4:1.1
	netbsd-5-0-RC3:1.1
	nick-hppapmap-base2:1.2
	netbsd-5-0-RC2:1.1
	jym-xensuspend:1.2.0.6
	jym-xensuspend-base:1.2
	netbsd-5-0-RC1:1.1
	nick-hppapmap-base:1.2
	nick-hppapmap:1.2.0.4
	mjf-devfs2:1.2.0.2
	haad-dm-base:1.1
	haad-dm-base2:1.1
	haad-nbase2:1.1
	ad-audiomp2:1.1.0.6
	ad-audiomp2-base:1.1
	netbsd-5:1.1.0.4
	netbsd-5-base:1.1
	haad-dm-base1:1.1
	mjf-devfs2-base:1.2
	simonb-wapbl-base:1.1
	simonb-wapbl-nbase:1.1
	haad-dm:1.1.0.2;
locks; strict;
comment	@# @;


1.2
date	2008.12.19.15.24.03;	author haad;	state Exp;
branches
	1.2.2.1
	1.2.4.1
	1.2.8.1;
next	1.1;

1.1
date	2008.07.07.14.45.53;	author haad;	state dead;
branches
	1.1.2.1;
next	;

1.2.2.1
date	2008.12.19.15.24.03;	author mjf;	state dead;
branches;
next	1.2.2.2;

1.2.2.2
date	2009.01.17.13.28.53;	author mjf;	state Exp;
branches;
next	;

1.2.4.1
date	2008.12.19.15.24.03;	author skrll;	state dead;
branches;
next	1.2.4.2;

1.2.4.2
date	2009.01.19.13.17.53;	author skrll;	state Exp;
branches;
next	;

1.2.8.1
date	2008.12.19.15.24.03;	author yamt;	state dead;
branches;
next	1.2.8.2;

1.2.8.2
date	2009.05.04.08.12.37;	author yamt;	state Exp;
branches;
next	;

1.1.2.1
date	2008.07.07.14.45.53;	author haad;	state Exp;
branches;
next	;


desc
@@


1.2
log
@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@@.
@
text
@

/* constant dm_target structures for error, zero, linear, stripes etc. */
struct dm_target {
	int (*init)(struct dm_table_entry *, int argc, char **argv);
	int (*destroy)(struct dm_table_entry *);
	int (*strategy)(struct dm_table_entry *, struct buf *);
	int (*upcall)(struct dm_table_entry *, struct buf *);

	SLIST_ENTRY(dm_target) next;
};


struct dm_table_entry {
	struct dm_dev *dm_dev;		/* backlink */
	uint64_t start;
	uint64_t length;

	struct dm_target *target;
	void *target_config;
	SLIST_ENTRY(dm_table_entry) next;
};
SLIST(dm_table, dm_table_entry);


struct dm_pdev {
	struct vnode *pdev_vnode;
	int refcnt;
	SLIST_ENTRY(dm_pdev) next_pdev;
};
SLIST(dm_pdevs, pm_pdev);


struct dm_dev {
	char name[DM_NAME_LEN];
	char uuid[DM_UUID_LEN];

	int minor;
	uint32_t flags;

	kmutex_t dev_mtx;
	uint32_t event_nr;
	uint32_t ref_cnt;

	struct dm_pdev pdevs;

	int cur_active_table;
	struct dm_table tables[2];

	struct dm_dev_list upcalls;
	SLIST_NEXT(dm_dev) next_upcall;

	SLIST_NEXT(dm_dev) next_devlist;
};
SLIST(dm_dev_list, dm_dev) dm_devs;


/* for zero,error : dm_target->target_config == NULL */
/* for linear : */
struct target_linear_config {
	struct dm_pdev *pdev;
	uint64_t offset;
};


/* for mirror : */
struct target_mirror_config {
	struct dm_pdev *orig;
	struct dm_pdev *copies[MAX_MIRROR_COPIES];

	/* copied blocks bitmaps administration etc*/
	struct dm_pdev *log_pdev;	/* for administration */
	uint64_t log_regionsize;	/* blocksize of mirror */

	/* list of parts that still need copied etc.; run length encoded? */
	....
};


/* for snapshot : */
struct target_snapshot_config {
	struct dm_dev *orig;

	/* modified blocks bitmaps administration etc*/
	struct dm_pdev *log_pdev;
	uint64_t log_regionsize;
	/* list of sector renames to the log device */
	...
};

@


1.2.8.1
log
@file proposal-dm.txt was added on branch yamt-nfs-mp on 2009-05-04 08:12:37 +0000
@
text
@d1 90
@


1.2.8.2
log
@sync with head.
@
text
@a0 90


/* constant dm_target structures for error, zero, linear, stripes etc. */
struct dm_target {
	int (*init)(struct dm_table_entry *, int argc, char **argv);
	int (*destroy)(struct dm_table_entry *);
	int (*strategy)(struct dm_table_entry *, struct buf *);
	int (*upcall)(struct dm_table_entry *, struct buf *);

	SLIST_ENTRY(dm_target) next;
};


struct dm_table_entry {
	struct dm_dev *dm_dev;		/* backlink */
	uint64_t start;
	uint64_t length;

	struct dm_target *target;
	void *target_config;
	SLIST_ENTRY(dm_table_entry) next;
};
SLIST(dm_table, dm_table_entry);


struct dm_pdev {
	struct vnode *pdev_vnode;
	int refcnt;
	SLIST_ENTRY(dm_pdev) next_pdev;
};
SLIST(dm_pdevs, pm_pdev);


struct dm_dev {
	char name[DM_NAME_LEN];
	char uuid[DM_UUID_LEN];

	int minor;
	uint32_t flags;

	kmutex_t dev_mtx;
	uint32_t event_nr;
	uint32_t ref_cnt;

	struct dm_pdev pdevs;

	int cur_active_table;
	struct dm_table tables[2];

	struct dm_dev_list upcalls;
	SLIST_NEXT(dm_dev) next_upcall;

	SLIST_NEXT(dm_dev) next_devlist;
};
SLIST(dm_dev_list, dm_dev) dm_devs;


/* for zero,error : dm_target->target_config == NULL */
/* for linear : */
struct target_linear_config {
	struct dm_pdev *pdev;
	uint64_t offset;
};


/* for mirror : */
struct target_mirror_config {
	struct dm_pdev *orig;
	struct dm_pdev *copies[MAX_MIRROR_COPIES];

	/* copied blocks bitmaps administration etc*/
	struct dm_pdev *log_pdev;	/* for administration */
	uint64_t log_regionsize;	/* blocksize of mirror */

	/* list of parts that still need copied etc.; run length encoded? */
	....
};


/* for snapshot : */
struct target_snapshot_config {
	struct dm_dev *orig;

	/* modified blocks bitmaps administration etc*/
	struct dm_pdev *log_pdev;
	uint64_t log_regionsize;
	/* list of sector renames to the log device */
	...
};

@


1.2.4.1
log
@file proposal-dm.txt was added on branch nick-hppapmap on 2009-01-19 13:17:53 +0000
@
text
@d1 90
@


1.2.4.2
log
@Sync with HEAD.
@
text
@a0 90


/* constant dm_target structures for error, zero, linear, stripes etc. */
struct dm_target {
	int (*init)(struct dm_table_entry *, int argc, char **argv);
	int (*destroy)(struct dm_table_entry *);
	int (*strategy)(struct dm_table_entry *, struct buf *);
	int (*upcall)(struct dm_table_entry *, struct buf *);

	SLIST_ENTRY(dm_target) next;
};


struct dm_table_entry {
	struct dm_dev *dm_dev;		/* backlink */
	uint64_t start;
	uint64_t length;

	struct dm_target *target;
	void *target_config;
	SLIST_ENTRY(dm_table_entry) next;
};
SLIST(dm_table, dm_table_entry);


struct dm_pdev {
	struct vnode *pdev_vnode;
	int refcnt;
	SLIST_ENTRY(dm_pdev) next_pdev;
};
SLIST(dm_pdevs, pm_pdev);


struct dm_dev {
	char name[DM_NAME_LEN];
	char uuid[DM_UUID_LEN];

	int minor;
	uint32_t flags;

	kmutex_t dev_mtx;
	uint32_t event_nr;
	uint32_t ref_cnt;

	struct dm_pdev pdevs;

	int cur_active_table;
	struct dm_table tables[2];

	struct dm_dev_list upcalls;
	SLIST_NEXT(dm_dev) next_upcall;

	SLIST_NEXT(dm_dev) next_devlist;
};
SLIST(dm_dev_list, dm_dev) dm_devs;


/* for zero,error : dm_target->target_config == NULL */
/* for linear : */
struct target_linear_config {
	struct dm_pdev *pdev;
	uint64_t offset;
};


/* for mirror : */
struct target_mirror_config {
	struct dm_pdev *orig;
	struct dm_pdev *copies[MAX_MIRROR_COPIES];

	/* copied blocks bitmaps administration etc*/
	struct dm_pdev *log_pdev;	/* for administration */
	uint64_t log_regionsize;	/* blocksize of mirror */

	/* list of parts that still need copied etc.; run length encoded? */
	....
};


/* for snapshot : */
struct target_snapshot_config {
	struct dm_dev *orig;

	/* modified blocks bitmaps administration etc*/
	struct dm_pdev *log_pdev;
	uint64_t log_regionsize;
	/* list of sector renames to the log device */
	...
};

@


1.2.2.1
log
@file proposal-dm.txt was added on branch mjf-devfs2 on 2009-01-17 13:28:53 +0000
@
text
@d1 90
@


1.2.2.2
log
@Sync with HEAD.
@
text
@a0 90


/* constant dm_target structures for error, zero, linear, stripes etc. */
struct dm_target {
	int (*init)(struct dm_table_entry *, int argc, char **argv);
	int (*destroy)(struct dm_table_entry *);
	int (*strategy)(struct dm_table_entry *, struct buf *);
	int (*upcall)(struct dm_table_entry *, struct buf *);

	SLIST_ENTRY(dm_target) next;
};


struct dm_table_entry {
	struct dm_dev *dm_dev;		/* backlink */
	uint64_t start;
	uint64_t length;

	struct dm_target *target;
	void *target_config;
	SLIST_ENTRY(dm_table_entry) next;
};
SLIST(dm_table, dm_table_entry);


struct dm_pdev {
	struct vnode *pdev_vnode;
	int refcnt;
	SLIST_ENTRY(dm_pdev) next_pdev;
};
SLIST(dm_pdevs, pm_pdev);


struct dm_dev {
	char name[DM_NAME_LEN];
	char uuid[DM_UUID_LEN];

	int minor;
	uint32_t flags;

	kmutex_t dev_mtx;
	uint32_t event_nr;
	uint32_t ref_cnt;

	struct dm_pdev pdevs;

	int cur_active_table;
	struct dm_table tables[2];

	struct dm_dev_list upcalls;
	SLIST_NEXT(dm_dev) next_upcall;

	SLIST_NEXT(dm_dev) next_devlist;
};
SLIST(dm_dev_list, dm_dev) dm_devs;


/* for zero,error : dm_target->target_config == NULL */
/* for linear : */
struct target_linear_config {
	struct dm_pdev *pdev;
	uint64_t offset;
};


/* for mirror : */
struct target_mirror_config {
	struct dm_pdev *orig;
	struct dm_pdev *copies[MAX_MIRROR_COPIES];

	/* copied blocks bitmaps administration etc*/
	struct dm_pdev *log_pdev;	/* for administration */
	uint64_t log_regionsize;	/* blocksize of mirror */

	/* list of parts that still need copied etc.; run length encoded? */
	....
};


/* for snapshot : */
struct target_snapshot_config {
	struct dm_dev *orig;

	/* modified blocks bitmaps administration etc*/
	struct dm_pdev *log_pdev;
	uint64_t log_regionsize;
	/* list of sector renames to the log device */
	...
};

@


1.1
log
@Add dmgetdefaultdisklabel to get virtual disklabel for Logical Volume device. Add snapshot targets (snapshot, snapshot-origin), add dm_type to dm_dev structure to identify type of device. e.g. we can have mirrored disk device with snapshot on them and spare disk on them. When driver want to work with snapshot devices, it looks to upcalls list and finds all DM_SNAPSHOT devices.
@
text
@d1 90
@


1.1.2.1
log
@Import of device-mapper driver. This driver is BSD rewrite of linux dm driver.
For now only error, linear and zero targets are supported. This driver uses NetBSD
specific ioctl protocola based on proplib.

I was able to create logical volume (with lvm2tools lvcreate utility) with this
version of driver, newfs it and mount it.
@
text
@a0 90


/* constant dm_target structures for error, zero, linear, stripes etc. */
struct dm_target {
	int (*init)(struct dm_table_entry *, int argc, char **argv);
	int (*destroy)(struct dm_table_entry *);
	int (*strategy)(struct dm_table_entry *, struct buf *);
	int (*upcall)(struct dm_table_entry *, struct buf *);

	SLIST_ENTRY(dm_target) next;
};


struct dm_table_entry {
	struct dm_dev *dm_dev;		/* backlink */
	uint64_t start;
	uint64_t length;

	struct dm_target *target;
	void *target_config;
	SLIST_ENTRY(dm_table_entry) next;
};
SLIST(dm_table, dm_table_entry);


struct dm_pdev {
	struct vnode *pdev_vnode;
	int refcnt;
	SLIST_ENTRY(dm_pdev) next_pdev;
};
SLIST(dm_pdevs, pm_pdev);


struct dm_dev {
	char name[DM_NAME_LEN];
	char uuid[DM_UUID_LEN];

	int minor;
	uint32_t flags;

	kmutex_t dev_mtx;
	uint32_t event_nr;
	uint32_t ref_cnt;

	struct dm_pdev pdevs;

	int cur_active_table;
	struct dm_table tables[2];

	struct dm_dev_list upcalls;
	SLIST_NEXT(dm_dev) next_upcall;

	SLIST_NEXT(dm_dev) next_devlist;
};
SLIST(dm_dev_list, dm_dev) dm_devs;


/* for zero,error : dm_target->target_config == NULL */
/* for linear : */
struct target_linear_config {
	struct dm_pdev *pdev;
	uint64_t offset;
};


/* for mirror : */
struct target_mirror_config {
	struct dm_pdev *orig;
	struct dm_pdev *copies[MAX_MIRROR_COPIES];

	/* copied blocks bitmaps administration etc*/
	struct dm_pdev *log_pdev;	/* for administration */
	uint64_t log_regionsize;	/* blocksize of mirror */

	/* list of parts that still need copied etc.; run length encoded? */
	....
};


/* for snapshot : */
struct target_snapshot_config {
	struct dm_dev *orig;

	/* modified blocks bitmaps administration etc*/
	struct dm_pdev *log_pdev;
	uint64_t log_regionsize;
	/* list of sector renames to the log device */
	...
};

@

