Latest liblvm base patches
Here are the latest liblvm base patches.
PATCH 1/3 New parameter system_dir for create_toolcontext.
cmd->sys_dir, which defaults to DEFAULT_SYS_DIR, will be set to system_dir i the parameter is not NULL. If the environment variable LVM_SYSTEM_DIR is set it will overwrite any value of cmd->sys_dir.
--- daemons/clvmd/lvm-functions.c | 4 ++-- lib/commands/toolcontext.c | 16 ++++++++++++++-- lib/commands/toolcontext.h | 9 +++++++-- tools/lvmcmdline.c | 4 ++-- 4 files changed, 25 insertions(+), 8 deletions(-)
daemons/clvmd/lvm-functions.c +2 -2
@@ -1,6 +1,6 @@/* * Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved. -* Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. +* Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. *
@@ -724,7 +724,7 @@ void lvm_do_backup(const char *vgname)/* Called to initialise the LVM context of the daemon */ int init_lvm (int using_gulm) { -if (!(cmd =create_toolcontext (1 ))) { +if (!(cmd =create_toolcontext (1 ,NULL ))) {log_error ("Failed to allocate command context" );return 0 ; }
lib/commands/toolcontext.c +14 -2
@@ -1,6 +1,6 @@/* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. -* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. +* Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. *
@@ -998,7 +998,8 @@ static void _init_globals(struct cmd_context *cmd) }/* Entry point */ -struct cmd_context *create_toolcontext (unsigned is_long_lived) +struct cmd_context *create_toolcontext (unsigned is_long_lived, +const char *system_dir) {struct cmd_context *cmd;
@@ -1030,6 +1031,17 @@ struct cmd_context *create_toolcontext(unsigned is_long_lived)strcpy (cmd->sys_dir,DEFAULT_SYS_DIR ); +/* +* cmd->sys_dir, which defaults to DEFAULT_SYS_DIR, will be set to +* system_dir if the parameter is not NULL. If the environment +* variable LVM_SYSTEM_DIR is set, it will overwrite any value of +* cmd->sys_dir. +*/ +if (system_dir) { +strncpy (cmd->sys_dir, system_dir,sizeof (cmd->sys_dir)); + cmd->sys_dir[sizeof (cmd->sys_dir) -1 ] ='\0' ; + } +if (!_get_env_vars (cmd)) goto error;
lib/commands/toolcontext.h +7 -2
@@ -1,6 +1,6 @@/* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. -* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. +* Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. *
@@ -94,7 +94,12 @@ struct cmd_context {char sysfs_dir[PATH_MAX ]; }; -struct cmd_context *create_toolcontext (unsigned is_long_lived); +/* +* cmd->sys_dir, which defaults to DEFAULT_SYS_DIR, will be set to system_dir +* if the parameter is not NULL. If the environment variable LVM_SYSTEM_DIR is +* set, it will overwrite any value of cmd->sys_dir. +*/ +struct cmd_context *create_toolcontext (unsigned is_long_lived,const char *system_dir);void destroy_toolcontext (struct cmd_context *cmd);int refresh_toolcontext (struct cmd_context *cmd);int config_files_changed (struct cmd_context *cmd);
tools/lvmcmdline.c +2 -2
@@ -1,6 +1,6 @@/* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. -* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. +* Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. *
@@ -1158,7 +1158,7 @@ struct cmd_context *init_lvm(void) _cmdline.the_args = &_the_args[0 ]; -if (!(cmd =create_toolcontext (0 ))) +if (!(cmd =create_toolcontext (0 ,NULL ))) return_NULL;return cmd;
Signature · 1 line
1.6.1.3
PATCH 2/3 Rename version.h to lvm-version.h, move it to lib/misc, add more version defines.
Rename version.h to lvm-version.h, move it to lib/misc and add more version defines. New defines are LVM_MAJOR, LVM_MINOR, LVM_PATCHLEVEL, LVM_RELEASE and LVM_RELEASE_DATE generated in configure. New GPL header. Fixed all occurances of version.h in the code.
Use $AWK for DM_LIB_PATCHLEVEL in configure.
TODO: recreate configure
--- configure.in | 20 +++++++++++++++++--- daemons/clvmd/clvmd.c | 4 ++-- include/.symlinks | 2 +- lib/format_text/export.c | 4 ++-- lib/misc/lvm-version.h.in | 29 +++++++++++++++++++++++++++++ make.tmpl.in | 4 ++-- test/t-000-basic.sh | 4 ++-- tools/lvmcmdlib.c | 4 ++-- tools/lvmcmdline.c | 2 +- tools/version.h.in | 3 --- 10 files changed, 58 insertions(+), 18 deletions(-) create mode 100644 lib/misc/lvm-version.h.in delete mode 100644 tools/version.h.in
configure.in +17 -3
@@ -1,6 +1,6 @@ ############################################################################### ## Copyright (C) 2000-2004 Sistina Software, Inc. All rights reserved. -## Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions
@@ -719,10 +719,19 @@ AC_MSG_RESULT($interface) DM_LIB_VERSION="\"`cat VERSION_DM 2>/dev/null || echo Unknown`\"" AC_DEFINE_UNQUOTED(DM_LIB_VERSION, $DM_LIB_VERSION, [Library version]) -DM_LIB_PATCHLEVEL=`cat VERSION_DM | awk -F '[[-. ]]' '{printf "%s.%s.%s",$1,$2,$3}'` +DM_LIB_PATCHLEVEL=`cat VERSION_DM | $AWK -F '[[-. ]]' '{printf "%s.%s.%s",$1,$2,$3}'` LVM_VERSION="\"`cat VERSION 2>/dev/null || echo Unknown`\"" +VER=`cat VERSION` +LVM_RELEASE_DATE="\"`echo $VER | $SED 's/.*(//;s/).*//'`\"" +VER=`echo "$VER" | $AWK '{print $1}'` +LVM_RELEASE="\"`echo "$VER" | $AWK -F '-' '{print $2}'`\"" +VER=`echo "$VER" | $AWK -F '-' '{print $1}'` +LVM_MAJOR=`echo "$VER" | $AWK -F '.' '{print $1}'` +LVM_MINOR=`echo "$VER" | $AWK -F '.' '{print $2}'` +LVM_PATCHLEVEL=`echo "$VER" | $AWK -F '.' '{print $3}'` + ################################################################################ AC_SUBST(BUILD_DMEVENTD) AC_SUBST(CFLAGS)
@@ -761,6 +770,11 @@ AC_SUBST(LVM1) AC_SUBST(LVM1_FALLBACK) AC_SUBST(CONFDIR) AC_SUBST(LVM_VERSION) +AC_SUBST(LVM_MAJOR) +AC_SUBST(LVM_MINOR) +AC_SUBST(LVM_PATCHLEVEL) +AC_SUBST(LVM_RELEASE) +AC_SUBST(LVM_RELEASE_DATE) AC_SUBST(MIRRORS) AC_SUBST(MSGFMT) AC_SUBST(OWNER)
@@ -798,6 +812,7 @@ lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile +lib/misc/lvm-version.h lib/snapshot/Makefile libdm/Makefile libdm/libdevmapper.pc
@@ -808,7 +823,6 @@ scripts/Makefile test/Makefile test/api/Makefile tools/Makefile -tools/version.h ]) AC_OUTPUT
daemons/clvmd/clvmd.c +2 -2
@@ -1,6 +1,6 @@/* * Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved. -* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. +* Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. *
@@ -49,7 +49,7 @@#include "clvmd-comms.h" #include "lvm-functions.h" #include "clvm.h" -#include "version.h" +#include "lvm-version.h" #include "clvmd.h" #include "refresh_clvmd.h" #include "lvm-logging.h"
include/.symlinks +1 -1
@@ -47,6 +47,7 @@ ../lib/misc/lvm-file.h ../lib/misc/lvm-globals.h ../lib/misc/lvm-string.h +../lib/misc/lvm-version.h ../lib/misc/lvm-wrappers.h ../lib/misc/sharedlib.h ../lib/report/report.h
@@ -57,4 +58,3 @@ ../libdm/misc/dmlib.h ../libdm/misc/kdev_t.h ../po/pogen.h -../tools/version.h
lib/format_text/export.c +2 -2
@@ -1,6 +1,6 @@/* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. -* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. +* Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. *
@@ -20,7 +20,7 @@#include "lvm-string.h" #include "segtype.h" #include "text_export.h" -#include "version.h" +#include "lvm-version.h" #include <stdarg.h> #include <time.h>
lib/misc/lvm-version.h.in new file +29 -0
@@ -0,0 +1,29 @@ +/* + * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. + * Copyright (C) 2004-2009 Red Hat, Inc. 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 Lesser General Public License v.2.1. + * + * You should have received a copy of the GNU Lesser 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_VERSION_H +/** + * The LVM version number + * + * LVM_MAJOR.LVM_MINOR.LVM_PATCHLEVEL[-LVM_RELEASE] + */ + +#define LVM_VERSION @LVM_VERSION@ +#define LVM_MAJOR @LVM_MAJOR@ +#define LVM_MINOR @LVM_MINOR@ +#define LVM_PATCHLEVEL @LVM_PATCHLEVEL@ +#define LVM_RELEASE @LVM_RELEASE@ +#define LVM_RELEASE_DATE @LVM_RELEASE_DATE@ +#endif
make.tmpl.in +2 -2
@@ -1,7 +1,7 @@ # @configure_input@ # # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. -# Copyright (C) 2004, 2008 Red Hat, Inc. All rights reserved. +# Copyright (C) 2004, 2009 Red Hat, Inc. All rights reserved. # # This file is part of LVM2. #
@@ -244,7 +244,7 @@ distclean: $(SUBDIRS.distclean) $(SOURCES:%.c=%.gcda) $(LDDEPS) \ config.cache config.log config.status \ Makefile make.tmpl core \ - version.h lvm2.po + lvm-version.h lvm2.po .export.sym: .exported_symbols set -e; (echo "Base {"; echo " global:"; \
test/t-000-basic.sh +2 -2
@@ -1,4 +1,4 @@ -# Copyright (C) 2007 Red Hat, Inc. All rights reserved. +# Copyright (C) 2009 Red Hat, Inc. All rights reserved. # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions
@@ -12,7 +12,7 @@ lvm version -v=$abs_top_srcdir/tools/version.h +v=$abs_top_srcdir/lib/misc/lvm-version.h sed -n "/#define LVM_VERSION ./s///p" "$v" | sed "s/ .*//" > expected lvm pvmove --version|sed -n "1s/.*: *\([0-9][^ ]*\) .*/\1/p" > actual
tools/lvmcmdlib.c +2 -2
@@ -1,6 +1,6 @@/* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. -* Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. +* Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. *
@@ -17,7 +17,7 @@#include "lvm2cmdline.h" #include "label.h" #include "memlock.h" -#include "version.h" +#include "lvm-version.h" #include "lvm2cmd.h"
tools/lvmcmdline.c +1 -1
@@ -16,7 +16,7 @@#include "tools.h" #include "lvm2cmdline.h" #include "label.h" -#include "version.h" +#include "lvm-version.h" #include "stub.h" #include "lvm2cmd.h"
tools/version.h.in deleted +0 -3
@@ -1,3 +0,0 @@ -#ifndef _LVM_VERSION_H -#define LVM_VERSION @LVM_VERSION@ -#endif
Signature · 1 line
1.6.1.3
PATCH 3/3 New base files needed for liblvm with doxygen style descriptions.
Added files lib/lvm.h and lib/lvm_base.c:
New structure lvm (used as an alias to cmd_context), new type definition lvm_t for the lvm handle. Added functions lvm_create, lvm_destroy and lvm_reload_config using the new handle.
Modified test/api/test.c:
Use new lvm.h header file and lvm_t handle.
Removed lib/lvm2.h
--- lib/Makefile.in | 5 ++- lib/lvm.h | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/lvm2.h | 53 --------------------------------------------- lib/lvm_base.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/api/test.c | 17 +++++++------- 5 files changed, 132 insertions(+), 64 deletions(-) create mode 100644 lib/lvm.h delete mode 100644 lib/lvm2.h create mode 100644 lib/lvm_base.c
lib/Makefile.in +3 -2
@@ -1,6 +1,6 @@ # # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. -# Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. +# Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. # # This file is part of LVM2. #
@@ -86,7 +86,8 @@ SOURCES =\ report/report.c \ striped/striped.c \ uuid/uuid.c \ - zero/zero.c + zero/zero.c \ + lvm_base.c ifeq ("@LVM1@", "internal") SOURCES +=\
lib/lvm.h new file +57 -0
57 lines not on this page · raw message
lib/lvm2.h deleted +0 -53
53 lines not on this page · raw message
lib/lvm_base.c new file +64 -0
64 lines not on this page · raw message
test/api/test.c +8 -9
@@ -1,6 +1,6 @@/* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. -* Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. +* Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. *
@@ -16,7 +16,7 @@#include <string.h> #include <stdlib.h> #include <readline/readline.h> -#include "lvm2.h" +#include "lvm.h" #define MAX_ARGS 64
@@ -48,7 +48,7 @@ static int lvm_split(char *str, int *argc, char **argv, int max)return *argc; } -static int lvmapi_test_shell (void *h) +static int lvmapi_test_shell (lvm_t libh) {int argc, i;char *input =NULL , *args[MAX_ARGS ], **argv;
@@ -99,18 +99,17 @@ static int lvmapi_test_shell(void *h)int main (int argc,char *argv[]) { -void *h; +lvm_t libh; - h =lvm2_create (); -if (!h) { + libh =lvm_create (NULL ); +if (!libh) {printf ("Unable to open lvm library instance\n" );return 1 ; } -lvmapi_test_shell (h); +lvmapi_test_shell (libh); -if (h) -lvm2_destroy (h); +lvm_destroy (libh);return 0 ; }
Signature · 1 line
1.6.1.3