Resolve conflicts created by import of lvm2tools-2.02.43.
This commit is contained in:
parent
4726d09dbc
commit
bc330923c1
|
@ -1,6 +0,0 @@
|
|||
LVM2 requires the device-mapper kernel module (dm-mod). This is
|
||||
available as a kernel patch for 2.4 (in kernel-patch-device-mapper), and
|
||||
is distributed with linux 2.5 and above. The LVM1 kernel module (lvm-mod)
|
||||
will not work with lvm2 packages. dm-mod and lvm-mod may both be loaded
|
||||
in the kernel at the same time with no problems. Without dm-mod, this
|
||||
package is pretty useless.
|
|
@ -1,82 +0,0 @@
|
|||
lvm2 (1.95.15-1) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
* Remove undocumented manpage symlinks.
|
||||
* Update description to be more informative. (Closes: #173499)
|
||||
* Add kernel-patch-device-mapper suggestion.
|
||||
* Update standards version.
|
||||
|
||||
-- Andres Salomon <dilinger@mp3revolution.net> Sun, 16 Feb 2002 04:21:26 -0400
|
||||
|
||||
lvm2 (1.95.11-1) unstable; urgency=low
|
||||
|
||||
* New upstream release. (Closes: #171436)
|
||||
* Removed TODO and INTRO from debian/docs; added WHATS_NEW.
|
||||
* Remove vgcfgrestore.8 undocumented symlink.
|
||||
* Added a README.Debian, mentioning the device-mapper kernel module
|
||||
requirement that lvm2 has. (Closes: #171674, #163020)
|
||||
* Get rid of debian/conffiles (debhelper's smart enough to figure that out).
|
||||
* debian/copyright fix to appease lintian.
|
||||
* Fix typo in tools/commands.h that caused /usr/sbin/; to be created.
|
||||
|
||||
-- Andres Salomon <dilinger@mp3revolution.net> Mon, 9 Dec 2002 02:51:02 -0400
|
||||
|
||||
lvm2 (1.95.10-2) unstable; urgency=low
|
||||
|
||||
* Fix software raid problems by ensuring lvm init script runs after
|
||||
raidtools init script. (Closes: #152569)
|
||||
|
||||
-- Andres Salomon <dilinger@mp3revolution.net> Tue, 3 Sep 2002 04:05:43 -0400
|
||||
|
||||
lvm2 (1.95.10-1) unstable; urgency=low
|
||||
|
||||
* New upstream release (Beta 3.2).
|
||||
* Change all references to /dev/device-mapper/control to
|
||||
/dev/mapper/control.
|
||||
|
||||
-- Andres Salomon <dilinger@mp3revolution.net> Sun, 1 Sep 2002 18:55:12 -0400
|
||||
|
||||
lvm2 (0.95.05-3) unstable; urgency=low
|
||||
|
||||
* Get rid of awk dependency in init script. (Closes: #146257)
|
||||
|
||||
-- Andres Salomon <dilinger@mp3revolution.net> Sun, 12 May 2002 04:39:06 -0500
|
||||
|
||||
lvm2 (0.95.05-2) unstable; urgency=low
|
||||
|
||||
* Use ${shlibs:Depends} in Depends.
|
||||
* Get rid of postinst/postrm scripts, use debhelper's init script instead.
|
||||
* Add Conflicts against lvm10, lvm-common.
|
||||
* Fix endian issues on big-endian machines.
|
||||
|
||||
-- Andres Salomon <dilinger@mp3revolution.net> Thu, 2 May 2002 23:53:53 -0500
|
||||
|
||||
lvm2 (0.95.05-1) unstable; urgency=low
|
||||
|
||||
* New release (Beta2).
|
||||
|
||||
-- Andres Salomon <dilinger@mp3revolution.net> Thu, 25 Apr 2002 00:37:41 -0500
|
||||
|
||||
lvm2 (0.95.04cvs20020306-1) unstable; urgency=low
|
||||
|
||||
* CVS updated.
|
||||
* Convert from debian native package.
|
||||
|
||||
-- Andres Salomon <dilinger@mp3revolution.net> Wed, 6 Mar 2002 00:43:21 -0500
|
||||
|
||||
lvm2 (0.95.04cvs20020304) unstable; urgency=low
|
||||
|
||||
* CVS updated.
|
||||
* Enhance init script; create devmapper control device, etc.
|
||||
* Add dmsetup as a suggestion.
|
||||
* Add /etc/lvm/lvm.conf conffile.
|
||||
* Add undocumented(7) for the commands missing manpages.
|
||||
|
||||
-- Andres Salomon <dilinger@mp3revolution.net> Mon, 4 Mar 2002 04:51:26 -0500
|
||||
|
||||
lvm2 (0.95.02cvs20020220) unstable; urgency=low
|
||||
|
||||
* Initial Release.
|
||||
|
||||
-- Andres Salomon <dilinger@mp3revolution.net> Wed, 20 Feb 2002 03:17:25 -0500
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
Source: lvm2
|
||||
Section: admin
|
||||
Priority: optional
|
||||
Maintainer: Andres Salomon <dilinger@mp3revolution.net>
|
||||
Build-Depends: debhelper (>> 3.0.0), libdevmapper-dev (>= 0.96.04), libreadline4-dev
|
||||
Standards-Version: 3.5.8.0
|
||||
|
||||
Package: lvm2
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}
|
||||
Conflicts: lvm10, lvm-common
|
||||
Replaces: lvm10, lvm-common
|
||||
Provides: lvm-binaries
|
||||
Suggests: dmsetup, kernel-patch-device-mapper
|
||||
Description: The Linux Logical Volume Manager
|
||||
This is LVM2, the rewrite of The Linux Logical Volume Manager. LVM
|
||||
supports enterprise level volume management of disk and disk subsystems
|
||||
by grouping arbitrary disks into volume groups. The total capacity of
|
||||
volume groups can be allocated to logical volumes, which are accessed as
|
||||
regular block devices.
|
||||
.
|
||||
LVM2 is currently stable, but has some unimplemented features (most notably,
|
||||
pvmove and e2fsadm). It is not yet recommended for production use. It is
|
||||
backwards-compatible with LVM1 (lvm10), and requires Linux kernel 2.4.
|
|
@ -1,25 +0,0 @@
|
|||
This package was debianized by Andres Salomon <dilinger@mp3revolution.net> on
|
||||
Wed, 20 Feb 2002 03:17:25 -0500.
|
||||
|
||||
It was downloaded from http://www.sistina.com/products_lvm.htm
|
||||
|
||||
Upstream Author: LVM Development Team
|
||||
|
||||
Copyright (c) 2001-2002 LVM Development Team
|
||||
|
||||
LVM2 is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
LVM2 is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
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
|
||||
|
||||
On Debian systems, the full text of the GPL can be found in
|
||||
/usr/share/common-licenses/GPL
|
|
@ -1,4 +0,0 @@
|
|||
etc/lvm
|
||||
usr/share/man/man5
|
||||
usr/share/man/man8
|
||||
sbin
|
|
@ -1,5 +0,0 @@
|
|||
BUGS
|
||||
README
|
||||
VERSION
|
||||
WHATS_NEW
|
||||
doc/*
|
|
@ -1,64 +0,0 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# lvm2 This script handles LVM2 initialization/shutdown.
|
||||
#
|
||||
# Written by Andres Salomon <dilinger@mp3revolution.net>.
|
||||
#
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
NAME=lvm2
|
||||
DESC=LVM
|
||||
|
||||
test -x /sbin/vgchange || exit 0
|
||||
modprobe dm-mod >/dev/null 2>&1
|
||||
|
||||
# Create necessary files in /dev for device-mapper
|
||||
create_devfiles() {
|
||||
DIR="/dev/mapper"
|
||||
FILE="$DIR/control"
|
||||
major=$(grep "[0-9] misc$" /proc/devices | sed 's/[ ]\+misc//')
|
||||
minor=$(grep "[0-9] device-mapper$" /proc/misc | sed 's/[ ]\+device-mapper//')
|
||||
|
||||
if test ! -d $DIR; then
|
||||
mkdir --mode=755 $DIR >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if test ! -c $FILE -a ! -z "$minor"; then
|
||||
mknod --mode=600 $FILE c $major $minor >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Initializing $DESC: "
|
||||
create_devfiles
|
||||
vgchange -a y
|
||||
|
||||
# # Mount all LVM devices
|
||||
# for vg in $( vgchange -a y 2>/dev/null | grep active | awk -F\" '{print $2}' ); do
|
||||
# MTPT=$( grep $vg /etc/fstab | awk '{print $2}' )
|
||||
# mount $MTPT
|
||||
# done
|
||||
echo "$NAME."
|
||||
;;
|
||||
stop)
|
||||
echo -n "Shutting down $DESC: "
|
||||
# We don't really try all that hard to shut it down; far too many
|
||||
# things that can keep it from successfully shutting down.
|
||||
vgchange -a n
|
||||
echo "$NAME."
|
||||
;;
|
||||
restart|force-reload)
|
||||
echo -n "Restarting $DESC: "
|
||||
vgchange -a n
|
||||
sleep 1
|
||||
vgchange -a y
|
||||
echo "$NAME."
|
||||
;;
|
||||
*)
|
||||
echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
|
@ -1,26 +0,0 @@
|
|||
debian/lvm2/usr/share/man/man5/lvm.conf.5
|
||||
debian/lvm2/usr/share/man/man8/lvchange.8
|
||||
debian/lvm2/usr/share/man/man8/lvcreate.8
|
||||
debian/lvm2/usr/share/man/man8/lvdisplay.8
|
||||
debian/lvm2/usr/share/man/man8/lvextend.8
|
||||
debian/lvm2/usr/share/man/man8/lvm.8
|
||||
debian/lvm2/usr/share/man/man8/lvmchange.8
|
||||
debian/lvm2/usr/share/man/man8/lvreduce.8
|
||||
debian/lvm2/usr/share/man/man8/lvremove.8
|
||||
debian/lvm2/usr/share/man/man8/lvrename.8
|
||||
debian/lvm2/usr/share/man/man8/lvscan.8
|
||||
debian/lvm2/usr/share/man/man8/pvchange.8
|
||||
debian/lvm2/usr/share/man/man8/pvcreate.8
|
||||
debian/lvm2/usr/share/man/man8/pvdisplay.8
|
||||
debian/lvm2/usr/share/man/man8/pvscan.8
|
||||
debian/lvm2/usr/share/man/man8/vgcfgbackup.8
|
||||
debian/lvm2/usr/share/man/man8/vgchange.8
|
||||
debian/lvm2/usr/share/man/man8/vgck.8
|
||||
debian/lvm2/usr/share/man/man8/vgcreate.8
|
||||
debian/lvm2/usr/share/man/man8/vgdisplay.8
|
||||
debian/lvm2/usr/share/man/man8/vgextend.8
|
||||
debian/lvm2/usr/share/man/man8/vgmerge.8
|
||||
debian/lvm2/usr/share/man/man8/vgreduce.8
|
||||
debian/lvm2/usr/share/man/man8/vgremove.8
|
||||
debian/lvm2/usr/share/man/man8/vgrename.8
|
||||
debian/lvm2/usr/share/man/man8/vgscan.8
|
|
@ -1,119 +0,0 @@
|
|||
#!/usr/bin/make -f
|
||||
# Sample debian/rules that uses debhelper.
|
||||
# GNU copyright 1997 by Joey Hess.
|
||||
#
|
||||
# This version is for a hypothetical package that builds an
|
||||
# architecture-dependant package, as well as an architecture-independent
|
||||
# package.
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
# This is the debhelper compatibility version to use.
|
||||
export DH_COMPAT=3
|
||||
|
||||
# These are used for cross-compiling and for saving the configure script
|
||||
# from having to guess our platform (since we know it already)
|
||||
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
|
||||
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
|
||||
|
||||
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
|
||||
CFLAGS += -g
|
||||
endif
|
||||
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
|
||||
INSTALL_PROGRAM += -s
|
||||
endif
|
||||
|
||||
configure: configure-stamp
|
||||
configure-stamp:
|
||||
dh_testdir
|
||||
# Add here commands to configure the package.
|
||||
./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/ --mandir=\$${prefix}/usr/share/man --infodir=\$${prefix}/usr/share/info
|
||||
|
||||
touch configure-stamp
|
||||
|
||||
build-arch: configure-stamp build-arch-stamp
|
||||
build-arch-stamp:
|
||||
dh_testdir
|
||||
|
||||
# Add here command to compile/build the package.
|
||||
$(MAKE)
|
||||
|
||||
touch build-arch-stamp
|
||||
|
||||
build-indep: configure-stamp build-indep-stamp
|
||||
build-indep-stamp:
|
||||
dh_testdir
|
||||
|
||||
# Add here command to compile/build the arch indep package.
|
||||
# It's ok not to do anything here, if you don't need to build
|
||||
# anything for this package.
|
||||
#/usr/bin/docbook-to-man debian/lvm2.sgml > lvm2.1
|
||||
|
||||
touch build-indep-stamp
|
||||
|
||||
build: build-arch build-indep
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp configure-stamp
|
||||
|
||||
# Add here commands to clean up after the build process.
|
||||
-$(MAKE) distclean
|
||||
-test -r /usr/share/misc/config.sub && \
|
||||
cp -f /usr/share/misc/config.sub config.sub
|
||||
-test -r /usr/share/misc/config.guess && \
|
||||
cp -f /usr/share/misc/config.guess config.guess
|
||||
|
||||
|
||||
dh_clean
|
||||
|
||||
install: DH_OPTIONS=
|
||||
install: build
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs
|
||||
|
||||
# Add here commands to install the package into debian/lvm2.
|
||||
$(MAKE) install prefix=$(CURDIR)/debian/lvm2
|
||||
install -m 0644 doc/example.conf debian/lvm2/etc/lvm/lvm.conf
|
||||
|
||||
|
||||
# Build architecture-independent files here.
|
||||
# Pass -i to all debhelper commands in this target to reduce clutter.
|
||||
binary-indep: build install
|
||||
# nada.
|
||||
|
||||
# Build architecture-dependent files here.
|
||||
binary-arch: build install
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
|
||||
# dh_installdebconf
|
||||
dh_installdocs
|
||||
dh_installexamples
|
||||
# dh_installlogrotate -a
|
||||
# dh_installemacsen -a
|
||||
# dh_installpam -a
|
||||
# dh_installmime -a
|
||||
dh_installinit --update-rcd-params="start 26 S . start 50 0 6 ."
|
||||
dh_installcron
|
||||
dh_installman
|
||||
dh_installinfo
|
||||
dh_installchangelogs
|
||||
dh_strip
|
||||
dh_link
|
||||
dh_compress
|
||||
dh_fixperms
|
||||
dh_makeshlibs
|
||||
dh_installdeb
|
||||
# dh_perl -a
|
||||
dh_shlibdeps
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install configure
|
|
@ -1,22 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
# Copyright (C) 2004-2005 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 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
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
SUBDIRS += mirror snapshot
|
||||
|
||||
include $(top_srcdir)/make.tmpl
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
process_event
|
||||
register_device
|
||||
unregister_device
|
|
@ -1,35 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
# Copyright (C) 2004-2005, 2008 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 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
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
INCLUDES += -I${top_srcdir}/tools
|
||||
CLDFLAGS += -L${top_srcdir}/tools -ldevmapper $(LVM2CMD_LIB)
|
||||
|
||||
SOURCES = dmeventd_mirror.c
|
||||
|
||||
ifeq ("@LIB_SUFFIX@","dylib")
|
||||
LIB_SHARED = libdevmapper-event-lvm2mirror.dylib
|
||||
else
|
||||
LIB_SHARED = libdevmapper-event-lvm2mirror.so
|
||||
endif
|
||||
|
||||
include $(top_srcdir)/make.tmpl
|
||||
|
||||
install: libdevmapper-event-lvm2mirror.$(LIB_SUFFIX)
|
||||
$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
|
||||
$(libdir)/$<.$(LIB_VERSION)
|
||||
$(LN_S) -f $<.$(LIB_VERSION) $(libdir)/$<
|
|
@ -1,289 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2005 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
|
||||
*/
|
||||
|
||||
#include "lvm2cmd.h"
|
||||
|
||||
#include <libdevmapper.h>
|
||||
#include <libdevmapper-event.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <syslog.h> /* FIXME Replace syslog with multilog */
|
||||
/* FIXME Missing openlog? */
|
||||
|
||||
#define ME_IGNORE 0
|
||||
#define ME_INSYNC 1
|
||||
#define ME_FAILURE 2
|
||||
|
||||
/*
|
||||
* register_device() is called first and performs initialisation.
|
||||
* Only one device may be registered or unregistered at a time.
|
||||
*/
|
||||
static pthread_mutex_t _register_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
/*
|
||||
* Number of active registrations.
|
||||
*/
|
||||
static int _register_count = 0;
|
||||
|
||||
static struct dm_pool *_mem_pool = NULL;
|
||||
static void *_lvm_handle = NULL;
|
||||
|
||||
/*
|
||||
* Currently only one event can be processed at a time.
|
||||
*/
|
||||
static pthread_mutex_t _event_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
static int _get_mirror_event(char *params)
|
||||
{
|
||||
int i, r = ME_INSYNC;
|
||||
char **args = NULL;
|
||||
char *dev_status_str;
|
||||
char *log_status_str;
|
||||
char *sync_str;
|
||||
char *p = NULL;
|
||||
int log_argc, num_devs;
|
||||
|
||||
/*
|
||||
* dm core parms: 0 409600 mirror
|
||||
* Mirror core parms: 2 253:4 253:5 400/400
|
||||
* New-style failure params: 1 AA
|
||||
* New-style log params: 3 cluster 253:3 A
|
||||
* or 3 disk 253:3 A
|
||||
* or 1 core
|
||||
*/
|
||||
|
||||
/* number of devices */
|
||||
if (!dm_split_words(params, 1, 0, &p))
|
||||
goto out_parse;
|
||||
|
||||
if (!(num_devs = atoi(p)))
|
||||
goto out_parse;
|
||||
p += strlen(p) + 1;
|
||||
|
||||
/* devices names + "400/400" + "1 AA" + 1 or 3 log parms + NULL */
|
||||
args = dm_malloc((num_devs + 7) * sizeof(char *));
|
||||
if (!args || dm_split_words(p, num_devs + 7, 0, args) < num_devs + 5)
|
||||
goto out_parse;
|
||||
|
||||
dev_status_str = args[2 + num_devs];
|
||||
log_argc = atoi(args[3 + num_devs]);
|
||||
log_status_str = args[3 + num_devs + log_argc];
|
||||
sync_str = args[num_devs];
|
||||
|
||||
/* Check for bad mirror devices */
|
||||
for (i = 0; i < num_devs; i++)
|
||||
if (dev_status_str[i] == 'D') {
|
||||
syslog(LOG_ERR, "Mirror device, %s, has failed.\n", args[i]);
|
||||
r = ME_FAILURE;
|
||||
}
|
||||
|
||||
/* Check for bad disk log device */
|
||||
if (log_argc > 1 && log_status_str[0] == 'D') {
|
||||
syslog(LOG_ERR, "Log device, %s, has failed.\n",
|
||||
args[2 + num_devs + log_argc]);
|
||||
r = ME_FAILURE;
|
||||
}
|
||||
|
||||
if (r == ME_FAILURE)
|
||||
goto out;
|
||||
|
||||
p = strstr(sync_str, "/");
|
||||
if (p) {
|
||||
p[0] = '\0';
|
||||
if (strcmp(sync_str, p+1))
|
||||
r = ME_IGNORE;
|
||||
p[0] = '/';
|
||||
} else
|
||||
goto out_parse;
|
||||
|
||||
out:
|
||||
if (args)
|
||||
dm_free(args);
|
||||
return r;
|
||||
|
||||
out_parse:
|
||||
if (args)
|
||||
dm_free(args);
|
||||
syslog(LOG_ERR, "Unable to parse mirror status string.");
|
||||
return ME_IGNORE;
|
||||
}
|
||||
|
||||
static void _temporary_log_fn(int level, const char *file __attribute((unused)),
|
||||
int line __attribute((unused)),
|
||||
const char *format)
|
||||
{
|
||||
if (!strncmp(format, "WARNING: ", 9) && (level < 5))
|
||||
syslog(LOG_CRIT, "%s", format);
|
||||
else
|
||||
syslog(LOG_DEBUG, "%s", format);
|
||||
}
|
||||
|
||||
static int _remove_failed_devices(const char *device)
|
||||
{
|
||||
int r;
|
||||
#define CMD_SIZE 256 /* FIXME Use system restriction */
|
||||
char cmd_str[CMD_SIZE];
|
||||
char *vg = NULL, *lv = NULL, *layer = NULL;
|
||||
|
||||
if (strlen(device) > 200) /* FIXME Use real restriction */
|
||||
return -ENAMETOOLONG; /* FIXME These return code distinctions are not used so remove them! */
|
||||
|
||||
if (!dm_split_lvm_name(_mem_pool, device, &vg, &lv, &layer)) {
|
||||
syslog(LOG_ERR, "Unable to determine VG name from %s",
|
||||
device);
|
||||
return -ENOMEM; /* FIXME Replace with generic error return - reason for failure has already got logged */
|
||||
}
|
||||
|
||||
/* FIXME Is any sanity-checking required on %s? */
|
||||
if (CMD_SIZE <= snprintf(cmd_str, CMD_SIZE, "vgreduce --config devices{ignore_suspended_devices=1} --removemissing %s", vg)) {
|
||||
/* this error should be caught above, but doesn't hurt to check again */
|
||||
syslog(LOG_ERR, "Unable to form LVM command: Device name too long");
|
||||
dm_pool_empty(_mem_pool); /* FIXME: not safe with multiple threads */
|
||||
return -ENAMETOOLONG; /* FIXME Replace with generic error return - reason for failure has already got logged */
|
||||
}
|
||||
|
||||
r = lvm2_run(_lvm_handle, cmd_str);
|
||||
|
||||
dm_pool_empty(_mem_pool); /* FIXME: not safe with multiple threads */
|
||||
return (r == 1) ? 0 : -1;
|
||||
}
|
||||
|
||||
void process_event(struct dm_task *dmt,
|
||||
enum dm_event_mask event __attribute((unused)),
|
||||
void **unused __attribute((unused)))
|
||||
{
|
||||
void *next = NULL;
|
||||
uint64_t start, length;
|
||||
char *target_type = NULL;
|
||||
char *params;
|
||||
const char *device = dm_task_get_name(dmt);
|
||||
|
||||
if (pthread_mutex_trylock(&_event_mutex)) {
|
||||
syslog(LOG_NOTICE, "Another thread is handling an event. Waiting...");
|
||||
pthread_mutex_lock(&_event_mutex);
|
||||
}
|
||||
do {
|
||||
next = dm_get_next_target(dmt, next, &start, &length,
|
||||
&target_type, ¶ms);
|
||||
|
||||
if (!target_type) {
|
||||
syslog(LOG_INFO, "%s mapping lost.\n", device);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmp(target_type, "mirror")) {
|
||||
syslog(LOG_INFO, "%s has unmirrored portion.\n", device);
|
||||
continue;
|
||||
}
|
||||
|
||||
switch(_get_mirror_event(params)) {
|
||||
case ME_INSYNC:
|
||||
/* FIXME: all we really know is that this
|
||||
_part_ of the device is in sync
|
||||
Also, this is not an error
|
||||
*/
|
||||
syslog(LOG_NOTICE, "%s is now in-sync\n", device);
|
||||
break;
|
||||
case ME_FAILURE:
|
||||
syslog(LOG_ERR, "Device failure in %s\n", device);
|
||||
if (_remove_failed_devices(device))
|
||||
/* FIXME Why are all the error return codes unused? Get rid of them? */
|
||||
syslog(LOG_ERR, "Failed to remove faulty devices in %s\n",
|
||||
device);
|
||||
/* Should check before warning user that device is now linear
|
||||
else
|
||||
syslog(LOG_NOTICE, "%s is now a linear device.\n",
|
||||
device);
|
||||
*/
|
||||
break;
|
||||
case ME_IGNORE:
|
||||
break;
|
||||
default:
|
||||
/* FIXME Provide value then! */
|
||||
syslog(LOG_INFO, "Unknown event received.\n");
|
||||
}
|
||||
} while (next);
|
||||
|
||||
pthread_mutex_unlock(&_event_mutex);
|
||||
}
|
||||
|
||||
int register_device(const char *device,
|
||||
const char *uuid __attribute((unused)),
|
||||
int major __attribute((unused)),
|
||||
int minor __attribute((unused)),
|
||||
void **unused __attribute((unused)))
|
||||
{
|
||||
int r = 0;
|
||||
|
||||
pthread_mutex_lock(&_register_mutex);
|
||||
|
||||
syslog(LOG_INFO, "Monitoring mirror device %s for events\n", device);
|
||||
|
||||
/*
|
||||
* Need some space for allocations. 1024 should be more
|
||||
* than enough for what we need (device mapper name splitting)
|
||||
*/
|
||||
if (!_mem_pool && !(_mem_pool = dm_pool_create("mirror_dso", 1024)))
|
||||
goto out;
|
||||
|
||||
if (!_lvm_handle) {
|
||||
lvm2_log_fn(_temporary_log_fn);
|
||||
if (!(_lvm_handle = lvm2_init())) {
|
||||
dm_pool_destroy(_mem_pool);
|
||||
_mem_pool = NULL;
|
||||
goto out;
|
||||
}
|
||||
lvm2_log_level(_lvm_handle, LVM2_LOG_SUPPRESS);
|
||||
/* FIXME Temporary: move to dmeventd core */
|
||||
lvm2_run(_lvm_handle, "_memlock_inc");
|
||||
}
|
||||
|
||||
_register_count++;
|
||||
r = 1;
|
||||
|
||||
out:
|
||||
pthread_mutex_unlock(&_register_mutex);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
int unregister_device(const char *device,
|
||||
const char *uuid __attribute((unused)),
|
||||
int major __attribute((unused)),
|
||||
int minor __attribute((unused)),
|
||||
void **unused __attribute((unused)))
|
||||
{
|
||||
pthread_mutex_lock(&_register_mutex);
|
||||
|
||||
syslog(LOG_INFO, "No longer monitoring mirror device %s for events\n",
|
||||
device);
|
||||
|
||||
if (!--_register_count) {
|
||||
dm_pool_destroy(_mem_pool);
|
||||
_mem_pool = NULL;
|
||||
lvm2_run(_lvm_handle, "_memlock_dec");
|
||||
lvm2_exit(_lvm_handle);
|
||||
_lvm_handle = NULL;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&_register_mutex);
|
||||
|
||||
return 1;
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
process_event
|
||||
register_device
|
||||
unregister_device
|
|
@ -1,35 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
# Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This file is part of the 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
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
INCLUDES += -I${top_srcdir}/tools
|
||||
CLDFLAGS += -L${top_srcdir}/tools -ldevmapper $(LVM2CMD_LIB)
|
||||
|
||||
SOURCES = dmeventd_snapshot.c
|
||||
|
||||
ifeq ("@LIB_SUFFIX@","dylib")
|
||||
LIB_SHARED = libdevmapper-event-lvm2snapshot.dylib
|
||||
else
|
||||
LIB_SHARED = libdevmapper-event-lvm2snapshot.so
|
||||
endif
|
||||
|
||||
include $(top_srcdir)/make.tmpl
|
||||
|
||||
install: libdevmapper-event-lvm2snapshot.$(LIB_SUFFIX)
|
||||
$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
|
||||
$(libdir)/$<.$(LIB_VERSION)
|
||||
$(LN_S) -f $<.$(LIB_VERSION) $(libdir)/$<
|
|
@ -1,232 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2008 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
|
||||
*/
|
||||
|
||||
#include "libdevmapper.h"
|
||||
#include "libdevmapper-event.h"
|
||||
#include "lvm2cmd.h"
|
||||
#include "lvm-string.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <syslog.h> /* FIXME Replace syslog with multilog */
|
||||
/* FIXME Missing openlog? */
|
||||
|
||||
/* First warning when snapshot is 80% full. */
|
||||
#define WARNING_THRESH 80
|
||||
/* Further warnings at 85%, 90% and 95% fullness. */
|
||||
#define WARNING_STEP 5
|
||||
|
||||
static pthread_mutex_t _register_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
/*
|
||||
* Number of active registrations.
|
||||
*/
|
||||
static int _register_count = 0;
|
||||
|
||||
static struct dm_pool *_mem_pool = NULL;
|
||||
static void *_lvm_handle = NULL;
|
||||
|
||||
struct snap_status {
|
||||
int invalid;
|
||||
int used;
|
||||
int max;
|
||||
};
|
||||
|
||||
/*
|
||||
* Currently only one event can be processed at a time.
|
||||
*/
|
||||
static pthread_mutex_t _event_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
static void _temporary_log_fn(int level,
|
||||
const char *file __attribute((unused)),
|
||||
int line __attribute((unused)),
|
||||
const char *format)
|
||||
{
|
||||
if (!strncmp(format, "WARNING: ", 9) && (level < 5))
|
||||
syslog(LOG_CRIT, "%s", format);
|
||||
else
|
||||
syslog(LOG_DEBUG, "%s", format);
|
||||
}
|
||||
|
||||
/* FIXME possibly reconcile this with target_percent when we gain
|
||||
access to regular LVM library here. */
|
||||
static void _parse_snapshot_params(char *params, struct snap_status *stat)
|
||||
{
|
||||
char *p;
|
||||
/*
|
||||
* xx/xx -- fractions used/max
|
||||
* Invalid -- snapshot invalidated
|
||||
* Unknown -- status unknown
|
||||
*/
|
||||
stat->used = stat->max = 0;
|
||||
|
||||
if (!strncmp(params, "Invalid", 7)) {
|
||||
stat->invalid = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* When we return without setting non-zero max, the parent is
|
||||
* responsible for reporting errors.
|
||||
*/
|
||||
if (!strncmp(params, "Unknown", 7))
|
||||
return;
|
||||
|
||||
if (!(p = strstr(params, "/")))
|
||||
return;
|
||||
|
||||
*p = '\0';
|
||||
p++;
|
||||
|
||||
stat->used = atoi(params);
|
||||
stat->max = atoi(p);
|
||||
}
|
||||
|
||||
/* send unregister command to itself */
|
||||
static void _unregister_self(struct dm_task *dmt)
|
||||
{
|
||||
const char *name = dm_task_get_name(dmt);
|
||||
struct dm_event_handler *dmevh;
|
||||
|
||||
if (!(dmevh = dm_event_handler_create()))
|
||||
return;
|
||||
|
||||
if (dm_event_handler_set_dev_name(dmevh, name))
|
||||
goto fail;
|
||||
|
||||
dm_event_handler_set_event_mask(dmevh, DM_EVENT_ALL_ERRORS|DM_EVENT_TIMEOUT);
|
||||
dm_event_unregister_handler(dmevh);
|
||||
fail:
|
||||
dm_event_handler_destroy(dmevh);
|
||||
}
|
||||
|
||||
void process_event(struct dm_task *dmt,
|
||||
enum dm_event_mask event __attribute((unused)),
|
||||
void **private)
|
||||
{
|
||||
void *next = NULL;
|
||||
uint64_t start, length;
|
||||
char *target_type = NULL;
|
||||
char *params;
|
||||
struct snap_status stat = { 0 };
|
||||
const char *device = dm_task_get_name(dmt);
|
||||
int percent, *percent_warning = (int*)private;
|
||||
|
||||
/* No longer monitoring, waiting for remove */
|
||||
if (!*percent_warning)
|
||||
return;
|
||||
|
||||
if (pthread_mutex_trylock(&_event_mutex)) {
|
||||
syslog(LOG_NOTICE, "Another thread is handling an event. Waiting...");
|
||||
pthread_mutex_lock(&_event_mutex);
|
||||
}
|
||||
|
||||
dm_get_next_target(dmt, next, &start, &length, &target_type, ¶ms);
|
||||
if (!target_type)
|
||||
goto out;
|
||||
|
||||
_parse_snapshot_params(params, &stat);
|
||||
/*
|
||||
* If the snapshot has been invalidated or we failed to parse
|
||||
* the status string. Report the full status string to syslog.
|
||||
*/
|
||||
if (stat.invalid || !stat.max) {
|
||||
syslog(LOG_ERR, "Snapshot %s changed state to: %s\n", device, params);
|
||||
_unregister_self(dmt);
|
||||
*percent_warning = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
percent = 100 * stat.used / stat.max;
|
||||
if (percent >= *percent_warning) {
|
||||
syslog(LOG_WARNING, "Snapshot %s is now %i%% full.\n", device, percent);
|
||||
/* Print warning on the next multiple of WARNING_STEP. */
|
||||
*percent_warning = (percent / WARNING_STEP) * WARNING_STEP + WARNING_STEP;
|
||||
}
|
||||
out:
|
||||
pthread_mutex_unlock(&_event_mutex);
|
||||
}
|
||||
|
||||
int register_device(const char *device,
|
||||
const char *uuid __attribute((unused)),
|
||||
int major __attribute((unused)),
|
||||
int minor __attribute((unused)),
|
||||
void **private)
|
||||
{
|
||||
int r = 0;
|
||||
int *percent_warning = (int*)private;
|
||||
|
||||
pthread_mutex_lock(&_register_mutex);
|
||||
|
||||
/*
|
||||
* Need some space for allocations. 1024 should be more
|
||||
* than enough for what we need (device mapper name splitting)
|
||||
*/
|
||||
if (!_mem_pool && !(_mem_pool = dm_pool_create("snapshot_dso", 1024)))
|
||||
goto out;
|
||||
|
||||
*percent_warning = WARNING_THRESH; /* Print warning if snapshot is full */
|
||||
|
||||
if (!_lvm_handle) {
|
||||
lvm2_log_fn(_temporary_log_fn);
|
||||
if (!(_lvm_handle = lvm2_init())) {
|
||||
dm_pool_destroy(_mem_pool);
|
||||
_mem_pool = NULL;
|
||||
goto out;
|
||||
}
|
||||
lvm2_log_level(_lvm_handle, LVM2_LOG_SUPPRESS);
|
||||
/* FIXME Temporary: move to dmeventd core */
|
||||
lvm2_run(_lvm_handle, "_memlock_inc");
|
||||
}
|
||||
|
||||
syslog(LOG_INFO, "Monitoring snapshot %s\n", device);
|
||||
|
||||
_register_count++;
|
||||
r = 1;
|
||||
|
||||
out:
|
||||
pthread_mutex_unlock(&_register_mutex);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
int unregister_device(const char *device,
|
||||
const char *uuid __attribute((unused)),
|
||||
int major __attribute((unused)),
|
||||
int minor __attribute((unused)),
|
||||
void **unused __attribute((unused)))
|
||||
{
|
||||
pthread_mutex_lock(&_register_mutex);
|
||||
|
||||
syslog(LOG_INFO, "No longer monitoring snapshot %s\n",
|
||||
device);
|
||||
|
||||
if (!--_register_count) {
|
||||
dm_pool_destroy(_mem_pool);
|
||||
_mem_pool = NULL;
|
||||
lvm2_run(_lvm_handle, "_memlock_dec");
|
||||
lvm2_exit(_lvm_handle);
|
||||
_lvm_handle = NULL;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&_register_mutex);
|
||||
|
||||
return 1;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: activate.h,v 1.1.1.1 2008/12/12 11:42:13 haad Exp $ */
|
||||
/* $NetBSD: activate.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: archiver.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: archiver.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: btree.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: btree.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: clvm.h,v 1.1.1.1 2008/12/12 11:42:13 haad Exp $ */
|
||||
/* $NetBSD: clvm.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: config.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: config.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: crc.h,v 1.1.1.1 2008/12/12 11:42:10 haad Exp $ */
|
||||
/* $NetBSD: crc.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: defaults.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: defaults.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dev-cache.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: dev-cache.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: device.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: device.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: display.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: display.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: errors.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: errors.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: filter-composite.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: filter-composite.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: filter-md.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: filter-md.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2004 Luca Berra
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: filter-persistent.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: filter-persistent.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: filter-regex.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: filter-regex.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: filter-sysfs.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: filter-sysfs.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2004 Red Hat, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: filter.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: filter.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: format-text.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: format-text.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: format1.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: format1.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: format_pool.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: format_pool.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: intl.h,v 1.1.1.1 2008/12/12 11:42:10 haad Exp $ */
|
||||
/* $NetBSD: intl.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: label.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: label.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: last-path-component.h,v 1.1.1.1 2008/12/12 11:42:10 haad Exp $ */
|
||||
/* $NetBSD: last-path-component.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2007 Red Hat, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lib.h,v 1.1.1.1 2008/12/12 11:42:10 haad Exp $ */
|
||||
/* $NetBSD: lib.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: locking.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: locking.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: log.h,v 1.1.1.1 2008/12/12 11:42:11 haad Exp $ */
|
||||
/* $NetBSD: log.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lv_alloc.h,v 1.1.1.1 2008/12/12 11:42:11 haad Exp $ */
|
||||
/* $NetBSD: lv_alloc.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lvm-exec.h,v 1.1.1.1 2008/12/12 11:42:10 haad Exp $ */
|
||||
/* $NetBSD: lvm-exec.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lvm-file.h,v 1.1.1.1 2008/12/12 11:42:10 haad Exp $ */
|
||||
/* $NetBSD: lvm-file.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lvm-string.h,v 1.1.1.1 2008/12/12 11:42:10 haad Exp $ */
|
||||
/* $NetBSD: lvm-string.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lvm-types.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: lvm-types.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lvm-wrappers.h,v 1.1.1.1 2008/12/12 11:42:10 haad Exp $ */
|
||||
/* $NetBSD: lvm-wrappers.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lvmcache.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: lvmcache.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: memlock.h,v 1.1.1.1 2008/12/12 11:42:10 haad Exp $ */
|
||||
/* $NetBSD: memlock.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: metadata-exported.h,v 1.1.1.1 2008/12/12 11:42:11 haad Exp $ */
|
||||
/* $NetBSD: metadata-exported.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: metadata.h,v 1.1.1.1 2008/12/12 11:42:11 haad Exp $ */
|
||||
/* $NetBSD: metadata.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pogen.h,v 1.1.1.1 2008/12/12 11:42:07 haad Exp $ */
|
||||
/* $NetBSD: pogen.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2004 Red Hat, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pv_alloc.h,v 1.1.1.1 2008/12/12 11:42:10 haad Exp $ */
|
||||
/* $NetBSD: pv_alloc.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2005 Red Hat, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: report.h,v 1.1.1.1 2008/12/12 11:42:10 haad Exp $ */
|
||||
/* $NetBSD: report.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: segtype.h,v 1.1.1.1 2008/12/12 11:42:10 haad Exp $ */
|
||||
/* $NetBSD: segtype.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sharedlib.h,v 1.1.1.1 2008/12/12 11:42:10 haad Exp $ */
|
||||
/* $NetBSD: sharedlib.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: str_list.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: str_list.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: targets.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: targets.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: text_export.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: text_export.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: text_import.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: text_import.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: toolcontext.h,v 1.1.1.1 2008/12/12 11:42:12 haad Exp $ */
|
||||
/* $NetBSD: toolcontext.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: util.h,v 1.1.1.1 2008/12/12 11:42:10 haad Exp $ */
|
||||
/* $NetBSD: util.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2007 Red Hat, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uuid.h,v 1.1.1.1 2008/12/12 11:42:10 haad Exp $ */
|
||||
/* $NetBSD: uuid.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: version.h,v 1.1.1.1 2008/12/12 11:42:07 haad Exp $ */
|
||||
/* $NetBSD: version.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
#ifndef _LVM_VERSION_H
|
||||
#define LVM_VERSION "2.2.02.43-cvs (12-08-08)"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: xlate.h,v 1.1.1.1 2008/12/12 11:42:10 haad Exp $ */
|
||||
/* $NetBSD: xlate.h,v 1.2 2008/12/12 11:55:06 haad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
config_t: config_t.c
|
||||
gcc -g -I../../include config_t.c -L../../lib -llvm -o config_t
|
||||
|
||||
clean:
|
||||
rm config_t
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* Test program that reads, then writes a config file.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct config_file *cf;
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Usage: %s <config_file>\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
cf = create_config_file();
|
||||
if (cf == NULL) {
|
||||
fprintf(stderr, "Couldn't create config_file object.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
if (!read_config(cf, argv[1])) {
|
||||
fprintf(stderr, "Couldn't read config file '%s'\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!write_config(cf, "out")) {
|
||||
fprintf(stderr, "Couldn't write config file 'out'\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
destroy_config_file(cf);
|
||||
dump_memory();
|
||||
return 0;
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
foo = []
|
|
@ -1,169 +0,0 @@
|
|||
# This file was originally generated by the LVM2 library
|
||||
# Generated: Wed Jul 17 22:41:37 2002
|
||||
|
||||
|
||||
description = "Created *after* executing 'lvcreate --quiet -s -n snap -c 512k -L200M vg0/origin /dev/hda8'"
|
||||
creation_time = 1026942097
|
||||
|
||||
vg0 {
|
||||
id = "Qmd96y-771S-Esbb-Zp6u-8xo9-Cfmt-YvndHY"
|
||||
seqno = 2
|
||||
status = ["RESIZEABLE", "READ", "WRITE"]
|
||||
system_id = "reti1014805292"
|
||||
extent_size = 8192 # 4 Megabytes
|
||||
max_lv = 255
|
||||
max_pv = 255
|
||||
|
||||
physical_volumes {
|
||||
|
||||
pv0 {
|
||||
id = "8nRQub-EquY-VR1C-Ipdv-6hEO-FuFT-wnlN5R"
|
||||
device = "/dev/discs/disc0/part8" # Hint only
|
||||
|
||||
status = ["ALLOCATABLE"]
|
||||
pe_start = 256
|
||||
pe_count = 501 # 1.95703 Gigabytes
|
||||
}
|
||||
|
||||
pv1 {
|
||||
id = "mRU6Mf-z1Sv-Kuqw-Ct1v-eC42-mnqs-YD1RrL"
|
||||
device = "/dev/discs/disc1/part2" # Hint only
|
||||
|
||||
status = ["ALLOCATABLE"]
|
||||
pe_start = 384
|
||||
pe_count = 7269 # 28.3945 Gigabytes
|
||||
}
|
||||
}
|
||||
|
||||
logical_volumes {
|
||||
|
||||
music {
|
||||
id = "000000-0000-0000-0000-0000-0000-000000"
|
||||
status = ["READ", "WRITE", "ALLOC_SIMPLE"]
|
||||
read_ahead = 0
|
||||
segment_count = 2
|
||||
|
||||
segment1 {
|
||||
start_extent = 0
|
||||
extent_count = 1024 # 4 Gigabytes
|
||||
stripes = 1
|
||||
|
||||
areas = [
|
||||
"pv1", 0
|
||||
]
|
||||
}
|
||||
segment2 {
|
||||
start_extent = 1024
|
||||
extent_count = 2560 # 10 Gigabytes
|
||||
stripes = 1
|
||||
|
||||
areas = [
|
||||
"pv1", 3584
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
photos {
|
||||
id = "000000-0000-0000-0000-0000-0000-000002"
|
||||
status = ["READ", "WRITE", "ALLOC_SIMPLE"]
|
||||
read_ahead = 0
|
||||
segment_count = 1
|
||||
|
||||
segment1 {
|
||||
start_extent = 0
|
||||
extent_count = 1024 # 4 Gigabytes
|
||||
stripes = 1
|
||||
|
||||
areas = [
|
||||
"pv1", 2048
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
id = "000000-0000-0000-0000-0000-0000-000003"
|
||||
status = ["READ", "WRITE", "ALLOC_SIMPLE"]
|
||||
read_ahead = 0
|
||||
segment_count = 1
|
||||
|
||||
segment1 {
|
||||
start_extent = 0
|
||||
extent_count = 512 # 2 Gigabytes
|
||||
stripes = 1
|
||||
|
||||
areas = [
|
||||
"pv1", 3072
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
origin {
|
||||
id = "000000-0000-0000-0000-0000-0000-000004"
|
||||
status = ["READ", "WRITE", "ALLOC_SIMPLE"]
|
||||
read_ahead = 0
|
||||
segment_count = 1
|
||||
|
||||
segment1 {
|
||||
start_extent = 0
|
||||
extent_count = 50 # 200 Megabytes
|
||||
stripes = 1
|
||||
|
||||
areas = [
|
||||
"pv1", 6144
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
packages {
|
||||
id = "000000-0000-0000-0000-0000-0000-000006"
|
||||
status = ["READ", "WRITE", "ALLOC_SIMPLE"]
|
||||
read_ahead = 0
|
||||
segment_count = 2
|
||||
|
||||
segment1 {
|
||||
start_extent = 0
|
||||
extent_count = 451 # 1.76172 Gigabytes
|
||||
stripes = 1
|
||||
|
||||
areas = [
|
||||
"pv0", 50
|
||||
]
|
||||
}
|
||||
segment2 {
|
||||
start_extent = 451
|
||||
extent_count = 573 # 2.23828 Gigabytes
|
||||
stripes = 1
|
||||
|
||||
areas = [
|
||||
"pv1", 6194
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
snap {
|
||||
id = "000000-0000-0000-0000-0000-0000-000001"
|
||||
status = ["READ", "WRITE", "ALLOC_SIMPLE"]
|
||||
read_ahead = 0
|
||||
segment_count = 1
|
||||
|
||||
segment1 {
|
||||
start_extent = 0
|
||||
extent_count = 50 # 200 Megabytes
|
||||
stripes = 1
|
||||
|
||||
areas = [
|
||||
"pv0", 0
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
snapshots {
|
||||
|
||||
snapshot0 {
|
||||
chunk_size = 1024
|
||||
origin = "origin"
|
||||
cow_store = "snap"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,106 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 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 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
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static void _help(FILE *fp, const char *prog)
|
||||
{
|
||||
fprintf(fp, "Usage : %s <table size> <num_entries>\n", prog);
|
||||
}
|
||||
|
||||
struct key_list {
|
||||
struct key_list *next;
|
||||
char key[1];
|
||||
};
|
||||
|
||||
static struct key_list *_create_word(int n)
|
||||
{
|
||||
struct key_list *kl = dbg_malloc(sizeof(*kl) + 32);
|
||||
snprintf(kl->key, 32, "abc%ddef%d", n, n);
|
||||
kl->next = 0;
|
||||
return kl;
|
||||
}
|
||||
|
||||
static struct key_list *_create_word_from_file(int n)
|
||||
{
|
||||
char word[128], *ptr;
|
||||
struct key_list *kl;
|
||||
|
||||
if (!fgets(word, sizeof(word), stdin))
|
||||
return 0;
|
||||
|
||||
for (ptr = word; *ptr; ptr++) {
|
||||
if (*ptr == '\n') {
|
||||
*ptr = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
kl = dbg_malloc(sizeof(*kl) + 32);
|
||||
snprintf(kl->key, 32, "%s", word);
|
||||
kl->next = 0;
|
||||
return kl;
|
||||
}
|
||||
|
||||
static void _do_test(int table_size, int num_entries)
|
||||
{
|
||||
int i;
|
||||
hash_table_t ht = hash_create(table_size);
|
||||
struct key_list *tmp, *key, *all = 0;
|
||||
|
||||
for (i = 0; i < num_entries; i++) {
|
||||
/* make up a word */
|
||||
if (!(key = _create_word_from_file(i))) {
|
||||
log_error("Ran out of words !\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* insert it */
|
||||
hash_insert(ht, key->key, key);
|
||||
key->next = all;
|
||||
all = key;
|
||||
}
|
||||
|
||||
for (key = all; key; key = key->next) {
|
||||
tmp = (struct key_list *) hash_lookup(ht, key->key);
|
||||
if (!tmp || (tmp != key)) {
|
||||
log_error("lookup failed\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (key = all; key; key = tmp) {
|
||||
tmp = key->next;
|
||||
dbg_free(key);
|
||||
}
|
||||
|
||||
hash_destroy(ht);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
init_log();
|
||||
|
||||
if (argc != 3) {
|
||||
_help(stderr, argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
_do_test(atoi(argv[1]), atoi(argv[2]));
|
||||
|
||||
dump_memory();
|
||||
fin_log();
|
||||
return 0;
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 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 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
|
||||
*/
|
||||
|
||||
#include "dev-cache.h"
|
||||
#include "log.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
struct device *dev;
|
||||
struct dev_iter *iter;
|
||||
|
||||
init_log();
|
||||
if (!dev_cache_init()) {
|
||||
log_error("couldn't initialise dev_cache_init failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!dev_cache_add_dir(argv[i])) {
|
||||
log_error("couldn't add '%s' to dev_cache\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!(iter = dev_iter_create(NULL))) {
|
||||
log_error("couldn't create iterator\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while ((dev = dev_iter_next(iter)))
|
||||
printf("%s\n", dev->name);
|
||||
|
||||
dev_iter_destroy(iter):
|
||||
dev_cache_exit();
|
||||
|
||||
dump_memory();
|
||||
fin_log();
|
||||
return 0;
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
# Copyright (C) 2004 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 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
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
SOURCES=\
|
||||
dev_cache_t.c
|
||||
|
||||
TARGETS=dev_cache_t
|
||||
|
||||
include $(top_srcdir)/make.tmpl
|
||||
|
||||
dev_cache_t: dev_cache_t.o $(top_srcdir)/lib/liblvm.a
|
||||
$(CC) -o dev_cache_t dev_cache_t.o -L$(top_srcdir)/lib -llvm
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 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 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
|
||||
*/
|
||||
|
||||
#include "dev-cache.h"
|
||||
#include "log.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
struct device *dev;
|
||||
struct dev_iter *iter;
|
||||
struct list_head *tmp;
|
||||
struct str_list *sl;
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "usage: %s <dir>\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
init_log(stderr);
|
||||
init_debug(_LOG_INFO);
|
||||
|
||||
if (!dev_cache_init()) {
|
||||
log_err("couldn't initialise dev_cache_init failed");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!dev_cache_add_dir(argv[i])) {
|
||||
log_err("couldn't add '%s' to dev_cache", argv[i]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!(iter = dev_iter_create(NULL))) {
|
||||
log_err("couldn't create iterator");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while ((dev = dev_iter_get(iter))) {
|
||||
printf("%s", dev->name);
|
||||
|
||||
list_for_each(tmp, &dev->aliases) {
|
||||
sl = list_entry(tmp, struct str_list, list);
|
||||
printf(", %s", sl->str);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
dev_iter_destroy(iter);
|
||||
dev_cache_exit();
|
||||
|
||||
dump_memory();
|
||||
fin_log();
|
||||
return 0;
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 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 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
|
||||
*/
|
||||
|
||||
#include "device.h"
|
||||
#include "random.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
}
|
|
@ -1,116 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 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 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
|
||||
*/
|
||||
|
||||
#include "random.h"
|
||||
#include "log.h"
|
||||
|
||||
int32_t _a[56];
|
||||
int32_t *_r;
|
||||
|
||||
static inline int32_t _mod_diff(int32_t x, int32_t y)
|
||||
{
|
||||
return (x - y) & 0x7fffffff;
|
||||
}
|
||||
|
||||
static int32_t _flip_cycle(void)
|
||||
{
|
||||
int32_t *ii, *jj;
|
||||
for (ii = _a + 1, jj = _a + 32; jj <= _a + 55; ii++, jj++)
|
||||
*ii = _mod_diff(*ii, *jj);
|
||||
|
||||
for (jj = _a + 1; ii <= _a + 55; ii++, jj++)
|
||||
*ii = _mod_diff(*ii, *jj);
|
||||
|
||||
_r = _a + 54;
|
||||
return _a[55];
|
||||
}
|
||||
|
||||
static void rand_init(int32_t seed)
|
||||
{
|
||||
int64_t i;
|
||||
int64_t prev = seed, next = 1;
|
||||
|
||||
seed = prev = _mod_diff(prev, 0); /* strip the sign */
|
||||
_a[55] = prev;
|
||||
for (i = 21; i; i = (i + 21) % 55) {
|
||||
_a[i] = next;
|
||||
next = _mod_diff(prev, next);
|
||||
if(seed & 1)
|
||||
seed = 0x40000000L + (seed >> 1);
|
||||
else
|
||||
seed >>= 1;
|
||||
|
||||
next = _mod_diff(next, seed);
|
||||
prev = _a[i];
|
||||
}
|
||||
|
||||
_flip_cycle();
|
||||
_flip_cycle();
|
||||
_flip_cycle();
|
||||
_flip_cycle();
|
||||
_flip_cycle();
|
||||
}
|
||||
|
||||
/*
|
||||
* FIXME: move this to be an inline in the
|
||||
* header.
|
||||
*/
|
||||
int32_t rand_get(void)
|
||||
{
|
||||
return (*_r >= 0) ? *_r-- : _flip_cycle();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* just used by rand_check
|
||||
*/
|
||||
#define t31 0x80000000
|
||||
static int32_t _uniform(int32_t m)
|
||||
{
|
||||
uint32_t t = t31 - (t31 % m);
|
||||
int32_t r;
|
||||
|
||||
do
|
||||
r = next_rand(sc);
|
||||
|
||||
while (t <= (uint32_t) r);
|
||||
|
||||
return r % m;
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks I've copied the code correctly.
|
||||
*/
|
||||
int rand_check(void)
|
||||
{
|
||||
int j;
|
||||
|
||||
rand_init(-314159L);
|
||||
|
||||
if (next_rand(sc) != 119318998) {
|
||||
log_err("Random number generator failed check 1");
|
||||
return 0;
|
||||
}
|
||||
|
||||
for(j = 1; j <= 133; j++)
|
||||
rand_get();
|
||||
|
||||
if (_uniform(0x55555555L) != 748103812) {
|
||||
log_err("Random number generator failed check 2");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 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 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
|
||||
*/
|
||||
|
||||
/*
|
||||
* Random number generator snarfed from the
|
||||
* Stanford Graphbase.
|
||||
*/
|
||||
|
||||
#ifndef _LVM_RANDOM_H
|
||||
#define _LVM_RANDOM_H
|
||||
|
||||
#include "lvm-types.h"
|
||||
|
||||
void rand_init(int32_t seed);
|
||||
int32_t rand_get(void);
|
||||
|
||||
/*
|
||||
* Note this will reset the seed.
|
||||
*/
|
||||
int rand_check(void);
|
||||
|
||||
#endif
|
|
@ -1,34 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
# Copyright (C) 2004 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 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
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
SOURCES=\
|
||||
rfilter_t.c \
|
||||
pfilter_t.c
|
||||
|
||||
TARGETS=\
|
||||
rfilter_t \
|
||||
pfilter_t
|
||||
|
||||
include $(top_srcdir)/make.tmpl
|
||||
|
||||
rfilter_t: rfilter_t.o $(top_srcdir)/lib/liblvm.a
|
||||
$(CC) -o rfilter_t rfilter_t.o -L$(top_srcdir)/lib -llvm
|
||||
|
||||
pfilter_t: pfilter_t.o $(top_srcdir)/lib/liblvm.a
|
||||
$(CC) -o pfilter_t pfilter_t.o -L$(top_srcdir)/lib -llvm
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 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 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
|
||||
*/
|
||||
|
||||
#include "filter-persistent.h"
|
||||
#include "log.h"
|
||||
#include "config.h"
|
||||
#include "filter-regex.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct config_file *cft;
|
||||
struct config_node *cn;
|
||||
struct dev_filter *rfilter, *pfilter;
|
||||
struct dev_iter *iter;
|
||||
struct device *dev;
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "Usage : %s <regex config>\n",
|
||||
argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
init_log(stderr);
|
||||
init_debug(_LOG_DEBUG);
|
||||
|
||||
if (!dev_cache_init()) {
|
||||
fprintf(stderr, "couldn't initialise dev_cache_init failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!dev_cache_add_dir("/dev")) {
|
||||
fprintf(stderr, "couldn't add '/dev' to dev_cache\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!(cft = create_config_file())) {
|
||||
fprintf(stderr, "couldn't create config file\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!read_config(cft, argv[1])) {
|
||||
fprintf(stderr, "couldn't read config file\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!(cn = find_config_node(cft->root, "/devices/filter", '/'))) {
|
||||
fprintf(stderr, "couldn't find filter section\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!(rfilter = regex_filter_create(cn->v))) {
|
||||
fprintf(stderr, "couldn't build filter\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!(pfilter = persistent_filter_create(rfilter, "./pfilter.cfg"))) {
|
||||
fprintf(stderr, "couldn't build filter\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!(iter = dev_iter_create(pfilter))) {
|
||||
log_err("couldn't create iterator");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fprintf(stderr, "filling cache\n");
|
||||
while ((dev = dev_iter_get(iter)))
|
||||
;
|
||||
dev_iter_destroy(iter);
|
||||
|
||||
fprintf(stderr, "dumping\n");
|
||||
if (!persistent_filter_dump(pfilter)) {
|
||||
fprintf(stderr, "couldn't dump pfilter\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fprintf(stderr, "loading\n");
|
||||
if (!persistent_filter_load(pfilter)) {
|
||||
fprintf(stderr, "couldn't load pfilter\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!(iter = dev_iter_create(pfilter))) {
|
||||
log_err("couldn't create iterator");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while ((dev = dev_iter_get(iter)))
|
||||
printf("%s\n", dev_name(dev));
|
||||
|
||||
dev_iter_destroy(iter);
|
||||
pfilter->destroy(pfilter);
|
||||
dev_cache_exit();
|
||||
destroy_config_file(cft);
|
||||
|
||||
dump_memory();
|
||||
fin_log();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 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 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
|
||||
*/
|
||||
|
||||
#include "filter-regex.h"
|
||||
#include "config.h"
|
||||
#include "log.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct config_file *cft;
|
||||
struct config_node *cn;
|
||||
struct dev_filter *filter;
|
||||
struct dev_iter *iter;
|
||||
struct device *dev;
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "Usage : %s <config_file>\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
init_log(stderr);
|
||||
init_debug(_LOG_DEBUG);
|
||||
|
||||
if (!(cft = create_config_file())) {
|
||||
fprintf(stderr, "couldn't create config file\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!read_config(cft, argv[1])) {
|
||||
fprintf(stderr, "couldn't read config file\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!(cn = find_config_node(cft->root, "/devices/filter", '/'))) {
|
||||
fprintf(stderr, "couldn't find filter section\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!dev_cache_init()) {
|
||||
fprintf(stderr, "couldn't initialise dev_cache_init failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!dev_cache_add_dir("/dev")) {
|
||||
fprintf(stderr, "couldn't add '/dev' to dev_cache\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!(filter = regex_filter_create(cn->v))) {
|
||||
fprintf(stderr, "couldn't build filter\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!(iter = dev_iter_create(filter))) {
|
||||
log_err("couldn't create iterator");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while ((dev = dev_iter_get(iter)))
|
||||
printf("%s\n", dev_name(dev));
|
||||
|
||||
dev_iter_destroy(iter);
|
||||
filter->destroy(filter);
|
||||
dev_cache_exit();
|
||||
destroy_config_file(cft);
|
||||
|
||||
dump_memory();
|
||||
fin_log();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
devices {
|
||||
|
||||
# first match is final, eg. /dev/ide/cdrom
|
||||
# get's rejected due to the first pattern
|
||||
|
||||
filter=["r/cdrom/", # don't touch the music !
|
||||
"a/hd[a-d][0-9]+/",
|
||||
"a/ide/",
|
||||
"a/sd/",
|
||||
"a/md/",
|
||||
"a|loop/[0-9]+|", # accept devfs style loop back
|
||||
"r/loop/", # and reject old style
|
||||
"a/dasd/",
|
||||
"a/dac960/",
|
||||
"a/nbd/",
|
||||
"a/ida/",
|
||||
"a/cciss/",
|
||||
"a/ubd/",
|
||||
"r/.*/"] # reject all others
|
||||
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
# Copyright (C) 2004 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 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
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
SOURCES=\
|
||||
read_vg_t.c \
|
||||
write_vg_t.c \
|
||||
pretty_print.c \
|
||||
get_pvs_t.c \
|
||||
read_pv_t.c \
|
||||
get_vgs_t.c
|
||||
|
||||
TARGETS=\
|
||||
read_vg_t \
|
||||
write_vg_t \
|
||||
get_pvs_t \
|
||||
read_pv_t \
|
||||
get_vgs_t
|
||||
|
||||
include $(top_srcdir)/make.tmpl
|
||||
|
||||
read_vg_t: read_vg_t.o pretty_print.o $(top_srcdir)/lib/liblvm.a
|
||||
$(CC) -o read_vg_t read_vg_t.o pretty_print.o -L$(top_srcdir)/lib -llvm
|
||||
|
||||
write_vg_t: write_vg_t.o pretty_print.o $(top_srcdir)/lib/liblvm.a
|
||||
$(CC) -o write_vg_t write_vg_t.o pretty_print.o \
|
||||
-L$(top_srcdir)/lib -llvm
|
||||
|
||||
get_pvs_t: get_pvs_t.o pretty_print.o $(top_srcdir)/lib/liblvm.a
|
||||
$(CC) -o get_pvs_t get_pvs_t.o pretty_print.o -L$(top_srcdir)/lib -llvm
|
||||
|
||||
read_pv_t: read_pv_t.o pretty_print.o $(top_srcdir)/lib/liblvm.a
|
||||
$(CC) -o read_pv_t read_pv_t.o pretty_print.o -L$(top_srcdir)/lib -llvm
|
||||
|
||||
get_vgs_t: get_vgs_t.o pretty_print.o $(top_srcdir)/lib/liblvm.a
|
||||
$(CC) -o get_vgs_t get_vgs_t.o pretty_print.o -L$(top_srcdir)/lib -llvm
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 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 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
|
||||
*/
|
||||
|
||||
#include "log.h"
|
||||
#include "format1.h"
|
||||
#include "pretty_print.h"
|
||||
#include "list.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct io_space *ios;
|
||||
struct list_head *pvs, *tmp;
|
||||
struct dm_pool *mem;
|
||||
|
||||
init_log(stderr);
|
||||
init_debug(_LOG_INFO);
|
||||
|
||||
if (!dev_cache_init()) {
|
||||
fprintf(stderr, "init of dev-cache failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!dev_cache_add_dir("/dev/loop")) {
|
||||
fprintf(stderr, "couldn't add /dev to dir-cache\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!(mem = dm_pool_create(10 * 1024))) {
|
||||
fprintf(stderr, "couldn't create pool\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ios = create_lvm1_format("/dev", mem, NULL);
|
||||
|
||||
if (!ios) {
|
||||
fprintf(stderr, "failed to create io_space for format1\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
pvs = ios->get_pvs(ios);
|
||||
|
||||
if (!pvs) {
|
||||
fprintf(stderr, "couldn't read vg %s\n", argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
list_for_each(tmp, pvs) {
|
||||
struct pv_list *pvl = list_entry(tmp, struct pv_list, list);
|
||||
dump_pv(&pvl->pv, stdout);
|
||||
}
|
||||
|
||||
ios->destroy(ios);
|
||||
|
||||
dm_pool_destroy(mem);
|
||||
dev_cache_exit();
|
||||
dump_memory();
|
||||
fin_log();
|
||||
return 0;
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 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 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
|
||||
*/
|
||||
|
||||
#include "log.h"
|
||||
#include "format1.h"
|
||||
#include "pretty_print.h"
|
||||
#include "list.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct io_space *ios;
|
||||
struct list_head *vgs;
|
||||
struct dm_pool *mem;
|
||||
|
||||
init_log(stderr);
|
||||
init_debug(_LOG_INFO);
|
||||
|
||||
if (!dev_cache_init()) {
|
||||
fprintf(stderr, "init of dev-cache failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!dev_cache_add_dir("/dev/loop")) {
|
||||
fprintf(stderr, "couldn't add /dev to dir-cache\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!(mem = dm_pool_create(10 * 1024))) {
|
||||
fprintf(stderr, "couldn't create pool\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ios = create_lvm1_format("/dev", mem, NULL);
|
||||
|
||||
if (!ios) {
|
||||
fprintf(stderr, "failed to create io_space for format1\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
vgs = ios->get_vgs(ios);
|
||||
|
||||
if (!vgs) {
|
||||
fprintf(stderr, "couldn't read vg names\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
dump_vg_names(vgs, stdout);
|
||||
ios->destroy(ios);
|
||||
|
||||
dm_pool_destroy(mem);
|
||||
dev_cache_exit();
|
||||
dump_memory();
|
||||
fin_log();
|
||||
return 0;
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 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 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
|
||||
*/
|
||||
|
||||
#include "pretty_print.h"
|
||||
|
||||
void dump_pv(struct physical_volume *pv, FILE *fp)
|
||||
{
|
||||
fprintf(fp, "physical_volume {\n");
|
||||
fprintf(fp, "\tname = '%s'\n", pv->dev->name);
|
||||
fprintf(fp, "\tvg_name = '%s'\n", pv->vg_name);
|
||||
fprintf(fp, "\tsize = %llu\n", pv->size);
|
||||
fprintf(fp, "\tpe_size = %llu\n", pv->pe_size);
|
||||
fprintf(fp, "\tpe_start = %llu\n", pv->pe_start);
|
||||
fprintf(fp, "\tpe_count = %u\n", pv->pe_count);
|
||||
fprintf(fp, "\tpe_allocated = %u\n", pv->pe_allocated);
|
||||
fprintf(fp, "}\n\n");
|
||||
}
|
||||
|
||||
void dump_lv(struct logical_volume *lv, FILE *fp)
|
||||
{
|
||||
int i;
|
||||
|
||||
fprintf(fp, "logical_volume {\n");
|
||||
fprintf(fp, "\tname = '%s'\n", lv->name);
|
||||
fprintf(fp, "\tsize = %llu\n", lv->size);
|
||||
fprintf(fp, "\tle_count = %u\n", lv->le_count);
|
||||
|
||||
fprintf(fp, "\tmap {\n");
|
||||
for (i = 0; i < lv->le_count; i++) {
|
||||
struct physical_volume *pv = lv->map[i].pv;
|
||||
|
||||
fprintf(fp, "\t\tpv = '%s', ",
|
||||
pv ? pv->dev->name : "null ???");
|
||||
fprintf(fp, "\textent = %u\n", lv->map[i].pe);
|
||||
}
|
||||
fprintf(fp, "\t}\n}\n\n");
|
||||
}
|
||||
|
||||
void dump_vg(struct volume_group *vg, FILE *fp)
|
||||
{
|
||||
struct list_head *tmp;
|
||||
|
||||
fprintf(fp, "volume_group {\n");
|
||||
fprintf(fp, "\tname = '%s'\n", vg->name);
|
||||
fprintf(fp, "\textent_size = %llu\n", vg->extent_size);
|
||||
fprintf(fp, "\textent_count = %d\n", vg->extent_count);
|
||||
fprintf(fp, "\tfree_count = %d\n", vg->free_count);
|
||||
fprintf(fp, "\tmax_lv = %d\n", vg->max_lv);
|
||||
fprintf(fp, "\tmax_pv = %d\n", vg->max_pv);
|
||||
fprintf(fp, "\tpv_count = %d\n", vg->pv_count);
|
||||
fprintf(fp, "\tlv_count = %d\n", vg->lv_count);
|
||||
fprintf(fp, "}\n\n");
|
||||
|
||||
list_for_each(tmp, &vg->pvs) {
|
||||
struct pv_list *pvl = list_entry(tmp, struct pv_list, list);
|
||||
dump_pv(&pvl->pv, fp);
|
||||
}
|
||||
|
||||
list_for_each(tmp, &vg->lvs) {
|
||||
struct lv_list *lvl = list_entry(tmp, struct lv_list, list);
|
||||
dump_lv(&lvl->lv, fp);
|
||||
}
|
||||
}
|
||||
|
||||
void dump_vg_names(struct list_head *vg_names, FILE *fp)
|
||||
{
|
||||
struct list_head *tmp;
|
||||
struct name_list *nl;
|
||||
|
||||
list_for_each(tmp, vg_names) {
|
||||
nl = list_entry(tmp, struct name_list, list);
|
||||
fprintf(fp, "%s\n", nl->name);
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 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 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_PRETTY_PRINT
|
||||
#define _LVM_PRETTY_PRINT
|
||||
|
||||
#include "metadata.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
void dump_pv(struct physical_volume *pv, FILE *fp);
|
||||
void dump_lv(struct logical_volume *lv, FILE *fp);
|
||||
void dump_vg(struct volume_group *vg, FILE *fp);
|
||||
void dump_vg_names(struct list_head *vg_names, FILE *fp);
|
||||
|
||||
#endif
|
|
@ -1,75 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 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 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
|
||||
*/
|
||||
|
||||
#include "log.h"
|
||||
#include "format1.h"
|
||||
#include "pretty_print.h"
|
||||
#include "list.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct io_space *ios;
|
||||
struct physical_volume *pv;
|
||||
struct dm_pool *mem;
|
||||
struct device *dev;
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "usage: read_pv_t <device>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
init_log(stderr);
|
||||
init_debug(_LOG_INFO);
|
||||
|
||||
if (!dev_cache_init()) {
|
||||
fprintf(stderr, "init of dev-cache failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!dev_cache_add_dir("/dev/loop")) {
|
||||
fprintf(stderr, "couldn't add /dev to dir-cache\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!(mem = dm_pool_create(10 * 1024))) {
|
||||
fprintf(stderr, "couldn't create pool\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ios = create_lvm1_format("/dev", mem, NULL);
|
||||
|
||||
if (!ios) {
|
||||
fprintf(stderr, "failed to create io_space for format1\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
pv = ios->pv_read(ios, argv[1]);
|
||||
|
||||
if (!pv) {
|
||||
fprintf(stderr, "couldn't read pv %s\n", dev->name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
dump_pv(pv, stdout);
|
||||
ios->destroy(ios);
|
||||
|
||||
dm_pool_destroy(mem);
|
||||
dev_cache_exit();
|
||||
dump_memory();
|
||||
fin_log();
|
||||
return 0;
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 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 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
|
||||
*/
|
||||
|
||||
#include "log.h"
|
||||
#include "format1.h"
|
||||
#include "pretty_print.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct io_space *ios;
|
||||
struct volume_group *vg;
|
||||
struct dm_pool *mem;
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "usage: read_vg_t <vg_name>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
init_log(stderr);
|
||||
init_debug(_LOG_INFO);
|
||||
|
||||
if (!dev_cache_init()) {
|
||||
fprintf(stderr, "init of dev-cache failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!dev_cache_add_dir("/dev/loop")) {
|
||||
fprintf(stderr, "couldn't add /dev to dir-cache\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!(mem = dm_pool_create(10 * 1024))) {
|
||||
fprintf(stderr, "couldn't create pool\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ios = create_lvm1_format("/dev", mem, NULL);
|
||||
|
||||
if (!ios) {
|
||||
fprintf(stderr, "failed to create io_space for format1\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
vg = ios->vg_read(ios, argv[1]);
|
||||
|
||||
if (!vg) {
|
||||
fprintf(stderr, "couldn't read vg %s\n", argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
dump_vg(vg, stdout);
|
||||
|
||||
ios->destroy(ios);
|
||||
|
||||
dm_pool_destroy(mem);
|
||||
dev_cache_exit();
|
||||
dump_memory();
|
||||
fin_log();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 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 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
|
||||
*/
|
||||
|
||||
#include "log.h"
|
||||
#include "format1.h"
|
||||
#include "pretty_print.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct io_space *ios;
|
||||
struct volume_group *vg;
|
||||
struct dm_pool *mem;
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "usage: read_vg_t <vg_name>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
init_log(stderr);
|
||||
init_debug(_LOG_INFO);
|
||||
|
||||
if (!dev_cache_init()) {
|
||||
fprintf(stderr, "init of dev-cache failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!dev_cache_add_dir("/dev/loop")) {
|
||||
fprintf(stderr, "couldn't add /dev to dir-cache\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!(mem = dm_pool_create(10 * 1024))) {
|
||||
fprintf(stderr, "couldn't create pool\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ios = create_lvm1_format("/dev", mem, NULL);
|
||||
|
||||
if (!ios) {
|
||||
fprintf(stderr, "failed to create io_space for format1\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
vg = ios->vg_read(ios, argv[1]);
|
||||
|
||||
if (!vg) {
|
||||
fprintf(stderr, "couldn't read vg %s\n", argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!ios->vg_write(ios, vg)) {
|
||||
fprintf(stderr, "couldn't write vg\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ios->destroy(ios);
|
||||
|
||||
dm_pool_destroy(mem);
|
||||
dev_cache_exit();
|
||||
dump_memory();
|
||||
fin_log();
|
||||
return 0;
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
# Copyright (C) 2004 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 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
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
SOURCES=\
|
||||
dbg_malloc_t.c
|
||||
|
||||
TARGETS=dbg_malloc_t
|
||||
|
||||
include $(top_srcdir)/make.tmpl
|
||||
|
||||
dbg_malloc_t: dbg_malloc_t.o
|
||||
$(CC) $(CFLAGS) -o dbg_malloc_t dbg_malloc_t.o \
|
||||
-L$(top_srcdir)/lib -llvm
|
||||
|
||||
pool_t: pool_t.o
|
||||
$(CC) $(CFLAGS) -o pool_t pool_t.o -L$(top_srcdir)/lib -llvm
|
||||
|
|
@ -1,156 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 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 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
|
||||
*/
|
||||
|
||||
#include "log.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
static void _print_help(FILE *out, const char *prog)
|
||||
{
|
||||
fprintf(out, "usage : %s [-hlbufd]\n\n", prog);
|
||||
fprintf(out, " h : this message\n");
|
||||
fprintf(out, " l : cause memory leak\n");
|
||||
fprintf(out, " b : overrun memory block\n");
|
||||
fprintf(out, " u : underrun memory block\n");
|
||||
fprintf(out, " f : free random pointer\n");
|
||||
fprintf(out, " d : free block twice\n");
|
||||
}
|
||||
|
||||
struct block_list {
|
||||
struct block_list *next;
|
||||
char dummy[9];
|
||||
};
|
||||
|
||||
static void _leak_memory(void)
|
||||
{
|
||||
int i;
|
||||
struct block_list *b, *head, **l = &head, *n;
|
||||
|
||||
/* allocate a list of blocks */
|
||||
for (i = 0; i < 1000; i++) {
|
||||
|
||||
if (!(b = dbg_malloc(sizeof(*b)))) {
|
||||
log_fatal("Couldn't allocate memory");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
b->next = 0;
|
||||
*l = b;
|
||||
l = &b->next;
|
||||
}
|
||||
|
||||
/* free off every other block */
|
||||
for (b = head, i = 0; b; b = n, i++) {
|
||||
n = b->next;
|
||||
if(i & 0x1)
|
||||
dbg_free(b);
|
||||
}
|
||||
}
|
||||
|
||||
static void _bounds_overrun(void)
|
||||
{
|
||||
char *b;
|
||||
|
||||
/* allocate a block */
|
||||
b = dbg_malloc(534);
|
||||
|
||||
/* overrun */
|
||||
b[534] = 56;
|
||||
|
||||
/* free it, which should trigger the bounds error */
|
||||
dbg_free(b);
|
||||
}
|
||||
|
||||
static void _bounds_underrun(void)
|
||||
{
|
||||
char *b;
|
||||
|
||||
/* allocate a block */
|
||||
b = dbg_malloc(534);
|
||||
|
||||
/* underrun */
|
||||
*(b - 1) = 56;
|
||||
|
||||
/* free it, which should trigger the bounds error */
|
||||
dbg_free(b);
|
||||
}
|
||||
|
||||
static void _free_dud(void)
|
||||
{
|
||||
char *b;
|
||||
|
||||
/* allocate a block */
|
||||
b = dbg_malloc(534);
|
||||
|
||||
/* free it, which should trigger the bounds error */
|
||||
dbg_free(b + 100);
|
||||
}
|
||||
|
||||
static void _free_twice(void)
|
||||
{
|
||||
char *b;
|
||||
|
||||
/* allocate a block */
|
||||
b = dbg_malloc(534);
|
||||
|
||||
/* free it, which should trigger the bounds error */
|
||||
dbg_free(b);
|
||||
dbg_free(b);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char opt;
|
||||
|
||||
init_log(stderr);
|
||||
init_debug(_LOG_DEBUG);
|
||||
opt = getopt(argc, argv, "hlbufd");
|
||||
switch(opt) {
|
||||
case EOF:
|
||||
case 'h':
|
||||
_print_help(stdout, argv[0]);
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
_leak_memory();
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
_bounds_overrun();
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
_bounds_underrun();
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
_free_dud();
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
_free_twice();
|
||||
break;
|
||||
|
||||
case '?':
|
||||
fprintf(stderr, "Unknown option -%c\n", opt);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
dump_memory();
|
||||
fin_log();
|
||||
return 0;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
# Copyright (C) 2004 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 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
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
SOURCES=\
|
||||
parse_t.c \
|
||||
matcher_t.c
|
||||
|
||||
TARGETS=\
|
||||
parse_t \
|
||||
matcher_t
|
||||
|
||||
include $(top_srcdir)/make.tmpl
|
||||
|
||||
parse_t: parse_t.o $(top_srcdir)/lib/liblvm.a
|
||||
$(CC) -o parse_t parse_t.o -L$(top_srcdir)/lib -llvm
|
||||
|
||||
matcher_t: matcher_t.o $(top_srcdir)/lib/liblvm.a
|
||||
$(CC) -o matcher_t matcher_t.o -L$(top_srcdir)/lib -llvm
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
"loop/[0-9]+"
|
||||
"hd[a-d][0-5]+"
|
|
@ -1,880 +0,0 @@
|
|||
/dev
|
||||
/dev/.devfsd
|
||||
/dev/cpu
|
||||
/dev/cpu/mtrr
|
||||
/dev/netlink
|
||||
/dev/netlink/route
|
||||
/dev/netlink/skip
|
||||
/dev/netlink/USERSOCK
|
||||
/dev/netlink/fwmonitor
|
||||
/dev/netlink/ARPD
|
||||
/dev/netlink/ROUTE6
|
||||
/dev/netlink/IP6_FW
|
||||
/dev/netlink/tap0
|
||||
/dev/netlink/tap1
|
||||
/dev/netlink/tap2
|
||||
/dev/netlink/tap3
|
||||
/dev/netlink/tap4
|
||||
/dev/netlink/tap5
|
||||
/dev/netlink/tap6
|
||||
/dev/netlink/tap7
|
||||
/dev/netlink/tap8
|
||||
/dev/netlink/tap9
|
||||
/dev/netlink/tap10
|
||||
/dev/netlink/tap11
|
||||
/dev/netlink/tap12
|
||||
/dev/netlink/tap13
|
||||
/dev/netlink/tap14
|
||||
/dev/netlink/tap15
|
||||
/dev/shm
|
||||
/dev/mem
|
||||
/dev/kmem
|
||||
/dev/null
|
||||
/dev/port
|
||||
/dev/zero
|
||||
/dev/full
|
||||
/dev/random
|
||||
/dev/urandom
|
||||
/dev/tty
|
||||
/dev/console
|
||||
/dev/vc
|
||||
/dev/vc/1
|
||||
/dev/vc/2
|
||||
/dev/vc/3
|
||||
/dev/vc/4
|
||||
/dev/vc/5
|
||||
/dev/vc/6
|
||||
/dev/vc/7
|
||||
/dev/vc/8
|
||||
/dev/vc/9
|
||||
/dev/vc/10
|
||||
/dev/vc/11
|
||||
/dev/vc/12
|
||||
/dev/vc/13
|
||||
/dev/vc/14
|
||||
/dev/vc/15
|
||||
/dev/vc/16
|
||||
/dev/vc/17
|
||||
/dev/vc/18
|
||||
/dev/vc/19
|
||||
/dev/vc/20
|
||||
/dev/vc/21
|
||||
/dev/vc/22
|
||||
/dev/vc/23
|
||||
/dev/vc/24
|
||||
/dev/vc/25
|
||||
/dev/vc/26
|
||||
/dev/vc/27
|
||||
/dev/vc/28
|
||||
/dev/vc/29
|
||||
/dev/vc/30
|
||||
/dev/vc/31
|
||||
/dev/vc/32
|
||||
/dev/vc/33
|
||||
/dev/vc/34
|
||||
/dev/vc/35
|
||||
/dev/vc/36
|
||||
/dev/vc/37
|
||||
/dev/vc/38
|
||||
/dev/vc/39
|
||||
/dev/vc/40
|
||||
/dev/vc/41
|
||||
/dev/vc/42
|
||||
/dev/vc/43
|
||||
/dev/vc/44
|
||||
/dev/vc/45
|
||||
/dev/vc/46
|
||||
/dev/vc/47
|
||||
/dev/vc/48
|
||||
/dev/vc/49
|
||||
/dev/vc/50
|
||||
/dev/vc/51
|
||||
/dev/vc/52
|
||||
/dev/vc/53
|
||||
/dev/vc/54
|
||||
/dev/vc/55
|
||||
/dev/vc/56
|
||||
/dev/vc/57
|
||||
/dev/vc/58
|
||||
/dev/vc/59
|
||||
/dev/vc/60
|
||||
/dev/vc/61
|
||||
/dev/vc/62
|
||||
/dev/vc/63
|
||||
/dev/vc/0
|
||||
/dev/ptmx
|
||||
/dev/misc
|
||||
/dev/misc/psaux
|
||||
/dev/pty
|
||||
/dev/pty/m0
|
||||
/dev/pty/m1
|
||||
/dev/pty/m2
|
||||
/dev/pty/m3
|
||||
/dev/pty/m4
|
||||
/dev/pty/m5
|
||||
/dev/pty/m6
|
||||
/dev/pty/m7
|
||||
/dev/pty/m8
|
||||
/dev/pty/m9
|
||||
/dev/pty/m10
|
||||
/dev/pty/m11
|
||||
/dev/pty/m12
|
||||
/dev/pty/m13
|
||||
/dev/pty/m14
|
||||
/dev/pty/m15
|
||||
/dev/pty/m16
|
||||
/dev/pty/m17
|
||||
/dev/pty/m18
|
||||
/dev/pty/m19
|
||||
/dev/pty/m20
|
||||
/dev/pty/m21
|
||||
/dev/pty/m22
|
||||
/dev/pty/m23
|
||||
/dev/pty/m24
|
||||
/dev/pty/m25
|
||||
/dev/pty/m26
|
||||
/dev/pty/m27
|
||||
/dev/pty/m28
|
||||
/dev/pty/m29
|
||||
/dev/pty/m30
|
||||
/dev/pty/m31
|
||||
/dev/pty/m32
|
||||
/dev/pty/m33
|
||||
/dev/pty/m34
|
||||
/dev/pty/m35
|
||||
/dev/pty/m36
|
||||
/dev/pty/m37
|
||||
/dev/pty/m38
|
||||
/dev/pty/m39
|
||||
/dev/pty/m40
|
||||
/dev/pty/m41
|
||||
/dev/pty/m42
|
||||
/dev/pty/m43
|
||||
/dev/pty/m44
|
||||
/dev/pty/m45
|
||||
/dev/pty/m46
|
||||
/dev/pty/m47
|
||||
/dev/pty/m48
|
||||
/dev/pty/m49
|
||||
/dev/pty/m50
|
||||
/dev/pty/m51
|
||||
/dev/pty/m52
|
||||
/dev/pty/m53
|
||||
/dev/pty/m54
|
||||
/dev/pty/m55
|
||||
/dev/pty/m56
|
||||
/dev/pty/m57
|
||||
/dev/pty/m58
|
||||
/dev/pty/m59
|
||||
/dev/pty/m60
|
||||
/dev/pty/m61
|
||||
/dev/pty/m62
|
||||
/dev/pty/m63
|
||||
/dev/pty/m64
|
||||
/dev/pty/m65
|
||||
/dev/pty/m66
|
||||
/dev/pty/m67
|
||||
/dev/pty/m68
|
||||
/dev/pty/m69
|
||||
/dev/pty/m70
|
||||
/dev/pty/m71
|
||||
/dev/pty/m72
|
||||
/dev/pty/m73
|
||||
/dev/pty/m74
|
||||
/dev/pty/m75
|
||||
/dev/pty/m76
|
||||
/dev/pty/m77
|
||||
/dev/pty/m78
|
||||
/dev/pty/m79
|
||||
/dev/pty/m80
|
||||
/dev/pty/m81
|
||||
/dev/pty/m82
|
||||
/dev/pty/m83
|
||||
/dev/pty/m84
|
||||
/dev/pty/m85
|
||||
/dev/pty/m86
|
||||
/dev/pty/m87
|
||||
/dev/pty/m88
|
||||
/dev/pty/m89
|
||||
/dev/pty/m90
|
||||
/dev/pty/m91
|
||||
/dev/pty/m92
|
||||
/dev/pty/m93
|
||||
/dev/pty/m94
|
||||
/dev/pty/m95
|
||||
/dev/pty/m96
|
||||
/dev/pty/m97
|
||||
/dev/pty/m98
|
||||
/dev/pty/m99
|
||||
/dev/pty/m100
|
||||
/dev/pty/m101
|
||||
/dev/pty/m102
|
||||
/dev/pty/m103
|
||||
/dev/pty/m104
|
||||
/dev/pty/m105
|
||||
/dev/pty/m106
|
||||
/dev/pty/m107
|
||||
/dev/pty/m108
|
||||
/dev/pty/m109
|
||||
/dev/pty/m110
|
||||
/dev/pty/m111
|
||||
/dev/pty/m112
|
||||
/dev/pty/m113
|
||||
/dev/pty/m114
|
||||
/dev/pty/m115
|
||||
/dev/pty/m116
|
||||
/dev/pty/m117
|
||||
/dev/pty/m118
|
||||
/dev/pty/m119
|
||||
/dev/pty/m120
|
||||
/dev/pty/m121
|
||||
/dev/pty/m122
|
||||
/dev/pty/m123
|
||||
/dev/pty/m124
|
||||
/dev/pty/m125
|
||||
/dev/pty/m126
|
||||
/dev/pty/m127
|
||||
/dev/pty/m128
|
||||
/dev/pty/m129
|
||||
/dev/pty/m130
|
||||
/dev/pty/m131
|
||||
/dev/pty/m132
|
||||
/dev/pty/m133
|
||||
/dev/pty/m134
|
||||
/dev/pty/m135
|
||||
/dev/pty/m136
|
||||
/dev/pty/m137
|
||||
/dev/pty/m138
|
||||
/dev/pty/m139
|
||||
/dev/pty/m140
|
||||
/dev/pty/m141
|
||||
/dev/pty/m142
|
||||
/dev/pty/m143
|
||||
/dev/pty/m144
|
||||
/dev/pty/m145
|
||||
/dev/pty/m146
|
||||
/dev/pty/m147
|
||||
/dev/pty/m148
|
||||
/dev/pty/m149
|
||||
/dev/pty/m150
|
||||
/dev/pty/m151
|
||||
/dev/pty/m152
|
||||
/dev/pty/m153
|
||||
/dev/pty/m154
|
||||
/dev/pty/m155
|
||||
/dev/pty/m156
|
||||
/dev/pty/m157
|
||||
/dev/pty/m158
|
||||
/dev/pty/m159
|
||||
/dev/pty/m160
|
||||
/dev/pty/m161
|
||||
/dev/pty/m162
|
||||
/dev/pty/m163
|
||||
/dev/pty/m164
|
||||
/dev/pty/m165
|
||||
/dev/pty/m166
|
||||
/dev/pty/m167
|
||||
/dev/pty/m168
|
||||
/dev/pty/m169
|
||||
/dev/pty/m170
|
||||
/dev/pty/m171
|
||||
/dev/pty/m172
|
||||
/dev/pty/m173
|
||||
/dev/pty/m174
|
||||
/dev/pty/m175
|
||||
/dev/pty/m176
|
||||
/dev/pty/m177
|
||||
/dev/pty/m178
|
||||
/dev/pty/m179
|
||||
/dev/pty/m180
|
||||
/dev/pty/m181
|
||||
/dev/pty/m182
|
||||
/dev/pty/m183
|
||||
/dev/pty/m184
|
||||
/dev/pty/m185
|
||||
/dev/pty/m186
|
||||
/dev/pty/m187
|
||||
/dev/pty/m188
|
||||
/dev/pty/m189
|
||||
/dev/pty/m190
|
||||
/dev/pty/m191
|
||||
/dev/pty/m192
|
||||
/dev/pty/m193
|
||||
/dev/pty/m194
|
||||
/dev/pty/m195
|
||||
/dev/pty/m196
|
||||
/dev/pty/m197
|
||||
/dev/pty/m198
|
||||
/dev/pty/m199
|
||||
/dev/pty/m200
|
||||
/dev/pty/m201
|
||||
/dev/pty/m202
|
||||
/dev/pty/m203
|
||||
/dev/pty/m204
|
||||
/dev/pty/m205
|
||||
/dev/pty/m206
|
||||
/dev/pty/m207
|
||||
/dev/pty/m208
|
||||
/dev/pty/m209
|
||||
/dev/pty/m210
|
||||
/dev/pty/m211
|
||||
/dev/pty/m212
|
||||
/dev/pty/m213
|
||||
/dev/pty/m214
|
||||
/dev/pty/m215
|
||||
/dev/pty/m216
|
||||
/dev/pty/m217
|
||||
/dev/pty/m218
|
||||
/dev/pty/m219
|
||||
/dev/pty/m220
|
||||
/dev/pty/m221
|
||||
/dev/pty/m222
|
||||
/dev/pty/m223
|
||||
/dev/pty/m224
|
||||
/dev/pty/m225
|
||||
/dev/pty/m226
|
||||
/dev/pty/m227
|
||||
/dev/pty/m228
|
||||
/dev/pty/m229
|
||||
/dev/pty/m230
|
||||
/dev/pty/m231
|
||||
/dev/pty/m232
|
||||
/dev/pty/m233
|
||||
/dev/pty/m234
|
||||
/dev/pty/m235
|
||||
/dev/pty/m236
|
||||
/dev/pty/m237
|
||||
/dev/pty/m238
|
||||
/dev/pty/m239
|
||||
/dev/pty/m240
|
||||
/dev/pty/m241
|
||||
/dev/pty/m242
|
||||
/dev/pty/m243
|
||||
/dev/pty/m244
|
||||
/dev/pty/m245
|
||||
/dev/pty/m246
|
||||
/dev/pty/m247
|
||||
/dev/pty/m248
|
||||
/dev/pty/m249
|
||||
/dev/pty/m250
|
||||
/dev/pty/m251
|
||||
/dev/pty/m252
|
||||
/dev/pty/m253
|
||||
/dev/pty/m254
|
||||
/dev/pty/m255
|
||||
/dev/pts
|
||||
/dev/pts/0
|
||||
/dev/pts/1
|
||||
/dev/pts/2
|
||||
/dev/pts/3
|
||||
/dev/pts/4
|
||||
/dev/pts/5
|
||||
/dev/pts/6
|
||||
/dev/pts/7
|
||||
/dev/vcc
|
||||
/dev/vcc/0
|
||||
/dev/vcc/a
|
||||
/dev/vcc/1
|
||||
/dev/vcc/a1
|
||||
/dev/vcc/2
|
||||
/dev/vcc/a2
|
||||
/dev/vcc/3
|
||||
/dev/vcc/a3
|
||||
/dev/vcc/5
|
||||
/dev/vcc/a5
|
||||
/dev/vcc/4
|
||||
/dev/vcc/a4
|
||||
/dev/vcc/6
|
||||
/dev/vcc/a6
|
||||
/dev/vcc/7
|
||||
/dev/vcc/a7
|
||||
/dev/tts
|
||||
/dev/tts/0
|
||||
/dev/cua
|
||||
/dev/cua/0
|
||||
/dev/ide
|
||||
/dev/ide/host0
|
||||
/dev/ide/host0/bus0
|
||||
/dev/ide/host0/bus0/target0
|
||||
/dev/ide/host0/bus0/target0/lun0
|
||||
/dev/ide/host0/bus0/target0/lun0/disc
|
||||
/dev/ide/host0/bus0/target0/lun0/part1
|
||||
/dev/ide/host0/bus0/target0/lun0/part2
|
||||
/dev/ide/host0/bus0/target0/lun0/part3
|
||||
/dev/ide/host0/bus0/target0/lun0/part4
|
||||
/dev/ide/host0/bus0/target0/lun0/part5
|
||||
/dev/ide/host0/bus0/target0/lun0/part6
|
||||
/dev/ide/host0/bus0/target0/lun0/part7
|
||||
/dev/ide/host0/bus0/target0/lun0/part8
|
||||
/dev/ide/host0/bus0/target1
|
||||
/dev/ide/host0/bus0/target1/lun0
|
||||
/dev/ide/host0/bus0/target1/lun0/disc
|
||||
/dev/ide/host0/bus0/target1/lun0/part1
|
||||
/dev/ide/host0/bus1
|
||||
/dev/ide/host0/bus1/target0
|
||||
/dev/ide/host0/bus1/target0/lun0
|
||||
/dev/ide/host0/bus1/target0/lun0/disc
|
||||
/dev/ide/host0/bus1/target0/lun0/part1
|
||||
/dev/ide/host0/bus1/target1
|
||||
/dev/ide/host0/bus1/target1/lun0
|
||||
/dev/discs
|
||||
/dev/discs/disc0
|
||||
/dev/discs/disc1
|
||||
/dev/discs/disc2
|
||||
/dev/floppy
|
||||
/dev/floppy/0u1440
|
||||
/dev/floppy/0u1680
|
||||
/dev/floppy/0u1722
|
||||
/dev/floppy/0u1743
|
||||
/dev/floppy/0u1760
|
||||
/dev/floppy/0u1920
|
||||
/dev/floppy/0u1840
|
||||
/dev/floppy/0u1600
|
||||
/dev/floppy/0u360
|
||||
/dev/floppy/0u720
|
||||
/dev/floppy/0u820
|
||||
/dev/floppy/0u830
|
||||
/dev/floppy/0u1040
|
||||
/dev/floppy/0u1120
|
||||
/dev/floppy/0u800
|
||||
/dev/floppy/0
|
||||
/dev/loop
|
||||
/dev/loop/0
|
||||
/dev/loop/1
|
||||
/dev/loop/2
|
||||
/dev/loop/3
|
||||
/dev/loop/4
|
||||
/dev/loop/5
|
||||
/dev/loop/6
|
||||
/dev/loop/7
|
||||
/dev/cdroms
|
||||
/dev/sound
|
||||
/dev/sound/dsp
|
||||
/dev/sound/dsp1
|
||||
/dev/sound/mixer
|
||||
/dev/sound/midi
|
||||
/dev/usb
|
||||
/dev/root
|
||||
/dev/initctl
|
||||
/dev/xconsole
|
||||
/dev/fd
|
||||
/dev/stdin
|
||||
/dev/stdout
|
||||
/dev/stderr
|
||||
/dev/route
|
||||
/dev/skip
|
||||
/dev/USERSOCK
|
||||
/dev/fwmonitor
|
||||
/dev/ARPD
|
||||
/dev/ROUTE6
|
||||
/dev/IP6_FW
|
||||
/dev/tap0
|
||||
/dev/tap1
|
||||
/dev/tap2
|
||||
/dev/tap3
|
||||
/dev/tap4
|
||||
/dev/tap5
|
||||
/dev/tap6
|
||||
/dev/tap7
|
||||
/dev/tap8
|
||||
/dev/tap9
|
||||
/dev/tap10
|
||||
/dev/tap11
|
||||
/dev/tap12
|
||||
/dev/tap13
|
||||
/dev/tap14
|
||||
/dev/tap15
|
||||
/dev/tty1
|
||||
/dev/tty2
|
||||
/dev/tty3
|
||||
/dev/tty4
|
||||
/dev/tty5
|
||||
/dev/tty6
|
||||
/dev/tty7
|
||||
/dev/tty8
|
||||
/dev/tty9
|
||||
/dev/tty10
|
||||
/dev/tty11
|
||||
/dev/tty12
|
||||
/dev/tty13
|
||||
/dev/tty14
|
||||
/dev/tty15
|
||||
/dev/tty16
|
||||
/dev/tty17
|
||||
/dev/tty18
|
||||
/dev/tty19
|
||||
/dev/tty20
|
||||
/dev/tty21
|
||||
/dev/tty22
|
||||
/dev/tty23
|
||||
/dev/tty24
|
||||
/dev/tty25
|
||||
/dev/tty26
|
||||
/dev/tty27
|
||||
/dev/tty28
|
||||
/dev/tty29
|
||||
/dev/tty30
|
||||
/dev/tty31
|
||||
/dev/tty32
|
||||
/dev/tty33
|
||||
/dev/tty34
|
||||
/dev/tty35
|
||||
/dev/tty36
|
||||
/dev/tty37
|
||||
/dev/tty38
|
||||
/dev/tty39
|
||||
/dev/tty40
|
||||
/dev/tty41
|
||||
/dev/tty42
|
||||
/dev/tty43
|
||||
/dev/tty44
|
||||
/dev/tty45
|
||||
/dev/tty46
|
||||
/dev/tty47
|
||||
/dev/tty48
|
||||
/dev/tty49
|
||||
/dev/tty50
|
||||
/dev/tty51
|
||||
/dev/tty52
|
||||
/dev/tty53
|
||||
/dev/tty54
|
||||
/dev/tty55
|
||||
/dev/tty56
|
||||
/dev/tty57
|
||||
/dev/tty58
|
||||
/dev/tty59
|
||||
/dev/tty60
|
||||
/dev/tty61
|
||||
/dev/tty62
|
||||
/dev/tty63
|
||||
/dev/tty0
|
||||
/dev/psaux
|
||||
/dev/ptyp0
|
||||
/dev/ptyp1
|
||||
/dev/ptyp2
|
||||
/dev/ptyp3
|
||||
/dev/ptyp4
|
||||
/dev/ptyp5
|
||||
/dev/ptyp6
|
||||
/dev/ptyp7
|
||||
/dev/ptyp8
|
||||
/dev/ptyp9
|
||||
/dev/ptypa
|
||||
/dev/ptypb
|
||||
/dev/ptypc
|
||||
/dev/ptypd
|
||||
/dev/ptype
|
||||
/dev/ptypf
|
||||
/dev/ptyq0
|
||||
/dev/ptyq1
|
||||
/dev/ptyq2
|
||||
/dev/ptyq3
|
||||
/dev/ptyq4
|
||||
/dev/ptyq5
|
||||
/dev/ptyq6
|
||||
/dev/ptyq7
|
||||
/dev/ptyq8
|
||||
/dev/ptyq9
|
||||
/dev/ptyqa
|
||||
/dev/ptyqb
|
||||
/dev/ptyqc
|
||||
/dev/ptyqd
|
||||
/dev/ptyqe
|
||||
/dev/ptyqf
|
||||
/dev/ptyr0
|
||||
/dev/ptyr1
|
||||
/dev/ptyr2
|
||||
/dev/ptyr3
|
||||
/dev/ptyr4
|
||||
/dev/ptyr5
|
||||
/dev/ptyr6
|
||||
/dev/ptyr7
|
||||
/dev/ptyr8
|
||||
/dev/ptyr9
|
||||
/dev/ptyra
|
||||
/dev/ptyrb
|
||||
/dev/ptyrc
|
||||
/dev/ptyrd
|
||||
/dev/ptyre
|
||||
/dev/ptyrf
|
||||
/dev/ptys0
|
||||
/dev/ptys1
|
||||
/dev/ptys2
|
||||
/dev/ptys3
|
||||
/dev/ptys4
|
||||
/dev/ptys5
|
||||
/dev/ptys6
|
||||
/dev/ptys7
|
||||
/dev/ptys8
|
||||
/dev/ptys9
|
||||
/dev/ptysa
|
||||
/dev/ptysb
|
||||
/dev/ptysc
|
||||
/dev/ptysd
|
||||
/dev/ptyse
|
||||
/dev/ptysf
|
||||
/dev/ptyt0
|
||||
/dev/ptyt1
|
||||
/dev/ptyt2
|
||||
/dev/ptyt3
|
||||
/dev/ptyt4
|
||||
/dev/ptyt5
|
||||
/dev/ptyt6
|
||||
/dev/ptyt7
|
||||
/dev/ptyt8
|
||||
/dev/ptyt9
|
||||
/dev/ptyta
|
||||
/dev/ptytb
|
||||
/dev/ptytc
|
||||
/dev/ptytd
|
||||
/dev/ptyte
|
||||
/dev/ptytf
|
||||
/dev/ptyu0
|
||||
/dev/ptyu1
|
||||
/dev/ptyu2
|
||||
/dev/ptyu3
|
||||
/dev/ptyu4
|
||||
/dev/ptyu5
|
||||
/dev/ptyu6
|
||||
/dev/ptyu7
|
||||
/dev/ptyu8
|
||||
/dev/ptyu9
|
||||
/dev/ptyua
|
||||
/dev/ptyub
|
||||
/dev/ptyuc
|
||||
/dev/ptyud
|
||||
/dev/ptyue
|
||||
/dev/ptyuf
|
||||
/dev/ptyv0
|
||||
/dev/ptyv1
|
||||
/dev/ptyv2
|
||||
/dev/ptyv3
|
||||
/dev/ptyv4
|
||||
/dev/ptyv5
|
||||
/dev/ptyv6
|
||||
/dev/ptyv7
|
||||
/dev/ptyv8
|
||||
/dev/ptyv9
|
||||
/dev/ptyva
|
||||
/dev/ptyvb
|
||||
/dev/ptyvc
|
||||
/dev/ptyvd
|
||||
/dev/ptyve
|
||||
/dev/ptyvf
|
||||
/dev/ptyw0
|
||||
/dev/ptyw1
|
||||
/dev/ptyw2
|
||||
/dev/ptyw3
|
||||
/dev/ptyw4
|
||||
/dev/ptyw5
|
||||
/dev/ptyw6
|
||||
/dev/ptyw7
|
||||
/dev/ptyw8
|
||||
/dev/ptyw9
|
||||
/dev/ptywa
|
||||
/dev/ptywb
|
||||
/dev/ptywc
|
||||
/dev/ptywd
|
||||
/dev/ptywe
|
||||
/dev/ptywf
|
||||
/dev/ptyx0
|
||||
/dev/ptyx1
|
||||
/dev/ptyx2
|
||||
/dev/ptyx3
|
||||
/dev/ptyx4
|
||||
/dev/ptyx5
|
||||
/dev/ptyx6
|
||||
/dev/ptyx7
|
||||
/dev/ptyx8
|
||||
/dev/ptyx9
|
||||
/dev/ptyxa
|
||||
/dev/ptyxb
|
||||
/dev/ptyxc
|
||||
/dev/ptyxd
|
||||
/dev/ptyxe
|
||||
/dev/ptyxf
|
||||
/dev/ptyy0
|
||||
/dev/ptyy1
|
||||
/dev/ptyy2
|
||||
/dev/ptyy3
|
||||
/dev/ptyy4
|
||||
/dev/ptyy5
|
||||
/dev/ptyy6
|
||||
/dev/ptyy7
|
||||
/dev/ptyy8
|
||||
/dev/ptyy9
|
||||
/dev/ptyya
|
||||
/dev/ptyyb
|
||||
/dev/ptyyc
|
||||
/dev/ptyyd
|
||||
/dev/ptyye
|
||||
/dev/ptyyf
|
||||
/dev/ptyz0
|
||||
/dev/ptyz1
|
||||
/dev/ptyz2
|
||||
/dev/ptyz3
|
||||
/dev/ptyz4
|
||||
/dev/ptyz5
|
||||
/dev/ptyz6
|
||||
/dev/ptyz7
|
||||
/dev/ptyz8
|
||||
/dev/ptyz9
|
||||
/dev/ptyza
|
||||
/dev/ptyzb
|
||||
/dev/ptyzc
|
||||
/dev/ptyzd
|
||||
/dev/ptyze
|
||||
/dev/ptyzf
|
||||
/dev/ptya0
|
||||
/dev/ptya1
|
||||
/dev/ptya2
|
||||
/dev/ptya3
|
||||
/dev/ptya4
|
||||
/dev/ptya5
|
||||
/dev/ptya6
|
||||
/dev/ptya7
|
||||
/dev/ptya8
|
||||
/dev/ptya9
|
||||
/dev/ptyaa
|
||||
/dev/ptyab
|
||||
/dev/ptyac
|
||||
/dev/ptyad
|
||||
/dev/ptyae
|
||||
/dev/ptyaf
|
||||
/dev/ptyb0
|
||||
/dev/ptyb1
|
||||
/dev/ptyb2
|
||||
/dev/ptyb3
|
||||
/dev/ptyb4
|
||||
/dev/ptyb5
|
||||
/dev/ptyb6
|
||||
/dev/ptyb7
|
||||
/dev/ptyb8
|
||||
/dev/ptyb9
|
||||
/dev/ptyba
|
||||
/dev/ptybb
|
||||
/dev/ptybc
|
||||
/dev/ptybd
|
||||
/dev/ptybe
|
||||
/dev/ptybf
|
||||
/dev/ptyc0
|
||||
/dev/ptyc1
|
||||
/dev/ptyc2
|
||||
/dev/ptyc3
|
||||
/dev/ptyc4
|
||||
/dev/ptyc5
|
||||
/dev/ptyc6
|
||||
/dev/ptyc7
|
||||
/dev/ptyc8
|
||||
/dev/ptyc9
|
||||
/dev/ptyca
|
||||
/dev/ptycb
|
||||
/dev/ptycc
|
||||
/dev/ptycd
|
||||
/dev/ptyce
|
||||
/dev/ptycf
|
||||
/dev/ptyd0
|
||||
/dev/ptyd1
|
||||
/dev/ptyd2
|
||||
/dev/ptyd3
|
||||
/dev/ptyd4
|
||||
/dev/ptyd5
|
||||
/dev/ptyd6
|
||||
/dev/ptyd7
|
||||
/dev/ptyd8
|
||||
/dev/ptyd9
|
||||
/dev/ptyda
|
||||
/dev/ptydb
|
||||
/dev/ptydc
|
||||
/dev/ptydd
|
||||
/dev/ptyde
|
||||
/dev/ptydf
|
||||
/dev/ptye0
|
||||
/dev/ptye1
|
||||
/dev/ptye2
|
||||
/dev/ptye3
|
||||
/dev/ptye4
|
||||
/dev/ptye5
|
||||
/dev/ptye6
|
||||
/dev/ptye7
|
||||
/dev/ptye8
|
||||
/dev/ptye9
|
||||
/dev/ptyea
|
||||
/dev/ptyeb
|
||||
/dev/ptyec
|
||||
/dev/ptyed
|
||||
/dev/ptyee
|
||||
/dev/ptyef
|
||||
/dev/vcs
|
||||
/dev/vcsa
|
||||
/dev/vcs1
|
||||
/dev/vcsa1
|
||||
/dev/ttyS0
|
||||
/dev/cua0
|
||||
/dev/hda
|
||||
/dev/hda1
|
||||
/dev/hda2
|
||||
/dev/hda3
|
||||
/dev/hda4
|
||||
/dev/hda5
|
||||
/dev/hda6
|
||||
/dev/hda7
|
||||
/dev/hda8
|
||||
/dev/hdb
|
||||
/dev/hdb1
|
||||
/dev/hdc
|
||||
/dev/hdc1
|
||||
/dev/fd0u1440
|
||||
/dev/fd0u1680
|
||||
/dev/fd0u1722
|
||||
/dev/fd0u1743
|
||||
/dev/fd0u1760
|
||||
/dev/fd0u1920
|
||||
/dev/fd0u1840
|
||||
/dev/fd0u1600
|
||||
/dev/fd0u360
|
||||
/dev/fd0u720
|
||||
/dev/fd0u820
|
||||
/dev/fd0u830
|
||||
/dev/fd0u1040
|
||||
/dev/fd0u1120
|
||||
/dev/fd0u800
|
||||
/dev/fd0
|
||||
/dev/loop0
|
||||
/dev/loop1
|
||||
/dev/loop2
|
||||
/dev/loop3
|
||||
/dev/loop4
|
||||
/dev/loop5
|
||||
/dev/loop6
|
||||
/dev/loop7
|
||||
/dev/dsp
|
||||
/dev/dsp1
|
||||
/dev/mixer
|
||||
/dev/midi
|
||||
/dev/lvm
|
||||
/dev/vg0
|
||||
/dev/vg0/group
|
||||
/dev/vg0/packages
|
||||
/dev/vg0/photos
|
||||
/dev/vg0/music
|
||||
/dev/log
|
||||
/dev/MAKEDEV
|
||||
/dev/printer
|
||||
/dev/vcs2
|
||||
/dev/vcsa2
|
||||
/dev/vcs3
|
||||
/dev/vcsa3
|
||||
/dev/vcs5
|
||||
/dev/vcsa5
|
||||
/dev/vcs4
|
||||
/dev/vcsa4
|
||||
/dev/vcs6
|
||||
/dev/vcsa6
|
||||
/dev/nvidia0
|
||||
/dev/nvidia1
|
||||
/dev/nvidia2
|
||||
/dev/nvidia3
|
||||
/dev/nvidiactl
|
||||
/dev/vcs7
|
||||
/dev/vcsa7
|
|
@ -1,143 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 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 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
|
||||
*/
|
||||
|
||||
#include "matcher.h"
|
||||
#include "log.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
|
||||
static int _read_spec(const char *file, char ***regex, int *nregex)
|
||||
{
|
||||
char buffer[1024], *start, *ptr;
|
||||
FILE *fp = fopen(file, "r");
|
||||
int asize = 100;
|
||||
char **rx = dbg_malloc(sizeof(*rx) * asize);
|
||||
int nr = 0;
|
||||
|
||||
if (!fp)
|
||||
return 0;
|
||||
|
||||
while (fgets(buffer, sizeof(buffer),fp)) {
|
||||
|
||||
/* trim leading whitespace */
|
||||
for (ptr = buffer; *ptr && isspace((int) *ptr); ptr++);
|
||||
|
||||
if (!*ptr || *ptr == '#')
|
||||
continue;
|
||||
|
||||
if (*ptr == '\"') {
|
||||
ptr++;
|
||||
start = ptr;
|
||||
while (*ptr && *ptr != '\"') {
|
||||
if (*ptr == '\\')
|
||||
ptr++;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (!*ptr) {
|
||||
fprintf(stderr, "Formatting error : "
|
||||
"No terminating quote\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
rx[nr] = dbg_malloc((ptr - start) + 1);
|
||||
strncpy(rx[nr], start, ptr - start);
|
||||
rx[nr][ptr - start] = '\0';
|
||||
nr++;
|
||||
} else {
|
||||
fprintf(stderr, "%s", ptr);
|
||||
fprintf(stderr, "Formatting error : \"<regex>\" "
|
||||
"<token_name>\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
*regex = rx;
|
||||
*nregex = nr;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void _free_regex(char **regex, int nregex)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < nregex; i++)
|
||||
dbg_free(regex[i]);
|
||||
|
||||
dbg_free(regex);
|
||||
}
|
||||
|
||||
static void _scan_input(struct matcher *m, char **regex)
|
||||
{
|
||||
char buffer[256], *ptr;
|
||||
int r;
|
||||
|
||||
while (fgets(buffer, sizeof(buffer), stdin)) {
|
||||
if ((ptr = strchr(buffer, '\n')))
|
||||
*ptr = '\0';
|
||||
|
||||
r = matcher_run(m, buffer);
|
||||
|
||||
if (r >= 0)
|
||||
printf("%s : %s\n", buffer, regex[r]);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct dm_pool *mem;
|
||||
struct matcher *scanner;
|
||||
char **regex;
|
||||
int nregex;
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "Usage : %s <pattern_file>\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
init_log(stderr);
|
||||
init_debug(_LOG_DEBUG);
|
||||
|
||||
if (!(mem = dm_pool_create(10 * 1024))) {
|
||||
fprintf(stderr, "Couldn't create pool\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
if (!_read_spec(argv[1], ®ex, &nregex)) {
|
||||
fprintf(stderr, "Couldn't read the lex specification\n");
|
||||
exit(3);
|
||||
}
|
||||
|
||||
if (!(scanner = matcher_create(mem, (const char **) regex, nregex))) {
|
||||
fprintf(stderr, "Couldn't build the lexer\n");
|
||||
exit(4);
|
||||
}
|
||||
|
||||
_scan_input(scanner, regex);
|
||||
_free_regex(regex, nregex);
|
||||
dm_pool_destroy(mem);
|
||||
|
||||
dump_memory();
|
||||
fin_log();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 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 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
|
||||
*/
|
||||
|
||||
#include "log.h"
|
||||
#include "../../lib/regex/parse_rx.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
static void _pretty_print(struct rx_node *rx, int depth)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < depth; i++)
|
||||
printf(" ");
|
||||
|
||||
/* display info about the node */
|
||||
switch (rx->type) {
|
||||
case CAT:
|
||||
printf("Cat");
|
||||
break;
|
||||
|
||||
case OR:
|
||||
printf("Or");
|
||||
break;
|
||||
|
||||
case STAR:
|
||||
printf("Star");
|
||||
break;
|
||||
|
||||
case PLUS:
|
||||
printf("Plus");
|
||||
break;
|
||||
|
||||
case QUEST:
|
||||
printf("Quest");
|
||||
break;
|
||||
|
||||
case CHARSET:
|
||||
printf("Charset : ");
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (bit(rx->charset, i) && isprint(i))
|
||||
printf("%c", (char) i);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Unknown type");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
if (rx->left)
|
||||
_pretty_print(rx->left, depth + 1);
|
||||
|
||||
if (rx->right)
|
||||
_pretty_print(rx->right, depth + 1);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct dm_pool *mem;
|
||||
struct rx_node *rx;
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Usage : %s <regex>\n", argv[0]);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
init_log(stderr);
|
||||
init_debug(_LOG_INFO);
|
||||
|
||||
if (!(mem = dm_pool_create(1024))) {
|
||||
fprintf(stderr, "Couldn't create pool\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!(rx = rx_parse_str(mem, argv[1]))) {
|
||||
fprintf(stderr, "Couldn't parse regex\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
_pretty_print(rx, 0);
|
||||
dm_pool_destroy(mem);
|
||||
|
||||
dump_memory();
|
||||
fin_log();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue