Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Initial import of libdm and dmctl to tree. libdm library can...



details:   https://anonhg.NetBSD.org/src/rev/1ccdd69e20ed
branches:  trunk
changeset: 761799:1ccdd69e20ed
user:      haad <haad%NetBSD.org@localhost>
date:      Tue Feb 08 03:20:13 2011 +0000

description:
Initial import of libdm and dmctl to tree. libdm library can be used
to access, manage and manipulate device-mapper driver. Which opens us bunch
of new possibilities like

        dm-multipath device target
        dm-crypt     device target
        dm-ccd       compatibility layer

With this import I'm bringing in dmctl tool for working with dm driver ,too.
I plan to replace gpl2 licensed dmsetup command with our dmctl tool in near
feature. It can also by placed to /rescue where we was not able to put
dmsetup because of licensing problems.

With libdm in tree we can now write RUMP atf test suite for dm driver to
ensure LVM subsystem stability as time goes.

Reviewed by: blymn@ and rmind@
Oked: by no objections on tech-userlevel@

diffstat:

 distrib/sets/lists/base/mi     |    3 +-
 distrib/sets/lists/base/shl.mi |    8 +-
 distrib/sets/lists/comp/mi     |   11 +-
 distrib/sets/lists/comp/shl.mi |    4 +-
 distrib/sets/lists/man/mi      |    5 +-
 lib/Makefile                   |    3 +-
 lib/libdm/Makefile             |   23 +
 lib/libdm/dm.3                 |  386 +++++++++++++++++
 lib/libdm/dm.h                 |  154 +++++++
 lib/libdm/libdm_ioctl.c        |  895 +++++++++++++++++++++++++++++++++++++++++
 lib/libdm/shlib_version        |    4 +
 sbin/Makefile                  |    4 +-
 sbin/dmctl/Makefile            |   24 +
 sbin/dmctl/README              |   23 +
 sbin/dmctl/dmctl.8             |   65 ++
 sbin/dmctl/dmctl.c             |  580 ++++++++++++++++++++++++++
 share/man/man3/intro.3         |    9 +-
 17 files changed, 2192 insertions(+), 9 deletions(-)

diffs (truncated from 2419 to 300 lines):

diff -r 10d508fe6b2e -r 1ccdd69e20ed distrib/sets/lists/base/mi
--- a/distrib/sets/lists/base/mi        Tue Feb 08 02:03:13 2011 +0000
+++ b/distrib/sets/lists/base/mi        Tue Feb 08 03:20:13 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.920 2011/02/04 19:42:12 pooka Exp $
+# $NetBSD: mi,v 1.921 2011/02/08 03:20:13 haad Exp $
 #
 # Note:        Don't delete entries from here - mark them as "obsolete" instead,
 #      unless otherwise stated below.
@@ -218,6 +218,7 @@
 ./sbin/dkctl                                   base-sysutil-root
 ./sbin/dkscan_bsdlabel                         base-sysutil-root
 ./sbin/dmesg                                   base-sysutil-root
+./sbin/dmctl                                   base-sysutil-root
 ./sbin/dmsetup                                 base-lvm-root           lvm
 ./sbin/drvctl                                  base-sysutil-root
 ./sbin/dump                                    base-sysutil-root
diff -r 10d508fe6b2e -r 1ccdd69e20ed distrib/sets/lists/base/shl.mi
--- a/distrib/sets/lists/base/shl.mi    Tue Feb 08 02:03:13 2011 +0000
+++ b/distrib/sets/lists/base/shl.mi    Tue Feb 08 03:20:13 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.573 2011/02/06 00:44:08 christos Exp $
+# $NetBSD: shl.mi,v 1.574 2011/02/08 03:20:13 haad Exp $
 #
 # Note:        Don't delete entries from here - mark them as "obsolete" instead,
 #      unless otherwise stated below.
