From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10267 invoked by alias); 30 Sep 2006 20:02:04 -0000 Received: (qmail 10252 invoked by uid 9447); 30 Sep 2006 20:02:03 -0000 Date: Sat, 30 Sep 2006 20:02:00 -0000 Message-ID: <20060930200203.10250.qmail@sourceware.org> From: agk@sourceware.org To: lvm2-cvs@sourceware.org Subject: LVM2 ./WHATS_NEW ./configure ./configure.in li ... Mailing-List: contact lvm2-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: lvm2-cvs-owner@sourceware.org X-SW-Source: 2006-09/txt/msg00011.txt.bz2 List-Id: CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2006-09-30 20:02:03 Modified files: . : WHATS_NEW configure configure.in lib : Makefile.in lib/misc : configure.h.in Added files: lib/misc : timestamp.c timestamp.h Log message: Add timestamp functions with --disable-realtime configure option. [AJ] Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.445&r2=1.446 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/configure.diff?cvsroot=lvm2&r1=1.52&r2=1.53 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/configure.in.diff?cvsroot=lvm2&r1=1.51&r2=1.52 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/Makefile.in.diff?cvsroot=lvm2&r1=1.79&r2=1.80 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/timestamp.c.diff?cvsroot=lvm2&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/timestamp.h.diff?cvsroot=lvm2&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/configure.h.in.diff?cvsroot=lvm2&r1=1.1&r2=1.2 --- LVM2/WHATS_NEW 2006/09/26 09:35:42 1.445 +++ LVM2/WHATS_NEW 2006/09/30 20:02:02 1.446 @@ -1,5 +1,6 @@ Version 2.02.11 - ===================================== + Add timestamp functions with --disable-realtime configure option. Add %VG, %LV and %FREE suffices to lvcreate/lvresize --extents arg. Fix two potential NULL pointer derefs in error cases in vg_read(). Separate --enable-cluster from locking lib options in lvmconf.sh. --- LVM2/configure 2006/08/18 21:17:17 1.52 +++ LVM2/configure 2006/09/30 20:02:02 1.53 @@ -310,7 +310,7 @@ #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 INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SET_MAKE RANLIB ac_ct_RANLIB CFLOW_CMD CSCOPE_CMD CPP EGREP ALLOCA LIBOBJS POW_LIB MSGFMT MODPROBE_CMD JOBS STATIC_LINK LVM1 POOL SNAPSHOTS MIRRORS OWNER GROUP COPTIMISE_FLAG CLDFLAGS CLDWHOLEARCHIVE CLDNOWHOLEARCHIVE LDDEPS LIB_SUFFIX LVM_VERSION LVM1_FALLBACK DEBUG DEVMAPPER HAVE_LIBDL HAVE_SELINUX CMDLIB LOCALEDIR CONFDIR STATICDIR INTL_PACKAGE INTL CLVMD CLUSTER FSADM DMEVENTD 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 INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SET_MAKE RANLIB ac_ct_RANLIB CFLOW_CMD CSCOPE_CMD CPP EGREP ALLOCA LIBOBJS POW_LIB MSGFMT MODPROBE_CMD JOBS STATIC_LINK LVM1 POOL SNAPSHOTS MIRRORS OWNER GROUP COPTIMISE_FLAG CLDFLAGS CLDWHOLEARCHIVE CLDNOWHOLEARCHIVE LDDEPS LIB_SUFFIX LVM_VERSION LVM1_FALLBACK DEBUG DEVMAPPER HAVE_LIBDL HAVE_SELINUX HAVE_REALTIME CMDLIB LOCALEDIR CONFDIR STATICDIR INTL_PACKAGE INTL CLVMD CLUSTER FSADM DMEVENTD LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -853,6 +853,7 @@ statically. Default is dynamic linking --enable-readline Enable readline support --disable-selinux Disable selinux support + --disable-realtime Disable realtime clock support --enable-debug Enable debugging --disable-devmapper Disable device-mapper interaction --disable-o_direct Disable O_DIRECT @@ -1459,6 +1460,7 @@ DEVMAPPER=yes ODIRECT=yes SELINUX=yes + REALTIME=yes CLUSTER=internal FSADM=no ;; darwin*) @@ -1473,6 +1475,7 @@ DEVMAPPER=yes ODIRECT=no SELINUX=no + REALTIME=no CLUSTER=none FSADM=no ;; esac @@ -7432,6 +7435,17 @@ echo "${ECHO_T}$SELINUX" >&6 ################################################################################ +echo "$as_me:$LINENO: checking whether to enable realtime support" >&5 +echo $ECHO_N "checking whether to enable realtime support... $ECHO_C" >&6 +# Check whether --enable-realtime or --disable-realtime was given. +if test "${enable_realtime+set}" = set; then + enableval="$enable_realtime" + REALTIME=$enableval +fi; +echo "$as_me:$LINENO: result: $REALTIME" >&5 +echo "${ECHO_T}$REALTIME" >&6 + +################################################################################ echo "$as_me:$LINENO: checking whether to build cluster LVM daemon" >&5 echo $ECHO_N "checking whether to build cluster LVM daemon... $ECHO_C" >&6 @@ -8421,6 +8435,96 @@ fi ################################################################################ +if test x$REALTIME = xyes; then + echo "$as_me:$LINENO: checking for clock_gettime function" >&5 +echo $ECHO_N "checking for clock_gettime function... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking for clock_gettime in -lrt" >&5 +echo $ECHO_N "checking for clock_gettime in -lrt... $ECHO_C" >&6 +if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char clock_gettime (); +int +main () +{ +clock_gettime (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_rt_clock_gettime=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_rt_clock_gettime=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_rt_clock_gettime" >&5 +echo "${ECHO_T}$ac_cv_lib_rt_clock_gettime" >&6 +if test $ac_cv_lib_rt_clock_gettime = yes; then + HAVE_REALTIME=yes +else + HAVE_REALTIME=no +fi + + echo "$as_me:$LINENO: result: $HAVE_REALTIME" >&5 +echo "${ECHO_T}$HAVE_REALTIME" >&6 + + if test x$HAVE_REALTIME = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_REALTIME 1 +_ACEOF + + LIBS="-lrt $LIBS" + else + { echo "$as_me:$LINENO: WARNING: Disabling realtime clock" >&5 +echo "$as_me: WARNING: Disabling realtime clock" >&2;} + fi +fi + +################################################################################ for ac_header in getopt.h do @@ -11097,6 +11201,7 @@ + ################################################################################ ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile dmeventd/Makefile dmeventd/mirror/Makefile doc/Makefile include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/snapshot/Makefile man/Makefile po/Makefile tools/Makefile tools/version.h tools/fsadm/Makefile test/mm/Makefile test/device/Makefile test/format1/Makefile test/regex/Makefile test/filters/Makefile" cat >confcache <<\_ACEOF @@ -11789,6 +11894,7 @@ s,@DEVMAPPER@,$DEVMAPPER,;t t s,@HAVE_LIBDL@,$HAVE_LIBDL,;t t s,@HAVE_SELINUX@,$HAVE_SELINUX,;t t +s,@HAVE_REALTIME@,$HAVE_REALTIME,;t t s,@CMDLIB@,$CMDLIB,;t t s,@LOCALEDIR@,$LOCALEDIR,;t t s,@CONFDIR@,$CONFDIR,;t t --- LVM2/configure.in 2006/08/18 21:17:17 1.51 +++ LVM2/configure.in 2006/09/30 20:02:02 1.52 @@ -42,6 +42,7 @@ DEVMAPPER=yes ODIRECT=yes SELINUX=yes + REALTIME=yes CLUSTER=internal FSADM=no ;; darwin*) @@ -56,6 +57,7 @@ DEVMAPPER=yes ODIRECT=no SELINUX=no + REALTIME=no CLUSTER=none FSADM=no ;; esac @@ -283,6 +285,13 @@ AC_MSG_RESULT($SELINUX) ################################################################################ +dnl -- Disable realtime clock support +AC_MSG_CHECKING(whether to enable realtime support) +AC_ARG_ENABLE(realtime, [ --disable-realtime Disable realtime clock support], +REALTIME=$enableval) +AC_MSG_RESULT($REALTIME) + +################################################################################ dnl -- Build cluster LVM daemon AC_MSG_CHECKING(whether to build cluster LVM daemon) AC_ARG_WITH(clvmd, @@ -450,6 +459,21 @@ fi ################################################################################ +dnl -- Check for realtime clock support +if test x$REALTIME = xyes; then + AC_MSG_CHECKING(for clock_gettime function) + AC_CHECK_LIB(rt, clock_gettime, HAVE_REALTIME=yes, HAVE_REALTIME=no) + AC_MSG_RESULT($HAVE_REALTIME) + + if test x$HAVE_REALTIME = xyes; then + AC_DEFINE([HAVE_REALTIME], 1, [Define to 1 to include support for realtime clock.]) + LIBS="-lrt $LIBS" + else + AC_MSG_WARN(Disabling realtime clock) + fi +fi + +################################################################################ dnl -- Check for getopt AC_CHECK_HEADERS(getopt.h, AC_DEFINE([HAVE_GETOPTLONG], 1, [Define to 1 to if getopt_long is available.])) @@ -578,6 +602,7 @@ AC_SUBST(DEVMAPPER) AC_SUBST(HAVE_LIBDL) AC_SUBST(HAVE_SELINUX) +AC_SUBST(HAVE_REALTIME) AC_SUBST(CMDLIB) AC_SUBST(MSGFMT) AC_SUBST(LOCALEDIR) --- LVM2/lib/Makefile.in 2006/08/17 18:23:42 1.79 +++ LVM2/lib/Makefile.in 2006/09/30 20:02:02 1.80 @@ -79,6 +79,7 @@ misc/lvm-file.c \ misc/lvm-string.c \ misc/lvm-wrappers.c \ + misc/timestamp.c \ mm/memlock.c \ regex/matcher.c \ regex/parse_rx.c \ /cvs/lvm2/LVM2/lib/misc/timestamp.c,v --> standard output revision 1.1 --- LVM2/lib/misc/timestamp.c +++ - 2006-09-30 20:02:03.640955000 +0000 @@ -0,0 +1,132 @@ +/* + * Copyright (C) 2006 Rackable Systems All rights reserved. + * + * This file is part of LVM2. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU General Public License v.2. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * Abstract out the time methods used so they can be adjusted later - + * the results of these routines should stay in-core. This implementation + * requires librt. + */ + +#include "lib.h" +#include + +#include "timestamp.h" + +/* + * The realtime section uses clock_gettime with the CLOCK_MONOTONIC + * parameter to prevent issues with time warps + */ +#ifdef HAVE_REALTIME + +#include +#include + +struct timestamp { + struct timespec t; +}; + +struct timestamp *get_timestamp(void) +{ + struct timestamp *ts = NULL; + int err = 0; + + if (!(ts = dm_malloc(sizeof(*ts)))) + return_NULL; + + if (clock_gettime(CLOCK_MONOTONIC, &ts->t)) { + log_sys_error("clock_gettime", "get_timestamp"); + return NULL; + } + + return ts; +} + +/* cmp_timestamp: Compare two timestamps + * + * Return: -1 if t1 is less than t2 + * 0 if t1 is equal to t2 + * 1 if t1 is greater than t2 + */ +int cmp_timestamp(struct timestamp *t1, struct timestamp *t2) +{ + if(t1->t.tv_sec < t2->t.tv_sec) + return -1; + if(t1->t.tv_sec > t2->t.tv_sec) + return 1; + + if(t1->t.tv_nsec < t2->t.tv_nsec) + return -1; + if(t1->t.tv_nsec > t2->t.tv_nsec) + return 1; + + return 0; +} + +#else /* ! HAVE_REALTIME */ + +/* + * The !realtime section just uses gettimeofday and is therefore subject + * to ntp-type time warps - not sure if should allow that. + */ + +#include + +struct timestamp { + struct timeval t; +}; + +struct timestamp *get_timestamp(void) +{ + struct timestamp *ts = NULL; + int err = 0; + + if (!(ts = dm_malloc(sizeof(*ts)))) + return_NULL; + + if ((err = gettimeofday(&ts->t, NULL))) { + log_sys_error("gettimeofday", "get_timestamp"); + return NULL; + } + + return ts; +} + +/* cmp_timestamp: Compare two timestamps + * + * Return: -1 if t1 is less than t2 + * 0 if t1 is equal to t2 + * 1 if t1 is greater than t2 + */ +int cmp_timestamp(struct timestamp *t1, struct timestamp *t2) +{ + if(t1->t.tv_sec < t2->t.tv_sec) + return -1; + if(t1->t.tv_sec > t2->t.tv_sec) + return 1; + + if(t1->t.tv_usec < t2->t.tv_usec) + return -1; + if(t1->t.tv_usec > t2->t.tv_usec) + return 1; + + return 0; +} + +#endif /* HAVE_REALTIME */ + +void destroy_timestamp(struct timestamp *t) +{ + if (t) + dm_free(t); +} /cvs/lvm2/LVM2/lib/misc/timestamp.h,v --> standard output revision 1.1 --- LVM2/lib/misc/timestamp.h +++ - 2006-09-30 20:02:03.723793000 +0000 @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2006 Rackable Systems All rights reserved. + * + * This file is part of LVM2. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU General Public License v.2. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _LVM_TIMESTAMP_H +#define _LVM_TIMESTAMP_H + +struct timestamp; + +struct timestamp *get_timestamp(void); + +/* cmp_timestamp: Compare two timestamps + * + * Return: -1 if t1 is less than t2 + * 0 if t1 is equal to t2 + * 1 if t1 is greater than t2 + */ +int cmp_timestamp(struct timestamp *t1, struct timestamp *t2); + +void destroy_timestamp(struct timestamp *t); + +#endif /* _LVM_TIMESTAMP_H */ + --- LVM2/lib/misc/configure.h.in 2006/05/09 21:23:50 1.1 +++ LVM2/lib/misc/configure.h.in 2006/09/30 20:02:02 1.2 @@ -174,6 +174,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SELINUX_SELINUX_H +/* define to 1 to include support for realtime clock */ +#undef HAVE_REALTIME + /* Define to 1 if you have the `setlocale' function. */ #undef HAVE_SETLOCALE