Add dm-userspace support to libdevmapper
Subsystems (2)
PATCH 1/1 Add dm-userspace support to libdevmapper
This patch against device-mapper-1.02.07 adds dm-userspace support to libdevmapper. Comments on the interface it provides would be appreciated. The patch also adds an example program to contrib/ that demonstrates simple usage of the dm-userspace functions provided.
I added a copyright line at the top of libdevmapper.h, as is customary in the Xen community. Please advise if this is not appropriate.
Signed-off-by Dan Smith <[email protected]>
Signed-off-by Ryan Grimm <[email protected]>
configure +28 -3
@@ -310,7 +310,7 @@ ac_includes_default="\ #endif" ac_default_prefix=/usr -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os AWK CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SET_MAKE RANLIB ac_ct_RANLIB LIBOBJS MSGFMT usrlibdir JOBS STATIC_LINK OWNER GROUP interface kerneldir missingkernel kernelvsn tmpdir COPTIMISE_FLAG CLDFLAGS LDDEPS LIB_SUFFIX DEBUG DM_LIB_VERSION COMPAT DMIOCTLS LOCALEDIR INTL_PACKAGE INTL DEVICE_UID DEVICE_GID DEVICE_MODE DMEVENTD PKGCONFIG LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os AWK CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SET_MAKE RANLIB ac_ct_RANLIB LIBOBJS MSGFMT usrlibdir JOBS STATIC_LINK OWNER GROUP interface kerneldir missingkernel kernelvsn tmpdir COPTIMISE_FLAG CLDFLAGS LDDEPS LIB_SUFFIX DEBUG DM_LIB_VERSION COMPAT DMIOCTLS LOCALEDIR INTL_PACKAGE INTL DEVICE_UID DEVICE_GID DEVICE_MODE DMEVENTD PKGCONFIG DMU LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options.
@@ -856,6 +856,7 @@ Optional Features: statically. Default is dynamic linking --disable-selinux Disable selinux support --enable-nls Enable Native Language Support + --disable-dmu Disable dm-userspace support Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -1443,7 +1444,8 @@ case "$host_os" in LDDEPS="$LDDEPS .export.sym" LIB_SUFFIX="so" DMIOCTLS="yes" - SELINUX="yes" ;; + SELINUX="yes" + DMU="yes" ;; darwin*) CFLAGS="$CFLAGS -no-cpp-precomp -fno-common" COPTIMISE_FLAG="-O2"
@@ -1451,7 +1453,8 @@ case "$host_os" in LDDEPS="$LDDEPS" LIB_SUFFIX="dylib" DMIOCTLS="no" - SELINUX="no" ;; + SELINUX="no" + DMU="no" ;; esac ################################################################################
@@ -5885,6 +5888,26 @@ fi fi ################################################################################ +echo "$as_me:$LINENO: checking whether to enable dm-userspace" >&5 +echo $ECHO_N "checking whether to enable dm-userspace... $ECHO_C" >&6 +# Check whether --enable-dmu or --disable-dmu was given. +if test "${enable_dmu+set}" = set; then + enableval="$enable_dmu" + DMU=$enableval +fi; +echo "$as_me:$LINENO: result: $DMU" >&5 +echo "${ECHO_T}$DMU" >&6 + +if test "x${DMU}" = "xyes"; then + if test "x${missingkernel}" = xyes; then + { { echo "$as_me:$LINENO: error: \"Kernel source required to build dm-userspace tools\"" >&5 +echo "$as_me: error: \"Kernel source required to build dm-userspace tools\"" >&2;} + { (exit 1); exit 1; }; } + fi +fi + + +################################################################################ echo "$as_me:$LINENO: checking for kernel version" >&5 echo $ECHO_N "checking for kernel version... $ECHO_C" >&6
@@ -5961,6 +5984,7 @@ fi ################################################################################ +
@@ -6672,6 +6696,7 @@ s,@DEVICE_MODE@,$DEVICE_MODE,;t t s,@DEVICE_MODE@,$DEVICE_MODE,;t t s,@DMEVENTD@,$DMEVENTD,;t t s,@PKGCONFIG@,$PKGCONFIG,;t t +s,@DMU@,$DMU,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF
configure.in +19 -2
@@ -38,7 +38,8 @@ case "$host_os" in LDDEPS="$LDDEPS .export.sym" LIB_SUFFIX="so" DMIOCTLS="yes" - SELINUX="yes" ;; + SELINUX="yes" + DMU="yes" ;; darwin*) CFLAGS="$CFLAGS -no-cpp-precomp -fno-common" COPTIMISE_FLAG="-O2"
@@ -46,7 +47,8 @@ case "$host_os" in LDDEPS="$LDDEPS" LIB_SUFFIX="dylib" DMIOCTLS="no" - SELINUX="no" ;; + SELINUX="no" + DMU="no" ;; esac ################################################################################
@@ -291,6 +293,20 @@ else else test -d "${kerneldir}" || { AC_MSG_WARN(kernel dir $kerneldir not found); missingkernel=yes ; } fi + +################################################################################ +dnl -- Disable dm-userspace +AC_MSG_CHECKING(whether to enable dm-userspace) +AC_ARG_ENABLE(dmu, [ --disable-dmu Disable dm-userspace support], +DMU=$enableval) +AC_MSG_RESULT($DMU) + +if test "x${DMU}" = "xyes"; then + if test "x${missingkernel}" = xyes; then + AC_ERROR("Kernel source required to build dm-userspace tools") + fi +fi + ################################################################################ dnl -- Kernel version string
@@ -383,6 +399,7 @@ AC_SUBST(DEVICE_MODE) AC_SUBST(DEVICE_MODE) AC_SUBST(DMEVENTD) AC_SUBST(PKGCONFIG) +AC_SUBST(DMU) ################################################################################ dnl -- First and last lines should not contain files to generate in order to
lib/.exported_symbols +18 -0
@@ -109,3 +109,21 @@ dm_hash_get_next dm_hash_get_next dm_set_selinux_context dm_task_set_geometry +dmu_ctl_open +dmu_ctl_close +dmu_ctl_send_queue +dmu_register_status_handler +dmu_register_map_handler +dmu_invalidate_block +dmu_sync_complete +dmu_events_pending +dmu_process_events +dmu_map_set_block +dmu_map_get_block +dmu_map_set_offset +dmu_map_get_id +dmu_map_set_dest_dev +dmu_map_set_copy_src_dev +dmu_map_set_writable +dmu_map_is_write +dmu_map_set_sync
lib/Makefile.in +6 -0
@@ -16,6 +16,7 @@ top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ interface = @interface@ +kerneldir = @kerneldir@ SOURCES =\ datastruct/bitset.c \
@@ -28,6 +29,11 @@ SOURCES =\ $(interface)/libdm-iface.c INCLUDES = -I$(interface) + +ifeq ("@DMU@", "yes") + INCLUDES += -I$(kerneldir)/include + SOURCES += dmu.c +endif LIB_STATIC = $(interface)/libdevmapper.a
lib/libdevmapper.h +46 -0
56 lines not on this page · raw message
.hgtags new file +2 -0
@@ -0,0 +1,2 @@ +625e2e3552bec3a9efd9f7f87c6f5fc41d7cacb8 ORIG +3bf96d9f87d98ee8c402fb4cf3ed503cc0577048 PRE_IO_COMP
contrib/dmu-example.c new file +103 -0
103 lines not on this page · raw message
lib/dmu.c new file +552 -0
552 lines not on this page · raw message
Signature · 4 lines
Dan Smith IBM Linux Technology Center Open Hypervisor Team email: [email protected]