@@ -25,6 +25,9 @@
 ./lib/libdevmapper.so                          base-lvm-shlib          lvm,dynamicroot
 ./lib/libdevmapper.so.1                                base-lvm-shlib          lvm,dynamicroot
 ./lib/libdevmapper.so.1.0                      base-lvm-shlib          lvm,dynamicroot
+./lib/libdm.so                                 base-sys-shlib          dynamicroot
+./lib/libdm.so.0                               base-sys-shlib          dynamicroot
+./lib/libdm.so.0.0                             base-sys-shlib          dynamicroot
 ./lib/libedit.so                               base-sys-shlib          dynamicroot
 ./lib/libedit.so.3                             base-sys-shlib          dynamicroot
 ./lib/libedit.so.3.0                           base-sys-shlib          dynamicroot
@@ -193,6 +196,9 @@
 ./usr/lib/libdevmapper.so                      base-lvm-shlib          lvm
 ./usr/lib/libdevmapper.so.1                    base-lvm-shlib          lvm
 ./usr/lib/libdevmapper.so.1.0                  base-lvm-shlib          lvm
+./usr/lib/libdm.so                             base-sys-shlib
+./usr/lib/libdm.so.0                           base-sys-shlib
+./usr/lib/libdm.so.0.0                         base-sys-shlib
 ./usr/lib/libdns.so                            base-bind-shlib
 ./usr/lib/libdns.so.5                          base-bind-shlib
 ./usr/lib/libdns.so.5.2                                base-bind-shlib
diff -r 10d508fe6b2e -r 1ccdd69e20ed distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Tue Feb 08 02:03:13 2011 +0000
+++ b/distrib/sets/lists/comp/mi        Tue Feb 08 03:20:13 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: mi,v 1.1583 2011/02/06 01:13:42 joerg Exp $
+#      $NetBSD: mi,v 1.1584 2011/02/08 03:20:14 haad Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -624,6 +624,7 @@
 ./usr/include/dirent.h                         comp-c-include
 ./usr/include/disktab.h                                comp-c-include
 ./usr/include/dlfcn.h                          comp-c-include
+./usr/include/dm.h                              comp-c-include
 ./usr/include/dns_sd.h                         comp-mdns-include       mdns
 ./usr/include/dwarf.h                          comp-c-include
 ./usr/include/elf.h                            comp-c-include
@@ -2417,6 +2418,9 @@
 ./usr/lib/libdevmapper.a                       comp-lvm-lib            lvm
 ./usr/lib/libdevmapper_g.a                     -unknown-               debuglib,lvm
 ./usr/lib/libdevmapper_p.a                     comp-lvm-proflib        profile,lvm
+./usr/lib/libdm.a                              comp-c-lib
+./usr/lib/libdm_g.a                            -unknown-               debuglib
+./usr/lib/libdm_p.a                            comp-c-proflib          profile
 ./usr/lib/libdns.a                             comp-bind-lib
 ./usr/lib/libdns_g.a                           -unknown-               debuglib
 ./usr/lib/libdns_p.a                           comp-bind-proflib       profile
@@ -2982,6 +2986,7 @@
 ./usr/libdata/debug/sbin/dkctl.debug           comp-sysutil-debug      debug
 ./usr/libdata/debug/sbin/dkscan_bsdlabel.debug comp-sysutil-debug      debug
 ./usr/libdata/debug/sbin/dmesg.debug           comp-sysutil-debug      debug
+./usr/libdata/debug/sbin/dmctl.debug           comp-sysutil-debug      debug
 ./usr/libdata/debug/sbin/dmsetup.debug         comp-sysutil-debug      lvm,debug
 ./usr/libdata/debug/sbin/drvctl.debug          comp-sysutil-debug      debug
 ./usr/libdata/debug/sbin/dump.debug            comp-sysutil-debug      debug
@@ -3892,6 +3897,7 @@
 ./usr/libdata/lint/llib-lcrypto_rc5.ln         comp-c-lintlib          lint,crypto_rc5
 ./usr/libdata/lint/llib-lcurses.ln             comp-c-lintlib          lint
 ./usr/libdata/lint/llib-ldes.ln                        comp-c-lintlib          lint,crypto
+./usr/libdata/lint/llib-ldm.ln                 comp-c-lintlib          lint
 ./usr/libdata/lint/llib-ldns.ln                        comp-bind-lintlib       lint
 ./usr/libdata/lint/llib-ldns_sd.ln             comp-mdns-lintlib       lint,mdns
 ./usr/libdata/lint/llib-ldwarf.ln              comp-c-lintlib          lint
@@ -5727,6 +5733,7 @@
 ./usr/share/man/cat3/dlfcn.0                   comp-c-catman           .cat
 ./usr/share/man/cat3/dlopen.0                  comp-c-catman           .cat
 ./usr/share/man/cat3/dlsym.0                   comp-c-catman           .cat
+./usr/share/man/cat3/dm.0                      comp-c-catman           .cat
 ./usr/share/man/cat3/dn_comp.0                 comp-c-catman           .cat
 ./usr/share/man/cat3/dn_expand.0               comp-c-catman           .cat
 ./usr/share/man/cat3/dngettext.0               comp-c-catman           .cat
@@ -11782,6 +11789,7 @@
 ./usr/share/man/html3/dlfcn.html               comp-c-htmlman          html
 ./usr/share/man/html3/dlopen.html              comp-c-htmlman          html
 ./usr/share/man/html3/dlsym.html               comp-c-htmlman          html
+./usr/share/man/html3/dm.html                  comp-c-htmlman          html
 ./usr/share/man/html3/dn_comp.html             comp-c-htmlman          html
 ./usr/share/man/html3/dn_expand.html           comp-c-htmlman          html
 ./usr/share/man/html3/dngettext.html           comp-c-htmlman          html
@@ -17745,6 +17753,7 @@
 ./usr/share/man/man3/dlfcn.3                   comp-c-man              .man
 ./usr/share/man/man3/dlopen.3                  comp-c-man              .man
 ./usr/share/man/man3/dlsym.3                   comp-c-man              .man
+./usr/share/man/man3/dm.3                      comp-c-man              .man
 ./usr/share/man/man3/dn_comp.3                 comp-c-man              .man
 ./usr/share/man/man3/dn_expand.3               comp-c-man              .man
 ./usr/share/man/man3/dngettext.3               comp-c-man              .man
diff -r 10d508fe6b2e -r 1ccdd69e20ed distrib/sets/lists/comp/shl.mi
--- a/distrib/sets/lists/comp/shl.mi    Tue Feb 08 02:03:13 2011 +0000
+++ b/distrib/sets/lists/comp/shl.mi    Tue Feb 08 03:20:13 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.158 2011/02/06 00:44:09 christos Exp $
+# $NetBSD: shl.mi,v 1.159 2011/02/08 03:20:14 haad Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -25,6 +25,7 @@
 ./usr/lib/libcurses_pic.a                      comp-c-piclib
 ./usr/lib/libdes_pic.a                         comp-c-piclib           crypto
 ./usr/lib/libdevmapper_pic.a                   comp-lvm-piclib         lvm
+./usr/lib/libdm_pic.a                          comp-c-piclib
 ./usr/lib/libdns_pic.a                         comp-bind-piclib
 ./usr/lib/libdns_sd_pic.a                      comp-mdns-piclib        mdns
 ./usr/lib/libdtrace_pic.a                      comp-c-piclib           dtrace
@@ -230,6 +231,7 @@
 ./usr/libdata/debug/usr/lib/libcurses.so.7.0.debug     comp-sys-debug  debug
 ./usr/libdata/debug/usr/lib/libdes.so.8.1.debug                comp-crypto-debug       crypto,debug
 ./usr/libdata/debug/usr/lib/libdevmapper.so.1.0.debug  comp-lvm-debug  lvm,debug
+./usr/libdata/debug/usr/lib/libdm.so.0.0.debug                 comp-sys-debug
 ./usr/libdata/debug/usr/lib/libdns.so.5.2.debug                comp-bind-debug debug
 ./usr/libdata/debug/usr/lib/libdns_sd.so.0.0.debug     comp-mdns-debug mdns,debug
 ./usr/libdata/debug/usr/lib/libdtrace.so.2.0.debug     comp-sys-debug  dtrace,debug
diff -r 10d508fe6b2e -r 1ccdd69e20ed distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Tue Feb 08 02:03:13 2011 +0000
+++ b/distrib/sets/lists/man/mi Tue Feb 08 03:20:13 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1284 2011/02/07 18:11:28 tsutsui Exp $
+# $NetBSD: mi,v 1.1285 2011/02/08 03:20:14 haad Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2162,6 +2162,7 @@
 ./usr/share/man/cat8/diskpart.0                        man-sysutil-catman      .cat
 ./usr/share/man/cat8/dkctl.0                   man-sysutil-catman      .cat
 ./usr/share/man/cat8/dkscan_bsdlabel.0         man-sysutil-catman      .cat
+./usr/share/man/cat8/dmctl.0                   man-sysutil-catman      .cat
 ./usr/share/man/cat8/dmesg.0                   man-sysutil-catman      .cat
 ./usr/share/man/cat8/dmsetup.0                 man-lvm-catman          lvm,.cat
 ./usr/share/man/cat8/dnssec-dsfromkey.0                man-bind-catman         .cat
@@ -4776,6 +4777,7 @@
 ./usr/share/man/html8/diskpart.html            man-sysutil-htmlman     html
 ./usr/share/man/html8/dkctl.html               man-sysutil-htmlman     html
 ./usr/share/man/html8/dkscan_bsdlabel.html     man-sysutil-htmlman     html
+./usr/share/man/html8/dmctl.html               man-sysutil-htmlman     html
 ./usr/share/man/html8/dmesg.html               man-sysutil-htmlman     html
 ./usr/share/man/html8/dmsetup.html             man-lvm-htmlman         lvm,html
 ./usr/share/man/html8/dnssec-dsfromkey.html    man-bind-htmlman        html
@@ -7446,6 +7448,7 @@
 ./usr/share/man/man8/diskpart.8                        man-sysutil-man         .man
 ./usr/share/man/man8/dkctl.8                   man-sysutil-man         .man
 ./usr/share/man/man8/dkscan_bsdlabel.8         man-sysutil-man         .man
+./usr/share/man/man8/dmctl.8                   man-sysutil-man         .man
 ./usr/share/man/man8/dmesg.8                   man-sysutil-man         .man
 ./usr/share/man/man8/dmsetup.8                 man-lvm-man             lvm,.man
 ./usr/share/man/man8/dnssec-dsfromkey.8                man-bind-man            .man
diff -r 10d508fe6b2e -r 1ccdd69e20ed lib/Makefile
--- a/lib/Makefile      Tue Feb 08 02:03:13 2011 +0000
+++ b/lib/Makefile      Tue Feb 08 03:20:13 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.161 2011/02/02 02:20:24 rmind Exp $
+#      $NetBSD: Makefile,v 1.162 2011/02/08 03:20:15 haad Exp $
 #      from: @(#)Makefile      5.25.1.1 (Berkeley) 5/7/91
 
 .include <bsd.own.mk>
@@ -84,6 +84,7 @@
 .endif
 
 SUBDIR+=       libcurses       # depends on libterminfo
+SUBDIR+=       libdm           # depends on libprop
 SUBDIR+=       libedit         # depends on libterminfo
 SUBDIR+=       librefuse       # depends on libpuffs
 SUBDIR+=       librumpuser     # depends on libpthread
diff -r 10d508fe6b2e -r 1ccdd69e20ed lib/libdm/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libdm/Makefile        Tue Feb 08 03:20:13 2011 +0000
@@ -0,0 +1,23 @@
+# $NetBSD: Makefile,v 1.1 2011/02/08 03:20:15 haad Exp $
+USE_FORT?= no  # network protocol library
+
+LIB=    dm
+
+SRCS=   libdm_ioctl.c
+MAN=   dm.3
+
+WARN= 4
+
+CPPFLAGS+= -I${.CURDIR}
+#CFLAGS+= -g -O0
+INCS= dm.h
+INCSDIR= /usr/include
+
+#LDADD+= -lprop
+#DPADD+= ${LIBPROP}
+
+.ifdef RUMP_ACTION
+CPPFLAGS+= -DRUMP_ACTION
+.endif
+
+.include <bsd.lib.mk>
diff -r 10d508fe6b2e -r 1ccdd69e20ed lib/libdm/dm.3
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libdm/dm.3    Tue Feb 08 03:20:13 2011 +0000
@@ -0,0 +1,386 @@
+.\"     $NetBSD: dm.3,v 1.1 2011/02/08 03:20:15 haad Exp $
+.\"
+.\" Copyright (c) 2004,2009 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Adam Hamsik.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.Dd Januar, 22
+.Dt DM 3
+.Os
+.Sh NAME
+.Nm libdm
+.Nd device-mapper access manipulation library
+.Sh LIBRARY
+.Lb libdm
+.Sh SYNOPSIS
+.In libdm.h
+.Ft void
+.Fn libdm_iter_destroy "libdm_iter_t libdm_iter"
+.Ft int
+.Fn libdm_task_run "libdm_task_t *libdm_task"
+.Ft libdm_task_t
+.Fn libdm_task_create "const char *command"
+.Ft void
+.Fn libdm_task_destroy "libdm_task_t libdm_task"
+.Ft int
+.Fn libdm_task_set_name "const char *name" "libdm_task_t libdm_task"
+.Ft char *
+.Fn libdm_task_get_name "libdm_task_t libdm_task"
+.Ft int
+.Fn libdm_task_set_uuid "const char *uuid" "libdm_task_t libdm_task"
+.Ft char *
+.Fn libdm_task_get_uuid "libdm_task_t libdm_task"
+.Ft char *
+.Fn libdm_task_get_command "libdm_task_t libdm_task"
+.Ft int32_t
+.Fn libdm_task_get_cmd_version "libdm_task_t libdm_task" "uint32_t *ver" "size_t size"
+.Ft int
+.Fn libdm_task_set_minor "uint32_t minor" "libdm_task_t libdm_task"
+.Ft uint32_t
+.Fn libdm_task_get_minor "libdm_task_t libdm_task"
+.Ft int
+.Fn libdm_task_set_flags "uint32_t flags" "libdm_task_t libdm_task"
+.Ft uint32_t
+.Fn libdm_task_get_flags "libdm_task_t libdm_task"
+.Ft uint32_t
+.Fn libdm_task_get_target_num "libdm_task_t libdm_task"
+.Ft int32_t
+.Fn libdm_task_get_open_num "libdm_task_t libdm_task"
+.Ft uint32_t
+.Fn libdm_task_get_event_num "libdm_task_t libdm_task"
+.Ft int
+.Fn libdm_task_set_cmd "libdm_cmd_t libdm_cmd" "libdm_task_t libdm_task"
+.Ft libdm_cmd_t
+.Fn libdm_task_get_cmd "libdm_task_t libdm_task"
+.Ft libdm_cmd_t
+.Fn libdm_cmd_create "void"
+.Ft void
+.Fn libdm_cmd_destroy "libdm_cmd_t libdm_cmd"
+.Ft libdm_iter_t



Home | Main Index | Thread Index | Old Index